【发布时间】:2018-11-26 06:51:12
【问题描述】:
我有一个供 VB.NET 读取的 XML 文件。我的代码特定于文件。
如何读取与<Key> LNGYIL 关联的<Value> 的值?
我的代码:
Dim doc As XDocument
doc = XDocument.Load("c:\jpan\faturalar.xml")
Dim lngyil= (
From v In doc.<soap>.<soap>.<IntegrationGetEntitySetWithPacketLoginResponse>.<IntegrationGetEntitySetWithPacketLoginResult>.<ResultEntitySet>.<CustomData>.<ArrayOfClsDictionaryOfStringObject>.<clsDictionaryOfStringObject>
Where v.<Key>.Value = "LNGYIL"
Select v.<Value>.Value
).Single()
ListBox1.Items.Insert(0, lngyil)
XML 来源:
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><IntegrationGetEntitySetWithPacketLoginResponse xmlns="http://integration.univera.com.tr"><IntegrationGetEntitySetWithPacketLoginResult><ResultString>OK</ResultString><IsSuccess>true</IsSuccess><ResultEntitySet><GorevSonucBilgiler/><DistUnvan/><PaketAdi/><Warnings/><PaketTanimlar><clsPaketTanim><Kod xsi:nil="true"/><Tabloadi>CUSTOMVIEW_ENTVIEWFATURAGENERIC_OZGUN</Tabloadi><Viewadi>CUSTOMVIEW_ENTVIEWFATURAGENERIC_OZGUN</Viewadi><Yon xsi:nil="true"/><Kriter>"(LNGDISTKOD = 12) AND BYTTUR IN(0,1) AND (LNGYIL = 2018) AND (BYTDURUM = 0)"</Kriter><Durum xsi:nil="true"/></clsPaketTanim></PaketTanimlar><SatirBazliTransaction>false</SatirBazliTransaction><LogKategori>0</LogKategori><IntegrationGorevSonucTip>0</IntegrationGorevSonucTip><errorLoglist/><SCCall>false</SCCall><ReturnLoglist>false</ReturnLoglist><StokSil>false</StokSil><CustomData><ArrayOfClsDictionaryOfStringObject><clsDictionaryOfStringObject><Key>LNGYIL</Key><Value xsi:type="xsd:int">2018</Value></clsDictionaryOfStringObject><clsDictionaryOfStringObject><Key>LNGDISTKOD</Key><Value xsi:type="xsd:int">12</Value></clsDictionaryOfStringObject><clsDictionaryOfStringObject><Key>TXTDISTKOD</Key><Value xsi:type="xsd:string">SH012</Value></clsDictionaryOfStringObject><clsDictionaryOfStringObject><Key>TXTSTKOD</Key><Value xsi:type="xsd:string">SH010</Value></clsDictionaryOfStringObject></ArrayOfClsDictionaryOfStringObject></CustomData></ResultEntitySet></IntegrationGetEntitySetWithPacketLoginResult></IntegrationGetEntitySetWithPacketLoginResponse></soap:Body></soap:Envelope>
目前我什么也得不到。
【问题讨论】:
-
谢谢,但节点标签中没有标准数据。