org.jibx.extras
Class Dom4JMapperBase

java.lang.Object
  extended byorg.jibx.extras.DocumentModelMapperBase
      extended byorg.jibx.extras.Dom4JMapperBase
Direct Known Subclasses:
Dom4JElementMapper, Dom4JListMapper

public class Dom4JMapperBase
extends DocumentModelMapperBase

Base implementation for custom marshaller/unmarshallers to dom4j representation. This provides the basic code used for both single element and content list handling.

Version:
1.0
Author:
Dennis M. Sosnoski

Field Summary
protected  int m_defaultNamespaceIndex
          Current default namespace index.
protected  java.lang.String m_defaultNamespaceURI
          Current default namespace URI (null if not determined).
private static org.dom4j.DocumentFactory s_factory
          dom4j component construction factory.
 
Fields inherited from class org.jibx.extras.DocumentModelMapperBase
m_unmarshalContext, m_xmlWriter, XML_NAMESPACE, XMLNS_NAMESPACE
 
Constructor Summary
Dom4JMapperBase()
           
 
Method Summary
private  int findNamespaceIndex(org.dom4j.Namespace ns)
          Get index number for declared namespace.
protected  void marshalContent(java.util.List content)
          Marshal content list.
protected  void marshalElement(org.dom4j.Element element)
          Marshal element with all attributes and content.
protected  void unmarshalContent(java.util.List content)
          Unmarshal element content.
protected  org.dom4j.Element unmarshalElement()
          Unmarshal element with all attributes and content.
 
Methods inherited from class org.jibx.extras.DocumentModelMapperBase
accumulateText, getNamespaceUri, getNextNamespaceIndex, isWhitespace
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

s_factory

private static org.dom4j.DocumentFactory s_factory
dom4j component construction factory.


m_defaultNamespaceURI

protected java.lang.String m_defaultNamespaceURI
Current default namespace URI (null if not determined).


m_defaultNamespaceIndex

protected int m_defaultNamespaceIndex
Current default namespace index.

Constructor Detail

Dom4JMapperBase

public Dom4JMapperBase()
Method Detail

findNamespaceIndex

private int findNamespaceIndex(org.dom4j.Namespace ns)
Get index number for declared namespace.

Parameters:
ns - namespace of interest
Returns:
namespace index number, or -1 if not declared or masked

marshalContent

protected void marshalContent(java.util.List content)
                       throws JiBXException,
                              java.io.IOException
Marshal content list.

Parameters:
content - list of content items to marshal
Throws:
JiBXException - on error in marshalling
java.io.IOException - on error writing to output

marshalElement

protected void marshalElement(org.dom4j.Element element)
                       throws JiBXException,
                              java.io.IOException
Marshal element with all attributes and content.

Parameters:
element - element to be marshalled
Throws:
JiBXException - on error in marshalling
java.io.IOException - on error writing to output

unmarshalContent

protected void unmarshalContent(java.util.List content)
                         throws JiBXException,
                                java.io.IOException
Unmarshal element content. This unmarshals everything up to the containing element close tag, adding each component to the content list supplied. On return, the parse position will always be at an END_TAG.

Parameters:
content - list for unmarshalled content
Throws:
JiBXException - on error in unmarshalling
java.io.IOException - on error reading input

unmarshalElement

protected org.dom4j.Element unmarshalElement()
                                      throws JiBXException,
                                             java.io.IOException
Unmarshal element with all attributes and content. This must be called with the unmarshalling context positioned at a START_TAG event.

Returns:
unmarshalled element
Throws:
JiBXException - on error in unmarshalling
java.io.IOException - on error reading input


Project Web Site