Use this type of MarshalRecord when the marshal target is a Node.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
NodeRecord nodeRecord = new NodeRecord();
nodeRecord.setDOM(myNode);
xmlMarshaller.marshal(myObject, nodeRecord);
If the marshal(Node) method is called on XMLMarshaller, then the Writer is automatically wrapped in a NodeRecord.
XMLContext xmlContext = new XMLContext("session-name");
XMLMarshaller xmlMarshaller = xmlContext.createMarshaller();
xmlMarshaller.marshal(myObject, myNode);
org.eclipse.persistence.oxm.XMLMarshaller
| Modifier and Type | Class and Description |
|---|---|
| protected class | NodeRecord.NodeRecordContentHandler
This class will typically be used in conjunction with an XMLFragmentReader. |
| Access | Constructor and Description |
|---|---|
| public | |
| public | |
| public | NodeRecord(String rootElementName, NamespaceResolver namespaceResolver)
INTERNAL: Create a record with the root element name get the namespace URI from the namespaceResolver. |
| public | NodeRecord(String localRootElementName, Node parent)
INTERNAL: Create a record with the local root element name, that is a child of the parent. |
| public | NodeRecord(String localRootElementName, NamespaceResolver namespaceResolver, Node parent)
INTERNAL: Create a record with the local root element name, that is a child of the parent. |
| public |
| Modifier and Type | Method 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. Implements org. |
| 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. Implements org. |
| public void | cdata(String
This is the value of the text to be wrapped value)Implements abstract org. Implements org. |
| public void | characters(String
This is the entire value of the text node. value)Implements abstract org. Implements org. |
| public void | |
| public void | closeStartElement()
Implements abstract org. Implements org. |
| public void | element(XPathFragment<XML_FIELD extends Field>
The XPathFragment of the element frag)Implements abstract org. |
| public void | endDocument()
Implements abstract org. |
| 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. Implements org. |
| public Document | |
| public Node | Returns: The marshal target.Overrides org. Implements org. |
| public String | |
| public String | |
| public void | node(Node
The Node to be added to the document node, NamespaceResolver The NamespaceResolver can be used to resolve the 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. |
| 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. Implements org. |
| private String | resolveNamespace(NamespaceResolver namespaceResolver, String localName)
INTERNAL: Return the namespace uri for the prefix of the given local name |
| 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. |
| public void | startPrefixMappings(NamespaceResolver namespaceResolver)
Overrides org. |
| public String |
| document | back to summary |
|---|---|
| private Document document | |
| node | back to summary |
|---|---|
| private Node node | |
| NodeRecord | back to summary |
|---|---|
| public NodeRecord() INTERNAL: Default constructor. | |
| NodeRecord | back to summary |
|---|---|
| public NodeRecord(String rootElementName) INTERNAL: Create a record with the root element name. | |
| NodeRecord | back to summary |
|---|---|
| public NodeRecord(String rootElementName, NamespaceResolver namespaceResolver) INTERNAL: Create a record with the root element name get the namespace URI from the namespaceResolver. | |
| NodeRecord | back to summary |
|---|---|
| public NodeRecord(String localRootElementName, Node parent) INTERNAL: Create a record with the local root element name, that is a child of the parent. | |
| NodeRecord | back to summary |
|---|---|
| public NodeRecord(String localRootElementName, NamespaceResolver namespaceResolver, Node parent) INTERNAL: Create a record with the local root element name, that is a child of the parent. Lookup the namespace URI from the namespaceResolver. | |
| NodeRecord | back to summary |
|---|---|
| public NodeRecord(Node node) INTERNAL: Create a record with the element. | |
| attribute | back to summary |
|---|---|
| public void attribute(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver, String value) Implements abstract org. Implements org. INTERNAL:
| |
| attribute | back to summary |
|---|---|
| public void attribute(String namespaceURI, String localName, String qName, String value) Implements abstract org. Implements org. INTERNAL:
| |
| cdata | back to summary |
|---|---|
| public void cdata(String value) Implements abstract org. Implements org. Doc from org. Receive notification of character data to be wrapped in a CDATA node. | |
| characters | back to summary |
|---|---|
| public void characters(String value) Implements abstract org. Implements org. INTERNAL:
| |
| clear | back to summary |
|---|---|
| public void clear() Overrides org.
| |
| closeStartElement | back to summary |
|---|---|
| public void closeStartElement() Implements abstract org. Implements org. INTERNAL:
| |
| element | back to summary |
|---|---|
| public void element(XPathFragment<XML_FIELD extends Field> frag) Implements abstract org. INTERNAL:
| |
| endDocument | back to summary |
|---|---|
| public void endDocument() Implements abstract org. INTERNAL:
| |
| endElement | back to summary |
|---|---|
| public void endElement(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver) Implements abstract org. Implements org. INTERNAL:
| |
| getDocument | back to summary |
|---|---|
| public Document getDocument() Overrides org.
| |
| getDOM | back to summary |
|---|---|
| public Node getDOM() Overrides org. Implements org. Return the Node that the object will be marshalled to. | |
| getLocalName | back to summary |
|---|---|
| public String getLocalName() Overrides org.
| |
| getNamespaceURI | back to summary |
|---|---|
| public String getNamespaceURI() Overrides org.
| |
| node | back to summary |
|---|---|
| public void node(Node node, NamespaceResolver namespaceResolver, String uri, String name) Implements abstract org. Doc from org. Receive notification of a node.
| |
| openStartElement | back to summary |
|---|---|
| public void openStartElement(XPathFragment<XML_FIELD extends Field> xPathFragment, NamespaceResolver namespaceResolver) Overrides org. Implements org. INTERNAL:
| |
| resolveNamespace | back to summary |
|---|---|
| private String resolveNamespace(NamespaceResolver namespaceResolver, String localName) INTERNAL: Return the namespace uri for the prefix of the given local name | |
| setDOM | back to summary |
|---|---|
| public void setDOM(Node dom) Set the Node that the object will be marshalled to.
| |
| startDocument | back to summary |
|---|---|
| public void startDocument(String encoding, String version) Implements abstract org. INTERNAL:
| |
| startPrefixMappings | back to summary |
|---|---|
| public void startPrefixMappings(NamespaceResolver namespaceResolver) Overrides org. INTERNAL: override so we don't iterate over namespaces when startPrefixMapping doesn't do anything
| |
| transformToXML | back to summary |
|---|---|
| public String transformToXML() Overrides org.
| |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| public void | comment(char[]
An array holding the characters in the comment. ch, int The starting position in the array. start, int The number of characters to use from the array. length)Implements org. |
| public void | |
| public void | |
| public void | endEntity(String
The name of the entity that is ending. name)Implements org. |
| public void | startCDATA()
Implements org. |
| public void | startDTD(String
The document type name. name, String The declared public identifier for the
external DTD subset, or null if none was declared. publicId, String The declared system identifier for the
external DTD subset, or null if none was declared.
(Note that this is not resolved against the document
base URI.) systemId)Implements org. |
| public void | startElement(String
the Namespace URI, or the empty string if the
element has no Namespace URI or if Namespace
processing is not being performed namespaceURI, String the local name (without prefix), or the
empty string if Namespace processing is not being
performed localName, String the qualified name (with prefix), or the
empty string if qualified names are not available qName, Attributes the attributes attached to the element. If
there are no attributes, it shall be an empty
Attributes object. The value of this object after
startElement returns is undefined atts)Overrides org. Implements org. |
| public void | startEntity(String
The name of the entity. If it is a parameter
entity, the name will begin with '%', and if it is the
external DTD subset, it will be "[dtd]". name)Implements org. |
| public void | startPrefixMapping(String
the Namespace prefix being declared.
An empty string is used for the default element namespace,
which has no prefix. prefix, String the Namespace URI the prefix is mapped to uri)Overrides org. Implements org. |
| prefixMappings | back to summary |
|---|---|
| pack-priv Map<String, String> prefixMappings | |
| NodeRecordContentHandler | back to summary |
|---|---|
| public NodeRecordContentHandler(NodeRecord nRec, NamespaceResolver resolver) | |
| comment | back to summary |
|---|---|
| public void comment(char[] ch, int start, int length) throws SAXException Implements org. Doc from org. Report an XML comment anywhere in the document. This callback will be used for comments inside or outside the document element, including comments in the external DTD subset (if read). Comments in the DTD must be properly nested inside start/endDTD and start/endEntity events (if used).
| |
| endCDATA | back to summary |
|---|---|
| public void endCDATA() throws SAXException Implements org. Doc from org. Report the end of a CDATA section.
| |
| endDTD | back to summary |
|---|---|
| public void endDTD() throws SAXException Implements org. Doc from org. Report the end of DTD declarations. This method is intended to report the end of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked.
| |
| endEntity | back to summary |
|---|---|
| public void endEntity(String name) throws SAXException Implements org. Doc from org. Report the end of an entity.
| |
| startCDATA | back to summary |
|---|---|
| public void startCDATA() throws SAXException Implements org. Doc from org. Report the start of a CDATA section. The contents of the CDATA section will be reported through
the regular
| |
| startDTD | back to summary |
|---|---|
| public void startDTD(String name, String publicId, String systemId) throws SAXException Implements org. Doc from org. Report the start of DTD declarations, if any. This method is intended to report the beginning of the DOCTYPE declaration; if the document has no DOCTYPE declaration, this method will not be invoked. All declarations reported through
Note that the start/endDTD events will appear within
the start/endDocument events from ContentHandler and
before the first
| |
| startElement | back to summary |
|---|---|
| public void startElement(String namespaceURI, String localName, String qName, Attributes atts) throws SAXException Overrides org. Implements org. Doc from org. Receive notification of the beginning of an element. The Parser will invoke this method at the beginning of every
element in the XML document; there will be a corresponding
This event allows up to three name components for each element:
Any or all of these may be provided, depending on the values of the http://xml.org/sax/features/namespaces and the http://xml.org/sax/features/namespace-prefixes properties:
Note that the attribute list provided will contain only
attributes with explicit values (specified or defaulted):
#IMPLIED attributes will be omitted. The attribute list
will contain attributes used for Namespace declarations
(xmlns* attributes) only if the
Like
| |
| startEntity | back to summary |
|---|---|
| public void startEntity(String name) throws SAXException Implements org. Doc from org. Report the beginning of some internal and external XML entities. The reporting of parameter entities (including
the external DTD subset) is optional, and SAX2 drivers that
report LexicalHandler events may not implement it; you can use the
General entities are reported with their regular names, parameter entities have '%' prepended to their names, and the external DTD subset has the pseudo-entity name "[dtd]". When a SAX2 driver is providing these events, all other
events must be properly nested within start/end entity
events. There is no additional requirement that events from
Note that skipped entities will be reported through the
Because of the streaming event model that SAX uses, some entity boundaries cannot be reported under any circumstances:
These will be silently expanded, with no indication of where the original entity boundaries were. Note also that the boundaries of character references (which are not really entities anyway) are not reported. All start/endEntity events must be properly nested.
| |
| startPrefixMapping | back to summary |
|---|---|
| public void startPrefixMapping(String prefix, String uri) throws SAXException Overrides org. Implements org. Doc from org. Begin the scope of a prefix-URI Namespace mapping. The information from this event is not necessary for
normal Namespace processing: the SAX XML reader will
automatically replace prefixes for element and attribute
names when the There are cases, however, when applications need to use prefixes in character data or in attribute values, where they cannot safely be expanded automatically; the start/endPrefixMapping event supplies the information to the application to expand prefixes in those contexts itself, if necessary. Note that start/endPrefixMapping events are not
guaranteed to be properly nested relative to each other:
all startPrefixMapping events will occur immediately before the
corresponding There should never be start/endPrefixMapping events for the "xml" prefix, since it is predeclared and immutable.
| |