{
return handleIncorrectElement(entry, validationProperties);
}
// used to hold the element and attribute unmarshal info results
SwordValidationInfo result = new SwordValidationInfo(xmlName);
try
{
initialise();
// FIXME - attributes?
// retrieve all of the sub-elements
Elements elements = entry.getChildElements();
Element element = null;
int length = elements.size();
for (int i = 0; i < length; i++)
{
element = elements.get(i);
if (isInstanceOf(element, Author.elementName()))
{
Author author = new Author();
result.addUnmarshallElementInfo(author.unmarshall(element, validationProperties));
authors.add(author);
}
else if (isInstanceOf(element, Category.elementName()))
{
Category category = new Category();
result.addUnmarshallElementInfo(category.unmarshall(element, validationProperties));
categories.add(category);
}
else if (isInstanceOf(element, Content.elementName()))
{
if( content == null )
{
content = new Content();
result.addUnmarshallElementInfo(content.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Content.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Generator.elementName()))
{
if( generator == null )
{
generator = new Generator();
result.addUnmarshallElementInfo(generator.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Generator.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Contributor.elementName()))
{
Contributor contributor = new Contributor();
result.addUnmarshallElementInfo(contributor.unmarshall(element, validationProperties));
contributors.add(contributor);
}
else if (isInstanceOf(element, Id.elementName()))
{
if( id == null )
{
id = new Id();
result.addUnmarshallElementInfo(id.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Id.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Link.elementName()))
{
Link link = new Link();
result.addUnmarshallElementInfo(link.unmarshall(element, validationProperties));
links.add(link);
}
else if (isInstanceOf(element, Published.elementName()))
{
if( published == null )
{
published = new Published();
result.addUnmarshallElementInfo(published.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Published.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Rights.elementName()))
{
if( rights == null )
{
rights = new Rights();
result.addUnmarshallElementInfo(rights.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Rights.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Summary.elementName()))
{
if( summary == null )
{
summary = new Summary();
result.addUnmarshallElementInfo(summary.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Summary.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Title.elementName()))
{
if( title == null )
{
title = new Title();
result.addUnmarshallElementInfo(title.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Title.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Updated.elementName()))
{
if( updated == null )
{
updated = new Updated();
result.addUnmarshallElementInfo(updated.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Updated.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if (isInstanceOf(element, Source.elementName()))
{
if( source == null )
{
source = new Source();
result.addUnmarshallElementInfo(source.unmarshall(element, validationProperties));
}
else if( validationProperties != null )
{
SwordValidationInfo info = new SwordValidationInfo(Source.elementName(),
SwordValidationInfo.DUPLICATE_ELEMENT,
SwordValidationInfoType.WARNING);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
else if( validationProperties != null )
{
XmlName name = new XmlName(element);
if( ! isElementChecked(name) )
{
SwordValidationInfo info = new SwordValidationInfo(name,
SwordValidationInfo.UNKNOWN_ELEMENT,
SwordValidationInfoType.INFO);
info.setContentDescription(element.getValue());
result.addUnmarshallElementInfo(info);
}
}
} // for