Creating a Schema With two occurrences of the same componen

This should cover W3C XML Schema, Relax NG and DTD related problems.
carol.aboody
Posts: 5
Joined: Mon Aug 13, 2007 1:04 pm

Creating a Schema With two occurrences of the same componen

Post by carol.aboody » Mon Aug 13, 2007 1:18 pm

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

jkmyoung
Posts: 89
Joined: Mon Mar 06, 2006 10:13 pm

Post by jkmyoung » Mon Aug 13, 2007 10:06 pm

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.

carol.aboody
Posts: 5
Joined: Mon Aug 13, 2007 1:04 pm

It's not a space problem

Post by carol.aboody » Tue Aug 14, 2007 4:51 pm

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?

Post Reply