Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization Error - Namespaces #99

Open
Devasta opened this issue Aug 13, 2024 · 1 comment
Open

Serialization Error - Namespaces #99

Devasta opened this issue Aug 13, 2024 · 1 comment

Comments

@Devasta
Copy link
Collaborator

Devasta commented Aug 13, 2024

use std::rc::Rc;

use xrust::item::Node;
use xrust::parser::xml;
use xrust::trees::smite::Node as SmiteNode;

fn main() {
    let doc_text = r#"<doc xmlns='ns1'><child xmlns='ns2'/></doc>"#;

    let doc = xml::parse(Rc::new(SmiteNode::new()), doc_text, None).unwrap();
    let xml_output = doc.to_xml();

    println!("{}", xml_output); 

}

The above is a minimal example, doing nothing except ingesting and re-exporting.

Sample document

<doc xmlns='ns1'><child xmlns='ns2'/></doc>

In the current main branch, we have the wrong namespace on the doc element

<doc xmlns='ns2'><child></child></doc>

On the dev branch both namespace declarations appear on the root node.

<doc xmlns='ns1' xmlns='ns2'><child></child></doc>

It also happens for namespaces that are aliased, for example the document

<a:doc xmlns:a='ns1'><a:child xmlns:a='ns2'/></a:doc>

Emits in main

<a:doc xmlns:a='ns2'><a:child></a:child></a:doc>

and dev

<a:doc xmlns:a='ns1' xmlns:a='ns2'><a:child></a:child></a:doc>

@ballsteve
Copy link
Owner

Please retest against release 1.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants