Top Description Fields Constructors Methods
org.eclipse.persistence.oxm.record

public Class XMLStreamWriterRecord

extends MarshalRecord
Class Inheritance
Imports
java.util.HashMap, .Map, javax.xml.namespace.NamespaceContext, javax.xml.stream.XMLStreamException, .XMLStreamWriter, org.eclipse.persistence.exceptions.XMLMarshalException, org.eclipse.persistence.internal.oxm.Constants, .NamespaceResolver, .XPathFragment, org.eclipse.persistence.internal.oxm.record.DomToXMLStreamWriter, org.w3c.dom.Document, .Node

Use this type of MarshalRecord when the marshal target is an XMLStreamWriter

XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
XMLStreamWriterRecord writerRecord = new XMLStreamWriterRecord(xmlStreamWriter);
xmlMarshaller.marshal(myObject, writerRecord);

See Also
org.eclipse.persistence.oxm.XMLMarshaller

Field Summary

Modifier and TypeField and Description
private DomToXMLStreamWriter
private NamespaceResolver
private Map<String, String>
private XMLStreamWriter
Inherited from org.eclipse.persistence.oxm.record.MarshalRecord:
COLON_W_SCHEMA_NIL_ATTRIBUTEtextWrapperFragmentTRUE

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
attribute(XPathFragment<XML_FIELD extends Field>
The XPathFragment contains the name and prefix information about the XML element being ended.
xPathFragment
,
NamespaceResolver
The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).
namespaceResolver
,
String
This is the complete value for the attribute.
value
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.attribute.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.attribute.

Receive notification of an attribute.
public void
attribute(String
The namespace URI, if the attribute is not namespace qualified the value of this parameter wil be null.
namespaceURI
,
String
The local name of the attribute.
localName
,
String
The qualified name of the attribute.
name
,
String
This is the complete value for the attribute.
value
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.attribute.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.attribute, org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord.attribute.

Receive notification of an attribute.
public void
public void
cdata(String
This is the value of the text to be wrapped
value
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.cdata.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.cdata.

Receive notification of character data to be wrapped in a CDATA node.
public void
characters(String
This is the entire value of the text node.
value
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.characters.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.characters.

Receive notification of character data.
public void
closeStartElement()

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.closeStartElement.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.closeStartElement.

Receive notification that all of the attribute events have occurred for the most recent element that has been started.
public void
public void
element(XPathFragment<XML_FIELD extends Field>
The XPathFragment of the element
frag
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.element.

Receive notification of an element.
public void
endDocument()

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.endDocument.

Recieve notification that a document is being ended.
public void
endElement(XPathFragment<XML_FIELD extends Field>
The XPathFragment contains the name and prefix information about the XML element being ended.
pathFragment
,
NamespaceResolver
The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).
namespaceResolver
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.endElement.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.endElement.

Receive notification that an element is being ended.
private DomToXMLStreamWriter
public XMLStreamWriter
public boolean
public void
public void
namespaceDeclarations(NamespaceResolver
The NamespaceResolver contains the namespace prefix and URI pairings that need to be declared.
namespaceResolver
)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.namespaceDeclarations.

INTERNAL: Add the namespace declarations to the XML document.
public void
node(Node
The Node to be added to the document
node
,
NamespaceResolver
The NamespaceResolver can be used to resolve the
resolver
,
String
replacement root name for the node
uri
,
String
replacement root namespace for the node namespace URI/prefix of the node
name
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.node.

Receive notification of a node.
public void
openStartElement(XPathFragment<XML_FIELD extends Field>
The XPathFragment contains the name and prefix information about the XML element being ended.
xPathFragment
,
NamespaceResolver
The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).
namespaceResolver
)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.openStartElement.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.openStartElement.

Receive notification that an element is being started.
public void
public void
startDocument(String
The XML document will be encoded using this encoding.
encoding
,
String
This specifies the version of XML.
version
)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.startDocument.

Receive notification that a document is being started.
public void
startPrefixMapping(String
The namespace prefix.
prefix
,
String
The namespace URI.
namespaceUri
)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.startPrefixMapping.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.startPrefixMapping.

Receive notification that a namespace has been declared.
public void
private void
Inherited from org.eclipse.persistence.oxm.record.MarshalRecord:
addaddGroupingElementaddPositionalNodesafterContainmentMarshalattributebeforeContainmentMarshalcharactersclearcloseStartGroupingElementsemptyAttributeemptyCollectionemptyComplexemptySimpleendCollectionendPrefixMappingendPrefixMappingsflushforceValueWrappergetCurrentAttributeGroupgetCycleDetectionStackgetDocumentgetDOMgetGroupingElementsgetLocalNamegetNameForFragmentgetNamespaceURIgetPositionalNodesgetPrefixBytesgetPrefixForFragmentgetStringForQNamegetTextWrapperFragmentgetValueToWriteisWrapperAsCollectionNamemarshalWithoutRootElementnilComplexnilSimplenodeopenStartGroupingElementspopAttributeGrouppredicateAttributeprocessNamespaceResolverForXSIPrefixpushAttributeGroupputremoveGroupingElementsetGroupingElementsetSessionsplitCDatastartCollectiontransformToXMLwriteHeader

Field Detail

domToStreamWriterback to summary
private DomToXMLStreamWriter domToStreamWriter
namespaceResolverback to summary
private NamespaceResolver namespaceResolver

Hides org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecordImpl.namespaceResolver.

prefixMappingback to summary
private Map<String, String> prefixMapping
xmlStreamWriterback to summary
private XMLStreamWriter xmlStreamWriter

Constructor Detail

XMLStreamWriterRecordback to summary
public XMLStreamWriterRecord(XMLStreamWriter xmlStreamWriter)

Method Detail

attributeback to summary
public void attribute(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver, String value)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.attribute.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.attribute.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.attribute.

Receive notification of an attribute.

Parameters
xPathFragment:XPathFragment<XML_FIELD extends Field>

The XPathFragment contains the name and prefix information about the XML element being ended.

namespaceResolver:NamespaceResolver

The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).

value:String

This is the complete value for the attribute.

Annotations
@Override
attributeback to summary
public void attribute(String namespaceURI, String localName, String name, String value)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.attribute.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.attribute, org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord.attribute.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.attribute.

Receive notification of an attribute.

Parameters
namespaceURI:String

The namespace URI, if the attribute is not namespace qualified the value of this parameter wil be null.

localName:String

The local name of the attribute.

name:String

The qualified name of the attribute.

value:String

This is the complete value for the attribute.

Annotations
@Override
attributeWithoutQNameback to summary
public void attributeWithoutQName(String namespaceURI, String localName, String prefix, String value)

Overrides org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecordImpl.attributeWithoutQName.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.attributeWithoutQName, org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord.attributeWithoutQName.

Annotations
@Override
cdataback to summary
public void cdata(String value)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.cdata.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.cdata.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.cdata.

Receive notification of character data to be wrapped in a CDATA node.

Parameters
value:String

This is the value of the text to be wrapped

Annotations
@Override
charactersback to summary
public void characters(String value)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.characters.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.characters.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.characters.

Receive notification of character data.

Parameters
value:String

This is the entire value of the text node.

Annotations
@Override
closeStartElementback to summary
public void closeStartElement()

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.closeStartElement.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.closeStartElement.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.closeStartElement.

Receive notification that all of the attribute events have occurred for the most recent element that has been started.

Annotations
@Override
defaultNamespaceDeclarationback to summary
public void defaultNamespaceDeclaration(String defaultNamespace)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.defaultNamespaceDeclaration.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.defaultNamespaceDeclaration.

Add the defaultNamespace declaration

Annotations
@Override
elementback to summary
public void element(XPathFragment<XML_FIELD extends Field> frag)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.element.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.element.

Receive notification of an element.

Parameters
frag:XPathFragment<XML_FIELD extends Field>

The XPathFragment of the element

Annotations
@Override
endDocumentback to summary
public void endDocument()

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.endDocument.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.endDocument.

Recieve notification that a document is being ended.

Annotations
@Override
endElementback to summary
public void endElement(XPathFragment<XML_FIELD extends Field> pathFragment, NamespaceResolver namespaceResolver)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.endElement.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.endElement.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.endElement.

Receive notification that an element is being ended.

Parameters
pathFragment:XPathFragment<XML_FIELD extends Field>

The XPathFragment contains the name and prefix information about the XML element being ended.

namespaceResolver:NamespaceResolver

The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).

Annotations
@Override
getDomToXMLStreamWriterback to summary
private DomToXMLStreamWriter getDomToXMLStreamWriter()
getXMLStreamWriterback to summary
public XMLStreamWriter getXMLStreamWriter()
isNamespaceAwareback to summary
public boolean isNamespaceAware()

Overrides org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecordImpl.isNamespaceAware.

Implements org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord.isNamespaceAware.

Doc from org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord.isNamespaceAware.

Determine if namespaces will be considered during marshal/unmarshal operations.

Annotations
@Override
namespaceDeclarationback to summary
public void namespaceDeclaration(String prefix, String namespaceURI)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.namespaceDeclaration.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.namespaceDeclaration, org.eclipse.persistence.internal.oxm.record.AbstractMarshalRecord.namespaceDeclaration.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.namespaceDeclaration.

Add the specified namespace declaration

Annotations
@Override
namespaceDeclarationsback to summary
public void namespaceDeclarations(NamespaceResolver namespaceResolver)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.namespaceDeclarations.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.namespaceDeclarations.

INTERNAL: Add the namespace declarations to the XML document.

Parameters
namespaceResolver:NamespaceResolver

The NamespaceResolver contains the namespace prefix and URI pairings that need to be declared.

Annotations
@Override
nodeback to summary
public void node(Node node, NamespaceResolver resolver, String uri, String name)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.node.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.node.

Receive notification of a node.

Parameters
node:Node

The Node to be added to the document

resolver:NamespaceResolver

The NamespaceResolver can be used to resolve the

uri:String

replacement root name for the node

name:String

replacement root namespace for the node namespace URI/prefix of the node

Annotations
@Override
openStartElementback to summary
public void openStartElement(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.openStartElement.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.openStartElement.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.openStartElement.

Receive notification that an element is being started.

Parameters
xPathFragment:XPathFragment<XML_FIELD extends Field>

The XPathFragment contains the name and prefix information about the XML element being ended.

namespaceResolver:NamespaceResolver

The NamespaceResolver can be used to resolve the namespace URI for the namespace prefix held by the XPathFragment (if required).

Annotations
@Override
setXMLStreamWriterback to summary
public void setXMLStreamWriter(XMLStreamWriter anXMLStreamWriter)
startDocumentback to summary
public void startDocument(String encoding, String version)

Implements abstract org.eclipse.persistence.oxm.record.MarshalRecord.startDocument.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.startDocument.

Receive notification that a document is being started.

Parameters
encoding:String

The XML document will be encoded using this encoding.

version:String

This specifies the version of XML.

Annotations
@Override
startPrefixMappingback to summary
public void startPrefixMapping(String prefix, String namespaceUri)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.startPrefixMapping.

Implements org.eclipse.persistence.internal.oxm.record.MarshalRecord.startPrefixMapping.

Doc from org.eclipse.persistence.oxm.record.MarshalRecord.startPrefixMapping.

Receive notification that a namespace has been declared.

Parameters
prefix:String

The namespace prefix.

namespaceUri:String

The namespace URI.

Annotations
@Override
startPrefixMappingsback to summary
public void startPrefixMappings(NamespaceResolver namespaceResolver)

Overrides org.eclipse.persistence.oxm.record.MarshalRecord.startPrefixMappings.

Annotations
@Override
writePrefixMappingsback to summary
private void writePrefixMappings()