parsing an xml file via php

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • thomas

    parsing an xml file via php

    hey everybody,

    does anyone know a good internet page where I can found some examples
    how to parse xml files by php.....

    all the pages I found give me too little information, so I was not able
    to solve my whole prob.


    thanks in advance,
    thomas

  • Snef

    #2
    Re: parsing an xml file via php

    Hi,

    I used clsParseXML. This is the header from the file itself:
    /*
    XML Parser Class
    by Eric Rosebrock
    PHP Freaks is a website dedicated to learning and teaching PHP. Here you will find a forum consisting of 173,006 members who have posted a total of 1,536,955 posts on the forums. Additionally, we have tutorials covering various aspects of PHP and you will find news syndicated from other websites so you can stay up-to-date. Along with the tutorials, the members of the forum can help you with your scripts, or you can help others by sharing your knowledge and answering questions.


    Class originated from: kris@h3x.com AT: http://www.devdump.com/phpxml.php

    Usage:

    <?php
    include 'clsParseXML.ph p';

    $xmlparse = &new ParseXML;
    $xml = $xmlparse->GetXMLTree('/path/to/xmlfile.xml');

    echo "<pre>";
    print_r($xml);
    echo "</pre>";
    ?>

    The path to the XML file may be a local file or a URL.
    Returns the elements of the XML file into an array with
    it's subelements as keys and subarrays.

    */

    Maybe you can find this ;)

    (I made a little adjustment so that I could use 'in memory' xml (= string with xml).

    thomas wrote:
    hey everybody,
    >
    does anyone know a good internet page where I can found some examples
    how to parse xml files by php.....
    >
    all the pages I found give me too little information, so I was not able
    to solve my whole prob.
    >
    >
    thanks in advance,
    thomas
    >

    Comment

    • jcbarry6@gmail.com

      #3
      Re: parsing an xml file via php


      thomas wrote:
      hey everybody,
      >
      does anyone know a good internet page where I can found some examples
      how to parse xml files by php.....
      >
      all the pages I found give me too little information, so I was not able
      to solve my whole prob.
      >
      >
      thanks in advance,
      thomas
      This site goes into pretty deep detail about how to do it.


      It works in PHP5 as well.

      Jay

      Comment

      Working...