ru.novosoft.dc.core
Class NSDCHandler
java.lang.Object
|
+--ru.novosoft.dc.core.NSDCHandler
- public class NSDCHandler
- extends java.lang.Object
- implements ConversionHandler
The class provides methods for handling a document conversion
using Apache Xerces2 DOM implementation and XML serializer.
Method Summary |
org.w3c.dom.DOMImplementation |
getDOMImplementation()
Return an implementation of Document Object Model. |
void |
serialize(org.w3c.dom.Document document,
CommonLogger logger,
java.lang.String fileName,
java.lang.String extension,
boolean preserveSpace,
boolean indent,
int lineWidth)
Serialize the document to XML file constructing its name from the
fileName parameter and the specified extension. |
java.io.InputStream |
start(java.lang.String source,
CommonLogger logger)
Open a source file for reading, log a message on starting conversion,
and return the input stream opened. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
NSDCHandler
public NSDCHandler(NSDCContext context)
- Construct a serializer based on the specified context.
start
public java.io.InputStream start(java.lang.String source,
CommonLogger logger)
- Open a source file for reading, log a message on starting conversion,
and return the input stream opened. If the source file is not found,
an error message is logged and the
NSDCException
is thrown.
- Specified by:
- start in interface ConversionHandler
getDOMImplementation
public org.w3c.dom.DOMImplementation getDOMImplementation()
- Return an implementation of Document Object Model.
- Specified by:
- getDOMImplementation in interface ConversionHandler
serialize
public void serialize(org.w3c.dom.Document document,
CommonLogger logger,
java.lang.String fileName,
java.lang.String extension,
boolean preserveSpace,
boolean indent,
int lineWidth)
- Serialize the document to XML file constructing its name from the
fileName parameter and the specified extension. If serialization fails, the
NSDCException
is thrown.
The following context options are used in this method:
"xml-indent" and "encoding".
- Specified by:
- serialize in interface ConversionHandler
- Parameters:
document
- a document to be serializedlogger
- a logger used for logging messagesfileName
- a name used as a template for the name of the output fileextension
- an extension for the output filepreserveSpace
- if true, the preserve space mode is usedindent
- if true, the output will be indented (the value of the
"xml-indent" option is used in this case)lineWidth
- a necessary width of output lines
(0 means no text wrapping)
Other Novosoft LLC products:
Handy Backup Handy Password manager