这是我的 XML 文件。
<config> <properties>
<entry key="delivaryDate">15-FEBRUARY-2013</entry>
<entry key="externalCOID">123456</entry>
<entry key="inputFileName">Generic_ChipONLY.chp</entry>
<entry key="recordTotal">2</entry>
<entry key="dueDate">15-MARCH-2013</entry>
</properties> </config>
例如,我想将“recordTotal”中的记录从 2 更改为 10,我该怎么做?现在我只知道使用 getElementsByTagName("entry") 获取。
DocumentBuilderFactory docBuilderFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();
Document doc = docBuilder.parse(new File("customer.xml"));
NodeList entry = doc.getElementsByTagName("entry");