Hen
Hen

Reputation: 253

how to create a GUI using data from xml file?

what i want is to create a dynamic GUI that consists of a set of buttons ( in my case each button represents an element from the xml file ) and when i click a button there will be a creation of buttons which represents its childs..i dnt know if it is possible to do that using DOM or JAXB..i'll be so thankful if anyone can help me or has another idea to do that! thanks!!

  <?xml version="1.0" encoding="UTF-8" ?> 

- <HWData xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="hw_data.xsd">

  <Header time="2015-02-03T02:02:56" uploaded="false" version="1.0" /> 

- <NE MOID="NE-SGSN-387826" objectClass="NE" objectClassVersion="1" NEId="387826" NEType="SGSN" systemTitle="SGSN-MNB-" locationName="MANOUBA" systemReleaseVersion="J8" softwareReleaseVersion="J8 50.70-0 50" serialNumber="387826" vendorName="Nokia">

- <EQHO MOID="NE-SGSN-387826/DN:EQHO-1A" objectClass="EQHO" objectClassVersion="1" equipmentHolderId="11" equipmentHolderType="Cabinet" equipmentHolderSpecificType="EC217_A" locationName="1A" serialNumber="" interchangeability="" version="" identificationCode="" vendorName="Nokia">

- <EQHO MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-1-0" objectClass="EQHO" objectClassVersion="1" equipmentHolderId="11100" equipmentHolderType="Cartridge" equipmentHolderSpecificType="ACH16_A" locationName="1A001-00" serialNumber="XY131403380" interchangeability="" version="" identificationCode="" vendorName="Nokia">

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-1-0/UNIT-1-PIU-1" objectClass="UNIT" objectClassVersion="1" unitId="1" unitTypeActual="ACPI4_A" unitTypeExpected="ACPI4_A" position="1" operationalState="enabled" serialNumber="FK124600007" interchangeability="B" version="3C" identificationCode="C111969" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-1-0/UNIT-1-RTM-1" objectClass="UNIT" objectClassVersion="1" unitId="1" unitTypeActual="CPRT4_A" unitTypeExpected="CPRT4_A" position="1" operationalState="enabled" serialNumber="JG130400410" interchangeability="A" version="2A" identificationCode="C111970" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-1-0/UNIT-FAN-2" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400960" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-1-0/UNIT-FAN-1" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400980" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  </EQHO>

  <EQHO MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-1-0" objectClass="EQHO" objectClassVersion="1" equipmentHolderId="111000501" equipmentHolderType="Cartridge" equipmentHolderSpecificType="CHAF2_A" locationName="1A001-00-FFI-1" serialNumber="31401904" interchangeability="A" version="" identificationCode="C110639" vendorName="Nokia" /> 

- <EQHO MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-2-0" objectClass="EQHO" objectClassVersion="1" equipmentHolderId="11200" equipmentHolderType="Cartridge" equipmentHolderSpecificType="ACH16_A" locationName="1A002-00" serialNumber="XY131403370" interchangeability="" version="" identificationCode="" vendorName="Nokia">

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-2-0/UNIT-1-PIU-1" objectClass="UNIT" objectClassVersion="1" unitId="1" unitTypeActual="ACPI4_A" unitTypeExpected="ACPI4_A" position="1" operationalState="enabled" serialNumber="FK124600059" interchangeability="B" version="3C" identificationCode="C111969" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-2-0/UNIT-SHM-2" objectClass="UNIT" objectClassVersion="1" unitId="3" unitTypeActual="ASMGR_A" unitTypeExpected="ASMGR_A" position="3" operationalState="enabled" serialNumber="XY131402619" interchangeability="A" version="4B" identificationCode="C110581" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-2-0/UNIT-FAN-3" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400977" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-2-0/UNIT-FAN-1" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400971" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-2-0/UNIT-FAN-2" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400975" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  </EQHO>

  <EQHO MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-2-0" objectClass="EQHO" objectClassVersion="1" equipmentHolderId="112000502" equipmentHolderType="Cartridge" equipmentHolderSpecificType="CHAF2_A" locationName="1A002-00-FFI-2" serialNumber="31401893" interchangeability="A" version="" identificationCode="C110639" vendorName="Nokia" /> 

- <EQHO MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-3-0" objectClass="EQHO" objectClassVersion="1" equipmentHolderId="11300" equipmentHolderType="Cartridge" equipmentHolderSpecificType="ACH16_A" locationName="1A003-00" serialNumber="XY131403377" interchangeability="" version="" identificationCode="" vendorName="Nokia">

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-3-0/UNIT-SHM-1" objectClass="UNIT" objectClassVersion="1" unitId="3" unitTypeActual="ASMGR_A" unitTypeExpected="ASMGR_A" position="3" operationalState="enabled" serialNumber="XY131301773" interchangeability="A" version="4B" identificationCode="C110581" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-3-0/UNIT-FAN-1" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400963" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-3-0/UNIT-FAN-2" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400962" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  <UNIT MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-3-0/UNIT-FAN-3" objectClass="UNIT" objectClassVersion="1" unitId="4" unitTypeActual="AFAMO_A" unitTypeExpected="AFAMO_A" position="4" operationalState="enabled" serialNumber="XY131400988" interchangeability="B" version="3B" identificationCode="C110638" vendorName="Nokia" /> 

  </EQHO>

  <EQHO MOID="NE-SGSN-387826/DN:EQHO-1A/EQHO-3-0" objectClass="EQHO" objectClassVersion="1" equipmentHolderId="113000503" equipmentHolderType="Cartridge" equipmentHolderSpecificType="CHAF2_A" locationName="1A003-00-FFI-3" serialNumber="31401903" interchangeability="A" version="" identificationCode="C110639" vendorName="Nokia" /> 

  </EQHO>

  </NE>

  </HWData>

Upvotes: 2

Views: 1665

Answers (2)

Adriaan Koster
Adriaan Koster

Reputation: 16209

Removed previous answer based on XStream in favor of JAXB.

Add the jaxb2-maven-plugin to your pom.xml:

        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxb2-maven-plugin</artifactId>
            <executions>
                <execution>
                    <goals>
                        <goal>xjc</goal>
                    </goals>
                </execution>
            </executions>
            <configuration>
                <schemaDirectory>src/main/resources/xsd/</schemaDirectory>
            </configuration>
        </plugin>

Put your XSD in src/main/resources/xsd/

The class HwDataTree extends DynamicTreeDemo which is part of an Oracle tutorial. Download both classes and add them to your project.

import generated.EQHO;
import generated.HWData;
import generated.NE;
import generated.UNIT;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import java.io.File;
import java.util.List;

public class HwDataTree extends DynamicTreeDemo {

    // the path of your XML file
    private static final String PATH = "C:/example.xml";

    @Override
    public void populateTree(DynamicTree treePanel) {
        HWData hwData = initData();
        treePanel.addObject(null, formatHeader(hwData));
        treePanel.addObject(null, formatNE(hwData));
        addNodesRecursive(hwData.getNE(), null, treePanel);
    }

    private HWData initData() {
        try {
            File xml = new File(PATH);
            JAXBContext jaxbContext = JAXBContext.newInstance(HWData.class);
            Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller();
            return (HWData) jaxbUnmarshaller.unmarshal(xml);
        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    }

    private void addNodesRecursive(NE parent, DefaultMutableTreeNode parentNode, DynamicTree treePanel) {
        List<EQHO> children = parent.getEQHO();
        for (EQHO child : children) {
            DefaultMutableTreeNode childNode = treePanel.addObject(parentNode, formatEQHO(child));
            addNodesRecursive(child, childNode, treePanel);
        }
    }

    private void addNodesRecursive(EQHO parent, DefaultMutableTreeNode parentNode, DynamicTree treePanel) {
        List<Object> children = parent.getEQHOAndUNIT();
        for (Object child : children) {
            DefaultMutableTreeNode childNode = treePanel.addObject(parentNode, getMOID(child));
            if (child instanceof EQHO) {
                EQHO eqho = (EQHO) child;
                addNodesRecursive(eqho, childNode, treePanel);
            }
        }
    }

    private String getMOID(Object child) {
        String moid;
        if (child instanceof EQHO) {
            EQHO eqho = (EQHO) child;
            moid = formatEQHO(eqho);
        } else if (child instanceof UNIT) {
            UNIT unit = (UNIT) child;
            moid = formatUnit(unit);
        } else {
            throw new RuntimeException("Could not parse type of: " + child);
        }
        return moid;
    }

    private String formatHeader(HWData hwData) {
        return String.format("Header time=%s", hwData.getHeader().getTime());
    }

    private String formatNE(HWData hwData) {
        return String.format("NE MOID=%s", hwData.getNE().getMOID());
    }

    private String formatEQHO(EQHO child) {
        return String.format("EQHO MOID=%s", child.getMOID());
    }

    private String formatUnit(UNIT unit) {
        return String.format("UNIT MOID=%s", unit.getMOID());
    }

    public static void main(String[] args) {
        javax.swing.SwingUtilities.invokeLater(new Runnable() {
            public void run() {
                createAndShowGUI();
            }
        });
    }

    private static void createAndShowGUI() {
        JFrame frame = new JFrame("Tree");
        frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
        HwDataTree newContentPane = new HwDataTree();
        newContentPane.setOpaque(true);
        frame.setContentPane(newContentPane);
        frame.pack();
        frame.setVisible(true);
    }
}

Generate the wrappers by executing mvn clean compile.

Then run HwDataTree, the result looks like this:

enter image description here

Upvotes: 2

Hen
Hen

Reputation: 253

this is my xsd

<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XMLSPY v5 rel. 4 U (http://www.xmlspy.com) by XMLSPY 5     Professional Ed. Release 4, Installed Multi + SMP for 2 users (Nokia GmbH) -->
<xsd:schema xmlns:xsd="http://www.w3.org/2001/XMLSchema" version="1.20">
<!--    Version history:
1.20: - changed "xsd" namespace according to W3C official recommendation
      - removed Telcordia specific pattern from EquipmentHolderSpecificTypes
      - added AvailabilityStatusEntry value "inCharge"
      - made "time" attribute in <Header/> mandatory
      - added serviceState attribute to PRUT
      - made PRUT attributes optional
      - added mnemonic attribute to EQHO
      - allow empty strings for attributes "position", "manufacturingDate", "dateOfLastService"
      - SoftwareReleaseVersionType: 20 -> 30

1.12: vendorName: mandatory, non-empty
1.11: PositionType: string -> integer 
      EquipmentHolderSpecificTypes: pattern refined according to Telcordia Network Engineer Java extensions
      Additional attributes in <Header/>
      time: timeInstant -> dateTime

1.10: Length of FunctionalUnitTypes: 4 -> 10
      Length of SoftwareReleaseVersionType: 10->20
      Length of VersionType: 5->30
-->
<xsd:simpleType name="AdministrativeState">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="locked"/>
        <xsd:enumeration value="unlocked"/>
        <xsd:enumeration value="shuttingDown"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ConnectorTypes">
    <xsd:restriction base="xsd:string"/>
</xsd:simpleType>

<xsd:simpleType name="DateOrEmptyType">
    <xsd:union memberTypes="xsd:date EmptyStringType"/>
</xsd:simpleType>

<!-- whitespaces are allowed -->
<xsd:simpleType name="EmptyStringType">
    <xsd:restriction base="xsd:string">
        <xsd:pattern value="\s*"/>
    </xsd:restriction> 
</xsd:simpleType>

<xsd:simpleType name="EquipmentHolderTypes">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
        <xsd:enumeration value="Cabinet"/>
        <xsd:enumeration value="Rack"/>
        <xsd:enumeration value="Subrack"/>
        <xsd:enumeration value="Cartridge"/>
        <xsd:enumeration value="Slot"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="EquipmentHolderSpecificTypes">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="FunctionalUnitIdType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="FunctionalUnitTypes">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="10"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="HWCheckSumType">
    <xsd:restriction base="xsd:integer"/>
</xsd:simpleType>
<xsd:simpleType name="IdentificationCodeType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="30"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="InterchangeabilityType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="LocationNameType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="30"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="MOID">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="256"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="MnemonicType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="10"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="NEAddressType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="256"/>
        <xsd:pattern value="[-_.0-9a-zA-Z]+=.*"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="NamingAttributeIdType">
    <xsd:restriction base="xsd:integer">
        <xsd:maxInclusive value="999999999"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="NameFromPlanningSystemType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="NETypes">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="NumberOfSlotsOccupiedType">
    <xsd:restriction base="xsd:integer">
        <xsd:minInclusive value="1"/>
        <xsd:maxInclusive value="99"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ObjectClassType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="5"/>
        <xsd:pattern value="[A-Z]*"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ObjectClassVersionType">
    <xsd:restriction base="xsd:integer">
        <xsd:maxInclusive value="100"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="OperationalState">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="disabled"/>
        <xsd:enumeration value="enabled"/>
    </xsd:restriction>
</xsd:simpleType>

<xsd:simpleType name="PositionType">
    <xsd:union memberTypes="xsd:integer EmptyStringType"/>
</xsd:simpleType>

<xsd:simpleType name="PowerSupplyTypes">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ProtectionGroupTypes">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="plus"/>
        <xsd:enumeration value="colon"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="SerialNumberType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="35"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="ServiceStateType">
    <xsd:restriction base="xsd:string">
        <xsd:enumeration value="active"/>
        <xsd:enumeration value="standby"/>
        <xsd:enumeration value="undefined"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="SoftwareReleaseVersionType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="30"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="SystemReleaseVersionType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="256"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="SystemTitleType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="256"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="UnitTypes">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="UserLabelType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="128"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="VendorNameType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="20"/>
        <xsd:minLength value="1"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:simpleType name="VersionType">
    <xsd:restriction base="xsd:string">
        <xsd:maxLength value="30"/>
    </xsd:restriction>
</xsd:simpleType>
<xsd:complexType name="AvailabilityStatus">
    <xsd:sequence>
        <xsd:element name="AvailabilityStatusEntry" minOccurs="0" maxOccurs="unbounded">
            <xsd:simpleType>
                <xsd:restriction base="xsd:string">
                    <xsd:enumeration value="inCharge"/>
                    <xsd:enumeration value="inTest"/>
                    <xsd:enumeration value="failed"/>
                    <xsd:enumeration value="powerOff"/>
                    <xsd:enumeration value="offLine"/>
                    <xsd:enumeration value="offDuty"/>
                    <xsd:enumeration value="dependency"/>
                    <xsd:enumeration value="degraded"/>
                    <xsd:enumeration value="notInstalled"/>
                    <xsd:enumeration value="logFull"/>
                </xsd:restriction>
            </xsd:simpleType>
        </xsd:element>
    </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="GlobalConnectorId">
    <xsd:attribute name="connectorHolderMOID" type="MOID"/>
    <xsd:attribute name="connectorIdentifier" type="xsd:string"/>
</xsd:complexType>
<xsd:complexType name="MOIDList">
    <xsd:sequence>
        <xsd:element name="MOID" type="MOID" maxOccurs="unbounded"/>
    </xsd:sequence>
</xsd:complexType>
<xsd:complexType name="PhysicalConnectorList">
    <xsd:sequence>
        <xsd:element name="Connector" minOccurs="0" maxOccurs="unbounded">
            <xsd:complexType>
                <xsd:sequence minOccurs="0">
                    <xsd:element name="connectedToIdentifier" type="GlobalConnectorId"/>
                </xsd:sequence>
                <xsd:attribute name="connectorType" type="ConnectorTypes"/>
                <xsd:attribute name="connectorIdentifier" type="xsd:string"/>
                <xsd:attribute name="location" type="xsd:string"/>
            </xsd:complexType>
        </xsd:element>
    </xsd:sequence>
</xsd:complexType>
<xsd:attributeGroup name="MOGeneralAttributes">
    <xsd:attribute name="MOID" type="MOID" use="required"/>
    <xsd:attribute name="objectClass" type="ObjectClassType"/>
    <xsd:attribute name="objectClassVersion" type="ObjectClassVersionType"/>
</xsd:attributeGroup>
<xsd:attributeGroup name="MOStateAttributes">
    <xsd:attribute name="administrativeState" type="AdministrativeState"/>
    <xsd:attribute name="operationalState" type="OperationalState"/>
</xsd:attributeGroup>
<xsd:element name="availabilityStatus" type="AvailabilityStatus"/>
<xsd:element name="physicalConnectorList" type="PhysicalConnectorList"/>
<xsd:element name="UNIT">
    <xsd:complexType>
        <xsd:sequence minOccurs="0" maxOccurs="2">
            <xsd:element ref="availabilityStatus" minOccurs="0"/>
            <xsd:element ref="physicalConnectorList" minOccurs="0"/>
        </xsd:sequence>
        <xsd:attributeGroup ref="MOGeneralAttributes"/>
        <xsd:attributeGroup ref="MOStateAttributes"/>
        <xsd:attribute name="unitId" type="NamingAttributeIdType"/>
        <xsd:attribute name="unitTypeActual" type="UnitTypes" use="required"/>
        <xsd:attribute name="unitTypeExpected" type="UnitTypes"/>
        <xsd:attribute name="position" type="PositionType"/>
        <xsd:attribute name="numberOfSlotsOccupied" type="NumberOfSlotsOccupiedType"/>
        <xsd:attribute name="userLabel" type="UserLabelType"/>
        <xsd:attribute name="softwareReleaseVersion" type="SoftwareReleaseVersionType"/>
        <xsd:attribute name="vendorName" type="VendorNameType" use="required"/>
        <xsd:attribute name="version" type="VersionType"/>
        <xsd:attribute name="serialNumber" type="SerialNumberType"/>
        <xsd:attribute name="manufacturingDate" type="DateOrEmptyType"/>
        <xsd:attribute name="dateOfLastService" type="DateOrEmptyType"/>
        <xsd:attribute name="interchangeability" type="InterchangeabilityType"/>
        <xsd:attribute name="identificationCode" type="IdentificationCodeType"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="PRUT">
    <xsd:complexType>
        <xsd:attributeGroup ref="MOGeneralAttributes"/>
        <xsd:attribute name="unitPointer" type="MOID"/>
        <xsd:attribute name="protectionUnitId" type="NamingAttributeIdType"/>
        <xsd:attribute name="protecting" type="xsd:boolean"/>
        <xsd:attribute name="priority" type="xsd:integer"/>
        <xsd:attribute name="serviceState" type="ServiceStateType"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="EQHO">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="physicalConnectorList" type="PhysicalConnectorList" minOccurs="0"/>
            <xsd:sequence minOccurs="0" maxOccurs="unbounded">
                <xsd:element ref="EQHO" minOccurs="0"/>
                <xsd:element ref="UNIT" minOccurs="0"/>
            </xsd:sequence>
        </xsd:sequence>
        <xsd:attributeGroup ref="MOGeneralAttributes"/>
        <xsd:attributeGroup ref="MOStateAttributes"/>
        <xsd:attribute name="equipmentHolderId" type="NamingAttributeIdType"/>
        <xsd:attribute name="equipmentHolderSpecificType" type="EquipmentHolderSpecificTypes" use="required"/>
        <xsd:attribute name="equipmentHolderType" type="EquipmentHolderTypes" use="required"/>
        <xsd:attribute name="userLabel" type="UserLabelType"/>
        <xsd:attribute name="vendorName" type="VendorNameType" use="required"/>
        <xsd:attribute name="version" type="VersionType"/>
        <xsd:attribute name="position" type="PositionType"/>
        <xsd:attribute name="locationName" type="LocationNameType"/>
        <xsd:attribute name="serialNumber" type="SerialNumberType"/>
        <xsd:attribute name="manufacturingDate" type="DateOrEmptyType"/>
        <xsd:attribute name="dateOfLastService" type="DateOrEmptyType"/>
        <xsd:attribute name="interchangeability" type="InterchangeabilityType"/>
        <xsd:attribute name="identificationCode" type="IdentificationCodeType"/>
        <xsd:attribute name="mnemonic" type="MnemonicType"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="POSU">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="poweredEquipmentPtrList" type="MOIDList" minOccurs="0"/>
        </xsd:sequence>
        <xsd:attributeGroup ref="MOGeneralAttributes"/>
        <xsd:attribute name="powerSupplyId" type="NamingAttributeIdType"/>
        <xsd:attribute name="powerSupplyType" type="PowerSupplyTypes"/>
        <xsd:attribute name="powerSource" type="xsd:integer"/>
        <xsd:attribute name="operationalState" type="OperationalState"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="FUUT">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:sequence minOccurs="0" maxOccurs="2">
                <xsd:element name="supportedByUnitList" type="MOIDList" minOccurs="0"/>
                <xsd:element name="affectedObjectList" type="MOIDList" minOccurs="0"/>
            </xsd:sequence>
            <xsd:element ref="FUUT" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attributeGroup ref="MOGeneralAttributes"/>
        <xsd:attributeGroup ref="MOStateAttributes"/>
        <xsd:attribute name="functionalUnitId" type="FunctionalUnitIdType"/>
        <xsd:attribute name="functionalUnitType" type="FunctionalUnitTypes" use="required"/>
        <xsd:attribute name="userLabel" type="UserLabelType"/>
        <xsd:attribute name="version" type="VersionType"/>
        <xsd:attribute name="protected" type="xsd:boolean"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="PRGR">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element name="availabilityStatus" type="AvailabilityStatus" minOccurs="0"/>
            <xsd:element ref="PRUT" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attributeGroup ref="MOGeneralAttributes"/>
        <xsd:attribute name="protectionGroupId" type="NamingAttributeIdType"/>
        <xsd:attribute name="protectionGroupType" type="ProtectionGroupTypes" use="required"/>
        <xsd:attribute name="revertive" type="xsd:boolean"/>
        <xsd:attribute name="operationalState" type="OperationalState"/>
        <xsd:attribute name="waitToRestoreTime" type="xsd:integer" use="required"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="Header">
    <xsd:complexType>
        <xsd:attribute name="time" type="xsd:dateTime" use="required"/>
        <xsd:attribute name="version" type="xsd:string"/>
        <xsd:attribute name="uploaded" type="xsd:boolean"/>
        <xsd:attribute name="GlobalId" type="xsd:integer"/>
        <xsd:attribute name="AdaptationName" type="xsd:string"/>
        <xsd:attribute name="AccessProtocol" type="xsd:string"/>
        <xsd:attribute name="ProprietaryMediatorAddress" type="NEAddressType"/>
        <xsd:attribute name="ProprietaryElementAddress" type="NEAddressType"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="NE">
    <xsd:complexType>
        <xsd:sequence minOccurs="0">
            <xsd:element ref="EQHO" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="POSU" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="FUUT" minOccurs="0" maxOccurs="unbounded"/>
            <xsd:element ref="PRGR" minOccurs="0" maxOccurs="unbounded"/>
        </xsd:sequence>
        <xsd:attributeGroup ref="MOGeneralAttributes"/>
        <xsd:attributeGroup ref="MOStateAttributes"/>
        <xsd:attribute name="NEId" type="xsd:string" use="required"/>
        <xsd:attribute name="NEType" type="NETypes" use="required"/>
        <xsd:attribute name="systemTitle" type="SystemTitleType"/>
        <xsd:attribute name="systemReleaseVersion" type="SystemReleaseVersionType"/>
        <xsd:attribute name="serialNumber" type="SerialNumberType"/>
        <xsd:attribute name="softwareReleaseVersion" type="SoftwareReleaseVersionType"/>
        <xsd:attribute name="userLabel" type="UserLabelType"/>
        <xsd:attribute name="vendorName" type="VendorNameType" use="required"/>
        <xsd:attribute name="version" type="VersionType"/>
        <xsd:attribute name="locationName" type="LocationNameType"/>
        <xsd:attribute name="HWCheckSum" type="HWCheckSumType"/>
        <xsd:attribute name="nameFromPlanningSystem" type="NameFromPlanningSystemType"/>
    </xsd:complexType>
</xsd:element>
<xsd:element name="HWData">
    <xsd:complexType>
        <xsd:sequence>
            <xsd:element ref="Header"/>
            <xsd:element ref="NE"/>
        </xsd:sequence>
    </xsd:complexType>
</xsd:element>
</xsd:schema>

Upvotes: 1

Related Questions