 |
 |
 |
Hi,
nandanprasad <pola_nandana@e...> writes:
> Here is a skeleton of xml, Can we have a keyref element refering to key of
> some other element? In the samples I f find that the keyref element
> normally points to key element defined within the same context eleement.
>
>
> <element name="A">
> <xs:key name="key1"/>
> </element>
>
> <element name="B">
> <xs:keyref name="key2" refer="key1"/>
> </element>
xs:keyref should refer to the xs:key defined in the same element or
in one of its ancestors. It is best however to keep both key and
keyref at the same, closest common level. For example, if you
had a third element which contains A and B then it would be a
good idea to put key and keyref there:
<element name="C">
<complexType>
<sequence>
<element ref="A"/>
<element ref="B"/>
</sequence>
</complexType>
<key name="a-key">
<selector xpath="A"/>
<field xpath="@key"/>
</key>
<keyref name="a-ref" refer="a-key">
<selector xpath="B"/>
<field xpath="@ref"/>
</keyref>
</element>
Here I assume that element A has a key attribute "key" and element B
has a reference attribute "ref".
hth,
-boris
--
Boris Kolpackov
Code Synthesis Tools CC
http://www.codesynthesis.com
Open-Source, Cross-Platform C++ XML Data Binding
|
 | 

|  |
These Archives are provided for informational purposes only and have been generated directly from the Altova mailing list archive system and are comprised of the lists set forth on www.altova.com/list/index.html. Therefore, Altova does not warrant or guarantee the accuracy, reliability, completeness, usefulness, non-infringement of intellectual property rights, or quality of any content on the Altova Mailing List Archive(s), regardless of who originates that content. You expressly understand and agree that you bear all risks associated with using or relying on that content. Altova will not be liable or responsible in any way for any content posted including, but not limited to, any errors or omissions in content, or for any losses or damage of any kind incurred as a result of the use of or reliance on any content. This disclaimer and limitation on liability is in addition to the disclaimers and limitations contained in the Website Terms of Use and elsewhere on the site.
|  |
| |
 |
 |
 |