APIdia Launch Partner
Top Description Fields Constructors Methods
com.sun.xml.internal.stream.writers

public Class XMLDOMWriterImpl

extends Object
implements XMLStreamWriterBase
Class Inheritance
All Implemented Interfaces
com.sun.xml.internal.stream.writers.XMLStreamWriterBase, javax.xml.stream.XMLStreamWriter
Imports
com.sun.org.apache.xerces.internal.dom.CoreDocumentImpl, .DocumentImpl, java.lang.reflect.InvocationTargetException, .Method, javax.xml.XMLConstants, javax.xml.namespace.NamespaceContext, javax.xml.stream.XMLStreamException, .XMLStreamWriter, javax.xml.transform.dom.DOMResult, org.w3c.dom.Attr, .CDATASection, .Comment, .Document, .Element, .EntityReference, .Node, .ProcessingInstruction, .Text, org.xml.sax.helpers.NamespaceSupport

This class provides support to build a DOM tree using XMLStreamWriter API's.
Author
K Venugopal

Field Summary

Modifier and TypeField and Description
private Node
private int
private NamespaceSupport
private boolean[]
private Node
private Document
private int
private StringBuffer

Constructor Summary

AccessConstructor and Description
public
XMLDOMWriterImpl(DOMResult
DOMResult object @javax.xml.transform.dom.DOMResult
result
)

Creates a new instance of XMLDOMwriterImpl

Method Summary

Modifier and TypeMethod and Description
public void
close()

Implements javax.xml.stream.XMLStreamWriter.close.

This method has no effect when called.

public void
flush()

Implements javax.xml.stream.XMLStreamWriter.flush.

This method has no effect when called.

public NamespaceContext
getNamespaceContext()

Implements javax.xml.stream.XMLStreamWriter.getNamespaceContext.

Returns the current namespace context.

private Node
public String
getPrefix(String namespaceURI)

Implements javax.xml.stream.XMLStreamWriter.getPrefix.

Gets the prefix the uri is bound to.

public Object
getProperty(String str)

Implements javax.xml.stream.XMLStreamWriter.getProperty.

Is not supported in this implementation.

private String
getQName(String prefix, String localName)

private void
public void
setDefaultNamespace(String uri)

Implements javax.xml.stream.XMLStreamWriter.setDefaultNamespace.

Is not supported in this version of the implementation.

public void
setNamespaceContext(NamespaceContext namespaceContext)

Implements javax.xml.stream.XMLStreamWriter.setNamespaceContext.

Sets the current namespace context for prefix and uri bindings.

public void
setPrefix(String prefix, String uri)

Implements javax.xml.stream.XMLStreamWriter.setPrefix.

Is not supported in this version of the implementation.

public void
writeAttribute(String localName, String value)

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Creates a DOM Attribute org.w3c.dom.Node and associates it with the current DOM element org.w3c.dom.Node.

public void
writeAttribute(String namespaceURI, String localName, String value)

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Creates a DOM Attribute org.w3c.dom.Node and associates it with the current DOM element org.w3c.dom.Node.

public void
writeAttribute(String prefix, String namespaceURI, String localName, String value)

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Creates a DOM Attribute org.w3c.dom.Node and associates it with the current DOM element org.w3c.dom.Node.

public void
public void
writeCharacters(String charData)

Implements javax.xml.stream.XMLStreamWriter.writeCharacters.

Creates a character object org.w3c.dom.Text and appends it to the current element in the DOM tree.

public void
writeCharacters(char[] values, int param, int param2)

Implements javax.xml.stream.XMLStreamWriter.writeCharacters.

Creates a character object org.w3c.dom.Text and appends it to the current element in the DOM tree.

public void
writeComment(String str)

Implements javax.xml.stream.XMLStreamWriter.writeComment.

Creates a Comment object org.w3c.dom.Comment and appends it to the current element in the DOM tree.

public void
writeDefaultNamespace(String namespaceURI)

Implements javax.xml.stream.XMLStreamWriter.writeDefaultNamespace.

Creates a DOM attribute and adds it to the current element in the DOM tree.

public void
writeDTD(String str)

Implements javax.xml.stream.XMLStreamWriter.writeDTD.

This method is not supported in this implementation.

public void
writeEmptyElement(String localName)

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

creates a DOM Element and appends it to the current element in the tree.

public void
writeEmptyElement(String namespaceURI, String localName)

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

creates a DOM Element and appends it to the current element in the tree.

public void
writeEmptyElement(String prefix, String localName, String namespaceURI)

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

creates a DOM Element and appends it to the current element in the tree.

public void
writeEndDocument()

Implements javax.xml.stream.XMLStreamWriter.writeEndDocument.

Will reset current Node pointer maintained by the implementation.

public void
writeEndElement()

Implements javax.xml.stream.XMLStreamWriter.writeEndElement.

Internal current Node pointer will point to the parent of the current Node.

public void
writeEntityRef(String name)

Implements javax.xml.stream.XMLStreamWriter.writeEntityRef.

Is not supported in this implementation.

public void
writeNamespace(String prefix, String namespaceURI)

Implements javax.xml.stream.XMLStreamWriter.writeNamespace.

creates a namespace attribute and will associate it with the current element in the DOM tree.

public void
public void
public void
writeStartDocument()

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

will set version on the Document object when the DOM Node passed to this implementation supports DOM Level3 API's.

public void
writeStartDocument(String version)

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

will set version on the Document object when the DOM Node passed to this implementation supports DOM Level3 API's.

public void
writeStartDocument(String encoding, String version)

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

will set version on the Document object when the DOM Node passed to this implementation supports DOM Level3 API's.

public void
writeStartDocument(String encoding, String version, boolean standalone, boolean standaloneSet)

Implements com.sun.xml.internal.stream.writers.XMLStreamWriterBase.writeStartDocument.

Writes the XML declaration.

public void
writeStartElement(String localName)

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

creates a DOM Element and appends it to the current element in the tree.

public void
writeStartElement(String namespaceURI, String localName)

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

creates a DOM Element and appends it to the current element in the tree.

public void
writeStartElement(String prefix, String localName, String namespaceURI)

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

creates a DOM Element and appends it to the current element in the tree.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

currentNodeback to summary
private Node currentNode
depthback to summary
private int depth
namespaceContextback to summary
private NamespaceSupport namespaceContext
needContextPopback to summary
private boolean[] needContextPop
nodeback to summary
private Node node
ownerDocback to summary
private Document ownerDoc
resizeValueback to summary
private int resizeValue
stringBufferback to summary
private StringBuffer stringBuffer

Constructor Detail

XMLDOMWriterImplback to summary
public XMLDOMWriterImpl(DOMResult result)

Creates a new instance of XMLDOMwriterImpl

Parameters
result:DOMResult

DOMResult object @javax.xml.transform.dom.DOMResult

Method Detail

closeback to summary
public void close() throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.close.

This method has no effect when called.

Exceptions
XMLStreamException:
if an error occurs
flushback to summary
public void flush() throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.flush.

This method has no effect when called.

Exceptions
XMLStreamException:
if an error occurs
getNamespaceContextback to summary
public NamespaceContext getNamespaceContext()

Implements javax.xml.stream.XMLStreamWriter.getNamespaceContext.

Doc from javax.xml.stream.XMLStreamWriter.getNamespaceContext.

Returns the current namespace context.

getNodeback to summary
private Node getNode()
getPrefixback to summary
public String getPrefix(String namespaceURI) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.getPrefix.

Doc from javax.xml.stream.XMLStreamWriter.getPrefix.

Gets the prefix the uri is bound to.

Exceptions
XMLStreamException:
if an error occurs
getPropertyback to summary
public Object getProperty(String str) throws IllegalArgumentException

Implements javax.xml.stream.XMLStreamWriter.getProperty.

Is not supported in this implementation.

Exceptions
IllegalArgumentException:
if the property is not supported
getQNameback to summary
private String getQName(String prefix, String localName)
incDepthback to summary
private void incDepth()
setDefaultNamespaceback to summary
public void setDefaultNamespace(String uri) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.setDefaultNamespace.

Is not supported in this version of the implementation.

Exceptions
XMLStreamException:
if an error occurs
setNamespaceContextback to summary
public void setNamespaceContext(NamespaceContext namespaceContext) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.setNamespaceContext.

Doc from javax.xml.stream.XMLStreamWriter.setNamespaceContext.

Sets the current namespace context for prefix and uri bindings. This context becomes the root namespace context for writing and will replace the current root namespace context. Subsequent calls to setPrefix and setDefaultNamespace will bind namespaces using the context passed to the method as the root context for resolving namespaces. This method may only be called once at the start of the document. It does not cause the namespaces to be declared. If a namespace URI to prefix mapping is found in the namespace context it is treated as declared and the prefix may be used by the StreamWriter.

Exceptions
XMLStreamException:
if an error occurs
setPrefixback to summary
public void setPrefix(String prefix, String uri) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.setPrefix.

Is not supported in this version of the implementation.

Exceptions
XMLStreamException:
if an error occurs
writeAttributeback to summary
public void writeAttribute(String localName, String value) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Creates a DOM Attribute org.w3c.dom.Node and associates it with the current DOM element org.w3c.dom.Node.

Exceptions
XMLStreamException:
if an error occurs
writeAttributeback to summary
public void writeAttribute(String namespaceURI, String localName, String value) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Creates a DOM Attribute org.w3c.dom.Node and associates it with the current DOM element org.w3c.dom.Node.

Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeAttributeback to summary
public void writeAttribute(String prefix, String namespaceURI, String localName, String value) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeAttribute.

Creates a DOM Attribute org.w3c.dom.Node and associates it with the current DOM element org.w3c.dom.Node.

Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeCDataback to summary
public void writeCData(String data) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeCData.

Creates a CDATA object org.w3c.dom.CDATASection.

Exceptions
XMLStreamException:
if an error occurs
writeCharactersback to summary
public void writeCharacters(String charData) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeCharacters.

Creates a character object org.w3c.dom.Text and appends it to the current element in the DOM tree.

Exceptions
XMLStreamException:
if an error occurs
writeCharactersback to summary
public void writeCharacters(char[] values, int param, int param2) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeCharacters.

Creates a character object org.w3c.dom.Text and appends it to the current element in the DOM tree.

Exceptions
XMLStreamException:
if an error occurs
writeCommentback to summary
public void writeComment(String str) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeComment.

Creates a Comment object org.w3c.dom.Comment and appends it to the current element in the DOM tree.

Exceptions
XMLStreamException:
if an error occurs
writeDefaultNamespaceback to summary
public void writeDefaultNamespace(String namespaceURI) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeDefaultNamespace.

Creates a DOM attribute and adds it to the current element in the DOM tree.

Exceptions
XMLStreamException:
if an error occurs
writeDTDback to summary
public void writeDTD(String str) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeDTD.

This method is not supported in this implementation.

Exceptions
XMLStreamException:
if an error occurs
writeEmptyElementback to summary
public void writeEmptyElement(String localName) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

creates a DOM Element and appends it to the current element in the tree.

Exceptions
XMLStreamException:
if an error occurs
writeEmptyElementback to summary
public void writeEmptyElement(String namespaceURI, String localName) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

creates a DOM Element and appends it to the current element in the tree.

Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeEmptyElementback to summary
public void writeEmptyElement(String prefix, String localName, String namespaceURI) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeEmptyElement.

creates a DOM Element and appends it to the current element in the tree.

Exceptions
XMLStreamException:
if an error occurs
writeEndDocumentback to summary
public void writeEndDocument() throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeEndDocument.

Will reset current Node pointer maintained by the implementation.

Exceptions
XMLStreamException:
if an error occurs
writeEndElementback to summary
public void writeEndElement() throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeEndElement.

Internal current Node pointer will point to the parent of the current Node.

Exceptions
XMLStreamException:
if an error occurs
writeEntityRefback to summary
public void writeEntityRef(String name) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeEntityRef.

Is not supported in this implementation.

Exceptions
XMLStreamException:
if an error occurs
writeNamespaceback to summary
public void writeNamespace(String prefix, String namespaceURI) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeNamespace.

creates a namespace attribute and will associate it with the current element in the DOM tree.

Exceptions
XMLStreamException:
if an error occurs
writeProcessingInstructionback to summary
public void writeProcessingInstruction(String target) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeProcessingInstruction.

is not supported in this release.

Exceptions
XMLStreamException:
if an error occurs
writeProcessingInstructionback to summary
public void writeProcessingInstruction(String target, String data) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeProcessingInstruction.

is not supported in this release.

Exceptions
XMLStreamException:
if an error occurs
writeStartDocumentback to summary
public void writeStartDocument() throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

will set version on the Document object when the DOM Node passed to this implementation supports DOM Level3 API's.

Exceptions
XMLStreamException:
if an error occurs
writeStartDocumentback to summary
public void writeStartDocument(String version) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

will set version on the Document object when the DOM Node passed to this implementation supports DOM Level3 API's.

Exceptions
XMLStreamException:
if an error occurs
writeStartDocumentback to summary
public void writeStartDocument(String encoding, String version) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeStartDocument.

will set version on the Document object when the DOM Node passed to this implementation supports DOM Level3 API's.

Exceptions
XMLStreamException:
If given encoding does not match encoding of the underlying stream
writeStartDocumentback to summary
public void writeStartDocument(String encoding, String version, boolean standalone, boolean standaloneSet) throws XMLStreamException

Implements com.sun.xml.internal.stream.writers.XMLStreamWriterBase.writeStartDocument.

Doc from com.sun.xml.internal.stream.writers.XMLStreamWriterBase.writeStartDocument.

Writes the XML declaration.

Annotations
@Override
Exceptions
XMLStreamException:
in case of an IOException
writeStartElementback to summary
public void writeStartElement(String localName) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

creates a DOM Element and appends it to the current element in the tree.

Exceptions
XMLStreamException:
if an error occurs
writeStartElementback to summary
public void writeStartElement(String namespaceURI, String localName) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

creates a DOM Element and appends it to the current element in the tree.

Exceptions
XMLStreamException:
if the namespace URI has not been bound to a prefix and javax.xml.stream.isRepairingNamespaces has not been set to true
writeStartElementback to summary
public void writeStartElement(String prefix, String localName, String namespaceURI) throws XMLStreamException

Implements javax.xml.stream.XMLStreamWriter.writeStartElement.

creates a DOM Element and appends it to the current element in the tree.

Exceptions
XMLStreamException:
if an error occurs