[phpXML] Re: [phpXML] RE: [phpXML] Subscription successful
Brought to you by:
bs_php,
nigelswinson
From: <nig...@us...> - 2001-10-09 13:11:28
|
Did you try $BasePrice =3D $xml->get_content($Product."/Pricing[1]/BasePrice[1]"); ? All paths to get_content must be complete. You seem to have missed the = [1] in the pricing argument. Nigel ----- Original Message -----=20 From: <sh...@co...> To: <us...@li...> Sent: Monday, July 09, 2001 3:50 PM Subject: [phpXML] RE: [phpXML] Subscription successful > Hello.....please forgive my question if it is > stupid, I am a newbie to XML. Can anyone assist. > Feel free to email me directly at sh...@co... >=20 >=20 >=20 > I am trying to parse the following XML file >=20 > http://www.coolshopping.com/xml/derek.xml >=20 > with the following script: >=20 > <?php >=20 > // Include the <phpXML/> class. > include("xml.php"); >=20 > // Create an XML object for the XML file. > $xml =3D new XML("derek.xml"); >=20 > // Check whether a search term was given. > $Products =3D $xml->evaluate("//Product"); >=20 > // Run through all members of the government. > foreach ( $Products as $Product ) > { > // Retrieve information about the person. > $Code =3D $xml->get_content($Product."/Code[1]"); > $Description =3D > $xml->get_content($Product."/Description[1]"); > $Url =3D $xml->get_content($Product."/Url[1]"); > $Caption =3D = $xml->get_content($Product."/Caption[1]"); > $Thumb =3D $xml->get_content($Product."/Thumb[1]"); > $BasePrice =3D $xml->get_content($Product."/Pricing/BasePrice[1]"); >=20 > // Display the information. >=20 >=20 > echo "merchant name: to be obtained <br>\n"; > echo "product sku: $Code <br>\n"; > echo "product name: $Description <br>\n"; > echo "product category : ?????<br>\n"; > echo "product short desc: $Caption <br>\n"; > echo "product price: $BasePrice <br>\n"; > echo "product manuf: ???? <br>\n"; > echo "product img url: $Thumb<br>\n"; > echo "product click url: $Url <br><hr>\n"; >=20 >=20 >=20 > } >=20 > ?> >=20 >=20 > I do not understand how to obtain the fields: >=20 > BasePrice > ProductRef Url >=20 > You can see my results at >=20 > http://www.coolshopping.com/xml/test.php3 >=20 > Can you give me some instructions on how to obtain these sub-level > fields? >=20 > Thank you in advance!! >=20 >=20 >=20 >=20 > Amy Strycula, Creative Director > Coolshopping.com > http://www.coolshopping.com > http://www.coolshopping.tv > (412) 366-7545 voice > (412) 366-8528 fax >=20 >=20 >=20 > -- > This message has been sent through the <phpXML/> user discussion list. = To unsubscribe, please visit = https://sslsites.de/mailinglisten/user/us...@li.../ >=20 -- This message has been sent through the <phpXML/> user discussion list. To unsubscribe, please visit https://sslsites.de/mailinglisten/user/us...@li.../ |