Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > XML > Extracting data from XML document

Reply
Thread Tools

Extracting data from XML document

 
 
Ken
Guest
Posts: n/a
 
      11-27-2003

What software is required to extract certain data from an XML
document?
 
Reply With Quote
 
 
 
 
Ken
Guest
Posts: n/a
 
      11-27-2003

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, http://www.velocityreviews.com/forums/(E-Mail Removed)
(Ken) wrote:

>
>What software is required to extract certain data from an XML
>document?


 
Reply With Quote
 
 
 
 
Martin Honnen
Guest
Posts: n/a
 
      11-27-2003


Ken wrote:
>
> On Thu, 27 Nov 2003 03:15:22 GMT, (E-Mail Removed)
> (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/

 
Reply With Quote
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      11-27-2003
In article <(E-Mail Removed)>,
Ken <(E-Mail Removed)> 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
(E-Mail Removed)
 
Reply With Quote
 
user@domain.invalid
Guest
Posts: n/a
 
      11-27-2003


> 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

 
Reply With Quote
 
Ken
Guest
Posts: n/a
 
      11-28-2003

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), (E-Mail Removed) (Patrick
TJ McPhee) wrote:

>In article <(E-Mail Removed)>,
>Ken <(E-Mail Removed)> 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.


 
Reply With Quote
 
Ken
Guest
Posts: n/a
 
      11-28-2003
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"
xmlnssl="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, (E-Mail Removed)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


 
Reply With Quote
 
Andy Dingley
Guest
Posts: n/a
 
      11-28-2003
On Fri, 28 Nov 2003 04:02:51 GMT, (E-Mail Removed)
(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"
xmlnssl="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
 
Reply With Quote
 
Patrick TJ McPhee
Guest
Posts: n/a
 
      11-30-2003
In article <(E-Mail Removed)>,
Ken <(E-Mail Removed)> 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
(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Extracting data from a document GTN170777 ASP General 5 06-28-2008 10:20 PM
Extracting text data from MS Word document Max Java 6 09-16-2004 11:01 PM
Refer to an XML document from within an XML document Manish Hatwalne XML 1 07-13-2004 10:24 AM
extracting data from a database and converting it into an XML file Toto C++ 5 03-06-2004 03:31 PM
Help on including one XML document within another XML document using XML Schemas Tony Prichard XML 0 12-12-2003 03:18 PM



Advertisments