To Code to tune up your xml.php file a bit:
1. function to write to file
example:
$xmlfile="File.xml";
...
$xmltext = $xml->get_as_xml_file();
$check=$xml->write_xml($xmlfile,$xmltext);
2. added encoding="" to <?xml version... ?>
so some special characters are supported too
especially important for some german "umlaute"
========================================
1. Add this function to class XML
/**
* Write XML Code in File
*
* @access private
* @author J. Carmanns
* @param $xmlfile_name - Name of File to write to
* @param $xmltext - XMLText to write into file (use
"get_as_xml_file()")
*/
function write_xml($xmlfile_name,$xmltext)
{
$fp = fopen($xmlfile_name,"w");
$check = false;
if ($fp != 0 && flock($fp, LOCK_EX+LOCK_NB)&& ftruncate( $fp, 0))
{
fwrite($fp,$xmltext);
clearstatcache();
$check = true;
flock($fp, LOCK_UN);
}
fclose($fp);
return $check;
}
========================================
2. Replace the line in function get_as_xml_file () with:
return '<?xml version="1.0"
encoding="iso-8859-1"?>'."\n".$this->get_file_internal( array(), "", 0, 1);
========================================
Ok all this is not too spectacular - but maybe these little modification can
be build in the next xmp.php version?
I am very new to php and the code might be not so perfect - but it worked
for me.
Why wasn't there something like the "write_xml" function before? I could
have used "xmldb.php" but i was not too happy with it...
Cheers
Jan
--
This message has been sent through the <phpXML/> user discussion list. To unsubscribe,
please visit https:[EMAIL PROTECTED]/
_______________________________________________
Phpxmldb-phpxml-arc mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/phpxmldb-phpxml-arc