xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jean-guillaume.battag...@inexware.fr
Subject Namespace feature using a SAX parser with JAXP.
Date Thu, 16 Aug 2001 12:52:46 GMT
<FONT face="Default Sans Serif, Verdana, Arial, Helvetica, sans-serif" size=2><div>Hi.</div><DIV>&nbsp;</DIV><DIV>On
David Megginson page titled "SAX2 Namespace Support", I've read this:</DIV><DIV><H2><FONT
color=#9900ff>2. Configuration</FONT></H2><DIV><H3><FONT color=#9900ff>2.1.
Configuring Namespace Support</FONT></H3><P><FONT color=#9900ff>The
"http://xml.org/features/namespaces" feature controls general Namespace processing: when this
feature is true (the default), Namespace URIs and local names must be available through the
<VAR>startElement</VAR> and <VAR>endElement</VAR> callbacks in the
</FONT><A href="http://www.megginson.com/SAX/Java/javadoc/org/xml/sax/ContentHandler.html"
target=blank><FONT color=#9900ff>ContentHandler</FONT></A><FONT color=#9900ff>
interface, and through the various methods in the </FONT><A href="http://www.megginson.com/SAX/Java/javadoc/org/xml/sax/Attributes.html"
target=blank><FONT color=#9900ff>Attributes</FONT></A><FONT color=#9900ff>
interface, and start/endPrefixMapping events must be reported.</FONT></P><P>&nbsp;</P><P>This
means the default value for the "http://xml.org/features/namespaces" feature should be true.</P><P>When
I instantiate my SAXParser "directly" using the following code :</P><P><FONT
color=#0000ff>XMLReader myReader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");<BR></FONT></P><P>I
can check that the following&nbsp;code : <FONT color=#0000ff>myReader.getFeature("http://xml.org/sax/features/namespaces")</FONT>
returns "true".</P><P>That seems correct.</P><P>&nbsp;</P><P>But
when I use JAXP like this :</P><P><FONT color=#0000cc>SAXParserFactory factory
= SAXParserFactory.newInstance();</FONT></P><P><FONT color=#0000cc>SAXParser
saxParser = factory.newSAXParser();</FONT></P><P><FONT color=#0000cc>XMLReader
myReader = saxParser.getXMLReader();<BR></FONT></P><P>I can check
that <FONT color=#0000cc>saxParser.isNamespaceAware() </FONT>or <FONT color=#0000cc>myReader.getFeature("http://xml.org/sax/features/namespaces")
</FONT>both return false.</P><P>Is it normal ?</P><P>If it is,
why isn't JAXP (or maybe xerces implementation of SAXParserFactory) respecting SAX2 specification
?</P><P>&nbsp;</P><P>Thanks.</P><P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
Jean-Guillaume.</P><P>P.S. : I hope I didn't make a mistake sending this question
to the "general mailing-list" but I think the answer could be of some interest for different
kind of projects.<BR></P></DIV></DIV></FONT>
---------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          general-unsubscribe@xml.apache.org
For additional commands, e-mail: general-help@xml.apache.org


Mime
View raw message