Reputation: 1
Im new to xml/xsd and Im dealing with issue if is possible to make reference to another node in xml and make propper xsd schema for it.
This is how i need to use it:
<data type="String">
<id>1</id>
<value>hello</value>
</data>
<data type="Integer">
<id>2</id>
<value>12345</value>
</data>
<function>
<args>
<reference to data with id 1>
...
</args>
<code>...</code>
<function>
<function>
<args>
<reference to data with id 2>
...
</args>
<code>...</code>
<function>
Is it possible to achive something like that? If yes, than how should xml and xsd schema look like ? Thanks in advance.
Upvotes: 0
Views: 138
Reputation: 163645
Yes, it is possible. You define data/id
as a key, and function/args/reference
as a keyref. I suggest you do some reading on key/keyref and then come back here if you can't make it work. There are plenty of examples on StackOverflow, but for an overview you're better off looking at an XML Schema textbook or online tutorial.
Upvotes: 1