1 package com.freemindcafe.xml.xsd.sample2;
4 import java.io.InputStream;
5 import java.io.StringWriter;
6 import java.util.ArrayList;
8 import junit.framework.Assert;
19 public void read_xml_and_validate_against_the_schema_succeeds()
throws Exception{
20 InputStream stream = this.getClass().getResourceAsStream(
"/com/freemindcafe/xml/xsd/sample2/po.xml");
22 XmlOptions options =
new XmlOptions();
23 ArrayList<Object> validationErrors=
new ArrayList<Object>();
24 options.setErrorListener(validationErrors);
25 if (!document.validate(options)) {
26 StringWriter sW=
new StringWriter();
27 for (Object o : validationErrors) {
30 System.out.println(sW.toString());
32 Assert.assertTrue(document.validate());