repair broken xml on load

Bug #170577 reported by Buliabyak-users
2
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.

Tags: importing svg ui
Revision history for this message
Bpfowler (bpfowler) wrote :

> 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

Revision history for this message
Bpfowler (bpfowler) wrote :

> ... 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.

I am sure that I would use this if it were in Inkscape, but
isn't it more work than needed?

My naive approach would be to try to put the importer
into 'vinegar and brown paper' mode in which elements
with warnings and/or errors where patched with ones
which looked the same (or were deleted if there were no
plausible replacement), but had no errors.

As you say, retaining the original XML is some form,
possibly a comment.

Revision history for this message
Bpfowler (bpfowler) wrote :

Suggested text:

BOLD: The document <name> could not be read in its
entirety because it has errors, or some data are missing.
Do you want to recover the readable data in this file?

Smaller: Inkscape can create a new document from any
readable objects contained in your file. Your original file
will not
be touched. Inkscape will open a new window called
<name> [Recovered]. You might want to export the
recovered objects into a new file before proceeding.
Note: You may be able to obtain better results using an
XML editor or text editor.

Revision history for this message
Bug Importer (bug-importer) wrote :

Bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1326574&group_id=93438&atid=604306
provides files that can be opened by inkscape by imply
strange behavior. This kind of problem might be added to an
XML checker build into inkscape.

Revision history for this message
Bug Importer (bug-importer) wrote :

Bug:
http://sourceforge.net/tracker/index.php?func=detail&aid=1326574&group_id=93438&atid=604306
provides files that can be opened by inkscape but imply
strange behavior. This kind of problem might be added to an
XML checker build into inkscape.

Revision history for this message
vonHalenbach (lustik) wrote :

good idea!

Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
jazzynico (jazzynico)
tags: added: importing svg ui
su_v (suv-lp)
description: updated
Revision history for this message
Jonathan Hofinger (jhofinger) wrote :

Hi, this has been suggested on GitLab as well: https://gitlab.com/inkscape/inbox/issues/853

Closed by: https://gitlab.com/jhofinger

Changed in inkscape:
status: Confirmed → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.