PLease have an example for Marshalling XML Schema with any element type 
------------------------------------------------------------------------

                 Key: JIBX-427
                 URL: http://jira.codehaus.org/browse/JIBX-427
             Project: JiBX
          Issue Type: Bug
    Affects Versions: JiBX 1.2.2
         Environment: Ubuntu 9.04 (jaunty) x86_64 (aka amd64), tried several 
1.5 and 1.6 sun JVMs (64-bit), Jibx 1.2.2
            Reporter: srinu
            Assignee: Dennis Sosnoski
             Fix For: JiBX 1.2.2


When I use a XML schema with an any element, unmarshalling works as expected, 
but marshalling dies at org.jibx.extras.DomElementMapper.marshall (see below). 
This is because (Object) obj is null. In my case the any element is optional 
(and not always given). I wonder if treating a (Object) with obj == null 
special would fix the issue (but I expect a least to get a different error). 

    public void marshal(Object obj, IMarshallingContext ictx)
        throws JiBXException {
        
        // make sure the parameters are as expected
        if (!(obj instanceof Element)) {
            throw new JiBXException("Mapped object not an org.w3c.dom.Element");
        } else {
            try {
                
                // marshal element and all content with only leading indentation
                m_xmlWriter = ictx.getXmlWriter();
                m_xmlWriter.indent();
                int indent = ictx.getIndent();
                ictx.setIndent(-1);
                m_defaultNamespaceURI = null;
                marshalElement((Element)obj);
                ictx.setIndent(indent);
                
            } catch (IOException e) {
                throw new JiBXException("Error writing to document", e);
            }
        }
    }



-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: 
http://jira.codehaus.org/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

------------------------------------------------------------------------------
Colocation vs. Managed Hosting
A question and answer guide to determining the best fit
for your organization - today and in the future.
http://p.sf.net/sfu/internap-sfd2d
_______________________________________________
jibx-devs mailing list
jibx-devs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to