oxigraph/rio

Is trim_text necessary in rio_xml?

jamesaoverton opened this issue · 2 comments

Thank you for building this library!

When I use rio_xml to update an existing RDFXML file that has trailing whitespace in some literals, I'm getting whitespace changes that are unrelated to the change I'm trying to make. I believe the source is this line that tells quick_xml to trim_text:

https://github.com/oxigraph/rio/blob/master/xml/src/parser.rs#L65

When I commented out this line and tried read the same RDFXML I got this "Unexpected text event" error that I'm not sure how to manage:

https://github.com/oxigraph/rio/blob/master/xml/src/parser.rs#L661

Is trim_true essential to how rio_xml works? What changes would be required to stop trimming whitespace?

Thanks again!

Tpt commented

Hi! Yes, we enabled trim_text to simplify rio_xml code. It's definitely possible to stop trimming whitespaces. The RDF/XML syntax specifies places where whitespaces are allowed using the ws rule, the parser should probably just ignore ::Text events in these places or maybe just everywhere to simplify the code (I don't believe it will cause interoperability problems).

Tpt commented

Should be fixed by 0bc80d7