我需要定义一组XSD。每个XSD都有一个标题元素,并且该标题是相同的,除了中间的一些元素。xsd选择覆盖
所以,我会:
XML1:
<req1>
<head>
<common1/>
<common2/>
<choice1/>
<choice2/>
<common3/>
</head>
<data1>...</data1>
</req1>
XML2:
<req2>
<head>
<common1/>
<common2/>
<choice2/>
<choice3/>
<common3/>
</head>
<data2>...</data2>
</req2>
其中选择1,选择2,choice3处于<choice>
集,像
<choice>
<choice2/>
<choice3/>
</choice>
并且可以有di不同请求类型之间的不同选择和元素数目。
我真的很希望能够在单个XSD中为标题定义这一点,然后将其包含在req1.xsd和req2.xsd中。我无法弄清楚如何动态地调换这个<choice>
。如果我没有<common3/>
部分,我可以使用基本元素,但我的理解是,当我添加任何东西到基地时,它只会在最后添加。任何方式我可以在中间替换,或者在使用底座时添加在中间?
完美工作。 10Q – 2012-04-23 12:26:24