0

Kotlin – Validate XML against XSDs

This post is about XML validation against more than one related XSDs – one XSD is included into the main XSD.

Requirements

Stuff used for this post.

  1. Java JDK 1.8.0_171
  2. IntelliJ IDEA
  3. Kotlin 1.2
    • Using 1.2.31-release-95

XML Schemas

We use the following schemas for XML validation.

Note on line 3, we included the first XSD in myschema.xsd. These files must be in the same directory.

XML to Validate

Kotlin Codes

Sample Output