You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-dev@xerces.apache.org by bu...@apache.org on 2002/06/21 10:18:34 UTC
DO NOT REPLY [Bug 10102] New: -
DOM parser throws exception doing XML Schema Validation
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10102>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND
INSERTED IN THE BUG DATABASE.
http://nagoya.apache.org/bugzilla/show_bug.cgi?id=10102
DOM parser throws exception doing XML Schema Validation
Summary: DOM parser throws exception doing XML Schema Validation
Product: Xerces2-J
Version: 2.0.1
Platform: PC
OS/Version: Windows NT/2K
Status: NEW
Severity: Critical
Priority: Other
Component: DOM
AssignedTo: xerces-j-dev@xml.apache.org
ReportedBy: tevoi@arena.sci.univr.it
I try to validate a Xml document that is actually a Soap message envelope. This
is my message:
<env:Envelope xmlns:env="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:enc="http://schemas.xmlsoap.org/soap/encoding/"
env:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<env:Body>...</env:Body>
</env:Envelope>
And this is my java code to parse Xml document:
static final String JAXP_SCHEMA_LANGUAGE =
"http://java.sun.com/xml/jaxp/properties/schemaLanguage";
static final String W3C_XML_SCHEMA =
http://www.w3.org/2001/XMLSchema;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
dbf.setNamespaceAware(true);
dbf.setValidating(true);
dbf.setAttribute(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
dbf.setAttribute(
"http://apache.org/xml/properties/schema/external-schemaLocation",
"http://schemas.xmlsoap.org/soap/envelope/
http://schemas.xmlsoap.org/soap/envelope/");
DocumentBuilder domBuilder = dbf.newDocumentBuilder();
System.out.println("parsing xml document...");
domBuilder.parse("file:/C:/tmp/soapMsg.xml");
I have this exception:
Warning: validation was turned on but an org.xml.sax.ErrorHandler was not
set, which is probably not what is desired. Parser will use a default
ErrorHandler to print the first 10 errors. Please call
the 'setErrorHandler' method to fix this.
Error: URI=file:/C:/tmp/soapMsg.xml Line=11: cvc-complex-type.3.2.2:
Attribute 'env:encodingStyle' is not allowed to appear in
element 'env:Envelope'.
Looking at envelope Schema, encodingStyle attribute is allowed...
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-dev-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-dev-help@xml.apache.org