src/output/spv/spvbin-helpers.c \
src/output/spv/spvbin-helpers.h \
src/output/spv/spvxml-helpers.c \
- src/output/spv/spvxml-helpers.h
+ src/output/spv/spvxml-helpers.h \
+ src/output/spv/vizml-decoder.c \
+ src/output/spv/vizml-decoder.h
light_binary_in = \
src/output/spv/binary-parser-generator \
#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"
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,
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)
{
}
spv_data_uninit (&data);
- vizml_free_visualization (v);
if (doc)
xmlFreeDoc (doc);
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);
--- /dev/null
+/* PSPP - a program for statistical analysis.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#include <config.h>
+
+#include "output/spv/vizml-decoder.h"
+
+#include "output/spv/spvxml-helpers.h"
+#include "output/spv/vizml-parser.h"
+
+char * WARN_UNUSED_RESULT
+decode_vizml (xmlNode *input, struct spv_data *data UNUSED)
+{
+ struct spvxml_context ctx = SPVXML_CONTEXT_INIT (ctx);
+ struct vizml_visualization *v;
+ vizml_parse_visualization (&ctx, input, &v);
+ char *error = spvxml_context_finish (&ctx, v ? &v->node_ : NULL);
+ if (error)
+ return error;
+
+ vizml_free_visualization (v);
+
+ return NULL;
+}
--- /dev/null
+/* PSPP - a program for statistical analysis.
+ Copyright (C) 2020 Free Software Foundation, Inc.
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+#ifndef OUTPUT_VIZML_DECODER_H
+#define OUTPUT_VIZML_DECODER_H 1
+
+/* Visualization Markup Language (VizML) decoder.
+
+ Used by spv.h, not useful directly. */
+
+#include <libxml/xmlreader.h>
+#include "libpspp/compiler.h"
+
+struct spv_data;
+
+char *decode_vizml (xmlNode *input, struct spv_data *)
+ WARN_UNUSED_RESULT;
+
+#endif /* output/spv/vizml-decoder.h */