tafia / quick-xml

Rust high performance xml reader and writer
MIT License
1.13k stars 227 forks source link

modified Tag Attribute & Text #779

Closed danielitzahi closed 1 day ago

danielitzahi commented 3 days ago

hi how can i only update the "Reader" data (Tag Attribute & Text) do i need "Writer" for this ? example:

<this_tag k1="v1" k2="v2"><child>text</child></this_tag>

update k2 to "v6" child text to "foo" tzahi

Mingun commented 3 days ago

What you mean under "update"? Do you want to get event from Reader and change its content? You cannot change existing event, but you can create a new one. Then you can use that event as if it was read by Reader (its lifetime will be different although). You need Writer only if you want to write updated XML to somewhere.

danielitzahi commented 3 days ago

Yes update data inside tag So It is possible to load xml with Writer And update data by the event? Thanks for your fast response (: Tzahi

Mingun commented 3 days ago

The Readme actually gives you example of updating. In the example we read XML, get events and replace a start tag with name this_tag:

In the end we get updated document.