无法使用vb脚本解析xml文件

时间:2017-04-13 11:26:30

标签: xml

我无法使用namesapce前缀

解析节点

我的xml是

<Root xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <Header>
        <MessageID>621c6744-1710-4e10-8a1d-33ae9dd125bc</MessageID>
        <MessageDate>2017-04-10</MessageDate>
        <PPMVersion>6.4.0.282</PPMVersion>
        <SchemaVersion>1.0</SchemaVersion>
    </Header>
    <Package ID="19ed0eff-ff90-4e3b-bb48-26293211fcbb" BusinessID="019324" Path="/Package/Product/Launch_Entity" xsi:type="B2B_Postpaid_Tariff_Plan">
        <Name>Shape Basic</Name>
        <Category_ID Product_Line_ID="12">12</Category_ID>
        <Effective_Start_Date>2016-11-03</Effective_Start_Date>
        <Available_Start_Date>2016-11-03</Available_Start_Date>
        <Element_Guid>19ed0eff-ff90-4e3b-bb48-26293211fcbb</Element_Guid>
        <Element_Type_Guid>bc9fef54-4f6c-4e59-bfaf-ed86c37f1b4c</Element_Type_Guid>
        <Business_ID>019324</Business_ID>
</Package>

我想使用vb脚本

读取xsi:type属性的值

1 个答案:

答案 0 :(得分:0)

Please use this below code.

Dim oXML
Set oXML = CreateObject("Microsoft.XMLDOM")

'Load the XML file
oXML.Load("pathOfYourFile")
'Loop through each nodes
For Each oChdNd In oXML.DocumentElement.ChildNodes
   WScript.Echo oChdNd.nodeName&":"&oChdNd.text&vbCrLf
Next