----- Original Message -----
From: <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Tuesday, April 17, 2001 8:48 AM
Subject: Re: Features in xerces
>
>
> Hi Brett,
>
> I tried your code fragment, but couldn't reproduce your error. I
> couldn't see anything obviously wrong, but my threshold for what is
obvious
> is probably higher than that of some of the others on this mailing list.
>
> Could I ask you to try inserting the following lines in your "catch"
> clauses, and to let us know the results? That should help pinpoint where
> things are going wrong.
>
> System.out.println("msg: "+e.getMessage());
> e.printStackTrace();
Now I'm really confused... here's the stack trace:
C:\javaxml2\build>java javaxml2.SAXTreeViewer
c:\javaxml2\ch04\xml\contents.xml
Message: http://xml.org/sax/properties/xml-string
org.xml.sax.SAXNotSupportedException:
http://xml.org/sax/properties/xml-string
at
org.apache.xerces.framework.XMLParser.getXMLString(XMLParser.java:862
)
at
org.apache.xerces.framework.XMLParser.getProperty(XMLParser.java:1587
)
at
org.apache.xerces.parsers.SAXParser.getProperty(SAXParser.java:852)
at javaxml2.JTreeContentHandler.startElement(SAXTreeViewer.java:320)
at org.apache.xerces.parsers.SAXParser.startElement(SAXParser.java,
Comp
iled Code)
at
org.apache.xerces.validators.common.XMLValidator.callStartElement(XML
Validator.java, Compiled Code)
at
org.apache.xerces.framework.XMLDocumentScanner.scanElement(XMLDocumen
tScanner.java, Compiled Code)
at
org.apache.xerces.framework.XMLDocumentScanner$ContentDispatcher.disp
atch(XMLDocumentScanner.java, Compiled Code)
at
org.apache.xerces.framework.XMLDocumentScanner.parseSome(XMLDocumentS
canner.java, Compiled Code)
at org.apache.xerces.framework.XMLParser.parse(XMLParser.java:952)
at javaxml2.SAXTreeViewer.buildTree(SAXTreeViewer.java:110)
at javaxml2.SAXTreeViewer.init(SAXTreeViewer.java:65)
at javaxml2.SAXTreeViewer.main(SAXTreeViewer.java:138)
The parser class org.apache.xerces.parsers.SAXParser does not support the
featur
e URI http://apache.org/xml/features/validation/schema
What's odd is that the choking happens on the schema feature, but it looks
like somewhere deep down, that triggers a call to the string interning
feature, which is what actually crashes things. Any ideas? I upgraded to the
latest Xerces (1.3.1) just to be sure, but still get this.
-Brett
>
> Thanks,
>
> Henry
> ------------------------------------------------------------------------
> Henry Zongaro XML Parsers development
> IBM SWS Toronto Lab Tie Line 778-6044; Phone (416) 448-6044
> mailto:[EMAIL PROTECTED]
>
>
> "Brett McLaughlin" <[EMAIL PROTECTED]> on 2001/04/16 10:04:18 PM
>
> Please respond to [EMAIL PROTECTED]
>
> To: <[EMAIL PROTECTED]>
> cc:
> Subject: Features in xerces
>
>
> I'm having some weird behavior trying to set features on an instance of an
> XMLReader, created with the org.apache.xerces.parsers.SAXParser class, and
> would love some clarification.
>
> Here's the relevant code fragment:
>
> String featureURI = "";
>
> try {
> // Create instances needed for parsing
> XMLReader reader =
> XMLReaderFactory.createXMLReader(vendorParserClass);
> ContentHandler jTreeContentHandler =
> new JTreeContentHandler(treeModel, base, reader);
> ErrorHandler jTreeErrorHandler = new JTreeErrorHandler();
>
> // Register content handler
> reader.setContentHandler(jTreeContentHandler);
>
> // Register error handler
> reader.setErrorHandler(jTreeErrorHandler);
>
> /** Deal with features **/
> featureURI = "http://xml.org/sax/features/validation";
>
> // Request validation
> reader.setFeature(featureURI, true);
>
> // Namespace processing - on
> featureURI = "http://xml.org/sax/features/namespaces";
> setNamespaceProcessing(reader, true);
>
> // Turn off schema processing
> featureURI =
> "http://apache.org/xml/features/validation/schema";
> reader.setFeature(featureURI, false);
>
> // Parse
> InputSource inputSource =
> new InputSource(xmlURI);
> reader.parse(inputSource);
> } catch (SAXNotRecognizedException e) {
> System.out.println("The parser class " + vendorParserClass +
> " does not recognize the feature URI " + featureURI);
> System.exit(0);
> } catch (SAXNotSupportedException e) {
> System.out.println("The parser class " + vendorParserClass +
> " does not support the feature URI " + featureURI);
> System.exit(0);
> }
>
> In this code, vendorParserClass is set to the value
> org.apache.xerces.parsers.SAXParser, and it works great without any
> features. However, each of these features triggers an error (commenting
out
> one generates an error on the next):
>
> The parser class org.apache.xerces.parsers.SAXParser does not support the
> featur
> e URI http://apache.org/xml/features/validation/schema
>
> Any ideas on what's going on? I'm using Xerces 1.3.0.
>
> Thanks,
> Brett
>
>
> ---------------------------------------------------------------------
> 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]