Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. [Help] MFC ypelib wrappers for MSXML5

[Help] MFC ypelib wrappers for MSXML5

Scheduled Pinned Locked Moved C / C++ / MFC
c++data-structureshelptutorial
6 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • O Offline
    O Offline
    oaks rbt
    wrote on last edited by
    #1

    I am currently using the Typelib wrappers for MSXML that was generated from the MFC Typelib Class wizard. I think I am using the objects incorrectly, and this is generating unhandled exception errors. I use wizard MFC Class from Typelib to generate wrapper classes for the MSXML5 control (CXMLDOMDocument, CXMLDOMElement, CXMLDOMNode, and CXMLNodeList). The exception occurs when I pass a CXMLDOMNode reference to a function that I want it to work on by stepping down farther in the node tree. For example: If(m_XMLDOMroot.hasChildNodes()) { int rootchildcount = RootNodeList.get_length(); for(int i = 0; i < rootchildcount; ++i) { CXMLDOMElement childnode = RootNodeList.get_item(i); <- This code sometimes user breaks SetChildNode(childnode); } } Robert

    G 1 Reply Last reply
    0
    • O oaks rbt

      I am currently using the Typelib wrappers for MSXML that was generated from the MFC Typelib Class wizard. I think I am using the objects incorrectly, and this is generating unhandled exception errors. I use wizard MFC Class from Typelib to generate wrapper classes for the MSXML5 control (CXMLDOMDocument, CXMLDOMElement, CXMLDOMNode, and CXMLNodeList). The exception occurs when I pass a CXMLDOMNode reference to a function that I want it to work on by stepping down farther in the node tree. For example: If(m_XMLDOMroot.hasChildNodes()) { int rootchildcount = RootNodeList.get_length(); for(int i = 0; i < rootchildcount; ++i) { CXMLDOMElement childnode = RootNodeList.get_item(i); <- This code sometimes user breaks SetChildNode(childnode); } } Robert

      G Offline
      G Offline
      Gerald Schwab
      wrote on last edited by
      #2

      Is SetChildNode(...) removing nodes/elements from the NodeList? This causes the length of the NodeList to decrease as your looping which causes 2 errors. 1) If rootchildcount was originally 10, and nodes are being removed, your still comparing against a length of 10, even though there are fewer than 10 nodes in the list. 2) Incrementing i for any iteration where a node was removed from the list, will cause your code to skip over the node (in the nodelist) following the node that was just removed.

      O 1 Reply Last reply
      0
      • G Gerald Schwab

        Is SetChildNode(...) removing nodes/elements from the NodeList? This causes the length of the NodeList to decrease as your looping which causes 2 errors. 1) If rootchildcount was originally 10, and nodes are being removed, your still comparing against a length of 10, even though there are fewer than 10 nodes in the list. 2) Incrementing i for any iteration where a node was removed from the list, will cause your code to skip over the node (in the nodelist) following the node that was just removed.

        O Offline
        O Offline
        oaks rbt
        wrote on last edited by
        #3

        To answer you question, and give move clarification. I am not removing any nodes. I am just accessing them to pull the information out of the nodes. I have notice that in some case the nodelist size if different sizes, cause sometimes there is a TEXT_Element in the list. I just do not understand this nomial yet. But this is for different files. Robert -- modified at 14:10 Thursday 10th August, 2006

        G 1 Reply Last reply
        0
        • O oaks rbt

          To answer you question, and give move clarification. I am not removing any nodes. I am just accessing them to pull the information out of the nodes. I have notice that in some case the nodelist size if different sizes, cause sometimes there is a TEXT_Element in the list. I just do not understand this nomial yet. But this is for different files. Robert -- modified at 14:10 Thursday 10th August, 2006

          G Offline
          G Offline
          Gerald Schwab
          wrote on last edited by
          #4

          I would suggest that you change your code to check the length of the node list on every iteration of the loop.

          if(m_XMLDOMroot.hasChildNodes())
          {
          for(int i = 0; i < RootNodeList.get_length(); ++i)
          {
          CXMLDOMElement childnode = RootNodeList.get_item(i); <- This code sometimes user breaks
          SetChildNode(childnode);
          }
          }

          O 1 Reply Last reply
          0
          • G Gerald Schwab

            I would suggest that you change your code to check the length of the node list on every iteration of the loop.

            if(m_XMLDOMroot.hasChildNodes())
            {
            for(int i = 0; i < RootNodeList.get_length(); ++i)
            {
            CXMLDOMElement childnode = RootNodeList.get_item(i); <- This code sometimes user breaks
            SetChildNode(childnode);
            }
            }

            O Offline
            O Offline
            oaks rbt
            wrote on last edited by
            #5

            I did what you sugguested, and the size of the rootNodeList is not changing. So any other sugguestions? BTW- Thanks for all the help given so far. Robert

            G 1 Reply Last reply
            0
            • O oaks rbt

              I did what you sugguested, and the size of the rootNodeList is not changing. So any other sugguestions? BTW- Thanks for all the help given so far. Robert

              G Offline
              G Offline
              Gerald Schwab
              wrote on last edited by
              #6

              What's the exception your getting?

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups