Can I include an XML file within another XML file?

Joined
May 11, 2011
Messages
1
Reaction score
0
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:
Code:
<?xml version='1.0' encoding='UTF-8'?>
<markers>
[COLOR=red]<marker name="whatever" lat="-27.927513" lng="153.194305" category="Travel Guides" />
<marker name="something else" lat="27.927513" lng="-153.194305" category="Accommodation" />[/COLOR]
<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)
Code:
<?xml version='1.0' encoding='UTF-8'?>
<markers xmlns:xi="http://www.w3.org/2001/XInclude">
[COLOR=red]<xi:include href="marker.xml"/>[/COLOR]
<mapstyle zoom="5" lat="-22" lng="147" />
<category name="Accommodation" initial="show" />
<category name="Activities" initial="hide" />
</markers>
together with the marker.xml file:
Code:
<?xml versio[COLOR=black]n='1.0'?>
[/COLOR][COLOR=red][COLOR=black]<marker name="whatever" lat="-27.927513" lng="153.194305" category="Travel Guides" />
<marker name="something else" lat="27.927513" lng="-153.194305" category="Accommodation" />[/COLOR][/COLOR]
but I am obviously doing something wrong, since I cannot get it to work at all.
Any help greatly appreciated.

 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,153
Members
46,701
Latest member
XavierQ83

Latest Threads

Top