On Friday, December 02, 2011 16:38:29 PM Jos van den Oever wrote: > After upgrading the calligra source code to the latest version of the Relax > NG schema, a problem became apparent. > > In various places, Calligra uses text:id. In ODF 1.2, text:id has been > deprecated in many places in favor of xml:id. For <text:p> the > specification says: > ------- > The text:id attribute specifies an identifier for an element. > OpenDocument consumers shall ignore a text:id attribute if it occurs on a > <text:p> element with an xml:id attribute value. If there is no xml:id > attribute value, then a text:id attribute should be processed as it were an > xml:id attribute. > OpenDocument producers may write text:id attributes for <text:p> elements > in addition to an xml:id attribute. > A <text:p> element shall not have an text:id attribute if it has no xml:id > attribute value. The value of a text:id attribute shall equal the value of > an xml:id attribute on the same <text:p> element. > The text:id attribute is deprecated in favor of xml:id. 19.914 > ------- > The same rules are defined for draw:text-box, text:changed-region, text:h, > and text:p. The quickest fix for this problem is to write out xml:id > whereever text:id is written on one of these elements. > > I've fixed this in libs/kotext/opendocument/KoTextWriter_p.cpp as a start. > At least a few odf documents should now roundtrip to valid ODF documents.
Currently, still nearly half of the roundtripped ODF files fail. ODT: 235 (127) ODS: 178 (61) ODP: 11 (11) Here is the list of error messages ordered by how often they occur. Note that these errors are not necessarily very clear. E.g. the most prevalent error says frame is not allowed in p. In fact <draw:frame> *is* allowed in <text:p>. The libxml2 library is not as clear as jing.jar which is used in validateODF.py. The latter gives the following error: error: element "draw:frame" missing required attribute "xml:id" xml:id is needed because draw:id="shape1" is defined. Because of this xml:id must be defined too. I've commited a patch which should fix many instances of this. You can recreate the errors with e.g.: calligratables --roundtrip-filename out.ods testfile.ods tools/scripts/validateODF.py out.ods To test an entire directory, on can call tools/scripts/profileOfficeFileLoading.py testdir result.csv &> out.log This is also what the build server does. 78 ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element p has extra content: frame 41 ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element table has extra content: table-row 9 ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute id for element page 9 ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element table failed to validate content 7 ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element p has extra content: custom-shape 4 ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute id for element frame 4 ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element p has extra content: text 3 ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute style-name for element list 3 ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element p has extra content: g 3 ERROR:RELAXNGV:RELAXNG_ERR_ELEMWRONG: Did not expect element tracked- changes there 2 RROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute structure- protected for element document-content 2 ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element p has extra content: rect 2 0:ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element table has extra content: table-row 1 :ERROR:RELAXNGV:RELAXNG_ERR_INVALIDATTR: Invalid attribute id for element page 1 :ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element table has extra content: table-row 1 ERROR:RELAXNGV:RELAXNG_ERR_EXTRACONTENT: Element p has extra content: ellipse 1 :ERROR:RELAXNGV:RELAXNG_ERR_ELEMWRONG: Did not expect element tracked- changes there 1 :ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element table failed to validate content 1 :0:ERROR:RELAXNGV:RELAXNG_ERR_CONTENTVALID: Element table failed to validate content Up to date results are at: http://158.36.191.251:8080/ (click on "login as guest") Cheers, Jos _______________________________________________ calligra-devel mailing list calligra-devel@kde.org https://mail.kde.org/mailman/listinfo/calligra-devel