Hey everyone, I'm trying to work with the /base functionality but something is not working like I'm expecting. I have set the config file to returnXml="true". Now, on the return page I get a nice <value> node, all the other nodes however, are not really nodes. Instead, they are simply text within the <value> node.
Which is not what I want, as I need the function to output a well formed XML document.
Hmm, sorry Richard but I don't really get it. The thing is, at the moment there is no XML to use an XpathNodeIterator on. I'm trying to build one in a /base function.
string query = "my query here"
var reader = umbraco.BusinessLogic.Application.SqlHelper.ExecuteReader(query);
This is basically my code. When I navigate to it however, everything that gets outputted is plain text, despite my config saying I want it to return XML. So, either I am misundertanding, and I should somehow make it return an XpathNodeIterator, or there is something else I'm missing. All I see now though, is that an XpathNodeIterator needs an XML to read from, which I do not have as I am trying to build it.
Yay! I got it! Thanks Richard! Returning an XPathNodeIterator was indeed just the answer I needed :D
@Ove: No, the problem wasn't my code, it worked and returned my data. It merely returned it as plain text rather than XML. I basically got the same result as the example page, a node called "value" holding all the stuff I returned as plain text. So what I needed to know, was how to make it return my output as an XML file.
/base and xml
Hey everyone, I'm trying to work with the /base functionality but something is not working like I'm expecting. I have set the config file to returnXml="true". Now, on the return page I get a nice <value> node, all the other nodes however, are not really nodes. Instead, they are simply text within the <value> node.
Which is not what I want, as I need the function to output a well formed XML document.
I am using Umbraco 4.5.2 btw.
Thanks in advance,
-Ferdy
Hi Ferdy,
The method returns an http://msdn.microsoft.com/en-us/library/system.xml.xpath.xpathnodeiterator.aspx">XpathNodeIterator instead of an XmDocument. Check the example on the msdn page how to process these nodes.
Cheers,
Richard
Hmm, sorry Richard but I don't really get it. The thing is, at the moment there is no XML to use an XpathNodeIterator on. I'm trying to build one in a /base function.
This is basically my code. When I navigate to it however, everything that gets outputted is plain text, despite my config saying I want it to return XML. So, either I am misundertanding, and I should somehow make it return an XpathNodeIterator, or there is something else I'm missing. All I see now though, is that an XpathNodeIterator needs an XML to read from, which I do not have as I am trying to build it.
Regards,
-Ferdy
Sorry you should return an XPathNodeIterator when using the returnXml option. This is just a string, so just return as a string?
Have you checked if the sample application works for you?
http://our.umbraco.org/wiki/reference/umbraco-base/simple-base-samples
It too returns a string.
If you could try to implement that sample, it will be easier too see if this is an issue with your code or something else.
Yay! I got it! Thanks Richard! Returning an XPathNodeIterator was indeed just the answer I needed :D
@Ove: No, the problem wasn't my code, it worked and returned my data. It merely returned it as plain text rather than XML. I basically got the same result as the example page, a node called "value" holding all the stuff I returned as plain text. So what I needed to know, was how to make it return my output as an XML file.
Which it now does.
Thanks again Richard!
Regards,
-Ferdy
is working on a reply...