private Model parseModel( XmlPullParser parser, boolean strict, InputSource source )
throws IOException, XmlPullParserException
{
String tagName = parser.getName();
Model model = new Model();
InputLocation _location;
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.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 if ( "xmlns".equals( name ) )
{
// ignore xmlns attribute in root class, which is a reserved attribute name
}
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, "modelVersion", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "modelVersion", _location );
model.setModelVersion( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "parent", null, parsed ) )
{
model.setParent( parseParent( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "groupId", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "groupId", _location );
model.setGroupId( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "artifactId", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "artifactId", _location );
model.setArtifactId( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "version", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "version", _location );
model.setVersion( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "packaging", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "packaging", _location );
model.setPackaging( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "name", _location );
model.setName( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "description", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "description", _location );
model.setDescription( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "url", _location );
model.setUrl( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "inceptionYear", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "inceptionYear", _location );
model.setInceptionYear( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
{
model.setOrganization( parseOrganization( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "licenses", null, parsed ) )
{
java.util.List licenses = new java.util.ArrayList/*<License>*/();
model.setLicenses( licenses );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "license".equals( parser.getName() ) )
{
licenses.add( parseLicense( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "developers", null, parsed ) )
{
java.util.List developers = new java.util.ArrayList/*<Developer>*/();
model.setDevelopers( developers );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "developer".equals( parser.getName() ) )
{
developers.add( parseDeveloper( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "contributors", null, parsed ) )
{
java.util.List contributors = new java.util.ArrayList/*<Contributor>*/();
model.setContributors( contributors );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "contributor".equals( parser.getName() ) )
{
contributors.add( parseContributor( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "mailingLists", null, parsed ) )
{
java.util.List mailingLists = new java.util.ArrayList/*<MailingList>*/();
model.setMailingLists( mailingLists );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "mailingList".equals( parser.getName() ) )
{
mailingLists.add( parseMailingList( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "prerequisites", null, parsed ) )
{
model.setPrerequisites( parsePrerequisites( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "modules", null, parsed ) )
{
java.util.List modules = new java.util.ArrayList/*<String>*/();
model.setModules( modules );
InputLocation _locations;
_locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "modules", _locations );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "module".equals( parser.getName() ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
_locations.setLocation( Integer.valueOf( modules.size() ), _location );
modules.add( getTrimmedValue( parser.nextText() ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "scm", null, parsed ) )
{
model.setScm( parseScm( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "issueManagement", null, parsed ) )
{
model.setIssueManagement( parseIssueManagement( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "ciManagement", null, parsed ) )
{
model.setCiManagement( parseCiManagement( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "distributionManagement", null, parsed ) )
{
model.setDistributionManagement( parseDistributionManagement( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
{
InputLocation _locations;
_locations = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "properties", _locations );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
String key = parser.getName();
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
_locations.setLocation( key, _location );
String value = parser.nextText().trim();
model.addProperty( key, value );
}
}
else if ( checkFieldWithDuplicate( parser, "dependencyManagement", null, parsed ) )
{
model.setDependencyManagement( parseDependencyManagement( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "dependencies", null, parsed ) )
{
java.util.List dependencies = new java.util.ArrayList/*<Dependency>*/();
model.setDependencies( dependencies );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "dependency".equals( parser.getName() ) )
{
dependencies.add( parseDependency( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "repositories", null, parsed ) )
{
java.util.List repositories = new java.util.ArrayList/*<Repository>*/();
model.setRepositories( repositories );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "repository".equals( parser.getName() ) )
{
repositories.add( parseRepository( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "pluginRepositories", null, parsed ) )
{
java.util.List pluginRepositories = new java.util.ArrayList/*<Repository>*/();
model.setPluginRepositories( pluginRepositories );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( "pluginRepository".equals( parser.getName() ) )
{
pluginRepositories.add( parseRepository( parser, strict, source ) );
}
else
{
checkUnknownElement( parser, strict );
}
}
}
else if ( checkFieldWithDuplicate( parser, "build", null, parsed ) )
{
model.setBuild( parseBuild( parser, strict, source ) );
}
else if ( checkFieldWithDuplicate( parser, "reports", null, parsed ) )
{
_location = new InputLocation( parser.getLineNumber(), parser.getColumnNumber(), source );
model.setLocation( "reports", _location );
model.setReports( Xpp3DomBuilder.build( parser ) );
}
else if ( checkFieldWithDuplicate( parser, "reporting", null, parsed ) )
{