Results 1 to 4 of 4
  1. #1
    SindhuP is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Parsing XML With DOM

    Hi,

    Can anyone provide me a link where I can find any example to parse the XML using DOM. I have an XML with deeply nested elements and I need to parse and write the data to a text file. I have gone through some of the tutorials and I am able to parse the XML. But, I am a bit confused with the nested nodes and elements. Could anyone help me pls.

    Please find the sample XML structure here:

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:abc xmlns:ns0="http://www.google.com">
    <B4K>
          <B4K01>00</B4K01>
          <B4K02>AC</B4K02>
          <R4F>
             <R4F01>CR</R4F01>
          </R4F>
          <R4F>
             <R4F01>CR</R4F01>
          </R4F>
          <N41>
             <N4101>ST</N4101>
             <N4102>abcd</N4102>
             <N43>
                <N4301>RAJ</N4301>
             </N43>
    		<N43>
                <N4301>szfsd</N4301>
             </N43>
             <N44>
                <N4401>US</N4401>
                <N4402>sdg</N4402>
                <N4403>500021</N4403>
             </N44>
          </N41>
          <P41>
             <P4102/>
             <P4103>SE</P4103>
             <P4104/>
             <PID>
    			<PID01>01</PID01>
    			<PID02>02</PID02>
    		</PID>
    		<PID>
    			<PID01>01</PID01>
    			<PID02>02</PID02>
    		</PID>
             <S4C>
                <S4C01>A</S4C01>
             </S4C>
             <A4K>
                <A4K01>FCE</A4K01>
                <A4K04>087</A4K04>
                <A4K05/>
             </A4K>
          </P41>
       </B4K>
    </ns0:abc>
    Last edited by SindhuP; 08-22-2012 at 05:05 PM.

  2. #2
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: Parsing XML With DOM

    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  3. #3
    SindhuP is offline Member
    Join Date
    Aug 2012
    Posts
    10
    Rep Power
    0

    Default Parsing XML using DOM in Java

    Hi,

    Can anyone provide me a link where I can find any example to parse the XML using DOM. I have an XML with deeply nested elements and I need to parse and write the data to a text file. I have gone through some of the tutorials and I am able to parse the XML. But, I am a bit confused with the nested nodes and elements. Could anyone help me pls.

    Please find the sample XML structure here:

    Java Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:abc xmlns:ns0="http://www.google.com">
    <B4K>
          <B4K01>00</B4K01>
          <B4K02>AC</B4K02>
          <R4F>
             <R4F01>CR</R4F01>
          </R4F>
          <R4F>
             <R4F01>CR</R4F01>
          </R4F>
          <N41>
             <N4101>ST</N4101>
             <N4102>abcd</N4102>
             <N43>
                <N4301>RAJ</N4301>
             </N43>
    		<N43>
                <N4301>szfsd</N4301>
             </N43>
             <N44>
                <N4401>US</N4401>
                <N4402>sdg</N4402>
                <N4403>500021</N4403>
             </N44>
          </N41>
          <P41>
             <P4102/>
             <P4103>SE</P4103>
             <P4104/>
             <PID>
    			<PID01>01</PID01>
    			<PID02>02</PID02>
    		</PID>
    		<PID>
    			<PID01>01</PID01>
    			<PID02>02</PID02>
    		</PID>
             <S4C>
                <S4C01>A</S4C01>
             </S4C>
             <A4K>
                <A4K01>FCE</A4K01>
                <A4K04>087</A4K04>
                <A4K05/>
             </A4K>
          </P41>
       </B4K>
    </ns0:abc>

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,242
    Rep Power
    19

    Default Re: Parsing XML With DOM

    Please go through all the links I posted earlier. Specifically, the second paragraph of the forum rules.

    I've merged the two threads.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. Parsing XML
    By Opid in forum New To Java
    Replies: 0
    Last Post: 10-03-2011, 01:39 AM
  2. Parsing XML
    By virvalid in forum Advanced Java
    Replies: 3
    Last Post: 08-10-2009, 12:40 PM
  3. Parsing
    By Matt Sakko in forum New To Java
    Replies: 14
    Last Post: 03-21-2009, 04:49 PM
  4. Xml Parsing
    By Nomad in forum XML
    Replies: 12
    Last Post: 02-22-2009, 11:19 AM
  5. xml parsing
    By gaurav65176 in forum XML
    Replies: 5
    Last Post: 11-12-2008, 11:07 AM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •