pub struct Entities<'a> { /* private fields */ }Expand description
A set of entities that should be unmapped and how they should be unmapped
Implementations§
Source§impl<'a> Entities<'a>
impl<'a> Entities<'a>
Sourcepub fn replace_entities(&self, inc_map: bool, s: &str) -> Option<String>
pub fn replace_entities(&self, inc_map: bool, s: &str) -> Option<String>
Replace general entity references and &#..; characters, using the map.
Return None if the string has no replacements required; else Some(new string).
The replacements that are used should also be replaced if this is expanding a general entity use.
We don’t handle parameter entities here yet (‘%thing;’)
However, the map should not be used for entity declaration contents in XML hence inc_map is provided. However, character entities &#..; are expanded in entity declarations.
Character entities are ALSO expanded when entities are used.
Another option would be to use two different Entities to handle the two different cases.
An ampersand (&) may be escapednumerically (&#38;) or with a general entity (&).
“ >makes ‘example’ be
An ampersand (&) may be escaped numerically (&) or with a general entity (&).
and a reference in a doc to &example; is then replaced with a ‘p’ element with content
An ampersand (&) may be escaped numerically (&) or with a general entity (&).