public class DomMapperBase extends DocumentModelMapperBase
Base implementation for custom marshaller/unmarshallers to DOM representation. This provides the basic code used for both single element and content list handling.
| Modifier and Type | Field and Description |
|---|---|
protected int |
m_defaultNamespaceIndex
Current default namespace index.
|
protected java.lang.String |
m_defaultNamespaceURI
Current default namespace URI (
null if not determined). |
protected org.w3c.dom.Document |
m_document
Actual document instance (required by DOM).
|
m_unmarshalContext, m_xmlWriter, XML_NAMESPACE, XMLNS_NAMESPACE| Modifier | Constructor and Description |
|---|---|
protected |
DomMapperBase()
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
addNamespace(java.lang.String prefix,
java.lang.String uri,
java.util.ArrayList nss)
Add namespace information to list.
|
private void |
addNamespaceUnique(java.lang.String prefix,
java.lang.String uri,
java.util.ArrayList nss)
Add namespace information to list if not already present.
|
private int |
findNamespaceIndex(java.lang.String prefix,
java.lang.String uri)
Get index number for declared namespace.
|
private boolean |
isEquivalent(java.lang.String a,
java.lang.String b)
Check if a pair of strings are equivalent, meaning either equal or one
empty and the other
null. |
protected void |
marshalContent(org.w3c.dom.NodeList content)
Marshal node list.
|
protected void |
marshalElement(org.w3c.dom.Element element)
Marshal element with all attributes and content.
|
protected void |
marshalNode(org.w3c.dom.Node node)
Marshal node.
|
protected void |
unmarshalContent(org.w3c.dom.Node parent)
Unmarshal node content.
|
protected org.w3c.dom.Element |
unmarshalElement()
Unmarshal element with all attributes and content.
|
protected org.w3c.dom.Node |
unmarshalNode()
Unmarshal single node.
|
accumulateText, getNamespaceUri, getNextNamespaceIndex, isWhitespaceprotected org.w3c.dom.Document m_document
protected java.lang.String m_defaultNamespaceURI
null if not determined).protected int m_defaultNamespaceIndex
protected DomMapperBase()
throws JiBXException
JiBXException - on error creating documentprivate int findNamespaceIndex(java.lang.String prefix,
java.lang.String uri)
prefix - namespace prefix (null if none)uri - namespace URI (empty string if none)-1 if not declared or
maskedprotected void marshalNode(org.w3c.dom.Node node)
throws JiBXException,
java.io.IOException
node - node to be marshalledJiBXException - on error in marshallingjava.io.IOException - on error writing to outputprotected void marshalContent(org.w3c.dom.NodeList content)
throws JiBXException,
java.io.IOException
content - list of nodes to marshalJiBXException - on error in marshallingjava.io.IOException - on error writing to outputprivate void addNamespace(java.lang.String prefix,
java.lang.String uri,
java.util.ArrayList nss)
prefix - uri - nss - private boolean isEquivalent(java.lang.String a,
java.lang.String b)
null.a - non-null valueb - comparison value (may be null)true if equivalent, false if notprivate void addNamespaceUnique(java.lang.String prefix,
java.lang.String uri,
java.util.ArrayList nss)
prefix - uri - nss - protected void marshalElement(org.w3c.dom.Element element)
throws JiBXException,
java.io.IOException
element - element to be marshalledJiBXException - on error in marshallingjava.io.IOException - on error writing to outputprotected org.w3c.dom.Node unmarshalNode()
throws JiBXException,
java.io.IOException
JiBXException - on error in unmarshallingjava.io.IOException - on error reading inputprotected void unmarshalContent(org.w3c.dom.Node parent)
throws JiBXException,
java.io.IOException
parent - node to which children are to be addedJiBXException - on error in unmarshallingjava.io.IOException - on error reading inputprotected org.w3c.dom.Element unmarshalElement()
throws JiBXException,
java.io.IOException
JiBXException - on error in unmarshallingjava.io.IOException - on error reading input