1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
//! Namespace handling for HTML documents.
//!
//! This module provides tools for processing namespace declarations in HTML documents,
//! particularly useful when working with prefixed elements (like `svg:rect`, `c:widget`)
//! that use namespace prefixes.
//!
//! # Overview
//!
//! Since HTML5 parsers don't process namespace prefixes, elements like `<svg:rect>` are
//! parsed as literal tag names. This module provides post-processing functions to split
//! prefixed names and apply namespace URIs based on `xmlns:*` declarations.
//!
//! # Example
//!
//! ```
//! #[cfg(feature = "namespaces")]
//! {
//! use brik::ns::{NsOptions, NsError};
//! use brik::parse_html;
//! use brik::traits::*;
//! use html5ever::ns;
//! use std::collections::HashMap;
//!
//! let html = r#"<html xmlns:c="https://example.com/custom">
//! <body><svg:rect /><c:widget>Content</c:widget></body>
//! </html>"#;
//!
//! let doc = parse_html().one(html);
//!
//! // Provide additional namespaces via options
//! let mut namespaces = HashMap::new();
//! namespaces.insert("svg".to_string(), ns!(svg));
//!
//! let options = NsOptions {
//! namespaces,
//! strict: false,
//! };
//!
//! // Apply namespace processing
//! let corrected = doc.apply_xmlns_opts(&options).unwrap();
//!
//! // Now prefixes are properly split and namespaced
//! let widget = corrected.select_first("widget").unwrap();
//! assert_eq!(widget.prefix().unwrap().as_ref(), "c");
//! assert_eq!(widget.namespace_uri().as_ref(), "https://example.com/custom");
//! }
//! ```
/// Apply xmlns declarations to document elements and attributes.
/// Default namespace configuration and injection.
///
/// **DEPRECATED**: This module is deprecated. Use [`apply_xmlns_opts`] with [`NsOptions`] instead.
/// Error types for namespace operations.
pub use ;
pub use ;
pub use ;