Using ref in xml
Hi,
I'm getting this error when validating my xml:
"A schema cannot contain two global components with the same name"
Here is the schema:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" attributeFormDefault="unqualified">
<xs:element name="chartUrl"/>
<xs:element name="total" type="xs:double"/>
<xs:element name="responseText" type="xs:string"/>
<xs:element name="bud02Out">
<xs:complexType>
<xs:all>
<xs:element ref="chartUrl"/>
<xs:element ref="total" minOccurs="0"/>
<xs:element ref="responseText" minOccurs="0"/>
</xs:all>
</xs:complexType>
</xs:element>
</xs:schema>
XML Spy does not complain when I save the schema file, but when I run an xml document that conforms to this schema through a validating parser, I get the error above. Any suggestions?
Here is code that creates the validating parser (java):
SAXBuilder builder = new SAXBuilder("org.apache.xerces.parsers.SAXParser", true);
builder.setFeature("http://apache.org/xml/features/validation/schema", true);
builder.setFeature("http://xml.org/sax/features/validation", true);
builder.setProperty("http://apache.org/xml/properties/schema/external-noNamespaceSchemaLocation",
"file:///" + Constants.SCHEMA_FOLDER + schemaFilename);
TIA,
Brian Barnett
|