* @param element
*/
private Contributor parseContributor(String tagName, Element element, boolean strict, String encoding)
throws IOException, DocumentException
{
Contributor contributor = new Contributor();
contributor.setModelEncoding( encoding );
java.util.Set parsed = new java.util.HashSet();
for ( Iterator i = element.nodeIterator(); i.hasNext(); )
{
Node node = (Node) i.next();
if ( node.getNodeType() != Node.ELEMENT_NODE )
{
}
else
{
Element childElement = (Element) node;
if ( childElement.getName().equals( "name" ) )
{
if ( parsed.contains( "name" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "name" );
contributor.setName( getTrimmedValue( childElement.getText() ) );
}
else if ( childElement.getName().equals( "email" ) )
{
if ( parsed.contains( "email" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "email" );
contributor.setEmail( getTrimmedValue( childElement.getText() ) );
}
else if ( childElement.getName().equals( "url" ) )
{
if ( parsed.contains( "url" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "url" );
contributor.setUrl( getTrimmedValue( childElement.getText() ) );
}
else if ( childElement.getName().equals( "organization" ) || childElement.getName().equals( "organisation" ) )
{
if ( parsed.contains( "organization" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "organization" );
contributor.setOrganization( getTrimmedValue( childElement.getText() ) );
}
else if ( childElement.getName().equals( "organizationUrl" ) || childElement.getName().equals( "organisationUrl" ) )
{
if ( parsed.contains( "organizationUrl" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "organizationUrl" );
contributor.setOrganizationUrl( getTrimmedValue( childElement.getText() ) );
}
else if ( childElement.getName().equals( "roles" ) )
{
if ( parsed.contains( "roles" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "roles" );
java.util.List roles = new java.util.ArrayList();
contributor.setRoles( roles );
for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
{
Node n = (Node) j.next();
if ( n.getNodeType() != Node.ELEMENT_NODE )
{
}
else
{
Element listElement = (Element) n;
if ( listElement.getName().equals( "role" ) )
{
roles.add( getTrimmedValue( listElement.getText() ) );
}
else
{
}
}
}
}
else if ( childElement.getName().equals( "timezone" ) )
{
if ( parsed.contains( "timezone" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "timezone" );
contributor.setTimezone( getTrimmedValue( childElement.getText() ) );
}
else if ( childElement.getName().equals( "properties" ) )
{
if ( parsed.contains( "properties" ) )
{
throw new DocumentException( "Duplicated tag: '" + element.getName() + "'");
}
parsed.add( "properties" );
for ( Iterator j = childElement.nodeIterator(); j.hasNext(); )
{
Node n = (Node) j.next();
if ( n.getNodeType() != Node.ELEMENT_NODE )
{
}
else
{
Element listElement = (Element) n;
String key = listElement.getName();
String value = listElement.getText()
.trim()
;
contributor.addProperty( key, value );
}
}
}
else
{