* @param parser
*/
private Repository parseRepository(String tagName, XmlPullParser parser, boolean strict, String encoding)
throws IOException, XmlPullParserException
{
Repository repository = new Repository();
repository.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "releases" ) )
{
if ( parsed.contains( "releases" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "releases" );
repository.setReleases( parseRepositoryPolicy( "releases", parser, strict, encoding ) );
}
else if ( parser.getName().equals( "snapshots" ) )
{
if ( parsed.contains( "snapshots" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "snapshots" );
repository.setSnapshots( parseRepositoryPolicy( "snapshots", parser, strict, encoding ) );
}
else if ( parser.getName().equals( "id" ) )
{
if ( parsed.contains( "id" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "id" );
repository.setId( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "name" ) )
{
if ( parsed.contains( "name" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "name" );
repository.setName( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "url" ) )
{
if ( parsed.contains( "url" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "url" );
repository.setUrl( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "layout" ) )
{
if ( parsed.contains( "layout" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "layout" );
repository.setLayout( getTrimmedValue( parser.nextText()) );
}
else
{
if ( strict )
{