[ http://jira.codehaus.org/browse/JIBX-310?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Thomas Pasch updated JIBX-310: ------------------------------ Attachment: test-any.xsd A simple schema with any. > Marshalling XML Schema with any element throws "Mapped object not an > org.w3c.dom.Element" (unmarshalling works) > --------------------------------------------------------------------------------------------------------------- > > Key: JIBX-310 > URL: http://jira.codehaus.org/browse/JIBX-310 > 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: Thomas Pasch > Assignee: Dennis Sosnoski > Attachments: DomElementMapper.java, test-any.xsd > > > 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 ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ jibx-devs mailing list jibx-devs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-devs