xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From John Robert Gardner <John.Robert.Gard...@east.sun.com>
Subject Building DTD-compliant DOM
Date Mon, 11 Sep 2000 14:52:44 GMT
Again a question re. Xerces, and as I don't work with it enough to be on that 
list, please forward it as need be if that's a better forum.  I'm sure someone 
has looked at this before.  My colleague and I have looked for something like 
this in archives and Faq's, but to no avail.

<snip>
Okay, the crux of the question is:

In Java, using Xerces, how do you build, from scratch, a DOM tree that is
compliant with a specified DTD?

What I am doing is this: I'm creating my DOM tree, appending the elements,
and writing it out to a file. I thought the DOM tree is supposed to be
compliant with the DTD I specified in my DocumentType object, because I
constructed it with a reference to my DocumentTypeImpl object:

outDoc = new DocumentImpl(dti); // dti is my DocumentTypeImpl

Further, when I spit out the document, it does NOT contain a reference to my
DTD -- shouldn't it be doing that?

Do I have to manually order the elements to be compliant with my DTD? If so,
how can I get access to the DTD itself to find out the order of the
elements? In the older (1.1) IBM4J parser, there was a DTD class that you
could use to find out the specification of the element order. In the Xerces
parser, I see no access to the DTD whatsoever.

I have attempted to use SAX, but abandoned the effort because I need
non-linear access to an original document (this effort is following
references that could be referenced in any order, I need to have
random-access to the document).

So -- any thoughts?

</snip>

another tyvmia,

jr

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-|
John Robert Gardner
Enterprise Management Architecture Group
Sun Microsystems Inc.,
MailStop UBUR02-306			
1 Network Drive
Burlington, MA  01803-0903		|  "Earn this"
					|  
Ph. 781-442-0692			|  -Capt. John H. Miller
Fax 781-442-1539			|   Saving Private Ryan
e-mail  john.robert.gardner@sun.com
-----------------------------------
http://vedavid.org/diss/
http://vedavid.org/xml/docs/



Mime
View raw message