Can not get XML attribute value using PHP

bador

New Member
\[code\]<Pages TotalPages="56" ProductCode="Headline" PubDate="2012-01-31" PubVersion="0" PubSubVersion="0" PageWidth="1622" PageHeight="1902"> <Page PageNo="1" PageName="" PageType="" Section="Section" ThumbnailPath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/1/Pv001.png" ImagePath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/1/Pg001_142_p.jpg" OverlayFullPath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/1/Pg001_142_t.png" PreviewPath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/1/Pg001.png" IsPreview="true" ImageHeight="1902" ImageWidth="1622" WithResource="true" /> <Page PageNo="2" PageName="" PageType="" Section="Section" ThumbnailPath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/2/Pv002.png" ImagePath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/2/Pg002_142_p.jpg" OverlayFullPath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/2/Pg002_142_t.png" PreviewPath="http://203.80.1.28/FlippingBook/Dev/Frontend/demo/Headline/2012/12/20/0/0/A/Content/2/Pg002.png" IsPreview="true" ImageHeight="1902" ImageWidth="1622" WithResource="true" /> </Pages>\[/code\]PHP:\[code\]$xml = simplexml_load_file($dir) or die("Error: Cannot create object");//$fileList = array();foreach($xml->children() as $Pages){ foreach($Pages->children() as $Page => $page){ $fileLink = $page['ThumbnailPath']; echo $fileLink; }}\[/code\]What I am going to get is the ThumbnailPath from node "Page" , I loop through Pages and page but it turn out gets nothing, how to fix this problem ? Thanks
 
Back
Top