How to read the text of an XML with the dom parser?

Hi all

It's my code. How will I be able to read the text inside the xml file using dom parser?

my xml file is like this...



 
    LLEYTON
    Hewitt
    Australian
   
    1
    897
   

 


    André
    Agassi
    American
   
    2
    679
   

 

which I stored in _xml.

InputStream is = getClass () .getResourceAsStream (_xml);

DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance ();

DocumentBuilder db = dbf.newDocumentBuilder ();

Doc document = db.parse (is);

NodeList nl = doc.getElementsByTagName("*");

for (int i = 0; i)< nl.getlength();="">

{

System.out.println ("node name" + nl.item (i) .getNodeName ());  Player, firstname, lastname, tennis o/p

System.out.println ("node value" + nl.item (i) .getTextContent ());  o/p value null, null, null, null

}

I want the text in the first name should get displayed as "Lleyton" and any other text in other tags as Andre/Agassi/American/2/679

You can install JDE and operates the samples, you will find XMLDEMO that will help you read XML application blackberry;

good luck;

Tags: BlackBerry Developers

Similar Questions

  • How to read the value of the javascript component text entry

    Hello

    I need to add ' / ' after user entering the first two characters and before entering the third character of character to the value of input text.
    To meet this requirement, I add a clientListener of type keyPress to input text element.
    My question is how to read the value entered by the user to input text in java script component (the clientListener method).

    I faked my requirement in a sample application @ http://www.easy-share.com/1912896093/format.7z

    Please help solve this problem.

    Thank you
    Kiran

    For setting/getting the value, you can even view:




    function keyPress (event) {}
    component = event.getSource ();

    Alert (Component.getSubmittedValue ());

    {component.setValue ("new value '");}
    ]]>

    Thank you
    Nini

  • How to read the XML doc in variable with XPath?

    Suppose that a variable in BPEL contains an entire XML document as (without the quotes):

    "value1 < foo > < bar > < / bar > < bar > value2 < / > < / foo >.

    How to read of BPEL an XPath expression with the value of the second
    < bar > element in a nother variable "target"?

    What do I have to use getvariabledata? How to pass the XPath?

    Peter

    Peter

    Here's how you can get there by business to be divested. You can access it by writing the XML expression (do not select foo--> bar directly on the tree) as below

    bpws:getVariableData ('Variable_name', 'Foo','/ NS4:foo / NS4:barbpws:getVariableData("intCounter")') and assign it to the variable "target". Here the value of the variable integer "intCounter" represents the nth element under the tag "foo". Let us know if you face any issues.

    Hope this will help.

  • How to read the files on time capsule

    How to read the files on time capsule from iPad?

    Thank you

    Using an application like navigation on the iPad. More info here:

    Stratospherix - FileBrowser - overview

  • How to read the status of User1 DIP-switch with a cRIO FPGA chassis?

    How to read the State of the DIP switches on a FPGA cRio chassis?

    I work with a cRIO 9022... My idea is to put the system in "service" mode with USER1 switch to IT and communicate with the FPGA via the FPGA - GUI (VI) on the host computer instead via the RT module that is used in normal conditions.

    Any ideas? Unfortunately, I don't have an unused channel on the left... .and (as I know) cannot use the interface RS232 of FPGA.

    Many thanks in advance,

    Luke

    Hi, this is the correct information. You cannot read the FPGA of DIP-switch status. The only thing you could do is to use the function of Reading Switch.vi located under the range of functions-> real-> utilities RT time

    It's how you probably know side host RT and not the FPGA.

    Cordially Virginia

  • How to read/write tdms 2.0 files with the TDM C DLL?

    Hello

    How to read/write tdms 2.0 files with the TDM C DLL?

    How consequently the datas in interlaced with the TDM C DLL mode?

    Thank you

    Confirmation: TDM C DLL always wrote the file in TDMS version 2.0.

  • How to read the value of list boxes by iteration in a loop For?

    I have a lot of list boxes on the front of my VI. I want to know how to read the value of this combo with a loop boxes For. The point is that I don't know how to get the reference of each combo box in a loop.

    Any information would be welcome. Thank you!

    su27 wrote:

    I have a lot of combo boxes on the front of my VI [...]

    Be sure to close the references that you have finished with them.

  • How to read the VI Analyzer config file?

    Hello

    How to read the analuzer vi configuration file? I'm getting a lot of errors on the size of the front panel and I don't know what should be the size you want. Where is the maximum expected size of the specified front panel?

    Kaspar says:

    Hello

    How to read the analuzer vi configuration file? I'm getting a lot of errors on the size of the front panel and I don't know what should be the size you want. Where is the maximum expected size of the specified front panel?

    If you have VI Analyzer installed, you can load the configuration file and look at the section select the Tests. There is a test for the maximum size of front under front-> User Interface. The default value is the resolution of the current monitor of the PC (including multiple monitors). You can change to the desired option.

  • How to read the date and time of a file by labview information

    How to read the date and time of a file by labview information? for example, time created and updated time.

    The similar question had already spoken here (this is the old thread but still seems topical):

    http://forums.NI.com/T5/LabVIEW/file-date-created/TD-p/109836

  • How to read the host name or serial number cRIO locally

    I have not worked with cRIO and decided to ask for help.  (o).

    I don't know about the screws that allow to access this information from a connected Windows machine, however, I want to retrieve and display this information on remote panels.  But I cannot determine how to read the cRIO hostname or the serial number of the software running on the cRIO?

    Thanks for the help.

    James

    This could help.

  • How to read the two columns of data from the Port series

    Hello

    I'm reading two columns of data from the serial port.

    Example:

    52439 52430

    52440 52437

    52209 52214

    51065 51070

    52206 52390

    I use the serial of Visa service and I can read the first column of data from the serial port, but I can't understand how to read the second column.

    I want to both sets of chart data.

    I enclose my VI.

    Thank you for your help.

    The analysis of string function takes a "Format string" on top (with the right button of the function and choose Help, which explains all the entries).  In particular, you can say 'Give me two numbers separated by a tab' and the output will be two numbers (whole or floating, depending on the chosen format).  In particular, %d\t%d specifies a decimal integer, , whole decimal.

  • How to read the color table in a subvi?

    How to read the color table in a subvi? Is it made by a reference to the table or with a global variable? For a better understanding of the problem, I added to vi. Run the "run.vi." I want to see

    the background color of the table "run.vi" in the subvi called "read color.vi".

    How can I do?

    Thanks in advance

    Norick

    pop up on the wire table refernece and establishes 'control '. Add this control to the icon of the sub - VI decision-making and then wire ref of the appellant to this Terminal VI so the calling VI move the ref to the Subvi.

    Ben

  • How to read the 32-bit depth .bmp image

    How to read the image, 32-bit depth using LabVIEW .bmp?


  • How to read the analog inputs of one Board of R for (PXI-7851R) series

    You can guide me please with the steps for reading of the analog inputs of a series a. card I use as the target fpga PXI-7851R.

    Have you looked at the examples provided with LabVIEW? There are examples showing how to read the analog inputs.

  • How to read the version of the operating system

    Hello

    Anyone know how to read the version of the operating system? My program has to know if it runs on Win Xp or Win 7 to adjust the setting.

    Thank you very much!

    Weiming

    GetWinOSVersion

Maybe you are looking for

  • Why mac won't erase the files - 43 error code

    I have an iMac that runs on the Version OS X El Capitan 10.11.3.  The processor is 3.2 GHz Intel Core i5 8 GB 1600 MHz DDR3 memory. For these last days, I was unable to use the move to trash function.  "Whenever I try to delete a file, I get the foll

  • Upgrade of RAM of the laptop Compaq Presario CQ57 307TU

    Hi, I have the map of ram standard 1x2gb and want to upgarde it to 8 GB. IM wondering what kind of card I need, I think I need a "10600 1333 mhz ddr3"-which is the correct? ". also, what is the difference between getting a 1x8gb and 2 x 4 GB card? Th

  • HP COMPAQ 15-a00tu drivers for windows 7 (32-bit operating system)

    I need drivers for HP COMPAQ 15-a00tu windows 7 (32 bit OS), I looked in the official website of HP, but there we have drivers for the 64 bit OS please help me to get the 32-bit drivers. Thanks in advance.

  • Messed up Windows Update?

    So, in these last days I noticed my Shutdown button with the shield on this subject. I press the button, close my PC and not to think about until the next time that I stopped and realized that he was still there. Finally, I click on windows update, a

  • Enabling ICS - the specified service does not exist as an installed device.

    My computer is running Windows 7 Ultimate 64 bit. I tried to turn my phone into a wi - fi hotspot. I have a wired and a wireless network adapter. I used the two cmd.exe as well as trying to create an ad hoc wireless network, but none works because I'