Re: Parsing an XML return from a POST - resend with a little more information
| From: | Roman Neuhauser | Date: | Wed, 10 Jan 2007 01:57:06 +0000 |
| Subject: | Re: Parsing an XML return from a POST - resend with a little more information | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-246821@lists.php.net to get a copy of this message | ||
# rluckhurst@resmaster.com / 2007-01-10 09:47:39 +1100:
> I have spent most of last night and today looking at XML parsing and now am
> totally confused. Some testing I have done suggests that SimpleXML is not the
> way to go however I am open to suggestions if it might be an answer.
What makes you think simplexml is not for you? I don't say it is, but
you need to tell us exactly what you need.
> I would appreciate any help or advice on how to parse this XML response and break it up
> into either an array or individual variables. It is important for this
> application to not only get the data contained between beginning and end tags
> but also the attributes as they contain important data returned from the server.
> I am the first to admit that PHP XML Parsing has me lost.
http://php.net/manual/en/ref.simplexml.php
has quite a few examples in
the user-contributed notes. Have you seen the manual?
> One other question I do have is that all of the examples I have seen, using the
> xml_parser, seem to be designed around a file being read into the parser. Is it
> possible for the XML data to be contained in a variable and then used in the
> parser?
Many of the examples at http://php.net/manual/en/ref.simplexml.php use
a
string variable as the source.
If that page in the manual is correct and there are no bugs, you should
be able to take off with
var_dump(new SimpleXMLElement($xmlstr));
where $xmlstr contains the server response.
--
How many Vietnam vets does it take to screw in a light bulb?
You don't know, man. You don't KNOW.
Cause you weren't THERE. http://bash.org/?255991