Hello everyone, I've been working on a /base routine that will in theory ingest xml from an external source parse that xml via xslt and chuck out nicely formed xml at the other end. Trouble is I'm still quite new to C# .net development and I'm having to feel my way around the problem.
This is what I have so far.
using System; using System.Collections.Generic; using System.Linq; using System.Web; using umbraco.presentation.umbracobase; using umbraco.presentation.Web; using System.Xml.XPath; using System.Xml; using System.Xml.Xsl;
namespace GeckoBoard.XMLProcessings { public class Library { public static XPathNodeIterator Test() { XmlDocument document = new XmlDocument(); //Fetch XML over HTTP document.Load("http://api.getclicky.com/api/stats/4?site_id=66353141&sitekey=73ba7921526acd12&type=visitors-list&visitor-details=time,uid&date=today&limit=all");
XslCompiledTransform xslt = new XslCompiledTransform();
//Load in XSLT (a local path would be better I think?) xslt.Load("http://mydomaine/xslt/Test.xslt");
XmlDocument transform = new XmlDocument();
//Attempt to pass in the XML document into the transform using (XmlWriter writer = transform.CreateNavigator().AppendChild()) { xslt.Transform(document, null, writer); }
Thanks for the infomation on XDocument, that could really be useful.
I did had a feeling the error may be with xslt.load I did try a, for want of a better word, local path but that reasult in a load error also. When I input
xslt.Load("text.xstl");
I recieved an error that file could not be located at location on the C:// but it bore little resemblece to the location of the file. Is there a better way to specify the location of a local file within a load statement?
Parsing XML using XSLT in /base
Hello everyone,
I've been working on a /base routine that will in theory ingest xml from an external source parse that xml via xslt and chuck out nicely formed xml at the other end. Trouble is I'm still quite new to C# .net development and I'm having to feel my way around the problem.
This is what I have so far.
At pressent I'm getting an inner exception of "System.IO.IOException: Unable to read data from the transport connection"
Any ideas anyone has are welcome =)
It seems this error is unrelated to outputting xml with /base. I think the error is in document.load or xslt.load.
Btw in Umbraco 4.6 you can also output an XmlDocument or XDocument. See this topic: http://our.umbraco.org/forum/developers/api-questions/12058-XPathNodeIterator-loses-CDATA
Jeroen
Thanks for the infomation on XDocument, that could really be useful.
I did had a feeling the error may be with xslt.load I did try a, for want of a better word, local path but that reasult in a load error also.
When I input
I recieved an error that file could not be located at location on the C:// but it bore little resemblece to the location of the file. Is there a better way to specify the location of a local file within a load statement?
is working on a reply...