[gnumeric] ods: one more preparse dtd simplification



commit 2b8a9eb120893a41ec1b6621515415ff5207e463
Author: Morten Welinder <terra gnome org>
Date:   Fri Jun 19 10:26:59 2015 -0400

    ods: one more preparse dtd simplification

 plugins/openoffice/openoffice-read.c |  111 ++++------------------------------
 1 files changed, 11 insertions(+), 100 deletions(-)
---
diff --git a/plugins/openoffice/openoffice-read.c b/plugins/openoffice/openoffice-read.c
index 24aeede..e7124bc 100644
--- a/plugins/openoffice/openoffice-read.c
+++ b/plugins/openoffice/openoffice-read.c
@@ -12236,112 +12236,18 @@ static GsfXMLInNode const opendoc_content_preparse_overrides[] =
        GSF_XML_IN_NODE (NAMED_EXPRS, NAMED_RANGE, OO_NS_TABLE, "named-range", GSF_XML_NO_CONTENT, 
&oo_named_expr_preparse, NULL),
        GSF_XML_IN_NODE_END
 };
-
 static GsfXMLInNode const *opendoc_content_preparse_dtd;
 
 
-static GsfXMLInNode const ooo1_content_preparse_dtd [] = {
-GSF_XML_IN_NODE_FULL (START, START, -1, NULL, GSF_XML_NO_CONTENT, FALSE, TRUE, NULL, NULL, 0),
-GSF_XML_IN_NODE (START, OFFICE, OO_NS_OFFICE, "document-content", GSF_XML_NO_CONTENT, NULL, NULL),
-  GSF_XML_IN_NODE (OFFICE, SCRIPT, OO_NS_OFFICE, "script", GSF_XML_NO_CONTENT, NULL, NULL),
-  GSF_XML_IN_NODE (OFFICE, OFFICE_FONTS, OO_NS_OFFICE, "font-decls", GSF_XML_NO_CONTENT, NULL, NULL),
-    GSF_XML_IN_NODE (OFFICE_FONTS, FONT_DECL, OO_NS_STYLE, "font-decl", GSF_XML_NO_CONTENT, NULL, NULL),
-  GSF_XML_IN_NODE (OFFICE, OFFICE_STYLES, OO_NS_OFFICE, "automatic-styles", GSF_XML_NO_CONTENT, NULL, NULL),
-    GSF_XML_IN_NODE (OFFICE_STYLES, PAGE_MASTER, OO_NS_STYLE, "page-master", GSF_XML_NO_CONTENT, NULL, NULL),
-    GSF_XML_IN_NODE (OFFICE_STYLES, STYLE, OO_NS_STYLE, "style", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (STYLE, STYLE_PROP, OO_NS_STYLE, "properties", GSF_XML_NO_CONTENT, NULL, NULL),
-        GSF_XML_IN_NODE (STYLE_PROP, STYLE_TAB_STOPS, OO_NS_STYLE, "tab-stops", GSF_XML_NO_CONTENT, NULL, 
NULL),
-
-    GSF_XML_IN_NODE (OFFICE_STYLES, NUMBER_STYLE, OO_NS_NUMBER, "number-style", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_NUMBER, OO_NS_NUMBER,          "number", 
GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_TEXT, OO_NS_NUMBER,    "text", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_FRACTION, OO_NS_NUMBER, "fraction", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_SCI_STYLE_PROP, OO_NS_NUMBER, "scientific-number", 
GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_STYLE_PROP, OO_NS_STYLE,     "properties", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (NUMBER_STYLE, NUMBER_MAP, OO_NS_STYLE,            "map", GSF_XML_NO_CONTENT, NULL, 
NULL),
-
-    GSF_XML_IN_NODE (OFFICE_STYLES, DATE_STYLE, OO_NS_NUMBER, "date-style", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_DAY, OO_NS_NUMBER,             "day", GSF_XML_NO_CONTENT,      NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_MONTH, OO_NS_NUMBER,           "month", GSF_XML_NO_CONTENT,    NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_YEAR, OO_NS_NUMBER,            "year", GSF_XML_NO_CONTENT,     NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_ERA, OO_NS_NUMBER,             "era", GSF_XML_NO_CONTENT,      NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_DAY_OF_WEEK, OO_NS_NUMBER,     "day-of-week", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_WEEK_OF_YEAR, OO_NS_NUMBER,    "week-of-year", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_QUARTER, OO_NS_NUMBER,         "quarter", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_HOURS, OO_NS_NUMBER,           "hours", GSF_XML_NO_CONTENT,    NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_MINUTES, OO_NS_NUMBER,         "minutes", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_SECONDS, OO_NS_NUMBER,         "seconds", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_AM_PM, OO_NS_NUMBER,           "am-pm", GSF_XML_NO_CONTENT,    NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_TEXT, OO_NS_NUMBER,            "text", GSF_XML_NO_CONTENT,     NULL, 
NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_TEXT_PROP, OO_NS_STYLE,                "text-properties", 
GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (DATE_STYLE, DATE_MAP, OO_NS_STYLE,              "map", GSF_XML_NO_CONTENT, NULL, 
NULL),
-
-    GSF_XML_IN_NODE (OFFICE_STYLES, TIME_STYLE, OO_NS_NUMBER, "time-style", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (TIME_STYLE, TIME_HOURS, OO_NS_NUMBER,           "hours", GSF_XML_NO_CONTENT,    NULL, 
NULL),
-      GSF_XML_IN_NODE (TIME_STYLE, TIME_MINUTES, OO_NS_NUMBER,         "minutes", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (TIME_STYLE, TIME_SECONDS, OO_NS_NUMBER,         "seconds", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (TIME_STYLE, TIME_AM_PM, OO_NS_NUMBER,           "am-pm", GSF_XML_NO_CONTENT,    NULL, 
NULL),
-      GSF_XML_IN_NODE (TIME_STYLE, TIME_TEXT, OO_NS_NUMBER,            "text", GSF_XML_NO_CONTENT,     NULL, 
NULL),
-      GSF_XML_IN_NODE (TIME_STYLE, TIME_TEXT_PROP, OO_NS_STYLE,                "text-properties", 
GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (TIME_STYLE, TIME_MAP, OO_NS_STYLE,              "map", GSF_XML_NO_CONTENT, NULL, 
NULL),
-
-    GSF_XML_IN_NODE (OFFICE_STYLES, STYLE_BOOL, OO_NS_NUMBER, "boolean-style", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (STYLE_BOOL, BOOL_PROP, OO_NS_NUMBER, "boolean", GSF_XML_NO_CONTENT, NULL, NULL),
-    GSF_XML_IN_NODE (OFFICE_STYLES, STYLE_CURRENCY, OO_NS_NUMBER, "currency-style", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_STYLE, OO_NS_NUMBER, "number", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_STYLE_PROP, OO_NS_STYLE, "properties", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_MAP, OO_NS_STYLE, "map", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_SYMBOL, OO_NS_NUMBER, "currency-symbol", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_CURRENCY, CURRENCY_TEXT, OO_NS_NUMBER, "text", GSF_XML_NO_CONTENT, NULL, NULL),
-    GSF_XML_IN_NODE (OFFICE_STYLES, STYLE_PERCENTAGE, OO_NS_NUMBER, "percentage-style", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_PERCENTAGE, PERCENTAGE_STYLE_PROP, OO_NS_NUMBER, "number", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_PERCENTAGE, PERCENTAGE_TEXT, OO_NS_NUMBER, "text", GSF_XML_NO_CONTENT, NULL, 
NULL),
-    GSF_XML_IN_NODE (OFFICE_STYLES, STYLE_TEXT, OO_NS_NUMBER, "text-style", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_TEXT, STYLE_TEXT_CONTENT, OO_NS_NUMBER,   "text-content", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_TEXT, STYLE_TEXT_PROP, OO_NS_NUMBER,              "text", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (STYLE_TEXT, STYLE_TEXT_MAP, OO_NS_STYLE,                "map", GSF_XML_NO_CONTENT, 
NULL, NULL),
-
-  GSF_XML_IN_NODE (OFFICE, OFFICE_BODY, OO_NS_OFFICE, "body", GSF_XML_NO_CONTENT, NULL, NULL),
-    GSF_XML_IN_NODE (OFFICE_BODY, TABLE_CALC_SETTINGS, OO_NS_TABLE, "calculation-settings", 
GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (TABLE_CALC_SETTINGS, DATE_CONVENTION, OO_NS_TABLE, "null-date", GSF_XML_NO_CONTENT, 
NULL, NULL),
-      GSF_XML_IN_NODE (TABLE_CALC_SETTINGS, ITERATION, OO_NS_TABLE, "iteration", GSF_XML_NO_CONTENT, NULL, 
NULL),
-    GSF_XML_IN_NODE (OFFICE_BODY, VALIDATIONS, OO_NS_TABLE, "content-validations", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (VALIDATIONS, VALIDATION, OO_NS_TABLE, "content-validation", GSF_XML_NO_CONTENT, NULL, 
NULL),
-        GSF_XML_IN_NODE (VALIDATION, VALIDATION_MSG, OO_NS_TABLE, "error-message", GSF_XML_NO_CONTENT, NULL, 
NULL),
-
-    GSF_XML_IN_NODE (OFFICE_BODY, TABLE, OO_NS_TABLE, "table", GSF_XML_NO_CONTENT, 
&odf_preparse_table_start, &odf_preparse_table_end),
-      GSF_XML_IN_NODE (TABLE, FORMS,    OO_NS_OFFICE, "forms", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (TABLE, TABLE_COL, OO_NS_TABLE, "table-column", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (TABLE, TABLE_ROW, OO_NS_TABLE, "table-row", GSF_XML_NO_CONTENT, 
&odf_preparse_row_start, &odf_preparse_row_end),
+static GsfXMLInNode const ooo1_content_preparse_overrides [] =
+{
+       GSF_XML_IN_NODE (OFFICE_BODY, TABLE, OO_NS_TABLE, "table", GSF_XML_NO_CONTENT, 
&odf_preparse_table_start, &odf_preparse_table_end),
+       GSF_XML_IN_NODE (TABLE, TABLE_ROW, OO_NS_TABLE, "table-row", GSF_XML_NO_CONTENT, 
&odf_preparse_row_start, &odf_preparse_row_end),
        GSF_XML_IN_NODE (TABLE_ROW, TABLE_CELL, OO_NS_TABLE, "table-cell", GSF_XML_NO_CONTENT, 
&odf_preparse_cell_start, NULL),
-         GSF_XML_IN_NODE (TABLE_CELL, CELL_CONTROL, OO_NS_DRAW, "control", GSF_XML_NO_CONTENT, NULL, NULL),
-         GSF_XML_IN_NODE (TABLE_CELL, CELL_TEXT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, NULL),
-           GSF_XML_IN_NODE (CELL_TEXT, CELL_TEXT_S,    OO_NS_TEXT, "s", GSF_XML_NO_CONTENT, NULL, NULL),
-           GSF_XML_IN_NODE (CELL_TEXT, CELL_TEXT_SPAN, OO_NS_TEXT, "span", GSF_XML_SHARED_CONTENT, NULL, 
NULL),
-         GSF_XML_IN_NODE (TABLE_CELL, CELL_OBJECT, OO_NS_DRAW, "object", GSF_XML_NO_CONTENT, NULL, NULL),    
          /* ignore for now */
-         GSF_XML_IN_NODE (TABLE_CELL, CELL_GRAPHIC, OO_NS_DRAW, "g", GSF_XML_NO_CONTENT, NULL, NULL),        
  /* ignore for now */
-           GSF_XML_IN_NODE (CELL_GRAPHIC, CELL_GRAPHIC, OO_NS_DRAW, "g", GSF_XML_NO_CONTENT, NULL, NULL),    
          /* 2nd def */
-           GSF_XML_IN_NODE (CELL_GRAPHIC, DRAW_POLYLINE, OO_NS_DRAW, "polyline", GSF_XML_NO_CONTENT, NULL, 
NULL),      /* 2nd def */
-         GSF_XML_IN_NODE (TABLE_CELL, DRAW_LINE, OO_NS_DRAW, "line", GSF_XML_NO_CONTENT, NULL, NULL),
-            GSF_XML_IN_NODE (DRAW_LINE, IGNORED_TEXT_CONTENT, OO_NS_TEXT, "p", GSF_XML_NO_CONTENT, NULL, 
NULL), /* ignore for now */
        GSF_XML_IN_NODE (TABLE_ROW, TABLE_COVERED_CELL, OO_NS_TABLE, "covered-table-cell", 
GSF_XML_NO_CONTENT, &odf_preparse_covered_cell_start, NULL),
-          GSF_XML_IN_NODE (TABLE_COVERED_CELL, DRAW_LINE, OO_NS_DRAW, "line", GSF_XML_NO_CONTENT, NULL, 
NULL),         /* 2nd def */
-      GSF_XML_IN_NODE (TABLE, TABLE_COL_GROUP, OO_NS_TABLE, "table-column-group", GSF_XML_NO_CONTENT, NULL, 
NULL),
-        GSF_XML_IN_NODE (TABLE_COL_GROUP, TABLE_COL_GROUP, OO_NS_TABLE, "table-column-group", 
GSF_XML_NO_CONTENT, NULL, NULL),
-        GSF_XML_IN_NODE (TABLE_COL_GROUP, TABLE_COL, OO_NS_TABLE, "table-column", GSF_XML_NO_CONTENT, NULL, 
NULL), /* 2nd def */
-      GSF_XML_IN_NODE (TABLE, TABLE_ROW_GROUP,       OO_NS_TABLE, "table-row-group", GSF_XML_NO_CONTENT, 
NULL, NULL),
-        GSF_XML_IN_NODE (TABLE_ROW_GROUP, TABLE_ROW_GROUP, OO_NS_TABLE, "table-row-group", 
GSF_XML_NO_CONTENT, NULL, NULL),
-        GSF_XML_IN_NODE (TABLE_ROW_GROUP, TABLE_ROW,       OO_NS_TABLE, "table-row", GSF_XML_NO_CONTENT, 
NULL, NULL), /* 2nd def */
-    GSF_XML_IN_NODE (OFFICE_BODY, NAMED_EXPRS, OO_NS_TABLE, "named-expressions", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (NAMED_EXPRS, NAMED_EXPR, OO_NS_TABLE, "named-expression", GSF_XML_NO_CONTENT, NULL, 
NULL),
-      GSF_XML_IN_NODE (NAMED_EXPRS, NAMED_RANGE, OO_NS_TABLE, "named-range", GSF_XML_NO_CONTENT, NULL, NULL),
-    GSF_XML_IN_NODE (OFFICE_BODY, DB_RANGES, OO_NS_TABLE, "database-ranges", GSF_XML_NO_CONTENT, NULL, NULL),
-      GSF_XML_IN_NODE (DB_RANGES, DB_RANGE, OO_NS_TABLE, "database-range", GSF_XML_NO_CONTENT, NULL, NULL),
-        GSF_XML_IN_NODE (DB_RANGE, TABLE_SORT, OO_NS_TABLE, "sort", GSF_XML_NO_CONTENT, NULL, NULL),
-          GSF_XML_IN_NODE (TABLE_SORT, SORT_BY, OO_NS_TABLE, "sort-by", GSF_XML_NO_CONTENT, NULL, NULL),
-
-GSF_XML_IN_NODE_END
+       GSF_XML_IN_NODE_END
 };
+static GsfXMLInNode const *ooo1_content_preparse_dtd;
 
 
 static GsfXMLInNode const *get_dtd () { return opendoc_content_dtd; }
@@ -13936,6 +13842,9 @@ go_plugin_init (G_GNUC_UNUSED GOPlugin *plugin, G_GNUC_UNUSED GOCmdContext *cc)
 
        opendoc_content_preparse_dtd =
                create_preparse_dtd (opendoc_content_dtd, opendoc_content_preparse_overrides);
+
+       ooo1_content_preparse_dtd =
+               create_preparse_dtd (ooo1_content_dtd, ooo1_content_preparse_overrides);
 }
 
 G_MODULE_EXPORT void
@@ -13945,4 +13854,6 @@ go_plugin_shutdown (G_GNUC_UNUSED GOPlugin *plugin, G_GNUC_UNUSED GOCmdContext *
        magic_transparent = NULL;
        g_free ((gpointer)opendoc_content_preparse_dtd);
        opendoc_content_preparse_dtd = NULL;
+       g_free ((gpointer)ooo1_content_preparse_dtd);
+       ooo1_content_preparse_dtd = NULL;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]