Web студия "GrandView"
  Главная   Написать Контакты
   
   
О проекте
Руководство php
 

DomDocument->dump_mem

(no version information, might be only in CVS)

DomDocument->dump_mem --  Dumps the internal XML tree back into a string

Описание

string DomDocument->dump_mem ( [bool format [, string encoding]] )

Creates an XML document from the dom representation. This function usually is called after building a new dom document from scratch as in the example below. The format specifies whether the output should be neatly formatted, or not.

Пример 1. Creating a simple HTML document header

<?php
$doc
= domxml_new_doc("1.0");
$root = $doc->create_element("HTML");
$root = $doc->append_child($root);
$head = $doc->create_element("HEAD");
$head = $root->append_child($head);
$title = $doc->create_element("TITLE");
$title = $head->append_child($title);
$text = $doc->create_text_node("This is the title");
$text = $title->append_child($text);
echo
"<PRE>";
echo
htmlentities($doc->dump_mem(true));
echo
"</PRE>";
?>

Замечание: The first parameter was added in PHP 4.3.0.

See also domdocument_dump_file(), and domdocument_html_dump_mem().



DomDocument->get_element_by_id> <DomDocument->dump_file
Last updated: Sat, 27 Jan 2007
 
add a note add a note User Contributed Notes
DomDocument->dump_mem
jonathan at fluent dot ltd dot uk
30-Nov-2003 04:11
It seems that if you use $xslt->dump_mem(TRUE) IE: breaks and formats all the HTML Badly. Perhaps its a problem with CR's...
ross at dev-null dot accretivetg dot com
26-Sep-2003 10:11
Given the missing description of the encoding parameter, I had hoped it would automatically encode the document if I set the encoding type; this is not the case.

At least in PHP v4.3.3, it seems that setting the encoding type does NOTHING other than set the name displayed in the string:

<?xml version="1.0" encoding="UTF-8"?>

Thus if you want your values to be encoded, you need to manually encode them when you create your DOM object.  E.g. assume you have a simple setup like this:

<?php

  $text
= '
Новости
11 июля 2007
Сайт запущен
© 2007 info@grandviewstudio.com

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 324

Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/sites/grandviewstudiocom/www/65f67d67a94ad980786580ae69e11c07/sape.php on line 330
Z058440144362 Z348613067571