Work on describing the detail XML format at a high level
authorBen Pfaff <blp@cs.stanford.edu>
Thu, 21 Jan 2016 06:47:05 +0000 (22:47 -0800)
committerBen Pfaff <blp@cs.stanford.edu>
Thu, 21 Jan 2016 06:47:05 +0000 (22:47 -0800)
(What's a "facet"?)

parse-xml.c
spv-file-format.texi

index 2f6b33813eb43bc4aa050d3bee9fd415ff32ccf5..3a32ee36e2731b317fe6a083b77b4d0f23373e80 100644 (file)
@@ -159,6 +159,24 @@ print_attribute (xmlNode *node, const char *attr)
     }
 }
 
+static void
+print_element (xmlDoc *doc, xmlNode *node, const char *element)
+{
+  for (; node; node = node->next)
+    {
+      if (!strcmp(element, (char *) node->name))
+        {
+          xmlBuffer *buf = xmlBufferCreate();
+          xmlNodeDump (buf, doc, node, 0, 1);
+          xmlBufferDump (stdout, buf);
+          xmlBufferFree (buf);
+          putchar ('\n');
+        }
+
+      print_element (doc, node->children, element);
+    }
+}
+
 static __attribute__((unused)) xmlNode *
 find_page_setup (xmlNode *node)
 {
@@ -237,6 +255,8 @@ main (int argc, char **argv)
     print_cdata (root);
   else if (!strcmp(argv[2], "text"))
     print_text (root);
+  else if (!strncmp(argv[2], "element:", 8))
+    print_element (doc, root, argv[2] + 8);
   else if (!strncmp(argv[2], "attr:", 5))
     print_attribute (root, argv[2] + 5);
   else if (!strcmp(argv[2], "labels"))
index 789a77707ce4d2894d80daec9f8af2975cd30ccb..6e73aef30960406ebbc9cdbc7ac88296d93d3ab1 100644 (file)
@@ -1227,7 +1227,35 @@ label is the string @code{s}.  Each label also includes a
 
 This format is still under investigation.
 
-All elements have an optional @code{id} attribute.
+The design of the detail XML format is not what one would end up with
+for describing pivot tables.  This is because it is a specialization
+of a much more general format (``visualization XML'' or ``VizML'')
+that can describe a wide range of visualizations.  Most of this
+generality is overkill for tables, and so we end up with a funny
+subset of a general-purpose format.
+
+The important elements of the detail XML format are:
+
+@itemize @bullet
+@item
+Variables.  Variables in detail XML roughly correspond to the
+dimensions in a light detail member.  There is one variable for each
+dimension, plus one variable for each level of labeling along an axis.
+
+The bulk of variables are defined with @code{sourceVariable} elements.
+The data for these variables comes from the associated
+@code{tableData.bin} member.  Some variables are defined, with
+@code{derivedVariable} elements, as a constant or in terms of a
+mapping function from a source variable.
+
+@item
+Assignment of variables to axes.  A variable can appear as columns, or
+rows, or layers.  The @code{faceting} element and its sub-elements
+describe this assignment.
+@end itemize
+
+All elements have an optional @code{id} attribute.  In practice many
+elements are assigned @code{id} attributes that are never referenced.
 
 @node SPV Detail visualization Element
 @subsection The @code{visualization} Element
@@ -1309,7 +1337,8 @@ Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat})?
 
 This element defines a variable whose values can be used elsewhere in
 the visualization.  It ties this element's @code{id} to a variable
-from the @file{.bin} member that corresponds to this @file{.xml}.
+from the @file{tableData.bin} member that corresponds to this
+@file{.xml}.
 
 This element has the following attributes.
 
@@ -1319,12 +1348,14 @@ Always set to @code{true}.
 
 @defvr {Required} source
 Always set to @code{tableData}, the @code{source-name} in the
-corresponding @file{.bin} member (@pxref{SPV Legacy Member Metadata}).
+corresponding @file{tableData.bin} member (@pxref{SPV Legacy Member
+Metadata}).
 @end defvr
 
 @defvr {Required} sourceName
 The name of a variable within the source, the @code{variable-name} in
-the corresponding @file{.bin} member (@pxref{SPV Legacy Member Data}).
+the corresponding @file{tableData.bin} member (@pxref{SPV Legacy
+Member Data}).
 @end defvr
 
 @defvr {Optional} dependsOn