Tuesday, May 9, 2017

How to validate an xml document against a schema

STEP 1: Create the XML

To create a new XML file, start eclipse IDE and choose File->New->Other->XML file->Create XML file from XML template.
Model the data of interest in the XML file. In my case, I have created the following XML.

The teams.xml file

<?xml version="1.0" encoding="UTF-8"?>
<team>
 <name>the great team</name>
 <description>these team was recruited by google to develop a secret product</description>
 <developers>
  <developer role="frontend">
   <name>John Carrot</name>
  </developer>
  <developer role="backend">
   <name>Joshua Allock</name>
  </developer>
  <developer role="frontend">
   <name>Brendan Tich</name>
  </developer>
 </developers>
</team>