try
{
XMLReader xml = new XMLReader( "metadata", metadataFile );
-
+ // invoke this to remove namespaces, see MRM-1136
+ xml.removeNamespaces();
+
ArchivaRepositoryMetadata metadata = new ArchivaRepositoryMetadata();
metadata.setGroupId( xml.getElementText( "//metadata/groupId" ) );
--- /dev/null
+<?xml version="1.0" encoding="UTF-8"?>
+<metadata xsi:schemaLocation="http://maven.apache.org/METADATA/1.0.0 http://maven.apache.org/xsd/metadata-1.0.0.xsd" xmlns="http://maven.apache.org/METADATA/1.0.0"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>idlj-maven-plugin</artifactId>
+ <version>1.1-SNAPSHOT</version>
+ <versioning>
+ <snapshot>
+ <timestamp>20090312.163710</timestamp>
+ <buildNumber>16</buildNumber>
+ </snapshot>
+ <lastUpdated>20090312163712</lastUpdated>
+ </versioning>
+</metadata>
List<Element> names = reader.getElementList( "//basic/names/name" );
assertElementTexts( names, new String[] { TRYGVIS, INFINITE_ARCHIVA } );
}
+
+ // MRM-1136
+ public void testProxiedMetadataRead()
+ throws XMLException
+ {
+ File xmlFile = getExampleXml( "maven-metadata-codehaus-snapshots.xml" );
+ XMLReader reader = new XMLReader( "metadata", xmlFile );
+ reader.removeNamespaces();
+
+ Element groupId = reader.getElement( "//metadata/groupId" );
+ assertNotNull( groupId );
+ assertEquals( "org.codehaus.mojo", groupId.getTextTrim() );
+ }
}