* @return Contributor
*/
private Contributor parseContributor( String tagName, XmlPullParser parser, boolean strict )
throws IOException, XmlPullParserException
{
Contributor contributor = new Contributor();
java.util.Set parsed = new java.util.HashSet();
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( checkFieldWithDuplicate( parser, "name", null, parsed ) )
{
contributor.setName( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "email", null, parsed ) )
{
contributor.setEmail( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "url", null, parsed ) )
{
contributor.setUrl( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "organization", "organisation", parsed ) )
{
contributor.setOrganization( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "organizationUrl", "organisationUrl", parsed ) )
{
contributor.setOrganizationUrl( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "roles", null, parsed ) )
{
java.util.List roles = new java.util.ArrayList/*<String>*/();
contributor.setRoles( roles );
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
if ( parser.getName().equals( "role" ) )
{
roles.add( getTrimmedValue( parser.nextText() ) );
}
else if ( strict )
{
throw new XmlPullParserException( "Unrecognised association: '" + parser.getName() + "'", parser, null );
}
else
{
// swallow up to end tag since this is not valid
while ( parser.next() != XmlPullParser.END_TAG ) {}
}
}
}
else if ( checkFieldWithDuplicate( parser, "timezone", null, parsed ) )
{
contributor.setTimezone( getTrimmedValue( parser.nextText() ) );
}
else if ( checkFieldWithDuplicate( parser, "properties", null, parsed ) )
{
while ( parser.nextTag() == XmlPullParser.START_TAG )
{
String key = parser.getName();
String value = parser.nextText().trim();
contributor.addProperty( key, value );
}
}
else
{
if ( strict )