This is really annoying the bageebers out of me.
When running the reader is skiping every other element.
City and Zip5 are not being assigned values.
I've even added:
If reader.NodeType = XmlNodeType.Element ...
and
If reader.NodeType = XmlNodeType.Element And reader.NodeType <> XmlNodeType.EndElement ...
Any Ideas?
Thanks
When running the reader is skiping every other element.
City and Zip5 are not being assigned values.
I've even added:
If reader.NodeType = XmlNodeType.Element ...
and
If reader.NodeType = XmlNodeType.Element And reader.NodeType <> XmlNodeType.EndElement ...
Any Ideas?
Thanks
Code:
' Returned xml
<?xml version="1.0" ?>
- <AddressValidateResponse>
- <Address ID="1">
<Address2>8 WILDWOOD DR</Address2>
<City>OLD LYME</City>
<State>CT</State>
<Zip5>06371</Zip5>
<Zip4>1844</Zip4>
</Address>
</AddressValidateResponse>
Code:
Dim Address As String = Nothing
Dim City As String = Nothing
Dim state As String = Nothing
Dim zip5 As String = Nothing
Dim zip4 As String = Nothing
Dim reader As XmlTextReader = New XmlTextReader("asuperlongurl")
reader.WhitespaceHandling = WhitespaceHandling.None
While reader.Read
Select Case reader.Name
Case "Address2" : Address = reader.ReadElementString
Case "City" : City = reader.ReadElementString
Case "State" : state = reader.ReadElementString
Case "Zip5" : zip5 = reader.ReadElementString
Case "Zip4" : zip4 = reader.ReadElementString
End Select
End While