我有一个 XSD。我想提取“元素名称=”的值,并将它们写入 Excel 工作表。我该怎么做呢?
在我看来,bufferedreader/XPATH/jaxb/Apache POI。但我以前没有使用过这些。请帮忙!
样本输入:
<?xml version="1.0" ?>
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:gw="XX" xmlns="XXXX" targetNamespace="XXXXX" elementFormDefault="qualified" xmlns:ns0="XXXXXX" xmlns:jaxb="http://java.sun.com/xml/ns/jaxb" jaxb:version="2.1">
<xsd:annotation>
<xsd:appinfo>
<jaxb:schemaBindings>
<jaxb:package name="XXXXXXXX" />
</jaxb:schemaBindings>
</xsd:appinfo>
</xsd:annotation>
<xsd:import namespace="XXXXXXXX" />
<xsd:element name="sample" type="sample" nillable="true" />
<xsd:complexType name="sample">
<xsd:sequence>
<xsd:element name="tempTerms" minOccurs="0" nillable="true">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="Input" minOccurs="0" maxOccurs="unbounded" nillable="true" type="ns0:tempTerm" />
</xsd:sequence>
</xsd:complexType>
</xsd:element>
<xsd:element name="PatternCode" minOccurs="0" nillable="true" type="xsd:string" gw:type="java.lang.String" />
</xsd:sequence>
</xsd:complexType>
</xsd:schema>
样本输出:
列名称为的 XLS:
sample
tempTerms
Input
PatternCode