我正在使用以下HTML代码,以便使用我的USPS Web工具帐户跟踪包
http://production.shippingapis.com/ShippingAPI.dll?API=TrackV2&XML=
1 xxx.xx.x.x xxx
响应如下
<TrackResponse>
<TrackInfo ID="XXXXXXXXXXXX">
<Class>First-Class Package Service</Class>
<ClassOfMailCode>FC</ClassOfMailCode>
<DestinationCity>ERLANGER</DestinationCity>
<DestinationState>KY</DestinationState>
<DestinationZip>41025</DestinationZip>
<EmailEnabled>false</EmailEnabled>
<KahalaIndicator>false</KahalaIndicator>
<MailTypeCode>DM</MailTypeCode>
<MPDATE>2017-01-08 11:28:09.000000</MPDATE>
<MPSUFFIX>748766316</MPSUFFIX>
<OriginCity>INDIANAPOLIS</OriginCity>
<OriginState>IN</OriginState>
<OriginZip>46227</OriginZip>
<PodEnabled>false</PodEnabled>
<PredictedDeliveryDate>January 12, 2017</PredictedDeliveryDate>
<RestoreEnabled>false</RestoreEnabled>
<RramEnabled>false</RramEnabled>
<RreEnabled>false</RreEnabled>
<Service>USPS Tracking<SUP>®</SUP></Service>
<ServiceTypeCode>001</ServiceTypeCode>
<Status>Delivered</Status>
<StatusCategory>Delivered</StatusCategory>
<StatusSummary>
Your item was delivered at 4:07 am on January 12, 2017 in ERLANGER, KY 41025.
</StatusSummary>
<TABLECODE>T</TABLECODE>
<TrackSummary>
<EventTime>4:07 am</EventTime>
<EventDate>January 12, 2017</EventDate>
<Event>Delivered</Event>
<EventCity>ERLANGER</EventCity>
<EventState>KY</EventState>
<EventZIPCode>41025</EventZIPCode>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>01</EventCode>
</TrackSummary>
<TrackDetail>
<EventTime>3:31 am</EventTime>
<EventDate>January 12, 2017</EventDate>
<Event>Departed USPS Facility</Event>
<EventCity>CINCINNATI</EventCity>
<EventState>OH</EventState>
<EventZIPCode>45234</EventZIPCode>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>10</EventCode>
</TrackDetail>
<TrackDetail>
<EventTime>3:28 am</EventTime>
<EventDate>January 12, 2017</EventDate>
<Event>Arrived at Post Office</Event>
<EventCity>CINCINNATI</EventCity>
<EventState>OH</EventState>
<EventZIPCode>45234</EventZIPCode>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>07</EventCode>
</TrackDetail>
<TrackDetail>
<EventTime>8:41 pm</EventTime>
<EventDate>January 11, 2017</EventDate>
<Event>Arrived at USPS Facility</Event>
<EventCity>CINCINNATI</EventCity>
<EventState>OH</EventState>
<EventZIPCode>45234</EventZIPCode>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>10</EventCode>
</TrackDetail>
<TrackDetail>
<EventTime>2:34 am</EventTime>
<EventDate>January 11, 2017</EventDate>
<Event>In Transit to Destination</Event>
<EventCity/>
<EventState/>
<EventZIPCode/>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>EX</EventCode>
</TrackDetail>
<TrackDetail>
<EventTime>2:34 am</EventTime>
<EventDate>January 10, 2017</EventDate>
<Event>Arrived at USPS Origin Facility</Event>
<EventCity>INDIANAPOLIS</EventCity>
<EventState>IN</EventState>
<EventZIPCode>46241</EventZIPCode>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>10</EventCode>
</TrackDetail>
<TrackDetail>
<EventTime>1:22 pm</EventTime>
<EventDate>January 9, 2017</EventDate>
<Event>Picked Up</Event>
<EventCity>INDIANAPOLIS</EventCity>
<EventState>IN</EventState>
<EventZIPCode>46227</EventZIPCode>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>03</EventCode>
</TrackDetail>
<TrackDetail>
<EventTime>4:43 pm</EventTime>
<EventDate>January 8, 2017</EventDate>
<Event>Shipping Label Created, USPS Awaiting Item</Event>
<EventCity>INDIANAPOLIS</EventCity>
<EventState>IN</EventState>
<EventZIPCode>46227</EventZIPCode>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>GX</EventCode>
<DeliveryAttributeCode>33</DeliveryAttributeCode>
</TrackDetail>
<TrackDetail>
<EventTime/>
<EventDate>January 8, 2017</EventDate>
<Event>Pre-Shipment Info Sent to USPS, USPS Awaiting Item</Event>
<EventCity/>
<EventState/>
<EventZIPCode/>
<EventCountry/>
<FirmName/>
<Name/>
<AuthorizedAgent>false</AuthorizedAgent>
<EventCode>MA</EventCode>
</TrackDetail>
</TrackInfo>
</TrackResponse>
如何检索HTML标记之间的某些信息并将其放入文本框?我找不到任何元素ID,所以我不能使用GetElementbyid 请帮忙 谢谢
答案 0 :(得分:0)
您可以使用XmlDocument,如下所示:
Dim currXml As New XmlDocument
currXml.Load(responseStream)
Dim idXml As XmlNodeList = currXml.GetElementsByTagName("TrackInfo ID")
Dim id As String = idXml(0).InnerText`