You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by "McEligot, Sean (contractor)" <Mc...@MTMC.ARMY.MIL> on 2001/05/25 20:36:48 UTC
duplicate element dsc in the same scope
A little background: I have one xsd file that includes two others. Each of
those two files has an element of the same name. Two get around this I
defined the elements to be of different types. <element name="SameName"
type="SameNameTypeOne"> and <element name="SameName" type="SameNameTypeTwo">
(see below). This seems like it would be correct, but I get the following
message:
example.xml:2:108:2:109 Schema error: duplicate element decl in the same
scope : SameName.
example.xml:4:33:4:34 Datatype error: In element 'SameName' : Value '123'
does not match regular expression facet '[a-z]*'..
example.xml: 1360 ms (5 elems, 1 attrs, 9 spaces, 6 chars)
Can someone tell me if this is my fault or an xerces bug, and suggest a way
to fix this or a better way to do it?
Thanks,
Sean
Here is an example to duplicate this behaivor:
=== example.xml ===
<?xml version="1.0" encoding="UTF-8"?>
<Example xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation='example.xsd'>
<One> <SameName>abc</SameName> </One>
<Two> <SameName>123</SameName> </Two>
</Example>
=== example.xsd ===
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns='http://www.w3.org/2001/XMLSchema'>
<include schemaLocation="one.xsd" />
<include schemaLocation="two.xsd" />
<element name="Example">
<complexType>
<sequence>
<element ref="One" minOccurs='0' maxOccurs='unbounded'/>
<element ref="Two" minOccurs='0' maxOccurs='unbounded'/>
</sequence>
</complexType>
</element>
</schema>
=== one.xsd ===
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns='http://www.w3.org/2001/XMLSchema'>
<element name="One">
<complexType>
<sequence>
<element maxOccurs="1" minOccurs="0" name="SameName"
type="SameNameTypeOne" />
</sequence>
</complexType>
</element>
<simpleType name="SameNameTypeOne">
<restriction base="string">
<pattern value="[a-z]*" />
</restriction>
</simpleType>
</schema>
=== two.xsd ===
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns='http://www.w3.org/2001/XMLSchema'>
<element name="Two">
<complexType>
<sequence>
<element maxOccurs="1" minOccurs="0" name="SameName"
type="SameNameTypeTwo" />
</sequence>
</complexType>
</element>
<simpleType name="SameNameTypeTwo">
<restriction base="string">
<pattern value="[0-9]*" />
</restriction>
</simpleType>
</schema>
---------------------------------------------------------------------
To unsubscribe, e-mail: xerces-j-user-unsubscribe@xml.apache.org
For additional commands, e-mail: xerces-j-user-help@xml.apache.org