Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Multiple XML Files

Status
Not open for further replies.

Ondoa

Programmer
Mar 27, 2007
4
US
Hello,
I have a feed that produces a new xml file everytime info is updated (it does not overwrite one file, it produces new files), which adds up very quickly. I need to know how to process these files, so that I can utilize the data and then delete the original files.

Any advice would be much appreciated.
Ondoa
 
Your question is much too general for a good response. The answer would all depend on what you want to use to process these files and what you are doing with the data.

For example, if you wanted to place the data from the xml files in a DB, you could use something like PHP to parse the files and send the data into a DB. This example, however, is just one of many possibilities and the best solution to your task is highly dependant on what languages you may alreay know and what you are trying to do with the data.

If you provide some more details perhaps you could get some more helpful and specific responses.
 
Thanks for the response Opengavel,
I'm open to whatever sounds like the best solution, regardless of required skillsets.

Here's my project. I need to create a view for airline flight schedules. The main database exports an xml file for each flight number and creates a new file each time that flight has an update. I am hoping to find the best way to process the information and display the most current information, while also automatically deleting the xml files when they're no longer needed, so my server doesn't get bogged down with these updates. There can be as many as 15 files created every minute.


 
In the past, I've used html and xsl to present xml data. My experience has been with referencing one xml file, which gets overwritten upon every update. I just want to know what has to be done in order to reference all of these unique files into one html/xsl view of the data.

I am at a loss. This is not the type of xml feed that I'm used to seeing. My primary research has shown that I must have an intermediary solution to process all of these files before I can implement my simple html/xsl view of the data. I just don't know what that intermediary solution should be.

Thanks.
 
Familiarize yourself with the document() function. Your main input document can be a simple XML document that contains the URIs of the other input documents. The only complication this adds to your XSL is the need to add a level to process this intermediate document. An attempt at an example (borrowed from a previous thread):
Code:
<?xml version="1.0"?>
<resource-list>
<name>ZZZ.xml</name>
<name>YZY.xml</name>
<name>XYZ.xml</name>
<name>XYX.xml</name>
<name>BCD.xml</name>
<name>MMM.xml</name>
<name>ABC.xml</name>
<name>AAA.xml</name>
</resource-list>
where each of these xml documents has the following structure:
Code:
<?xml version="1.0"?>
<resource>
<name>ABC Resource</name>
<description>Resource Description</description>
</resource>
Code:
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="[URL unfurl="true"]http://www.w3.org/1999/XSL/Transform">[/URL]

<xsl:template match="/">
    <xsl:for-each select="resource-list/name">
        <xsl:apply-templates select="document(.)/*"/>
    </xsl:for-each>
</xsl:template>
[b]<!-- place template(s) here that match the input documents' root node -->[/b]
</xsl:stylesheet>

Does this help?

Tom Morrison
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top