private Build parseBuild( XmlPullParser parser, boolean strict, InputSource source )
throws IOException, XmlPullParserException
{
String tagName = parser.getName();
Build build = new Build();
InputLocation _location;
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "", _location );
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, "sourceDirectory", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "sourceDirectory", _location );
build.setSourceDirectory( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "scriptSourceDirectory", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "scriptSourceDirectory", _location );
build.setScriptSourceDirectory( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "testSourceDirectory", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "testSourceDirectory", _location );
build.setTestSourceDirectory( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "outputDirectory", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "outputDirectory", _location );
build.setOutputDirectory( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "testOutputDirectory", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "testOutputDirectory", _location );
build.setTestOutputDirectory( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "extensions", null, parsed ) )
{
java.util.List extensions = new java.util.ArrayList/*<Extension>*/();
build.setExtensions( extensions );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "extension".equals( parser.getName() ) )
{
extensions.add( parseExtension( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "defaultGoal", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "defaultGoal", _location );
build.setDefaultGoal( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "resources", null, parsed ) )
{
java.util.List resources = new java.util.ArrayList/*<Resource>*/();
build.setResources( resources );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "resource".equals( parser.getName() ) )
{
resources.add( parseResource( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "testResources", null, parsed ) )
{
java.util.List testResources = new java.util.ArrayList/*<Resource>*/();
build.setTestResources( testResources );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "testResource".equals( parser.getName() ) )
{
testResources.add( parseResource( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "directory", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "directory", _location );
build.setDirectory( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "finalName", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "finalName", _location );
build.setFinalName( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "filters", null, parsed ) )
{
java.util.List filters = new java.util.ArrayList/*<String>*/();
build.setFilters( filters );
InputLocation _locations;
_locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
build.setLocation( "filters", _locations );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "filter".equals( parser.getName() ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
_locations.setLocation( Integer.valueOf( filters.size() ), _location );
filters.add( getTrimmedValue( parser.nextText() ) );
}
else
{
checkUnknownElement( parser, strict );