0

I am testing XML.XInclude following its structure guide:

http://www.w3.org/2001/XInclude.xsd

I have a child1.xml file:

<?xml version="1.0"?>
<child1>
  <config>
  </config>
</child1>

a child2.xml file:

<?xml version="1.0"?>
<child2>
  <config>
  </config>
</child2>

and parent.xml file:

<?xml version="1.0"?>
<config xmlns:xi="http://www.w3.org/2001/XInclude">
    <xi:include parse="xml" href="child1.xml"/>
    <xi:include parse="xml" href="child2.xml"/>
</config>

However, when I open parent.xml in Internet Explorer, the child1.xml and child2.xml are not merged inside the parent.xml. I expect that the contents of child1.xml and child2.xml are shown in parent.xml but it does not. I just see this with parent.xml:

<?xml version="1.0" ?> 
- <config xmlns:xi="http://www.w3.org/2001/XInclude">
  <xi:include parse="xml" href="child1.xml" /> 
  <xi:include parse="xml" href="child2.xml" /> 
  </config>

Did I do something wrong or using XInclude will not show the include files?

Thanks in advance.

olidev
  • 20,058
  • 51
  • 133
  • 197

1 Answers1

0

Internet Explorer doesn't have any support for XInclude. Nor does any other browser I can think of. You need to use an XInclude processor. E.g. if you had it parent.xml loaded into a PHP DOMDocument then you could call its xinclude() method and it would process the includes.

Jon Hanna
  • 110,372
  • 10
  • 146
  • 251
  • is there any tool for visualizing the XInclude? Thanks in advance. – olidev Mar 07 '12 at 11:58
  • @devn no doubt there is, but I don't know of any. I haven't played with XInclude in ages. I experimented a bit while the spec was a working draft and found it relatively easy to roll ones own implementation for most cases (I was playing so I didn't care about catching every edge case). – Jon Hanna Mar 21 '12 at 11:12
  • there is an XInclude library for .NET - https://mvpxml.codeplex.com/wikipage?title=XInclude.NET&referringTitle=Home, however it doesn't seem to support local relative paths, so I think I need to use an XmlResolver as mentioned at their webpage. I'm working to add support for XInclude to my XmlTransform utility (http://zoomicon.com/tranXform), since I need it for a project – George Birbilis Sep 26 '14 at 13:10
  • also, I wonder if one could use Behaviors to implement XInclude in IE in a similar way to how CSS3 PIE uses them to add support for CSS3 (http://css3pie.com/documentation/supported-css3-features/ - see the .htc file they have for example) – George Birbilis Sep 26 '14 at 13:13