我必须在 xml 文档的标题中移动PrescriberOrderNumber
到上面。Sent time
在下面的代码中,当我可以创建节点时,它会将其扔到列表的底部。尝试使用InsertBefore
时,会引发 Runtime 5 错误。
XML:
<Message xmlns="http://www.ncpdp.org/schema/SCRIPT" version="010" release="006">
<Header>
<To Qualifier="D">6199568422001</To>
<From Qualifier="P">0001060</From>
<MessageID>992a39320ba04a53b1e44094389c063a</MessageID>
<SentTime>2013-07-03T14:24:47.005371Z</SentTime>
<PrescriberOrderNumber>ZSUR10009D</PrescriberOrderNumber>
</Header>
VBA 脚本:
Case "SentTime"
Dim objRoot As IXMLDOMNode
Dim objMemberElem As IXMLDOMNode
Set objRoot = oXMLDoc3.DocumentElement
'Create 1 Child Element
Set objMemberElem = oXMLDoc3.createElement("RelatesToMessageID")
objMemberElem.Text = n.Text
Set node = objRoot.SelectSingleNode("*/SentTime")
objRoot.ChildNodes.Item(0).appendChild objMemberElem
objRoot.InsertBefore objMemberElem, node
有任何想法吗?