import java.io.File;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class test {
public void testDOMBuilder() {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document=builder.parse(new File("compile.xml"));
NodeList nodeList_VERINFO=document.getElementsByTagName("layer");
for(int i=0;i<nodeList_VERINFO.getLength();i++){
System.out.println(nodeList_VERINFO.item(i));
Element element=(Element)nodeList_VERINFO.item(i);
String content=element.getElementsByTagName("compile-errors").item(0).getFirstChild().getNodeValue();
System.out.println("compile-errors:"+content);
content=element.getElementsByTagName("compile-warnings").item(0).getFirstChild().getNodeValue();
System.out.println("compile-warnings:"+content);
}
} catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String avg[]){
test t=new test();
t.testDOMBuilder();
}
}
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.w3c.dom.NodeList;
public class test {
public void testDOMBuilder() {
try {
DocumentBuilderFactory factory = DocumentBuilderFactory
.newInstance();
DocumentBuilder builder = factory.newDocumentBuilder();
Document document=builder.parse(new File("compile.xml"));
NodeList nodeList_VERINFO=document.getElementsByTagName("layer");
for(int i=0;i<nodeList_VERINFO.getLength();i++){
System.out.println(nodeList_VERINFO.item(i));
Element element=(Element)nodeList_VERINFO.item(i);
String content=element.getElementsByTagName("compile-errors").item(0).getFirstChild().getNodeValue();
System.out.println("compile-errors:"+content);
content=element.getElementsByTagName("compile-warnings").item(0).getFirstChild().getNodeValue();
System.out.println("compile-warnings:"+content);
}
} catch(Exception e)
{
e.printStackTrace();
}
}
public static void main(String avg[]){
test t=new test();
t.testDOMBuilder();
}
}