K
Kimmo J?rvikangas
Dear XML (Schema) experts,
As an example I have the following 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="ROOT_ELEMENT">
<xs:complexType>
<xs:choice>
<xs:element name="FOO1" type="xs:date"/>
<xs:element name="FOO2" type="xs:dateTime"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Which is fine for my schema validator.
However, if I wanted to have the name of the element appearing under
the root-element to ALLWAYS have the same name (for example FOO,
without a number at the end) regardless of the type of the element I
keep getting (MOST OF THE TIME!) this error message:
"Schema error cos-element-consistent - all types of local element
'FOO' must be consistent".
When I look the situation from the point of an instance document I
don't see how the instance document conforming to this schema with
FOO-element (with varying type) could violate W3C XML recommendation.
SOMETIMES my schema validator gives me green light when in "text mode"
and red light in "graphical mode" of this particular situation (in a
bit more complicated schema instance, though) which seems to me a bug
anyway in this schema validator.
What bothers me is that I dunno which of the two is correct; am I
allowed to have in schema under choice-element two elements declared
with the same name, but different type, or is this not allowed (XML
schema itself is a XML document, too, and two elements with same name
but with different type in the same contextual level is not
allowed...)
I am using XMLSPY Enterprise Edition version 2004 rel.2. as the
"schema validator" I was referring to a couple of times.
Appreciate any solid opinions on this,
<kimmo/>
As an example I have the following 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="ROOT_ELEMENT">
<xs:complexType>
<xs:choice>
<xs:element name="FOO1" type="xs:date"/>
<xs:element name="FOO2" type="xs:dateTime"/>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Which is fine for my schema validator.
However, if I wanted to have the name of the element appearing under
the root-element to ALLWAYS have the same name (for example FOO,
without a number at the end) regardless of the type of the element I
keep getting (MOST OF THE TIME!) this error message:
"Schema error cos-element-consistent - all types of local element
'FOO' must be consistent".
When I look the situation from the point of an instance document I
don't see how the instance document conforming to this schema with
FOO-element (with varying type) could violate W3C XML recommendation.
SOMETIMES my schema validator gives me green light when in "text mode"
and red light in "graphical mode" of this particular situation (in a
bit more complicated schema instance, though) which seems to me a bug
anyway in this schema validator.
What bothers me is that I dunno which of the two is correct; am I
allowed to have in schema under choice-element two elements declared
with the same name, but different type, or is this not allowed (XML
schema itself is a XML document, too, and two elements with same name
but with different type in the same contextual level is not
allowed...)
I am using XMLSPY Enterprise Edition version 2004 rel.2. as the
"schema validator" I was referring to a couple of times.
Appreciate any solid opinions on this,
<kimmo/>