Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Getting data from XML

Options
  • 22-12-2006 1:05am
    #1
    Registered Users Posts: 3,330 ✭✭✭


    I'm looking for a way of saving data from an XML file into text or Excel?

    I think it's possible with PHP maybe?

    Basically I want some automatic method which accesses an XML file (from an external site) every so often, and saves certain data from it.

    Any suggestions?


Comments

  • Registered Users Posts: 7,468 ✭✭✭Evil Phil


    Yep it's possible: http://ie2.php.net/xml. What programming languages do you know/are hoping to learn?


  • Closed Accounts Posts: 381 ✭✭DAVE_K


    SAX/DOM (depending on the size of your file, SAX for large files, DOM for smaller ones) are what you want to be using to read it.
    Then use a method in your program to create a text file and output it.

    If you're using Java Xerces/Xalan are the XML readers to use. If using .NET
    there's various XMLTextReader/XMLStreamReader classes in the XML.NET Framework package.

    If you're using anything else I'm not so sure.


  • Closed Accounts Posts: 248 ✭✭comanche


    plazzTT wrote:
    I'm looking for a way of saving data from an XML file into text or Excel?

    I think it's possible with PHP maybe?

    Basically I want some automatic method which accesses an XML file (from an external site) every so often, and saves certain data from it.

    Any suggestions?


    apache xmlbeans or castor for java


  • Closed Accounts Posts: 22,479 ✭✭✭✭philologos


    plazzTT wrote:
    I'm looking for a way of saving data from an XML file into text or Excel?

    I think it's possible with PHP maybe?

    Basically I want some automatic method which accesses an XML file (from an external site) every so often, and saves certain data from it.

    Any suggestions?

    you'd neeed to run a seperate PHP file on the commandline to get the data at seperate intervals as it has to be run the whole time. and another on the webpage to view it. I have to do that for my IRC bot


  • Registered Users Posts: 1,127 ✭✭✭smcelhinney


    Use Java, Xalan/Xerces, Xpath and cron.

    Java (w. Xalan/Xerces) to parse the file
    Xpath to extract required information
    cron to schedule this

    example:

    java Extractor "/path/to/element[@attribute = 'criteria']"

    the parameter is an Xpath expression.

    add this to your crontab file. If you're using Windows, first of all, damn you, second of all, get cygwin www.cygwin.com

    Bobs your fathers brother..


  • Advertisement
Advertisement