Y
yawnmoth
Say I have the following XML file:
<parent xmlns="uri://domain.tld/"><child /></parent>
In order to query the child node I need to register the uri://domain.tld/
namespace with a prefix, like 'parent'. I then need to do '//
parentarent//parent:child'. My question is this: if one node is in
a namespace are all children to that node assumed to be in the same
name space? In that case it seems like it's redundant to have to
specify the namespace for each and every successive child. I mean, is
there even a way to construct a child to parentarent such that '//
parentarent//child' would return a node?
Also, it doesn't seem to me like there's really a lot of point in
assigning a namespace to the root node? I mean, since there can only
be one root node it's not as if disambiguation is necessary. For
<root><parent xmlns="uri://a.a" /><parent /></root>, you'd need a
namespace to differentiate the two parent tags, but for my initial XML
it seems totally unnecessary? And yet I frequently see XML documents
that do just this - place the root node in it's own namespace.
<parent xmlns="uri://domain.tld/"><child /></parent>
In order to query the child node I need to register the uri://domain.tld/
namespace with a prefix, like 'parent'. I then need to do '//
parentarent//parent:child'. My question is this: if one node is in
a namespace are all children to that node assumed to be in the same
name space? In that case it seems like it's redundant to have to
specify the namespace for each and every successive child. I mean, is
there even a way to construct a child to parentarent such that '//
parentarent//child' would return a node?
Also, it doesn't seem to me like there's really a lot of point in
assigning a namespace to the root node? I mean, since there can only
be one root node it's not as if disambiguation is necessary. For
<root><parent xmlns="uri://a.a" /><parent /></root>, you'd need a
namespace to differentiate the two parent tags, but for my initial XML
it seems totally unnecessary? And yet I frequently see XML documents
that do just this - place the root node in it's own namespace.