On 26.08.2007 16:07 Uhr, Grzegorz Kossakowski wrote:

Are these valid xml files?:

Nit-picking: None of them is valid as there is nothing to validate against like a DTD or a schema. You can only talk about well-formedness.

<root>
  <foo:foo xmlns:foo="http://foo.org/1.0";>
  </foo:foo>

  <!-- namespaced element outside namespace declaration -->
  <foo:foo>
  </foo:foo>
</root>

If the second one is valid we have to keep all declared namespaces till
the end of xml file (gets worse for xmls with jx:imports).

Second file is valid XML but second "foo" element is in the same namespace as 
root element (empty
namespace) and it's full name is "foo:foo". Lack of namespace declaration makes 
prefix meaningless
and part of element's name (if prefix is attached to the namespace it's part of 
element's name also).

That's not correct. This one is not well-formed, it should result in a "undeclared namespace prefix"-exception.

Namespace declarations are not available to sibling elements.

That's true.

Joerg

Reply via email to