netvl / xml-rs

An XML library in Rust
MIT License
459 stars 110 forks source link

Simple way to remove whitespaces #230

Closed igiona closed 12 months ago

igiona commented 1 year ago

I'm looking for a simple way to remove all the unnecessary whitespaces from a "human readable" XML string, to reduce the XML-size for machine-to-machine communication.

<my>
   <beautiful>XML</beautiful>
</my>

should result in:

<my><beautiful>XML</beautiful></my>

In there already something available in this library?

kornelski commented 12 months ago

There's a trim_whitespace() config option. See also document rewriting example https://github.com/netvl/xml-rs/blob/master/examples/rewrite.rs