Hi Dennis,
sorry for the late response. I was in Shanghai the last couple of weeks. What an exciting city...
Back to the supposed bug.
My (shortened) mapping is like the following (I changed to DomFragmentMapper meanwhile):
--
<?xml version="1.0" encoding="UTF-8"?>
<binding name="xfb" global-ids="false" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="binding.xsd">
<namespace uri="http://livis.com/xmlns/FormX" default="elements"/>
<mapping name="value" class="com.livis.formsx.desc.ElementValueX">
<value name="name" field="name" style="attribute" usage="optional"/>
<value name="data" field="data" usage="optional"/>
<structure name="xml-data" usage="optional">
<structure field="xdata" usage="optional"
marshaller="org.jibx.extras.DomFragmentMapper"
unmarshaller="org.jibx.extras.DomFragmentMapper"/>
</structure>
</mapping>
--My hope was to successfully unmarshall and then marshall something like:
-- <?xml version="1.0" encoding="UTF-8"?> <value name="sample" xmlns="http://livis.com/xmlns/FormX"> <data>A brown fox.</data> <xml-data>A <span class="color">brown</span> fox.</xml-data> </value> --
It does not work when the attribute (class="color") is present, wether i declare a namespaceprefix or not in the binding. For simplicity and testing, I have left out an html namespace declaration which does not alter the problem (because attributes in the example have no namespace prefix anyway).
I seem to use beta3b.
My previous bug report used a namespace prefix and DomElementMapper.
I may restate my question:
Do You have a working example where you use DomElementMapper or DomFragmentMapper within an XML document which has a default namespace, and where the mapped node contains BOTH elements and attributes, as far as a complete unmarshall/marshall cycle is concerned?
Thanks for Your help.
Falk
Dennis Sosnoski wrote at="2004-10-23": > I'm missing something about what's going on in this case. The > findNamespaceIndex code assumes you'll supply the prefix if one is > defined for the namespace. If the namespace is using a prefix and you > don't supply that prefix in the call the -1 return seems correct to me. > > I understand that you may have multiple namespace definitions, and that > the default namespace at an outer level can be masked by an inner > default namespace. I don't understand how the unmarshalling would create > a reference to a masked namespace, though. Can you clarify how this is > occurring? Thanks, > > - Dennis
Hi Dennis,
DomMapperBase.findNamespaceIndex() has a second bug and I follow-up the most appropriate thread for this I could find.
If the <binding> element has a <namespace> child like
<namespace uri="mynsuri" default="elements" prefix="myprefix"/>
then
DomMapperBase.findNamespaceIndex(null,"mynsuri") returns -1.
It works ok if the <namespace> child lacks the prefix attribute. However, there is no reason why not to declare a prefix even for the default namespace (in cases where the deault namespace is out of scope by an intermediate default namespace xmlns attribute).
More importantly however, unmarshall() works while marshall() what was unmarshalled beforehand raises an exception. This breaks your symmetry design goal and is hard to debug for the user -- at least, it was for me ;-)
Keep up your great work,
Falk
-- Dr. Falk Langhammer Living Pages Research GmbH Kolosseumstr. 1a D-80469 Munich, Germany mailto:[EMAIL PROTECTED] http://www.living-pages.de Phone +49 (89) 189 207-27 Fax +49 (89) 189 207-29 Mobil +49 (171) 79 39 667 mailto:[EMAIL PROTECTED] (urgent SMS with subject header) PGP public Key Id: 0xF7FBCA39
------------------------------------------------------- This SF.Net email is sponsored by: InterSystems CACHE FREE OODBMS DOWNLOAD - A multidimensional database that combines robust object and relational technologies, making it a perfect match for Java, C++,COM, XML, ODBC and JDBC. www.intersystems.com/match8 _______________________________________________ jibx-users mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jibx-users
