?
Solved

SimpleXML for 4.3

Posted on 2007-04-05
5
Medium Priority
?
601 Views
Last Modified: 2013-12-12
I had a link that I can't find to some code that would act like the new SimpleXML function in php5. Does anyone know of any code that can act like SimpleXML in php 4.3. Specifically it reads the XML string or document and turns it into a PHP Object.
0
Comment
Question by:Isisagate
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
5 Comments
 
LVL 23

Accepted Solution

by:
Stacy Spear earned 1000 total points
ID: 18859383
0
 
LVL 23

Expert Comment

by:Stacy Spear
ID: 18859399
Oops, you did say object. Its already there as XML DOM. Or maybe you need to compile it in if it isn't.

http://us3.php.net/domxml
0
 
LVL 11

Author Comment

by:Isisagate
ID: 18885494
Well the thing is the dom is overly complicated to work with going through all the nodes and such. what I want is this...

<quote>
    <customer>
        <firstname>bob</firstname>
        <lastname>smith</firstname>
    </customer>
    <customer>
         <firstname>Sally</firstname>
         <lastname>Peters</lastname>
    </customer>
</quote>


I want to be able to access it like this....


echo($quote->customer[0]->firstname);  //returns bob
echo($quote->customer[1]->firstname); //returns Sally


I ran across some code that did it once before but I lost the link. Also I have similar code for JavaScript. It just seems like a natural way to access XML especially in a loose typed language.  Kinda like it parses the DOM and builds the objects.
0
 
LVL 23

Expert Comment

by:Stacy Spear
ID: 18888369
Maybe you were referring to the Php (4 something) function of xml_parse_into_struct()?

http://www.google.com/search?q=xml_parse_into_struct%28%29
0
 
LVL 11

Author Comment

by:Isisagate
ID: 18891634
Nope that's not what I had found it literally converted the XML into a PHP Object structure. Not an array structure.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to count occurrences of each item in an array.
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question