##// END OF EJS Templates
Добавлена метка v3.0.10 для набора изменений 74e048cbaac8
Добавлена метка v3.0.10 для набора изменений 74e048cbaac8

File last commit:

r264:3a6e18c432be v3
r266:254d1f255d87 v3
Show More
XmlToJson.cs
32 lines | 967 B | text/x-csharp | CSharpLexer
cin
Added XmlToJson xsl transformation....
r264 using System;
using System.IO;
using System.Reflection;
using System.Xml;
using System.Xml.Xsl;
using Implab.Components;
using Implab.Formats.Json;
namespace Implab.Xml {
public class XmlToJson {
const string XmlToJsonTransformId = "Implab.Xml.json.xsl";
static LazyAndWeak<XslCompiledTransform> m_default = new LazyAndWeak<XslCompiledTransform>(CreateTransform, true);
public static XslCompiledTransform Default {
get { return m_default.Value; }
}
protected static XslCompiledTransform CreateTransform() {
var transform = new XslCompiledTransform();
using(var reader = XmlReader.Create(GetDefaultTransform())) {
transform.Load(reader);
}
return transform;
}
protected static Stream GetDefaultTransform() {
return Assembly.GetExecutingAssembly().GetManifestResourceStream(XmlToJsonTransformId);
}
}
}