Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

responsXml namespace problem (Nullreferenceexception)

Status
Not open for further replies.

ozane

Technical User
Feb 3, 2005
57
TR
hi
i am sending request to server and receiving xml response from server. part of xml is as follows:

Code:
 <?xml version="1.0" encoding="UTF-8" ?> 
- <csw:Capabilities version="2.0.0" xmlns:csw="[URL unfurl="true"]http://www.opengis.net/cat/csw"[/URL] xmlns:dc="[URL unfurl="true"]http://purl.org/dc/elements/1.1/"[/URL] xmlns:xs="[URL unfurl="true"]http://www.w3.org/2001/XMLSchema"[/URL] xmlns:ogc="[URL unfurl="true"]http://www.opengis.net/ogc"[/URL] xmlns:req="[URL unfurl="true"]http://www.esri.com/metadata/http-request/"[/URL] xmlns:ows="[URL unfurl="true"]http://www.opengis.net/ows">[/URL]
- <ows:ServiceIdentification>
  <ows:ServiceType>CSW</ows:ServiceType> 
  <ows:ServiceTypeVersion>2.0.0</ows:ServiceTypeVersion> 
....

i want to populate the textboxes on my aspx page with the values from xml. for example i wantto extract the value of "ServiceType" element. but i am having exception when i want to get the values, i guess because of the namespace like csw and ows. how can i get the values? can i neglect the namespaces when i get the xml from server. sometimes other servers responsing xml with different namespace but the same structure... here is my part of my asp code.

Code:
 If xmlhttp.status = 200 Then
            Dim sonuc = xmlhttp.responseXML.xml

            Dim read As New System.Xml.XmlDataDocument
            read.LoadXml(sonuc)
            Dim node As System.Xml.XmlNode
            node = read.SelectSingleNode("Capabilities")
            TextBox1.Text = node.SelectSingleNode("ows:ServiceIdentification/ows:ServiceType").InnerText
            TextBox2.Text = node.SelectSingleNode("ows:ServiceTypeVersion").InnerText
        Else
....

any idea
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top