i'm trying to create a xml file with the following code:
$xmlfile='template.xml';
$xml = simplexml_load_file($xmlfile);
$xml->asXML('12801.xml');
while template.xml file contains this:
<?xml version="1.0" standalone="yes"?>
<posts>
<1president/>
<2vice-president/>
<3secretary/>
<4assistant-secretary/>
<5science-secretary/>
<6dramatic-secretary/>
<7athletic-secretary/>
</posts>
it's throwing a lot of errors saying:
Warning: simplexml_load_file(): template.xml:3: parser error : StartTag: invalid element name in try.php on line 3
what is the problem here? as much i know, the xml in template.xml seems to be valid.
_). After initial character following are allowed: digits period(.) hyphen(-) underscore(_) colon(:- legal but should not be used except for namespaces NO other characters are allowed like #, @, $, %.... w3.org/TR/REC-xml/#NT-NameChar$result3 = mysql_query("SELECT * FROM post") or die(mysql_error()); $xml=new SimpleXMLElement("<posts></posts>");; while($row3 = mysql_fetch_array($result3)) $newchild = $xml->addChild($row3['post']); $xml->asXML("vote/template.xml");