Re: [PHP4BETA] cvs: /php4/ext/pdf pdf.c
| From: | Kristian Koehntopp | Date: | Fri, 10 Mar 2000 09:10:31 +0000 |
| Subject: | Re: [PHP4BETA] cvs: /php4/ext/pdf pdf.c | ||
| References: | 1 | Groups: | php.version4 |
| Request: | Send a blank email to php-version4+get-11853@lists.php.net to get a copy of this message | ||
How am I using the domxml extension?
I have used
$o = xmldocfile("skdtest");
to read and parse an XML file and I can dump
the document structure using a recursive function
dump():
function dump(&$o, $level = 0) {
dent($level);
printf("%s is a %s of type %s\n",
$o->name,
get_class($o),
$xml_type[$o->type]);
$c = $o->children();
if (is_array($c)) {
reset($c);
while(list($k, $v) = each($c)) {
dump($v, $level+2);
}
}
Within my XML document there are containers named QUESTION and
ANSWER. I do not want to decend into these containers, but dump
domxml_dumpmem() them. But
if ($o->name != "QUESTION" and $o->name != "ANSWERS") {
$c = o->children();
...
} else {
print htmlspecialchars($o->dumpmem());
}
does not work, because I need a Dom Document object, not a Dom
Node object to dump this. So how would I create a new Dom
Document named $p and add the $o subtree to $p easily?
From the source I gather that it cannot be done, because the
DomXML extension keeps the XML tree in libXML structure and does
not create true PHP objects to represent the XML tree instead.
That is, I cannot $p->children[] = $o;
But also there is no function $p->addnode($o); with will add
$o and the whole subtree below $o to $p.
Finally: Is it intentional that the DomXML classnames are
illegal classnames containing spaces?
Kristian
--
Kristian Köhntopp, NetUSE Kommunikationstechnologie GmbH
Siemenswall, D-24107 Kiel, Germany, +49 431 386 436 00
Using PHP3? See our web development library at
http://phplib.netuse.de/ (We have moved! Update your
bookmarks!)