| Kohei Yoshida | b5f5085 | 2017-05-11 23:31:26 -0400 | [diff] [blame] | 1 | ## Contains ODF import and export filter logic. |
| Michael Stahl | 4386a0d | 2013-03-11 21:16:46 +0100 | [diff] [blame] | 2 | |
| 3 | The main library "xo" contains the basic ODF import/export filter |
| 4 | implementation for most applications. The document is accessed |
| 5 | via its UNO API, which has the advantage that the same import/export |
| 6 | code can be used for text in all applications (from/to Writer/EditEngine). |
| 7 | The filter consumes/produces via SAX UNO API interface (implemented in |
| 8 | "sax"). Various bits of the ODF filters are also implemented in |
| Kohei Yoshida | 624ec19 | 2017-05-19 20:43:04 -0400 | [diff] [blame] | 9 | applications, for example [git:sw/source/filter/xml]. |
| Michael Stahl | 4386a0d | 2013-03-11 21:16:46 +0100 | [diff] [blame] | 10 | |
| 11 | There is a central list of all element or attribute names in |
| Kohei Yoshida | d1de267 | 2017-05-19 21:11:02 -0400 | [diff] [blame] | 12 | [git:include/xmloff/xmltoken.hxx]. The main class of the import filter |
| Michael Stahl | 4386a0d | 2013-03-11 21:16:46 +0100 | [diff] [blame] | 13 | is SvXMLImport, and of the export filter SvXMLExport. |
| 14 | |
| 15 | The Import filter maintains a stack of contexts for each element being |
| 16 | read. There are many classes specific to particular elements, derived |
| 17 | from SvXMLImportContext. |
| 18 | |
| 19 | Note that for export several different versions of ODF are supported, |
| 20 | with the default being the latest ODF version with "extensions", which |
| 21 | means it may contain elements and attributes that are only in drafts of |
| 22 | the specification or are not yet submitted for specification. Documents |
| 23 | produced in the other (non-extended) ODF modes are supposed to be |
| Andrea Gelmini | 74117f9 | 2017-03-24 15:38:38 +0100 | [diff] [blame] | 24 | strictly conforming to the respective specification, i.e., only markup |
| Michael Stahl | 4386a0d | 2013-03-11 21:16:46 +0100 | [diff] [blame] | 25 | defined by the ODF specification is allowed. |
| 26 | |
| 27 | There is another library "xof" built from the source/transform directory, |
| 28 | which is the filter for the OpenOffice.org XML format. This legacy format |
| 29 | is a predecessor of ODF and was the default in OpenOffice.org 1.x versions, |
| 30 | which did not support ODF. This filter works as a SAX transformation |
| 31 | from/to ODF, i.e., when importing a document the transform library reads |
| 32 | the SAX events from the file and generates SAX events that are then |
| 33 | consumed by the ODF import filter. |
| 34 | |
| Kohei Yoshida | 624ec19 | 2017-05-19 20:43:04 -0400 | [diff] [blame] | 35 | [OpenOffice.org XML File Format](http://www.openoffice.org/xml/general.html) |
| Michael Stahl | 4386a0d | 2013-03-11 21:16:46 +0100 | [diff] [blame] | 36 | |
| 37 | There is some stuff in the "dtd" directory which is most likely related |
| 38 | to the OpenOffice.org XML format but is possibly outdated and obsolete. |
| Kohei Yoshida | b5f5085 | 2017-05-11 23:31:26 -0400 | [diff] [blame] | 39 | |
| 40 | ### Add new XML tokens |
| 41 | |
| 42 | When adding a new XML token, you need to add its entry in the following three |
| 43 | files: |
| 44 | |
| Kohei Yoshida | 624ec19 | 2017-05-19 20:43:04 -0400 | [diff] [blame] | 45 | * [git:include/xmloff/xmltoken.hxx] |
| 46 | * [git:xmloff/source/core/xmltoken.cxx] |
| 47 | * [git:xmloff/source/token/tokens.txt] |
| Kohei Yoshida | b5f5085 | 2017-05-11 23:31:26 -0400 | [diff] [blame] | 48 | |