Class VocabUtil

java.lang.Object
com.adobe.epubcheck.vocab.VocabUtil

public final class VocabUtil extends Object
Utilities related to property values, vocabularies, and prefix declarations.
  • Field Details

    • EMPTY_VOCAB

      public static Vocab EMPTY_VOCAB
    • propertyPattern

      private static Pattern propertyPattern
    • whitespaceSplitter

      private static com.google.common.base.Splitter whitespaceSplitter
  • Constructor Details

    • VocabUtil

      private VocabUtil()
  • Method Details

    • parseProperty

      public static com.google.common.base.Optional<Property> parseProperty(String value, Map<String,Vocab> vocabs, ValidationContext context, EPUBLocation location)
      Parses a single property value and report validation errors on the fly.
      Parameters:
      value - the value to parse.
      vocabs - a map of prefix to vocabularies.
      context - the validation context (report, locale, path, etc).
      location - the location in the validated file.
      Returns:
      an Optional containing the property if it was parsed successfully or nothing if there was a parsing error
    • parsePropertyList

      public static Set<Property> parsePropertyList(String value, Map<String, ? extends Vocab> vocabs, ValidationContext context, EPUBLocation location)
      Parses a space-separated list of property values, and report validation errors on the fly.
      Parameters:
      value - the value to parse.
      vocabs - a map of prefix to vocabularies.
      context - the validation context (report, locale, path, etc).
      location - the location in the validated file.
      Returns:
    • parseProperties

      private static Set<Property> parseProperties(String value, Map<String, ? extends Vocab> vocabs, boolean isList, ValidationContext context, EPUBLocation location)
    • parsePrefixDeclaration

      public static Map<String,Vocab> parsePrefixDeclaration(String value, Map<String, ? extends Vocab> predefined, Map<String, ? extends Vocab> known, Set<String> forbidden, Report report, EPUBLocation location)
      Parses a prefix attribute value and returns a map of prefixes to vocabularies, given a pre-existing set of reserved prefixes, known vocabularies, and default vocabularies that cannot be re-declared.
      Parameters:
      value - the prefix declaration to parse.
      predefined - a map of reserved prefixes to associated vocabularies.
      known - a map of known URIs to known vocabularies.
      forbidden - a set of URIs of default vocabularies that cannot be re-declared.
      report - to report errors on the fly.
      location - the location of the attribute in the source file.
      Returns: