|
我用QTP生成的XML的脚本程序再给元素设定属性的时候的顺序居然我不可控制,这一小部分代码如下
Set doc = XMLUtil.CreateXML()
doc.CreateDocument "InfoChannelNews"
Set root = doc.GetRootElement()
root.AddChildElementByName "row",""
Set children = root.ChildElements()
children.Item(1).AddAttribute "NewsID","20060803083945201"
children.Item(1).AddAttribute "NewsTime","20060803084254"
children.Item(1).AddAttribute "NewsTitle","This is News Title!"
children.Item(1).AddAttribute "bTitleNews","0"
children.Item(1).AddAttribute "NewsContent","This is News Content[Optional]"
children.Item(1).AddAttribute "NewsContent_HTML","[Optional]"
children.Item(1).AddAttribute "Columns","108,147,206"
children.Item(1).AddAttribute "Keywords","301,521,547"
children.Item(1).AddAttribute "MakerID","101"
children.Item(1).AddAttribute "CheckID","0"
doc.SaveFile "d:\InfoChannelNews.xml"
我想叫元素row属性的顺序按照NewsID,NewsTime, NewsTitle,bTitleNews, NewsContent,NewsContent_HTML,Columns,Keywords,MakerID,CheckID的顺序生成。
可是QTP把属性按照名称长短+字母顺序自动排列,它排的顺序如下NewsID,CheckID,Columns,MakerID,Keywords,NewsTime, NewsTitle,bTitleNews, NewsContent,NewsContent_HTML。
我曾经尝试寻找一个函数来设置排序,结果没有找到这个函数。我又尝试从设置QTP的角度来修改QTP的设置,可是也没有找到在哪设置,这个问题不知道有没有解决办法吗? |
|