public Node getDOM()
    {
        Object root = m_message.getRawData();
        try {
            String packageName = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_PACKAGE_NAME);
            String bindingName = (String)((TrxMessageHeader)this.getMessage().getMessageHeader()).get(SOAPMessageTransport.JIBX_BINDING_NAME);
            if (bindingName == null)
            {
            	packageName = root.getClass().getName();
            	packageName = packageName.substring(0, packageName.lastIndexOf('.'));
            	((TrxMessageHeader)this.getMessage().getMessageHeader()).put(SOAPMessageTransport.JIBX_PACKAGE_NAME, packageName);
            }

            Node node = null;            
//            DocumentBuilder db = Util.getDocumentBuilder();
            Document doc = null;            
            
            IMarshallingContext mctx = JibxContexts.getJIBXContexts().getMarshaller(packageName, bindingName);
            if (mctx == null)
                return null;
            synchronized(mctx)
            {   // Since the marshaller is shared (may want to tweek this for multi-cpu implementations)
//?            	DomElementMapper domElementMapper  = new DomElementMapper();
//?            	m.marshalDocument(domElementMapper);
//?            	domElementMapper.marshal(root, m);
//?                IBindingFactory bfact = BindingDirectory.getFactory(clazz);
//?                IMarshallingContext mctx = bfact.createMarshallingContext();
                
            	String[] namespaces = JibxContexts.getJIBXContexts().get(packageName, bindingName).getFactory().getNamespaces();
                JDOMWriter jdomWriter = new JDOMWriter(namespaces);
                mctx.setXmlWriter(jdomWriter);
                mctx.marshalDocument(root);
                mctx.endDocument();
                
                org.jdom.Document jdoc = jdomWriter.getDocument();
                
                DOMOutputter dout = new DOMOutputter();
                doc = dout.output(jdoc);
            }
            node = doc.getDocumentElement();

            if (node != null)
                return node;
        } catch (JiBXException ex)   {
            ex.printStackTrace();
        } catch (java.lang.IllegalArgumentException ex)   {
            ex.printStackTrace();
        } catch (JDOMException e) {
			e.printStackTrace();
		}
        return super.getDOM();
    }
public Node getDOM ( ) { Object root = m_message . getRawData ( ) ; try { String packageName = ( String ) ( ( TrxMessageHeader ) this . getMessage ( ) . getMessageHeader ( ) ) . get ( SOAPMessageTransport . JIBX_PACKAGE_NAME ) ; String bindingName = ( String ) ( ( TrxMessageHeader ) this . getMessage ( ) . getMessageHeader ( ) ) . get ( SOAPMessageTransport . JIBX_BINDING_NAME ) ; if ( bindingName == null ) { packageName = root . getClass ( ) . getName ( ) ; packageName = packageName . substring ( 0 , packageName . lastIndexOf ( '.' ) ) ; ( ( TrxMessageHeader ) this . getMessage ( ) . getMessageHeader ( ) ) . put ( SOAPMessageTransport . JIBX_PACKAGE_NAME , packageName ) ; } Node node = null ; Document doc = null ; IMarshallingContext mctx = JibxContexts . getJIBXContexts ( ) . getMarshaller ( packageName , bindingName ) ; if ( mctx == null ) return null ; synchronized ( mctx ) { String [ ] namespaces = JibxContexts . getJIBXContexts ( ) . get ( packageName , bindingName ) . getFactory ( ) . getNamespaces ( ) ; JDOMWriter jdomWriter = new JDOMWriter ( namespaces ) ; mctx . setXmlWriter ( jdomWriter ) ; mctx . marshalDocument ( root ) ; mctx . endDocument ( ) ; org . jdom . Document jdoc = jdomWriter . getDocument ( ) ; DOMOutputter dout = new DOMOutputter ( ) ; doc = dout . output ( jdoc ) ; } node = doc . getDocumentElement ( ) ; if ( node != null ) return node ; } catch ( JiBXException ex ) { ex . printStackTrace ( ) ; } catch ( java . lang . IllegalArgumentException ex ) { ex . printStackTrace ( ) ; } catch ( JDOMException e ) { e . printStackTrace ( ) ; } return super . getDOM ( ) ; }
Convert this tree to a DOM object.
Currently this is lame because I convert the tree to text, then to DOM.
In the future, jaxb will be able to convert directly.
@return The dom tree.