Recommendations for creating XSD files

There are practices that you can follow when creating XML Schema Definition (XSD) files that will make it easier to use the files for event definitions in the Monitor Model editor.

The following practices are recommended:
  • In an XSD file, you create data type definitions and element declarations. Although the data type assigned to an event part can be either an element declaration, a complex type, or a simple type, it is recommended that you create an element declaration along with a data type definition, and use the element declaration as the event part data type in the Monitor Model editor. The following image shows BusinessInformation.xsd in the XML schema editor. Notice how an element declaration named CustomerOrder has been created, and assigned the complex type OrderType.
    Screen capture of BusinessInformation.xsd in the XML schema editor

    Notice that all three constructs from the XSD file are displayed in the window and are available for selection. However, if you select the element declaration, the path attribute of the event part can be inferred by the Monitor Model editor and completed for you.

  • An XSD file can contain many types and elements. In fact, a single XSD file can hold all the type information needed for a monitor model. (A common base event file, however, can only contain one event definition.) You can think of an XSD file as a library of type definitions that are all related to each other or used for a similar purpose.
  • If you create an XSD from the Project Explorer, certain settings are provided by default. If you are defining the XSD elsewhere, you should complete the following tasks:
    • Define a target namespace for the XSD file. The namespace enables you to draw a boundary line around related things to say they are related. You can use the same names in different namespaces and have elements with the same name in use at the same time.
    • Set elementFormDefault and attributeFormDefault to qualified. This helps to ensure that expressions written to access pieces of information within a type are unambiguous.

For more information about XML schemas, see the Rational® Application Developer information, especially "Creating XML schemas."