xml to text file using java

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • vishwa040
    New Member
    • Feb 2007
    • 9

    xml to text file using java

    hi folks,
    I need to convert a xml file into a text file using core java..


    thanks in advance...
    plz reply to [email removed]
    Last edited by MMcCarthy; Feb 21 '07, 06:21 AM. Reason: removing email address - against site rules
  • dmjpro
    Top Contributor
    • Jan 2007
    • 2476

    #2
    give me the xml file content ...

    and what u want from it ....


    i am online

    Comment

    • vishwa040
      New Member
      • Feb 2007
      • 9

      #3
      Originally posted by dmjpro
      give me the xml file content ...

      and what u want from it ....


      i am online
      <?xml version="1.0" encoding="utf-8" standalone="no" ?>
      <!DOCTYPE persons SYSTEM "http://mail.persistent .co.in/v1/addrbook.dtd">
      <persons count="13">
      <person ref="6024732a-1c38-102a-922a-0007e9315819">
      <cn>Satish Agrawal</cn>
      <category unfiled="yes">3 </category>
      <primaryphone>t elephonenumber</primaryphone>
      <uuid>6024732 a-1c38-102a-922a-0007e9315819</uuid>
      <lastmodtime>20 060118T063535Z</lastmodtime>
      <surname>Agrawa l</surname>
      <givenname>Sati sh</givenname>
      <mail>satishgra wal@persistent. co.in</mail>
      <telephonenumbe r primary="yes"/>
      <nickname>satis h</nickname>
      <displayname>Sa tish Agrawal</displayname>
      </person>
      <person ref="0dbb27fa-20ed-102a-9922-0007e9315819">
      <cn>Rahul Patil</cn>
      <category unfiled="yes">3 </category>
      <primaryphone>t elephonenumber</primaryphone>
      <uuid>0dbb27f a-20ed-102a-9922-0007e9315819</uuid>
      <lastmodtime>20 060124T061900Z</lastmodtime>
      <surname>Pati l</surname>
      <givenname>Rahu l</givenname>
      <mail>rahulptil @persistent.co. in</mail>
      <telephonenumbe r primary="yes"/>
      <nickname>rahul </nickname>
      <displayname>Ra hul Patil</displayname>
      </person>
      <person ref="d141cc6e-20fd-102a-8307-0007e9315819">
      <cn>Milind Limaye</cn>
      <category unfiled="yes">3 </category>
      <primaryphone>t elephonenumber</primaryphone>
      <uuid>d141cc6 e-20fd-102a-8307-0007e9315819</uuid>
      <lastmodtime>20 060124T081900Z</lastmodtime>
      <surname>Limaye </surname>
      <givenname>Mili nd</givenname>
      <mail>milindaye @persistent.co. in</mail>
      <telephonenumbe r primary="yes"/>
      <nickname>milin d</nickname>
      <displayname>Mi lind Limaye</displayname>
      </person>
      <person ref="b620b9c4-2669-102a-929b-0007e9315819">
      <cn>prerana</cn>
      <category>2</category>
      <primaryphone>t elephonenumber</primaryphone>
      <uuid>b620b9c 4-2669-102a-929b-0007e9315819</uuid>
      <lastmodtime>20 060131T055356Z</lastmodtime>
      <surname>khar e</surname>
      <givenname>prer ana</givenname>
      <mail>preranhar e@persistent.co .in</mail>
      <telephonenumbe r primary="yes"/>
      <nickname>prera na</nickname>
      <displayname>pr erana</displayname>
      </person>
      </persons>
      And I want the outputs in following format (For each record ) :

      And I want the outputs in following format (For each record ) :

      Person 1:
      Name : Satish Agrawal
      Surname : Agrawal
      and so on.....

      Comment

      • dmjpro
        Top Contributor
        • Jan 2007
        • 2476

        #4
        try to utilize the link ....

        http://www.cafeconlech e.org/books/xmljava/chapters/
        if it helps u

        Comment

        • r035198x
          MVP
          • Sep 2006
          • 13225

          #5
          Originally posted by vishwa040
          hi folks,
          I need to convert a xml file into a text file using core java..


          thanks in advance...
          plz reply to [email removed]
          You can use JAXP.

          Comment

          Working...