* @return Profile
*/
private Profile parseProfile( String tagName, XmlPullParser parser, boolean strict )
throws IOException, XmlPullParserException
{
Profile profile = new Profile();
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
{
profile.setId( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) )
{
profile.setActivation( parseActivation( "activation", parser, strict ) );
}
else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
{
profile.setBuild( parseBuildBase( "build", parser, strict ) );
}
else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
{
profile.setDistributionManagement( parseDistributionManagement( "distributionManagement", parser, strict ) );
}
else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
{
java.util.List modules = new java.util.ArrayList/*<String>*/();
profile.setModules( modules );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "module" ) )
{
modules.add( getTrimmedValue( parser.nextText() ) );
}
else if ( strict )
{
throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
}
else
{
// swallow up to end tag since this is not valid
while ( parser.next() != XmlPullParser.END_TAG ) {}
}
}
}
else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
{
java.util.List repositories = new java.util.ArrayList/*<Repository>*/();
profile.setRepositories( repositories );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "repository" ) )
{
repositories.add( parseRepository( "repository", parser, strict ) );
}
else if ( strict )
{
throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
}
else
{
// swallow up to end tag since this is not valid
while ( parser.next() != XmlPullParser.END_TAG ) {}
}
}
}
else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
{
java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/();
profile.setPluginRepositories( pluginRepositories );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "pluginRepository" ) )
{
pluginRepositories.add( parseRepository( "pluginRepository", parser, strict ) );
}
else if ( strict )
{
throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
}
else
{
// swallow up to end tag since this is not valid
while ( parser.next() != XmlPullParser.END_TAG ) {}
}
}
}
else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
{
java.util.List dependencies = new java.util.ArrayList/*<Dependency>*/();
profile.setDependencies( dependencies );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "dependency" ) )
{
dependencies.add( parseDependency( "dependency", parser, strict ) );
}
else if ( strict )
{
throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
}
else
{
// swallow up to end tag since this is not valid
while ( parser.next() != XmlPullParser.END_TAG ) {}
}
}
}
else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
{
profile.setReports( Xpp3DomBuilder.build( parser ) );
}
else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
{
profile.setReporting( parseReporting( "reporting", parser, strict ) );
}
else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
{
profile.setDependencyManagement( parseDependencyManagement( "dependencyManagement", parser, strict ) );
}
else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
{
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
String key = parser.getName();
String value = parser.nextText().trim();
profile.addProperty( key, value );
}
}
else
{
if ( strict )