[jdom-interest] Finding text for an element in an XML Doc
Kesav Kumar
kesavk at voquette.com
Thu Apr 19 08:28:26 PDT 2001
If you know the path of the text node its very stright job
First parse the xmldoc and get the Document object.
SAXBuilder builder = new SAXBuilder();
Document doc = builder.build(new BufferedInputStream(new
FileInputStream("foo.xml"), 1024));
Element root = doc.getRootElement();
String text =
root.getChild("subelement1").getChild("childelement").getTextTrim();
Kesav Kumar
Software Engineer
Voquette, Inc.
650 356 3740
mailto:kesavk at voquette.com
http://www.voquette.com
Voquette...Delivering Sound Information
-----Original Message-----
From: Mark Glass [mailto:mglass at datalinx.net]
Sent: Thursday, April 19, 2001 8:07 AM
To: jdom-interest
Subject: [jdom-interest] Finding text for an element in an XML Doc
Hi all,
I need some suggestions -- I'm working on an application which reads
an XML document, determines the text in a node which is specified by
through a config file and returns the ttext. I intened to use XPath,
e.g. String elementText =
getKeyFieldText("/root/subelement1/childelement/Text()"). After doing
some investigation it appears that XPath is used only for XSL. Are there
any libraries available that will allow items to be located in an XML
document?
Thanks in advance for your help..
Mark Glass
_______________________________________________
To control your jdom-interest membership:
http://lists.denveronline.net/mailman/options/jdom-interest/youraddr@yourhos
t.com
More information about the jdom-interest
mailing list