2017-04-13 112 views
0

我無法解析與namesapce前綴節點來解析XML文件無法使用VB腳本

我的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> 

我想讀XSI的值:type屬性使用VB腳本

回答

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