Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
2.0.4
-
None
Description
Looking at the (very good) documentation on the POM at http://maven.apache.org/pom.html, the very first link is to the POM XSD, the schema definition for the XML. This XSD explicitly places POMs into the namespace targetNamespace="http://maven.apache.org/POM/4.0.0".
However, the immediately following examples of POMs do not place their examples inside this namespace (there should be an xmlns="http://maven.apache.org/POM/4.0.0" at the root element).
Taking a look through my local repository, it's all a bit hit-and-miss as to whether the defined POM is in the correct namespace or not.
This is really annoying, because any tools I write that wish to use standard XML parsers to consume the POM need, in effect, to pass a namespace manager around, because if I wish to XPath to 'dependencies', I have to say 'is this //pom:dependencies, or is it a "defective" POM, where it's just //dependencies. This is bad if I'm using XSLT too (as one might to display a 'prettyprinted' POM).
- The documentation should use the namespace
- Maven should probably warn when it meets a POM that it's compiling from contains information in an invalid namespace.
- Maven should re-namespace POMs to be in the 'right' namespace when copying to repositories (or perhaps modify any POM.xml that it sees which is incorrect automatically).