pub struct Namespace { /* private fields */ }Expand description
Namespace is a set of namespace prefixes and URIs, and mappings between them, that have been encountered or are defaults.
It also contains a stack of active mappings
More complex implementations will move to using BTree for the prefixes
Implementations§
Source§impl Namespace
impl Namespace
Sourcepub fn uses_xmlns(&self) -> bool
pub fn uses_xmlns(&self) -> bool
Returns true if the Namespace was constructed indicating it should provide the standard XMLNS
Sourcepub fn find_name(&mut self, name: &str) -> Option<NSNameId>
pub fn find_name(&mut self, name: &str) -> Option<NSNameId>
Find a name within the Namespace; return a None if not found, or Some(NSNameId) if it is. An empty name is an NSNameId::None
Sourcepub fn find_prefix(&mut self, prefix: &str) -> Option<NSPrefixId>
pub fn find_prefix(&mut self, prefix: &str) -> Option<NSPrefixId>
Find a prefix within the Namespace; return a None if not found, or Some(NSPrefixId) if it is. An empty name is an NSPrefixId::None
Sourcepub fn find_uri(&mut self, uri: &str) -> Option<NSUriId>
pub fn find_uri(&mut self, uri: &str) -> Option<NSUriId>
Find a URI within the Namespace; return a None if not found, or Some(NSUriId) if it is. An empty name is an NSUriId::None
Sourcepub fn prefix_str<'a>(&'a self, prefix: NSPrefixId, default: &'a str) -> &'a str
pub fn prefix_str<'a>(&'a self, prefix: NSPrefixId, default: &'a str) -> &'a str
Borrow the str of a NSPrefixId within the Namespace
Sourcepub fn add_mapping(&mut self, prefix: &str, uri: &str) -> NSMap
pub fn add_mapping(&mut self, prefix: &str, uri: &str) -> NSMap
Add a mapping from a prefix to a URI
Sourcepub fn add_mapping_by_id(
&mut self,
prefix_id: NSPrefixId,
uri_id: NSUriId,
) -> NSMap
pub fn add_mapping_by_id( &mut self, prefix_id: NSPrefixId, uri_id: NSUriId, ) -> NSMap
Add a mapping from a prefix to a URI