Why to parse xml?


XML & Web services: Why to parse xml?

  1. Why to parse xml? (1 messages)

    I am a newbiee to web service. May i know that why we need to parse xml? actually what mean by parse? if i retrieve information from xml, how i gonna display it in html properly?

    Threaded Messages (1)

  2. Why to parse xml?[ Go to top ]

    An XML document is a semantic representation of some data. In other words, it gives you a piece of data and says what the data is.

    However, in order to use the semantics (metadata) and the data itself, you need to interpret the raw XML document, which is just a string of characters, into a programming construct. This interpretation is called parsing. You parse raw XML in order to understand it.

    As to your question about displaying XML in HTML, a transformation is needed. This transformation is basically a process containing the following two steps:
    1) Parse the XML into a programming construct (for example, from "billingdata.xml" to an instance of com.company.BillingData class)
    2) Generate HTML based on the programming construct

    The implementation of steps 1 and 2 are dependent on the format/schema of the XML document, the structure of the programming construct, and the rules based on which the HTML is to be produced. Often this process is realized with the help of an XSL stylesheet, which describes the transformation form a particular XML schema to something else (usually HTML, could be WML/XHTML/plaintext/PDF/whatever).