From 9172e40679711ac2bf2f40d6eb47d150a8b46f14 Mon Sep 17 00:00:00 2001 From: Ben Pfaff Date: Fri, 17 Oct 2025 16:13:42 -0700 Subject: [PATCH] some tables parse --- rust/doc/src/spv/legacy-detail-xml.md | 2 +- rust/pspp/src/output/spv.rs | 1 + rust/pspp/src/output/spv/legacy.rs | 51 ++++++++++++++++++++++----- 3 files changed, 44 insertions(+), 10 deletions(-) diff --git a/rust/doc/src/spv/legacy-detail-xml.md b/rust/doc/src/spv/legacy-detail-xml.md index cdbcc4af1c..8d5edf3f87 100644 --- a/rust/doc/src/spv/legacy-detail-xml.md +++ b/rust/doc/src/spv/legacy-detail-xml.md @@ -69,7 +69,7 @@ simpleSort :method[sort_method]=(custom) => categoryOrder categoryOrder => TEXT -container :style=ref style => container_extension? location+ labelFrame* +container :style=ref style => container_extension? location* labelFrame* extension[container_extension] :combinedFootnotes=(true) => EMPTY diff --git a/rust/pspp/src/output/spv.rs b/rust/pspp/src/output/spv.rs index 292d91926e..a20ca1eabc 100644 --- a/rust/pspp/src/output/spv.rs +++ b/rust/pspp/src/output/spv.rs @@ -428,6 +428,7 @@ impl Table { Ok(result) => result, Err(error) => panic!("{error:?}"), }; + dbg!(_visualization); Ok(PivotTable::new([]).into_item()) } } diff --git a/rust/pspp/src/output/spv/legacy.rs b/rust/pspp/src/output/spv/legacy.rs index 7763db5cbd..f6fab20c67 100644 --- a/rust/pspp/src/output/spv/legacy.rs +++ b/rust/pspp/src/output/spv/legacy.rs @@ -56,8 +56,8 @@ pub struct Visualization { extension: Option, user_source: UserSource, - /*#[serde(rename = "$value")] - variables: Vec,*/ + #[serde(rename = "$value")] + variables: Vec, categorical_domain: Option, graph: Graph, #[serde(default, rename = "labelFrame")] @@ -114,6 +114,8 @@ struct DerivedVariable { /// An expression that defines the variable's value. #[serde(rename = "@value")] value: String, + #[serde(default, rename = "extension")] + extensions: Vec, format: Option, string_format: Option, #[serde(default, rename = "valueMapEntry")] @@ -130,6 +132,9 @@ struct VariableExtension { #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] struct UserSource { + #[serde(rename = "@id")] + id: String, + #[serde(rename = "@missing")] missing: Option, } @@ -254,6 +259,7 @@ struct Format { try_strings_as_numbers: Option, #[serde(rename = "@negativesOutside")] negatives_outside: Option, + #[serde(default)] relabel: Vec, #[serde(default, rename = "affix")] affixes: Vec, @@ -475,6 +481,9 @@ struct ValueMapEntry { #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] struct Style { + #[serde(rename = "@id")] + id: Option, + /// The text color or, in some cases, background color. #[serde(rename = "@color")] color: Option, @@ -679,6 +688,9 @@ enum Method { #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] struct Faceting { + #[serde(rename = "@id")] + id: Option, + #[serde(default)] layers1: Vec, cross: Cross, @@ -699,10 +711,14 @@ enum CrossChild { /// No dimensions along this axis. Unity, /// Dimensions along this axis. - Nest, /*( - /// From innermost to outermost. - Vec, - )*/ + Nest(Nest), +} + +#[derive(Deserialize, Debug)] +#[serde(rename_all = "camelCase")] +struct Nest { + #[serde(rename = "variableReference")] + variable_references: Vec, } #[derive(Deserialize, Debug)] @@ -726,12 +742,10 @@ struct Layer { struct FacetLayout { table_layout: TableLayout, #[serde(default)] + #[serde(rename = "setCellProperties")] scp1: Vec, #[serde(rename = "facetLevel")] facet_levels: Vec, - #[serde(default)] - #[serde(rename = "setCellProperties")] - scp2: Vec, } #[derive(Deserialize, Debug)] @@ -747,6 +761,9 @@ struct TableLayout { #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] struct SetCellProperties { + #[serde(rename = "@id")] + id: Option, + #[serde(rename = "@applyToConverse")] apply_to_converse: Option, @@ -867,6 +884,9 @@ struct SetFrameStyle { #[derive(Deserialize, Debug)] #[serde(rename_all = "camelCase")] struct Interval { + #[serde(rename = "@id")] + id: Option, + #[serde(rename = "@style")] style: Ref