4 Attachment(s)
Setting ".Text" value of XML Attribute Node Changes Node Index Order???
Cross posted at: https://www.msofficeforums.com/word-vba/42960-setting-text-value-xml-attribute-node-changes.html#post143240
and
https://social.msdn.microsoft.com/Fo...um=xmlandnetfx
The attached file should help illustrate the issue.
I recently put together a process to populate a userform Listbox using data in a document CustomXMLPart using child nodes of a parent ListEntry node:
Attachment 24589
Next, I thought it would be an interesting exercise to see if I could use attributes (vice child nodes) e.g.,:
Attachment 24590
However, I discovered that whenever I attempted to redefine the attribute values using the .Attributes property and index, the order of the attributes was altered in the XML e.g.,:
m_oCXNode.Attributes(1).Text = txtEditName
m_oCXNode.Attributes(2).Text = txtEditRank
m_oCXNode.Attributes(3).Text = txtEditSN
resulted in the following:
Attachment 24591
I've worked around this issue in the attached but would sure like to understand why that happens or get a suggestion on a better forum to publish this issue.
Paul, if I've committed some breach of cross posting protocol, please advise and I will attempt to correct.
Thanks