I'm trying to write on xml file. but my server have DOM as disabled. so i can't use the DOM function.
daha sonra diğer xml üzerinde DOM yazmak için bir yol var?
Files:
xml:
<?xml version="1.0" encoding="UTF-8"?>
<events>
<record>
<event>aaa</event>
<eventDate>bbb</eventDate>
<desc>ccc</desc>
</record>
Parser.php:
header("Content-type: text/html; charset=utf-8");
$record = array(
'event' => $_POST['event'],
'eventDate' => $_POST['eventDate'],
'desc' => $_POST['desc'],
);
$doc = new DOMDocument();
$doc->load( 'calendar.xml' );
$doc->formatOutput = true;
$r = $doc->getElementsByTagName("events")->item(0);
$b = $doc->createElement("record");
$event = $doc->createElement("event");
$event->appendChild(
$doc->createTextNode( $record["event"] )
);
$b->appendChild( $event );
$eventDate = $doc->createElement("eventDate");
$eventDate->appendChild(
$doc->createTextNode( $record["eventDate"] )
);
$b->appendChild( $eventDate );
$desc = $doc->createElement("desc");
$desc->appendChild(
$doc->createTextNode( $record["desc"] )
);
$b->appendChild( $desc );
$r->insertBefore( $b,$r->firstChild );
$doc->save("calendar.xml");
header("Location: {$_SERVER['HTTP_REFERER']}");
ben ne yapabilirim?