日期:2014-05-18  浏览次数:20736 次

用jDom或dom4j解析这样的XML
<?xml   version= "1.0 "   encoding= "GB2312 "?>
<xsd:schema   xmlns:xsd= "http://www.w3.org/2001/XMLSchema ">
<xsd:annotation>
<xsd:documentation>
                                      电梯参数信息;FileTypeCode:1105。
                                    </xsd:documentation>
</xsd:annotation>
<xsd:element   name= "GG_DTCS "   type= "RootType "/>
<xsd:complexType   name= "RootType ">
<xsd:sequence>
<xsd:element   name= "SystemCode "   type= "xsd:string "/>
<xsd:element   name= "FileTypeCode "   type= "xsd:string "/>
<xsd:element   name= "SendDate "   type= "xsd:string "/>
<xsd:element   name= "SendNo "   type= "xsd:string "/>
<xsd:element   name= "item "   type= "ItemType "   maxOccurs= "unbounded "/>
</xsd:sequence>
</xsd:complexType>

</xsd:schema>


请教高手,这样的XML的文件如何解析出来,读取里面的内容!拜托了!!最后给解析的代码啊!!

------解决方案--------------------
这样的XML的文件?
这个是xsd,是xml文件的外观,具体的内容由xml填充。

使用dom4j的xpath很方便的解析啊。