【发布时间】:2010-11-15 15:42:47
【问题描述】:
我正在使用 Apache 的 Xerces2-j 来解析我的 XSD。我正在尝试获取 XSD 中元素/属性声明的数据类型信息。
这是一个 XSD 示例:
<xs:element name="Pretzel">
...
<xs:attribute name="Flavor" type="xs:string"/>
<xs:attribute name="ProductID" type="xs:nonNegativeInteger"/>
...
</xs:element>
在这种情况下,我想获取 Flavor 和 ProductID 属性的数据类型。根据W3C Schema API 和its Xerces2-j implementation,XSAttributeDeclaration 的 getActualVCType() 将得到我想要的。但对我来说,该方法总是返回 45,即 UNAVAILABLE_DT。这是 Xerces2-j 中的错误,还是我只是理解 API 错误?如果我是,如果有人能在这里指出正确的方向,我将不胜感激。
【问题讨论】: