dom 4j读取xml中的值DOM 和String相互转换

xiaoxiao2025-04-09  12

String request_xml=request_xml;

Document doc = DocumentHelper.parseText(request_xml);                                    Element root = doc.getRootElement();                   Node billelement= root.selectSingleNode("bill");                   Node billheadlement =  billelement.selectSingleNode("billhead");                   Node pkorg= billheadlement.selectSingleNode("pk_org");                   System.out.println("old==>pkorg="+pkorg.getText());                   pkorg.setText(orgid);                   System.out.println("new==>pkorg="+pkorg.getText());                   String text = doc.asXML();                  System.out.println("text"+text);

转载请注明原文地址: https://www.6miu.com/read-5027841.html

最新回复(0)