PoiScript / docx-rs

A Rust library for parsing and generating docx files.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Document loading/parsing errors

tuxmark5 opened this issue · comments

I've been using docx crate in one of my projects for a while and over time I've run into a few documents that fail to load with this crate.

element_end.docx:
Xml(UnexpectedToken { token: "ElementEnd { end: Empty, span: StrSpan(\"/>\" 487..489) }" })

invalid_digit.docx:
Xml(FromStr(ParseIntError { kind: InvalidDigit }))

missing_content.docx:
Xml(MissingField { name: "Hyperlink", field: "content" })

missing_id.docx:
Xml(MissingField { name: "NumberingProperty", field: "id" })

missing_level.docx:
Xml(MissingField { name: "NumberingProperty", field: "level" })

unkown_value_right.docx
Xml(FromStr("Unkown Value. Found right, Expected "start", "end", "center","))
^ Also a typo in the error message (Unkown -> Unknown).

Most of the documents fail to load because of the missing id/level in NumberingProperty and unknown right value. The other errors are quite rare.