Convert SimpleXMLElement object to XML format in php -
one xml file view.xml
convert simplexmlelement object after parent node it's child object need convert in xml format in php
**
view.xml
**
> <cards name="country-cards" model="core_country" title="country" > > <field name="name" /> > <field name="code" /> > <template><![cdata[ > <div class="span12"><strong>{{name}}</strong></div> <div> > <div class="span8"> > <span>{{name}}<br/> > {{code}}<br/></span> > </div></div>]]> > </template> > </cards> **$xml = simplexml_load_file($xmlviewfilepath);**
foreach ($xml $key=>$value) {
$value want convert in xml formate
}
question: other simple way achieve simplexmlelement object xml parsing , store database without i/o operation?
already used php conversion mechanism results in output null in database link below
try somthing this..
$doc = new domdocument(); $doc->formatoutput = true; $doc->loadxml($sxml->asxml()); $xml = $doc->savexml();
for more information check link
Comments
Post a Comment