diff options
Diffstat (limited to '')
-rw-r--r-- | src/reader.rs | 45 |
1 files changed, 39 insertions, 6 deletions
diff --git a/src/reader.rs b/src/reader.rs index 2785c88..b0d21db 100644 --- a/src/reader.rs +++ b/src/reader.rs @@ -1,6 +1,6 @@ use futures::Stream; use nom::Err; -use std::str; +use std::{collections::BTreeMap, str}; use tokio::io::AsyncBufReadExt; use crate::{ @@ -30,8 +30,8 @@ impl<R> Reader<R> where R: AsyncBufReadExt + Unpin, { - /// reads entire next prolog, element, or misc - pub async fn read<'s>(&'s mut self) -> Result<crate::xml::Element<'s>, Error> { + /// could resursively read and include namespace tree with values to be shadowed within new local context + async fn read_recursive(&mut self, namespaces: BTreeMap<Option<String>, String>) -> Result<Element, Error> { let element; let len; loop { @@ -45,15 +45,48 @@ where } Err(e) => match e { Err::Incomplete(_) => (), - e => return Err(Error::ParseError(input.to_owned())), + e => return Err::<E, Error>(Error::ParseError(input.to_owned())), }, } } - self.inner.consume(len); - // Ok(element) + let final; + match element { + crate::xml::Element::Empty(e) => { + let final = Element { + + } + }, + crate::xml::Element::NotEmpty(_, _, _) => todo!(), + } + + self.inner.consume(len); todo!() } + /// reads entire next prolog, element, or misc + // pub async fn read<E: From<Element>>(&mut self) -> Result<E, Error> { + // let element; + // let len; + // loop { + // let buf = self.inner.fill_buf().await?; + // let input = str::from_utf8(buf)?; + // match crate::xml::element(input) { + // Ok((rest, e)) => { + // element = e; + // len = buf.len() - rest.len(); + // break; + // } + // Err(e) => match e { + // Err::Incomplete(_) => (), + // e => return Err::<E, Error>(Error::ParseError(input.to_owned())), + // }, + // } + // } + // self.inner.consume(len); + + // // Ok(element) + // todo!() + // } // pub async fn read_start(&self) -> Result<impl From<Element>, Error> { // todo!() // } |