Liquid Studio 2020
XsdEditorNotation Assert
XSD Editor > Graphical Notation Overview > XsdEditorNotation Assert
 Graphical Representation

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.


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.

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


The following XSD code

<?xml version="1.0"?>
<xs:schema xmlns:xs=""
    <xs:element name="Example">
                <xs:element name="paragraph" type="paragraphType" maxOccurs="unbounded" />
    <xs:complexType name="paragraphType" mixed="true">
            <xs:element name="table" type="xs:string" minOccurs="0" />
            <xs:element name="paragraph" type="paragraphType" minOccurs="0" />
        <xs:assert test="if (paragraph) then paragraph/preceding-sibling::table else true()" />

Will be represented like this

Sample XML would look like this

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

 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.