John
05-10-2011, 08:25 AM
I have been looking far and wide for some tutorial on how to include external data, for example another XML or TXT file, within an XML file.
What I would like to do is to get the data in red from another file:
<?xml version='1.0' encoding='UTF-8'?>
<markers>
<marker name="whatever" lat="-27.927513" lng="153.194305" category="Travel Guides" />
<marker name="something else" lat="27.927513" lng="-153.194305" category="Accommodation" />
<mapstyle zoom="5" lat="-22" lng="147" />
<category name="Accommodation" initial="show" />
<category name="Activities" initial="hide" />
</markers>
So I tried the following main file (based on http://www.w3.org/TR/xinclude/#rel-extent (http://www.w3.org/TR/xinclude/#rel-extent%29:))
<?xml version='1.0' encoding='UTF-8'?>
<markers xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="marker.xml"/>
<mapstyle zoom="5" lat="-22" lng="147" />
<category name="Accommodation" initial="show" />
<category name="Activities" initial="hide" />
</markers>
together with the marker.xml file:
<?xml version='1.0'?>
<marker name="whatever" lat="-27.927513" lng="153.194305" category="Travel Guides" />
<marker name="something else" lat="27.927513" lng="-153.194305" category="Accommodation" />but I am obviously doing something wrong, since I cannot get it to work at all.
Any help greatly appreciated.
What I would like to do is to get the data in red from another file:
<?xml version='1.0' encoding='UTF-8'?>
<markers>
<marker name="whatever" lat="-27.927513" lng="153.194305" category="Travel Guides" />
<marker name="something else" lat="27.927513" lng="-153.194305" category="Accommodation" />
<mapstyle zoom="5" lat="-22" lng="147" />
<category name="Accommodation" initial="show" />
<category name="Activities" initial="hide" />
</markers>
So I tried the following main file (based on http://www.w3.org/TR/xinclude/#rel-extent (http://www.w3.org/TR/xinclude/#rel-extent%29:))
<?xml version='1.0' encoding='UTF-8'?>
<markers xmlns:xi="http://www.w3.org/2001/XInclude">
<xi:include href="marker.xml"/>
<mapstyle zoom="5" lat="-22" lng="147" />
<category name="Accommodation" initial="show" />
<category name="Activities" initial="hide" />
</markers>
together with the marker.xml file:
<?xml version='1.0'?>
<marker name="whatever" lat="-27.927513" lng="153.194305" category="Travel Guides" />
<marker name="something else" lat="27.927513" lng="-153.194305" category="Accommodation" />but I am obviously doing something wrong, since I cannot get it to work at all.
Any help greatly appreciated.