Package com.adobe.epubcheck.messages

Examples of com.adobe.epubcheck.messages.MessageLocation


    if (name.equals("smil"))
    {
      vocabs = VocabUtil.parsePrefixDeclaration(e.getAttributeNS(EpubConstants.EpubTypeNamespaceUri, "prefix"), RESERVED_VOCABS,
          KNOWN_VOCAB_URIS, DEFAULT_VOCAB_URIS, report,
          new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()));
    } else if (name.equals("seq"))
    {
      processSeq(e);
    } else if (name.equals("text"))
    {
View Full Code Here


  }

  private void checkType(String type)
  {
    VocabUtil.parsePropertyList(type, vocabs, report,
        new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()));
  }
View Full Code Here

      {
        String mimeType = xrefChecker.getMimeType(ref);
        if (mimeType != null && !OPFChecker30.isBlessedAudioType(mimeType))
        {
          report.message(MessageId.MED_005,
              new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()), ref, mimeType);
        }
      }
      xrefChecker.registerReference(path, parser.getLineNumber(), parser.getColumnNumber(), ref, type);
    }
  }
View Full Code Here

    {
      if(ref.refResource.matches("^[^:/?#]+://.*")
          && !(version == EPUBVersion.VERSION_3 && (ref.type == RT_AUDIO || ref.type == RT_VIDEO)))
      {
        report.message(MessageId.RSC_006,
            new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource));
      }
      else if (!ocf.hasEntry(ref.refResource) && !ref.refResource.matches("^[^:/?#]+://.*"))
      {
        report.message(MessageId.RSC_007,
            new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource));

      }
      else if (!undeclared.contains(ref.refResource))
      {
        undeclared.add(ref.refResource);
        report.message(MessageId.RSC_008,
            new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource));
      }
      return;
    }

    if (ref.fragment == null)
    {
      switch (ref.type)
      {
        case RT_SVG_PAINT:
        case RT_SVG_CLIP_PATH:
        case RT_SVG_SYMBOL:
          report.message(MessageId.RSC_015,
              new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource));
          break;
        case RT_HYPERLINK:
          // if mimeType is null, we should have reported an error already
          if (res.mimeType != null
              && !OPFChecker.isBlessedItemType(res.mimeType, version)
              && !OPFChecker
              .isDeprecatedBlessedItemType(res.mimeType)
              && !res.hasValidItemFallback)
          {
            report.message(MessageId.RSC_010,
                new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource));
          }
          if (/* !res.mimeType.equals("font/opentype") && */!res.inSpine)
          {
            report.message(MessageId.RSC_011,
                new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource));
          }
          break;
        case RT_IMAGE:
          // if mimeType is null, we should have reported an error already
          if (res.mimeType != null
              && !OPFChecker.isBlessedImageType(res.mimeType)
              && !res.hasValidImageFallback)
          {
            report.message(MessageId.MED_003,
                new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber),
                res.mimeType);
          }
          break;
        case RT_STYLESHEET:
          // if mimeType is null, we should have reported an error already

          // Implementations are allowed to process any stylesheet
        // language they desire; so this is an
        // error only if no fallback is available.
        // See also:
        // https://code.google.com/p/epubcheck/issues/detail?id=244

        if (res.mimeType != null
            && !OPFChecker.isBlessedStyleType(res.mimeType)
            && !OPFChecker
                .isDeprecatedBlessedStyleType(res.mimeType)
            && !res.hasValidItemFallback)
        {
          report.message(MessageId.CSS_010,
              new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber),
              res.mimeType);
        }
          break;
      }
    }
    else
    { //if (ref.fragment == null) {
      if (ref.fragment.startsWith("epubcfi("))
      {
        //Issue 150
        return;
      }

      switch (ref.type)
      {
        case RT_HYPERLINK:
          // if mimeType is null, we should have reported an error already
          if (res.mimeType != null
              && !OPFChecker.isBlessedItemType(res.mimeType, version)
              && !OPFChecker
              .isDeprecatedBlessedItemType(res.mimeType)
              && !res.hasValidItemFallback)
          {
            report.message(MessageId.RSC_010,
                new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource + "#" + ref.fragment));
          }
          if (!res.inSpine)
          {
            report.message(MessageId.RSC_011,
                new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource + "#" + ref.fragment));
          }
          break;
        case RT_IMAGE:
          report.message(MessageId.RSC_009,
              new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource + "#" + ref.fragment));
          break;
        case RT_STYLESHEET:
          report.message(MessageId.RSC_013,
              new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource + "#" + ref.fragment));
          break;
      }
      Anchor anchor = res.anchors.get(ref.fragment);
      if (anchor == null)
      {
        report.message(MessageId.RSC_012,
            new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource + "#" + ref.fragment));
      }
      else
      {
        switch (ref.type)
        {
          case RT_SVG_PAINT:
          case RT_SVG_CLIP_PATH:
            if (anchor.type != ref.type)
            {
              report.message(MessageId.RSC_014,
                  new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource + "#" + ref.fragment));
            }
            break;
          case RT_SVG_SYMBOL:
          case RT_HYPERLINK:
            if (anchor.type != ref.type && anchor.type != RT_GENERIC)
            {
              report.message(MessageId.RSC_014,
                  new MessageLocation(ref.resource, ref.lineNumber, ref.columnNumber, ref.refResource + "#" + ref.fragment));
            }
            break;
        }
      }
    }
View Full Code Here

        EpubCSSCheckCSSHandler.ClassUsage cu = localStyleMap.get(key);
        if (cu.Count == 0)
        {

          assert (cu.Name != null && !cu.Name.isEmpty());
          report.message(MessageId.CSS_024, new MessageLocation(getFileName(), cu.Location.getLineNumber(), cu.Location.getColumnNumber(), key));
        }
      }
    }
  }
View Full Code Here

              if (value.length() > 0)
              {
                String styleName = "." + value;
                if (!IncrementLocalCssClassCount(styleName) && !IncrementGlobalCssClassCount(styleName))
                {
                  report.message(MessageId.CSS_025, new MessageLocation(getFileName(), locator.getLineNumber(), locator.getColumnNumber(), styleName));
                }
              }
            }
          }
        }
View Full Code Here

        for (String key : localStyleMap.keySet())
        {
          EpubCSSCheckCSSHandler.ClassUsage cu = localStyleMap.get(key);
          if (cu != null && cu.Count == 0)
          {
            MessageLocation messageLocation = new MessageLocation(cu.FileName, cu.Location.getLineNumber(), cu.Location.getColumnNumber(), key);
            if (cu != null)
            {
              assert (cu.Name != null && !cu.Name.isEmpty());
            }
            assert (key != null && !key.isEmpty());
View Full Code Here

    // the test string will be used to compare test result
    String test = checkNonAsciiFilename(str, report);

    if (str.endsWith("."))
    {
      report.message(MessageId.PKG_011, new MessageLocation(str, 0, 0));
      test += ".";
    }

    boolean spaces = false;
    final char[] ascciGraphic = new char[]{'<', '>', '"', '{', '}', '|',
        '^', '`', '*', '?' /* , ':','/', '\\' */};
    String result = "";
    char[] chars = str.toCharArray();
    for (char c : chars)
    {
      for (char a : ascciGraphic)
      {
        if (c == a)
        {
          result += "\"" + Character.toString(c) + "\",";
          test += Character.toString(c);
        }
      }
      if (Character.isSpaceChar(c))
      {
        spaces = true;
        test += Character.toString(c);
      }
    }
    if (result.length() > 1)
    {
      result = result.substring(0, result.length() - 1);
      report.message(MessageId.PKG_009, new MessageLocation(str, 0, 0), result);
    }
    if (spaces)
    {
      report.message(MessageId.PKG_010, new MessageLocation(str, 0, 0));
    }

    if (version == EPUBVersion.VERSION_3)
    {
      checkCompatiblyEscaped30(str, test, report);
View Full Code Here

    // TODO change this from warning to a compatibility hint message level

    String nonAscii = str.replaceAll("[\\p{ASCII}]", "");
    if (nonAscii.length() > 0)
    {
      report.message(MessageId.PKG_012, new MessageLocation(str, 0, 0), nonAscii);
    }
    return nonAscii;
  }
View Full Code Here

      }
    }
    if (result.length() > 1)
    {
      result = result.substring(0, result.length() - 1);
      report.message(MessageId.PKG_009, new MessageLocation(str, 0, 0), result);
    }
    return test;
  }
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.