[jdom-interest] Problem validating XML Document w/JDOM and Xerces2-J

Laurent Bihanic laurent.bihanic at atosorigin.com
Mon Jun 2 04:21:15 PDT 2003


You mistyped the schema instance namespace. The correct URI is 
"http://www.w3.org/2001/XMLSchema-instance" (XMLSchema instead of XLSchema).

Laurent


gary_a_woodbridge at bankone.com wrote:

> 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




More information about the jdom-interest mailing list