Quantcast
Channel: XML, System.Xml, MSXML and XmlLite forum
Viewing all articles
Browse latest Browse all 935

Extract Value from XML Document

$
0
0
Hello all I am having a rough time extracting a node value from an XML Document.  I feel like I am close, but cannot quite figure it out so I have resorted to the forums.  I am used to dealing with SQL Server Data so this is new to me.  Please find my code and XML data below.  Thanks in advance!

<?xml version="1.0" encoding="utf-8"?><RETS ReplyCode="0" ReplyText="Operation successful"><RETS-RESPONSE xmlns="CREA.Search.Property"><Pagination><TotalRecords>961</TotalRecords><Limit>10</Limit><Offset>1</Offset><TotalPages>97</TotalPages><RecordsReturned>10</RecordsReturned></Pagination><PropertyDetails ID="11937196" LastUpdated="Thu, 14 Jun 2012 16:39:57 GMT"><ListingID>DDF106RES001</ListingID><AgentDetails ID="1937465"><Name>Alex Drow</Name><Office ID="270564"><Name>Consumer Housing Inc.</Name><Address><City>Kentville</City></Address></Office><Position>Broker Owner</Position></AgentDetails><Board>106</Board><Business><Franchise>False</Franchise></Business><Building><BathroomTotal>2</BathroomTotal><BedroomsTotal>3</BedroomsTotal><CoolingType>Central air conditioning</CoolingType><DisplayAsYears>2</DisplayAsYears><FireplacePresent>False</FireplacePresent><HeatingFuel>Natural gas</HeatingFuel><HeatingType>Air circulation heat</HeatingType><SizeInterior>1685 sqft</SizeInterior><Type>House</Type></Building>
</PropertyDetails>
</RETS-RESPONSE></RESPONSE>



            Dim xnList As XmlNodeList = document.SelectNodes("RETS/RETS-RESPONSE/PropertyDetails")
            For Each xn As XmlNode In xnList
                Dim example As XmlNode = xn.SelectSingleNode("Building")
                If example IsNot Nothing Then
                    Dim na As String = example("BathroomTotal").InnerText
                    Dim no As String = example("BathroomTotal").InnerText
                End If
            Next

 

Viewing all articles
Browse latest Browse all 935

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>