I want to change Hi to How are You? What should be done. I want code for this replacement. Thanks in advance.
there are two possible ways.
– get the CDATA text and use str_replace()
– get the CDATA text, render it anew as XML, replace the textContent via DOM, import the output of the 2nd XML into the 1st XML
important: a CDATA section is its own node type and everything contained is text.
Thanks very much for your reply but if you provide coding for that, then it would be much easier to me.
practically the same as in your other threads about this XML.
ok. Now can you tell me how to use getElementsById to identify a perticular tag & to echo that div’s content. A small example please… Based on my xml file(I want to echo Hi based on id=2). In this how we can use getElementsById function?
if I remember right you have to either parse that XML chunk as HTML or parse it with a DTD that defines id as ID type attribute.
You should read up on the PHP-class called SimpleXML. It’s not really simple, but easier to understand and work with than creating your own way to parse your XML-files. http://php.net/manual/en/book.simplexml.php