Home » railML newsgroups » railml.common » Use of lists in RailML to be commented
Use of lists in RailML to be commented [message #1081] Thu, 12 February 2009 06:18
Joerg von Lingen is currently offline  Joerg von Lingen
Messages: 148
Registered: May 2011
Senior Member
Hi,

there is a question to user and XML experts about using lists within a attribute.

At the description of brake systems available we have the need to have a set, i.e. none or any out
of a given list, additional brakes. Thus I tried to translate this into XML in oder to have the
information in one attribute but limit the allowable values in the list.

This is the enumeration for the possible values:
<xs:simpleType name="tBrkPos" final="restriction">
<xs:restriction base="xs:string">
<xs:enumeration value="H" />
<xs:enumeration value="E" />
<xs:enumeration value="Mg" />
<xs:enumeration value="Wb" />
</xs:restriction>
</xs:simpleType>

This is the attribute using the list:
<xs:simpleType name="tAuxBrakes">
<xs:annotation>
<xs:documentation>none, one or any of "H", "E", "Mg", "Wb"</xs:documentation>
</xs:annotation>
<xs:list itemType="tBrkPos" />
</xs:simpleType>

The alternative would be a child element
<xsd:sequence>
<xsd:element name="auxiliaryBrakes" type="eAuxiliaryBrakes"
minOccurs="0" />
</xsd:sequence>

with a group of single attributes one for each value
<xsd:complexType name="eAuxiliaryBrakes">
<xsd:attributeGroup ref="aAuxiliaryBrakes" />
</xsd:complexType>

<xsd:attributeGroup name="aAuxiliaryBrakes">
<xsd:attribute name="H" type="xsd:boolean" use="optional" default="false" />
<xsd:attribute name="E" type="xsd:boolean" use="optional" default="false" />
<xsd:attribute name="Mg" type="xsd:boolean" use="optional" default="false" />
<xsd:attribute name="Wb" type="xsd:boolean" use="optional" default="false" />
<xsd:attribute name="ep" type="xsd:boolean" use="optional" default="false" />
</xsd:attributeGroup>

Could anyone please comment on the use of lists or the alternative in general but also with respect
to the best formulation in XML.

P.S.: Attribute and type names are not final.
--
Mit freundlichen Grüßen/Best regards,
-------------------------------------
Jörg von Lingen
Previous Topic: Vorstellung trafIT solutions
Next Topic: Thesis about a our sistem inegrated with RailML
Goto Forum:
  


Current Time: Thu Apr 18 02:45:02 CEST 2024