I have the following XML and I can't seem to select the appropriate nodelist. I am using:
nodelist = doc.SelectNodes("/TaskOfArrayOfCorporationn0S_PdIRS/Result")
But this is not returning the corporation node. XML is formatted as follows:
<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>
Try XPathSelectElement
nodelist = doc?.XPathSelectElement("/TaskOfArrayOfCorporationn0S_PdIRS/Result")
If nodelist Is Nothing Then
'path was not found.
End If
Nothing
will be returned if the path cannot be found.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.