AppletTalk.com Forum Index AppletTalk.com
Java discussions newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Simple Java XML Parsing

 
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian)
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Thu Oct 19, 2006 12:56 am    Post subject: Simple Java XML Parsing Reply with quote



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!!!
Back to top
Display posts from previous:   
Post new topic   Reply to topic    AppletTalk.com Forum Index -> Java (Italian) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.