Code example for Validator

Methods: validate

    public void testValidatorBadXML() { 
        System.out.println("-- testValidatorBadXML");
        try { 
            fail("MUST NOT be able to validate bad restlet.xml"); 
        } catch (SAXException x) {
            // the error must be a "cvc-complex-type.2.4.a" 
            assertTrue("MUST detect schema violation", x.getLocalizedMessage()
            // ...and it has to refer to 'bad-element' 
            assertTrue("MUST detect schema violation related to 'bad-element'", 
                    x.getLocalizedMessage().indexOf("bad-element") > 0);
        } catch (IOException x) {
            fail("MUST throw a SAXException only");