|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectwriter2latex.xmerge.DOMDocument
public class DOMDocument
An implementation of Document
for
StarOffice documents.
Field Summary | |
---|---|
private org.w3c.dom.Document |
contentDoc
DOM Document of content.xml. |
private java.lang.String |
documentName
|
private static javax.xml.parsers.DocumentBuilderFactory |
factory
Factory for DocumentBuilder objects. |
private java.lang.String |
fileExt
|
private java.lang.String |
fileName
|
private org.w3c.dom.Document |
styleDoc
DOM Document of content.xml. |
Constructor Summary | |
---|---|
DOMDocument(java.lang.String name,
java.lang.String ext)
Default constructor. |
|
DOMDocument(java.lang.String name,
java.lang.String ext,
boolean namespaceAware,
boolean validating)
Constructor with arguments to set namespaceAware
and validating flags. |
Method Summary | |
---|---|
private org.w3c.dom.Document |
createDOM(java.lang.String rootName)
Creates a new DOM Document containing minimum
OpenOffice XML tags. |
private byte[] |
docToBytes(org.w3c.dom.Document doc)
Write out a org.w3c.dom.Document object into a
byte array. |
org.w3c.dom.Document |
getContentDOM()
Return a DOM Document object of the document content
file. |
protected java.lang.String |
getFileExtension()
Returns the file extension of the Document
represented. |
java.lang.String |
getFileName()
Return the file name of the Document , possibly
with the standard extension. |
java.lang.String |
getName()
Return the name of the Document . |
void |
initContentDOM()
Initializes a new DOM Document with the content
containing minimum XML tags. |
void |
read(java.io.InputStream is)
Read the Office Document from the specified
InputStream . |
void |
setContentDOM(org.w3c.dom.Node newDom)
Sets the Content of the Document to the contents of the
supplied Node list. |
private java.lang.String |
trimDocumentName(java.lang.String name)
Removes the file extension from the Document
name. |
void |
write(java.io.OutputStream os)
Write out content to the supplied OutputStream . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static javax.xml.parsers.DocumentBuilderFactory factory
DocumentBuilder
objects.
private org.w3c.dom.Document contentDoc
Document
of content.xml.
private org.w3c.dom.Document styleDoc
Document
of content.xml.
private java.lang.String documentName
private java.lang.String fileName
private java.lang.String fileExt
Constructor Detail |
---|
public DOMDocument(java.lang.String name, java.lang.String ext)
name
- Document
name.ext
- Document
extension.public DOMDocument(java.lang.String name, java.lang.String ext, boolean namespaceAware, boolean validating)
namespaceAware
and validating
flags.
name
- Document
name (may or may not
contain extension).ext
- Document
extension.namespaceAware
- Value for namespaceAware
flag.validating
- Value for validating
flag.Method Detail |
---|
protected java.lang.String getFileExtension()
Document
represented.
Document
.private java.lang.String trimDocumentName(java.lang.String name)
Document
name.
name
- Full Document
name with extension.
Document
without the extension.public org.w3c.dom.Document getContentDOM()
Document
object of the document content
file. Note that a content DOM is not created when the constructor
is called. So, either the read
method or the
initContentDOM
method will need to be called ahead
on this object before calling this method.
Document
object.public void setContentDOM(org.w3c.dom.Node newDom)
Document
to the contents of the
supplied Node
list.
public java.lang.String getName()
Document
.
getName
in interface Document
Document
.public java.lang.String getFileName()
Document
, possibly
with the standard extension.
getFileName
in interface OutputFile
Document
.public void read(java.io.InputStream is) throws java.io.IOException
Document
from the specified
InputStream
.
read
in interface Document
is
- Office document InputStream
.
java.io.IOException
- If any I/O error occurs.public void write(java.io.OutputStream os) throws java.io.IOException
OutputStream
.
write
in interface OutputFile
os
- XML OutputStream
.
java.io.IOException
- If any I/O error occurs.private byte[] docToBytes(org.w3c.dom.Document doc) throws java.io.IOException
Write out a org.w3c.dom.Document
object into a
byte
array.
TODO: remove dependency on com.sun.xml.tree.XmlDocument package!
Document
- DOM Document
object.
byte
array of DOM Document
object.
java.io.IOException
- If any I/O error occurs.public final void initContentDOM() throws java.io.IOException
Document
with the content
containing minimum XML tags.
java.io.IOException
- If any I/O error occurs.private final org.w3c.dom.Document createDOM(java.lang.String rootName) throws java.io.IOException
Creates a new DOM Document
containing minimum
OpenOffice XML tags.
This method uses the subclass
getOfficeClassAttribute
method to get the
attribute for office:class.
rootName
- root name of Document
.
java.io.IOException
- If any I/O error occurs.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |