Hello,
I am trying to parse an xml which comes back from Amazon and I am trying to know how many Browsenodes are shown within the XML.
I am using the classs Tarzan to get the xml from Amazon and the returned data is automatically placed into simplexml.
So currently I have this script
Code: $nodeinfo = $pas->browse_node_lookup($node);
$xmlNode = $nodeinfo ->body->BrowseNodes->BrowseNode->xpath('/Ancestors');
$nodeCount = count ( $xmlNode );
if($nodeCount){
echo "NodeCount".$nodeCount."n";
}
The $nodeinfo holds the following xml structure and I am only showing the part for the Nodes
Code: [BrowseNodes] => SimpleXMLElement Object
(
[Request] => SimpleXMLElement Object
(
[IsValid] => True
[BrowseNodeLookupRequest] => SimpleXMLElement Object
(
[BrowseNodeId] => 16197
)
)
[BrowseNode] => SimpleXMLElement Object
(
[BrowseNodeId] => 16197
[Name] => Epic
[Ancestors] => SimpleXMLElement Object
(
[BrowseNode] => SimpleXMLElement Object
(
[BrowseNodeId] => 16190
[Name] => Fantasy
[Ancestors] => SimpleXMLElement Object
(
[BrowseNode] => SimpleXMLElement Object
(
[BrowseNodeId] => 25
[Name] => Science Fiction & Fantasy
[Ancestors] => SimpleXMLElement Object
(
[BrowseNode] => SimpleXMLElement Object
(
[BrowseNodeId] => 1000
[Name] => Subjects
[IsCategoryRoot] => 1
[Ancestors] => SimpleXMLElement Object
(
[BrowseNode] => SimpleXMLElement Object
(
[BrowseNodeId] => 283155
[Name] => Books
with the Xpath I am trying to get the number how often "Ancestors" is shown. With this count I am able to goto my next programming script.
With my script this is not working, it always gives me a 1.
Is there a better way then how I have tried to solve it to count the Ancesters node?
Is there also a way how to read the Nodes backway to front? Amazon gives the Structure of an item from the lowest group to the highest.
I am kind of new with Simplexml and would really need some help.
Hope some one can help me out.
Best regards
Finding digits in variable containing text, and IDing them
$romanstock = "http://www.remoteprice.com/data.asp?storeid=123&itemcode=456&type=2";$contentsstock = file_get_contents($romanstock);The above code, when rendering
How to submit a form to the same page?
I have a table containing information about books in my library and this table has the following columns: id, title, category. What I want to do is to make a form that will allow me to sort these
close site for maintenance
i get a tutorial, saying the following code can put our site offline, and only the developer can view the siteCode: [Select]RewriteEngine OnRewriteBase /RewriteCond %{REMOTE_ADDR}
PHP, jAVASCRIPT setting input values, why isn't it working?
Hi:I am calling this javascript:<script language="javascript">function set_item_values(x){document.forms.form1.GetElementById(x).value =
DELETE rows based on content
I have a link in my rows$bit="http://bit.ly/abcd";$query = mysql_query("DELETE FROM *table* WHERE sentence........");//I need to delete all sentence rows which DOES NOT contain my
Access website from only 1 computer...?
One of my customers wants his website to only be accessed by people in which they bought the website membership from on their computer. He's afraid that the users might share their login's with their
Small problem with image resize script
Hi!I am a little bit new to php and I have an issue installing an image resize script I downloaded (http://shiftingpixel.com/2008/03/03/smart-image-resizer/) and can't seem to get it working.Here's a
newbie error
what is wrong with this code ? <html><body><?php$conn=odbc_connect('Towel','','');if (!$conn) {exit("Connection Failed: " . $conn);}$sql="SELECT *
php call servlet
I have done a php backup application .So there is a form that user pick some files to zip and download.Because of a problem with greek characters I make a servet (java) to create the zip.But I want
Unable to display contents in Second Drop Down Box
Hi All, What I am trying to do is 2 dependent drop down boxes and when user selects submit button the values are to be passed to the database to run a insert query. Right now, I am stuck