|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectxml.XmlElementTextGen
public class XmlElementTextGen
Supports the conversion of an XML DOM element to text.
This is really redundant now that JAXP supports DOM Load-and-Save (but note that DOM LS requires access to the Document containing the element).
An instance will supply the text string for a given XML DOM Element -- via its getText() method. Alternatively the text can be appended to a Writer -- via the writeText() method.
Construction time flag parameters determine whether or not the text has indentation, and whether or not it contains an XML declaration.
NB
Now (2007) JAXP element text generation output format seems to vary
with the context -- e.g. a single line for an internally constructed
DOM element, multiple lines with indentation for a DOM element
read from an external source.
Constructor Summary | |
---|---|
XmlElementTextGen(boolean doindent)
Constructs a new XML text generator, that uses the given indentation setting, does not output an XML declaration, uses the standard encoding (UTF-8), and that uses the standard output buffer size. |
|
XmlElementTextGen(boolean doindent,
boolean doxmldecl)
Constructs a new XML text generator, that uses the given indentation setting, generates an XML declaration or not, as specified, uses the standard encoding (UTF-8), and that uses the standard output buffer size. |
|
XmlElementTextGen(boolean doindent,
java.lang.String encoding,
boolean doxmldecl)
Constructs a new XML text generator, that uses the given indentation setting, generates an XML declaration or not, as specified, uses the given encoding, and that uses the standard output buffer size. |
|
XmlElementTextGen(boolean doindent,
java.lang.String encoding,
boolean doxmldecl,
int bufsize)
Constructs a new XML text generator, that uses the given indentation setting, generates an XML declaration or not, as specified, and that uses the given encoding and output buffer size. |
Method Summary | |
---|---|
java.lang.String |
getText(org.w3c.dom.Element el)
Generates and returns the text for the given element. |
java.lang.String |
getText(org.w3c.dom.Element el,
java.lang.String prfx,
java.lang.String sffx)
Generates the text for the given element, with the given prefix and suffix text attached, and returns the result. |
static java.lang.String |
indentedLinesForPureXML(java.lang.String xml)
Returns a multi-line indented version of the given pure XML text. |
static java.lang.String |
linesForPureXML(java.lang.String xml)
Returns a multi-line non-indented version of the given pure XML text. |
void |
writeText(org.w3c.dom.Element el,
java.io.Writer wrtr)
Generates the text for the given element, and writes it to the given writer. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public XmlElementTextGen(boolean doindent) throws javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerConfigurationException
public XmlElementTextGen(boolean doindent, boolean doxmldecl) throws javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerConfigurationException
public XmlElementTextGen(boolean doindent, java.lang.String encoding, boolean doxmldecl) throws javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerConfigurationException
public XmlElementTextGen(boolean doindent, java.lang.String encoding, boolean doxmldecl, int bufsize) throws javax.xml.transform.TransformerConfigurationException
javax.xml.transform.TransformerConfigurationException
Method Detail |
---|
public java.lang.String getText(org.w3c.dom.Element el) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public java.lang.String getText(org.w3c.dom.Element el, java.lang.String prfx, java.lang.String sffx) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public void writeText(org.w3c.dom.Element el, java.io.Writer wrtr) throws javax.xml.transform.TransformerException
javax.xml.transform.TransformerException
public static java.lang.String indentedLinesForPureXML(java.lang.String xml)
public static java.lang.String linesForPureXML(java.lang.String xml)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |