如果我能有一个示例代码来使用 DOM/SAX 解析器解析以下格式的 XML,我会很高兴。
<MMV>Sysdecs000110010101</MMV>
<Protocol name="SNMP">
<CS CommandString="wmanIf2BsOfdmaTTG" oid="1.3.6.1.2.1.10.184.1.1.6.2.2.1.3.1" Get_SecurityString="public" Set_SecurityString="private" type="integer"></CS>
<CS CommandString="wmanIf2BsOfdmaRTG" oid="1.3.6.1.2.1.10.184.1.1.6.2.2.1.4.1" Get_SecurityString="public" Set_SecurityString="private" type="integer"></CS>
<CS CommandString="wmanIf2BsOfdmaFrameDurationCode" oid="1.3.6.1.2.1.10.184.1.1.6.2.2.1.9.1" Get_SecurityString="public" Set_SecurityString="private" type="integer"></CS>
</Protocol>
<Protocol name="CLI">
<CS CommandString="show clock" mode="usermode" type="get" username="aaa" password="bbb"/>
<CS CommandString="show version" mode="usermode" type="get" username="bbb" password="ccc"/>
<CS CommandString="set username" mode="configrmode" type="set" username="cc" password="ddd"/>
</Protocol>
谢谢你......
最佳答案
完成这个简单的tutorial了解 DOM 和 SAX 解析并尝试自己编写代码。如果您遇到困难,请提出具体问题。
关于java - 如何解析给定格式的XML文件?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1795127/