DOM and node

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View
I have XML like this :

         <a href="link.html">Name</a>

How to get only "Producer:" without value of <strong> node ?

I would like to do it in a preety way using built-in PHP classes of DOM family.

I can't find solution better then :
  $nodeLI->nodeValue and REGEX

How do you process XML like this one?

Re: DOM and node

El 10/05/2011 13:48, smerf escribió/wrote:
Quoted text here. Click to load it

If the structure won't change, you can do this:


$xml_string = '<?xml version="1.0" encoding="ISO-8859-1"?>
         <a href="link.html">Name</a>

$doc = new DOMDocument;

$lists = $doc->getElementsByTagName('li');
foreach($lists as $li){

You can trim() the value if you wish.

-- - Álvaro G. Vicario - Burgos, Spain
-- Mi sitio sobre programación web:
-- Mi web de humor satinado:

Site Timeline