child nodes
-
I'm generating some C code from XML, and now I want to generate sub Structs. I know I can do the following (a child node of same name as parent node), value value But what I'm having problems with is getting the top-level structs with SelectNodes, and then getting sub-level structs with SelectNodes (or other select commands). I've been doing things like: //StructList = xDB->m_pDomDocument->getElementsByTagName("Struct"); StructList = xDB->m_pDomDocument->selectNodes("//Struct"); and have not gotten lucky yet. X|
-
I'm generating some C code from XML, and now I want to generate sub Structs. I know I can do the following (a child node of same name as parent node), value value But what I'm having problems with is getting the top-level structs with SelectNodes, and then getting sub-level structs with SelectNodes (or other select commands). I've been doing things like: //StructList = xDB->m_pDomDocument->getElementsByTagName("Struct"); StructList = xDB->m_pDomDocument->selectNodes("//Struct"); and have not gotten lucky yet. X|
I have not used any of the calls to return a selective list (just the entire list and then steped through it.) I believe it is quite picky on having a bstr as the argument not a char array as you have. Try declaring a "CComBSTR txt;" and then using it. What parser version are you using? Depending on what you are looking for it may be more direct to use an xslt transformation. To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
-
I have not used any of the calls to return a selective list (just the entire list and then steped through it.) I believe it is quite picky on having a bstr as the argument not a char array as you have. Try declaring a "CComBSTR txt;" and then using it. What parser version are you using? Depending on what you are looking for it may be more direct to use an xslt transformation. To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
thanks much I'm using MSXML v4 (current) the quoted text is working . . . although come to think of it, I always use BSTR's when convering from CStrings (doing this in MFC) xslt transformation - I have not yet had the courage to do that in C++ code About stepping throught the list . . . actually, what I am trying to do is very,very similar to the MSDN example where they recursed through a node set and displayed all the nodes in a CTreeCtrl . . . maybe I'll go back and try to figure out the recursion that needs to be done. If I can recurse through the node tree and keep track of which nodes are child to which, it might be less complicated than I am making it.
-
thanks much I'm using MSXML v4 (current) the quoted text is working . . . although come to think of it, I always use BSTR's when convering from CStrings (doing this in MFC) xslt transformation - I have not yet had the courage to do that in C++ code About stepping throught the list . . . actually, what I am trying to do is very,very similar to the MSDN example where they recursed through a node set and displayed all the nodes in a CTreeCtrl . . . maybe I'll go back and try to figure out the recursion that needs to be done. If I can recurse through the node tree and keep track of which nodes are child to which, it might be less complicated than I am making it.
have you looked at Ray Hayes demo? http://www.codeproject.com/soap/iexmlparser.asp This was with MSXML 3 but still applys to what you describe. To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
-
have you looked at Ray Hayes demo? http://www.codeproject.com/soap/iexmlparser.asp This was with MSXML 3 but still applys to what you describe. To be conscious that you are ignorant of the facts is a great step towards Knowledge. Benjamin Disraeli
thanks much, good demo, it does apply, and the comments below it were helpful too.