From fd825c3074f45c93219bd3fc15b72365b9f5832d Mon Sep 17 00:00:00 2001 From: Thomas Krause Date: Sat, 18 Apr 2026 15:45:12 +0200 Subject: [PATCH] Revert changes in GraphML import that caused annotation values with XML tags inside to fail --- CHANGELOG.md | 4 ++++ core/Cargo.toml | 2 +- core/src/errors.rs | 2 -- core/src/graph/serialization/graphml.rs | 8 ++++---- core/src/graph/serialization/graphml_example.graphml | 2 +- 5 files changed, 10 insertions(+), 8 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bc25c2511..739221875 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Fixed + +- Revert changes in GraphML import that caused annotation values with XML tags inside to fail. + ## [4.1.3] - 2026-04-17 ### Fixed diff --git a/core/Cargo.toml b/core/Cargo.toml index 5ca4cfcb3..c92af03b7 100644 --- a/core/Cargo.toml +++ b/core/Cargo.toml @@ -22,7 +22,7 @@ memmap2 = "0.9" normpath = "1.1.1" num-traits = "0.2" percent-encoding = "2.1" -quick-xml = "0.39" +quick-xml = "0.28" rand = "0.10" rayon = { version = "1.3", default-features = false } regex = "1" diff --git a/core/src/errors.rs b/core/src/errors.rs index e39b3c72e..faa2ea412 100644 --- a/core/src/errors.rs +++ b/core/src/errors.rs @@ -46,8 +46,6 @@ pub enum GraphAnnisCoreError { #[error(transparent)] Xml(#[from] quick_xml::Error), #[error(transparent)] - XmlEncoding(#[from] quick_xml::encoding::EncodingError), - #[error(transparent)] XmlAttr(#[from] quick_xml::events::attributes::AttrError), #[error("Cache error: {0}")] LfuCache(String), diff --git a/core/src/graph/serialization/graphml.rs b/core/src/graph/serialization/graphml.rs index f8bc1f3c8..d97a5ff8d 100644 --- a/core/src/graph/serialization/graphml.rs +++ b/core/src/graph/serialization/graphml.rs @@ -510,7 +510,7 @@ fn read_graphml( progress_callback: &F, ) -> Result> { let mut reader = Reader::from_reader(input); - reader.config_mut().expand_empty_elements = true; + reader.expand_empty_elements(true); let mut keys = BTreeMap::new(); @@ -584,7 +584,7 @@ fn read_graphml( } } Event::Text(t) if in_graph && level == 4 && current_data_key.is_some() => { - current_data_value = Some(t.decode()?.to_string()); + current_data_value = Some(t.unescape()?.to_string()); } Event::CData(t) => { @@ -745,7 +745,7 @@ value = "test""#; node_name: "first_node".to_string(), anno_ns: DEFAULT_NS.to_string(), anno_name: "an_annotation".to_string(), - anno_value: "something".to_string(), + anno_value: "something important".to_string(), }) .unwrap(); @@ -839,7 +839,7 @@ value = "test""#; .unwrap(); assert_eq!(3, first_node_annos.len()); assert_eq!( - Some(Cow::Borrowed("something")), + Some(Cow::Borrowed("something important")), g.get_node_annos() .get_value_for_item( &first_node_id, diff --git a/core/src/graph/serialization/graphml_example.graphml b/core/src/graph/serialization/graphml_example.graphml index 3339f1516..93c26ab08 100644 --- a/core/src/graph/serialization/graphml_example.graphml +++ b/core/src/graph/serialization/graphml_example.graphml @@ -10,7 +10,7 @@ key = "" [some.another] value = "test"]]> - something + something <strong>important</strong> node