Project

Profile

Help

Saxon .Net XML Version 1.1

Added by Anonymous about 15 years ago

Legacy ID: #7762054 Legacy Poster: Krishan Arora (kris2510)

Hi, I am using the .Net Saxon HE API (Saxon 9HE) for transforming xsl. But as soon as I specify the xml version as 1.1, it gives me an error at processor.NewXsltCompiler().Compile(new System.Uri(xslPath)).Load(); Does Saxon .Net API support XML Version 1.1? Thanks


Replies (3)

Please register to reply

RE: Saxon .Net XML Version 1.1 - Added by Anonymous about 15 years ago

Legacy ID: #7762073 Legacy Poster: Michael Kay (mhkay)

Saxon supports XML 1.1 provided that the XML parser supports it. But I think the native Microsoft XML parsers don't. So you'll have to ensure that all parsing is done using the Apache Xerces parser, which is included in the Saxon .NET runtime library. I haven't tested this, but try calling processor.setProperty("http://saxon.sf.net/feature/preferJaxpParser", "true") on the Processor object

RE: Saxon .Net XML Version 1.1 - Added by Anonymous about 15 years ago

Legacy ID: #7762089 Legacy Poster: Krishan Arora (kris2510)

I tried setting the property but didn't work for me. Is there something else we can try? Many Thanks!

RE: Saxon .Net XML Version 1.1 - Added by Anonymous about 15 years ago

Legacy ID: #7762221 Legacy Poster: Michael Kay (mhkay)

It seems that this Processor option only affects documents parsed using the DocumentBuilder. It seems to work if you do it this way: // Create a Processor instance. Processor processor = new Processor(); processor.SetProperty("http://saxon.sf.net/feature/preferJaxpParser", "true"); // Load the source document XdmNode input = processor.NewDocumentBuilder().Build(new Uri(samplesDir, "data/books.xml")); // Create a transformer for the stylesheet. XdmNode styledoc = processor.NewDocumentBuilder().Build(new Uri(samplesDir, "styles/books.xsl")); XsltTransformer transformer = processor.NewXsltCompiler().Compile(styledoc).Load(); Sorry for the incorrect advice. Generally, though, I'm not sure it's wise to be using XML 1.1 in a .NET environment. I don't think Microsoft have any intention of supporting it, so you may be restricting your choice of tools. However, it's nice to know that you can convert the documents to XML 1.0 using Saxon if you need to!

    (1-3/3)

    Please register to reply