Page 1 of 1

Creating a Schema With two occurrences of the same componen

Posted: Mon Aug 13, 2007 1:18 pm
by carol.aboody
Hello all,

Hope you could help me.

I have to validate an XML file using an XSD schema.
The problem is that the XML contains the same name, "isavail ", in 2 different uses.

I can't change the XML, how can I validate it?

My XML file looks like this:

Code: Select all


<?xml version="1.0" encoding="ISO-8859-1" ?>
<isavail rc="0" service="invitation">
< isavails>
< isavail invid="64834" status="valid"/>
</ isavails>
</ isavail >
My XSD schema looks like this:

Code: Select all


<?xml version="1.0" encoding="UTF-8"?>
<!--W3C Schema generated by XMLSpy v2007 sp2 (http://www.altova.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema">
<xs:element name=" isavails ">
<xs:complexType>
<xs:sequence>
<xs:element ref=" isavail"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name=" isavail">
<xs:complexType>
<xs:sequence>
<xs:element ref=" isavails" minOccurs="0"/>
</xs:sequence>
<xs:attribute name="status" type="xs:string"/>
<xs:attribute name="service" type="xs:string"/>
<xs:attribute name="rc" type="xs:int"/>
<xs:attribute name="invid" type="xs:long"/>
</xs:complexType>
</xs:element>
</xs:schema>

when i try validating it i get this message:
sch-props-correct.2: A schema cannot contain two global components with the same name; this schema contains two occurrences of ',isavail'.


Any suggestions?

Thanks,

Carol

Posted: Mon Aug 13, 2007 10:06 pm
by jkmyoung
Technically this is an Oxygen forum, not an XMLSpy one. But anyways:
Try removing the spaces from all the element name declarations. XMLSpy is picky about this.

It's not a space problem

Posted: Tue Aug 14, 2007 4:51 pm
by carol.aboody
I'm sorry, I'm new to XML world..

I'm trying to validate the file with JDOM Object (JAVA application), not XMLSPY.

The spaces are not present in the XSD file , only in this msg (copy-paste problem..)

Do you have any more ideas?