* @return Returns a <code>Preference</code> representing the data in the file.
* @throws XMLStreamException Thrown if there is an error reading the file.
*/
public static Preference parsePreferenceFile(XMLStreamReader reader)
throws XMLStreamException {
Preference preference = null;
int eventType = reader.getEventType();
while (reader.hasNext()) {
eventType = reader.next();
if (eventType == XMLStreamConstants.START_ELEMENT) {
QName elementQName = reader.getName();
String elementName = elementQName.toString();
if (ELEMENT_PREFERENCE.equals(elementName)) {
preference = new Preference();
}
else if (ELEMENT_GENERAL.equals(elementName)) {
StaxPreferenceXmlUtil.parseGeneral(reader, preference);
}
else if (ELEMENT_VIEW.equals(elementName)) {