gmaxey
07-14-2019, 07:41 AM
Cross posted at: https://www.msofficeforums.com/word-vba/42960-setting-text-value-xml-attribute-node-changes.html#post143240
(https://www.msofficeforums.com/word-vba/42960-setting-text-value-xml-attribute-node-changes.html#post143240)and
https://social.msdn.microsoft.com/Forums/en-US/f49b0efc-5e01-4567-9eb1-8ed3b97d97b5/redefining-attribute-node-text-value-using-the-attribute-property-and-index-results-in-reording-the?forum=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:
24589
Next, I thought it would be an interesting exercise to see if I could use attributes (vice child nodes) e.g.,:
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:
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
(https://www.msofficeforums.com/word-vba/42960-setting-text-value-xml-attribute-node-changes.html#post143240)and
https://social.msdn.microsoft.com/Forums/en-US/f49b0efc-5e01-4567-9eb1-8ed3b97d97b5/redefining-attribute-node-text-value-using-the-attribute-property-and-index-results-in-reording-the?forum=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:
24589
Next, I thought it would be an interesting exercise to see if I could use attributes (vice child nodes) e.g.,:
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:
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