Liquid XML Studio
XsdEditorNotation Assert
Send Feedback
XSD Editor > Graphical Notation Overview > XsdEditorNotation Assert

Glossary Item Box

ShowGraphical Representation

ShowSummary

When the XML document is loaded the XPath expression in the xs:assert element is evaluated, if it does not evaluate to true, a validation error is raised.

This mechanism provides the ability to provide cross field validation, something that has been lacking in the XSD 1.0 standard.

ShowCreating

An xs:assert can be added to the following XSD entities

This can be done using the right click context menu on any of these entities.

A new facet type called Assertion has also been added to the XSD 1.1 standard. This is functionally the same as <xs:assert> but can also be applied to attributes and simpleTypes.

ShowProperties

Id A user defined ID to uniquely identify the entity within the schema
Test The XPath expression that must be true for the XML document to be considered valid
XPath Default Namespace The default namespace used in the XPath expression 'Test'.

ShowSample

The following XSD code

<?xml version="1.0"?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
        elementFormDefault="qualified">
    <xs:element name="Example">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="paragraph" type="paragraphType" maxOccurs="unbounded" />
            </xs:sequence>
        </xs:complexType>
    </xs:element>
    <xs:complexType name="paragraphType" mixed="true">
        <xs:sequence>
            <xs:element name="table" type="xs:string" minOccurs="0" />
            <xs:element name="paragraph" type="paragraphType" minOccurs="0" />
        </xs:sequence>
        <xs:assert test="if (paragraph) then paragraph/preceding-sibling::table else true()" />
    </xs:complexType>
</xs:schema>

Will be represented like this

Sample XML would look like this

<?xml version="1.0" encoding="utf-8"?>
<Example>
    <paragraph>
        <table>Table 1</table>
        <paragraph>Paragraph 1</paragraph>
    </paragraph>
       
</Example>


 

ShowInline 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.