Expand description
XML canonicalization APIs.
The current implementation supports C14N 1.0/1.1 and can only use octet streams as document sources.
Support for Exclusive XML C14N, as well as support for XPath node set input, is planned for future expansion.
§Example
use anyxml::{
c14n::CanonicalizeHandler,
sax::{ParserOption, XMLReader},
uri::URIString,
};
const DOC: &str = r#"<?xml version="1.0"?>
<?xml-stylesheet href="doc.xsl"
type="text/xsl" ?>
<!DOCTYPE doc SYSTEM "doc.dtd">
<doc>Hello, world!<!-- Comment 1 --></doc>
<?pi-without-data ?>
<!-- Comment 2 -->
<!-- Comment 3 -->"#;
let mut reader = XMLReader::builder()
.set_handler(CanonicalizeHandler::default())
.build();
reader.parse_str(DOC, None).ok();
assert_eq!(reader.handler.buffer, r#"<?xml-stylesheet href="doc.xsl"
type="text/xsl" ?>
<doc>Hello, world!</doc>
<?pi-without-data?>"#);§Reference
Structs§
- Canonicalize
Handler - SAX handler to support streaming XML canonicalization.
Enums§
- Canonicalize
Method - Canonicalization method.