* @param xmlStreamReader
*/
private Build parseBuild(String tagName, XMLStreamReader xmlStreamReader, boolean strict, String encoding)
throws IOException, XMLStreamException
{
Build build = new Build();
build.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
{
if ( xmlStreamReader.getLocalName().equals( "nagEmailAddress" ) )
{
if ( parsed.contains( "nagEmailAddress" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "nagEmailAddress" );
build.setNagEmailAddress( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "sourceDirectory" ) )
{
if ( parsed.contains( "sourceDirectory" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "sourceDirectory" );
build.setSourceDirectory( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "unitTestSourceDirectory" ) )
{
if ( parsed.contains( "unitTestSourceDirectory" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "unitTestSourceDirectory" );
build.setUnitTestSourceDirectory( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "aspectSourceDirectory" ) )
{
if ( parsed.contains( "aspectSourceDirectory" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "aspectSourceDirectory" );
build.setAspectSourceDirectory( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "integrationUnitTestSourceDirectory" ) )
{
if ( parsed.contains( "integrationUnitTestSourceDirectory" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "integrationUnitTestSourceDirectory" );
build.setIntegrationUnitTestSourceDirectory( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "sourceModifications" ) )
{
if ( parsed.contains( "sourceModifications" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "sourceModifications" );
java.util.List sourceModifications = new java.util.ArrayList();
build.setSourceModifications( sourceModifications );
while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
{
if ( xmlStreamReader.getLocalName().equals( "sourceModification" ) )
{
build.addSourceModification( parseSourceModification( "sourceModification", xmlStreamReader, strict, encoding ) );
}
else
{
throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
}
}
else if ( xmlStreamReader.getLocalName().equals( "unitTest" ) )
{
if ( parsed.contains( "unitTest" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "unitTest" );
build.setUnitTest( parseUnitTest( "unitTest", xmlStreamReader, strict, encoding ) );
}
else if ( xmlStreamReader.getLocalName().equals( "defaultGoal" ) )
{
if ( parsed.contains( "defaultGoal" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "defaultGoal" );
build.setDefaultGoal( getTrimmedValue( xmlStreamReader.getElementText()) );
}
else if ( xmlStreamReader.getLocalName().equals( "resources" ) )
{
if ( parsed.contains( "resources" ) )
{
throw new XMLStreamException( "Duplicated tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}
parsed.add( "resources" );
java.util.List resources = new java.util.ArrayList();
build.setResources( resources );
while ( xmlStreamReader.nextTag() == XMLStreamConstants.START_ELEMENT )
{
if ( xmlStreamReader.getLocalName().equals( "resource" ) )
{
build.addResource( parseResource( "resource", xmlStreamReader, strict, encoding ) );
}
else
{
throw new XMLStreamException( "Unrecognised tag: '" + xmlStreamReader.getLocalName() + "'", xmlStreamReader.getLocation() );
}