start moving vizml parsing into a new file
[pspp] / src / output / spv / spv.c
index 1d347fd1ad981ad0c83f278a2a5393328471cded..c3d8ac6dcd1b9cc3941f893baaea426198aa51ff 100644 (file)
@@ -40,7 +40,7 @@
 #include "output/spv/spv-legacy-decoder.h"
 #include "output/spv/spv-light-decoder.h"
 #include "output/spv/structure-xml-parser.h"
-#include "output/spv/vizml-parser.h"
+#include "output/spv/vizml-decoder.h"
 
 #include "gl/c-ctype.h"
 #include "gl/intprops.h"
@@ -840,7 +840,7 @@ pivot_table_open_legacy (struct spv_item *item)
   struct spvxml_context ctx = SPVXML_CONTEXT_INIT (ctx);
   struct spvdx_visualization *v;
   spvdx_parse_visualization (&ctx, xmlDocGetRootElement (doc), &v);
-  error = spvxml_context_finish (&ctx, &v->node_);
+  error = spvxml_context_finish (&ctx, v ? &v->node_ : NULL);
 
   if (!error)
     error = decode_spvdx_table (v, item->subtype, item->legacy_properties,
@@ -915,10 +915,8 @@ spv_open_graph (struct spv_item *item)
       return error;
     }
 
-  struct spvxml_context ctx = SPVXML_CONTEXT_INIT (ctx);
-  struct vizml_visualization *v;
-  vizml_parse_visualization (&ctx, xmlDocGetRootElement (doc), &v);
-  error = spvxml_context_finish (&ctx, &v->node_);
+  if (!error)
+    error = decode_vizml (xmlDocGetRootElement (doc), &data);
 
   if (error)
     {
@@ -931,7 +929,6 @@ spv_open_graph (struct spv_item *item)
     }
 
   spv_data_uninit (&data);
-  vizml_free_visualization (v);
   if (doc)
     xmlFreeDoc (doc);
 
@@ -1140,7 +1137,7 @@ spv_heading_read (struct spv_reader *spv,
   struct spvxml_context ctx = SPVXML_CONTEXT_INIT (ctx);
   struct spvsx_root_heading *root;
   spvsx_parse_root_heading (&ctx, xmlDocGetRootElement (doc), &root);
-  error = spvxml_context_finish (&ctx, &root->node_);
+  error = spvxml_context_finish (&ctx, root ? &root->node_ : NULL);
 
   if (!error && root->page_setup)
     spv->page_setup = decode_page_setup (root->page_setup, file_name);