repair broken xml on load
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Inkscape |
Invalid
|
Wishlist
|
Unassigned |
Bug Description
Now, what would be nice is if a file fails to load due to invalid XML, the user gets a dialog like this:
-------
This file is damaged. Do you want to
try to automatically repair it? Some
data may not be recoverable.
| Cancel | [ Repair Document ]
-------
..at which point Inkscape would retry parsing the file with a more "permissive" XML parser, and mark the document as dirty when first loaded. Similar actions for other gross violations of validity might be nice too.
One important property of the "permissive parser" would be to preserve anything it doesn't understand as an XML comment (rather than throwing it away), to permit further hand-recovery if the automatic recovery isn't sufficient.
Quoting Alan Horkan <email address hidden>:
>
> I'd go for a slightly more terse wording (and I wouldn't bother saying
> try or automatic) but this is an excellent idea.
>
> This file is damaged, would you like to repair it?
> | Cancel | [ Repair Document ]
Some extra explanation is needed to manage expectations. Given an arbitrary corrupt document, here's no guarantee that whatever heuristics the permissive parser applies won't still produce garbage or simply fail outright in nontrival cases.
From a user's perspective, it's a matter of:
"Hey, I can't load this file because it's damaged, but I might be able to recover some data for you. Do you want me to try?"
versus
"Hey, this file is damaged but I can magically fix it for you. Do you want me to fix it?"
Per most HIGs, "This file is damaged, try to repair it?" should probably be bold heading; the remainder of the explanatory text would be presented in smaller text at normal weight.
> Now, what would be nice is if a file fails to load owing
> to invalid XML, the user gets a dialog like this:
By default, Inkscape should refuse to open files
which are not well-formed; or open them in the
user's $EDITOR