Mark Wilson I am the creator of TopXML. I am available for international and local (Australia) contracts. I am a Solution Architect/Business Analyst. I have worked in IT in several countries (NZ, Australia, South Africa, UK) building and training teams for government and very large non-governmental organizations. I am ex-Microsoft Consulting Services. I wrote the first book on Microsoft XML published in 2000 called XML Programming with VB and ASP. Most recently I have been building tools for the SEO industry. Ask me for a 37 point SEO health-checkup for your website.
First posted :
03/24/2008
Times viewed :
490
DOMCharacterData Function insertData
PHP Version: (No version information might be only in CVS. I have used this function
in PHP5)
DOM: W3C
DOM Level 1
Description
This function inserts a string at a specified
position in a Text Node (DOMCharacterData).
Usage:
voidDOMCharacterData->insertData ( int offset, string
data)
Inserts string data
at position offset.
Throws DOMException if offset is negative or greater than
the number of 16-bit units in data.
Example:
The XML file, which I
have used contains following data. I have stored this file in “c:/topxml_demo/php/xml_files/employee.xml” directory.
//insert some text in 5th postion
of Text Node. Here I have
inserted “'Inserted at 5th position” at 5thpostion
so the new text node should be “Text Inserted at 5th position Node Created”
$textNode->insertData(5,'Inserted at 5th position ');
//append
the Text Node into the newly created node