beautypg.com

Echelon i.LON 100 e2 Internet Server User Manual

Page 212

background image

i.

LON 100 Internet Server Programmer’s Reference

14-5

'the string to be retrieved and manipulated. Load the

'parameter into the XMLDocument object using the LoadXml method.

Dim myXML As New Xml.XmlDocument()

myXML.LoadXml(myXMLreturnString)

'Create a variable to reference the list of NVLs returned by the

'function. Each NVL child element in the string returned by the

'function will be considered a separate node within this list.

Dim myXmlNodeList As Xml.XmlNodeList

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

'Create a reference to a user-specified NVL from the list returned

'by DataServerList.

Dim myXmlNode As Xml.XmlNode

Const NV_INDEX As Integer = 0

myXmlNode = myXmlNodeList.Item(NV_INDEX)

'Insert the element around the node to match the

'format required within the parameter of the DataServerGet

'function. Call the DataServerGet function, using the created

'string as input. The function will return the configuration of

'the data point with index number NV_INDEX.

myXMLreturnString =

myWebReference.DataServerGet("" &_

myXmlNode.OuterXml & "")

'Store the parameter returned by DataServerGet in the

'XMLDocument object created earlier. Then, reference the NVL 'element

included in the return string in the myXmlNode variable.

myXML.LoadXml(myXMLreturnString)

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

myXmlNode = myXmlNodeList.Item(NV_INDEX)

'Insert updated text into the property of the

'string returned by DataServerGet. Then pass the string to

'DataServerSet. The of the data point will be

'updated in the Data Server when DataServerSet is called. The

' property is the third property within each

'element. As a result, the index value fed to the ChildNodes

'property must be 2, since the index values are 0-based.

Dim myNewLocation As String

myNewLocation = "\Building 1\Room 3\Ceiling "

Const UCPTlocation As Integer = 2

myXmlNode.ChildNodes(UCPTlocation).InnerText = myNewLocation

myXMLreturnString = myWebReference.DataServerSet(myXML.OuterXml)

'Verify that the index number returned by DataServerSet matches

'the index number supplied in the input to the function. If they

'match, the data point was updated successfully.