dom_import_simplexml

(PHP 5, PHP 7)

dom_import_simplexml Gets a DOMElement object from a SimpleXMLElement object

说明

dom_import_simplexml ( SimpleXMLElement $node ) : DOMElement

This function takes the node node of class SimpleXML and makes it into a DOMElement node. This new object can then be used as a native DOMElement node.

参数

node

The SimpleXMLElement node.

返回值

The DOMElement node added or FALSE if any errors occur.

范例

Example #1 Import SimpleXML into DOM with dom_import_simplexml()

<?php

$sxe 
simplexml_load_string('<books><book><title>blah</title></book></books>');

if (
$sxe === false) {
    echo 
'Error while parsing the document';
    exit;
}

$dom_sxe dom_import_simplexml($sxe);
if (!
$dom_sxe) {
    echo 
'Error while converting XML';
    exit;
}

$dom = new DOMDocument('1.0');
$dom_sxe $dom->importNode($dom_sxetrue);
$dom_sxe $dom->appendChild($dom_sxe);

echo 
$dom->saveXML();

?>

参见

相关文章
php com 函数 connect events from a com object to a php objectphp cubrid mysql 兼容性函数 get column information from a result and return as an objectphp dbase 函数 gets a record from a database as an associative arrayphp dbase 函数 gets a record from a database as an indexed arrayphp dom 函数 gets a domelement object from a simplexmlelement objectphp frontbase 函数 get column information from a result and return as an objectphp fdf 函数 gets a value from the opt array of a fieldphp firebird/interbase 函数 get an object from a interbase databasephp kadm5 函数 gets all policies from the kerberos databasephp kadm5 函数 gets the principal s entries from the kerberos databasephp kadm5 函数 gets all principals from the kerberos databasephp ldap 函数 parse result object from an ldap extended operationphp rrd 函数 gets the timestamp of the first sample from rrd filephp simplexml 函数 get a simplexmlelement object from a dom nodephp sqlite 函数 fetches the next row from a result set as an objectphp sqlsrv 函数 gets field data from the currently selected rowphp stream 函数 return a bucket object from the brigade for operating onphp uopz 函数 gets the static variables from function or method scopephp sdo das relational 函数 returns the special root object in an otherwise empty data graph. used when creating a data graph from scratchphp sdo das xml 函数 creates an xml document object from scratch without the need to load a document from a file or string
关注编程学问公众号