diff options
Diffstat (limited to 'src/xml/mod.rs')
-rw-r--r-- | src/xml/mod.rs | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/xml/mod.rs b/src/xml/mod.rs index 221c334..9424d0b 100644 --- a/src/xml/mod.rs +++ b/src/xml/mod.rs @@ -47,6 +47,22 @@ pub enum QName<'s> { UnprefixedName(UnprefixedName<'s>), } +impl<'s> QName<'s> { + pub fn prefix(&self) -> Option<&'s str> { + match self { + QName::PrefixedName(prefixed_name) => return Some(**prefixed_name.prefix), + QName::UnprefixedName(_) => return None, + } + } + + pub fn local_part(&self) -> &str { + match self { + QName::PrefixedName(prefixed_name) => return **prefixed_name.local_part, + QName::UnprefixedName(unprefixed_name) => return ****unprefixed_name, + } + } +} + impl<'s> ToString for QName<'s> { fn to_string(&self) -> String { match self { @@ -473,7 +489,7 @@ pub struct ETag<'s> { #[derive(Debug, Clone)] pub enum ContentItem<'s> { - // CharData(&'s str), + CharData(CharData<'s>), Element(Element<'s>), Reference(Reference<'s>), CDSect(CDSect<'s>), |