public class EpubStep extends SplitStep
ConvertStep
) or input
semantic XHTML document (typically created using a EditStep
running "w2x:xed/main.xed") to an EPUB 2 file.
The outline level used to split the input XHTML+CSS document is specified by parameter step_name.split-before-level. This outline level is an integer between 0 and 8 inclusive. Default outline level is 0.
The save file of the EPUB document is specified by parameter step_name.out-file.
SplitStep.Part
Modifier and Type | Field and Description |
---|---|
protected static Name |
CASE_NAME |
protected static Name |
CONTENT_NAME |
protected static String |
COVER_HTML |
protected static Namespace |
DC_NS |
protected static Namespace |
DCTERMS_NS |
protected static Name |
DEFAULT_NAME |
protected static Name |
DOC_TITLE_NAME |
protected static Name |
GUIDE_NAME |
protected static Name |
HEAD_NAME |
protected static Name |
IDREF_NAME |
protected static Name |
ITEM_NAME |
protected static Name |
ITEMREF_NAME |
protected static Name |
LINEAR_NAME |
protected static Name |
MANIFEST_NAME |
protected static Name |
MEDIA_TYPE_NAME |
protected static Name |
META_NAME |
protected static Name |
METADATA_NAME |
protected static Name |
NAV_LABEL_NAME |
protected static Name |
NAV_MAP_NAME |
protected static Name |
NAV_POINT_NAME |
protected static Name |
NCX_NAME |
protected static Namespace |
NCX_NS |
protected static PrefixEntry[] |
NCX_PREFIX_ENTRIES |
protected static Name |
OPF_META_NAME |
protected static Namespace |
OPF_NS |
protected static PrefixEntry[] |
OPF_PREFIX_ENTRIES |
protected static Namespace |
OPS_NS |
protected static Name |
PACKAGE_NAME |
protected static Name |
PLAY_ORDER_NAME |
protected static Name |
REFERENCE_NAME |
protected static Name |
REQUIRED_NAMESPACE_NAME |
protected static Name |
SPINE_NAME |
protected static Name |
SWITCH_NAME |
protected static Name |
TEXT_NAME |
protected static Name |
TOC_NAME |
protected static Name |
UNIQUE_IDENTIFIER_NAME |
protected static Name |
VERSION_NAME |
COLS_ATTR, FRAME_ELEM, FRAMESET_ELEM, SCROLLING_ATTR, TOC_CSS
stepName
Constructor and Description |
---|
EpubStep(String stepName)
Constructs a EpubStep having specified name.
|
Modifier and Type | Method and Description |
---|---|
protected void |
addItems(File dir,
int urlPrefixLength,
Map<File,String> fileToId,
Element manifest) |
protected void |
addMeta(Document xhtmlDoc,
Element metadata) |
protected void |
createEpub(File tempDir,
File outFile,
ProgressMonitor monitor) |
protected File |
doProcess(Document xhtmlDoc,
File tempFile,
Map<String,String> parameters,
int[] stepCounter,
ProgressMonitor monitor) |
protected String |
mediaType(String ext) |
protected static Element |
newItem(String id,
String href,
String mediaType) |
protected static Element |
newItemref(String id) |
protected static Element |
newMeta(String name,
String content) |
protected static Element |
newSimpleElement(Namespace ns,
String localPart,
String text) |
protected static Element |
newText(String textContent) |
void |
process(Object[] state,
Map<String,String> parameters,
int[] stepCounter,
ProgressMonitor monitor)
Execute this processing step.
|
protected void |
saveContent(List<SplitStep.Part> parts,
String coverName,
String coverImageName,
String epubIdent,
String defaultLang,
Document xhtmlDoc,
File file,
ProgressMonitor monitor) |
protected String |
saveCover(URL imageURL,
File file,
ProgressMonitor monitor) |
protected void |
saveDocument(Document doc,
boolean indent,
String encoding,
File file,
ProgressMonitor monitor) |
protected void |
saveTOC(List<SplitStep.Part> parts,
String epubIdent,
boolean omitTOCRoot,
File file,
ProgressMonitor monitor) |
protected Document |
toContent(List<SplitStep.Part> parts,
String coverName,
String coverImageName,
String epubIdent,
String defaultLang,
Document xhtmlDoc,
File tempDir) |
protected Document |
toTOC(List<SplitStep.Part> parts,
String epubIdent,
boolean omitTOCRoot) |
protected static void |
zipEpub(File srcDir,
File zipFile) |
addPart, collectCounters, collectIds, collectNotes, copyNotes, copyNotes2, createCharsetMeta, createFrameset, createPartTemplate, createTOCStyle, creatingFile, deleteNotes, findById, findCharset, findCharsetMeta, findNotes, findParentPart, findTitle, fixLinks, getAllText, getBoxFirstChildElement, getOutlineLevel, isNote, isNoteRef, isNoteSeparator, newOutFile, newOutFile, parseCounterPI, parseCounterReset, processCounters, processLinks, processNotes, processNotes2, processParts, resetCounters, saveParts, setNotes, splitDocument, toTOC, useSameChunk
debugParameters, equals, getAllParameters, getBooleanParameter, getFileParameter, getIntParameter, getParameter, getURLParameter, hashCode, illegalState, joinAllParameters, missingParameter, parameterName, progress, toString, urlOrFile
protected static final Namespace OPS_NS
protected static final Name SWITCH_NAME
protected static final Name CASE_NAME
protected static final Name DEFAULT_NAME
protected static final Name REQUIRED_NAMESPACE_NAME
protected static final Namespace NCX_NS
protected static final PrefixEntry[] NCX_PREFIX_ENTRIES
protected static final Name NCX_NAME
protected static final Name HEAD_NAME
protected static final Name META_NAME
protected static final Name DOC_TITLE_NAME
protected static final Name TEXT_NAME
protected static final Name NAV_MAP_NAME
protected static final Name NAV_POINT_NAME
protected static final Name NAV_LABEL_NAME
protected static final Name CONTENT_NAME
protected static final Name VERSION_NAME
protected static final Name PLAY_ORDER_NAME
protected static final Namespace OPF_NS
protected static final Namespace DC_NS
protected static final Namespace DCTERMS_NS
protected static final PrefixEntry[] OPF_PREFIX_ENTRIES
protected static final Name PACKAGE_NAME
protected static final Name METADATA_NAME
protected static final Name OPF_META_NAME
protected static final Name MANIFEST_NAME
protected static final Name ITEM_NAME
protected static final Name SPINE_NAME
protected static final Name ITEMREF_NAME
protected static final Name GUIDE_NAME
protected static final Name REFERENCE_NAME
protected static final Name UNIQUE_IDENTIFIER_NAME
protected static final Name MEDIA_TYPE_NAME
protected static final Name TOC_NAME
protected static final Name IDREF_NAME
protected static final Name LINEAR_NAME
protected static final String COVER_HTML
public EpubStep(String stepName)
public void process(Object[] state, Map<String,String> parameters, int[] stepCounter, ProgressMonitor monitor) throws Exception
SplitStep
state[0]
contains:
ConvertStep
).
process
in class SplitStep
state
- contains the current state of processing:
a Document
or a File
.
This object is used as the input of this step and thus, is processed by this step.
After its execution, this method generally updates
the state array with a new Document
or File
to pass the result/output of this step to the next step.
parameters
- all the parameters passed to the Processor
owning and thus executing this process step.
Parameters which are relevant to this processing step are prefixed
with "ProcessStep.stepName
.".
stepCounter
- contains the rank of previously executed
processing step. Must be incremented by this method.monitor
- used to monitor the progress of the processing steps
Invoking convenience method ProcessStep.progress(java.lang.String, int[], com.xmlmind.util.ProgressMonitor)
suffices to
make good use of both monitor and stepCounter.
Exception
- if for any reason, this method failsprotected File doProcess(Document xhtmlDoc, File tempFile, Map<String,String> parameters, int[] stepCounter, ProgressMonitor monitor) throws Exception
Exception
protected void saveDocument(Document doc, boolean indent, String encoding, File file, ProgressMonitor monitor) throws CanceledException, IOException
saveDocument
in class SplitStep
CanceledException
IOException
protected void saveTOC(List<SplitStep.Part> parts, String epubIdent, boolean omitTOCRoot, File file, ProgressMonitor monitor) throws CanceledException, IOException
CanceledException
IOException
protected Document toTOC(List<SplitStep.Part> parts, String epubIdent, boolean omitTOCRoot)
protected String saveCover(URL imageURL, File file, ProgressMonitor monitor) throws CanceledException, IOException
CanceledException
IOException
protected void saveContent(List<SplitStep.Part> parts, String coverName, String coverImageName, String epubIdent, String defaultLang, Document xhtmlDoc, File file, ProgressMonitor monitor) throws CanceledException, IOException
CanceledException
IOException
protected Document toContent(List<SplitStep.Part> parts, String coverName, String coverImageName, String epubIdent, String defaultLang, Document xhtmlDoc, File tempDir) throws IOException
IOException
protected static final Element newSimpleElement(Namespace ns, String localPart, String text)
protected void addItems(File dir, int urlPrefixLength, Map<File,String> fileToId, Element manifest) throws IOException
IOException
protected void createEpub(File tempDir, File outFile, ProgressMonitor monitor) throws CanceledException, IOException
CanceledException
IOException
protected static final void zipEpub(File srcDir, File zipFile) throws IOException
IOException