var panoramaNodes = content.Instance.XmlContent.SelectNodes("//node [@nodeTypeAlias = 'Panorama' and data[@alias = 'mailSentDate'] != '']");
This works great and I am happily working with the nodes that get returned. So far, so good.
However, I saw a tweet by Niels a few weeks ago of him wanting to break the possibility to directly call content.Instance. I always knew I was not really supposed to do that, but anything that can be abused will be abused, right? ;-)
So, here's my question: how SHOULD I be getting the same result (an XmlNodeList)? I've been looking for sample code, using the nodeFactory, but I can't find an example that works for me. Can someone please show me how to rewrite the above code?
Got source of those tweets? I actually added an exposure of the XML cache within the UmbracoContext which is more useful in v4.1. But I exposed it as a XDocument, cuz LINQ to XML is more awesome ;)
I just really want a clear example of something using the nodeFactory, as I can't seem to find any. Also, we're not "supposed" to call content.Instance directly anyway, so I would like a good alternative.
Mostly this is just something I want for documentation of best practices.
Alternative to content.Instance.XmlContent
So I am getting an XmlNodeList by doing this:
This works great and I am happily working with the nodes that get returned. So far, so good.
However, I saw a tweet by Niels a few weeks ago of him wanting to break the possibility to directly call content.Instance. I always knew I was not really supposed to do that, but anything that can be abused will be abused, right? ;-)
So, here's my question: how SHOULD I be getting the same result (an XmlNodeList)? I've been looking for sample code, using the nodeFactory, but I can't find an example that works for me. Can someone please show me how to rewrite the above code?
Many thanks!
Got source of those tweets? I actually added an exposure of the XML cache within the UmbracoContext which is more useful in v4.1. But I exposed it as a XDocument, cuz LINQ to XML is more awesome ;)
I think he decided against removing it after all, but I remember that tweet too.
Niels' original tweet and his promise to "behave" (as if! :p) later.
Now answer the original question, please. ;-) lol
What's wrong with your solution? Looks neat to me. Unless you want to use LINQ2Umbraco in 4.1 that is. That'll look even better.
I just really want a clear example of something using the nodeFactory, as I can't seem to find any. Also, we're not "supposed" to call content.Instance directly anyway, so I would like a good alternative.
Mostly this is just something I want for documentation of best practices.
is working on a reply...