About XML Schema Properties

 

The Documentation tab is available only in Stylus Studio XML Professional Edition.

When the Diagram or Tree tab of an XML Schema is active, you can see the properties for the selected node. Click the node whose properties you want to view, and the properties appear in the Properties window. If the Properties window is not visible, select View > Properties from the menu bar.

To change the value of a property, click the property field and enter the new value. If only certain values are allowed, Stylus Studio displays a drop-down list of the valid choices. In the Diagram view, some properties are read-only. To modify these properties, switch to the Tree view and change the property there. When you switch back to the Diagram view, your change is visible.

Each type of node has its own set of properties. The following topics describe the properties for various node types:

About xsd:schema Properties

The root element of every XML Schema document is the xsd:schema element. The xsd:schema element has the properties described in Table 37. Click the Tree tab, and then click the Schema node to view the properties for the xsd:schema element.

Property
Description
Type
The type is always Schema.
Namespace

The namespace for the Schema node is usually xsd, but you can change it.

Target Namespace
This is the namespace that elements and attributes defined in an instance document belong to. For example, suppose you define the following:
<xsd:schema ... targetNamespace="http://myNS">
               

              
<xsd:element name="myelement"/>
                   

                
In an instance document, the following declarations conform with the target namespace:
<myelement xmlns="http://myNS"/>
               
<myns:myelement xmlns:myns="http://myNS"/>
               

            
However, the following declaration does not conform:
<myns:myelement xmlns:myns="http://anotherNS"/>
               

            
Version
Use this property as a convenient way to track the revisions of your XML Schema document.
Default Element Form
An element or attribute's form is either qualified or unqualified. A form of qualified means that each time an element or attribute is referenced in the schema document, you must specify the prefix of its namespace. Every element and attribute has a form attribute. If it is not explicitly defined, the schema processor checks the default attribute form specified for the Schema node. For example:
<xs:schema elementFormDefault="qualified" 
               

              
targetNamespace="http://myNs" 
                   
xmlns:myns="http://myNS">
                   

                
  <xs:element name="topElem"> ....
</xs:element>
                   
<xs:element name="anElem">
                   
 <xs:complexType>
                   

                
<xs:sequence> <xs:element ref="myns:topElem"> ...

If the form for the element topElem (or, the default form for elements) was defined to be unqualified, the reference could have used ref="topElem".

Default Attribute Form
Default Blocked Definitions
If an element does not have its own blocked or final definition, the schema processor uses the default blocked or final definition you specify here.
Default Final Definitions
Table 37. xsd:schema Properties

Element and Element Reference Properties in XML Schemas

Both global and local elements have the properties described in Table 38. References to elements have the same properties except where noted.

Property
Description
Type
For elements, the type is always Element. For references to elements, the type is always Ref. to Element.
Name
The tag name you use in an instance document. Specify the name you want the element to have.
Min Occur.
Specifies the minimum number of instances of this element that can be present. If an element is not required to be present, specify 0. You cannot specify this property for a global element. If you do, Stylus Studio ignores it.
Max Occur.
Specifies the maximum number of instances of this element that can be present. If there is no limit to the number of instances, specify unbounded. You cannot specify this property for a global element. If you do, Stylus Studio ignores it.
Data Type
The type of the data that the element contains. Select from all simpleTypes defined in an XML Schema, and all types (simple or complex) that you define in the same schema. Nodes that are references to elements do not have this property.
Default
Specifies the default value for this element. Specification of this property makes sense only for optional elements. If you specified 0 for the Min Occur. property, you can specify a default value.
When this element is in an instance document, the element has whatever value you specify. If you do not specify this element, the schema processor behaves as though you had specified it with the default value. When you specify a default value for an element, that element must be optional in an instance document. An element can have a value for the Default property or a value for the Fixed Value property. The two properties are mutually exclusive.
Fixed Value
When you specify a value for Fixed Value, it is optional for the element to appear in an instance document. However, if the element does appear, it must have the value specified by Fixed Value. Whether or not you specify this element in an instance document, the schema processor behaves as though you had specified this element with the fixed value. An element can have a value for the Fixed Value property or a value for the Default property. The two properties are mutually exclusive.
Abstract
A Boolean value that indicates whether substitution for this element is required. When Abstract is true, the element cannot be used in an instance document. Instead, a member of the element's substitution group must appear in the instance document.
Nillable
A Boolean value that indicates whether the contents of the element can be set to nil. A value of true indicates that the element can be empty; that is, it is permissible for the element to not contain any subelements, attributes, or data.
Form
An element's form is either qualified or unqualified. A form of qualified means that each time the element is referenced in the schema document, you must specify the prefix of its namespace. Every element has a form attribute. If it is not explicitly defined, the schema processor checks the default attribute form specified for the Schema node.
Blocked Substitutions
Defines that this element cannot be derived in some forms. That is, it specifies that one or more extensions, restrictions or substitutions cannot be permitted. For example, an enumeration for all the states in the United States can block extensions and substitutions, thus allowing derived data types only so as to restrict the number of valid states.
Final Substitutions
Specifies that this element is not allowed to be substituted in a substitution group if these are extensions or restrictions of the same base type. For example, suppose an Invoice contains a reference to a PO document. The PO document is derived from AccountingDocument. If PO document has the final="extensions" attribute, and PartialPO is defined as an extension from AccountingDocument, the Invoice cannot substitute PO with PartialPO.
Substitution Groups
If an element defines an element name definition in a substitution group, it means that it can be used in all the places where there is a reference to that element. For example, suppose the PO document definition indicates that it can refer to an RFQ element. You can specify that a foo element is in the substitution group for an RFQ element. If you do, a PO document is valid if it refers to a foo element.
Table 38. Element and Element Reference Properties

Attribute and Attribute Reference Properties in XML Schemas

Both global and local attributes have the properties described in the Table 39. References to attributes have the same properties, except where noted.

Property
Description
Type
For attributes, the type is always Attribute. For attribute references, the type is always Ref. to Attribute.
Name
The attribute name you use in an instance document. Specify the name you want the attribute to have.
Data Type
The type of the data that is the value of the attribute. Select from all simpleTypes defined in an XML Schema, and all simpleTypes that you already defined in the same schema. References to attributes do not have this property.
Default
Specifies the default value for this attribute. Specification of this property makes sense only for optional attributes. If you specified optional for the Restrictions property, you can specify a default value.
If this attribute is in an instance document, the attribute has whatever value you specify. If you do not specify this attribute, the schema processor behaves as though you had specified it with the default value. When you specify a default value for an attribute, that attribute must be optional in an instance document. An attribute can have a value for the Default property or a value for the Fixed Value property. The two properties are mutually exclusive.
Fixed Value
When you specify a value for Fixed Value, it is optional for the attribute to appear in an instance document. However, if the attribute does appear, it must have the value specified by Fixed Value. Whether or not you specify this attribute in an instance document, the schema processor behaves as though you had specified this attribute with the fixed value. An attribute can have a value for the Fixed Value property or a value for the Default property. The two properties are mutually exclusive.
Restrictions
Specify prohibited, optional, or required.
Form
An attribute's form is either qualified or unqualified. A form of qualified means that each time the attribute is referenced in a schema document, you must specify the prefix of its namespace. Every attribute has a form attribute. If it is not explicitly defined, the schema processor checks the default attribute form specified for the Schema node.
Table 39. Attribute and Attribute Reference Properties

Group Properties in XML Schemas

A group contains references to elements. Groups have the properties described in Table 40:

Property
Description
Type
The type is always Group.
Name
The name you specified for the group.
Min Occur.
Specifies the minimum number of instances of this group that can appear in a complexType that references this group. If a group is not required to be present, specify 0.
Max Occur.
Specifies the maximum number of instances of this group that can appear in a complexType that references this group. If there is no limit to the number of instances, specify unbounded.
Table 40. Group Properties

Model Group Properties in XML Schemas

After you create a group node or a complexType node, you can add a model group node as a child. A model group specifies rules for the occurrence of elements. These are the elements that are the children of the group or complexType in an instance document. A model group references and defines elements. Model groups have the properties described in Table 41:

Property
Description
Type
The type is always Model Group.
Modifier
Specifies the occurrence rules for the elements that you add as children of the model group node. Specify one of the following values:
l all specifies that each element must appear exactly zero or one time. The elements can appear in any order. In an instance document, the children of the group or complexType can include 0 or 1 instance of each element.
l choice specifies that exactly one element can be present, and there must be only one instance of that element. In an instance document, exactly one element can be a child of the group or complexType.
l sequence specifies that the elements must appear in the order in which they are specified in the schema. For each element, you can specify whether it is optional and whether it can appear more than once. The default is that exactly one must be present in an instance document. In an instance document, each element that appears must be in the same order as in the schema.
Another value you can specify is any. When you specify any, you do not add any element definitions or references to elements. As the name implies, any element can appear any number of times.
Min Occur.
Specifies the minimum number of instances of this model group that can appear in this group or complexType. If a model group is not required to be present, specify 0.
Max Occur.
Specifies the maximum number of instances of this model group that can appear in this group or complexType. If there is no limit to the number of instances, specify unbounded.
Table 41. Model Group Properties

Complex and simpleType Properties in XML Schemas

complexTypes have the properties described in Table 42. simpleTypes have only the Type and Name properties.

Property
Description
Type
The type is always complexType or simpleType.
Name
The type name you use elsewhere in the XML Schema. Specify the name you want the type to have.
Abstract
A Boolean value that indicates whether substitution for this complexType is required. When Abstract is true, the complexType cannot be used in an instance document. Instead, a member of the complexType's substitution group must appear in the instance document. simpleTypes do not have this property.
Mixed
A Boolean value that indicates whether or not this complexType can contain raw data as well as elements and attributes. A value of true indicates that it can contain raw data. simpleTypes do not have this property.
Blocked Substitutions
Defines that this type cannot be derived in some forms. That is, it specifies that one or more extensions, restrictions or substitutions cannot be permitted. For example, an enumeration for all the states in the United States can block extensions and substitutions, thus allowing derived data types only so as to restrict the number of valid states.
Final Substitutions
Specifies that the type is not allowed to be substituted in a substitution group if these are extensions or restrictions of the same base type. For example, suppose an Invoice contains a reference to a PO document. The PO document is derived from AccountingDocument. If PO document has the final="extensions" attribute, and PartialPO is defined as an extension from AccountingDocument, the Invoice cannot substitute PO with PartialPO.
Table 42. Complex and simpleType Properties

Restriction and Extension Type Properties in XML Schemas

When you define a simpleType, you always derive it from a built-in XML Schema simpleType, or a simpleType you previously defined. To specify the simpleType that your simpleType is based on, add a restriction node or an extension node to your simpleType node.

A restriction node indicates that your simpleType is a subset of some other simpleType. An extension node indicates that your simpleType extends the range of values provided by an existing simpleType.

Restriction type nodes and extension type nodes have the properties described in Table 43:

Property
Description
Type
The type is always Restriction or Extension.
Base Type
Indicates the data type that this simpleType is based on.
Table 43. Restriction and Extension Type Properties

See

Content Type Properties in XML Schemas

Content types have the properties described in Table 44:

Property
Description
Type
The type is always Content.
Mixed
A Boolean value that indicates whether this node can contain text as well as elements.
Content Type
When the value is simpleContent, the node can contain only character data and no elements or attributes. When the value is complexContent, the node can contain character data, elements, and attributes.
Table 44. Content Type Properties

Aggregator Type Properties in XML Schemas

After you create a simpleType node, you can add an aggregator node as its child. An aggregator node indicates that a single instance of an element of your new simpleType contains a sequence of atomic types. Aggregator types have the properties described in Table 45:

Property
Description
Type
Must be list or union.
  • list indicates that all instances in the sequence must be of the same type.
  • union indicates that the instances in the sequence can be of different types.
Aggregator Type
The type of the instances included in your new simpleType. If the value of Type is union, you can specify a space-separated list.
Table 45. Aggregator Type Properties

Facet Type Properties in XML Schemas

Facet types have the properties described in Table 46:

Property
Description
Facet Type
Must be one of the following: enumeration, fractionDigits, length, maxExclusive, maxInclusive, maxLength, minExclusive, minInclusive, minLength, pattern, totalDigits, or whiteSpace.
Fixed
A Boolean value that indicates whether you can further restrict the simpleType with this same facet and a different value. The default is false. That is, the default is that you can apply the same facet more than once. For example, suppose you specify the following definition:
<xsd:simpleType name="zip"> 
               

              
<xsd:restriction base="xsd:string"> 
                   
<xsd:length value="5" fixed="true"/> 
                   
</xsd:restriction> 
                   

                
</xsd:simpleType>  
This defines a postal code whose length is 5 characters. You can further restrict this simpleType with, for example, the pattern facet so that the first three characters must always be " 100", but you cannot further restrict the length facet when the Fixed property is set to true.
Facet types of pattern and enumeration do not have the Fixed property.
Value
Varies according to the facet type. See About Facet Types for simpleTypes.
Table 46. Facet Type Properties

Notation Type Properties in XML Schemas

Notation types have the properties described in Table 47. See Defining Notations for more information.

Property
Description
Type
The type is always Notation.
Name
The name you specify for the notation.
Public ID
Unique string that refers to the physical location of the external data, for example, MyCompany//LOGO//JPEG.
System ID
URL used to physically locate the external data, for example, http://www.mycompany.com/mylogo.jpg.
Table 47. Notation Type Properties

Include Type Properties in XML Schemas

Include types have the properties described in Table 48. See Referencing External XML Schemas for more information.

Property
Description
Type
The type is always Include.
Location
URL that identifies the location of the file that contains the XML Schema.
Table 48. Include Type Properties

Import Type Properties in XML Schemas

Import types have the properties described in Table 49. See Referencing External XML Schemas for more information.

Property
Description
Type
The type is always Import.
Location
URL that identifies the location of the file that contains the XML Schema.
Target Namespace
This is the namespace that elements and attributes defined in an instance document belong to.
Table 49. Import Type Properties

Redefine Type Properties in XML Schemas

Redefine types have the properties described in Table 50. See Referencing External XML Schemas for more information.

Property
Description
Type
The type is always Redefine.
Location
URL that identifies the location of the file that contains the XML Schema.
Table 50. Redefine Type Properties

Identity Constraint Type Properties in XML Schemas

Identity Constraint types have the properties described in Table 51. See Adding an Identity Constraint to an Element for more information.

Property
Description
Type
The type is always Identity Constraint.
Name
The name you specify for the identity constraint.
Table 51. Identity Constraint Type Properties

Constraint Element Type Properties in XML Schemas

Constraint Element types have the properties described in Table 52. See Adding an Identity Constraint to an Element for more information.

Property
Description
Type
The type is always Constraint Element.
XPath Expression
An XPath expression that returns the element for which you are defining a constraint.
Table 52. Constraint Element Type Properties

Documentation Type Properties in XML Schemas

Documentation types have the properties described in the following table:

Property
Description
Type
The type is always Documentation.
Source
A path or URL for an external file that contains the documentation.
Language
The language of the contents of the documentation.
Table 53. Documentation Type Properties

 
Free Stylus Studio XML Training: