|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.codehaus.stax2.ri.dom.DOMWrappingWriter
com.fasterxml.aalto.dom.DOMWriterImpl
public final class DOMWriterImpl
This is an adapter class that allows building a DOM tree using
XMLStreamWriter
interface.
Note that the implementation is only to be used for use with
javax.xml.transform.dom.DOMResult
.
Some notes regarding missing/incomplete functionality:
Field Summary | |
---|---|
protected String |
_automaticNsPrefix
|
protected int[] |
_autoNsSeq
for NsRepairing mode |
protected WriterConfig |
_config
|
protected DOMOutputElement |
_currElem
This element is the current context element, under which all other nodes are added, until matching end element is output. |
protected DOMOutputElement |
_openElement
This element is non-null right after a call to either writeStartElement and
writeEmptyElement , and can be used to
add attributes and namespace declarations. |
protected String |
_suggestedDefNs
|
Fields inherited from class org.codehaus.stax2.ri.dom.DOMWrappingWriter |
---|
mDocument, mEncoding, mNsAware, mNsContext, mNsRepairing, mValueEncoder |
Method Summary | |
---|---|
protected void |
appendLeaf(Node n)
|
static DOMWriterImpl |
createFrom(WriterConfig cfg,
DOMResult dst)
|
protected void |
createStartElem(String nsURI,
String prefix,
String localName,
boolean isEmpty)
Method called by all start element write methods. |
protected String |
findElemPrefix(String nsURI,
DOMOutputElement elem)
Method called to find an existing prefix for the given namespace, if any exists in the scope. |
protected String |
findOrCreateAttrPrefix(String suggPrefix,
String nsURI,
DOMOutputElement elem)
Method called to somehow find a prefix for given namespace, to be used for a new start element; either use an existing one, or generate a new one. |
protected String |
generateElemPrefix(String suggPrefix,
String nsURI,
DOMOutputElement elem)
Method called after findElemPrefix(java.lang.String, com.fasterxml.aalto.dom.DOMOutputElement) has returned null,
to create and bind a namespace mapping for specified namespace. |
NamespaceContext |
getNamespaceContext()
|
String |
getPrefix(String uri)
|
Object |
getProperty(String name)
|
boolean |
isPropertySupported(String name)
|
protected void |
outputAttribute(String nsURI,
String prefix,
String localName,
String value)
|
void |
setDefaultNamespace(String uri)
|
void |
setPrefix(String prefix,
String uri)
|
boolean |
setProperty(String name,
Object value)
|
void |
writeAttribute(String localName,
String value)
|
void |
writeAttribute(String nsURI,
String localName,
String value)
|
void |
writeAttribute(String prefix,
String nsURI,
String localName,
String value)
|
void |
writeDefaultNamespace(String nsURI)
|
void |
writeDTD(String rootName,
String systemId,
String publicId,
String internalSubset)
|
void |
writeEmptyElement(String localName)
|
void |
writeEmptyElement(String nsURI,
String localName)
|
void |
writeEmptyElement(String prefix,
String localName,
String nsURI)
|
void |
writeEndDocument()
|
void |
writeEndElement()
|
void |
writeNamespace(String prefix,
String nsURI)
|
void |
writeStartElement(String localName)
|
void |
writeStartElement(String nsURI,
String localName)
|
void |
writeStartElement(String prefix,
String localName,
String nsURI)
|
Methods inherited from class org.codehaus.stax2.ri.dom.DOMWrappingWriter |
---|
close, closeCompletely, copyEventFromReader, flush, getEncoding, getLocation, getValueEncoder, reportUnsupported, serializeQNameValue, setNamespaceContext, setValidationProblemHandler, stopValidatingAgainst, stopValidatingAgainst, throwOutputError, throwOutputError, validateAgainst, writeBinary, writeBinary, writeBinaryAttribute, writeBinaryAttribute, writeBoolean, writeBooleanAttribute, writeCData, writeCData, writeCharacters, writeCharacters, writeComment, writeDecimal, writeDecimalAttribute, writeDouble, writeDoubleArray, writeDoubleArrayAttribute, writeDoubleAttribute, writeDTD, writeEntityRef, writeFloat, writeFloatArray, writeFloatArrayAttribute, writeFloatAttribute, writeFullEndElement, writeInt, writeIntArray, writeIntArrayAttribute, writeIntAttribute, writeInteger, writeIntegerAttribute, writeLong, writeLongArray, writeLongArrayAttribute, writeLongAttribute, writeProcessingInstruction, writeProcessingInstruction, writeQName, writeQNameAttribute, writeRaw, writeRaw, writeRaw, writeSpace, writeSpace, writeStartDocument, writeStartDocument, writeStartDocument, writeStartDocument |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final WriterConfig _config
protected DOMOutputElement _currElem
Note: explicit empty element (written using
writeEmptyElement
) will never become
current element.
protected DOMOutputElement _openElement
writeStartElement
and
writeEmptyElement
, and can be used to
add attributes and namespace declarations.
Note: while this is often the same as _currElem
,
it's not always. Specifically, an empty element (written
explicitly using writeEmptyElement
) will
become open element but NOT current element. Conversely,
regular elements will remain current element when
non elements are written (text, comments, PI), but
not the open element.
protected int[] _autoNsSeq
protected String _suggestedDefNs
protected String _automaticNsPrefix
Method Detail |
---|
public static DOMWriterImpl createFrom(WriterConfig cfg, DOMResult dst) throws XMLStreamException
XMLStreamException
public NamespaceContext getNamespaceContext()
getNamespaceContext
in interface XMLStreamWriter
getNamespaceContext
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public String getPrefix(String uri)
getPrefix
in interface XMLStreamWriter
getPrefix
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public Object getProperty(String name)
getProperty
in interface XMLStreamWriter
getProperty
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public void setDefaultNamespace(String uri)
setDefaultNamespace
in interface XMLStreamWriter
setDefaultNamespace
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public void setPrefix(String prefix, String uri) throws XMLStreamException
setPrefix
in interface XMLStreamWriter
setPrefix
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
public void writeAttribute(String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
writeAttribute
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
public void writeAttribute(String nsURI, String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
writeAttribute
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
public void writeAttribute(String prefix, String nsURI, String localName, String value) throws XMLStreamException
writeAttribute
in interface XMLStreamWriter
writeAttribute
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
public void writeDefaultNamespace(String nsURI)
writeDefaultNamespace
in interface XMLStreamWriter
writeDefaultNamespace
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public void writeEmptyElement(String localName) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
writeEmptyElement
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
public void writeEmptyElement(String nsURI, String localName) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
writeEmptyElement
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
public void writeEmptyElement(String prefix, String localName, String nsURI) throws XMLStreamException
writeEmptyElement
in interface XMLStreamWriter
writeEmptyElement
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
public void writeEndDocument()
writeEndDocument
in interface XMLStreamWriter
writeEndDocument
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public void writeEndElement()
public void writeNamespace(String prefix, String nsURI) throws XMLStreamException
XMLStreamException
public void writeStartElement(String localName) throws XMLStreamException
XMLStreamException
public void writeStartElement(String nsURI, String localName) throws XMLStreamException
XMLStreamException
public void writeStartElement(String prefix, String localName, String nsURI) throws XMLStreamException
XMLStreamException
public boolean isPropertySupported(String name)
isPropertySupported
in interface org.codehaus.stax2.XMLStreamWriter2
isPropertySupported
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public boolean setProperty(String name, Object value)
setProperty
in interface org.codehaus.stax2.XMLStreamWriter2
setProperty
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
public void writeDTD(String rootName, String systemId, String publicId, String internalSubset) throws XMLStreamException
writeDTD
in interface org.codehaus.stax2.XMLStreamWriter2
writeDTD
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
XMLStreamException
protected void appendLeaf(Node n) throws IllegalStateException
appendLeaf
in class org.codehaus.stax2.ri.dom.DOMWrappingWriter
IllegalStateException
protected void createStartElem(String nsURI, String prefix, String localName, boolean isEmpty) throws XMLStreamException
nsURI
- Namespace URI to use: null and empty String denote 'no namespace'
XMLStreamException
protected void outputAttribute(String nsURI, String prefix, String localName, String value) throws XMLStreamException
XMLStreamException
protected final String findElemPrefix(String nsURI, DOMOutputElement elem) throws XMLStreamException
nsURI
- URI of namespace for which we need a prefix
XMLStreamException
protected final String generateElemPrefix(String suggPrefix, String nsURI, DOMOutputElement elem) throws XMLStreamException
findElemPrefix(java.lang.String, com.fasterxml.aalto.dom.DOMOutputElement)
has returned null,
to create and bind a namespace mapping for specified namespace.
XMLStreamException
protected final String findOrCreateAttrPrefix(String suggPrefix, String nsURI, DOMOutputElement elem) throws XMLStreamException
suggPrefix
- Suggested prefix to bind, if any; may be null
to indicate "no preference"nsURI
- URI of namespace for which we need a prefixelem
- Currently open start element, on which the attribute
will be added.
XMLStreamException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |