Skip to content

Commit a7cb878

Browse files
authored
Merge pull request #857 from mematthias/master
Make BytesCData decode method public
2 parents a81bac7 + 4acc194 commit a7cb878

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

Changelog.md

+4
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515

1616
### New Features
1717

18+
- [#857]: Add `BytesCData::decode()`.
19+
1820
### Bug Fixes
1921

2022
### Misc Changes
2123

24+
[#857]: https://github.com/tafia/quick-xml/pull/857
25+
2226

2327
## 0.37.4 -- 2025-04-01
2428

src/events/mod.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -843,8 +843,13 @@ impl<'a> BytesCData<'a> {
843843
))
844844
}
845845

846-
/// Gets content of this text buffer in the specified encoding
847-
pub(crate) fn decode(&self) -> Result<Cow<'a, str>, EncodingError> {
846+
/// Decodes the raw input byte content of the CDATA section into a string,
847+
/// without performing XML entity escaping.
848+
///
849+
/// When this event produced by the XML reader, it uses the encoding information
850+
/// associated with that reader to interpret the raw bytes contained within this
851+
/// CDATA event.
852+
pub fn decode(&self) -> Result<Cow<'a, str>, EncodingError> {
848853
Ok(self.decoder.decode_cow(&self.content)?)
849854
}
850855
}

0 commit comments

Comments
 (0)