Liquid Studio 2020
XSD Editor / Graphical Notation Overview / Attribute
In This Topic
    Attribute
    In This Topic
     Graphical Representation
     Summary

    The xs:attribute element indicates that the parent can/must contain an attribute within the XML document.

     Creating

    An xs:attribute can be added to an xs:element, xs:complexType or xs:attributeGroup. This can be done using the right click context menu on any of these entities and using the menu item Add Child -> Attribute.

     Properties

    Name The name of the attribute (this is used within the XML document i.e. <Order OrderID="87">).
    Type  Describes the type of data contained within the attribute. There are a number of built in types, but you can define your own by defining a <simpleType>.
    Facets The facets available depend on the 'type' attribute see Facets for more information.
    Default The default value given to the attribute. If the attribute is not specified then a parser should use this value in its place (Default and Fixed are mutually exclusive).
    Fixed The value that the attribute has to take (Default and Fixed are mutually exclusive).
    Form
    Id A user defined ID to uniquely identify the entity within the schema
    Simple Type Content Determines the content type of the attribute. If it is Restriction, then the type specified in the Type property can be further restricted by using facets (i.e. you can set value ranges or lengths etc). If it's List, then the attribute can contain a space separated list of values (of the type defined in the Type property), the number of items can then be constrained with the MinOccurs and MaxOccurs. If it's Union, then the property Union Types, allows you to specify all the types that the attribute may contain (i.e. it could contain a date or a number).
    Union Types Only valid when the Simple Type Content is set to Union. Allows you to provide a list of the types that the attribute can contain.  
    Use If the value is Required, then the attribute must appear in the XML document. If it's Optional then it may appear, if it's Prohibited then it must not appear, this is only applicable when the parent element has been restricted (see <element> and <complexType>)

     Sample

    The following XSD code

    <xs:attribute name="OrderID">

    <xs:simpleType>

    <xs:restriction base="xs:int">

    <xs:maxInclusive value="999" />

    <xs:minInclusive value="0" />

    </xs:restriction>

    </xs:simpleType>

    </xs:attribute>

    Will be represented like this

    Sample XML would look like this

    <?xml version="1.0" encoding="utf-16"?>

    <Order OrderID="87">

     Inline Properties

    Properties that apply to a type are shown inline at the bottom of the items container.

    Values that are inherited from the base types are shown in brackets, values specifically set against the item are shown without brackets.

    If a facet is not valid for a given type (typically because of its data type), then its value is shown in red.

    Inline properties can be disabled in the Options.

     

     

     

     

    See Also