|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object | +--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 | |
protected org.w3c.dom.Document |
document
The XML builder document. |
| Constructor Summary | |
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 java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected org.w3c.dom.Document document
| 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 teh document's root elementpublicID - the PUBLIC id of the document typesystemID - the SYSTEm id of the document type| 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 generationorg.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
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
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
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'
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||