Package org.custommonkey.xmlunit

Examples of org.custommonkey.xmlunit.Validator


    ArchiveOrderRequest request = new ArchiveOrderRequest(
        dummyMerchantConstants);
    request.setGoogleOrderNo("1234567890");
   
    try {
      Validator v = new Validator(request.getXml());
      v.useXMLSchema(true);
      v.setJAXP12SchemaSource(xsd);

      assertTrue("XML valid ", v.isValid());
    } catch (SAXNotRecognizedException e) {
      System.out.println("Parser does not support validation.");
    }
  }
View Full Code Here


        dummyMerchantConstants);
    request.setGoogleOrderNo("1234567890");
    request.setAmount(10.0f);

    try {
      Validator v = new Validator(request.getXml());
      v.useXMLSchema(true);
      v.setJAXP12SchemaSource(xsd);

      assertTrue("XML valid ", v.isValid());
    } catch (SAXNotRecognizedException e) {
      System.out.println("Parser does not support validation.");
    }
  }
View Full Code Here

    ProcessOrderRequest request = new ProcessOrderRequest(
        dummyMerchantConstants);
    request.setGoogleOrderNo("1234567890");

    try {
      Validator v = new Validator(request.getXml());
      v.useXMLSchema(true);
      v.setJAXP12SchemaSource(xsd);

      assertTrue("XML valid ", v.isValid());
    } catch (SAXNotRecognizedException e) {
      System.out.println("Parser does not support validation.");
    }
  }
View Full Code Here

public class WebXmlTest extends TestCase {

    public void testWebXmlDTDCompliance() throws Exception {
        // makes sure web.xml is DTD compliant (without requiring internet access in the process)
        InputSource is = new InputSource(new FileInputStream("src/main/webapp/WEB-INF/web.xml"));
        Validator v = new Validator(is, new File("src/test/java/org/geoserver/web/web-app_2_3.dtd").toURL().toString());
        assertTrue(v.isValid());
    }
View Full Code Here

    private void assertValid(File output) throws FileNotFoundException, SAXException {
        InputSource xml = new InputSource(new FileInputStream(output));
        URL dtdUrl = getClass().getClassLoader().getResource(DTD_RESOURCE);
        assertThat("resource " + DTD_RESOURCE + " exists", dtdUrl, notNullValue());
        // Specify a validator as the documents don't have <!DOCTYPE jslint> in them.
        Validator validator = new Validator(xml, dtdUrl.toString(), "jslint");
        assertThat(validator.toString(), validator.isValid(), is(true));
    }
View Full Code Here

    private Validator getValidatorFor(String xml) throws SAXException {
        URL dtd = Resources.getResource(DTD_RESOURCE);
        // Specify a validator as the documents don't have <!DOCTYPE file> in them.
        // NB: We produce a subset of the full DTD (no root jslint element), but it's enough to
        // validate.
        return new Validator(new InputSource(new StringReader(xml)), dtd.toString(), "file");
    }
View Full Code Here

        StringReader reader = new StringReader(xml);
        String systemID =
                org.zanata.xml.TmxDtdResolver.class.getResource(
                        "/org/zanata/xml/tmx14.dtd").toString();
        String doctype = "tmx";
        Validator v = new Validator(reader, systemID, doctype);
        assertTrue(v.toString(), v.isValid());
    }
View Full Code Here

public class WebXmlTest extends TestCase {

    public void testWebXmlDTDCompliance() throws Exception {
        // makes sure web.xml is DTD compliant (without requiring internet access in the process)
        InputSource is = new InputSource(new FileInputStream("src/main/webapp/WEB-INF/web.xml"));
        Validator v = new Validator(is, new File("src/test/java/org/geoserver/web/web-app_2_3.dtd").toURL().toString());
        assertTrue(v.isValid());
    }
View Full Code Here

   
        // System.out.println(resp.getOutputStreamContent());
       
        String result = resp.getOutputStreamContent();
       
        Validator validator = new Validator(result);
        validator.useXMLSchema(true);
        validator.assertIsValid();
       
        Document doc = XMLUnit.buildTestDocument(result);
        Map<String, String> namespaces = new HashMap<String, String>();
        namespaces.put("xlink", "http://www.w3.org/1999/xlink");
        namespaces.put("xsi", "http://www.w3.org/2001/XMLSchema-instance");
View Full Code Here

TOP

Related Classes of org.custommonkey.xmlunit.Validator

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.