Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Kim Grandgagnage 63 posts 87 karma points
    Sep 16, 2011 @ 18:34
    Kim Grandgagnage
    0

    "ghost nodes" in content.Instance.XmlContent.CreateNavigator();

     

    Hi,

    How can it be that the content.Instance.XmlContent.CreateNavigator returns nodes that doesn't exist anymore?
    I want to retreive orderlines for a specific order in my usercontrol. For this I've written a method called "GetNodes", given the following parameters:

    * propertyValue = an orderid
    * property = "@parentID"
    * docType = "OrderItemDoctype"

    So when I execute:
    GetNodes("OrderItemDoctype", "@parentID", 1000).Select(orderitem => new OrderItem(orderitem.Id)).ToList();

    I should retreive all the orderlines for order with an id equal to 1000. In the backend order 1000 doesn't have any orderlines. But when I execute the method, it returns orderlines which I deleted a time ago.

    Any help would we appreciated!

    Below is my method:

    public static IEnumerable<Node> GetNodes(string docType, string property, int propertyValue)
    {       var nodes = new Collection<Node>();
    var xpn = content.Instance.XmlContent.CreateNavigator();
            var xpni = xpn.Select("//" + docType + " [" + property + " = " + propertyValue + "]");
                while (xpni.MoveNext())
                {
                    var node = xpni.Current;
                    if (node == null) continue;
                    var attribute = node.GetAttribute("id", "");
                    if (ValidationHelper.IsNumeric(attribute))
                    {

                    }
                }
                return nodes;
            }

     

  • Kim Grandgagnage 63 posts 87 karma points
    Sep 16, 2011 @ 18:39
    Kim Grandgagnage
    0

    In the if (ValidationHelper.IsNumeric(attribute)) there are two more code lines:

    var n = new Node(Convert.ToInt32(attribute));
    nodes.Add(n);

Please Sign in or register to post replies

Write your reply to:

Draft