Understanding XML Notation

Print Friendly

 


XML Notation

The diagrams are all illustrated with a set of symbols which are specific to a particular vendor’s implementation of schema diagrams. The following explanation of these symbols will help in understanding the meaning of the diagrams.

Element

Probably the most basic part of these diagrams are the named rectangles. Each of these represents a token called an Element. Each Element symbol can be elaborated with extra information as shown in the samples below.

This is a mandatory simple element of type string. The upper left corner of the icon has a shading that indicates data is contained in this element and the type specifies that the data is a string. If there were an enumeration (i.e. list of specific values) then the enum list would be shown in the symbol.

Optional Element

This is an optional element as specified by the dotted lines used to frame the rectangle. Comments under the element describe it in more detail. Data is expected in the element as shown by upper left shading.

Recurring Element

This element is composed of other elements as indicated by the box with a ‘plus’ on the right side. It must occur at least one (1…) and can occur an unlimited amount of times (infinity symbol).

 

 

Sequence Connector

The connection box in this diagram indicates that dateRange is made up of three elements. In this case each of these is optional but on many cases some or all will be mandatory. This is called a sequence indicator.

 

 

Choice Connector

This connector is a ‘choice’ indicator. This means that financialTerms is always going to be exactly one of the elements on the right.

 

 

Definition Using Complex Type

This diagram illustrates the use of a complex type for defining an element. Quote is a defined type. When creating forwardPointsQuote its type was set to Quote. As a consequence of this, the element forwardPointsQuote picks up the definition specified by the complex type. These constructs are used frequently when there are multiple elements in different roles but with the same pattern.

 

 

Complex Type

When viewed by itself the complex type looks very similar to a normal element. What makes types powerful is that they can be re-used to specify the different elements with identical requirements. This is done in a way that the complex type is not explicitly seen in the resulting XML. When changes are made to the type every element defined using them will change accordingly.

 




Leave a Reply

You must be logged in to post a comment.