Search

11.2. Message Validation

download PDF
Here is a sample that depicts message validation.
Message Content:
<MyBook xmlns="example">
  <Chapter1/>
  <Chapter2/>
</MyBook>
This is the associated XML Schema definition:
<?xml version="1.0" encoding="UTF-8"?>
<schema xmlns="http://www.w3.org/2001/XMLSchema"
        targetNamespace="example"
        xmlns:orders="example">
        <element name="MyBook" type="example:MyBook"/>
        <complexType name="MyBook">
            <sequence>
                <element name="Chapter1" type="string"/>
            </sequence>
        </complexType>
</schema>
The XML content is still well-formed, but it has a Chapter2 element that is not declared as the child of MyBook element in the XML schema. Hence the content cannot be validated against the schema.
Red Hat logoGithubRedditYoutubeTwitter

Learn

Try, buy, & sell

Communities

About Red Hat Documentation

We help Red Hat users innovate and achieve their goals with our products and services with content they can trust.

Making open source more inclusive

Red Hat is committed to replacing problematic language in our code, documentation, and web properties. For more details, see the Red Hat Blog.

About Red Hat

We deliver hardened solutions that make it easier for enterprises to work across platforms and environments, from the core datacenter to the network edge.

© 2024 Red Hat, Inc.