Keith-

Okay, the situation is a little clearer now (I do vaguely remember reading about attributes and namespace inheritance)... This brings me to the question of how to handle namespaces for attributes in a schema? This problem comes up when I try to round trip Jitesh's example (unmarshal, marshal, unmarshal) with validation turned on -- the first time works fine because in his original xml file the attributes are not prefixed, but when Castor marshals the objects back out it adds prefixes, and then on unmarshalling Xerces complains when it tries to validate against the schema (Attribute 'ns1:name' is not allowed to appear in element 'logger'). I believe Castor is doing the right thing with the namespaces, and the original xml file is probably flawed, but I haven't been able to find the correct combination of xml/schema/mapping file to keep everyone happy...

At this point I think we're into the "just for future reference" category, but any advice you can give would be appreciated :)

Thanks!
Stephen

Keith Visco wrote:

I'm skipping most of the conversation as I don't have too much to add, but here I can explain a bit more:

Stephen Bash wrote:

OH! And looking back through comments I now remember, the reason I had to be screwy with the mapping file namespaces is to get the mapped attributes into the right namespace. Otherwise when marshalling, Castor would put the elements in the correct namespace, but put the attributes back in the castor namespace... It was weird... There's probably a better way to do that.


The reason Castor defaults to the "castor" namespace is because Jitesh's mapping file declares this as the default namespace as such:

<mapping xmlns="http://castor.exolab.org/";

So Castor is using that namespace when determing the proper namespace for a field when not prefixed.

Namespaces in the mapping file are a bit tricky to work with. We should probably update the mapping file to use a more explicit approach where ns-prefix and ns-uri are spelled out everywhere including the bind-xml elements...it would make it clearer, but it would also make it more verbose and tedious.

Hope that helps to make it a bit clearer as to how Castor determines the namespace of a field when not prefixed.

--Keith

-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------



-------------------------------------------------
If you wish to unsubscribe from this list, please send an empty message to the following address:

[EMAIL PROTECTED]
-------------------------------------------------

Reply via email to