Package com.adobe.epubcheck.xml

Examples of com.adobe.epubcheck.xml.XMLElement


    }

    // if the element is <CipherReference>, then the element name
    // is stripped of rootBase, and URLDecoded, and finally put into
    // encryptedItemsSet.
    XMLElement e = parser.getCurrentElement();
    if (e.getName().equals("CipherReference"))
    {
      String algorithm = null;
      XMLElement parent = e.getParent();
      if (parent != null)
      {
        parent = parent.getParent();
        if (parent != null && parent.getName().equals("EncryptedData"))
        {
          algorithm = (String) parent.getPrivateData();
        }
      }
      String entryName = e.getAttribute("URI");
      try
      {
        entryName = URLDecoder.decode(entryName, "UTF-8");
      }
      catch (UnsupportedEncodingException er)
      {
        // UTF-8 is guaranteed to be supported
        throw new InternalError(e.toString());
      }
      if (algorithm == null)
      {
        algorithm = "unknown";
      }
      if (algorithm.equals("http://www.idpf.org/2008/embedding"))
      {
        ocf.setEncryption(entryName, new IDPFFontManglingFilter(null));
      }
      else if (algorithm.equals("http://ns.adobe.com/pdf/enc#RC"))
      {
        ocf.setEncryption(entryName, new AdobeFontManglingFilter(null));
      }
      else
      {
        ocf.setEncryption(entryName, new UnsupportedEncryptionFilter());
      }
    }
    else if (e.getName().equals("EncryptionMethod"))
    {
      String algorithm = e.getAttribute("Algorithm");
      if (algorithm != null)
      {
        XMLElement parent = e.getParent();
        if (parent != null)
        {
          String comp = parent.getAttributeNS(
              "http://ns.adobe.com/digitaleditions/enc",
              "compression");
          if (comp == null)
          {
            parent.setPrivateData(algorithm);
          }
        }
      }
    }
  }
View Full Code Here


    {
      HandlerUtil.checkXMLVersion(parser);
      checkedUnsupportedXmlVersion = true;
    }
    boolean registerEntry = true;
    XMLElement e = parser.getCurrentElement();
    String ns = e.getNamespace();
   
    if (ns == null
        || ns.equals("")
        || ns.equals("http://openebook.org/namespaces/oeb-package/1.0/")
        || ns.equals("http://www.idpf.org/2007/opf"))
    {
      String name = e.getName();
      if (name.equals("package"))
      {
        if (!ns.equals("http://www.idpf.org/2007/opf"))
        {
          report.message(MessageId.OPF_047, new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()));
          opf12PackageFile = true;
        }
        /*
             * This section checks to see the value of the unique-identifier
             * attribute and stores it in the String uniqueIdent or reports
             * an error if the unique-identifier attribute is missing or
             * does not have a value
             */
        String uniqueIdentAttr = e.getAttribute("unique-identifier");
        if (uniqueIdentAttr != null && !uniqueIdentAttr.equals(""))
        {
          uniqueIdent = uniqueIdentAttr;
        }
        else
        {
          report.message(MessageId.OPF_048, new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()));
        }
      }
      else if (name.equals("item"))
      {
        String id = e.getAttribute("id");
        String href = e.getAttribute("href");
        if (href != null
            && !(version == EPUBVersion.VERSION_3 && href
                .matches("^[^:/?#]+://.*"))) {
          try
          {
            href = PathUtil.resolveRelativeReference(path, href,
                null);
          }
          catch (IllegalArgumentException ex)
          {
            report.message(MessageId.OPF_010,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber(), href),
                ex.getMessage());
            href = null;
          }
        }
        if (href != null && href.matches("^[^:/?#]+://.*")) {
       
          report.info(path, FeatureEnum.REFERENCE, href);
        }
        String mimeType = e.getAttribute("media-type");
        String fallback = e.getAttribute("fallback");
       
        // dirty fix for issue 271: treat @fallback attribute in EPUB3 like fallback-style in EPUB2
        // then all the epubcheck mechanisms on checking stylesheet fallbacks will work as in EPUB 2
        String fallbackStyle = (version == EPUBVersion.VERSION_3) ? e.getAttribute("fallback") : e.getAttribute("fallback-style");
       
        String namespace = e.getAttribute("island-type");
        String properties = e.getAttribute("properties");
        if (properties != null)
        {
          properties = properties.replaceAll("[\\s]+", " ");
        }

        if (version == EPUBVersion.VERSION_3
            && href.matches("^[^:/?#]+://.*")
            && !OPFChecker30.isBlessedAudioType(mimeType)
            && !OPFChecker30.isBlessedVideoType(mimeType))
        {
          if (OPFChecker30.isCoreMediaType(mimeType))
          {
            report.message(MessageId.OPF_010,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()), href);
          }
          else
          {
            // mgy 20120414: this shouldn't even be a warning
            // report.warning(
            // path,
            // parser.getLineNumber(),
            // parser.getColumnNumber(),
            // "Remote resource not validated");
          }
        }

        OPFItem item = new OPFItem(id, href, mimeType, fallback,
            fallbackStyle, namespace, properties,
            parser.getLineNumber(), parser.getColumnNumber());

        if (id != null)
        {
          itemMapById.put(id, item);
          report.info(href, FeatureEnum.UNIQUE_IDENT, id);
        }
        else
        {
          System.err.printf("Item is missing id : %s\n", href);
        }
        if (properties != null)
        {
          String propertyArray[] = properties.split(" ");
          for (String aPropertyArray : propertyArray)
          {
            if (aPropertyArray.equals("nav"))
            {
              item.setNav(true);
            }
            if (aPropertyArray.equals("scripted"))
            {
              item.setScripted(true);
            }
          }

        }
        if (href != null && registerEntry)
        {
          itemMapByPath.put(href, item);
          items.add(item);
        }
      }
      else if (name.equals("reference"))
      {
        String type = e.getAttribute("type");
        String title = e.getAttribute("title");
        String href = e.getAttribute("href");
        if (href != null && xrefChecker != null)
        {
          try
          {
            href = PathUtil.resolveRelativeReference(path, href,
                null);
            xrefChecker.registerReference(path,
                parser.getLineNumber(),
                parser.getColumnNumber(), href,
                XRefChecker.RT_GENERIC);
          }
          catch (IllegalArgumentException ex)
          {
            report.message(MessageId.OPF_010,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber(), href), ex.getMessage());
            href = null;
          }
        }
        if (href != null && href.startsWith("http"))
        {
          report.info(path, FeatureEnum.REFERENCE, href);
        }
       
        OPFReference ref = new OPFReference(type, title, href,
            parser.getLineNumber(), parser.getColumnNumber());
        refs.add(ref);
      }
      else if (name.equals("spine"))
      {
        String pageMap = e.getAttribute("page-map");
        if (pageMap != null)
        {
          pageMapId = pageMap;
          pageMapReferenceLocation = new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber(), String.format("page-map=\"%1$s\"", pageMapId));
          report.message(MessageId.OPF_062, pageMapReferenceLocation);
        }

        String idref = e.getAttribute("toc");
        if (idref != null)
        {
          OPFItem toc = itemMapById.get(idref);
          if (toc == null)
          {
            report.message(MessageId.OPF_049,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()),
                idref);
            report.info(null, FeatureEnum.HAS_NCX, "false");
          }
          else
          {
            toc.setNcx(true);
            report.info(toc.getPath(), FeatureEnum.HAS_NCX, "true");
            if (toc.getMimeType() != null
                && !toc.getMimeType().equals(
                "application/x-dtbncx+xml"))
            {
              report.message(MessageId.OPF_050,
                  new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()));
            }
          }
        }
        else
        {
          report.info(null, FeatureEnum.HAS_NCX, "false");
        }
      }
      else if (name.equals("itemref"))
      {
        String idref = e.getAttribute("idref");
        if (idref != null)
        {
          OPFItem item = getItemById(idref);
          if (item != null)
          {
            spine.add(item);
            item.setInSpine(true);
            report.info(item.getPath(), FeatureEnum.IS_SPINEITEM, "true");
            String linear = e.getAttribute("linear");
            if (linear != null && "no".equals(linear.trim()))
            {
              item.setSpineLinear(false);
            }
            else
            {
              item.setSpineLinear(true);
            }
            report.info(item.getPath(), FeatureEnum.IS_LINEAR, String.valueOf(item.getSpineLinear()));

            boolean isFixed = globalPrePaginated;
            String properties = e.getAttribute("properties");
            if (properties != null && !properties.equals(""))
            {
              properties = properties.replaceAll("[\\s]+", " ");
              String propertyArray[] = properties.split(" ");
              for (String prop : propertyArray)
              {
                if (prop.equals("rendition:layout-pre-paginated"))
                {
                  isFixed = true;
                }
                else if (prop.equals("rendition:layout-reflowable"))
                {
                  isFixed = false;
                }
              }
            }
            if (isFixed)
            {
              report.info(item.getPath(), FeatureEnum.HAS_FIXED_LAYOUT, String.valueOf(true));
            }
          }
          else
          {
            report.message(MessageId.OPF_049,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()),
                idref);
          }
        }
      }
      else if (name.equals("dc-metadata") || name.equals("x-metadata"))
      {
        if (!opf12PackageFile)
        {
          report.message(MessageId.OPF_049,
              new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()),
              name);
        }
      }
    }
    else if (ns.equals("http://purl.org/dc/elements/1.1/"))
    {
      // in the DC metadata, when the <identifier> element is parsed, if
      // it has a non-null and non-empty id attribute value that is the
      // same as the value of the unique-identifier attribute of the
      // package element, set uniqueIdentExists = true (to make sure that
      // the unique-identifier attribute references an existing
      // <identifier> id attribute
      String name = e.getName();
      if (name.equals("identifier"))
      {
        String idAttr = e.getAttribute("id");
        if (idAttr != null && !idAttr.equals("")
            && idAttr.equals(uniqueIdent))
        {
          uniqueIdentExists = true;
        }
      }
      else if (name.equals("creator"))
      {
        String role = e.getAttributeNS("http://www.idpf.org/2007/opf", "role");
        if (role != null && !role.equals("") && !isValidRole(role))
        {
          report.message(MessageId.OPF_052,
              new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()), role);
        }
View Full Code Here

  }

  public void endElement()
  {

    XMLElement e = parser.getCurrentElement();
    if ("http://www.idpf.org/2007/opf".equals(e.getNamespace()))
    {
      String name = e.getName();
      // <meta property="dcterms:modified">2012-02-27T16:38:35Z</meta>
      // <meta property="rendition:layout">pre-paginated</meta>
      if ("meta".equals(name))
      {
        String attr = e.getAttribute("property");
        if ("dcterms:modified".equals(attr))
        {
          String val = (String) e.getPrivateData();
                    report.info(null, FeatureEnum.MODIFIED_DATE, val);
        }
        else if ("rendition:layout".equals(attr))
        {
          String val = (String) e.getPrivateData();
          if ("pre-paginated".equals(val))
          {
            report.info(null, FeatureEnum.HAS_FIXED_LAYOUT,
                "pre-paginated");
            globalPrePaginated = true;
          }
        }
        else
        {
          String attr1 = e.getAttribute("name");
          if ("fixed-layout".equals(attr1)
              && "true".equals(e.getAttribute("content")))
          {
            report.info(null, FeatureEnum.HAS_FIXED_LAYOUT,
                "fixed-layout");
          }
        }
      }
      else if ("package".equals(name))
      {
        if(pageMapId != null)
        {
          if (null == itemMapById.get(pageMapId))
          {
            report.message(MessageId.OPF_063, pageMapReferenceLocation, pageMapId);
          }
        }
      }
    }
    else if (e.getNamespace().equals("http://purl.org/dc/elements/1.1/"))
    {
      String name = e.getName();
      if (name.equals("identifier"))
      {
        String idAttr = e.getAttribute("id");
        if (idAttr != null && !idAttr.equals("")
            && idAttr.equals(uniqueIdent))
        {
          String idval = (String) e.getPrivateData();
          // if (idval != null && ocf != null)
          // ocf.setUniqueIdentifier(idval);
          if (idval != null)
          {
            report.info(null, FeatureEnum.UNIQUE_IDENT,
                idval.trim());
          }
        }
      }
      else if (name.equals("date"))
      {
        String dateval = (String) e.getPrivateData();
        boolean valid = true;
        String detail = null;

        if (dateval == null || "".equals(dateval))
        {
          valid = false;
          detail = "zero-length string";
        }
        else
        {
          DateParser dateParser = new DateParser();
          try
          {
            Date date = dateParser.parse(dateval.trim());
            /*
                   * mg: DateParser does not enforce four-digit years,
                   * which http://www.w3.org/TR/NOTE-datetime seems to
                   * want
                   */
            String year = new SimpleDateFormat("yyyy").format(date);
            if (year.length() > 4)
            {
              throw new InvalidDateException(year);
            }
            report.info(null, FeatureEnum.DC_DATE, dateval);
          }
          catch (InvalidDateException d)
          {
            valid = false;
            detail = d.getMessage();
          }
        }

        if (!valid)
        {
          if (this.version == EPUBVersion.VERSION_3)
          {
            report.message(MessageId.OPF_053,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()),
                (dateval == null ? "" : dateval),
                detail);
          }
          else
          {
            report.message(MessageId.OPF_054,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()),
                (dateval == null ? "" : dateval),
                detail);
          }
        }
      }
      else if (name.equals("title") || name.equals("language"))
      {
        // issue 138: issue a warning if dc:title and dc:language is
        // empty for 2.0 and 2.0.1
        // note that an empty dc:identifier is checked in opf20.rng and
        // will
        // therefore be reported as an error, that may or may not be a
        // good idea.
        if ("language".equals(name))
        {
          String value = (String) e.getPrivateData();
          if (value != null)
          {
            report.info(null, FeatureEnum.DC_LANGUAGE, value.trim());
          }
        }
        else if ("title".equals(name))
        {
          String value = (String) e.getPrivateData();
          if (value != null)
          {
            report.info(null, FeatureEnum.DC_TITLE, value.trim());
          }
        }
        if (version == EPUBVersion.VERSION_2)
        {
          String value = (String) e.getPrivateData();
          if (value == null || value.trim().length() < 1)
          {
            report.message(MessageId.OPF_055,
                new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()),
                name);
          }
        }
      }
      else if (name.equals("creator"))
      {
        String value = (String) e.getPrivateData();
        if (value != null)
        {
          report.info(null, FeatureEnum.DC_CREATOR, value.trim());
        }
      }
      else if (name.equals("contributor"))
      {
        String value = (String) e.getPrivateData();
        if (value != null)
        {
          report.info(null, FeatureEnum.DC_CONTRIBUTOR, value.trim());
        }
      }
      else if (name.equals("publisher"))
      {
        String value = (String) e.getPrivateData();
        if (value != null)
        {
          report.info(null, FeatureEnum.DC_PUBLISHER, value.trim());
        }
      }
      else if (name.equals("rights"))
      {
        String value = (String) e.getPrivateData();
        if (value != null)
        {
          report.info(null, FeatureEnum.DC_RIGHTS, value.trim());
        }
      }
      else if (name.equals("subject"))
      {
        String value = (String) e.getPrivateData();
        if (value != null)
        {
          report.info(null, FeatureEnum.DC_SUBJECT, value.trim());
        }
      }
      else if (name.equals("description"))
      {
        String value = (String) e.getPrivateData();
        if (value != null)
        {
          report.info(null, FeatureEnum.DC_DESCRIPTION, value.trim());
        }
      }
View Full Code Here

  }

  public void characters(char[] chars, int start, int len)
  {

    XMLElement e = parser.getCurrentElement();
    String name = e.getName();
    String ns = e.getNamespace();
    boolean keepValue = ("http://www.idpf.org/2007/opf".equals(ns) && "meta".equals(name))
        || "http://purl.org/dc/elements/1.1/".equals(ns);
    if (keepValue)
    {
      String val = (String) e.getPrivateData();
      String text = new String(chars, start, len);
      if (val == null)
      {
        val = text;
      }
      else
      {
        val = val + text;
      }
      e.setPrivateData(val);
    }
  }
View Full Code Here

    {
      HandlerUtil.checkXMLVersion(parser);
      checkedUnsupportedXmlVersion = true;
    }

    XMLElement e = parser.getCurrentElement();
    String ns = e.getNamespace();
    if (e.getName().equals("rootfile") && ns != null
        && ns.equals("urn:oasis:names:tc:opendocument:xmlns:container"))
    {
      String mediaType = (e.getAttribute("media-type") != null) ? e.getAttribute("media-type").trim() : "unknown";
      String fullPath = e.getAttribute("full-path");
      if (!entries.containsKey(mediaType))
      {
        entries.put(mediaType, new LinkedList<String>());
      }
      entries.get(mediaType).add(fullPath);
View Full Code Here

  }

  public void startElement()
  {
    openElements++;
    XMLElement e = parser.getCurrentElement();
    ElementLocation currentLocation = new ElementLocation(parser.getLineNumber(), parser.getColumnNumber());
    elementLocationStack.push(currentLocation);

    if (!checkedUnsupportedXMLVersion)
    {
      HandlerUtil.checkXMLVersion(parser);
      checkedUnsupportedXMLVersion = true;
    }

    String id = e.getAttribute("id");

    String baseTest = e.getAttributeNS(XMLConstants.XML_NS_URI, "base");
    if (baseTest != null)
    {
      base = baseTest;
    }

    if (!epubTypeInUse)
    {
      String eNS = e.getAttributeNS(EpubConstants.EpubTypeNamespaceUri, "type");
      if (eNS != null)
      {
        epubTypeInUse = true;
      }
    }

    String ns = e.getNamespace();
    String name = e.getName().toLowerCase();
    int resourceType = XRefChecker.RT_GENERIC;
    if (ns != null)
    {
      if (ns.equals("http://www.w3.org/2000/svg"))
      {
        if (name.equals("lineargradient")
            || name.equals("radialgradient")
            || name.equals("pattern"))
        {
          resourceType = XRefChecker.RT_SVG_PAINT;
        }
        else if (name.equals("clippath"))
        {
          resourceType = XRefChecker.RT_SVG_CLIP_PATH;
        }
        else if (name.equals("symbol"))
        {
          resourceType = XRefChecker.RT_SVG_SYMBOL;
        }
        else if (name.equals("a"))
        {
          checkHRef(e, "http://www.w3.org/1999/xlink", "href");
        }
        else if (name.equals("use"))
        {
          checkSymbol(e, "http://www.w3.org/1999/xlink", "href");
        }
        else if (name.equals("image"))
        {
          checkImage(e, "http://www.w3.org/1999/xlink", "href");
        }
        checkPaint(e, "fill");
        checkPaint(e, "stroke");
      }
      else if (ns.equals(EpubConstants.HtmlNamespaceUri))
      {
        if (name.equals("a"))
        {
          checkHRef(e, null, "href");
        }
        else if (name.equals("img"))
        {
          checkImage(e, null, "src");
        }
        else if (name.equals("object"))
        {
          checkObject(e, null, "data");
        }
        else if (name.equals("link"))
        {
          checkLink(e, null, "href");
        }
        else if (name.equals("base"))
        {
          base = e.getAttribute("href");
        }
        else if (name.equals("style"))
        {
          textNode = new StringBuilder();
        }
        else if (name.equals("iframe"))
        {
          checkIFrame(e);
        }
        else if (name.equals("table"))
        {
          ++tableDepth;
        }
        else if (name.equals("th") && tableDepth > 0)
        {
          hasTh = true;
        }
        else if (name.equals("thead") && tableDepth > 0)
        {
          hasThead = true;
        }
        else if (name.equals("caption") && tableDepth > 0)
        {
          hasCaption = true;
        }
        else if (name.equals("i") || name.equals("b") || name.equals("em") || name.equals("strong"))
        {
          checkBoldItalics(e);
        }

        resourceType = XRefChecker.RT_HYPERLINK;

        String style = e.getAttribute("style");
        if (style != null && style.length() > 0)
        {
          CSSCheckerFactory.getInstance().newInstance(
              ocf, report, style, true, path,
              currentLocation.getLineNumber(),
View Full Code Here

  }

  public void endElement()
  {
    openElements--;
    XMLElement e = parser.getCurrentElement();
    String ns = e.getNamespace();
    String name = e.getName();

    if (openElements == 0)
    {
      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))
    {
View Full Code Here

  public void startElement()
  {
    super.startElement();

    XMLElement e = parser.getCurrentElement();
    String name = e.getName();

    if (name.equals("html"))
    {
      Map<String, Vocab> reserved = (this.pubTypes.contains(OPFData.DC_TYPE_EDUPUB)) ? RESERVED_EDUPUB_VOCABS
          : RESERVED_VOCABS;
      vocabs = VocabUtil.parsePrefixDeclaration(
          e.getAttributeNS(EpubConstants.EpubTypeNamespaceUri, "prefix"), reserved,
          KNOWN_VOCAB_URIS, DEFAULT_VOCAB_URIS, report,
          new MessageLocation(path, parser.getLineNumber(), parser.getColumnNumber()));
    }
    else if (name.equals("link"))
    {
      processLink(e);
    }
    else if (name.equals("object"))
    {
      processObject(e);
    }
    else if (name.equals("math"))
    {
      propertiesSet.add(ITEM_PROPERTIES.MATHML);
      inMathML = true;
      hasAltorAnnotation = (null != e.getAttribute("alttext"));
    }
    else if (!mimeType.equals("image/svg+xml") && name.equals("svg"))
    {
      propertiesSet.add(ITEM_PROPERTIES.SVG);
      processStartSvg(e);
    }
    else if (name.equals("script"))
    {
      propertiesSet.add(ITEM_PROPERTIES.SCRIPTED);
    }
    else if (!mimeType.equals("image/svg+xml") && name.equals("switch"))
    {
      propertiesSet.add(ITEM_PROPERTIES.SWITCH);
    }
    else if (name.equals("audio"))
    {
      processAudio();
    }
    else if (name.equals("video"))
    {
      processVideo(e);
    }
    else if (name.equals("canvas"))
    {
      processCanvas();
    }
    else if (name.equals("img"))
    {
      processImg();
    }
    else if (name.equals("a"))
    {
      anchorNeedsText = true;
      processAnchor(e);
    }
    else if (name.equals("annotation-xml"))
    {
      hasAltorAnnotation = true;
    }

    processInlineScripts(e);

    processSrc(("source".equals(name)) ? e.getParent().getName() : name, e.getAttribute("src"));

    checkType(e.getAttributeNS(EpubConstants.EpubTypeNamespaceUri, "type"));

    checkSSMLPh(e.getAttributeNS("http://www.w3.org/2001/10/synthesis", "ph"));
  }
View Full Code Here

  @Override
  public void endElement()
  {
    super.endElement();
    XMLElement e = parser.getCurrentElement();
    String name = e.getName();
    if (openElements == 0 && (name.equals("html") || name.equals("svg")))
    {
      checkProperties();
    }
    else if (name.equals("object"))
View Full Code Here

  public void startElement()
  {
    super.startElement();

    XMLElement e = parser.getCurrentElement();
    String name = e.getName();

    if (name.equals("package"))
    {
      // Note: the #parsePrefixDeclaration is called once for each "class" of
      // properties (meta+scheme, itemref, item, and link) so that default and
      // reserved vocabs can be set appropriately (e.g. the default vocab or
      // rendition vocab for 'meta' properties is not the same as for the 'item'
      // properties)
      // Messages are reported only on the first invocation; a quiet reporter is
      // used for subsequent invocations.
      String prefixDecl = e.getAttribute("prefix");
      MessageLocation loc = new MessageLocation(path, parser.getLineNumber(),
          parser.getColumnNumber());
      metaVocabs = VocabUtil.parsePrefixDeclaration(prefixDecl, RESERVED_META_VOCABS,
          KNOWN_META_VOCAB_URIS, DEFAULT_VOCAB_URIS, report, loc);
      itemVocabs = VocabUtil.parsePrefixDeclaration(prefixDecl, RESERVED_ITEM_VOCABS,
          KNOWN_ITEM_VOCAB_URIS, DEFAULT_VOCAB_URIS, QuietReport.INSTANCE, loc);
      itemrefVocabs = VocabUtil.parsePrefixDeclaration(prefixDecl, RESERVED_ITEMREF_VOCABS,
          KNOWN_ITEMREF_VOCAB_URIS, DEFAULT_VOCAB_URIS, QuietReport.INSTANCE, loc);
      linkrelVocabs = VocabUtil.parsePrefixDeclaration(prefixDecl, RESERVED_LINKREL_VOCABS,
          KNOWN_LINKREL_VOCAB_URIS, DEFAULT_VOCAB_URIS, QuietReport.INSTANCE, loc);
    }
    else if (name.equals("meta"))
    {
      processMeta(e);
    }
    else if (name.equals("link"))
    {
      processLink(e);
    }
    else if (name.equals("item"))
    {
      processItemProperties(e.getAttribute("properties"), e.getAttribute("media-type"));
    }
    else if (name.equals("itemref"))
    {
      processItemrefProperties(e.getAttribute("properties"));
    }
    else if (name.equals("mediaType"))
    {
      processBinding(e);
    }
View Full Code Here

TOP

Related Classes of com.adobe.epubcheck.xml.XMLElement

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.