|
|
|
[
Permlink
| « Hide
]
Werner Guttmann - 01/Sep/07 04:23 AM
I can confirm that I am getting the very same exceptions. I have tried to modify the given XML document instance to use an explicit namespace declaration as well as a default namespace declarations to qualify the remainder of the document - which does not change anything ..
Christophe, I have recently made some code changes in this area, that originated from a bug with the XML code generator. As part of this, I have changed some code areas that deal with XML namespaces as well. Would you be in a position to retry against the 1.2 snapshot release I just made available ?
Christophe, changing your input XML to
<?xml version="1.0"?> <def:item xmlns:def="default" xmlns:media="http://search.yahoo.com/mrss/"> <def:description>My description field</def:description> <media:description>My media description field</media:description> </def:item> and the mapping file to <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapping PUBLIC "-//EXOLAB/Castor Object Mapping DTD Version 1.0//EN" "http://castor.exolab.org/mapping.dtd">
<mapping xmlns:def="default" xmlns:media="http://search.yahoo.com/mrss/">
<class name="xml.c2132.Item">
<map-to xml="item" />
<field name="mediaDescription" type="string" get-method="getMediaDescription"
set-method="setMediaDescription">
<bind-xml name="media:description" node="element" />
</field>
<field name="description" type="string" get-method="getDescription"
set-method="setDescription">
<bind-xml name="def:description" node="element" />
</field>
</class>
</mapping>
I can get things to work fully. It looks like there's a problem with the use of default XML namespaces in this context. Initial patch for review. Unfortunately, post-patch there's two CTF tests failing on XML diffs.
Btw, I am not sure about the validity of your XML, as you are missing a default namespace declaration. But adding such a definition does not change the fact that there's a problem.
Werner, thanks a lot for your support.
There is no way for me to change the input XML: it's an external RSS feed (in turn, MediaRSS). Currently I can work around the Castor issue, but of course I will be very pleased when you will fix it definitely. I stay in touch. Hmm .. can you attach a complete sample of what you are receiving ?
I've attached a full XML sample of what should be unmarshalled.
The case where for example a 'title" element coexist with a 'media:title' element under the same parent, doesn't occur here hopefully. It may occur according to the MediaRSS spec (http://search.yahoo.com/mrss Hope it'll help. Sometimes I wonder whether it will happen that somebody is willing to acknowledge one's private efforts financially ... ;-(.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||