How to find node using attribute

Developer
rajesh
2011-07-19
2013-05-20
  • rajesh
    rajesh
    2011-07-19

    i am using TinyXPath to find the node whose tag is "node" using attribute, it is not working. for other node whose tag is "nodes" or "objects" or "sg"  is working fine.

    has the name "node" some internal meaning or what? i m confused??

     
  • rajesh
    rajesh
    2011-07-19

    the sample code is…
    xpath_processor XPathParam(root, "//dgn/sg/objects");
    int nParamCnt = XPathParam.u_compute_xpath_node_set();
    TiXmlElement* pTiXmlEle = XPathParam.XNp_get_xpath_node(0)->ToElement();

    xpath_processor XPathPrm(pTiXmlEle, "object[@name = 'abc'");
    int iParam = XPathPrm.u_compute_xpath_node_set();
    TiXmlElement* pTiXmlEleParam = XPathPrm.XNp_get_xpath_node(0)->ToElement();

    it is working.
    but when i am using node in place of object it is giving the all nodes and not considering attribute 'abc'

    why??