|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.mmbase.util.xml.DocumentReader
org.mmbase.util.xml.DocumentWriter
Abstract class for creating xml documents. Use this class as the base class for writers that construct and export DOM documents. The document can then be used internally or serialized using a number of utility methods.
| Field Summary |
| Fields inherited from class org.mmbase.util.xml.DocumentReader |
document, DTD_ERROR, DTD_ERROR_1_0, FILENOTFOUND, PUBLIC_ID_ERROR, PUBLIC_ID_ERROR_1_0 |
| Constructor Summary | |
DocumentWriter(org.xml.sax.InputSource source)
Constructs the document by reading it from a source. |
|
DocumentWriter(org.xml.sax.InputSource source,
boolean validating,
java.lang.Class resolveBase)
Constructs the document by reading it from a source. |
|
DocumentWriter(java.lang.String path)
Constructs the document by reading it from a file. |
|
DocumentWriter(java.lang.String path,
boolean validating,
java.lang.Class resolveBase)
Constructs the document by reading it from a source. |
|
DocumentWriter(java.lang.String qualifiedName,
java.lang.String publicId,
java.lang.String systemId)
Constructs the document writer. |
|
| Method Summary | |
protected org.w3c.dom.Comment |
addComment(java.lang.String key,
org.w3c.dom.Element out)
Creates a Comment (provided comments should be included), and adds it to the specified node as a child. |
protected org.w3c.dom.Comment |
addComment(java.lang.String key,
java.lang.String a1,
org.w3c.dom.Element out)
Creates a Comment (provided comments should be included), and adds it to the specified node as a child. |
protected org.w3c.dom.Comment |
addComment(java.lang.String key,
java.lang.String a1,
java.lang.String a2,
org.w3c.dom.Element out)
Creates a Comment (provided comments should be included), and adds it to the specified node as a child. |
protected org.w3c.dom.Element |
addContentElement(java.lang.String tagname,
java.lang.String content,
org.w3c.dom.Element out)
Creates a DOM element which contains a Text Node, and adds it to the specified node as a child. |
protected abstract void |
generate()
Generates the document. |
org.w3c.dom.Document |
generateDocument()
Generates the document if it hadn't be done so already. |
org.w3c.dom.Document |
getDocument()
Returns the completed document representation; If the document was not yet generated, it is generated by calling generateDocument(). |
boolean |
getIncludeComments()
Gets whether the document will include comments |
protected java.lang.String |
getMessage(java.lang.String key)
Retrieves a message from the resource bundle. |
protected java.lang.String |
getMessage(java.lang.String key,
java.lang.String a1)
Retrieves a message from the resource bundle. |
protected java.lang.String |
getMessage(java.lang.String key,
java.lang.String a1,
java.lang.String a2)
Retrieves a message from the resource bundle. |
protected java.lang.String |
getMessage(java.lang.String key,
java.lang.String a1,
java.lang.String a2,
java.lang.String a3)
Retrieves a message from the resource bundle. |
protected void |
getMessageRetriever(java.lang.String resourcelocation)
Initialize the ResourceBundle with the given resource. |
void |
setIncludeComments(boolean value)
Sets whether the document will include comments |
void |
write(javax.xml.transform.stream.StreamResult result)
Generates the document and writes it to the result object. |
void |
writeToFile(java.lang.String filename)
Generates the document and store it as a file in the given path. |
void |
writeToStream(java.io.OutputStream out)
Generates the document and store it in the given stream. |
java.lang.String |
writeToString()
Generates the document and returns it as a string. |
| Methods inherited from class org.mmbase.util.xml.DocumentReader |
getDocumentBuilder, getDocumentBuilder, getFileName, getNodeTextValue, registerPublicIDs, validate |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
public DocumentWriter(java.lang.String qualifiedName,
java.lang.String publicId,
java.lang.String systemId)
throws org.w3c.dom.DOMException
generateDocument(), which is in turn called when
the document is first accessed through getDocument().
qualifiedName - the qualified name of the document's root elementpublic DocumentWriter(java.lang.String path)
path - the path to the file from which to read the document
public DocumentWriter(java.lang.String path,
boolean validating,
java.lang.Class resolveBase)
path - the path to the file from which to read the documentvalidating - whether to validate the documentresolveBase - the base class whose package is used to resolve dtds, set to null if unknownpublic DocumentWriter(org.xml.sax.InputSource source)
source - the input source from which to read the document
public DocumentWriter(org.xml.sax.InputSource source,
boolean validating,
java.lang.Class resolveBase)
source - the input source from which to read the documentvalidating - whether to validate the documentresolveBase - the base class whose package is used to resolve dtds, set to null if unknown| Method Detail |
protected void getMessageRetriever(java.lang.String resourcelocation)
resourcelocation - Resource.protected java.lang.String getMessage(java.lang.String key)
key - the key of the message
protected java.lang.String getMessage(java.lang.String key,
java.lang.String a1)
key - the key of the messagea1 - the first parameter to substitute in the message
protected java.lang.String getMessage(java.lang.String key,
java.lang.String a1,
java.lang.String a2)
key - the key of the messagea1 - the first parameter to substitute in the messagea2 - the second parameter to substitute in the message
protected java.lang.String getMessage(java.lang.String key,
java.lang.String a1,
java.lang.String a2,
java.lang.String a3)
key - the key of the messagea1 - the first parameter to substitute in the messagea2 - the second parameter to substitute in the messagea3 - the third parameter to substitute in the message
protected org.w3c.dom.Element addContentElement(java.lang.String tagname,
java.lang.String content,
org.w3c.dom.Element out)
tagname - name of the new elementcontent - content of the new element as a stringout - the element to which to add the new Element.
protected org.w3c.dom.Comment addComment(java.lang.String key,
org.w3c.dom.Element out)
key - the key of the comment to add as a stringout - the element to which to add the new Comment.
setIncludeComments(boolean)
protected org.w3c.dom.Comment addComment(java.lang.String key,
java.lang.String a1,
org.w3c.dom.Element out)
key - the key of the comment to add as a stringa1 - the first parameter to substitute in the commentout - the element to which to add the new Comment.
setIncludeComments(boolean)
protected org.w3c.dom.Comment addComment(java.lang.String key,
java.lang.String a1,
java.lang.String a2,
org.w3c.dom.Element out)
key - the comment to add as a stringa1 - the first parameter to substitute in the commenta2 - the second parameter to substitute in the commentout - the element to which to add the new Comment.
setIncludeComments(boolean)
protected abstract void generate()
throws org.w3c.dom.DOMException
org.w3c.dom.DOMException - when an error occurred during generation
public final org.w3c.dom.Document generateDocument()
throws org.w3c.dom.DOMException
org.w3c.dom.DOMException - when an error occurred during generation
org.w3c.dom.DOMException - when the document was already constructed
public org.w3c.dom.Document getDocument()
throws org.w3c.dom.DOMException
org.w3c.dom.DOMException - when an error occurred during generationpublic void setIncludeComments(boolean value)
value - if true, the document will include commentspublic boolean getIncludeComments()
public java.lang.String writeToString()
throws java.io.IOException,
javax.xml.transform.TransformerException
java.io.IOException
javax.xml.transform.TransformerException
public void writeToFile(java.lang.String filename)
throws java.io.IOException,
javax.xml.transform.TransformerException
filename - the filepath where the configuration is to be stored
java.io.IOException
javax.xml.transform.TransformerException
public void writeToStream(java.io.OutputStream out)
throws java.io.IOException,
javax.xml.transform.TransformerException
out - the output stream where the configuration is to be stored
java.io.IOException
javax.xml.transform.TransformerException
public void write(javax.xml.transform.stream.StreamResult result)
throws java.io.IOException,
javax.xml.transform.TransformerException
result - the StreamResult object where to store the configuration'
java.io.IOException
javax.xml.transform.TransformerException
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||