When creating empty nodes like xhtml:link, the output misses the closing slash. This is what I got:
<link ...>
![]() | DomDocument->create_element(no version information, might be only in CVS) DomDocument->create_element -- Create new element node说明domelement DomDocument->create_element ( string name )This function returns a new instance of class DomElement. The tag name of the element is the value of the passed parameter. 本节点不会出现在文档中,除非是用例如 domnode_append_child() 函数来将其插入。 The return value is FALSE if an error occurred. See also domdocument_create_element_ns(), domnode_append_child(), domdocument_create_text(), domdocument_create_comment(), domdocument_create_attribute(), domdocument_create_processing_instruction(), domdocument_create_entity_reference(), and domnode_insert_before(). ![]()
Mikael Ljungberg
04-May-2005 01:46
When creating empty nodes like xhtml:link, the output misses the closing slash. This is what I got:
dk
25-Nov-2003 03:58
The first example on this page is also a bit verbose. Since the DomElement class inherits/extends the DomNode class, one does not, in fact, have to get another reference to the first node. The create_element method has already given you that reference. (Also, the last line passes a string to the append_child method, instead of a DomNode object) Simplified:
Jorrit Kronjee
05-Nov-2003 11:15
The example done by Nico Almhoedi has a small error.
Nico almhoedi at gmx dot de
05-Jan-2003 07:40
It's easier possible since DomNode->append_child($new_element) returns the new child as an object, so you can refer to it immediately.
greg@cabinetuk
14-Nov-2002 09:27
Its important to remember, when adding a created element to an existing node using append_child(), that if you want to then add another element to that node you have to go back and set up a DOMNode instance using DOMDocument_get_elements_by_tagname or similar before you can append another node onto it. | ![]() |