Marko, 

See inline...


Marko Topolnik wrote:
> 
> >Which version of Castor did you try this on...?
> 
> >Did you remember to recompile the class-descriptors are
> >generating new sources?
> 
> I am using the latest CVS bits through Eclipse and I do a complete
> rebuild after regenerating sources.
> 
> Anyway, I see that as of today there is a new revision of
> XMLFieldDescriptor (1.9) which seems to address the issue (there is a
> new field, _useParentClassNamespace and the code for getNameSpaceURI()
> is completely new). 

Actually that code is not completely new, it was simply commented out by
myself for a while because it was breaking some test cases for Castor
generated code. I added the _useParentClassNamespace as a work around,
so that when people use a mapping file it's easier to specify the
namespaces.

However, there was always a way to get the proper namespaces in a
mapping file by using the bind-xml/@name with a QName...see below.


> I tested with this new revision and the discussed
> behavior (default form) is now correct for both elements and attributes.
> The behavior is also correct for explicit element form (see below), but
> it is incorrect for explicit attribute form (explicit form specification
> is ignored). The behavior is also incorrect for elements/attributes
> imported from another schema (they are rendered as unqualified).
> 
> I realize that my previous post did not make it obvious what is my
> primary issue: I personally do not need the SourceGenerator approach. I
> have my own Java classes and want to marshal them using a custom
> mapping. This is exactly what Jean-Pierre Loeffel has tried to bring to
> attention.
> 
> My view is that any serious Java-to-XML binding technology has to
> provide a way to explicitly state the namespace URI of each element and
> attribute independently. Currently, this can be specified in Castor only
> for the element that the class as a whole is bound to. In other words,
> it can be specified only for the root element of a marshalled document.

That's not true, Castor's bind-xml name attribute is a QName, so you can
very easily specify a namespace as such:

<field name="foo" ..>
   <bind-xml name="bar:foo" xmlns:bar="...."/>
</field>

> 
> Jean-Pierre seems to have made a thorough effort to have his requirement
> met in whatever way possible and came up with a workaround that
> specifies element namespaces "behind Castor's back." His problem (as
> well as Jean-Pierre himself :) cries for a proper treatment within
> Castor.

What thread are you referring to? I don't know who Jean-Pierre Loeffel
is, so you'll have to point me to a specific thread that you are talking
about.

> 
> The most important requirement would be met by implementing Item 1. from
> my previous post:
> 
> > 1. add to <bind-xml> the same faculty that exists in <map-to>, namely
> > the ns-uri and ns-prefix attributes. This will make it possible to
> > specify the qualified name to be bound to for each field separately.

Like I said above, you can use a QName as the value of the name
attribute for
bind-xml.

> 
> XML Schema allows elements/attributes from arbitrary namespaces either
> through the use of wildcards, or through importing other schemas and
> declaring references to elements defined therein. Here is an example:

...omitted discussion about wildcards...

This seems to be a valid concern, please file an enhancement request for
the namespace wildcard support via Bugzilla.

I'll look into the qualified/unqualified attribute issue.

Thanks,

--Keith

----------------------------------------------------------- 
If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
        unsubscribe castor-dev

Reply via email to