[thelist] PHP + XML question

Burhan Khalid thelist at meidomus.com
Tue Mar 18 13:18:34 CST 2003


Hello List :

      You know how they say you never know the worth of something till
      its gone? Well ... its true. I am so glad the list is back up.
      I've been struggling with this question for quite a time now.

      New to PHP and XML, so please advise as appropriate :

      How do I find the parent node of a XML tag? The sample XML data
      that I'll be working with is here :
      http://weather.interceptvector.com/weather.xml?id=VVNDQTA5ODI%3D

      As you can see, <sky> <wid> and <precipitation> appear both as
      children of <weather> and <forecast>. I managed to read the XML
      file in, after understanding how the parser works, but got stuck
      with this problem.

      My current setup checks to see which tag the parser is on, and
      then appropriately populates a class with the information.
      However, I currently have no way of knowing if the parser is on
      the <wid> of <weather> or the <wid> of <forecast>. My temporary
      solution is that of setting a flag when we are in <forecast>,
      and doing a bunch of ifs, but I know there has got to be a
      better way to do this.

      Thanks in advance for your thoughts on this.

      PS > I can donate some space on my server if evolt.org needs it.


  

-- 
Best regards,
 Burhan
 mailto:thelist at meidomus.com





More information about the thelist mailing list