Class XmlReportAbstract

java.lang.Object
com.adobe.epubcheck.api.MasterReport
com.adobe.epubcheck.util.XmlReportAbstract
All Implemented Interfaces:
LocalizableReport, Report
Direct Known Subclasses:
XmlReportImpl, XmpReportImpl

public abstract class XmlReportAbstract extends MasterReport
Abstract class to generate a report in XML. It collects the information needed for the report and provides helper methods to generate proper XML. In order to generate a specific XML, the generateReport method should be provided in a derived class.
  • Field Details

    • out

      protected PrintWriter out
    • epubCheckName

      protected String epubCheckName
    • epubCheckVersion

      protected String epubCheckVersion
    • epubCheckDate

      protected String epubCheckDate
    • generationDate

      protected String generationDate
    • creationDate

      protected String creationDate
    • lastModifiedDate

      protected String lastModifiedDate
    • identifier

      protected String identifier
    • titles

      protected Set<String> titles
    • creators

      protected final Set<String> creators
    • contributors

      protected final Set<String> contributors
    • subjects

      protected final Set<String> subjects
    • publisher

      protected String publisher
    • rights

      protected final Set<String> rights
    • date

      protected String date
    • mediaTypes

      protected final Set<String> mediaTypes
    • formatName

      protected String formatName
    • formatVersion

      protected String formatVersion
    • pagesCount

      protected long pagesCount
    • charsCount

      protected long charsCount
    • language

      protected String language
    • embeddedFonts

      protected final Set<String> embeddedFonts
    • refFonts

      protected final Set<String> refFonts
    • references

      protected final Set<String> references
    • hasEncryption

      protected boolean hasEncryption
    • hasSignatures

      protected boolean hasSignatures
    • hasAudio

      protected boolean hasAudio
    • hasVideo

      protected boolean hasVideo
    • hasFixedLayout

      protected boolean hasFixedLayout
    • hasScripts

      protected boolean hasScripts
    • warns

      protected final List<CheckMessage> warns
    • errors

      protected final List<CheckMessage> errors
    • fatalErrors

      protected final List<CheckMessage> fatalErrors
    • hints

      protected final List<CheckMessage> hints
    • doc

      private Document doc
    • currentEl

      private Element currentEl
    • namespaceURI

      private String namespaceURI
    • namespaces

      private Map<String,String> namespaces
  • Constructor Details

  • Method Details

    • initialize

      public void initialize()
      Description copied from interface: Report
      Called when a report if first created
    • close

      public void close()
      Specified by:
      close in interface Report
      Overrides:
      close in class MasterReport
    • message

      public void message(Message message, EPUBLocation location, Object... args)
      Description copied from interface: Report
      Called when a violation of the standard is found in epub.
      Parameters:
      message - The message being reported
      location - location information for the message
      args - Arguments referenced by the format string for the message.
    • info

      public void info(String resource, FeatureEnum feature, String value)
      Description copied from interface: Report
      Called when when a feature is found in epub.
      Parameters:
      resource - name of the resource in the epub zip container that has this feature or null if the feature is on the container level.
      feature - a keyword to know what kind of feature has been found
      value - value found
    • getNameFromPath

      protected String getNameFromPath(String path)
    • generateReport

      public abstract int generateReport()
      Method to implement effective report generation.
      Returns:
      errorCode
    • setNamespace

      public void setNamespace(String uri)
    • addPrefixNamespace

      public void addPrefixNamespace(String prefix, String uri)
    • generate

      public int generate()
      Description copied from interface: Report
      Called to create a report after the checks have been made
    • capitalize

      protected String capitalize(String in)
    • makeElement

      private Element makeElement(String name)
    • makeAttribute

      private Attr makeAttribute(KeyValue<String,String> kv)
    • startElement

      protected void startElement(String name, List<KeyValue<String,String>> attrs)
    • startElement

      protected void startElement(String name, KeyValue<String,String>... attrs)
    • startElement

      protected void startElement(String name)
    • endElement

      protected void endElement(String name)
    • generateElement

      protected void generateElement(String name, String value)
    • generateElement

      protected void generateElement(String name, String value, KeyValue<String,String>... attrs)
    • generateElement

      protected void generateElement(String name, String value, List<KeyValue<String,String>> attrs)
    • correctToUtf8

      protected static String correctToUtf8(String inputString)
      Make sure the string contains valid UTF-8 characters
      Parameters:
      inputString -
      Returns:
      escaped String
    • fromTime

      protected static String fromTime(long time)
      Transform time into ISO 8601 string.