CDATA
Brought to you by:
bs_php,
nigelswinson
|
From: Gabriel T. <gth...@we...> - 2004-01-21 17:54:45
|
Hello,
I just can't figure out, how to get CDATA out of an element.
My xml file:
<?xml version="1.0" encoding="iso-8859-1"?>
<Buyer>
<User>
<AboutMe>0</AboutMe>
<AllowPaymentEdit>1</AllowPaymentEdit>
<CIPBankAccountStored>0</CIPBankAccountStored>
<CheckoutEnabled>1</CheckoutEnabled>
<Email><![CDATA[gth...@we...]]></Email>
<RegDate>2003-12-30 15:31:20</RegDate>
<CountryCode>us</CountryCode>
<Zip>94115</Zip>
<UserId>mkgtest2</UserId>
</User>
</Buyer>
This works fine:
$user = $xpath->getData('/Buyer[1]/User[1]/UserId[1]/');
$user = $xpath->getData('/Buyer[1]/User[1]/UserId[1]/text()!!');
return is "mkgtest2".
For the element "Email" i have not found anything that returns
"gth...@we...".
I tried:
$user = $xpath->match('//Email');
It returns Array ( [0] => /Buyer[1]/User[1]/Email[1] )
Ok, that's fine, but when i try to use that xpath in
$user = $xpath->getData('/Buyer[1]/User[1]/Email[1]');
or
$user = $xpath->getData('/Buyer[1]/User[1]/Email[1]/text()!!');
i get nothing, not even an error.
So what's the deal with the CDATA ?
I guess i'm missing something because this can't be
so hard.
Thanks,
Gabriel
|