我正在尝试解析这个复杂类型,但无法使用XSOM JAVA获取
你知道它是如何解析的吗?
<xsd:sequence>
<xsd:any namespace="##other" processContents="lax" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
发布于 2012-10-12 03:06:16
假设此测试为XSD:
<?xml version="1.0" encoding="utf-8" ?>
<!--XML Schema generated by QTAssistant/XML Schema Refactoring (XSR) Module (http://www.paschidev.com)-->
<xsd:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<xsd:complexType name="test">
<xsd:sequence>
<xsd:any namespace="##other" processContents="lax" maxOccurs="unbounded"/>
</xsd:sequence>
<xsd:anyAttribute namespace="##other" processContents="lax"/>
</xsd:complexType>
</xsd:schema>您需要以下代码:
XSOMParser parser = new XSOMParser();
//parser.setErrorHandler(...);
//parser.setEntityResolver(...);
parser.parse(new File(...));
XSSchemaSet sset = parser.getResult();
XSComplexType xt = sset.getComplexType("http://tempuri.org/XMLSchema.xsd", "test");
XSWildcard anyAttr = xt.getAttributeWildcard();关键是getAttributeWildcard接口。
https://stackoverflow.com/questions/12816033
复制相似问题