note 68108 added to function.dom-domdocument-createdocumentfragment
| From: | xavier dot pinardatlaposte dot net at osu1 dot php dot net | Date: | Thu, 13 Jul 2006 14:08:27 +0000 |
| Subject: | note 68108 added to function.dom-domdocument-createdocumentfragment | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-114734@lists.php.net to get a copy of this message | ||
The interest of fragment is I think :
- only nodes inside the fragment are inserted,
not the fragment itself when you insert the fragment
- you can append String litteral with the method
DOMDocumentFragment->appendXML()
So, a fragment may look like this :
part of document<li>bla bla </li> ...
This fragment is describe with a fragment description
that may look like this is you use
it as an "XML Fragment Interchange" :
<f:fcs xmlns:f="http://www.w3.org/2001/02/xml-fragment"
[...]
<myOriginalStructure>
[...]
<f:fragbody/>
[...]
</myOriginalStructure>
cf :: http://www.w3.org/TR/xml-fragment
An example could be for "XML Fragment Interchange":
$dom = new DomDocument();
$frag = $dom->createDocumentFragment();
$fragbody = $dom->createElementNS(
'http://www.w3.org/2001/02/xml-package',
'p:body'
);
$frag->appendXML(
'test fragment<ilo>data</ilo> +
an object property +
something else '
);
$fragbody->appendChild($frag);
$dom->appendChild($fragbody);
var_dump($dom->saveXML());
----
Server IP: 64.71.164.2
Probable Submitter: 82.225.156.90
----
X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER
autolearn=no version=2.64
----
Manual Page -- http://www.php.net/manual/en/function.dom-domdocument-createdocumentfragment.php
Edit -- http://master.php.net/note/edit/68108
Del: integrated -- http://master.php.net/note/delete/68108/integrated
Del: useless -- http://master.php.net/note/delete/68108/useless
Del: bad code -- http://master.php.net/note/delete/68108/bad+code
Del: spam -- http://master.php.net/note/delete/68108/spam
Del: non-english -- http://master.php.net/note/delete/68108/non-english
Del: in docs -- http://master.php.net/note/delete/68108/in+docs
Del: other reasons-- http://master.php.net/note/delete/68108
Reject -- http://master.php.net/note/reject/68108
Search -- http://master.php.net/manage/user-notes.php