xml-general mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Edwin Goei <Edwin.G...@eng.sun.com>
Subject Re: question about xerces 1.2.3 and jaxp
Date Fri, 19 Jan 2001 17:56:05 GMT
Scott McLaughlin wrote:
> 
> I am trying to use the setFeature method of javax.xml.parsers.SAXParserFactory, but I
am running  into a problem when I run the application.
> 
> Here is the code I am using :
> 
> SAXParserFactory factory = SAXParserFactory.newInstance();
> factory.setFeature("http://xml.org/sax/features/namespace-prefixes", false);
> SAXParser parser = factory.newSAXParser();
> 
> when I run this code I get the following Error:
> 
> Error in parsing: Feature: http://xml.org/sax/features/namespace-prefixes
> 
> If I replace the factory.setFeature() call with the one below after I create the parser
I don't get the error.
> parser.getXMLReader().setFeature("http://xml.org/sax/features/namespace-prefixes", false);
> 
> What I am trying to find out,
> is this a known problem or is it something I am doing wrong?

The SAXParserFactory.setFeature() method is part of JAXP 1.1, which
hasn't been fully implemented yet.  (All the JAXP 1.0 features should
work, however.)  The workaround you use is fine.  It uses JAXP to get
the system default parser (unlike SAX which forces the app to specify)
and uses SAX2 to set features, which makes the app portable.

-Edwin

Mime
View raw message