* @author Remy Maucherat
*/
public class DescriptionMetaDataParser extends MetaDataElementParser {
public static DescriptionImpl parse(XMLStreamReader reader) throws XMLStreamException {
DescriptionImpl description = new DescriptionImpl();
// Handle attributes
final int count = reader.getAttributeCount();
for (int i = 0; i < count; i ++) {
final String value = reader.getAttributeValue(i);
if (reader.getAttributeNamespace(i) != null) {
continue;
}
final Attribute attribute = Attribute.forName(reader.getAttributeLocalName(i));
switch (attribute) {
case ID: {
description.setId(value);
break;
}
case LANG: {
description.setLanguage(value);
break;
}
default: throw unexpectedAttribute(reader, i);
}
}
description.setDescription(reader.getElementText());
return description;
}