Package ch.entwine.weblounge.common.impl.util.xml

Examples of ch.entwine.weblounge.common.impl.util.xml.ValidationErrorHandler


      URL siteUrl = e.nextElement();

      logger.debug("Parsing site definition from bundle '{}'", bundleName);

      // Load and validate the site descriptor
      ValidationErrorHandler errorHandler = new ValidationErrorHandler(siteUrl);
      docBuilder.setErrorHandler(errorHandler);
      final Document siteXml = docBuilder.parse(siteUrl.openStream());
      if (errorHandler.hasErrors()) {
        logger.error("Errors found while validating site descriptor in bundle '{}'. Site is not loaded", bundleName);
        return;
      }

      // Start loading the site in a new thread in order to enable parallel
View Full Code Here


    docBuilderFactory.setSchema(siteSchema);
    docBuilderFactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();

    // Validate and read the site descriptor
    ValidationErrorHandler errorHandler = new ValidationErrorHandler("site");
    docBuilder.setErrorHandler(errorHandler);
    Document doc = docBuilder.parse(siteXml);

    Site site = SiteImpl.fromXml(doc.getFirstChild());
    return site;
View Full Code Here

        int endIndex = moduleXmlUrl.toExternalForm().lastIndexOf('/');
        URL moduleUrl = new URL(moduleXmlUrl.toExternalForm().substring(0, endIndex));
        logger.debug("Loading module '{}' for site '{}'", moduleXmlUrl, this);

        // Load and validate the module descriptor
        ValidationErrorHandler errorHandler = new ValidationErrorHandler(moduleXmlUrl);
        docBuilder.setErrorHandler(errorHandler);
        Document moduleXml = docBuilder.parse(moduleXmlUrl.openStream());
        if (errorHandler.hasErrors()) {
          logger.error("Errors found while validating module descriptor {}. Site '{}' is not loaded", moduleXml, this);
          throw new IllegalStateException("Errors found while validating module descriptor " + moduleXml);
        }

        // We need the module id even if the module initialization fails to log
View Full Code Here

    while (entries != null && entries.hasMoreElements()) {
      URL entry = (URL) entries.nextElement();

      // Validate and read the module descriptor
      ValidationErrorHandler errorHandler = new ValidationErrorHandler(entry);
      DocumentBuilder docBuilder;

      try {
        docBuilder = docBuilderFactory.newDocumentBuilder();
        docBuilder.setErrorHandler(errorHandler);
        Document doc = docBuilder.parse(entry.openStream());
        if (errorHandler.hasErrors()) {
          logger.warn("Error parsing integration test {}: XML validation failed", entry);
          continue;
        }
        IntegrationTestGroup test = IntegrationTestParser.fromXml(doc.getFirstChild());
        test.setSite(this);
View Full Code Here

    docBuilderFactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();

    // Validate and read the module descriptor
    URL testContext = this.getClass().getResource(testFile);
    ValidationErrorHandler errorHandler = new ValidationErrorHandler(testContext);
    docBuilder.setErrorHandler(errorHandler);
    Document doc = docBuilder.parse(testContext.openStream());
    assertFalse("Schema validation failed", errorHandler.hasErrors());

    module = ModuleImpl.fromXml(doc.getFirstChild());
    module.setSite(site);
  }
View Full Code Here

    docBuilderFactory.setNamespaceAware(true);
    DocumentBuilder docBuilder = docBuilderFactory.newDocumentBuilder();

    // Validate and read the module descriptor
    URL testContext = IntegrationTestParserTest.class.getResource(testFile);
    ValidationErrorHandler errorHandler = new ValidationErrorHandler(testContext);
    docBuilder.setErrorHandler(errorHandler);
    Document doc = docBuilder.parse(testContext.openStream());
    assertFalse("Schema validation failed", errorHandler.hasErrors());

    // Finally, parse the test
    testGroup = IntegrationTestParser.fromXml(doc.getFirstChild());
    testCases = testGroup.getTestCases();
  }
View Full Code Here

TOP

Related Classes of ch.entwine.weblounge.common.impl.util.xml.ValidationErrorHandler

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.