Here is how I parse my XML:
// instantiate parser
DOMParser parser = new DOMParser();
// parsing document from URI string
parser.parse(this.documentURI);
// querying document after parse
this.doc = parser.getDocument();
Here is a snippet of my XML:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE webapp SYSTEM "webapp.dtd">
<webapp name="rentalnet">
Do I have to do anything in code to tell it to validate against the DTD?
-----Original Message-----
From: Joseph Kesselman [mailto:[EMAIL PROTECTED]
Sent: Monday, November 10, 2003 2:48 PM
To: [EMAIL PROTECTED]
Subject: RE: #text when parsing xml
Whitespace *IS* text in XML; see the XML spec.
*IF* you are validating against a DTD (I'm not sure about schema), it is
possible to have whitespace that occurs in places where only elements were
expected marked as "whitespace in element content". (SAX,
erroneously-but-uncorrectably, calls this "ignorable whitespace".) Your
application can then filter it out. I believe Xerces offers a feature which
will perform this filtering for you. Note that whitespace adjacent to other
text is considered part of that text and can NOT be filtered out at this
level; if your application considers the space irrelevant in that case ,
*it* must take responsibility for discarding it.
See also the xml:space directive, which is another way to help tell
applications which whitespace is and isn't meaningful. I'm not sure whether
Xerces provides filtering on this criterion, or if you're required to
implement that yourself.
______________________________________
Joe Kesselman, IBM Next-Generation Web Technologies: XML, XSL and more.
"The world changed profoundly and unpredictably the day Tim Berners Lee
got bitten by a radioactive spider." -- Rafe Culpin, in r.m.filk
---------------------------------------------------------------------
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]