Package com.xmlmind.assembly
Class Processor
- java.lang.Object
-
- com.xmlmind.assembly.Processor
-
public class Processor extends Object
Assembly processor: processes a DocBook 5.1+ assembly file and creates the equivalent DocBook 5.1+ "flat" document (for example abook; called the "realized" document).
-
-
Field Summary
Fields Modifier and Type Field Description static StringDOCBOOK_NS_URIThe namespace URI of DocBook v5+.static StringVERSIONThe version number of this processor.
-
Constructor Summary
Constructors Constructor Description Processor()Equivalent toProcessor(null).Processor(Console c)Constructs a Processor using specified console to display its progress, warning, error, etc, messages.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description intconfigure(String[] args)Allows to configure this processor using the options of command-line utilityassembly(that is,-struct,-format, etc).booleangetCheckRealizedDocument()Returnstrueif realized document is to be checked for cross-reference errors, missing image resources, etc.ConsoleHelpergetConsole()LoadergetDocumentLoader()Returns the document loader used to load XML documents.String[]getOutputFormats()Returns the output formats which are to be considered by this processor.StringgetProcessedStructId()Returns the value of the ID of thestructureto be processed.String[]getProfile()Returns the profile applied to the realized document.XMLResolvergetResolver()Returns the entity and URI resolver being used when loading or transforming an XML document.ProcessorgetTransclusionProcessor()Returns the processor used to process transcluded documents.static voidmain(String[] args)Implementation of theassemblycommand-line utility.booleanprocess(URL inURL, File outFile)Processes specified assembly and saves the realized document to specified file.Documentprocess(URL inURL, URL realizedDocURL)Processes specified assembly and returns the realized document.voidsetCheckRealizedDocument(boolean check)Specifies whether realized document is to be checked for cross-reference errors, missing image resources, etc.voidsetConsole(Console c)voidsetDocumentLoader(Loader loader)Specifies which document loader to use to load XML documents.voidsetOutputFormat(String format)Similar tosetOutputFormats(java.lang.String[])except that specified string is split around character;.voidsetOutputFormats(String[] formats)Specifies the output formats (generally only one) which are to be considered by this processor.voidsetProcessedStructId(String id)Specifies the value of the ID of thestructureto be processed.voidsetProfile(String[] profile)Specifies the profile applied to the realized document.voidsetResolver(XMLResolver resolver)Specifies which entity and URI resolver to use when loading or transforming an XML document.voidsetTransclusionProcessor(Processor proc)Specifies which processor to use to process transcluded documents.
-
-
-
Field Detail
-
VERSION
public static final String VERSION
The version number of this processor.- See Also:
- Constant Field Values
-
DOCBOOK_NS_URI
public static final String DOCBOOK_NS_URI
The namespace URI of DocBook v5+.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Processor
public Processor()
Equivalent toProcessor(null).
-
Processor
public Processor(Console c)
Constructs a Processor using specified console to display its progress, warning, error, etc, messages.- Parameters:
c- the console. May benull.- See Also:
setConsole(com.xmlmind.util.Console)
-
-
Method Detail
-
setConsole
public void setConsole(Console c)
-
getConsole
public ConsoleHelper getConsole()
-
setResolver
public void setResolver(XMLResolver resolver)
Specifies which entity and URI resolver to use when loading or transforming an XML document.- Parameters:
resolver- which resolver to use. May benull.- See Also:
getResolver()
-
getResolver
public XMLResolver getResolver()
Returns the entity and URI resolver being used when loading or transforming an XML document. May returnnull.
-
setDocumentLoader
public void setDocumentLoader(Loader loader)
Specifies which document loader to use to load XML documents.This loader is expected to process XInclude elements.
- Parameters:
loader- which loader to use. May benull, in which case an instance ofLoaderImplis used.- See Also:
getDocumentLoader()
-
getDocumentLoader
public Loader getDocumentLoader()
Returns the document loader used to load XML documents.
-
setTransclusionProcessor
public void setTransclusionProcessor(Processor proc)
Specifies which processor to use to process transcluded documents.- Parameters:
proc- which transclusion processor to use. May benull, in which case an instance ofProcessoris used.- See Also:
getTransclusionProcessor()
-
getTransclusionProcessor
public Processor getTransclusionProcessor()
Returns the processor used to process transcluded documents.
-
setProcessedStructId
public void setProcessedStructId(String id)
Specifies the value of the ID of thestructureto be processed. This may be needed in case theassemblycontains severalstructures.- Parameters:
id- the value of thexml:idattribute of thestructureto be processed. May benull, in which case, the firststructurein document order is processed.- See Also:
getProcessedStructId()
-
getProcessedStructId
public String getProcessedStructId()
Returns the value of the ID of thestructureto be processed. May returnnull.- See Also:
setProcessedStructId(java.lang.String)
-
setOutputFormat
public void setOutputFormat(String format)
Similar tosetOutputFormats(java.lang.String[])except that specified string is split around character;.
-
setOutputFormats
public void setOutputFormats(String[] formats)
Specifies the output formats (generally only one) which are to be considered by this processor.- Parameters:
formats- the output formats which are to be considered by this processor. May benull, in which case:- If the
structureto be processed has aoutputformatattribute, then the value of this attribute is the output format considered by this processor. - Otherwise, the "implicit format" is used.
The "implicit format" matches
output,filterin,filteroutelements without anyoutputformatattribute.
- If the
- See Also:
setProcessedStructId(java.lang.String),getOutputFormats()
-
getOutputFormats
public String[] getOutputFormats()
Returns the output formats which are to be considered by this processor. May returnnull.- See Also:
setOutputFormats(java.lang.String[])
-
setCheckRealizedDocument
public void setCheckRealizedDocument(boolean check)
Specifies whether realized document is to be checked for cross-reference errors, missing image resources, etc. Default option isfalse.- See Also:
getCheckRealizedDocument()
-
getCheckRealizedDocument
public boolean getCheckRealizedDocument()
Returnstrueif realized document is to be checked for cross-reference errors, missing image resources, etc.- See Also:
setCheckRealizedDocument(boolean)
-
setProfile
public void setProfile(String[] profile)
Specifies the profile applied to the realized document.This may be needed if you want the diagnostics reported by the realized document checker to be accurate.
- Parameters:
profile- a list of profiling attribute name/value pairs. May benull.- See Also:
getProfile(),setCheckRealizedDocument(boolean)
-
getProfile
public String[] getProfile()
Returns the profile applied to the realized document. May returnnull.- See Also:
setProfile(java.lang.String[])
-
configure
public int configure(String[] args) throws IllegalArgumentException
Allows to configure this processor using the options of command-line utilityassembly(that is,-struct,-format, etc).- Parameters:
args- command-line options- Returns:
- index in array
argsof first unknown option. This may be the index of an unknown option or the index of the assembly input file. - Throws:
IllegalArgumentException- if an usage error is found inargs
-
process
public Document process(URL inURL, URL realizedDocURL) throws IOException
Processes specified assembly and returns the realized document.Warning, errors and fatal errors (other than
IOExceptions) are reported using theconsole.- Parameters:
inURL- URL of the assembly input documentrealizedDocURL- URL of the realized document. May benullif unimportant or unknown.- Returns:
- realized document;
nullif a fatal error has been reported - Throws:
IOException- if, for any reason, an I/O exception is raised during the processing.- See Also:
process(URL, File)
-
process
public boolean process(URL inURL, File outFile) throws IOException
Processes specified assembly and saves the realized document to specified file.Warning, errors and fatal errors (other than
IOExceptions) are reported using theconsole.- Parameters:
inURL- URL of the assembly input documentoutFile- save file of the realized document- Returns:
trueif realized document has been saved;falseif a fatal error has been reported- Throws:
IOException- if, for any reason, an I/O exception is raised during the processing.- See Also:
process(URL, URL)
-
main
public static void main(String[] args)
Implementation of theassemblycommand-line utility.
-
-