[UPHPU] beginner to DOM library

Eric Goebel ericgoebel at gmail.com
Wed Nov 8 10:50:32 MST 2006


Try this:
$doc->save("php://output");

-Eric
On 11/8/06, Richard K Miller <richardkmiller at gmail.com> wrote:
> I'm trying to get acquainted with the PHP DOM library (php.net/dom)
> available in PHP5.  Any idea why I don't get more meaningful output
> from this code?
>
> <?php
>
> $doc = new DOMDocument;
> $doc->loadXML('<?xml version="1.0" encoding="iso-8859-1" ?
>  ><foo><bar>hello world</bar></foo>');
> print_r($doc);
>
> $xpath = new DOMXPath($doc);
> print_r($xpath);
>
> $nodes = $xpath->query("//foo");
> print_r($nodes);
>
> foreach($nodes as $node)
>         print_r($node);
>
> ?>
>
> OUTPUT:
>
> DOMDocument Object
> (
> )
> DOMXPath Object
> (
> )
> DOMNodeList Object
> (
> )
> DOMElement Object
> (
> )
>
> I was hoping the output would include various nodes in the document.
> Maybe PHP is masking the values from print_r()?
>
> Richard
>
>
>
> _______________________________________________
>
> UPHPU mailing list
> UPHPU at uphpu.org
> http://uphpu.org/mailman/listinfo/uphpu
> IRC: #uphpu on irc.freenode.net
>


More information about the UPHPU mailing list