xml节点引用和xsd模式

xml节点引用和xsd模式,xml,reference,xsd,Xml,Reference,Xsd,我是xml/xsd新手,如果可以引用xml中的另一个节点并为其创建propper xsd模式,我将处理这个问题 我需要这样使用它: <data type="String"> <id>1</id> <value>hello</value> </data> <data type="Integer"> <id>2</id> <value>12345&l

我是xml/xsd新手,如果可以引用xml中的另一个节点并为其创建propper xsd模式,我将处理这个问题

我需要这样使用它:

<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>
有可能实现这样的目标吗?如果是,那么xml和xsd模式应该是什么样子?
提前谢谢

是的,这是可能的。将data/id定义为键,将function/args/reference定义为键ref。我建议你阅读一下key/keyref,如果你做不到的话,就回到这里。关于StackOverflow的例子有很多,但要想了解概述,最好看一本XML模式教科书或在线教程