* @param parser
*/
private Profile parseProfile(String tagName, XmlPullParser parser, boolean strict, String encoding)
throws IOException, XmlPullParserException
{
Profile profile = new Profile();
profile.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "id" ) )
{
if ( parsed.contains( "id" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "id" );
profile.setId( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "activation" ) )
{
if ( parsed.contains( "activation" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "activation" );
profile.setActivation( parseActivation( "activation", parser, strict, encoding ) );
}
else if ( parser.getName().equals( "properties" ) )
{
if ( parsed.contains( "properties" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "properties" );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
String key = parser.getName();
String value = parser.nextText()
.trim()
;
profile.addProperty( key, value );
}
}
else if ( parser.getName().equals( "repositories" ) )
{
if ( parsed.contains( "repositories" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "repositories" );
java.util.List repositories = new java.util.ArrayList();
profile.setRepositories( repositories );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "repository" ) )
{
repositories.add( parseRepository( "repository", parser, strict, encoding ) );
}
else
{
parser.nextText();
}
}
}
else if ( parser.getName().equals( "pluginRepositories" ) )
{
if ( parsed.contains( "pluginRepositories" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "pluginRepositories" );
java.util.List pluginRepositories = new java.util.ArrayList();
profile.setPluginRepositories( pluginRepositories );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "pluginRepository" ) )
{
pluginRepositories.add( parseRepository( "pluginRepository", parser, strict, encoding ) );