aboutsummaryrefslogtreecommitdiffstats
path: root/src/xml/mod.rs
diff options
context:
space:
mode:
authorLibravatar cel 🌸 <cel@bunny.garden>2025-04-03 03:09:35 +0100
committerLibravatar cel 🌸 <cel@bunny.garden>2025-04-03 03:09:35 +0100
commit9c561014f3c4278c0991290c898713f8e9c928e8 (patch)
tree92c60a88b34909387c854c483a3c3f4bc41c27b9 /src/xml/mod.rs
parent2b399fb59d17bc127fbcd1533a3c079bc86770e1 (diff)
downloadpeanuts-9c561014f3c4278c0991290c898713f8e9c928e8.tar.gz
peanuts-9c561014f3c4278c0991290c898713f8e9c928e8.tar.bz2
peanuts-9c561014f3c4278c0991290c898713f8e9c928e8.zip
feat: xml logging
Diffstat (limited to 'src/xml/mod.rs')
-rw-r--r--src/xml/mod.rs43
1 files changed, 25 insertions, 18 deletions
diff --git a/src/xml/mod.rs b/src/xml/mod.rs
index 3f7dc79..b0d9056 100644
--- a/src/xml/mod.rs
+++ b/src/xml/mod.rs
@@ -66,16 +66,16 @@ impl<'s> QName<'s> {
}
}
-impl<'s> ToString for QName<'s> {
- fn to_string(&self) -> String {
- match self {
- QName::PrefixedName(prefixed_name) => {
- format!("{}:{}", **prefixed_name.prefix, **prefixed_name.local_part)
- }
- QName::UnprefixedName(unprefixed_name) => unprefixed_name.to_string(),
- }
- }
-}
+// impl<'s> ToString for QName<'s> {
+// fn to_string(&self) -> String {
+// match self {
+// QName::PrefixedName(prefixed_name) => {
+// format!("{}:{}", **prefixed_name.prefix, **prefixed_name.local_part)
+// }
+// QName::UnprefixedName(unprefixed_name) => unprefixed_name.to_string(),
+// }
+// }
+// }
/// [8] PrefixedName ::= Prefix ':' LocalPart
#[derive(Clone, Debug, PartialEq, Eq)]
@@ -123,7 +123,12 @@ impl<'s> Deref for LocalPart<'s> {
// xml spec
/// [1] document ::= prolog element Misc*
-pub type Document<'s> = (Prolog<'s>, Element<'s>, Vec<Misc<'s>>);
+#[derive(Debug)]
+pub struct Document<'s> {
+ prolog: Prolog<'s>,
+ element: Element<'s>,
+ miscs: Vec<Misc<'s>>,
+}
/// [2] Char ::= #x9 | #xA | #xD | [#x20-#xD7FF] | [#xE000-#xFFFD] | [#x10000-#x10FFFF] /* any Unicode character, excluding the surrogate blocks, FFFE, and FFFF. */
#[repr(transparent)]
@@ -380,11 +385,12 @@ impl<'s> Deref for CData<'s> {
pub struct CDEnd;
/// [22] prolog ::= XMLDecl? Misc* (doctypedecl Misc*)?
-pub type Prolog<'s> = (
- Option<XMLDecl<'s>>,
- Vec<Misc<'s>>,
- Option<(DoctypeDecl<'s>, Vec<Misc<'s>>)>,
-);
+#[derive(Debug)]
+pub struct Prolog<'s> {
+ pub(crate) xml_decl: Option<XMLDecl<'s>>,
+ pub(crate) miscs: Vec<Misc<'s>>,
+ pub(crate) doctype_decl: Option<(DoctypeDecl<'s>, Vec<Misc<'s>>)>,
+}
/// [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>'
#[derive(Debug)]
@@ -456,7 +462,8 @@ pub enum IntSubsetDeclaration<'s> {
}
/// from [16] intSubset ::= (markupdecl | PEReference | S)*
/// [28b] intSubset ::= (markupdecl | DeclSep)*
-pub type IntSubset<'s> = Vec<IntSubsetDeclaration<'s>>;
+#[derive(Debug)]
+pub struct IntSubset<'s>(Vec<IntSubsetDeclaration<'s>>);
/// [29] markupdecl ::= elementdecl | AttlistDecl | EntityDecl | NotationDecl | PI | Comment
#[derive(Debug)]
@@ -481,7 +488,7 @@ pub enum ExtSubsetDeclaration<'s> {
DeclSep(DeclSep<'s>),
}
/// [31] extSubsetDecl ::= ( markupdecl | conditionalSect | DeclSep)*
-type ExtSubsetDecl<'s> = Vec<ExtSubsetDeclaration<'s>>;
+pub struct ExtSubsetDecl<'s>(Vec<ExtSubsetDeclaration<'s>>);
/// [32] SDDecl ::= S 'standalone' Eq (("'" ('yes' | 'no') "'") | ('"' ('yes' | 'no') '"'))
#[derive(Debug, Clone)]