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

Help with deserializing/serializing #178

Closed
alakhpc opened this issue Jul 26, 2022 · 0 comments
Closed

Help with deserializing/serializing #178

alakhpc opened this issue Jul 26, 2022 · 0 comments

Comments

@alakhpc
Copy link

alakhpc commented Jul 26, 2022

Hi!, I have a xml file with a structure like this

<?xml version="1.0" encoding="utf-8"?>
<Preferences Prop1="value1" Prop2="value2" />

I'd like to change the value of "Prop2" to something else and then write to another file

How would I do this, I tried Deserializing like this

serde_xml_rs::from_str::<HashMap<String, String>>(&xml_string)?

that gives me the values but I can't serialize it again into the same format,
It comes out as

<Prop1>
value1
</Prop1>
<Prop2>
value2
</Prop2>

I dont want to make a struct since there are few hundred properties in the file and I only need to change 1 or 2

@alakhpc alakhpc closed this as completed Jun 25, 2023
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

1 participant