domNode->set_namespace

From: Date: Tue, 18 Mar 2003 22:05:32 +0000
Subject: domNode->set_namespace
Groups: php.general.es 
Request: Send a blank email to general-es+get-33888@lists.php.net to get a copy of this message
Hola, tengo el siguiente XML (example.xml): <RDF xmlns:r="http://www.w3.org/TR/RDF/" xmlns:d="http://purl.org/dc/elements/1.0/" xmlns="http://directory.mozilla.org/rdf"> <Topic r:id="Top"> <tag catid="1"/> <d:Title>Top</d:Title> </Topic> <Topic r:id="Top/Arts"> <tag catid="2"/> <d:Title>Arts</d:Title> <link r:resource="http://www3.bc.sympatico.ca/PHILLIPSHOTGLASS/GlassPage.html"/> </Topic> <ExternalPage about="http://www3.bc.sympatico.ca/PHILLIPSHOTGLASS/GlassPage.html"> <d:Title>John phillips Blown glass</d:Title> <d:Description>A small display of glass by John Phillips</d:Description> </ExternalPage> <Topic r:id="Top/Business"> <tag catid="3"/> <d:Title>Business</d:Title> </Topic> <Topic r:id="Top/Computers"> <tag catid="4"/> <d:Title>Computers</d:Title> <link r:resource="http://www.cs.tcd.ie/FME/"/> <link r:resource="http://pages.whowhere.com/computers/pnyhlen/Timeline.html"/> </Topic> </RDF> y quiero listar x ejemplo los tag's "link" para luego revisar aquellos que tengan en el resource una determinada url. hice este script que lo probe y funcionaba bien en un xml simple. <? $XMLfilename="example.xml"; if(!$dom = domxml_open_file($XMLfilename)) { echo "Error while parsing the document\n"; exit; } $dom->set_namespace("http://www.w3.org/TR/RDF/", "xmlns:r"); $dom->set_namespace("http://purl.org/dc/elements/1.0/", "xmlns:d"); $dom->set_namespace("http://directory.mozilla.org/rdf", "xmlns"); $array_element = $dom->get_elements_by_tagname("Topic/link"); echo count($array_element); if ($array_element) { for ($i=0;$i<count($array_element);$i++) { echo $array_element[$i]->value(); } } ?> me parece que no funciona porque el set_namespace no esta funcionando, alguien me puede ayudar o dar alguna idea de como hacerlo? Gracias Pablo

« previous php.general.es (#33888) next »