skip to main content
TGO > Programmers documentation > Business objects and data sources > Network elements > Loading a network element defined in XML
 
Loading a network element defined in XML
For detailed information about data sources, see Data sources.
All you have to do to load a network element written in XML into a data source, is create a data source using the data source default implementation defined by IltDefaultDataSource and pass the XML file to the parse method of the data source, as follows:
 
dataSource = new IltDefaultDataSource();
dataSource.parse("NetworkElementXMLFile.xml");
How to define a network element in XML
Below is an example of a network element defined in XML format. For details about the XML elements used in this example, see Elements in an XML data file .
In this example, the object state associated with the first network element ( NE1 ) has a default value. The second object ( NE2 ) explicitly defines the primary states of its associated OSI state. For details about states, see States.
 
<cplData>
  <addObject id="NE1">
    <class>ilog.tgo.model.IltNetworkElement</class>
      <attribute name="name">NE1</attribute>
      <attribute name="type">NE</attribute>
      <attribute name="function">Transport</attribute>
      <attribute name="family">OC96</attribute>
      <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
        <x>10.0</x>
        <y>50.9</y>
      </attribute>
      <attribute name="objectState"
             JavaClass="ilog.tgo.model.IltOSIObjectState"/>
  </addObject>
  <addObject id="NE2">
    <class>ilog.tgo.model.IltNetworkElement</class>
      <attribute name="name">NE2</attribute>
      <attribute name="type">Terminal</attribute>
      <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
        <x>60.0</x>
        <y>50.9</y>
      </attribute>
      <attribute name="objectState"
             javaClass="ilog.tgo.model.IltOSIObjectState">
     <state>
      <administrative>Unlocked</administrative>
      <operational>Enabled</operational>
      <usage>Active</usage>
    </state>
    </attribute>
  </addObject>
</cplData>
The following figure shows the two network elements displayed in a network component:
Network elements displayed in a network component

Copyright © 2018, Rogue Wave Software, Inc. All Rights Reserved.