Menu

How to find an element

Lou
2005-12-01
2013-05-20
  • Lou

    Lou - 2005-12-01

    How can I find a specific element.

    example, I want to get to element named <list>. The element <soap1> and <soap2> might be there or not.

    <soap1>
      <soap2>
        <list>
          <item>
            <name>name1</name>
            <type>type1</type>
          </item>
          <item>
          ...
          </item>
        </list>
      </soap2> 
    </soap1>

    There is a discussion, subject:  getElementsByTagName, and the reply was to use GetChildElement, but I don't think this function exists!!

    thanks,
    Lou.

     
    • helen

      helen - 2005-12-25

      I have the same question!
      the following is my xml file:
      <?xml version="1.0"?>
      <friends>
          <friend>
              <tel>
                  <home>05922192318</home>
                  <work>05923856923</work>
              </tel>
              </friend>
      </friends>

      i write the code:
      TiXmlHandle docHandle( &pXMLDom );

      TiXmlNode* node = docHandle.FirstChild(nodeName).Node();

      Just when the nodeName="friends", node is not NULL,but I want to search the node by his name for examples "home" , then how can I get this node buy its tag Name?

      Thanks in advance!

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.