-/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]);
+/* {{{ proto DOMElement dom_document_create_element(string tagName [, string value]) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-2141741547
Since:
*/
/* }}} end dom_document_create_element */
-/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment();
+/* {{{ proto DOMDocumentFragment dom_document_create_document_fragment() U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-35CB04B5
Since:
*/
/* }}} end dom_document_create_document_fragment */
-/* {{{ proto DOMText dom_document_create_text_node(string data);
+/* {{{ proto DOMText dom_document_create_text_node(string data) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1975348127
Since:
*/
/* }}} end dom_document_create_text_node */
-/* {{{ proto DOMComment dom_document_create_comment(string data);
+/* {{{ proto DOMComment dom_document_create_comment(string data) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1334481328
Since:
*/
/* }}} end dom_document_create_comment */
-/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data);
+/* {{{ proto DOMCdataSection dom_document_create_cdatasection(string data) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-D26C0AF8
Since:
*/
/* }}} end dom_document_create_cdatasection */
-/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data);
+/* {{{ proto DOMProcessingInstruction dom_document_create_processing_instruction(string target, string data) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-135944439
Since:
*/
/* }}} end dom_document_create_processing_instruction */
-/* {{{ proto DOMAttr dom_document_create_attribute(string name);
+/* {{{ proto DOMAttr dom_document_create_attribute(string name) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-1084891198
Since:
*/
/* }}} end dom_document_create_attribute */
-/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name);
+/* {{{ proto DOMEntityReference dom_document_create_entity_reference(string name) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-392B75AE
Since:
*/
/* }}} end dom_document_create_entity_reference */
-/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname);
+/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name(string tagname) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-A6C9094
Since:
*/
/* }}} end dom_document_get_elements_by_tag_name */
-/* {{{ proto DOMNode dom_document_import_node(DOMNode importedNode, boolean deep);
+/* {{{ proto DOMNode dom_document_import_node(DOMNode importedNode, boolean deep) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#Core-Document-importNode
Since: DOM Level 2
*/
/* }}} end dom_document_import_node */
-/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value]);
+/* {{{ proto DOMElement dom_document_create_element_ns(string namespaceURI, string qualifiedName [,string value]) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrElNS
Since: DOM Level 2
*/
/* }}} end dom_document_create_element_ns */
-/* {{{ proto DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName);
+/* {{{ proto DOMAttr dom_document_create_attribute_ns(string namespaceURI, string qualifiedName) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-DocCrAttrNS
Since: DOM Level 2
*/
/* }}} end dom_document_create_attribute_ns */
-/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName);
+/* {{{ proto DOMNodeList dom_document_get_elements_by_tag_name_ns(string namespaceURI, string localName) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBTNNS
Since: DOM Level 2
*/
/* }}} end dom_document_get_elements_by_tag_name_ns */
-/* {{{ proto DOMElement dom_document_get_element_by_id(string elementId);
+/* {{{ proto DOMElement dom_document_get_element_by_id(string elementId) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-ID-getElBId
Since: DOM Level 2
*/
/* }}} end dom_document_get_element_by_id */
-/* {{{ proto DOMNode dom_document_adopt_node(DOMNode source);
+/* {{{ proto DOMNode dom_document_adopt_node(DOMNode source) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-adoptNode
Since: DOM Level 3
*/
/* }}} end dom_document_adopt_node */
-/* {{{ proto void dom_document_normalize_document();
+/* {{{ proto void dom_document_normalize_document() U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-normalizeDocument
Since: DOM Level 3
*/
/* }}} end dom_document_normalize_document */
-/* {{{ proto DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName);
+/* {{{ proto DOMNode dom_document_rename_node(node n, string namespaceURI, string qualifiedName) U
URL: http://www.w3.org/TR/2003/WD-DOM-Level-3-Core-20030226/DOM3-Core.html#core-Document3-renameNode
Since: DOM Level 3
*/
}
/* }}} end dom_document_rename_node */
-/* {{{ proto void DOMDocument::__construct([string version], [string encoding]); */
+/* {{{ proto void DOMDocument::__construct([string version], [string encoding]) U */
PHP_METHOD(domdocument, __construct)
{
}
/* }}} end dom_parser_document */
-/* {{{ proto DOMNode dom_document_load(string source [, int options]);
+/* {{{ proto DOMNode dom_document_load(string source [, int options]) U
URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-load
Since: DOM Level 3
*/
}
/* }}} end dom_document_load */
-/* {{{ proto DOMNode dom_document_loadxml(string source [, int options]);
+/* {{{ proto DOMNode dom_document_loadxml(string source [, int options]) U
URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-loadXML
Since: DOM Level 3
*/
}
/* }}} end dom_document_loadxml */
-/* {{{ proto int dom_document_save(string file);
+/* {{{ proto int dom_document_save(string file) U
Convenience method to save to file
*/
PHP_FUNCTION(dom_document_save)
}
/* }}} end dom_document_save */
-/* {{{ proto string dom_document_savexml([node n]);
+/* {{{ proto string dom_document_savexml([node n]) U
URL: http://www.w3.org/TR/DOM-Level-3-LS/load-save.html#LS-DocumentLS-saveXML
Since: DOM Level 3
*/
}
}
-/* {{{ proto int dom_document_xinclude([int options])
+/* {{{ proto int dom_document_xinclude([int options]) U
Substitutues xincludes in a DomDocument */
PHP_FUNCTION(dom_document_xinclude)
{
}
-/* {{{ proto boolean dom_document_validate();
+/* {{{ proto boolean dom_document_validate() U
Since: DOM extended
*/
PHP_FUNCTION(dom_document_validate)
}
}
-/* {{{ proto boolean dom_document_schema_validate_file(string filename); */
+/* {{{ proto boolean dom_document_schema_validate_file(string filename) U */
PHP_FUNCTION(dom_document_schema_validate_file)
{
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
}
/* }}} end dom_document_schema_validate_file */
-/* {{{ proto boolean dom_document_schema_validate(string source); */
+/* {{{ proto boolean dom_document_schema_validate(string source) U */
PHP_FUNCTION(dom_document_schema_validate_xml)
{
_dom_document_schema_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
}
}
-/* {{{ proto boolean dom_document_relaxNG_validate_file(string filename); */
+/* {{{ proto boolean dom_document_relaxNG_validate_file(string filename) U */
PHP_FUNCTION(dom_document_relaxNG_validate_file)
{
_dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_FILE);
}
/* }}} end dom_document_relaxNG_validate_file */
-/* {{{ proto boolean dom_document_relaxNG_validate_xml(string source); */
+/* {{{ proto boolean dom_document_relaxNG_validate_xml(string source) U */
PHP_FUNCTION(dom_document_relaxNG_validate_xml)
{
_dom_document_relaxNG_validate(INTERNAL_FUNCTION_PARAM_PASSTHRU, DOM_LOAD_STRING);
}
}
-/* {{{ proto DOMNode dom_document_load_html_file(string source);
+/* {{{ proto DOMNode dom_document_load_html_file(string source) U
Since: DOM extended
*/
PHP_METHOD(domdocument, loadHTMLFile)
}
/* }}} end dom_document_load_html_file */
-/* {{{ proto DOMNode dom_document_load_html(string source);
+/* {{{ proto DOMNode dom_document_load_html(string source) U
Since: DOM extended
*/
PHP_METHOD(domdocument, loadHTML)
}
/* }}} end dom_document_load_html */
-/* {{{ proto int dom_document_save_html_file(string file);
+/* {{{ proto int dom_document_save_html_file(string file) U
Convenience method to save to file as html
*/
PHP_FUNCTION(dom_document_save_html_file)
}
/* }}} end dom_document_save_html_file */
-/* {{{ proto string dom_document_save_html();
+/* {{{ proto string dom_document_save_html() U
Convenience method to output as html
*/
PHP_FUNCTION(dom_document_save_html)
#endif /* defined(LIBXML_HTML_ENABLED) */
-/* {{{ proto boolean DOMDocument::registerNodeClass(string baseclass, string extendedclass);
+/* {{{ proto boolean DOMDocument::registerNodeClass(string baseclass, string extendedclass)
Register extended class used to create base node type */
PHP_METHOD(domdocument, registerNodeClass)
{
--- /dev/null
+--TEST--
+CharData: DOMCharacterData and related functionality
+--SKIPIF--
+<?php require_once('skipif.inc'); ?>
+--FILE--
+<?php
+require_once("dom_test.inc");
+
+$dom = new DOMDocument("1.0", "UTF-8");
+$root = $dom->createElement('root');
+$dom->appendChild($root);
+
+$dom2 = new DOMDocument("1.0");
+$dom2->loadXML(b'<doc2><child1>data</child1></doc2>');
+$root2 = $dom2->documentElement;
+
+$imported = $dom->importNode($root2->firstChild, TRUE);
+
+$root->appendChild($imported);
+
+$att = $dom->createAttribute('imported');
+$attval = $dom->createTextNode('1');
+$att->appendChild($attval);
+$imported->setAttributeNode($att);
+
+$comment = $dom->createComment('testing DOMDocument functionality');
+$dom->insertBefore($comment, $root);
+
+for ($x=1; $x < 3; $x++) {
+ if ($x == 2) {
+ $node = $dom->createElementNS('urn::foo', 'foo:child', 'data ');
+ $entity = $dom->createEntityReference('amp');
+ $node->appendChild($entity);
+ $node->appendChild(new DOMText(' stuff'));
+ } else {
+ $node = $dom->createElementNS('urn::foo', 'foo:child');
+ $data = $dom->createCDATASection('cdata');
+ $node->appendChild($data);
+ }
+ $root->appendChild($node);
+
+ $att = $dom->createAttributeNS('urn::foo', 'foo:bar');
+ $att->appendChild($dom->createTextNode($x));
+ $node->setAttributeNode($att);
+ $att = $dom->createAttribute('xml:id');
+ $att->appendChild($dom->createTextNode('id'.$x));
+ $node->setAttributeNode($att);
+}
+
+$nodes = $dom->getElementsByTagName('child1');
+$node = $nodes->item(0);
+$value = $dom->createProcessingInstruction('php', "echo 'Hello World'; ");
+$node->replaceChild($value, $node->firstChild);
+
+$nodes = $dom->getElementsByTagNameNS('urn::foo', 'child');
+$node = $nodes->item(1);
+$frag = $dom->createDocumentFragment();
+$frag->appendChild($node);
+
+var_dump($dom->saveXML($frag));
+
+$file = dirname(__FILE__).'/dom.tmp';
+$dom->save($file);
+
+$doc = new DOMDocument();
+$doc->load($file);
+
+$node = $doc->getElementById('id1');
+$node->parentNode->removeChild($node);
+
+print "\n".$doc->saveXML();
+
+unlink($file);
+
+$file = dirname(__FILE__).'/html.tmp';
+$doc->loadHTMLFile(dirname(__FILE__).'/test.html');
+$doc->saveHTMLFile($file);
+$output = $doc->saveHTML();
+$dom->loadHTMLFile($file);
+$output2 = $dom->saveHTML();
+
+if ($output === $output2) {
+ print "\nOutput is identical\n";
+} else {
+ print "\nOutput is different\n";
+}
+
+unlink($file);
+?>
+--EXPECT--
+
+string(85) "<foo:child xmlns:foo="urn::foo" foo:bar="2" xml:id="id2">data & stuff</foo:child>"
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!--testing DOMDocument functionality-->
+<root xmlns:foo="urn::foo"><child1 imported="1"><?php echo 'Hello World'; ?></child1></root>
+
+Output is identical
+