V
vunet.us
Hello,
I am new to Java. I need to find two values in XML file, compare them
with other two values and, if match, add to new XML string. Please,
help me with 2 errors:
String new XML = null;
NodeList nodes = document.getElementsByTagName("Car");
for(int i=0; i<nodes.getLength(); i++){
Element e1 = (Element) nodes.item(i);
Element e2 = (Element) nodes.item(i);
String e1val = e1.getNodeValue("Color"); //ERROR: method getNodeValue
not found in org.w3c.dom.Element
String e2val = e2.getAttribute("Type");
if(e1val.equals("Red") && e2val.equals("Sedan")){
newXML = //HOW TO ADD THIS NODE AS STRING?
}
return newXML;
}
THANK YOU!!!
I am new to Java. I need to find two values in XML file, compare them
with other two values and, if match, add to new XML string. Please,
help me with 2 errors:
String new XML = null;
NodeList nodes = document.getElementsByTagName("Car");
for(int i=0; i<nodes.getLength(); i++){
Element e1 = (Element) nodes.item(i);
Element e2 = (Element) nodes.item(i);
String e1val = e1.getNodeValue("Color"); //ERROR: method getNodeValue
not found in org.w3c.dom.Element
String e2val = e2.getAttribute("Type");
if(e1val.equals("Red") && e2val.equals("Sedan")){
newXML = //HOW TO ADD THIS NODE AS STRING?
}
return newXML;
}
THANK YOU!!!