请问关于c的具体应用场景有哪些?

2026-04-29 01:053阅读0评论SEO基础
  • 内容介绍
  • 文章标签
  • 相关推荐

本文共计252个文字,预计阅读时间需要2分钟。

请问关于c的具体应用场景有哪些?

以下是对原文的简化

plaintext以下代码能正常工作,但运行缓慢且耗时。我正在使用带有Saxon的XSLT2将XDocument转换为另一个XDocument,通过SaxonWrapper进行调整:public static XDocument HSRTransform(XDocument source) { System.Reflection...

以下代码可以正常工作,但是很麻烦而且很慢.我正在使用带有Saxon的XSLT2将XDocument转换为另一个XDocument,使用SaxonWrapper进行调整:

public static XDocument HSRTransform(XDocument source) { System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream xslfile = thisExe.GetManifestResourceStream("C2KDataTransform.Resources.hsr.xsl"); XmlDocument xslDoc = new XmlDocument(); xslDoc.Load(xslfile); XmlDocument sourceDoc = new XmlDocument(); sourceDoc.Load(source.CreateReader()); var sw = new StringWriter(); Xsl2Processor processor = new Xsl2Processor(); processor.Load(xslDoc); processor.Transform(sourceDoc, new XmlTextWriter(sw)); XDocument outputDoc = XDocument.Parse(sw.ToString()); return outputDoc; }

我意识到缓慢可能实际上是我无法控制的位,但是有更好的方法来完成XDocument和XmlDocument之间的所有切换以及编写器的使用吗?

请问关于c的具体应用场景有哪些?

您可以尝试直接传入从XDocument创建的XmlWriter,而不是使用字符串来创建XDocument:

XDocument outputDoc = new XDocument(); processor.Transform(sourceDoc, outputDoc.CreateWriter()); return outputDoc;

除此之外,其他减速可能在SaxonWrapper本身,它使用旧的XmlDocument – 而不是它的表现速度更快.

本文共计252个文字,预计阅读时间需要2分钟。

请问关于c的具体应用场景有哪些?

以下是对原文的简化

plaintext以下代码能正常工作,但运行缓慢且耗时。我正在使用带有Saxon的XSLT2将XDocument转换为另一个XDocument,通过SaxonWrapper进行调整:public static XDocument HSRTransform(XDocument source) { System.Reflection...

以下代码可以正常工作,但是很麻烦而且很慢.我正在使用带有Saxon的XSLT2将XDocument转换为另一个XDocument,使用SaxonWrapper进行调整:

public static XDocument HSRTransform(XDocument source) { System.Reflection.Assembly thisExe = System.Reflection.Assembly.GetExecutingAssembly(); System.IO.Stream xslfile = thisExe.GetManifestResourceStream("C2KDataTransform.Resources.hsr.xsl"); XmlDocument xslDoc = new XmlDocument(); xslDoc.Load(xslfile); XmlDocument sourceDoc = new XmlDocument(); sourceDoc.Load(source.CreateReader()); var sw = new StringWriter(); Xsl2Processor processor = new Xsl2Processor(); processor.Load(xslDoc); processor.Transform(sourceDoc, new XmlTextWriter(sw)); XDocument outputDoc = XDocument.Parse(sw.ToString()); return outputDoc; }

我意识到缓慢可能实际上是我无法控制的位,但是有更好的方法来完成XDocument和XmlDocument之间的所有切换以及编写器的使用吗?

请问关于c的具体应用场景有哪些?

您可以尝试直接传入从XDocument创建的XmlWriter,而不是使用字符串来创建XDocument:

XDocument outputDoc = new XDocument(); processor.Transform(sourceDoc, outputDoc.CreateWriter()); return outputDoc;

除此之外,其他减速可能在SaxonWrapper本身,它使用旧的XmlDocument – 而不是它的表现速度更快.