FWIW, I've needed to hack my code to handle three differences between the 2
different API versions.  To be honest, I can't keep track of which API was
in which release of PHP, so I'll just call them API A) and API B).

1) Names of tags:
    API A) $node->name
    API B) $node->tagname

2) Tag attribute value:
    API A) $node->children[0]->content
    API B) $node->value

3) Is a node a text node:
    API A) $node->type == XML_TEXT_NODE
    API B) strtolower(get_class($node)) == 'domtext'

I haven't installed libxml 2.4.2 and PHP 4.0.7rc1 yet, but I'm wondering if
someone can tell me which API version is in use?  This script should tell
you:

<?php
$__x = xmltree('<a b="c">d</a>');
if ($__x->children[0]->name=='a' &&
$__x->children[0]->attributes[0]->name=='b' &&
  $__x->children[0]->attributes[0]->children[0]->content=='c' &&
$__x->children[0]->content=='d') {
        echo 'API A';
} else if ($__x->children[0]->tagname=='a' &&
$__x->children[0]->attributes[0]->name=='b' &&
  $__x->children[0]->attributes[0]->value=='c' &&
$__x->children[0]->children[0]->content=='d') {
        echo 'API B';
} else {
        echo 'something totally new :(';
}



- Colin



-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to