Package com.adobe.epubcheck.messages

Examples of com.adobe.epubcheck.messages.MessageLocation


    if (this.findLocation(location) == null)
    {
      if (this.locations.size() == CheckMessage.MAX_LOCATIONS)
      {
        ++additionalLocations;
        this.locations.add(new MessageLocation("There is 1 additional location for this message.", -1, -1));
      }
      else if (this.locations.size() < CheckMessage.MAX_LOCATIONS)
      {
        this.locations.add(location);
      }
      else
      {
        ++additionalLocations;
        MessageLocation infoLocation = this.locations.get(this.locations.size() - 1);
        infoLocation.setFileName(String.format("There are %1$s additional locations for this message.", additionalLocations));
      }
    }
  }
View Full Code Here


    if (href.length() < 1)
    {
      //if href="" then selfreference which is valid,
      //but as per issue 225, issue a hint
      report.message(MessageId.HTM_045,
          new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber(), href));
      return;
    }

    if (".".equals(href))
    {
      //selfreference, no need to check
    }


    if (href.startsWith("http"))
    {
      report.info(path, FeatureEnum.REFERENCE, href);
    }

    /*
       * mgy 20120417 adding check for base to initial if clause as part
       * of solution to issue 155
       */
    if (isRegisteredSchemeType(href) || (null != base && isRegisteredSchemeType(base)))
    {
      return;
    }

    // This if statement is needed to make sure XML Fragment identifiers
    // are not reported as non-registered URI scheme types
    else if (href.indexOf(':') > 0)
    {
      report.message(MessageId.HTM_025,
          new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber(), href));
      return;
    }

    try
    {
      href = PathUtil.resolveRelativeReference(path, href, base);
    }
    catch (IllegalArgumentException err)
    {
      report.message(MessageId.OPF_010,
          new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber(), href),
          err.getMessage());
      return;
    }
    if (xrefChecker != null)
    {
View Full Code Here

    return null;
  }

  public String toString()
  {
    MessageLocation location = this.locations.get(this.locations.size() - 1);
    String lineSeparator = System.getProperty("line.separator");
    String text;
    text = "ID: " + ID + lineSeparator
        + "SEVERITY: " + (severity != null ? severity : "-UNDEFINED-")
        + lineSeparator
        + lineSeparator
        + "ERRONEOUS FILE NAME: " + location.getFileName()
        + lineSeparator;
    if (location.getLine() > 0
        && location.getColumn() > 0)
    {
      text += "LINE NUMBER: " + location.getLine() + lineSeparator;
    }
    text += "COLUMN NUMBER: " + location.getColumn() + lineSeparator;
    text += "DESCRIPTION (long): " + this.message + lineSeparator;
    text += "=========================================================================================================================="
        + lineSeparator;

    return text;
View Full Code Here

    }
  }

  void checkBoldItalics(XMLElement e)
  {
    report.message(MessageId.HTM_038, new MessageLocation(path, parser.getLineNumber(),
        parser.getColumnNumber(), e.getName()));
  }
View Full Code Here

        parser.getColumnNumber(), e.getName()));
  }

  void checkIFrame(XMLElement e)
  {
    report.message(MessageId.HTM_036, new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber(), e.getName()));
  }
View Full Code Here

      report.info(path, FeatureEnum.CHARS_COUNT, Long.toString(charsCount));
      if (!epubTypeInUse)
      {
        if (version == EPUBVersion.VERSION_3)
        {
          report.message(MessageId.ACC_007, new MessageLocation(path, -1, -1));
        }
      }
      else
      {
        epubTypeInUse = false;
      }
    }

    ElementLocation currentLocation = elementLocationStack.pop();

    boolean inXhtml = EpubConstants.HtmlNamespaceUri.equals(ns);

    if (inXhtml && "script".equals(name))
    {
      String attr = e.getAttribute("type");
      report.info(path, FeatureEnum.HAS_SCRIPTS, (attr == null) ? "" : attr);
    }

    if (inXhtml && "style".equals(name))
    {
      String style = textNode.toString();
      if (style.length() > 0)
      {
        CSSCheckerFactory.getInstance().newInstance(
            ocf, report, style, false, path,
            currentLocation.getLineNumber(),
            currentLocation.getColumnNumber(), xrefChecker, version).runChecks();
      }
      textNode = null;
    }

    if (inXhtml && ("table".equals(name)))
    {
      if (tableDepth > 0)
      {
        --tableDepth;
        MessageLocation location = new MessageLocation(path, currentLocation.getLineNumber(), currentLocation.getColumnNumber(), "table");

        checkDependentCondition(MessageId.ACC_005, tableDepth == 0, hasTh, location);
        checkDependentCondition(MessageId.ACC_006, tableDepth == 0, hasThead, location);
        checkDependentCondition(MessageId.ACC_012, tableDepth == 0, hasCaption, location);
View Full Code Here

  {
    NodeList spines = doc.getElementsByTagNameNS(EpubConstants.OpfNamespaceUri, "spine");
    Node spine = spines.getLength() > 0 ? spines.item(0) : null;
    if (spine == null)
    {
      report.message(MessageId.OPF_019, new MessageLocation(pathRootFile, -1, -1));
      outWriter.println("Spine element not found within package root document " + pathRootFile);
      return false;
    }
    return true;
  }
View Full Code Here

      if (spine.getLength() > 0)
      {
        NodeList spineElements = spine.item(0).getChildNodes();
        if (spineElements.getLength() > maxSpineElements)
        {
          report.message(MessageId.OPF_020, new MessageLocation(pathRootFile, -1, -1));
          return false;
        }
      }
    }
    return true;
View Full Code Here

    {
      is = getInputStream(fileEntry);
      if (is == null)
      {
        String fileName = new File(zip.getName()).getName();
        report.message(MessageId.RSC_001, new MessageLocation(fileName, -1, -1), fileEntry);
      }
      else
      {
        doc = readXML(report, fileEntry, is, EpubConstants.ElementLineNumberAttribute, EpubConstants.ElementColumnNumberAttribute);
      }
    }
    catch (IOException e)
    {
      report.message(MessageId.PKG_008, new MessageLocation(fileEntry, -1, -1), fileEntry);
    }
    catch (SAXException e)
    {
      report.message(MessageId.RSC_005, new MessageLocation(fileEntry, -1, -1), e.getMessage());
      doc = null;
    }
    finally
    {
      if (is != null)
View Full Code Here

    }

    @Override
    public void startPrefixMapping (String prefix, String uri) throws SAXException
    {
      namespaceHelper.declareNamespace(prefix, uri, new MessageLocation(fileName, locator.getLineNumber(), locator.getColumnNumber(), prefix), report);
    }
View Full Code Here

TOP

Related Classes of com.adobe.epubcheck.messages.MessageLocation

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.