Monday 13 June 2011

Read XML File

'xmldoc.Load("C:\Siraj\" & "Response_Test.xml")

'Dim Response_data As String

Dim nsmRequest As New XmlNamespaceManager(xmldoc.NameTable)

nsmRequest.AddNamespace("soapenv", "http://schemas.xmlsoap.org/soap/envelope/")
nsmRequest.AddNamespace("oug", "http://webcomponent.components.oug.osgi.scorex.com/")

'XmlElement root = xmldoc.DocumentElement;
Dim nodes As XmlNodeList = xmldoc.DocumentElement.SelectNodes("//oug:MyWSResponse/items/item", nsmRequest)
' you cannot use prefix with NameSpaceMng
'XmlNodeList nodes = xmldoc.DocumentElement.SelectNodes("//myWSResponse/items");
For Each node As XmlNode In nodes
'Response.Write(node.InnerText)
If node.Name.ToUpper = "ITEM" And node.InnerText.ToUpper = "MY_RC" Then
'
If node.NextSibling.InnerText = "0" Then
SubmissionSuccess = True
End If
ElseIf node.Name.ToUpper = "ITEM" And node.InnerText.ToUpper = "RC_DESC" Then ' useful when WF_RC IS <> 0
RC_DESC = node.NextSibling.InnerText

ElseIf node.Name.ToUpper = "ITEM" And node.InnerText.ToUpper = "CODE" Then ' useful when WF_RC IS <> 0
' This could be a lookup table - ALL SYS???? Error codes
Return_Code = node.NextSibling.InnerText
If Return_Code <> "0" Then
SubmissionSuccess = False
Exit For ' If error during submission data tag will not be used
End If
ElseIf node.Name.ToUpper = "ITEM" And node.InnerText.ToUpper = "DATA" Then
Response_Data = node.NextSibling.InnerText
End If
Next



*******Select Single Node


thisNode = xmlResponseData.DocumentElement.SelectSingleNode("//OUTPUT/MY_NUM")
If Not thisNode Is Nothing Then
AppNum = thisNode.InnerText
End If

Reading XML Files with ASP.NET

This is full article from Faizal Khan.

Reading XML Files with ASP.NET


We can bind an XML file to a list/combo box control.



Read This

Populate with ListArray and Hashtable/



Read This

Sunday 12 June 2011

Display XmlDataSource. using XPath ASP.Net

The following code example demonstrates how to use an XmlDataSource control with a templated Repeater control to display XML data that has been filtered using an XPath expression.

MSDN Source



**************

Walkthrough: Creating a Web Page to Display XML Data



Displaying XML Data in a List Control

Walkthrough: Displaying and Tracking Advertisements with the AdRotator Control



Creating Advertisements