Extracting data from XML document

Discussion in 'XML' started by Ken, Nov 27, 2003.

  1. Ken

    Ken Guest

    What software is required to extract certain data from an XML
    document?
    Ken, Nov 27, 2003
    #1
    1. Advertising

  2. Ken

    Ken Guest

    What I mean by the below question is rather : What software is
    required to extract certain data from an XML document that is served
    from another website?

    On Thu, 27 Nov 2003 03:15:22 GMT,
    (Ken) wrote:

    >
    >What software is required to extract certain data from an XML
    >document?
    Ken, Nov 27, 2003
    #2
    1. Advertising

  3. Ken wrote:
    >
    > On Thu, 27 Nov 2003 03:15:22 GMT,
    > (Ken) wrote:
    >
    >
    > What I mean by the below question is rather : What software is
    > required to extract certain data from an XML document that is served
    > from another website?
    >
    >>What software is required to extract certain data from an XML
    >>document?


    XML parsers know how to load files via HTTP so all you need is an XML
    parser. Check http://xml.apache.org/ for XML parsers.
    --

    Martin Honnen
    http://JavaScript.FAQTs.com/
    Martin Honnen, Nov 27, 2003
    #3
  4. In article <>,
    Ken <> wrote:

    % What I mean by the below question is rather : What software is
    % required to extract certain data from an XML document that is served
    % from another website?

    What do you want to do? There are programs which can extract data
    and stick it a relational database. There are programs which can
    extract data and write it to a flat file. There are libraries which
    can feed data directly to an application you've written.

    --

    Patrick TJ McPhee
    East York Canada
    Patrick TJ McPhee, Nov 27, 2003
    #4
  5. Ken

    Guest


    > What software is
    > required to extract certain data from an XML document that is served
    > from another website?


    You can use XSLT's document() function.

    Code example:

    <xsl:template match="foo">
    <xsl:apply-templates select="document('http://www.theserver.com/foo.xml')"/>
    </xsl:template>


    Devon
    , Nov 27, 2003
    #5
  6. Ken

    Ken Guest

    I want to extract the data and put them into an access database. But
    do tell me more about the other programs like libraries which can feed
    data directl y to an application I have written.

    Tks

    On Thu, 27 Nov 2003 16:57:34 +0100 (MET), (Patrick
    TJ McPhee) wrote:

    >In article <>,
    >Ken <> wrote:
    >
    >% What I mean by the below question is rather : What software is
    >% required to extract certain data from an XML document that is served
    >% from another website?
    >
    >What do you want to do? There are programs which can extract data
    >and stick it a relational database. There are programs which can
    >extract data and write it to a flat file. There are libraries which
    >can feed data directly to an application you've written.
    Ken, Nov 28, 2003
    #6
  7. Ken

    Ken Guest

    Thanks Devon. I use your method and can't seem to return the required
    elements. Can you tell me what's wrong with the code below? The code
    is adapted from http://www.w3schools.com/xsl/xsl_value_of.asp


    --------------- code start here -------------------

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:template match="/">
    <xsl:apply-templates
    select="document('http://www.w3schools.com/xsl/cdcatalog.xml')"/>
    </xsl:template>

    <html>
    <body>
    <h2>My CD Collection</h2>
    <table border="1">
    <tr bgcolor="#9acd32">
    <th>Title</th>
    <th>Artist</th>
    </tr>
    <tr>
    <td><xsl:value-of select="catalog/cd/title"/></td>
    <td><xsl:value-of select="catalog/cd/artist"/></td>
    </tr>
    </table>
    </body>
    </html>
    </xsl:template>
    </xsl:stylesheet>

    -------------------- code end here -------------------


    On Thu, 27 Nov 2003 18:33:54 GMT, lid wrote:

    >
    >
    >> What software is
    >> required to extract certain data from an XML document that is served
    >> from another website?

    >
    >You can use XSLT's document() function.
    >
    >Code example:
    >
    ><xsl:template match="foo">
    ><xsl:apply-templates select="document('http://www.theserver.com/foo.xml')"/>
    ></xsl:template>
    >
    >
    >Devon
    Ken, Nov 28, 2003
    #7
  8. Ken

    Andy Dingley Guest

    On Fri, 28 Nov 2003 04:02:51 GMT,
    (Ken) wrote:

    >Thanks Devon. I use your method and can't seem to return the required
    >elements. Can you tell me what's wrong with the code below? The code
    >is adapted from http://www.w3schools.com/xsl/xsl_value_of.asp


    Try this:

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

    <xsl:variable name="doc"
    select="document('http://www.w3schools.com/xsl/cdcatalog.xml')"/>

    <xsl:template match="/">

    <html><body>
    <h2>My CD Collection</h2>

    <table border="1">
    <tr bgcolor="#9acd32"><th>Title</th><th>Artist</th></tr>

    <xsl:for-each select="$doc/catalog/cd" >
    <tr>
    <td><xsl:value-of select="./title"/></td>
    <td><xsl:value-of select="./artist"/></td>
    </tr>
    </xsl:for-each>

    </table>
    </body></html>
    </xsl:template>

    </xsl:stylesheet>



    If you want to see it quickly in client-side IE, save it as
    xsl_document.xsl and try browsing the following xml document

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <?xml-stylesheet type="text/xsl" href="xsl_document.xsl" ?>

    <foo />

    --
    Die Gotterspammerung - Junkmail of the Gods
    Andy Dingley, Nov 28, 2003
    #8
  9. In article <>,
    Ken <> wrote:

    % I want to extract the data and put them into an access database. But
    % do tell me more about the other programs like libraries which can feed
    % data directl y to an application I have written.

    I was thinking specifically of XML parsers, and in particular parsers
    which have XPath implementations. There are many of them floating around.
    --

    Patrick TJ McPhee
    East York Canada
    Patrick TJ McPhee, Nov 30, 2003
    #9
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Max
    Replies:
    6
    Views:
    6,070
    Malcolm Dew-Jones
    Sep 17, 2004
  2. Tony Prichard
    Replies:
    0
    Views:
    722
    Tony Prichard
    Dec 12, 2003
  3. Manish Hatwalne
    Replies:
    1
    Views:
    397
    Martin Honnen
    Jul 13, 2004
  4. Toto
    Replies:
    5
    Views:
    645
  5. GTN170777

    Extracting data from a document

    GTN170777, Jun 27, 2008, in forum: ASP General
    Replies:
    5
    Views:
    198
    Bob Barrows [MVP]
    Jun 28, 2008
Loading...

Share This Page