xml preview view in browser
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$xml_data = $xml->createElement("DATA");
$xml_row = $xml->createElement("ROW","test");
$xml_data->appendChild( $xml_row );
$str = $xml->saveXML();
$str = "
xml not allowed character list
public function xmlEscape($string) {
return str_replace(array('&', '<', '>', '\'', '"'), array('&', '<', '>', ''', '"'), $string);
}
xml add html data in value
$xml_sub_col = $xml->createElement("ITEM");
$xml_sub_col->appendChild($xml->createCDATASection( "test"));
add attrubute in xml
$xml_sub_col->setAttribute("id",$arrValSubCol[0]);
$xml = new DOMDocument('1.0', 'UTF-8');
$xml->preserveWhiteSpace = false;
$xml->formatOutput = true;
$xml_data = $xml->createElement("DATA");
$xml_row = $xml->createElement("ROW","test");
$xml_data->appendChild( $xml_row );
$str = $xml->saveXML();
$str = "
".htmlspecialchars($str)."";
xml not allowed character list
public function xmlEscape($string) {
return str_replace(array('&', '<', '>', '\'', '"'), array('&', '<', '>', ''', '"'), $string);
}
xml add html data in value
$xml_sub_col = $xml->createElement("ITEM");
$xml_sub_col->appendChild($xml->createCDATASection( "test"));
add attrubute in xml
$xml_sub_col->setAttribute("id",$arrValSubCol[0]);