Hello Elena,
The code I had was built around a sample and I didn't realize that the
doctype was handled in the way you explained. Thank you for that. I have
been able to reconstruct the DOCTYPE statement for a DOM Tree that
originally had the DOCTYPE line specified.
The other point of my original question was the more relevant part to me
though. If I have an XML document that does not have a DOCTYPE line
specified in the XML is there any way at parse time to specify which DTD to
use? For example, if I have a very simple XML file (or any other input
source) like the one below without a DOCTYPE statement...
<fred>
<name>bill</name>
</fred>
... is there anyway to specify a on the DOMParser.parse that it should be
parsed using "fred.dtd" as if it had been written...
<!DOCTYPE fred SYSTEM 'fred.dtd'>
<fred>
<name>bill</name>
</fred>
As a last addendum to the above, in a normal parsing case as well as the
case above when the DTD is just specified as SYSTEM "name.dtd" what are the
rules that decide were this DTD file is checked for? It finds the DTD if
it is in the same directory but does not seem to find it from the CLASSPATH
as I expected. If you parse an XML document from, for example, an
InputSource rather than from a file there is no local directory for the
parser to look for the DTD.
Cheers ... Dave
Elena
Litani/Toronto/IB To: [EMAIL PROTECTED]
[EMAIL PROTECTED] cc:
Subject: Re: Validating XML
output from a DOM Tree
25/03/2002 18:21
Please respond to
xerces-j-user
Dave Barfield wrote:
> With both of these methods I can recreate the original XML by recursing
> through the tree and, for example, outputting the contents of the tree to
a
> StringBuffer. At this point the DOCTYPE line is gone as it doesn't
appear
> to have been stored in the DOM Tree.
What do you mean the doctype line is gone? If you parse a document with
a doctype, the Document.getDoctype() should return the doctype node
(unless we have a bug in our implementation..).
It would be helpful if you attach the code you've wrote.
Thanks!
--
Elena Litani / IBM Toronto
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]