Using an xmldocument object, Writing to a data point, Using an xmldocument object -4 – Echelon i.LON 100 e2 Internet Server User Manual
Page 211: Writing to a data point -4, 1 writing to a data point, 2 using an xmldocument object
myXMLReturnString = myWebReference.DataServerRead(myXMLInputString)
14.2.2
Using an XMLDocument Object
Visual Basic .NET provides several features you may find useful when programming with
XML. One of these features is an object type called an XMLDocument. This section provides
two examples of how you might use an XMLDocument object to parse and manipulate the
XML data returned by the SOAP functions.
The following example uses an XMLDocument object to construct the parameter to
be passed to the SOAP functions. It also uses the List/Get/Set algorithm described in
Chapter 4 of this document to write to the configuration of a data point. This algorithm is
very useful when writing to the configuration of an item, as it does not require you to
manually create the XML string to be supplied to the Set function. Instead, you modify the
output from the Get function to serve as the input. For a general description of the
List/Get/Set algorithm, see List, Get, Set and Delete Functions on page 4-10.
This sample invokes the DataServerList to retrieve a list containing the index numbers of all
data points that have been added to the
i.
LON 100 Data Server. It then uses the
DataServerGet function to retrieve the configuration of the data point that has been assigned
index number 0.
You could use this algorithm to write to any number of properties for any number of
applications, without having to create an entire input string for the applicable Set function.
You could also use it to create new objects for applications, by modifying or removing the
index number returned by the Get function before passing it to Set.
Dim myWebReference As New iLON100_Reference.iLON100()
Dim myURL As String
14.2.2.1
Writing to a Data Point
The DataServerGet function returns an XML string containing the configuration of the
selected data point. This sample uses an XMLDocument object to store the configuration
returned by DataServerGet, and to modify the value of the
that string. It then passes the string to the DataServerSet function as input. Once
DataServerSet is invoked, the
the DataServer.
'Declare an instance of the
i.
LON 100 Web Service.
'Specify IP address of the
i.
LON 100 by replacing the default
'“localhost” with the IP address used by the
i.
LON 100.
myURL = myWebReference.Url()
myWebReference.Url = myURL.Replace("localhost", "10.5.250.59")
'Call DataServerList and store the
'the function in the String variable myXMLreturnString.
i.
LON 100 Internet Server Programmer’s Reference
myXMLreturnString = myWebReference.DataServerList("")
Dim myXMLreturnString As String
'Instantiate an XMLDocument object to parse the
'returned by the DataServerList function. This allows the data in
14-4