The name says it all, Alex: it's a parser that parses
an XML document and creates a DOM tree.  

Your DocumentBuilder is probably using one behind the
scenes to do the same thing.

The only difference is that you're
DocumentBuilderFactory uses methods like
setNamespaceAware() and setValidating() instead of the
XML-Apache setFeature() method on the DOMParser class
itself.  I'll try that and see if it makes a
difference.  

Thanks for the suggestion - anything helps.  What I'm
doing now is obviously wrong, because I'm not failing
when I parse invalid documents! - MOD


--- Alex Neth <[EMAIL PROTECTED]> wrote:

<HR>
<html><head></head><body>I don't use the DOMParser
class.&nbsp; What is the purpose of this class?&nbsp;
I use the following method to parse the document:<br>
<br>
 &nbsp;&nbsp; DocumentBuilderFactory docFactory =
DocumentBuilderFactory.newInstance();<br>
 &nbsp;&nbsp; docFactory.setNamespaceAware(true);<br>
 &nbsp;&nbsp; docFactory.setValidating(true);<br>
 &nbsp;&nbsp; try {<br>
 &nbsp;&nbsp; &nbsp; docBuilder_ =
docFactory.newDocumentBuilder();<br>
 &nbsp;&nbsp; } catch (ParserConfigurationException e)
{<br>
 &nbsp;&nbsp; }<br>
 &nbsp;&nbsp; Document&nbsp; doc =
docBuilder_.parse(f);<br>
<br>
Shouldn't enabling validation here work?<br>
<br>
It definitely does something because I don't get the
"grammar not found" error when validation is set to
false.<br>
<br>
Also, the validation "feature" has "sax" in the
feature name.&nbsp; I would think that means it's a
SAX specific feature.<br>
<br>
Thanks<br>
<br>
<br>
Ian Roberts wrote:<br>
<blockquote type="cite"
cite="mid:[EMAIL PROTECTED]"><pre
wrap="">On Wed, 21 Feb 2001, Alex Neth
wrote:<br><br></pre>
  <blockquote type="cite"><pre wrap="">Also, does
validation have to be enabled in order to get the
parser to load<br>the schema and apply fixed/default
attribute values?<br></pre></blockquote>
    <pre wrap=""><!----><br>To get the parser to do
schema validation at all, you need to set
the<br>validation, validation/schema and namespaces
features (see the Features<br>page of the xerces-j
website for the exact feature
URIs).<br><br>Ian<br><br></pre>
    </blockquote>
    <br>
</body></html>


---------------------------------------------------------------------
To unsubscribe, e-mail:
[EMAIL PROTECTED]
For additional commands, e-mail:
[EMAIL PROTECTED]



__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! 
http://auctions.yahoo.com/

Reply via email to