Class OPFHandler
- All Implemented Interfaces:
ContentHandler, DTDHandler, EntityResolver, ErrorHandler, DeclHandler, EntityResolver2, LexicalHandler
- Direct Known Subclasses:
OPFHandler30
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String, OPFItem.Builder> protected final Map<io.mola.galimatias.URL, OPFItem.Builder> private OPFItemsprivate booleanprotected Stringprotected EPUBLocationprivate final Vector<OPFReference> private intprotected static final String(package private) Stringprivate Stringprivate booleanFields inherited from class XMLHandler
context, path, report -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate voidvoidcharacters(char[] chars, int start, int len) booleanChecks to see if the unique-identifier attribute of the package element references an existing DC metadata identifier element's id attributevoidcom.google.common.base.Optional<OPFItem> getItemById(String id) Search the list of item by ID.com.google.common.base.Optional<OPFItem> getItemByURL(io.mola.galimatias.URL url) Search the list of item by URL.getItems()Returns an immutable list of all the items in the OPF, in document order, including those represented bylinkelements pointing to local resources.booleanbooleangetPath()getReference(int index) intReturns an immutable list of the items in the spine.getUid()private static booleanisValidRole(String role) protected voidreportItem(OPFItem item) Report features or messages for a given item.voidMethods inherited from class XMLHandler
currentElement, endElement, registerReference, registerReference, setDocumentLocator, startElementMethods inherited from class BaseURLHandler
baseURL, checkURLMethods inherited from class LocationHandler
location, locationMethods inherited from class DefaultHandler2
attributeDecl, comment, elementDecl, endCDATA, endDTD, endEntity, externalEntityDecl, getExternalSubset, internalEntityDecl, resolveEntity, resolveEntity, startCDATA, startDTD, startEntityMethods inherited from class DefaultHandler
endDocument, endPrefixMapping, error, fatalError, ignorableWhitespace, notationDecl, processingInstruction, skippedEntity, startDocument, startPrefixMapping, unparsedEntityDecl, warningMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface ContentHandler
declaration
-
Field Details
-
TEXT
- See Also:
-
pageMapId
-
pageMapReferenceLocation
-
itemBuilders
-
itemBuildersByURL
-
spineIDs
-
items
-
refs
-
validRoles
-
uniqueIdent
-
uniqueIdentExists
private boolean uniqueIdentExists -
uid
String uid -
opf12PackageFile
private boolean opf12PackageFile -
spineItemCounter
private int spineItemCounter
-
-
Constructor Details
-
OPFHandler
-
-
Method Details
-
getPath
-
getOpf12PackageFile
public boolean getOpf12PackageFile() -
getOpf20PackageFile
public boolean getOpf20PackageFile() -
getItemById
-
getItemByURL
Search the list of item by URL.- Parameters:
id- the URL of the item to search- Returns:
- an
Optionalcontaining the item of the given URL if found, orOptional.absent()
-
getSpineItems
-
getItems
-
getReferenceCount
public int getReferenceCount() -
getReference
-
checkUniqueIdentExists
public boolean checkUniqueIdentExists()Checks to see if the unique-identifier attribute of the package element references an existing DC metadata identifier element's id attribute- Returns:
- true if there is an identifier with an id attribute that matches the value of the unique-identifier attribute of the package element. False otherwise.
-
getUid
-
isValidRole
-
startElement
public void startElement()- Overrides:
startElementin classXMLHandler
-
getIdentId
-
endElement
public void endElement()- Overrides:
endElementin classXMLHandler
-
characters
public void characters(char[] chars, int start, int len) - Specified by:
charactersin interfaceContentHandler- Overrides:
charactersin classDefaultHandler
-
buildItems
private void buildItems() -
reportItem
Report features or messages for a given item.- Parameters:
item- the item to report.
-