Can I include an XML file within another XML file?

Discussion in 'XML' started by Poirot, May 11, 2011.

  1. Poirot

    Poirot

    Joined:
    May 11, 2011
    Messages:
    1
    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.

    Poirot, May 11, 2011
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. foldface@yahoo.co.uk
    Replies:
    1
    Views:
    781
    Bertilo Wennergren
    Nov 24, 2003
  2. Tony Prichard
    Replies:
    0
    Views:
    717
    Tony Prichard
    Dec 12, 2003
  3. BlackIce
    Replies:
    1
    Views:
    17,153
  4. mark4asp
    Replies:
    2
    Views:
    2,198
    Harry Haller
    Nov 7, 2006
  5. Andreas Bogenberger
    Replies:
    3
    Views:
    888
    Andreas Bogenberger
    Feb 22, 2008
Loading...

Share This Page