From: Ben Pfaff Date: Mon, 22 Feb 2016 01:51:45 +0000 (-0800) Subject: Document more detail XML. X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?p=pspp;a=commitdiff_plain;h=1713de7bb9768a933a7974a3713586a63f53d638 Document more detail XML. --- diff --git a/detail-xml b/detail-xml index 3735a657fa..9fca90acf4 100644 --- a/detail-xml +++ b/detail-xml @@ -66,7 +66,7 @@ formatMapping := [id? from] format footnotes := [id? superscript variable] footnoteMapping+ footnoteMapping := [id? from to definesReference] -cross := [id?] nest+ +cross := [id?] nest nest nest := [id?] variableReference+ variableReference := [ref] diff --git a/dump2.c b/dump2.c index 15670ecf4b..740cbbedaa 100644 --- a/dump2.c +++ b/dump2.c @@ -217,7 +217,8 @@ dump_source(int end, int count, int n_series, const char *name) int n_sysmis = 0; for (int i = 0; i < n_series; i++) { - printf (" series %d: \"%s\"\n ", i, get_fixed_string(288)); + printf (" series %d: \"%s\", %d values:\n ", + i, get_fixed_string(288), count); for (int i = 0; i < count; i++) { double d = get_double(); diff --git a/parse-xml.c b/parse-xml.c index 3a32ee36e2..9cf6694f91 100644 --- a/parse-xml.c +++ b/parse-xml.c @@ -164,7 +164,7 @@ print_element (xmlDoc *doc, xmlNode *node, const char *element) { for (; node; node = node->next) { - if (!strcmp(element, (char *) node->name)) + if (node->name && !strcmp(element, (char *) node->name)) { xmlBuffer *buf = xmlBufferCreate(); xmlNodeDump (buf, doc, node, 0, 1); diff --git a/spv-detail.gv b/spv-detail.gv index e026a483e3..5704c6a49d 100644 --- a/spv-detail.gv +++ b/spv-detail.gv @@ -48,7 +48,7 @@ digraph spv_detail { "footnotes" -> "footnoteMapping" [label="+"]; - "cross" -> "nest" [label="+"]; + "cross" -> "nest" [label="2"]; "nest" -> "variableReference" [label="+"]; diff --git a/spv-file-format.texi b/spv-file-format.texi index 6e73aef309..6c6878b274 100644 --- a/spv-file-format.texi +++ b/spv-file-format.texi @@ -143,18 +143,18 @@ times. @end iftex @menu -* SPV heading Element:: -* SPV label Element:: -* SPV container Element:: -* SPV text Element (Inside @code{container}):: -* SPV html Element:: -* SPV table Element:: -* SPV tableStructure Element:: -* SPV dataPath Element:: -* SPV pageSetup Element:: -* SPV pageHeader and pageFooter Elements:: -* SPV pageParagraph Element:: -* SPV @code{text} Element (Inside @code{pageParagraph}):: +* SPV Structure heading Element:: +* SPV Structure label Element:: +* SPV Structure container Element:: +* SPV Structure text Element (Inside @code{container}):: +* SPV Structure html Element:: +* SPV Structure table Element:: +* SPV Structure tableStructure Element:: +* SPV Structure dataPath Element:: +* SPV Structure pageSetup Element:: +* SPV Structure pageHeader and pageFooter Elements:: +* SPV Structure pageParagraph Element:: +* SPV Structure @code{text} Element (Inside @code{pageParagraph}):: @end menu @node SPV Structure heading Element @@ -440,7 +440,7 @@ This element has no attributes. @node SPV Structure @code{text} Element (Inside @code{pageParagraph}) @subsection The @code{text} Element (Inside @code{pageParagraph}) -Parent: @code{pageParagraph} @* +Parent: @code{pageParagraph} Contents: CDATA? This @code{text} element is nested inside a @code{pageParagraph}. There @@ -1228,7 +1228,7 @@ label is the string @code{s}. Each label also includes a This format is still under investigation. 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 +for describing pivot tables. This is because it is a special case 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 @@ -1257,6 +1257,17 @@ describe this assignment. All elements have an optional @code{id} attribute. In practice many elements are assigned @code{id} attributes that are never referenced. +@menu +* SPV Detail visualization Element:: +* SPV Detail userSource Element:: +* SPV Detail sourceVariable Element:: +* SPV Detail derivedVariable Element:: +* SPV Detail extension Element:: +* SPV Detail graph Element:: +* SPV Detail location Element:: +* SPV Detail coordinates Element:: +@end menu + @node SPV Detail visualization Element @subsection The @code{visualization} Element @@ -1295,6 +1306,7 @@ format used in Unix with the underscore replaced by a hyphen, e.g.@: @defvr {Required} name The title of the pivot table, localized to the output language. +@end defvr @defvr {Required} style The @code{id} of a @code{style} element (@pxref{SPV Detail style @@ -1316,10 +1328,8 @@ one of 2.4, 2.5, 2.7, and 2.8. @node SPV Detail userSource Element @subsection The @code{userSource} Element -@format Parent: @code{visualization} @* Contents: -@end format This element has the following attributes. @@ -1330,10 +1340,8 @@ Always @code{listwise}. @node SPV Detail sourceVariable Element @subsection The @code{sourceVariable} Element -@format Parent: @code{visualization} @* Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat})? -@end format This element defines a variable whose values can be used elsewhere in the visualization. It ties this element's @code{id} to a variable @@ -1377,10 +1385,8 @@ as value labels. @node SPV Detail derivedVariable Element @subsection The @code{derivedVariable} Element -@format Parent: @code{visualization} @* Contents: @code{extension}* (@code{format} @math{|} @code{stringFormat} @code{valueMapEntry}*) -@end format Like @code{sourceVariable}, this element defines a variable whose values can be used elsewhere in the visualization. Instead of being @@ -1417,13 +1423,15 @@ viewer can work with them together. For a group variable, this is the name of the corresponding categorical variable. @end defvr +@menu +* SPV Detail valueMapEntry Element:: +@end menu + @node SPV Detail valueMapEntry Element @subsubsection The @code{valueMapEntry} Element -@format Parent: @code{derivedVariable} @* Contents: empty -@end format A @code{valueMapEntry} element defines a mapping from one or more values of a source expression to a target value. (In the corpus, the @@ -1500,3 +1508,96 @@ An integer or a name like ``dimension0''. @defvr {Required} helpId An identifier. @end defvr + +@node SPV Detail graph Element +@subsection The @code{graph} Element + +Parent: @code{visualization} @* +Contents: @code{location}@math{+} @code{coordinates} @code{faceting} @code{facetLayout} @code{interval} + +@code{graph} has the following attributes. + +@defvr {Required} cellStyle +@defvrx {Required} style +Each of these is the @code{id} of a @code{style} element (@pxref{SPV +Detail style element}). The former is the default style for +individual cells, the latter for the entire table. +@end defvr + +@node SPV Detail location Element +@subsection The @code{location} Element + +Parent: @code{graph} @* +Contents: empty + +Each instance of this element specifies where some part of the table +frame is located. All the examples in the corpus have four instances +of this element, one for each of the parts @code{height}, +@code{width}, @code{left}, and @code{top}. Some examples in the +corpus add a fifth for part @code{bottom}, even though it is not clear +how all of @code{top}, @code{bottom}, and @code{heigth} can be honored +at the same time. In any case, @code{location} seems to have little +importance in representing tables; a reader can safely ignore it. + +@defvr {Required} part +One of @code{height}, @code{width}, @code{top}, @code{bottom}, or +@code{left}. Presumably @code{right} is acceptable as well but the +corpus contains no examples. +@end defvr + +@defvr {Required} method +How the location is determined: + +@table @code +@item sizeToContent +Based on the natural size of the table. Observed only for +parts @code{height} and @code{width}. + +@item attach +Based on the location specified in @code{target}. Observed only for +parts @code{top} and @code{bottom}. + +@item fixed +Using the value in @code{value}. Observed only for parts @code{top}, +@code{bottom}, and @code{left}. + +@item same +Same as the specified @code{target}. Observed only for part +@code{left}. +@end table +@end defvr + +@defvr {Optional} min +Minimum size. Only observed with value @code{100pt}. Only observed +for part @code{width}. +@end defvr + +@defvr {Dependent} target +Required when @code{method} is @code{attach} or @code{same}, not +observed otherwise. This is the ID of an element to attach to. +Observed with the ID of @code{title}, @code{footnote}, @code{graph}, +and other elements. +@end defvr + +@defvr {Dependent} value +Required when @code{method} is @code{fixed}, not observed otherwise. +Observed values are @code{0%}, @code{0px}, @code{1px}, and @code{3px} +on parts @code{top} and @code{left}, and @code{100%} on part +@code{bottom}. +@end defvr + +@node SPV Detail coordinates Element +@subsection The @code{coordinates} Element + +Parent: @code{graph} @* +Contents: empty + +This element is always present and always empty, with no attributes +(except @code{id}). + +@node SPV Detail faceting Element +@subsection The @code{faceting} Element + +Parent: @code{graph} @* +Contents: @code{cross} @code{layer}@math{+} +