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 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 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/blackberry _______________________________________________ jibx-devs mailing list jibx-devs@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jibx-devs