domxml_xmltree

(PHP 4 >= 4.2.0)

domxml_xmltree — Creates a tree of PHP objects from an XML document

Описание

DomDocument domxml_xmltree ( string $str )

The function parses the XML document in str and returns a tree PHP objects as the parsed document.

This function is isolated from the other functions, which means you cannot access the tree with any of the other functions. Modifying it, for example by adding nodes, makes no sense since there is currently no way to dump it as an XML file.

However this function may be valuable if you want to read a file and investigate the content.

Список параметров

str

The contents of the XML file.

Возвращаемые значения

Returns a tree of Dom objects starting by a DomDocument.

[an error occurred while processing the directive]

Коментарии

This is a genuinely useful function, however, as with any DOM-based markup parser, be mindful of the size of the XML document you are parsing.  Representing very large XML files as object structures requires *a lot* of memory and processing, and may even crash your server (which is what happened to my Apache when I tried parsing a 2MB XML file using this function, just for fun... ;).
2002-12-12 21:03:15
http://php5.kiev.ua/manual/ru/function.domxml-xmltree.html
Автор:
Replacing line 10 works well, but replacing line 15 causes some errors. I have a tree like:

<admin>

<user level="0">
<username>admin</username>
<password>admin_pass</password>
</user>
<user level="1">
<username>moder</username>
<password>moder_pass</password>
</user>

</admin>

when I remove those brackets only the last <user> is included into array. In this example it would be 
<user level="1">
<username>moder</username>
<password>juozux</password>
</user>

no user name admin, etc.

p.s. I don't store passwords in plain text in xml, that was just an example :))
2005-02-23 08:38:27
http://php5.kiev.ua/manual/ru/function.domxml-xmltree.html
You can modify the returned DomDocument, and dump it as an XML file 
by using DomDocument->dump_mem() or DomDocument->dump_file().
2006-05-16 04:36:20
http://php5.kiev.ua/manual/ru/function.domxml-xmltree.html

    Поддержать сайт на родительском проекте КГБ