|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sf.exorcist.midgard.DOMBuilder
public final class DOMBuilder
Document builder class. This class provides an intuitive interface for incrementally building DOM documents.
Constructor Summary | |
---|---|
DOMBuilder(java.lang.String name,
java.lang.String namespace,
java.lang.String prefix)
Creates a builder for a new DOM document. |
Method Summary | |
---|---|
void |
addContent(java.lang.String content)
Adds the given string as text content to the current element. |
void |
addContentElement(java.lang.String name,
java.lang.String content)
Adds a new child element with the given name and text content. |
void |
endElement()
Makes the parent element current. |
void |
setAttribute(java.lang.String name,
boolean value)
Sets the named boolean attribute of the current element. |
void |
setAttribute(java.lang.String name,
java.lang.String value)
Sets the named attribute of the current element. |
void |
startElement(java.lang.String name)
Creates a new element with the given name as the child of the current element and makes the created element current. |
void |
write(java.io.OutputStream xml)
Writes the document built by this builder into the given output stream. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DOMBuilder(java.lang.String name, java.lang.String namespace, java.lang.String prefix) throws javax.xml.parsers.ParserConfigurationException
name
- name of the root element
javax.xml.parsers.ParserConfigurationException
- if a document cannot be createdMethod Detail |
---|
public void write(java.io.OutputStream xml) throws java.io.IOException
xml
- XML output stream
java.io.IOException
- if the document could not be writtenpublic void startElement(java.lang.String name)
endElement
method needs to be called
to return back to the original element.
name
- name of the new elementpublic void endElement()
startElement
method has been fully
built.
public void setAttribute(java.lang.String name, java.lang.String value)
name
- attribute namevalue
- attribute valuepublic void setAttribute(java.lang.String name, boolean value)
name
- attribute namevalue
- boolean attribute valuepublic void addContent(java.lang.String content)
content
- text contentpublic void addContentElement(java.lang.String name, java.lang.String content)
name
- child element namecontent
- child element content
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |