Hello Everyone-
Recently the list has seen a lot of discussion of Castor's use of XML namespaces and questions regarding implementation. This message has a double purpose, one, to explain to everyone what I understand of Castor and namespaces, and two, allow Keith to double check that I understand the situation correctly. (Keith - please double check me!)
The short answer is that one can marshal (Java object to XML) and apply namespaces to the XML using either a mapping file or class descriptors, and unmarshalling (XML to Java object) that file is possible if and only if there would be no naming conflicts with the namespaces removed. Both versions 0.9.5.4 and 0.9.6RC1 follow this behavior.
My understanding is Keith has now updated the interface (and in the process created a lot of work for himself and the team, so my thanks in advance) so that in a future version (possibly as early as the release of 0.9.6? Feel free to comment Keith...) Castor will have namespace support for both marshalling and unmarshalling that allows namespaces to separate conflicting elements and attributes.
So IMHO, in a data persistence application (i.e. Castor creates the XML and is the only application to read the XML), I find using multiple namespaces is not all that helpful (since all the elements and attributes have to be named as if they were in one namespace). But in other applications (I would guess mostly web apps) where the XML created is used by some other entity other than Castor, the namespace support seems to be sufficient (though I have not personally tested this).
So that is my understanding of the current state of things. If people are curious, I can post an example that can marshal and unmarshal using a mapping file, but as mentioned above, all the elements and attributes must be named as if they were in one namespace.
I hope this clears things up for some people (and I hope I didn't make any major missteps).
Stephen
rencheng wrote: > Hi,All > When I use castor to marshall java obj to xml,I found > that only class node has namespace prefix, and the sub field in the > parent class node has no namespace prefix. And there also no attribute > for the 'field' node in the mapping file to set the prefix. > I check the impl class > org.exolab.castor.xml.util.XMLFieldDescriptorImpl, it has the nsPrefix > field..... Is it implemented? And How can i do to statisfy my request? > > Any help, thanks. > > > rencheng > [EMAIL PROTECTED] > 2005-01-04 > > > ------------------------------------------------------------------------ > > ----------------------------------------------------------- > If you wish to unsubscribe from this mailing, send mail to > [EMAIL PROTECTED] with a subject of: > unsubscribe castor-user
----------------------------------------------------------- If you wish to unsubscribe from this mailing, send mail to
[EMAIL PROTECTED] with a subject of:
unsubscribe castor-user
