Hi Jessica,
thanks for your answer. This looks as easy, as I thought it could
be, but... ;-)
Jessica Perry Hekman wrote:
:
> Questions welcome, answers not guaranteed.
:
Would be fine, if you had some answers for me.
> public void fix (String nodeName) throws Exception {
> DocumentImpl doc = (DocumentImpl) this.parser.getDocument();
> XMLValidator val = this.parser.getValidator();
Which parser provides the method getValidator()?
I couldn't find it in the apidocs (Xerces-J 1.4.1/1.4.3/2.0.0.beta2)
Do I have to set up the Grammar, XMLValidator etc. manually for a
"customized" parser? That's what I hoped to avoid ;-)
> Node node, parent;
> NodeList nl = doc.getElementsByTagName(nodeName);
>
> for (int i = 0; i < nl.getLength(); i++) {
> node = nl.item(i);
> parent = node.getParentNode();
> InsertableElementsInfo info =
> this.makeInfoObject (node);
Do you construct thie InsertableElementsInfo completely new (e.g.
based on the schema tree - should be easy), or is it possible to get
(at least) the possibleChildren[] from where ever the
parser/validator stored this info on parsing the DTD/schema?
> int failedIndex =
> val.whatCanGoHere
> (this.getElementDeclIndex
> (this.getElementIndex(parent.getNodeName())),
> true, info);
:
> protected int getElementDeclIndex (int elementIndex)
> throws Exception {
:
> XMLValidator val = this.parser.getValidator();
> Grammar g = val.getGrammar();
Again I cannot see the method getGrammar() in the apidocs of
XMLValidator!?
>
> if (g == null) {
> throw new Exception
> ("FixInvalidXML failed to locate grammar object");
> }
> return(g.getElementDeclIndex(elementIndex, -1));
> }
:
--begin:vcard
n:Th�nnessen;Andreas
tel;cell:(+49)-175-9633552
tel;fax:(+49)-89-321407-12
tel;home:(+49)-8031-807856
tel;work:(+49)-89-321407-22
x-mozilla-html:FALSE
url:http://www.philosys.de/
org:Philosys Software GmbH;<BR><DIV align="left"><IMG SRC=http://www.philosys.de/~andreas/img/philosys.gif></DIV>
adr:;;Edisonstr. 6;Unterschlei�heim;Bayern;85716;Germany
version:2.1
email;internet:[EMAIL PROTECTED]
title:Dipl. Ing. FH Elektrotechnik / Datentechnik
fn:Andreas Th�nnessen
end:vcard
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]