I have a small XML stream that I can't figure out how to read two of the first nodes (TotalCount and Offset). the XML file is structured like
<?xml version="1.0"?>
-<SearchResultOfApiProject xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<TotalCount>3986</TotalCount>
<Offset>0</Offset>
<Limit>50</Limit>
-<Items>
-<ApiProject>
<ProjectNumber>1R01DA034054-01A1</ProjectNumber>
<Fy>2013</Fy>
</ApiProject>
-<ApiProject>
<ProjectNumber>5T32DK083262-05</ProjectNumber>
<Fy>2013</Fy>
</ApiProject>
-<ApiProject>
<ProjectNumber>5K08CA142904-04</ProjectNumber>
<Fy>2013</Fy>
</ApiProject>
</Items>
</SearchResultOfApiProject>
I can read the full XML file using:
Dim doc As XmlDocument = New XmlDocument()
doc.LoadXml(xmlString)
Dim DocumentNodes As XmlNodeList = doc.GetElementsByTagName("ApiProject")
And then loop the nodes but I can't figure out how to read the TotalCount and Offset nodes in the root
我得到了TotalCount = doc.SelectSingleNode(“ SearchResultOfApiProject / TotalCount”)。InnerText
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.