org.daisy.zedval.engine
Class SvgFile

java.lang.Object
  extended byjava.io.File
      extended byorg.daisy.zedval.engine.ZedFile
          extended byorg.daisy.zedval.engine.ManifestFile
              extended byorg.daisy.zedval.engine.ImageFile
                  extended byorg.daisy.zedval.engine.SvgFile
All Implemented Interfaces:
java.lang.Comparable, org.xml.sax.ContentHandler, org.xml.sax.EntityResolver, org.xml.sax.ErrorHandler, java.io.Serializable

public class SvgFile
extends ImageFile
implements org.xml.sax.ContentHandler, org.xml.sax.ErrorHandler, org.xml.sax.EntityResolver

An SvgFile object represents a single DTB SVG image 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
SvgFile(java.lang.String fullPath, java.lang.String id, java.lang.String mimeType)
           
 
Method Summary
 void characters(char[] ch, int start, int length)
           
 void endDocument()
           
 void endElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName)
           
 void endPrefixMapping(java.lang.String prefix)
           
 void error(org.xml.sax.SAXParseException e)
           
 void fatalError(org.xml.sax.SAXParseException e)
           
 java.util.Collection getValidationErrors()
           
 java.util.Collection getValidationFatalErrors()
           
 java.util.Collection getValidationWarnings()
           
 void ignorableWhitespace(char[] ch, int start, int length)
           
 void initialize()
          Does all basic integrity tests (existence, readability, format) and sets properties
 boolean isParsed()
          Has this file been parsed?
 boolean isValid()
          Is this file valid to the DTD?
 boolean isValidated()
          Has this file been parsed with validation on?
 boolean isWellFormed()
          Is this file well-formed XML?
 void processingInstruction(java.lang.String target, java.lang.String data)
           
 org.xml.sax.InputSource resolveEntity(java.lang.String publicId, java.lang.String systemId)
           
 void setDocumentLocator(org.xml.sax.Locator locator)
           
 void skippedEntity(java.lang.String name)
           
 void startDocument()
           
 void startElement(java.lang.String namespaceURI, java.lang.String localName, java.lang.String qName, org.xml.sax.Attributes atts)
           
 void startPrefixMapping(java.lang.String prefix, java.lang.String uri)
           
 void warning(org.xml.sax.SAXParseException e)
           
 
Methods inherited from class org.daisy.zedval.engine.ImageFile
doesMatchFormat
 
Methods inherited from class org.daisy.zedval.engine.ManifestFile
getId, getMimeType, getPackage, setID, setMimeType, setPackage, toString
 
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

SvgFile

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

initialize

public void initialize()
                throws ZedFileInitializationException
Does all basic integrity tests (existence, readability, format) and sets properties

Overrides:
initialize in class ImageFile
Throws:
ZedFileInitializationException

isWellFormed

public boolean isWellFormed()
Is this file well-formed XML?

Returns:
true if wellformed, false if malformed OR not yet parsed

isValid

public boolean isValid()
Is this file valid to the DTD?

Returns:
true if valid, false if invalid OR not yet parsed OR malformed

isParsed

public boolean isParsed()
Has this file been parsed?

Returns:
true if has been parsed, false otherwise

isValidated

public boolean isValidated()
Has this file been parsed with validation on?

Returns:
true if has been parsed with validation on, false otherwise

startElement

public void startElement(java.lang.String namespaceURI,
                         java.lang.String localName,
                         java.lang.String qName,
                         org.xml.sax.Attributes atts)
Specified by:
startElement in interface org.xml.sax.ContentHandler

error

public void error(org.xml.sax.SAXParseException e)
Specified by:
error in interface org.xml.sax.ErrorHandler

warning

public void warning(org.xml.sax.SAXParseException e)
Specified by:
warning in interface org.xml.sax.ErrorHandler

fatalError

public void fatalError(org.xml.sax.SAXParseException e)
Specified by:
fatalError in interface org.xml.sax.ErrorHandler

resolveEntity

public org.xml.sax.InputSource resolveEntity(java.lang.String publicId,
                                             java.lang.String systemId)
                                      throws org.xml.sax.SAXException,
                                             java.io.IOException
Specified by:
resolveEntity in interface org.xml.sax.EntityResolver
Throws:
org.xml.sax.SAXException
java.io.IOException

getValidationErrors

public java.util.Collection getValidationErrors()
Returns:
an empty or non-empty collection of SAXParseExceptions caught via the SAX Errhandler error method
See Also:
isValid()

getValidationFatalErrors

public java.util.Collection getValidationFatalErrors()
Returns:
an empty or non-empty collection of SAXParseExceptions caught via the SAX Errhandler fatalError method
See Also:
isWellFormed()

getValidationWarnings

public java.util.Collection getValidationWarnings()
Returns:
an empty or non-empty collection of SAXParseExceptions caught via the SAX Errhandler warning method

characters

public void characters(char[] ch,
                       int start,
                       int length)
Specified by:
characters in interface org.xml.sax.ContentHandler

endDocument

public void endDocument()
Specified by:
endDocument in interface org.xml.sax.ContentHandler

endElement

public void endElement(java.lang.String namespaceURI,
                       java.lang.String localName,
                       java.lang.String qName)
Specified by:
endElement in interface org.xml.sax.ContentHandler

endPrefixMapping

public void endPrefixMapping(java.lang.String prefix)
Specified by:
endPrefixMapping in interface org.xml.sax.ContentHandler

ignorableWhitespace

public void ignorableWhitespace(char[] ch,
                                int start,
                                int length)
Specified by:
ignorableWhitespace in interface org.xml.sax.ContentHandler

processingInstruction

public void processingInstruction(java.lang.String target,
                                  java.lang.String data)
Specified by:
processingInstruction in interface org.xml.sax.ContentHandler

setDocumentLocator

public void setDocumentLocator(org.xml.sax.Locator locator)
Specified by:
setDocumentLocator in interface org.xml.sax.ContentHandler

skippedEntity

public void skippedEntity(java.lang.String name)
Specified by:
skippedEntity in interface org.xml.sax.ContentHandler

startDocument

public void startDocument()
Specified by:
startDocument in interface org.xml.sax.ContentHandler

startPrefixMapping

public void startPrefixMapping(java.lang.String prefix,
                               java.lang.String uri)
Specified by:
startPrefixMapping in interface org.xml.sax.ContentHandler