Javascript library: xmlobjectloaderlib.js – Rockwell Automation 1768-EWEB EtherNet/IP Web Server Module User Manual User Manual

Page 100

Advertising
background image

Publication ENET-UM527E-EN-P - October 2006

100 Create Custom Web Pages

Javascript Library: XMLObjectLoaderLib.js

This library uses the conversion.js library. To include these libraries in
your custom web page, include these lines.

<script type="text/javascript"

src="/scripts/conversion.js">

</script>

<script type="text/javascript"

src="/scripts/XMLObjectLoaderLib.js">

</script>

The XMLObjectLoaderLib library requires an input file in XML format
which describes the CIP object being returned from a
GET_ATTRIBUTE_ALL service. The following example shows the
format of this input file:

<object name="IdentityInstance">

<attribute index="1" name="VendorID" type="UINT"/>

<attribute index="2" name="DeviceType" type="UINT"/>

<attribute index="3" name="ProductCode" type="UINT"/>

<object index="4" name="Revision">

<attribute index="1" name="MajorRevision"

type="USINT"/>

<attribute index="2" name="MinorRevision"

type="USINT"/>

</object>

<attribute index="5" name="Status" type="WORD"/>

<attribute index="6" name="SerialNumber" type="DWORD"/>

<attribute index="7" name="ProductName" type="STRING"/>

</object>

This description format is recursive - structures within the object can
be described by declaring an “object” element, then describing the
members of the structure under consideration. The names of the
elements are used to construct the Javascript object, and the members
of the Javascript object have names that match the “name” attributes in
the description file. The “index” attributes describe the order in
which these elements occur in the object; each attribute and object
except the root object must contain an index attribute.

decToBin(decimalnumber)

The decToBin function takes an unsigned decimal number as a parameter and returns
a string representing decimalnumber in binary notation. The return value does not have a
prefix and breaks the resulting binary string into groups of four characters.

Function

Description

Advertising
This manual is related to the following products: