*/
private Profile parseProfile( XmlPullParser parser, boolean strict )
throws IOException, XmlPullParserException
{
String tagName = parser.getName();
Profile profile = new Profile();
for ( int i = parser.getAttributeCount() - 1; i >= 0; i-- )
{
String name = parser.getAttributeName( i );
String value = parser.getAttributeValue( i );
if ( name.indexOf( ':' ) >= 0 )
{
// just ignore attributes with non-default namespace (for example: xmlns:xsi)
}
else
{
checkUnknownAttribute( parser, name, tagName, strict );
}
}
java.util.Set parsed = new java.util.HashSet();
while ( ( strict ? parser.nextTag() : nextTag( parser ) ) == XmlPullParser.START_TAG )
{
if ( checkFieldWithDuplicate( parser, "activation", null, parsed ) )
{
profile.setActivation( parseActivation( 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 ( "repository".equals( parser.getName() ) )
{
repositories.add( parseRepository( parser, strict ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
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 ( "pluginRepository".equals( parser.getName() ) )
{
pluginRepositories.add( parseRepository( parser, strict ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "id", null, parsed ) )
{
profile.setId( getTrimmedValue( parser.nextText() ) );
}
else
{
checkUnknownElement( parser, strict );
}