Hi,

I apologize in advance for this question, which is most likely about XML Schema and not about Xerces; however maybe somebody out there has already encountered this issue.

I'm writing my first moderately complicated XML Schema; I have much more experience with dtd's. If I were writing a dtd for this application, it would include something like

<!ELEMENT anElt ...>
<!ATTLIST anElt name ID #REQUIRED ..  >

<!ELEMENT anotherElt ...>
<!ATTLIST  anotherElt refs IDREFS #REQUIRED .. >

however, here I prefer to use XML Schema key and keyref because of the ability to limit scope. I've tried something like this, where xs is the prefix for XML schema namespace:

<xs:element name="anElt" ...>

    <xs:attribute name="name" type="xs:NMTOKEN" use="required" />
...
</xs:element>


<xs:element name="anotherElt" ..>
    <xs:attribute name="refs" type="xs:NMTOKENS: use="required" />
 ..
</xs:element>


and then

<xs:key name="anEltKey">
   <xs:selector xpath="anElt" />
   <xs:field     xpath="@name" />
</xs:key>

<xs:keyref name="anotherRef" refer="anEltKey" >
   <xs:selector xpath="anotherElt" />
   <xs:field     xpath="@refs" />
</xs:keyref>

This works as long as the value of the anotherRef attribute in the instance document is just a single token. If it's more than one, Xerces complains with an identity constraint error. Is there some way (in the 2nd xs:field element above) to express the idea of selecting each token within the attribute string? I haven't found anything like this in the XPATH spec. Or is there some other concise way to get the effect of ID/IDREFS plus the nice scoping?

Thanks,
Joanne


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to