* @param parser
*/
private Build parseBuild(String tagName, XmlPullParser parser, boolean strict, String encoding)
throws IOException, XmlPullParserException
{
Build build = new Build();
build.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "nagEmailAddress" ) )
{
if ( parsed.contains( "nagEmailAddress" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "nagEmailAddress" );
build.setNagEmailAddress( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "sourceDirectory" ) )
{
if ( parsed.contains( "sourceDirectory" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "sourceDirectory" );
build.setSourceDirectory( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "unitTestSourceDirectory" ) )
{
if ( parsed.contains( "unitTestSourceDirectory" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "unitTestSourceDirectory" );
build.setUnitTestSourceDirectory( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "aspectSourceDirectory" ) )
{
if ( parsed.contains( "aspectSourceDirectory" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "aspectSourceDirectory" );
build.setAspectSourceDirectory( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "integrationUnitTestSourceDirectory" ) )
{
if ( parsed.contains( "integrationUnitTestSourceDirectory" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "integrationUnitTestSourceDirectory" );
build.setIntegrationUnitTestSourceDirectory( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "sourceModifications" ) )
{
if ( parsed.contains( "sourceModifications" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "sourceModifications" );
java.util.List sourceModifications = new java.util.ArrayList();
build.setSourceModifications( sourceModifications );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "sourceModification" ) )
{
sourceModifications.add( parseSourceModification( "sourceModification", parser, strict, encoding ) );
}
else
{
parser.nextText();
}
}
}
else if ( parser.getName().equals( "unitTest" ) )
{
if ( parsed.contains( "unitTest" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "unitTest" );
build.setUnitTest( parseUnitTest( "unitTest", parser, strict, encoding ) );
}
else if ( parser.getName().equals( "defaultGoal" ) )
{
if ( parsed.contains( "defaultGoal" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "defaultGoal" );
build.setDefaultGoal( getTrimmedValue( parser.nextText()) );
}
else if ( parser.getName().equals( "resources" ) )
{
if ( parsed.contains( "resources" ) )
{
throw new XmlPullParserException( "Duplicated tag: '" + parser.getName() + "'", parser, null);
}
parsed.add( "resources" );
java.util.List resources = new java.util.ArrayList();
build.setResources( resources );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "resource" ) )
{
resources.add( parseResource( "resource", parser, strict, encoding ) );