Topic
1 reply Latest Post - ‏2011-10-17T17:44:12Z by zabalex
ISHPK
ISHPK
1 Post
ACCEPTED ANSWER

Pinned topic XPath Query to exclude descendent elements

‏2011-10-03T14:57:50Z |
Thanks in advance...

If i already have the result of this X path Query /root/listing/seller_info/seller_name

then how can i exclude this from the following query which is made on its ancestor? root/listing/seller_info

I tried /root/listing/seller_info but it fetches all the descendents of 'seller_info' including 'seller_name'
Updated on 2011-10-17T17:44:12Z at 2011-10-17T17:44:12Z by zabalex
  • zabalex
    zabalex
    1 Post
    ACCEPTED ANSWER

    Re: XPath Query to exclude descendent elements

    ‏2011-10-17T17:44:12Z  in response to ISHPK
    Hi

    First you need to Create an XMLDocument Object and the root of your XML path to Object.
    then you create a XMLNode object and cast XMLDocument to XMLNode
    Now,
    Use the below Syntax:-
    XMLDocument objdoc = new XMLDocument(Server.MapPath("xyz.xml");
    XMLNode ObjNode = new XMLNode(objdoc);

    XMLElement objElement = ObjNode("Full path of node");

    string val = objElement.toString();

    Console.Writeline(val);

    SEO San Francisco