468,309 Members | 1,121 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,309 developers. It's quick & easy.

keyref refer to another xsd's "key"

I have two xsd files, in one xsd file, I defined a "key", I'd like to
use "keyref" to refer to that "key" from another xsd file. But I always
get attribute is empty error.

my.xsd is my first xsd file with "key", myphone.xsd is the keyref file
which need to refer to the "key"

Thanks.

my.xsd:

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns="http://www.fisc.com" xmlns:fs="http://www.fisc.com"
targetNamespace="http://www.fisc.com" elementFormDefault="qualified">
<xs:element name="name" type="xs:string"/>
<xs:element name="cubic">
<xs:complexType>
<xs:sequence>
<xs:element ref="name"/>
<xs:element name="devices" minOccurs="0" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:any namespace="##any" processContents="skip"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="office">
<xs:complexType>
<xs:sequence>
<xs:element ref="cubic" minOccurs="2" maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
<xs:key name="test0">
<xs:selector xpath="fs:cubic/fs:name"/>
<xs:field xpath="."/>
</xs:key>
</xs:element>
</xs:schema>
myphone.xsd:
<?xml version="1.0" encoding="UTF-8"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:yb="http://www.yellowbook.com"
targetNamespace="http://www.yellowbook.com"
elementFormDefault="qualified" attributeFormDefault="unqualified"
xmlns:fs="http://www.fisc.com"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.fisc.com C:\proj\xmlschema\my.xsd">
<xs:element name="phone">
<xs:annotation>
<xs:documentation>Comment describing your root
element</xs:documentation>
</xs:annotation>
<xs:complexType>
<xs:sequence>
<xs:element name="shareWith" type="xs:string"/>
<xs:element name="phoneNumber" type="xs:integer"/>
</xs:sequence>
</xs:complexType>
<xs:keyref name="shareWithKeyRef" refer="fs:test0">
<xs:selector xpath="yb:phone/yb:shareWith"/>
<xs:field xpath="."/>
</xs:keyref>
</xs:element>
</xs:schema>

Sep 19 '05 #1
0 1312

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

1 post views Thread by Holger (David) Wagner | last post: by
5 posts views Thread by Steven | last post: by
2 posts views Thread by Alex Maghen | last post: by
reply views Thread by NPC403 | last post: by
reply views Thread by Teichintx | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.