Hi folks,
I am having an awful problem. I have an xml file structured like this:
I need to copy the "<VIEW_NAME>" node and place it inside each "<T_COMMENTS>" node for each "<VIEW_NAME>" node.
I need to do this so that I can import the xml file as two tables linked by [VIEW_NAME]
The result would be something like this:
I am almost at the stage of pulling my hair out with this. I can't find any examples of this online. Very little documentation or tutorials on how to do this with VBA. I'm a complete newbie with XML DOM.
Any help at all is much appreciated!
I am having an awful problem. I have an xml file structured like this:
Code:
<root>
<T_IMPORT>
<VIEW_NAME>0001</VIEW_NAME>
<IMAGE_FILE>0001.jpg</IMAGE_FILE>
<T_COMMENTS>
<COMMENT_NO>Comment 1</COMMENT_NO>
<STATUS>New</STATUS>
<USER>user1</USER>
<COMMENT>001sdfgsdfghsdfgsdfgasdf</COMMENT>
</T_COMMENTS>
<T_COMMENTS>
<COMMENT_NO>Comment 2</COMMENT_NO>
<STATUS>New</STATUS>
<USER>User2</USER>
<COMMENT>002sdfgsdfgsdfgsdfg</COMMENT>
</T_COMMENTS>
</T_IMPORT>
<T_IMPORT>
<VIEW_NAME>0002</VIEW_NAME>
<IMAGE_FILE>0002.jpg</IMAGE_FILE>
<T_COMMENTS>
<COMMENT_NO>Comment 1</COMMENT_NO>
<STATUS>New</STATUS>
<USER>User3</USER>
<COMMENT>003sdfgsdfgsdfgsdfgsdf</COMMENT>
</T_COMMENTS>
<T_COMMENTS>
<COMMENT_NO>Comment 2</COMMENT_NO>
<STATUS>New</STATUS>
<USER>User5</USER>
<COMMENT>TESTCOMMENT!</COMMENT>
</T_COMMENTS>
</T_IMPORT>
</root>
I need to copy the "<VIEW_NAME>" node and place it inside each "<T_COMMENTS>" node for each "<VIEW_NAME>" node.
I need to do this so that I can import the xml file as two tables linked by [VIEW_NAME]
The result would be something like this:
Code:
<root>
<T_IMPORT>
<VIEW_NAME>View 1</VIEW_NAME>
<IMAGE_FILE>0001.jpg</IMAGE_FILE>
<T_COMMENTS>
<VIEW_NAME>View 1</VIEW_NAME>
<COMMENT_NO>Comment 1</COMMENT_NO>
<STATUS>New</STATUS>
<USER>user1</USER>
<COMMENT>001sdfgsdfghsdfgsdfgasdf</COMMENT>
</T_COMMENTS>
<T_COMMENTS>
<VIEW_NAME>View 1</VIEW_NAME>
<COMMENT_NO>Comment 2</COMMENT_NO>
<STATUS>New</STATUS>
<USER>User2</USER>
<COMMENT>002sdfgsdfgsdfgsdfg</COMMENT>
</T_COMMENTS>
</T_IMPORT>
<T_IMPORT>
<VIEW_NAME>View 2</VIEW_NAME>
<IMAGE_FILE>0002.jpg</IMAGE_FILE>
<T_COMMENTS>
<VIEW_NAME>View 2</VIEW_NAME>
<COMMENT_NO>Comment 1</COMMENT_NO>
<STATUS>New</STATUS>
<USER>User3</USER>
<COMMENT>003sdfgsdfgsdfgsdfgsdf</COMMENT>
</T_COMMENTS>
<T_COMMENTS>
<VIEW_NAME>View 2</VIEW_NAME>
<COMMENT_NO>Comment 2</COMMENT_NO>
<STATUS>New</STATUS>
<USER>User5</USER>
<COMMENT>TESTCOMMENT!</COMMENT>
</T_COMMENTS>
</T_IMPORT>
</root>
I am almost at the stage of pulling my hair out with this. I can't find any examples of this online. Very little documentation or tutorials on how to do this with VBA. I'm a complete newbie with XML DOM.
Any help at all is much appreciated!