saxon 9 sa warning on schema unique constraint

RolfK

Usenet Archive
Joined
Dec 17, 2007
Messages
34
Reaction score
0
Dear ALL,

I'm creating a schema and have a behaviour I do not understand. Basically I have declared all my elements as global complex types and refere to them later in complex types.
Please see some code snipets:

<xs:element name="MPTest"> <==== This is the top element <xs:complexType> <xs:sequence> <xs:element ref="Preamble"/> <xs:element ref="SpecItems"/> <xs:element ref="ConditionSets"/> .......

<xs:element name="SpecItems">
<xs:complexType>
<xs:sequence>
<xs:element ref="SpecItem" maxOccurs="unbounded"/> </xs:sequence> </xs:complexType> <xs:unique name="SpecItemName"> <==== Line 219 is here <xs:selector xpath="SpecItem"/> <xs:field xpath="@Name"/> </xs:unique> </xs:element>

....
<xs:element name="SpecItem">
<xs:complexType>
<xs:sequence>
<xs:element ref="Description"/>
<xs:element ref="sdoc:SimpleDoc"/>
<xs:element ref="Measurement" maxOccurs="6"/>
</xs:sequence>
<xs:attribute name="Name" type="tGeneralName" use="required"/> <xs:attribute name="Drift" type="tGeneralName" use="optional"/>

......

In case I do not use the xs:unique cinstarint every thing is validated OK BUT, in case I have it in I get this warning:

...sourcing Saxon 9.1.0.1 and JDK 1.5.11
Warning: on line 219 of MarginTable.xsd:
The complex type of element SpecItems does not allow a child element named SpecItem

In my understanding SpecItem is clearly an allowed child of SpeItems. Why does saxon complain by adding the unique constraint ?

Any idea is welcome

Thanks

Rolf
 

Martin Honnen

Usenet Archive
Joined
Apr 8, 2000
Messages
6,174
Reaction score
0
RolfK said:
BUT, in case I have it in I get this warning:

..sourcing Saxon 9.1.0.1 and JDK 1.5.11
Warning: on line 219 of MarginTable.xsd:
The complex type of element SpecItems does not allow a child element named SpecItem

In my understanding SpecItem is clearly an allowed child of SpeItems. Why does saxon complain by adding the unique constraint ?

I could not find a problem with the schema snippets you posted. You might want to check with a different validating parser like Xerces. If Xerces or another validating parser does not find an issue then I would raise the problem on the Saxon help list.
 

C. M. Sperberg-McQueen

Usenet Archive
Joined
Jul 2, 2003
Messages
95
Reaction score
0
RolfK writes:

Dear ALL,

I'm creating a schema and have a behaviour I do not understand.
.....

In case I do not use the xs:unique cinstarint every thing is validated OK BUT, in case I have it in I get this warning:

..sourcing Saxon 9.1.0.1 and JDK 1.5.11
Warning: on line 219 of MarginTable.xsd:
The complex type of element SpecItems does not allow a child element ...

As Martin Honnen sagely observed in another thread recently:
if sane-looking code fails for no visible reason, check for a namespace problem.

What is the target namespace of your schema document?

Or, put another way: the complex type of your SpecItems element refers to an element whose expanded name is {}SpecItem (i.e. an element named SpecItem, assigned to no namespace). Is that the expanded name of the SpecItem element your schema document defines?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
548,049
Messages
3,104,245
Members
248,133
Latest member
DujonT

Latest Threads

Top