Re: Parsing an XML return from a POST - resend with a little more information

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Roman Neuhauser wrote:
> # rluckhurst@xxxxxxxxxxxxx / 2007-01-10 12:09:40 +1100:
>> RN> What makes you think simplexml is not for you? I don't say it is, but
>> RN> you need to tell us exactly what you need.
>> RN>
>>
>> From what I can see, unless I am mistaken, SimpleXML can not deal with
>> attributes within a tag. It only seems to deal with data contained between a
>> start tag and an end tag. I have a lot of data contained within the start tags
>> that I must extract.

a cutdown example of the XML your trying to extract stuff from would
speak volumes.

> 
> A cursory glance at the ref.simplexml.php page led me to
> http://www.php.net/manual/en/function.simplexml-element-attributes.php,
> isn't this what you want?
> 
>> RN> http://php.net/manual/en/ref.simplexml.php has quite a few examples in
>> RN> the user-contributed notes. Have you seen the manual?
>> RN>
>>
>> Yes of course I have seen the manual.
>>
>> RN> Many of the examples at http://php.net/manual/en/ref.simplexml.php use a
>> RN> string variable as the source.
>>
>> Yes I know they do but the examples for xml_parse() do not use a string.
> 
> Uh, http://www.php.net/manual/en/function.xml-parse.php says xml_parse()
> takes a string. *shrug*
> Anyway, I'm still not convinced simplexml isn't enough for you.

me, I'm pretty convinced simpleXML is what he wants.

simpleXML was a dog to use in earlier versions of php5 because simpleXML objects
were 'immune' to inspection by var_dump(), print_r(), etc [meaning you be told some
property was an array and then get an error if you access said property as an array,
stuff like that].

those problems have been helped the way of the dodo so now simpleXML really does
what it says on the tin.

of course there is always the options of using regular expressions or simple
string manipulation functions to extract the relevant data from the string of
'xml' - technically there is no need to go anywhere near a 'real' xml parser
as such.

> 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux