How do you get a Node's text value using DOM?
Hi,
Can anyone tell me how I can extract the text values from <currency>, <Handle>, <shortcut> and <source> tags?
This is my Code
import org.w3c.dom.*;
import org.apache.xerces.parsers.DOMParser;
public class CurveConfSave{
public static void walkover(Node n){
if( n.getNodeType() == Node.ELEMENT_NODE){
System.out.println("Walking over: " + ((Element)n).getNodeName());
for( Node c = n.getFirstChild();c != null;c=c.getNextSibling()){
walkover(c);
public static void main(String[] args) {
try {
DOMParser p = new DOMParser();
p.parse("CurveConf1.xml");
Document doc = p.getDocument();
NodeList liveCurvesNodeList = doc.getElementsByTagName("LiveCurves");
System.out.println("Num items: " + liveCurvesNodeList.getLength());
// Get the first node from the node list
Node liveCurvesNode = liveCurvesNodeList.item(0);
System.out.println("Live Curves Node: " + liveCurvesNode.getNodeName());
walkover(liveCurvesNode);
} catch (Exception ex) {
System.out.println(ex);
This is the xml chunk that I want to mainpulate
<LiveCurves>
<dd.enumerate>
<AUD>
<Currency>AUD</Currency>
<Handle>GregB_AUD.today.</Handle>
<Shortcut>LondonJava</Shortcut>
<Source>XDB</Source>
</AUD>
</dd.enumerate>
<dd.enumerate>
<CAD>
<Currency>CAD</Currency>
<Handle>GregB_CAD.today.</Handle>
<Shortcut>LondonJava</Shortcut>
<Source>XDB</Source>
</CAD>
</dd.enumerate>
This is the new modified code but I still get blanks for the Text Values I am trying to retrieve....
import org.w3c.dom.*;
import org.apache.xerces.parsers.DOMParser;
public class CurveConfSave{
public static void walkover(Node n){
if( n.getNodeType() == Node.ELEMENT_NODE){
System.out.println("Walking over: " + ((Element)n).getNodeName());
for( Node c = n.getFirstChild();c != null;c=c.getNextSibling()){
if("GBP".equals(c.getNodeName())){
NodeList childNodes = c.getChildNodes();
System.out.println("Child Nodes Length " + childNodes.getLength());
for (int i=0; i < childNodes.getLength();i++){
if(childNodes.item(i).getNodeType() == Node.ELEMENT_NODE){
System.out.println("Node value: " + "[" + childNodes.item(i).getNodeName() + "]");
if(childNodes.item(i).getNodeType() == Node.TEXT_NODE){
System.out.println("Node value: " + "[" + childNodes.item(i).getNodeValue() + "]");
System.exit(0);
walkover(c);
public static void main(String[] args) {
try {
DOMParser p = new DOMParser();
p.parse("CurveConf1.xml");
Document doc = p.getDocument();
NodeList liveCurvesNodeList = doc.getElementsByTagName("LiveCurves");
System.out.println("Num items: " + liveCurvesNodeList.getLength());
// Get the first node from the node list
Node liveCurvesNode = liveCurvesNodeList.item(0);
System.out.println("Live Curves Node: " + liveCurvesNode.getNodeName());
walkover(liveCurvesNode);
} catch (Exception ex) {
System.out.println(ex);
Similar Messages
-
HT4427 how do you get the speak to text on the iphone4
How do you get the speak to text on the iphone4??
You do not... that is a feature of the 4S and 5 with Siri.
-
How do you get times on incoming texts?
how do you get times on incoming texts?
To use Videora iPod Convertor to convert movies for use on your iPod, consult these helpful links:
To get started: http://www.videora.com/en-us/Converter/iPod/
If you have questions: http://www.videora.com/en-us/Converter/guides.html
If you have more questions, post them here: http://www.pspvideo9.com/forums/index.php?c=8
Note that Videora iPod Convertor is a 3rd party program. If you need help with it, post your question there.
GFF -
once you have downloaded ESX24 sample packs from the internet how do you get them on to logic so you can use them ?
Mac App Store: Hiding and unhiding purchases
http://support.apple.com/kb/HT4928 -
How do you get the cursor to move faster using the arrow key?
And how do you forward delete?
nerowolfe wrote:
STU9000 wrote:
Thanks, been wondering how to do that for ages.
Still can't see the answer to my first question though...
re-read my post. The answer is there.
Malcolm Rayfield wrote:
Still can't see the answer to my first question though...
*_Use Fn-Delete_*
That was my second question. -
how do you get your ipod touch to make a noise when people text you and to pop up on the screen my friend did something to her ipod to do this but i dont know how please help!!!!!!!!!!!!!!!!!!!!!!!!!!! its like she updated it but i already tried it!!!!!!i am very confused and want my ipod touch 4g like that please help thxns:)
Go to Settings>Notifications and turn alerts/sounds on for the app(s) in question. Not all apps have all options.
-
How do you get your text messages to not show on the screen when they come in
How do you get your text messages to show on the screen when then come in? My iphone 3s would just say the persons name and text message. This says the persons name and the whole message
Settings > Notifications > Messages > Show Preview - Turn to OFF
-
When I am on my home screen on the iPhone, swipe left to the search page. Put a letter in the search field. then scroll down. eventually you get to all your texts previously deleted or not. The are all there. How can I clear the entire text from the phone
When I am on my home screen on the iPhone, swipe left to the search page. Put a letter in the search field. then scroll down. eventually you get to all your texts previously deleted or not. The are all there. How can I clear the entire text from the phone
-
How do you get your ring/text tones that were purchased back on your phone
how do you get your ring/text tones that were purchased back on your phone
Hey there oops31,
Welcome to Apple Support Communities.
It sounds like you want to know how to get tones that you’ve previously purchased on your iPhone 4s. The article linked below outlines the options for downloading past purchases and includes information about syncing tones from iTunes to your iOS device.
Download past purchases - Apple Support
Audiobooks, ringtones, and tones
If you made a backup of these items on your Mac or PC, you can sync the items to your iOS device. You can't download these items again from iTunes in the Cloud.
Cheers,
-Jason -
The text knock out, how do you get rid of the black backround?
the text knock out, how do you get rid of the black backround?, ive seen people have the text negative with out the black backround im just not sure how to do it. im running version 10.0.3
The text in FCP has no black background. You put it on top of whatever you want and the background is transparent.
-
How do you get the text box text properties dialog box to appear on a MAC?
how do you get the text box text properties dialog box to appear in Adobe Reader XI on a MAC? I know windows is Ctrl-E but can't figure out what to hit for Mac.
Right-click the toolbar and you should find it there (including the short-cut, which is probably Cmd+E).
-
How do you get LabView7.0 to place a text display on top of a graph instead of it becoming buried and invisible?
On your toolbar, you will see a little icon on the far right. The tip strip says Reorder. Select the graph, then the Reorder button and select Move to Back.
-
How do you get passwords to stay valid?? Why do videos from Facebook and mail only play in 1/2 the screen?? I have been forced to Apple by my boss. Before, I had a "dumb" phone (talk, text, pics only) i can't seem to find a users guide that answers my questions. I don't know what category this falls in. Is there an"I-phone For Dummies" book/site?
Didn't you look?
iphone for dummies
And there's always the manual of course. -
Pages for ipad2 - how do you get text to wrap around the contours of a picture? Not the simple square wrap, but I saw text following the contours of a picture of a bike wheel at the Apple store demo
Sjazbec,
Thanks for the reply.
I did read the help and went through the tutorial - the butterfly text wrap (and the wrap around the curved contour of the bicycle wheel at the Apple store) is the reason I am asking this question. I don't know how to use one of my own pictures and tell Pages what contour to wrap around. Is there some additional image editing software that I need to "creatively crop" one of my own pictures, so that Pages will be able to wrap around that contour?
Thanks / Danke!! -
i bought a ringtone that was delivered by text from cellsea. i thought it would show up in Ringtones in settings. It didn't. How do you get the ringtone into the ringtone library so it can be hooked to a incoming ring
You don't.
This is not how you get ringtones for iphone.
Maybe you are looking for
-
Nokia 808 Video mode - Jerking problem
The Jerking only happen when video mode happen on all setting 1080p,720p,360p. So I guess someone really happen in the hardware itself. Yes I tried touch screen zoom in this video and also volume button in the middle of the video. Both having the jer
-
Hi :) I just bought a new Macbook Air .
i had to reset it and when all was done my IPhoto went missing? now they are asking me to purchase it again? help? TY
-
CANNOT CREATE FILE ? DOWNLOADING
I let a friend borrow my computer and i think he changed some stuff on it. Now everytime i try to download andything in the downloads screen it says "cannot create file" and doenst download the file. Anyone have any ideas?
-
Why can't I email photos direct from iPhoto?
Why can't I email photos directly from iPhoto, or even attach them to email?
-
HT201364 I have a brand new macbook pro, but it won't let me download mavericks
I have a brand new macbook pro, but it won't let me download mavericks