org.jhotdraw.xml
Class JavaxDOMOutput
- java.lang.Object
-
- org.jhotdraw.xml.JavaxDOMOutput
-
-
Constructor Summary
Constructors Constructor and Description JavaxDOMOutput(DOMFactory factory)Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidaddAttribute(java.lang.String name, boolean value)Adds an attribute to current element of the DOM Document.voidaddAttribute(java.lang.String name, boolean value, boolean defaultValue)Adds an attribute to current element of the DOM Document if it is different from the default value.voidaddAttribute(java.lang.String name, double value)Adds an attribute to current element of the DOM Document.voidaddAttribute(java.lang.String name, double value, double defaultValue)Adds an attribute to current element of the DOM Document if it is different from the default value.voidaddAttribute(java.lang.String name, float value)Adds an attribute to current element of the DOM Document.voidaddAttribute(java.lang.String name, float value, float defaultValue)Adds an attribute to current element of the DOM Document if it is different from the default value.voidaddAttribute(java.lang.String name, int value)Adds an attribute to current element of the DOM Document.voidaddAttribute(java.lang.String name, int value, int defaultValue)Adds an attribute to current element of the DOM Document if it is different from the default value.voidaddAttribute(java.lang.String name, java.lang.String value)Adds an attribute to current element of the DOM Document.voidaddAttribute(java.lang.String name, java.lang.String value, java.lang.String defaultValue)Adds an attribute to current element of the DOM Document if it is different from the default value.voidaddComment(java.lang.String comment)Adds a comment to the current element of the DOM Document.voidaddText(java.lang.String text)Adds a text to current element of the DOM Document.voidcloseElement()Closes the current element of the DOM Document.java.lang.ObjectgetPrototype()Returns a prototype for the object currently being written.voidopenElement(java.lang.String tagName)Puts a new element into the DOM Document.voidsave(java.io.OutputStream out)Writes the contents of the DOMOutput into the specified output stream.voidsave(java.io.Writer out)Writes the contents of the DOMOutput into the specified output stream.voidsetDoctype(java.lang.String doctype)Sets the doctype for the XML document.voidwriteObject(java.lang.Object o)Writes an object.
-
-
-
Constructor Detail
-
JavaxDOMOutput
public JavaxDOMOutput(DOMFactory factory) throws java.io.IOException
Creates a new instance.- Throws:
java.io.IOException
-
-
Method Detail
-
save
public void save(java.io.OutputStream out) throws java.io.IOExceptionWrites the contents of the DOMOutput into the specified output stream.- Throws:
java.io.IOException
-
save
public void save(java.io.Writer out) throws java.io.IOExceptionWrites the contents of the DOMOutput into the specified output stream.- Throws:
java.io.IOException
-
openElement
public void openElement(java.lang.String tagName)
Puts a new element into the DOM Document. The new element is added as a child to the current element in the DOM document. Then it becomes the current element. The element must be closed using closeElement.- Specified by:
openElementin interfaceDOMOutput
-
closeElement
public void closeElement()
Closes the current element of the DOM Document. The parent of the current element becomes the current element.- Specified by:
closeElementin interfaceDOMOutput- Throws:
java.lang.IllegalArgumentException- if the provided tagName does not match the tag name of the element.
-
addComment
public void addComment(java.lang.String comment)
Adds a comment to the current element of the DOM Document.- Specified by:
addCommentin interfaceDOMOutput
-
addText
public void addText(java.lang.String text)
Adds a text to current element of the DOM Document. Note: Multiple consecutives texts will be merged.
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.String value)Adds an attribute to current element of the DOM Document.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, int value)Adds an attribute to current element of the DOM Document.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, boolean value)Adds an attribute to current element of the DOM Document.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, float value)Adds an attribute to current element of the DOM Document.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, double value)Adds an attribute to current element of the DOM Document.- Specified by:
addAttributein interfaceDOMOutput
-
writeObject
public void writeObject(java.lang.Object o) throws java.io.IOExceptionDescription copied from interface:DOMOutputWrites an object.- Specified by:
writeObjectin interfaceDOMOutput- Throws:
java.io.IOException
-
addAttribute
public void addAttribute(java.lang.String name, float value, float defaultValue)Description copied from interface:DOMOutputAdds an attribute to current element of the DOM Document if it is different from the default value.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, int value, int defaultValue)Description copied from interface:DOMOutputAdds an attribute to current element of the DOM Document if it is different from the default value.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, double value, double defaultValue)Description copied from interface:DOMOutputAdds an attribute to current element of the DOM Document if it is different from the default value.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, boolean value, boolean defaultValue)Description copied from interface:DOMOutputAdds an attribute to current element of the DOM Document if it is different from the default value.- Specified by:
addAttributein interfaceDOMOutput
-
addAttribute
public void addAttribute(java.lang.String name, java.lang.String value, java.lang.String defaultValue)Description copied from interface:DOMOutputAdds an attribute to current element of the DOM Document if it is different from the default value.- Specified by:
addAttributein interfaceDOMOutput
-
getPrototype
public java.lang.Object getPrototype()
Description copied from interface:DOMOutputReturns a prototype for the object currently being written. This can be used, to reduce the amount of data written to DOMOutput. For example, by not writing object attributes, which have the same values as the prototype.- Specified by:
getPrototypein interfaceDOMOutput
-
setDoctype
public void setDoctype(java.lang.String doctype)
Description copied from interface:DOMOutputSets the doctype for the XML document.- Specified by:
setDoctypein interfaceDOMOutput
-
-
DataMelt 3.0 © DataMelt by jWork.ORG