docx-reader 0.1.1

A .docx file reader in rust
Documentation
use std::io::Read;
use std::str::FromStr;
use xml::attribute::OwnedAttribute;
use xml::reader::{EventReader, XmlEvent};

use super::*;

impl ElementReader for TableCell {
	fn read<R: Read>(r: &mut EventReader<R>, _: &[OwnedAttribute]) -> Result<Self, ReaderError> {
		let mut cell = TableCell::new();
		loop {
			let e = r.next();

			match e {
				Ok(XmlEvent::StartElement {
					attributes, name, ..
				}) => {
					let e = XMLElement::from_str(&name.local_name).unwrap();
					match e {
						XMLElement::Paragraph => {
							let p = Paragraph::read(r, &attributes)?;
							cell = cell.add_paragraph(p);
							continue;
						}
						XMLElement::StructuredDataTag => {
							if let Ok(tag) = StructuredDataTag::read(r, &attributes) {
								cell = cell.add_structured_data_tag(tag);
							}
							continue;
						}
						XMLElement::TableCellProperty => {
							if let Ok(p) = TableCellProperty::read(r, &attributes) {
								cell.property = p;
							}
							continue;
						}
						XMLElement::Table => {
							if let Ok(table) = Table::read(r, &attributes) {
								cell = cell.add_table(table)
							}
						}
						_ => {}
					}
				}
				Ok(XmlEvent::EndElement { name, .. }) => {
					let e = XMLElement::from_str(&name.local_name).unwrap();
					if e == XMLElement::TableCell {
						return Ok(cell);
					}
				}
				Err(_) => return Err(ReaderError::XMLReadError),
				_ => {}
			}
		}
	}
}