One thing to note is that the built-in referential integrity mechanism will only be enforced if the change is made from the Design view. If you make the changes directly by typing in the Source view, then it is your responsibility to ensure that you make all the changes correctly. Any change you made in the Source view will automatically be reflected in the Design and Outline view.

Namespace

Namespace provides a way to identify where an element or attribute comes from. For example, two elements from two different schemas might have the same name (for example, SampleElement). To identify them, let us say Schema A's SampleElement vs. Schema B's SampleElement; we can use the XML Namespaces mechanism to distinguish them.

This section provides a quick introduction on how to define namespace for your schema in the XML Schema editor. In the xsd file, the target namespace is by default is http://www.ibm.com. This is indicated by the targetNamespace attribute in the schema element. This means that all the types that are defined in this schema belong to the target namespace http://www.ibm.com.

Usually, your schema has a prefix for its target namespace. To refer to any type defined in your schema, you must use this defined prefix. If you want to change the namespace prefix or the target namespace for your schema, you can use the Design view to do this. The following demonstrates this feature:

￿Select the file object, that is your schema.

￿In the Design view, change the Prefix field to any prefix you desire.

￿In the Design view, change the Target namespace field to any namespace of your choice, for example http://www.your application name.com.

￿Because such a change has a global impact to your entire document, you must click the Apply button to make this global change.

￿Switch over to the Source view. You will notice that the attributes on the schema element and all the prefixes for the types are automatically changed for you.

In order to have a more detailed view about XML namespaces and their support in the Application Developer, have a look at 5.3, “Namespace support” on page 90.

Validating schema

Another useful feature of the XML Schema editor is the incremental validation feature. At any point during your development of an XML Schema, you can invoke the validate process to validate the schema. The validation is also automatically run when you save the document, or when you finish typing in the

88 The XML Files: Development of XML/XSL Applications Using WebSphere Studio

Page 104
Image 104
IBM Version 5 manual Namespace, Validating schema