更新时间:2023-01-26 08:03:50
读取XML到InputStream和则:
Read the xml into a InputStream and then:
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
DocumentBuilder db = dbf.newDocumentBuilder();
doc = db.parse([the InpuTstream]);
然后你可以使用DOC,如:
Then you can use doc like:
if(doc.getElementsByTagName("GeometryCollection").getLength()>0){
org.w3c.dom.Node parent_node = doc.getElementsByTagName("GeometryCollection").item(0);
NodeList nl = parent_node.getChildNodes();
for(int i = 0;i<nl.getLength();i++){
...