org.daisy.zedval.engine
Class NcxFile

java.lang.Object
  extended byjava.io.File
      extended byorg.daisy.zedval.engine.ZedFile
          extended byorg.daisy.zedval.engine.ManifestFile
              extended byorg.daisy.zedval.engine.XmlFile
                  extended byorg.daisy.zedval.engine.NcxFile
All Implemented Interfaces:
java.lang.Comparable, org.xml.sax.ContentHandler, org.xml.sax.DTDHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, org.xml.sax.ext.LexicalHandler, Referring, java.io.Serializable

public class NcxFile
extends XmlFile

An NcxFile object represents a DTB navigation control file

Author:
James Pritchett, Markus Gylling
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.daisy.zedval.engine.ManifestFile
MIME_JPEG, MIME_MP3, MIME_NCX, MIME_PACKAGE, MIME_PNG, MIME_RESOURCE, MIME_SMIL, MIME_SVG, MIME_TEXT, MIME_WAV, MIME_AAC
 
Fields inherited from class java.io.File
pathSeparator, pathSeparatorChar, separator, separatorChar
 
Constructor Summary
NcxFile(java.lang.String fullPath, java.lang.String id, java.lang.String mimeType)
           
 
Method Summary
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
          Looks for end of all elements to keep track of actual NCX depth
 java.lang.Integer expectedDepth()
          Returns the actual depth of heading nesting for this NCX
 int expectedMaxPageNormal()
          Returns the actual maximum page-normal value
 int expectedMaxPageNumber()
          Returns the actual maxPageNumber (see z2005 meta dtb:maxPageNumber)
 int expectedPageFront()
          Returns the actual number of front pages
 int expectedPageNormal()
          Returns the actual number of normal pages
 int expectedPageSpecial()
          Returns the actual number of special pages
 java.util.HashMap getAudioFileRefs()
          Returns a HashMap of all audio files referenced by this file
 java.util.HashMap getContentFileRefs()
          Returns a HashMap of all content files referenced by this file
 java.lang.Integer getDepth()
          Returns the declared depth of heading nesting for this NCX (value of dtb:depth metadata item)
 java.util.HashMap getFileRefs()
          Returns a HashMap of all files referenced by this file
 java.util.HashMap getImageFileRefs()
          Returns a HashMap of all image files referenced by this file
 int getMaxPageNormal()
          Returns the declared maximum page-normal value (value of dtb:maxPageNormal metadata item)
 int getMaxPageNumber()
          Returns the declared maxPageNumber (see z2005 meta dtb:maxPageNumber)
 int getPageFront()
          Returns the declared number of front pages (value of dtb:pageFront metadata item)
 int getPageNormal()
          Returns the declared number of normal pages (value of dtb:pageNormal metadata item)
 int getPageSpecial()
          Returns the declared number of special pages (value of dtb:pageSpecial metadata item)
 java.util.Set getSmilCustomTestElements()
           
 java.lang.String getUid()
          Returns the declared unique identifier value for this NCX (value of "dtb:uid" metadata item)
 boolean isValidDepth()
          Is the declared Depth value correct?
 boolean isValidPageFront()
          Is the declared PageFront value correct?
 boolean isValidPageNormal()
          Is the declared PageNormal value correct?
 boolean isValidPageSpecial()
          Is the declared PageSpecial value correct?
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
          Grabs all incoming elements and looks for properties to set
 java.lang.String toString()
           
 
Methods inherited from class org.daisy.zedval.engine.XmlFile
characters, comment, endCDATA, endDocument, endDTD, endEntity, endPrefixMapping, error, fatalError, getAllValidationErrors, getDoctypeName, getDoctypePublicId, getDoctypeSystemId, getRootElementLocalName, getRootElementNsURI, getValidationErrors, getValidationFatalErrors, getValidationWarnings, getXmlFileElementById, getXmlFileElements, hasIDValue, ignorableWhitespace, initialize, isParsed, isValid, isValidated, isWellFormed, notationDecl, processingInstruction, resolveEntity, setDocumentLocator, skippedEntity, startCDATA, startDocument, startDTD, startEntity, startPrefixMapping, unparsedEntityDecl, warning
 
Methods inherited from class org.daisy.zedval.engine.ManifestFile
getId, getMimeType, getPackage, setID, setMimeType, setPackage
 
Methods inherited from class org.daisy.zedval.engine.ZedFile
getName
 
Methods inherited from class java.io.File
canRead, canWrite, compareTo, compareTo, createNewFile, createTempFile, createTempFile, delete, deleteOnExit, equals, exists, getAbsoluteFile, getAbsolutePath, getCanonicalFile, getCanonicalPath, getParent, getParentFile, getPath, hashCode, isAbsolute, isDirectory, isFile, isHidden, lastModified, length, list, list, listFiles, listFiles, listFiles, listRoots, mkdir, mkdirs, renameTo, setLastModified, setReadOnly, toURI, toURL
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NcxFile

public NcxFile(java.lang.String fullPath,
               java.lang.String id,
               java.lang.String mimeType)
Parameters:
id - id from package file manifest
fullPath - File path
mimeType - File MIME type as given in package manifest
Method Detail

getMaxPageNormal

public int getMaxPageNormal()
Returns the declared maximum page-normal value (value of dtb:maxPageNormal metadata item)

Returns:
the declared maximum page-normal value (value of dtb:maxPageNormal metadata item)

expectedMaxPageNormal

public int expectedMaxPageNormal()
Returns the actual maximum page-normal value

Returns:
the actual maximum page-normal value

getPageFront

public int getPageFront()
Returns the declared number of front pages (value of dtb:pageFront metadata item)

Returns:
the declared number of front pages (value of dtb:pageFront metadata item)

expectedPageFront

public int expectedPageFront()
Returns the actual number of front pages

Returns:
the actual number of front pages

isValidPageFront

public boolean isValidPageFront()
Is the declared PageFront value correct?

Returns:
true if so

getPageNormal

public int getPageNormal()
Returns the declared number of normal pages (value of dtb:pageNormal metadata item)

Returns:
the declared number of normal pages (value of dtb:pageNormal metadata item)

expectedPageNormal

public int expectedPageNormal()
Returns the actual number of normal pages

Returns:
the actual number of normal pages

getMaxPageNumber

public int getMaxPageNumber()
Returns the declared maxPageNumber (see z2005 meta dtb:maxPageNumber)

Returns:
the declared maxPageNumber value

expectedMaxPageNumber

public int expectedMaxPageNumber()
Returns the actual maxPageNumber (see z2005 meta dtb:maxPageNumber)

Returns:
the actual maxPageNumber value

isValidPageNormal

public boolean isValidPageNormal()
Is the declared PageNormal value correct?

Returns:
true if so

getPageSpecial

public int getPageSpecial()
Returns the declared number of special pages (value of dtb:pageSpecial metadata item)

Returns:
the declared number of special pages (value of dtb:pageSpecial metadata item)

expectedPageSpecial

public int expectedPageSpecial()
Returns the actual number of special pages

Returns:
the actual number of special pages

isValidPageSpecial

public boolean isValidPageSpecial()
Is the declared PageSpecial value correct?

Returns:
true if so

getDepth

public java.lang.Integer getDepth()
Returns the declared depth of heading nesting for this NCX (value of dtb:depth metadata item)

Returns:
The declared depth of heading nesting for this NCX (value of dtb:depth metadata item)

expectedDepth

public java.lang.Integer expectedDepth()
Returns the actual depth of heading nesting for this NCX

Returns:
The actual depth of heading nesting for this NCX

isValidDepth

public boolean isValidDepth()
Is the declared Depth value correct?

Returns:
true if so

getUid

public java.lang.String getUid()
Returns the declared unique identifier value for this NCX (value of "dtb:uid" metadata item)

Returns:
The declared unique identifier value for this NCX (value of "dtb:uid" metadata item)

getFileRefs

public java.util.HashMap getFileRefs()
Returns a HashMap of all files referenced by this file

Returns:
A HashMap of File objects (key = absolute path)

getContentFileRefs

public java.util.HashMap getContentFileRefs()
Returns a HashMap of all content files referenced by this file

Returns:
A HashMap of File objects (key = absolute path)

getAudioFileRefs

public java.util.HashMap getAudioFileRefs()
Returns a HashMap of all audio files referenced by this file

Returns:
A HashMap of File objects (key = absolute path)

getImageFileRefs

public java.util.HashMap getImageFileRefs()
Returns a HashMap of all image files referenced by this file

Returns:
A HashMap of File objects (key = absolute path)

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
Grabs all incoming elements and looks for properties to set

Specified by:
startElement in interface org.xml.sax.ContentHandler
Overrides:
startElement in class XmlFile
Parameters:
namespaceURI - The namespace URI of the element
localName - The non-prefixed name of the element
qName - The qualified name of the element
atts - List of all element attributes

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
Looks for end of all elements to keep track of actual NCX depth

Specified by:
endElement in interface org.xml.sax.ContentHandler
Overrides:
endElement in class XmlFile
Parameters:
namespaceURI - The namespace URI of the element
localName - The non-prefixed name of the element
qName - The qualified name of the element

getSmilCustomTestElements

public java.util.Set getSmilCustomTestElements()
Returns:
a Set<XmlFileElement> of all NCX elements with local name "smilCustomTest"

toString

public java.lang.String toString()
Overrides:
toString in class XmlFile