-
Notifications
You must be signed in to change notification settings - Fork 16
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
preserve node prefix #28
base: master
Are you sure you want to change the base?
Conversation
@@ -379,7 +379,13 @@ fn convert_node(el: &Element, config: &Config, path: &String) -> Option<Value> { | |||
for child in el.children() { | |||
match convert_node(child, config, &path) { | |||
Some(val) => { | |||
let name = &child.name().to_string(); | |||
let name = if child.prefix().is_some() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This feels awkward. There is probably a more idiomatic way of achieving the same.
@@ -379,7 +379,13 @@ fn convert_node(el: &Element, config: &Config, path: &String) -> Option<Value> { | |||
for child in el.children() { | |||
match convert_node(child, config, &path) { | |||
Some(val) => { | |||
let name = &child.name().to_string(); | |||
let name = if child.prefix().is_some() { | |||
let formatted_name = format!("{}:{}", child.prefix().unwrap(), child.name().to_string()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
format!() macro is a slow way of string concatenation. Consider [].concat()
@brandonros , thank you for the PR. I'm not sure what to do with it. There was a talk of archiving this repo because it outlived its usefulness. If you think this repo is still relevant, I'm happy to work with you on the PR.
Thanks again for the effort and let us know what you think. |
addresses #27