My two cents on this, this is a snippet from some rust code I have for a
simple tool that, in part, yanks out values from the pom.
We can see setting the xpath needs the namespace included (It’s
possible I could use one of the wildcard xpaths mentioned elsewhere in
this thread, I didn’t know you could actually do that tho), set the
namespace value on the context, and evaluate.
Nothing too drastic and hard, but if we start changing namespaces, I’d
need some way of configuring that, or - god forbid, we start intermixing
maven namespace “versions”.
Now, that URL also returns a 404, so it doesn’t even link to any
schema or documentation etc. so it feels like the URL mentioned in the
namespace shouldn’t be versioned, but that raises the question of how
many things will that break, or would we JUST change that for M4?
Mark
```
fn buid_xpath(factory: &Factory, xpath: &str) -> XPath {
factory.build(xpath).expect("No path").expect("No compiled path")
}
pub fn parse_pom(path: String, xml: &str) -> Result<MavenPom,
BuildError> {
let doc = parser::parse(xml)
.attach_printable(format!("Failed to parse {}", path))
.change_context(BuildError)?;
let document = doc.as_document();
let factory = Factory::new();
let group_id_path = buid_xpath(&factory, "/mvn:project/mvn:groupId");
let artifact_id_path = buid_xpath(&factory,
"/mvn:project/mvn:artifactId");
let version_path = buid_xpath(&factory, "/mvn:project/mvn:version");
let mut context = Context::new();
context.set_namespace("mvn", "http://maven.apache.org/POM/4.0.0");
let group_id = group_id_path.evaluate(&context,
document.root()).expect("No path");
let artifact_id = artifact_id_path.evaluate(&context,
document.root()).expect("No path");
let version = version_path.evaluate(&context,
document.root()).expect("No path");
Ok(MavenPom::Pom {
group_id: group_id.string(),
artifact_id: artifact_id.string(),
version: version.string(),
path,
})
}
```
On 17 Mar 2026, at 0:40, Elliotte Rusty Harold wrote:
The problems pop as soon as you attempt to use XSLT, XPath, XInclude,
XSD, or any other general purpose XML tool to process pom.xml files.
If you don't do that and only use Maven's own libraries, you might
never encounter problems. However, this removes a large ecosystem of
well developed and supported libraries from our toolboxes. Not
everyone uses these tools, but those of us who do really miss them.