beautypg.com

Reading data logs, Reading data logs -6, 2 reading data logs – Echelon i.LON 100 e2 Internet Server User Manual

Page 213

background image

myXmlNodeList = myXML.SelectNodes("/iLONDataServer/NVL")

myXmlNode = myXmlNodeList.Item(NV_INDEX)

Const UCPTindex As Integer = 0

If myXmlNode.ChildNodes(UCPTindex).InnerText <> NV_INDEX _

Then MsgBox("FAILED")

End If

14.2.2.2

Reading Data Logs

The following programming sample invokes the DataLoggerRead function, using a static

XML string as input. It then parses the string returned by DataLoggerRead using an

XMLDocument object, and writes the information it extracts to a database using SQL. This
code includes comments explaining each step of this process.

'Create an instance of the

i.

LON100's WSDL file.

Dim ilon As New WebReference1.iLON100()

'Specify the IP location of the

i.

LON 100 by replacing the default

'“localhost” with the IP address used by the

i.

LON 100.

s = ilon.Url

ilon.Url = s.Replace("localhost", "10.5.250.59")

Dim ret As String

Dim data As String

'Create the XML string to be passed to DataLoggerRead. This program

'will read log entries from the Data Logger using index number 0.

data="0"

'Call DataLoggerRead and send the SOAP message.

ret = ilon.DataLoggerRead(data)

'Prepare to parse the XML string returned by the function. Create an

'XML document object to store the return string, and an Xpath navigator

'object to navigate through the string and return the properties you

'want.

Dim xmlDoc As New System.Xml.XmlDocument()

Dim xmlNav As System.Xml.XPath.XPathNavigator

'Parse the XML string returned by DataLoggerRead.

xmlDoc.LoadXml(ret)

xmlNav = xmlDoc.CreateNavigator()

'Create iterators to store the values you want to extract from the

'return string.

Dim dataValues As System.Xml.XPath.XPathNodeIterator

Dim timestamps As System.Xml.XPath.XPathNodeIterator

Dim pointNames As System.Xml.XPath.XPathNodeIterator

Dim locations As System.Xml.XPath.XPathNodeIterator

Dim source As System.Xml.XPath.XPathNodeIterator

Dim units As System.Xml.XPath.XPathNodeIterator

myXML.LoadXml(myXMLreturnString)

i.

LON 100 Internet Server Program

14-6

mer’s Reference