Hello!
I have an XML file, and I want to insert new nodes, but I don't know how?
Can somebody help me?
This is my XML file.
<?xml version="1.0" encoding="utf-8"?>
<root>
<uri><![CDATA[http://api.bart.gov/api/route.aspx?cmd=routeinfo&route=2]]></uri>
<sched_num>28</sched_num>
<routes>
<route>
<name>Millbrae/SFIA - Pittsburg/Bay Point</name>
<abbr>SFIA-PITT</abbr>
<config>
<station>MLBR</station>
<station>SFIA</station>
<station>SBRN</station>
</config>
</route>
</routes>
<message/>
</root>
Now I have new route, which I want to add to this file, How I can do that?
$newroute =
<?xml version="1.0" encoding="utf-8"?>
<root>
<uri><![CDATA[http://api.bart.gov/api/route.aspx?cmd=routeinfo&route=3]]></uri>
<sched_num>28</sched_num>
<routes>
<route>
<name>Richmond - Fremont</name>
<abbr>RICH-FRMY</abbr>
<config>
<station>MLBR</station>
<station>SFIA</station>
<station>SBRN</station>
</config>
</route>
</routes>
<message/>
</root>
Thx a lot!