XInclude with Saxon 9.6 in .NET application
Added by Martin Honnen about 9 years ago
I am trying to get XInclude supported in a C# .NET application with Saxon 9.6.0.7 HE, but it does not work. The code I have is
Uri baseUri = new Uri(Environment.CurrentDirectory);
Processor proc = new Processor();
proc.Implementation.setXIncludeAware(true);
Console.WriteLine("XIncludeAware: {0}", proc.Implementation.isXIncludeAware());
XmlResolver resolver = new XmlUrlResolver();
XdmNode input = proc.NewDocumentBuilder().Build(resolver.ResolveUri(baseUri, "../XMLFile1.xml"));
Console.WriteLine(input.OuterXml);
Console.WriteLine(input.BaseUri);
Console.WriteLine(File.Exists(resolver.ResolveUri(input.BaseUri, "XMLFile2.xml").LocalPath));
The file @XMLFile1.xml@ is
the file @XMLFile2.xml@ is
foo
the output of the code is
XIncludeAware: True file:///c:/Users/Martin Honnen/Documents/Visual Studio 2012/Projects/SaxXInclTest1/SaxXInclTest1/XMLFile1.xml True
so I think the parser should include the referenced file @XMLFile2.xml@ but it does not do that.
I am not sure what is wrong, when I use the Saxon 9.6 .NET Transform application with option @-xi:on@ on the input document then XInclude is applied.
I also tried setting @proc.SetProperty("http://saxon.sf.net/feature/xinclude-aware", "true");@ but it does not change the result, XInclude is not applied.
Replies (2)
RE: XInclude with Saxon 9.6 in .NET application - Added by O'Neil Delpratt about 9 years ago
Thanks for your feedback. This looks like a bug to me Saxon comes with the JAXP parser which is used by default and does support XInclude.
I have created a bug issue: https://saxonica.plan.io/issues/2488
RE: XInclude with Saxon 9.6 in .NET application - Added by O'Neil Delpratt about 9 years ago
Bug has now been fixed. see bug issue #2488
Please register to reply