* @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, "activation", null, parsed ) )
{
profile.setActivation( parseActivation( "activation", 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 ( 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, "id", null, parsed ) )
{
profile.setId( getTrimmedValue( parser.nextText() ) );
}
else
{
if ( strict )
{