pub struct Documents { /* private fields */ }
Expand description
A collection of XML documents as can be used by XPath and XSLT.
This collection can be prepared before any XPath or XSLT processing begins.
Alternatively this collection can be added to incrementally during
processing using the fn:doc
function for instance. Once a document under
a URL is present, it cannot be changed anymore.
The fn:parse-xml
and fn:parse-xml-fragment
functions can be used to
create new documents from strings without URLs.
Implementations§
Source§impl Documents
impl Documents
Sourcepub fn add_string(
&mut self,
xot: &mut Xot,
uri: Option<&RiStr<IriSpec>>,
xml: &str,
) -> Result<DocumentHandle, DocumentsError>
pub fn add_string( &mut self, xot: &mut Xot, uri: Option<&RiStr<IriSpec>>, xml: &str, ) -> Result<DocumentHandle, DocumentsError>
Add a string as an XML document. It can be designated with a URI.
Sourcepub fn add_fragment_string(
&mut self,
xot: &mut Xot,
xml: &str,
) -> Result<DocumentHandle, DocumentsError>
pub fn add_fragment_string( &mut self, xot: &mut Xot, xml: &str, ) -> Result<DocumentHandle, DocumentsError>
Add a string as an XML fragment.
Sourcepub fn add_root(
&mut self,
uri: Option<&RiStr<IriSpec>>,
root: Node,
) -> Result<DocumentHandle, DocumentsError>
pub fn add_root( &mut self, uri: Option<&RiStr<IriSpec>>, root: Node, ) -> Result<DocumentHandle, DocumentsError>
Add a root node of an XML document. Designate it with a URI.
Sourcepub fn get_by_handle(&self, handle: DocumentHandle) -> Option<&Document>
pub fn get_by_handle(&self, handle: DocumentHandle) -> Option<&Document>
Obtain a document by handle
Sourcepub fn get_node_by_handle(&self, handle: DocumentHandle) -> Option<Node>
pub fn get_node_by_handle(&self, handle: DocumentHandle) -> Option<Node>
Obtain document node by handle
Sourcepub fn get_by_uri(&self, uri: &RiStr<IriSpec>) -> Option<&Document>
pub fn get_by_uri(&self, uri: &RiStr<IriSpec>) -> Option<&Document>
Obtain a document by URI
It’s only possible to obtain a document by URI if it was added with a URI.
Sourcepub fn get_node_by_uri(&self, uri: &RiStr<IriSpec>) -> Option<Node>
pub fn get_node_by_uri(&self, uri: &RiStr<IriSpec>) -> Option<Node>
Obtain document node by URI
Trait Implementations§
Source§impl From<Documents> for DocumentsRef
impl From<Documents> for DocumentsRef
Source§fn from(documents: Documents) -> DocumentsRef
fn from(documents: Documents) -> DocumentsRef
Auto Trait Implementations§
impl !Freeze for Documents
impl !RefUnwindSafe for Documents
impl Send for Documents
impl !Sync for Documents
impl Unpin for Documents
impl UnwindSafe for Documents
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more