Hi Brinkman,!
On Mon, 22 Jan 2001, Brinkman, Theodore wrote:
> Maybe I'm missing something, but I'm thinking it's giving the correct
> output.
>
> The 'TEXT' that is showing up just seems to be some sort of indication as to
> what type of data it found.
>
> ELEMENT catalog //the parser found an element named
> 'catalog'
> TEXT //the element 'catalog' is of type TEXT
> content= //it had no content of its own
> ELEMENT category //inside it found an element named
> 'category'
> ATTRIBUTE id //'category' has an attribute named 'id'
> TEXT // the attribute 'id' is of type TEXT
> content=db // the attribute 'id' has a value of 'db'
> ATTRIBUTE name //'category' has an attribute named 'name'
> TEXT // the attribute 'name' is of type TEXT
> content=Databases // the attribute 'name' has a value of
> 'Databases'
> TEXT //the element 'category' is of type
> TEXT
> [...] //[...]
>
> Somebody who knows better please correct me if I'm wrong.
>
Point made! xmllint gives +1 but the first found node looks like:
[result of print_r ($node) ]
DomNode Object
(
[name] => text
[content] =>
[node] => Resource id #3
[type] => 3
)
I don't get it why `name' is `text'. Maybe I should file a bug report.
Just wanted to be sure it's not me being wrong.
>
> Hey,
> I've been playing w/ DOM functions (not very documented, but cool :)
> and had the following:
>
> [categories.xml]
>
> <?xml version="1.0"?>
> <catalog>
> <category id="db" name="Databases">
> <topic>
> <name>MySQL</name>
> <description>MySQL Manual</description>
> </topic>
>
> <topic>
> <name>PostgreSQL</name>
> <description>PostgreSQL Manuals</description>
> </topic>
>
> </category>
> </catalog>
>
> [xmltest.php]
> <?php
> header ('Content-Type: text/plain');
>
> $doc = new DomDocument();
> $node = new DomNode();
>
> $doc = xmldocfile ('categories.xml');
> $root = $doc->root();
> $cats = $root->children();
>
> $node = $cats[0];
>
> print_r ($node->name);
>
>
> It outputs "text" and I would expect "Databases".
>
> running xmllint gives:
>
> [teo@teo xml]$ xmllint --debug categories.xml
> DOCUMENT
> version=1.0
> URL=categories.xml
> standalone=true
> ELEMENT catalog
> TEXT
> content=
> ELEMENT category
> ATTRIBUTE id
> TEXT
> content=db
> ATTRIBUTE name
> TEXT
> content=Databases
> TEXT
> [...]
>
>
> Any idea what's wrong?
>
> TIA
>
>
-- teodor
--
PHP General 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]