View Single Post
Old February 24th, 2007, 02:24 AM
ooper01 ooper01 is offline
Registered User
Join Date: Feb 2007
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using ref in xml

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="" 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:element ref="chartUrl"/>
        <xs:element ref="total" minOccurs="0"/>
        <xs:element ref="responseText" minOccurs="0"/>

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("", true);
builder.setFeature("", true);
            "file:///" + Constants.SCHEMA_FOLDER + schemaFilename);

Brian Barnett