-
SAXParser displays error when parsing <xi:include
Hi All,
Even though I passed the following argument to the JVM when calling my parser class, the parser displays error
---JVM argument--
SOME_VAR=-Dorg.apache.xerces.xni.parser.XMLParserConfiguration=org.apache.xerces.parsers.XIncludePar serConfiguration
----Error----
cvc-complex-type.2.4.a: Invalid content was found starting with element 'myFile'. One of 'xx' is expected
When I add
myParser.setFeature("http://apache.org/xml/features/xinclude", true); , before parsing, I get no error.
Since I have already passed the [org.apache.xerces.xni.parser.XMLParserConfiguration
argument], I should not have needed to 'setFeature' that stuff, right?
Please advise if you know what is going on here.
Thank you for your time.
***
Here is what I did:
(1)create a parser (saxparser)
(2) set some properties
(3) parse
Here is sample
<pre>
private SAXParser SP;
SP.setFeature("http://xml.org/sax/features/validation",true);
SP.setFeature("http://apache.org/xml/features/validation/schema", true);
SP.setFeature("http://xml.org/sax/features/namespace-prefixes",false);
SP.setFeature("http://xml.org/sax/features/namespaces",true);
SP.setErrorHandler(new MyErrorHandler());
SP.setProperty("http://apache.org/xml/properties/schema/external-schemaLocation",targetNamespace);
//now parsing ...
SP.parse((String)filename);
</pre>
Cheers,
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
Forum Rules
|
Top DevX Stories
Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL
|
Bookmarks