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

[feature] update to 'minidom:0.13.0' #746

Closed
wants to merge 1 commit into from
Closed

Conversation

woshilapin
Copy link
Contributor

This PR depends on hove-io/minidom_ext#6.

I'm removing entirely the dependence on minidom_writer and uses the already available APIs from minidom in order to write XML files. A few modifications to the fixtures had to be done but their only formatting differences, not semantic.

I also removed quick_xml from Cargo.toml (see hove-io/minidom_ext#6 for the explanation).

@@ -120,6 +120,13 @@ fn only_alphanumeric(s: &str) -> String {
s.chars().filter(|c| c.is_alphanumeric()).collect()
}

fn write_file(filepath: &PathBuf, netex: Element) -> Result<()> {
let file = File::create(filepath)?;
let mut writer = minidom::quick_xml::Writer::new_with_indent(file, b'\t', 1);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also like to propose the following modification to avoid indented XML files in release mode.

Suggested change
let mut writer = minidom::quick_xml::Writer::new_with_indent(file, b'\t', 1);
#[cfg(debug_assertions)]
let mut writer = minidom::quick_xml::Writer::new_with_indent(file, b'\t', 1);
#[cfg(not(debug_assertions))]
let mut writer = minidom::quick_xml::Writer::new(file);

Comment on lines +74 to +75
[patch.crates-io]
minidom_ext = { git = "https://github.com/CanalTP/minidom_ext", branch = "minidom-0.13" }
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has to be removed before merging.

@woshilapin woshilapin marked this pull request as draft February 22, 2021 15:36
@woshilapin
Copy link
Contributor Author

minidom:0.13.0 doesn't support XML comments anymore (see this PR) and also got a lot more demanding about namespaces definitions. These constraints are not acceptable for our products, so we'll not be upgrading to minidom:0.13.0.

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

Successfully merging this pull request may close these issues.

1 participant