Hi i was wondering how this works, i want to use the umbraco rest feature to output xml that we wanna use on a google maps object, but i am stuck with the last peace of code, when i debug i see that the xml is availble, but when i return it, it always shows the entire XML document, can someone help me how to accomplish this?
[code]
using System; using System.Collections.Generic; using System.Linq; using System.Web;
using umbraco.cms.businesslogic.web; using umbraco.BusinessLogic; using System.IO; using System.Xml.XPath; namespace Stadgenoot.Business { public class Rest { public static int Hello() { var x = umbraco.library.GetXmlNodeByXPath("root/descendant::Huurwoning"); return x.count; } } }
[/code]
This works, it returns 21 objects, which is corret, but my question is, how do i output the xml of those?
using System; using System.Collections.Generic; using System.Linq; using System.Web;
using umbraco.cms.businesslogic.web; using umbraco.BusinessLogic; using System.IO; using System.Xml.XPath; namespace Stadgenoot.Business { public class Rest { public static int Hello() {
var x = umbraco.library.GetXmlNodeByXPath("root/descendant::Huurwoning");
Here's an excerpt from the Umbraco Wiki Documentaton on /base:
"Your methods can have almost any return type. Base will convert your type to a string and return the result of the conversion. The string representation of your return type is produced by calling ToString() on the return type, which in many cases amounts to the name of the type.
The only exception to this rule is your method returns a System.Xml.XPath.XPathNodeIterator, in which case /base will return the OuterXml of the Xml content of the XPathNodeIterator."
The problem is that the entire XML Document is returned, it doesn't seem to matter what kind of xpath expression i use, however, when i go in debug mode, i can see that the count is ok, the only problem is that i don't have an idea how i can return the right objects.
Umbraco base and returning multple nodes
Hi i was wondering how this works, i want to use the umbraco rest feature to output xml that we wanna use on a google maps object, but i am stuck with the last peace of code, when i debug i see that the xml is availble, but when i return it, it always shows the entire XML document, can someone help me how to accomplish this?
[code]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.web;
using umbraco.BusinessLogic;
using System.IO;
using System.Xml.XPath;
namespace Stadgenoot.Business
{
public class Rest
{
public static int Hello()
{
var x = umbraco.library.GetXmlNodeByXPath("root/descendant::Huurwoning");
return x.count;
}
}
}
[/code]
This works, it returns 21 objects, which is corret, but my question is, how do i output the xml of those?
Something went wrong with code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.web;
using umbraco.BusinessLogic;
using System.IO;
using System.Xml.XPath;
namespace Stadgenoot.Business
{
public class Rest
{
public static int Hello()
{
var x = umbraco.library.GetXmlNodeByXPath("root/descendant::Huurwoning");
return x.count;
}
}
}
Here's an excerpt from the Umbraco Wiki Documentaton on /base:
"Your methods can have almost any return type. Base will convert your type to a string and return the result of the conversion. The string representation of your return type is produced by calling ToString() on the return type, which in many cases amounts to the name of the type.
The only exception to this rule is your method returns a System.Xml.XPath.XPathNodeIterator, in which case /base will return the OuterXml of the Xml content of the XPathNodeIterator."
Check
http://our.umbraco.org/wiki/reference/umbraco-base/programming-a-class-for-the-base-system
For code examples.
Regards
Jesper Hauge
Yes, i was able to output xml, when i use:
return umbraco.library.GetXmlNodeByXPath("root/descendant::Huurwoning");
The problem is that the entire XML Document is returned, it doesn't seem to matter what kind of xpath expression i use, however, when i go in debug mode, i can see that the count is ok, the only problem is that i don't have an idea how i can return the right objects.
Ditto; GetXmlNodeByXPath seems to always result in the entire content tree, regardless of the xpath argument.
is working on a reply...