xmlbeans解析XML详细介绍的说明很多,官方也有很多参考,不多废话,主要流程如下:
</pre><p>1. 下载 xmlbean 文件 <a target=_blank href="http://download.csdn.net/detail/q119909033/8813173">官方或者直接点击</a></p><p>2. 根据XML生成<span style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; line-height:18px; background-color:rgb(250,250,250)">Schema(<span style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; line-height:18px; background-color:rgb(250,250,250)">XML文件的结构和元素约束文件</span>) ,可使用工具Altova XMLSpy进行生成.<a target=_blank href="http://download.csdn.net/detail/q119909033/8813173">破解版下载地址点我.</a></span></p><p><span style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; line-height:18px; background-color:rgb(250,250,250)">3.使用 SPY打开XML,依次选择<span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px">DTD/Schema->Generate DTD/Schema-><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px">W3C Schema->输入名称,得到MRO.xsd文件.</span></span></span></p><p><span style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; line-height:18px; background-color:rgb(250,250,250)"><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px"><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px">4. 编写</span></span></span><span style="color:rgb(51,51,51); font-size:14px; line-height:26px; font-family:Arial; background-color:rgb(250,250,250)">measure</span><span style="color:rgb(51,51,51); font-size:14px; line-height:26px; font-family:Arial; background-color:rgb(250,250,250)">.xsdconfig文件.主要作用提供给xmlbean生成命名使用.</span></p><p><span style="font-family:Monaco,'DejaVu Sans Mono','Bitstream Vera Sans Mono',Consolas,'Courier New',monospace; line-height:18px; background-color:rgb(250,250,250)"><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px"><span style="color:rgb(51,51,51); font-family:Arial; font-size:14px; line-height:26px"></span></span></span></p><pre name="code" class="html"><span style="font-family: Arial; background-color: rgb(250, 250, 250);"></span><pre name="code" class="html"><xb:config xmlns:xb="http://xml.apache.org/xmlbeans/2004/02/xbean/config"> <xb:namespace> <xb:package>measure.xmlbean</xb:package> </xb:namespace> </xb:config>
4. 拷贝mro.xsd,原始XML文件,mewasure.xsdconfig文件至xmlbean\bin目录下.记得配置JAVAJDK环境变量
5. 执行scomp -out measureXmlBean.jar MRO.xsdmewasure.xsdconfig6.
复制生成JAR文件至工程,eclipse引用JAR.
6.java使用方法如下
try { File xmlFile = new File(path); BulkPmMrDataFileDocument doc = BulkPmMrDataFileDocument.Factory.parse(xmlFile); FileHeader customers = doc.getBulkPmMrDataFile().getFileHeader(); ENodeB enb = doc.getBulkPmMrDataFile().getENodeB(); Measurement[] measurement = enb.getMeasurementArray(); for (int i = 0; i < measurement.length; i++) { Measurement customer = measurement[i]; println("id:" + i); println("getSmr ID:" + customer.getSmr()); println("getObjectArray name:" + customer.getObjectArray()[0].getId()); } } catch (Exception ex) { ex.printStackTrace(); }
到此全完已经介绍完成.
关于spy破解简单说下:
1. 屏蔽验证.C:\WINDOWS\system32\drivers\etc\hosts加入.
127.0.0.1 altova.com #XMLspy
127.0.0.1 www.altova.com #XMLspy
127.0.0.1 link.altova.com #XMLspy
2. 安装,复制patch到安装目录.点击应用补丁
3. 启动注册,注册码如下
Name:www.shijeiweb.cn
Company:shijeiweb
Key-code:PM92JW3-HJMTA8C-P2H3C53-579CT11-PCCYT91-X8D0LM1-PWY8U42
时间: 2024-10-08 22:46:29