[jdom-interest] Problem validating XML Document w/JDOM and Xerces2-J
gary_a_woodbridge at bankone.com
gary_a_woodbridge at bankone.com
Thu May 29 11:54:53 PDT 2003
I have an XML Document that start off like this:
<?xml version="1.0" encoding="UTF-8"?>
<TransactionRequest xmlns:xsi="http://www.w3.org/2001/XLSchema-instance"
xsi:noNamespaceSchemaLocation="TransactionRequest.xsd"><WithdrawalRequest>
...
My XSD file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
.
.
.
<xs:complexType name="trtype">
<xs:choice>
<xs:element name="WithdrawalRequest" type="wrtrtype"/>
<xs:element name="DepositRequest" type="drtrtype"/>
<xs:element name="RepoRequest" type="rrtrtype"/>
</xs:choice>
</xs:complexType>
<xs:element name="TransactionRequest" type="trtype" />
</xs:schema>
I have my SAXBuilder set up like this:
builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser",true);
builder.setFeature("http://apache.org/xml/features/validation/schema",
true);
builder.setProperty(
"http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation"
,
"TransactionRequest.xsd");
When I try to validate the above XML document with the builder, I get the
following:
Error on line 2: cvc-complex-type.3.2.2: Attribute
'xsi:noNamespaceSchemaLocation' is not allowed to appear in element
'TransactionRequest'.
org.jdom.input.JDOMParseException: Error on line 2: cvc-complex-type.3.2.2:
Attribute 'xsi:noNamespaceSchemaLocation' is not allowed to appear in
element 'TransactionRequest'.
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:381)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:764)
at
com.bankone.ns3.trol.WithdrawalRequest.main(WithdrawalRequest.java:238)
Caused by: org.xml.sax.SAXParseException: cvc-complex-type.3.2.2: Attribute
'xsi:noNamespaceSchemaLocation' is not allowed to appear in element
'TransactionRequest'.
at org.apache.xerces.parsers.AbstractSAXParser.parse(Unknown Source)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:370)
at org.jdom.input.SAXBuilder.build(SAXBuilder.java:764)
at
com.bankone.ns3.trol.WithdrawalRequest.main(WithdrawalRequest.java:238)
So, what am I doing wrong?
Thanks,
Gary
This transmission may contain information that is privileged, confidential and/or exempt from disclosure under applicable law. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution, or use of the information contained herein (including any reliance thereon) is STRICTLY PROHIBITED. If you received this transmission in error, please immediately contact the sender and destroy the material in its entirety, whether in electronic or hard copy format. Thank you.
More information about the jdom-interest
mailing list