skip to main content
TGO > Programmers documentation > Business objects and data sources > Subnetworks > Loading a subnetwork defined in XML
 
Loading a subnetwork defined in XML
All you have to do 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 shown below:
 
dataSource = new IltDefaultDataSource();
dataSource.parse("SubnetworkXMLFile.xml");
For detailed information about data sources, see Data sources.
How to define a subnetwork in an XML file
The following is an example of a subnetwork defined in XML format. For details about the XML elements used in this example, see Elements in an XML data file .
The example creates a network element with identifier SubNetwork1. This network element is automatically interpreted by the network component as a subnetwork when you add the containment relationship using the XML tag <parent>.
The example creates a network element as a subnetwork that contains two children objects connected by a link.
*Add the subnetwork
 
<addObject id="SubNetwork1">
  <class>ilog.tgo.model.IltNetworkElement</class>
  <attribute name="name">SubNetwork</attribute>
  <attribute name="type">NMW</attribute>
</addObject>Add the subnetworks.
*Add the child objects
 
<addObject id="SubNode1">
  <class>ilog.tgo.model.IltNetworkElement</class>
  <parent>SubNetwork1</parent>
  <attribute name="name">BSC1</attribute>
  <attribute name="type">BSC</attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
    <x>580</x> <y>80</y>
  </attribute>
  <attribute name="objectState"
javaClass="ilog.tgo.model.IltAlarmObjectState">
    <alarms>
      <new severity="Warning">2</new>
    </alarms>
  </attribute>
</addObject>
 
<addObject id="SubNode2">
  <class>ilog.tgo.model.IltNetworkElement</class>
  <parent>SubNetwork1</parent>
  <attribute name="name">BTS2</attribute>
  <attribute name="type">BTS_Image</attribute>
  <attribute name="position" javaClass="ilog.cpl.graphic.IlpPoint">
    <x>620</x> <y>180</y>
  </attribute>
  <attribute name="objectState"
javaClass="ilog.tgo.model.IltOSIObjectState">
    <state>
      <administrative>ShuttingDown</administrative>
      <operational>Enabled</operational>
      <usage>Active</usage>
    </state>
    <alarms>
      <new severity="Warning">4</new>
    </alarms>
    <procedural>Reporting</procedural>
    <repair>UnderRepair</repair>
    <performance state="Output">150</performance>
  </attribute>
</addObject>
*Create a link connecting the two child objects
 
<addObject id="SubNode1-SubNode2">
  <class>ilog.tgo.model.IltLink</class>
  <parent>SubNetwork1</parent>
  <link> <from>SubNode1</from> <to>SubNode2</to> </link>
  <attribute name="name">InternalLink</attribute>
  <attribute name="media">null</attribute>
  <attribute name="objectState"
javaClass="ilog.tgo.model.IltBiSONETObjectState">
    <state>ActiveProtecting</state>
  </attribute>
</addObject>

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