簡體   English   中英

VB.NET XML節點

[英]VB.NET xml node

我有以下XML,但似乎無法選擇適當的節點列表。 我在用:

nodelist = doc.SelectNodes("/TaskOfArrayOfCorporationn0S_PdIRS/Result")

但這並不返回公司節點。 XML的格式如下:

<TaskOfArrayOfCorporationn0S_PdIRS xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/System.Threading.Tasks">
<Result xmlns:d2p1="Corporations">
    <d2p1:Corporation>
        <d2p1:AlternateAddress i:nil="true" /> 
        <d2p1:AlternateCity i:nil="true" />
        <d2p1:AlternateState i:nil="true" />
        <d2p1:AlternateZip i:nil="true" />
        <d2p1:BusinessName>GABRIEL’S COFFEE SHOP LLC</d2p1:BusinessName> 
        <d2p1:BusinessStatus>Active</d2p1:BusinessStatus> 
        <d2p1:Category>LLC</d2p1:Category>
        <d2p1:DateOfIncorporation>2018-05-18T00:00:00</d2p1:DateOfIncorporation>
        <d2p1:DissolutionDate i:nil="true" />
        <d2p1:Duration i:nil="true" />
        <d2p1:ExpirationDate>2019-05-31T00:00:00</d2p1:ExpirationDate> 
        <d2p1:ForeignBusinessName i:nil="true" />< 
        <d2p1:RegisteredAgentAddress>532 SILICA RD NW </d2p1:RegisteredAgentAddress> 
        <d2p1:RegisteredAgentCity>QUINCY</d2p1:RegisteredAgentCity> 
        <d2p1:RegisteredAgentName>VERONICA SOSA</d2p1:RegisteredAgentName> 
        <d2p1:RegisteredAgentState>WA</d2p1:RegisteredAgentState> 
        <d2p1:RegisteredAgentZip>98848 9466</d2p1:RegisteredAgentZip> 
        <d2p1:StateOfIncorporation>WASHINGTON</d2p1:StateOfIncorporation> 
        <d2p1:Type>LLC</d2p1:Type>
        <d2p1:TypeDescription>WA LIMITED LIABILITY COMPANY</d2p1:TypeDescription>
        <d2p1:Ubi>604288731</d2p1:Ubi>
    </d2p1:Corporation>
</Result>

試試XPathSelectElement

nodelist = doc?.XPathSelectElement("/TaskOfArrayOfCorporationn0S_PdIRS/Result")

If nodelist Is Nothing Then
   'path was not found.
End If

如果找不到路徑,則不會返回Nothing內容。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM