如何使用XPath在ref中查找XML属性中的节点?

时间:2016-07-09 01:29:23

标签: xpath xsd jaxb xjc

我正在尝试使用以下xsd

中的ref访问属性/元素节点
<xs:attributeGroup name="arcAttrs">
    <xs:attribute ref="xlink:type" use="required" fixed="arc"/>
    <xs:attribute ref="xlink:arcrole"/>
    <xs:attribute ref="xlink:title"/>
    <xs:attribute ref="xlink:show"/>
    <xs:attribute ref="xlink:actuate"/>
    <xs:attribute ref="xlink:from"/>
    <xs:attribute ref="xlink:to">
        <xs:annotation>
            <xs:documentation>
 from and to have default behavior when values are missing
</xs:documentation>
        </xs:annotation>
    </xs:attribute>
</xs:attributeGroup>
<xs:group name="arcModel">
    <xs:sequence>
        <xs:element ref="xlink:title" minOccurs="0" maxOccurs="unbounded"/>
    </xs:sequence>
</xs:group>
<xs:complexType name="arcType">
    <xs:group ref="xlink:arcModel"/>
    <xs:attributeGroup ref="xlink:arcAttrs"/>
</xs:complexType>

我尝试通过

访问它
 <bindings node="xs:complexType[@name='arcType']">
                <bindings node="xs:group/xs:element[@ref='xlink:title']">
                    <property name="arcModelTitle"/>
                </bindings>

        </bindings>

但它不起作用......我该怎么办呢?

我想要做的是:通过xjc从xsd生成JAVA包。但是,xsd中存在一些名称冲突,如下面的错误:

[ERROR] Property "Title" is already defined. Use &lt;jaxb:property> to resolve this conflict.
line 197 of file:/D:/0Ubiloc/TEST/xlink.xsd
[ERROR] The following location is relevant to the above error
line 183 of file:/D:/0Ubiloc/TEST/xlink.xsd

所以我想重新定义属性或元素的名称。但它没有得到带有ref的节点(属性/元素),就像我在地板上的代码一样

提前致谢

0 个答案:

没有答案