I'm just curious about default namespaces. I have the follow xml:
<root xmlns="myNamespace">
<someElement xmlns="anotherNamespace">
<data>Info</data>
</someElement>
<anotherElement>
<moreData>Info2</moreData>
</anotherElement>
</root>
My guess is that myNamespace is inherit for <root> and <anotherElement>. And anotherNamespace is a default namespace in <someElement> so in this element and for its child's overrides the other myNamespace.
I know that I can rewrite the above xml code like:
<my:root xmlns:my="myNamespace">
<a:someElement xmlns:a="anotherNamespace">
<a:data>Info</a:data>
</a:someElement>
<my:anotherElement>
<my:moreData>Info2</my:moreData>
</my:anotherElement>
</my:root>
I think that both are totally valid but I have some problems with some xml beans implementation in java which doesn't accept the first one, so I'm curious if there is an xml specification where specifies if first aproach is or not correct.
 
No comments:
Post a Comment