Search the Community
Showing results for tags 'xml cdata php'.
-
I need to create an xml file with php. Most of the xml is no problem, but part of it has cdata with other information. Following is how the output should look <?xml version="1.0" encoding="utf-8" ?> <component name="customEPGGrid" extends="EPGGrid" > <script type="text/brightscript" > <![CDATA[ function init() print "inside epg" m.content = createObject("RoSGNode","ContentNode") m.top.setFocus(true) dateNow = CreateObject("roDateTime") dateNow = dateNow.asSeconds() - 2000 addChannel("ABC") addItem("ABC Show ", dateNow) m.top.content = m.content m.top.translation = [50, 300] m.top.numRows = 5 m.top.duration = 10800 m.top.nowNextMode = false m.top.infoGridGap = 0 m.top.channelInfoColumnLabel = "Hello" end function ]]> </script> </component> $xml=new DOMDocument('1.0', 'UTF-8'); $xml->preserveWhiteSpace = false; $xml->formatOutput = true; $components = $xml->createElement("components"); $name=$xml->createAttribute("name"); $name->value = "customEPGGrid"; $extends=$xml->createAttribute("extends"); $extends->value = "EPGGrid"; $components->appendChild($name); $components->appendChild($extends); $script = $xml->createElement("script"); $type=$xml->createAttribute("type"); $type->value = "text/brightscript"; $cdata = $xml->createCDATASection("function init()"); $script->appendChild($cdata); $script->appendChild($type); $components->appendChild($script); $xml->appendChild($components); $xml->save($filename2); Here is the php code that creates the xml. I can create the cdata element and the Function Int(), but not sure how to get the rest. Any help in gettig the information in the function int() would be appreciated.