@@ -12,7 +12,7 @@ use std::path::Path;
1212use crate :: errors:: Result ;
1313use crate :: events:: Event ;
1414use crate :: name:: { LocalName , NamespaceResolver , QName , ResolveResult } ;
15- use crate :: reader:: { Reader , XmlSource } ;
15+ use crate :: reader:: { Reader , Span , XmlSource } ;
1616
1717/// A low level encoding-agnostic XML event reader that performs namespace resolution.
1818///
@@ -425,6 +425,10 @@ impl<R: BufRead> NsReader<R> {
425425 /// storage for events content. This function is supposed to be called after
426426 /// you already read a [`Start`] event.
427427 ///
428+ /// Returns a span that cover content between `>` of an opening tag and `<` of
429+ /// a closing tag or an empty slice, if [`expand_empty_elements`] is set and
430+ /// this method was called after reading expanded [`Start`] event.
431+ ///
428432 /// Manages nested cases where parent and child elements have the same name
429433 /// ("the same" means that their local names are the same and their prefixes
430434 /// resolves to the same namespace).
@@ -491,7 +495,7 @@ impl<R: BufRead> NsReader<R> {
491495 /// (ResolveResult::Bound(ns), Event::Start(start))
492496 /// );
493497 ///
494- /// //...then, we could skip all events to the corresponding end event.
498+ /// // ...then, we could skip all events to the corresponding end event.
495499 /// // This call will correctly handle nested <outer> elements.
496500 /// // Note, however, that this method does not handle namespaces.
497501 /// reader.read_to_end_into(end.name(), &mut buf).unwrap();
@@ -508,8 +512,9 @@ impl<R: BufRead> NsReader<R> {
508512 /// [`UnexpectedEof`]: crate::errors::Error::UnexpectedEof
509513 /// [`read_to_end()`]: Self::read_to_end
510514 /// [`BytesStart::to_end()`]: crate::events::BytesStart::to_end
515+ /// [`expand_empty_elements`]: Self::expand_empty_elements
511516 #[ inline]
512- pub fn read_to_end_into ( & mut self , end : QName , buf : & mut Vec < u8 > ) -> Result < ( ) > {
517+ pub fn read_to_end_into ( & mut self , end : QName , buf : & mut Vec < u8 > ) -> Result < Span > {
513518 // According to the https://www.w3.org/TR/xml11/#dt-etag, end name should
514519 // match literally the start name. See `Self::check_end_names` documentation
515520 self . reader . read_to_end_into ( end, buf)
@@ -657,6 +662,10 @@ impl<'i> NsReader<&'i [u8]> {
657662 /// Reads until end element is found. This function is supposed to be called
658663 /// after you already read a [`Start`] event.
659664 ///
665+ /// Returns a span that cover content between `>` of an opening tag and `<` of
666+ /// a closing tag or an empty slice, if [`expand_empty_elements`] is set and
667+ /// this method was called after reading expanded [`Start`] event.
668+ ///
660669 /// Manages nested cases where parent and child elements have the same name
661670 /// ("the same" means that their local names are the same and their prefixes
662671 /// resolves to the same namespace).
@@ -717,7 +726,7 @@ impl<'i> NsReader<&'i [u8]> {
717726 /// (ResolveResult::Bound(ns), Event::Start(start))
718727 /// );
719728 ///
720- /// //...then, we could skip all events to the corresponding end event.
729+ /// // ...then, we could skip all events to the corresponding end event.
721730 /// // This call will correctly handle nested <outer> elements.
722731 /// // Note, however, that this method does not handle namespaces.
723732 /// reader.read_to_end(end.name()).unwrap();
@@ -734,8 +743,9 @@ impl<'i> NsReader<&'i [u8]> {
734743 /// [`UnexpectedEof`]: crate::errors::Error::UnexpectedEof
735744 /// [`read_to_end()`]: Self::read_to_end
736745 /// [`BytesStart::to_end()`]: crate::events::BytesStart::to_end
746+ /// [`expand_empty_elements`]: Self::expand_empty_elements
737747 #[ inline]
738- pub fn read_to_end ( & mut self , end : QName ) -> Result < ( ) > {
748+ pub fn read_to_end ( & mut self , end : QName ) -> Result < Span > {
739749 // According to the https://www.w3.org/TR/xml11/#dt-etag, end name should
740750 // match literally the start name. See `Self::check_end_names` documentation
741751 self . reader . read_to_end ( end)
0 commit comments