* @param reader The reader used to read in the file.
* @return Returns a <code>Property</code> representing the data in the file.
* @throws XMLStreamException Thrown if there is an error reading the file.
*/
public static Property parsePropertyFile(XMLStreamReader reader) throws XMLStreamException {
Property property = null;
Review review = 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 (PropertyConstraints.ELEMENT_PROPERTY.equals(elementName)) {
// create a new property object, this is the root element
property = new Property();
}
else if (PropertyConstraints.ELEMENT_REVIEW.equals(elementName)) {
// create a new review and add it to the property object
review = new Review();
property.getReview().add(review);
// get the attributes of review
String id = reader.getAttributeValue(null, PropertyConstraints.ATTRIBUTE_ID);
review.setId(id);
}