Using XmlReader in .NET for XSLT Converting Very Large XML Files

All,

I'm not sure if this is possible, so I thought it would be better to ask here. In C #, I do a lot of XSLT transformations of very large XML files (15 MB each) A constant problem that I encountered is the fact that XPathDocument uses too much data to represent XML in memory as a tree. Is it possible to use an XmlReader that is based on SAX to convert a document using XSLT?

Many thanks,

MK

+3
source share
4 answers

XSLT 1.0 , , XSLT 1.0. XSLT 3.0 streaming, Saxon 9.3: http://www.saxonica.com/documentation/sourcedocs/streaming.xml.

, , "15 " " ". XSLT 1.0 .NET?

+1

XPathNavigator ( XPathDocument CreateNavigator) XslCompiledTransform XslTransform . , XPathNavigator SAX .

, .

0

There is a set of XSL controls available in the .net library that inherit from standard Xml controls.

The article is available here:

http://support.microsoft.com/kb/307322

using System;
using System.Xml;
using System.Xml.Xsl; 

namespace XSLTransformation
{
    public class Class1
    {
        static void Main(string[] args)
        {
            XslTransform myXslTransform = new XslTransform();

            myXslTransform.Load("reference.xsl"); 

            myXslTransform.Transform("inputfile.xml", "outputfile.xml");

         }
    }
}
-1
source

You can do it,

          XmlTextReader xtr = new XmlTextReader("C:\abc.xml");
          XPathDocument xp = new XPathDocument(xtr);
          XPathNavigator xpn =   xp.CreateNavigator();

Hope this helps you.

-1
source

Source: https://habr.com/ru/post/1796006/


All Articles