<?php
$document = new DOMDocument;
$document->loadXML( '<?xml version="1.0" encoding="UTF-8"?>
<workflow name="StartSetUnsetEnd" version="1">
  <node id="1" type="Start">
    <outNode id="2"/>
  </node>
  <node id="2" type="VariableSet">
    <variable name="x">
      <integer>1</integer>
    </variable>
    <outNode id="3"/>
  </node>
  <node id="3" type="VariableUnset">
    <variable name="x"/>
    <outNode id="4"/>
  </node>
  <node id="4" type="End"/>
</workflow>' );

foreach ( $document->getElementsByTagName( 'node' ) as $node )
{
    $type = $node->getAttribute( 'type' );

    if ( $type == 'VariableSet' )
    {
        foreach ( $node->getElementsByTagName( 'variable' ) as $variable )
        {
            // $variable->getAttribute( 'name' ) returns 'x' as expected.

            // I want to access the <integer> child node of the <variable>
            // node at this point but all I see is a DOMText object that
            // contains whitespace and $variable->nodeValue contains 1
            // which is the value of the <integer> element.
        }
    }
}

-- 
Sebastian Bergmann
System Developer
[EMAIL PROTECTED] | eZ Systems | http://ez.no

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
Components mailing list
[email protected]
http://lists.ez.no/mailman/listinfo/components

Reply via email to