我有一个带有函数的 VBScript,它将返回 XML 作为输出。如何读取输出文件并从 xml 中获取标签 (emp_id) 中的值?
strResult = myfunction (Str1,Str2)
Set objXML = Server.CreateObject("Msxml2.DOMDocument")
objXML.LoadXml(strResult)
当我尝试加载 Xml 时,Server 和 objXml 为空。
strResult 包含一个带有许多标签的 xml。其中我只对一个标签(emp_id)感兴趣
在'strResult'中输出xml
<?xml version="1.0" encoding="UTF-8"?>
<NewDataSet>
<xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns="">
<xs:element name="NewDataSet" msdata:IsDataSet="true"><xs:complexType><xs:choice maxOccurs="unbounded">
<xs:element name="ReturningDataSet"><xs:complexType><xs:sequence><xs:element name="sno" type="xs:int" minOccurs="0"/>
<xs:element name="alternate_id" type="xs:string" minOccurs="0"/>
<xs:element name="cusip" type="xs:string" minOccurs="0"/>
<xs:element name="alternate_id_type_cd" type="xs:string" minOccurs="0"/>
<xs:element name="isin" type="xs:string" minOccurs="0"/>
<xs:element name="emp_id" type="xs:string" minOccurs="0"/>
<xs:element name="sedol" type="xs:string" minOccurs="0"/>
<xs:element name="issuer_id" type="xs:string" minOccurs="0"/>
<xs:element name="iv_type" type="xs:string" minOccurs="0"/>
<xs:element name="idType" type="xs:string" minOccurs="0"/>
<xs:element name="couponRate" type="xs:double" minOccurs="0"/>
<xs:element name="maturityDt" type="xs:dateTime" minOccurs="0"/>
<xs:element name="datedDt" type="xs:dateTime" minOccurs="0"/>
<xs:element name="branch" type="xs:string" minOccurs="0"/>
<xs:element name="securityName" type="xs:string" minOccurs="0"/>
<xs:element name="iso_currency" type="xs:string" minOccurs="0"/>
<xs:element name="dayCountPer" type="xs:string" minOccurs="0"/>
<xs:element name="dayCountYr" type="xs:string" minOccurs="0"/>
<xs:element name="marketExch" type="xs:string" minOccurs="0"/>
<xs:element name="inputPrcForm" type="xs:string" minOccurs="0"/>
<xs:element name="iso_country" type="xs:string" minOccurs="0"/>
<xs:element name="settlementConv" type="xs:string" minOccurs="0"/>
<xs:element name="settlementMeth" type="xs:string" minOccurs="0"/>
<xs:element name="firstCpnDt" type="xs:dateTime" minOccurs="0"/>
<xs:element name="securityMinDen" type="xs:double" minOccurs="0"/>
<xs:element name="securityMinInc" type="xs:double" minOccurs="0"/>
<xs:element name="country" type="xs:string" minOccurs="0"/>
<xs:element name="currency" type="xs:string" minOccurs="0"/>
<xs:element name="programId" type="xs:string" minOccurs="0"/>
<xs:element name="programName" type="xs:string" minOccurs="0"/>
<xs:element name="warningMessages" type="xs:string" minOccurs="0"/>
</xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType>
</xs:element></xs:schema><ReturningDataSet id="ReturningDataSet1" rowOrder="0">
<sno>1</sno>
<alternate_id>02R99BBM5 </alternate_id>
<cusip> </cusip>
<alternate_id_type_cd>FMRID </alternate_id_type_cd>
<isin> </isin>
****<emp_id>02R349BXC5</emp_id>****
<sedol> </sedol>
<issuer_id>02R99B</issuer_id>
<iv_type>YCD </iv_type>
<idType>FMRID </idType>
<couponRate>0.7</couponRate>
<maturityDt>2012-12-26T00:00:00.0000000</maturityDt>
<datedDt>2012-12-11T00:00:00.0000000</datedDt>
<branch>NYC </branch>
<securityName>ASB Y$CD .7% 12/26/12 </securityName>
<iso_currency>USD </iso_currency>
<dayCountPer>ACT</dayCountPer>
<dayCountYr>360</dayCountYr>
<marketExch>OT</marketExch>
<inputPrcForm>C </inputPrcForm>
<iso_country>NZ </iso_country>
<settlementConv>DT</settlementConv>
<settlementMeth>DTCF </settlementMeth>
<country>NEWZ</country>
<currency>USA</currency>
<programId> </programId>
<programName> </programName>
<warningMessages><?xml version="1.0" encoding="UTF-8"?><NewDataSet><xs:schema id="NewDataSet" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns=""><xs:element name="NewDataSet" msdata:IsDataSet="true"><xs:complexType><xs:choice maxOccurs="unbounded"><xs:element name="ReturningDataSet"><xs:complexType><xs:sequence><xs:element name="errorSev" type="xs:string" minOccurs="0"/><xs:element name="errorId" type="xs:string" minOccurs="0"/><xs:element name="errorText" type="xs:string" minOccurs="0"/></xs:sequence></xs:complexType></xs:element></xs:choice></xs:complexType></xs:element></xs:schema><ReturningDataSet id="ReturningDataSet1" rowOrder="0"><errorSev>20</errorSev><errorId>CDA1356</errorId><errorText>FDWarning1: Freq of interest Payment not available from prefered data source FREQ_RATE_CHANGE_CD. Data system defaulted. </errorText></ReturningDataSet></NewDataSet></warningMessages>
</ReturningDataSet>
</NewDataSet>