https://bugs.documentfoundation.org/show_bug.cgi?id=145010

--- Comment #7 from [email protected] ---
Thank you! I didn't know about the flat file format. I could use it to repair
my presentation:

```
    import lxml.etree as ET

    ns = {
        "smil":        
"urn:oasis:names:tc:opendocument:xmlns:smil-compatible:1.0",
        "anim":         "urn:oasis:names:tc:opendocument:xmlns:animation:1.0",
    }

    path_in  = "Quiz1.fodp"
    path_out = "Quiz2.fodp"

    # parse fodp as xml
    with open(path_in, "rb") as odp:
        root = ET.fromstring(odp.read())

    # find damaged animations
    setsWithoutTarget = root.xpath("//anim:set[not(@smil:targetElement)]",
namespaces=ns)
   
setsWithoutTarget.extend(root.xpath("//anim:animateColor[not(@smil:targetElement)]",
namespaces=ns))

    # remove these nodes
    for set in setsWithoutTarget:
        parent = set.getparent()
        while len(parent.getchildren()) == 1:
            parent = parent.getparent()
        parent.getparent().remove(parent)

    # write new fodp
    with open(path_out, "w") as odp:
        odp.write('<?xml version="1.0" encoding="UTF-8"?>\n\n')
        odp.write(ET.tostring(root, encoding="unicode", pretty_print=True))
```

It would be good if Impress would automatically remove such invalid animations,
but it would be even better if these animations wouldn't be created at all ;)

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to