• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

how can i parse?

 
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
How can i parse a XML which is in String i.e.
String str="<?xml version="1.0" encoding="UTF-8"?>
<book>
<title>This is my first Xml program</title>
<prod id="15-12" media="internet"></prod>

<chapter>Introduction to XML
<para>what is XML</para>
<para>How to code XML</para>
</chapter>

<chapter>Intro to syntax
<para>Elements of XML</para>
<para>Attribute of XML</para>
</chapter>
</book>";

So which parser will be a good option, SAX or DOM?
 
Marshal
Posts: 28226
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To parse XML from a string, you do something like this:As for which parser to use, that depends on several things. Have you read any Java XML tutorials yet? Here's a link to one:

http://java.sun.com/xml/tutorial_intro.html
 
Suhas Madap
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
ThanQ paul. this will help me. ThanQ once again.
reply
    Bookmark Topic Watch Topic
  • New Topic