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

public Class ContentHandlerRecord

extends MarshalRecord
Class Inheritance
Imports
java.util.ArrayList, .List, .Map.Entry, org.eclipse.persistence.exceptions.XMLMarshalException, org.eclipse.persistence.internal.oxm.Constants, .NamespaceResolver, .XPathFragment, org.eclipse.persistence.internal.oxm.record.XMLFragmentReader, org.w3c.dom.Attr, .Node, org.xml.sax.ContentHandler, .SAXException, org.xml.sax.ext.LexicalHandler, org.xml.sax.helpers.AttributesImpl

Use this type of MarshalRecord when the marshal target is a ContentHandler.

XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
ContentHandlerRecord contentHandlerRecord = new ContentHandlerRecord();
marshalRecord.setContentHandler(myContentHandler);
xmlMarshaller.marshal(myObject, contentHandlerRecord);

If the marshal(ContentHandler) method is called on XMLMarshaller, then the ContentHanlder is automatically wrapped in a ContentHandlerRecord.

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

See Also
org.eclipse.persistence.oxm.XMLMarshaller

Field Summary

Modifier and TypeField and Description
private AttributesImpl
private ContentHandler
pack-priv List<String>
protected boolean
private LexicalHandler
private List<List<String>>
private XPathFragment<XML_FIELD extends Field>
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.

INTERNAL:
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.
qName
,
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.

INTERNAL:
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.

INTERNAL:
public void
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.

INTERNAL:
public void
public void
endElement(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
)

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

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

INTERNAL:
public void
public ContentHandler

Returns:

The marshal target.
getContentHandler
()

Return the ContentHandler that the object will be marshalled to.

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 namespace URI/prefix of the node
namespaceResolver
,
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.
private void
openAndCloseStartElement()

INTERNAL: Create a start element tag - this call results in a complete start element, i.e. closeStartElement() does not need to be called after a call to this method.

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.

INTERNAL:
public String
resolveNamespacePrefix(XPathFragment<XML_FIELD extends Field> frag, NamespaceResolver resolver)

public String
public void
setContentHandler(ContentHandler
The marshal target.
contentHandler
)

Set the ContentHandler that the object will be marshalled to.

public void
setLexicalHandler(LexicalHandler lexicalHandler)

Set the LexicalHandler to receive CDATA related events

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.

INTERNAL:
public void
public void
Inherited from org.eclipse.persistence.oxm.record.MarshalRecord:
addaddGroupingElementaddPositionalNodesafterContainmentMarshalattributebeforeContainmentMarshalcharactersclearcloseStartGroupingElementsdefaultNamespaceDeclarationemptyAttributeemptyCollectionemptyComplexemptySimpleendCollectionendPrefixMappingsflushforceValueWrappergetCurrentAttributeGroupgetCycleDetectionStackgetDocumentgetDOMgetGroupingElementsgetLocalNamegetNameForFragmentgetNamespaceURIgetPositionalNodesgetPrefixBytesgetPrefixForFragmentgetStringForQNamegetTextWrapperFragmentgetValueToWriteisWrapperAsCollectionNamemarshalWithoutRootElementnamespaceDeclarationnilComplexnilSimplenodeopenStartGroupingElementspopAttributeGrouppredicateAttributeprocessNamespaceResolverForXSIPrefixpushAttributeGroupputremoveGroupingElementsetGroupingElementsetSessionsplitCDatastartCollectiontransformToXMLwriteHeader

Field Detail

attributesback to summary
private AttributesImpl attributes
contentHandlerback to summary
private ContentHandler contentHandler
currentLevelPrefixMappingsback to summary
pack-priv List<String> currentLevelPrefixMappings
isStartElementOpenback to summary
protected boolean isStartElementOpen
lexicalHandlerback to summary
private LexicalHandler lexicalHandler
prefixMappingsback to summary
private List<List<String>> prefixMappings
xPathFragmentback to summary
private XPathFragment<XML_FIELD extends Field> xPathFragment

Constructor Detail

ContentHandlerRecordback to summary
public ContentHandlerRecord()

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.

INTERNAL:

Parameters
xPathFragment:XPathFragment<XML_FIELD extends Field>

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

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

namespaceResolver:NamespaceResolver

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

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

value:String

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

This is the complete value for the attribute.

Annotations
@Override
attributeback to summary
public void attribute(String namespaceURI, String localName, String qName, 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.

INTERNAL:

Parameters
namespaceURI:String

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

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

localName:String

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

The local name of the attribute.

qName:String

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

The qualified name of the attribute.

value:String

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

This is the complete value for the attribute.

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.

INTERNAL:

Parameters
value:String

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

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.

INTERNAL:

Parameters
value:String

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

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.

INTERNAL:

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

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

INTERNAL:

Parameters
frag:XPathFragment<XML_FIELD extends Field>

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

The XPathFragment of the element

Annotations
@Override
endDocumentback to summary
public void endDocument()

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

INTERNAL:

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

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

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

INTERNAL:

Parameters
xPathFragment:XPathFragment<XML_FIELD extends Field>

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

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

namespaceResolver:NamespaceResolver

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

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

Annotations
@Override
endPrefixMappingback to summary
public void endPrefixMapping(String prefix)

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

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

INTERNAL:

Parameters
prefix:String

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

The namespace prefix.

Annotations
@Override
getContentHandlerback to summary
public ContentHandler getContentHandler()

Return the ContentHandler that the object will be marshalled to.

Returns:ContentHandler

The marshal target.

namespaceDeclarationsback to summary
public void namespaceDeclarations(NamespaceResolver namespaceResolver)

Overrides 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 namespaceResolver, String uri, String name)

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

Receive notification of a node.

Parameters
node:Node

The Node to be added to the document

namespaceResolver:NamespaceResolver

The NamespaceResolver can be used to resolve the namespace URI/prefix of the node

uri:String

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

replacement root name for the node

name:String

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

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

Annotations
@Override
openAndCloseStartElementback to summary
private void openAndCloseStartElement()

INTERNAL: Create a start element tag - this call results in a complete start element, i.e. closeStartElement() does not need to be called after a call to this method.

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.

INTERNAL:

Parameters
xPathFragment:XPathFragment<XML_FIELD extends Field>

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

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

namespaceResolver:NamespaceResolver

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

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

Annotations
@Override
resolveNamespacePrefixback to summary
public String resolveNamespacePrefix(XPathFragment<XML_FIELD extends Field> frag, NamespaceResolver resolver)
resolveNamespacePrefixback to summary
public String resolveNamespacePrefix(String s)

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

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

Annotations
@Override
setContentHandlerback to summary
public void setContentHandler(ContentHandler contentHandler)

Set the ContentHandler that the object will be marshalled to.

Parameters
contentHandler:ContentHandler

The marshal target.

setLexicalHandlerback to summary
public void setLexicalHandler(LexicalHandler lexicalHandler)

Set the LexicalHandler to receive CDATA related events

startDocumentback to summary
public void startDocument(String encoding, String version)

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

INTERNAL:

Parameters
encoding:String

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

The XML document will be encoded using this encoding.

version:String

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

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.

INTERNAL:

Parameters
prefix:String

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

The namespace prefix.

namespaceURI:String

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

The namespace URI.

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

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

Annotations
@Override