WISHLIST: "incremental" and multiple default namespace declarations of 
namespaces
---------------------------------------------------------------------------------

         Key: JIBX-71
         URL: http://jira.codehaus.org/browse/JIBX-71
     Project: JiBX
        Type: Wish
  Components: core  
    Versions: CVS    
    Reporter: Chris Chen
    Priority: Minor


There was a conversation in the mailing list a while back that spoke of 
namespace handling.  I would like to request a new feature that will hopefully 
go into 2.0:

The ability to declare the namespace used by the <mapping> element without 
globally declaring it in the binding file.

For instance, say an xml document looks like this:

<a xmlns="urn:a">
  <b xmlns="urn:b"/>
</a>

For unmarshalling purposes, the binding file will have two global <namespace> 
elements declared.  This will work well.  However, marshalling the object to 
xml will output the following:

<a xmlns="urn:a" xmlns:b="urn:b">
  <b:b/>
</a>

Semanticallly, the two xml documents are the same and should cause no errors.  
However, imagine a large XML document containing a vast number of namespaces, 
some used only once or twice within the document itself.  With the current 
marshalling mechanism, ALL these namespaces that affect top-level <mapping> 
elements must be declared globally.  Thus, for instance, if there are 30 
<mapping> elements with 30 different namespaces, all those namespaces must be 
declared globally, and subsequently the marshalled document's root element will 
contain all 30 namespace declarations.  Although semantically correct, the 
document becomes different from the original document that the user may be used 
to and also a bit more clumsy.

It would  be nice to allow declaration of the <mapping> element's namespace 
within the <mapping> itself.  For instance,

<mapping name="b" ns="uri:b" ....>
  <namespace uri="uri:b" default="elements"/>
</mapping>

The above binding definition will not work in the current code since the inner 
<namespace> declaration is only valid for the <mapping> children, not the 
<mapping>'s namespace.  It would somehow be nice to do something like the 
above.  This will solve two issues -- "incremental" declaration of namespaces 
and the ability to have multiple default namespaces for different elements.  In 
the current code, only one namespace can be the default; all others must 
specify a prefix.  I understand the semantics will be the same, but it becomes 
a change that users may be unaccustomed to (specifically if they have to modify 
the marshalled document later).



-- 
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



-------------------------------------------------------
SF.Net email is sponsored by: Discover Easy Linux Migration Strategies
from IBM. Find simple to follow Roadmaps, straightforward articles,
informative Webcasts and more! Get everything you need to get up to
speed, fast. http://ads.osdn.com/?ad_id=7477&alloc_id=16492&op=click
_______________________________________________
jibx-devs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jibx-devs

Reply via email to