pub struct Document<'d> {
pub dom: XmlDoc,
pub path: String,
pub corpus: &'d Corpus,
pub dnm: Option<DNM>,
}
Expand description
One of our math documents, thread-friendly
Fields
dom: XmlDoc
The DOM of the document
path: String
The file path of the document
corpus: &'d Corpus
A reference to the corpus containing this document
dnm: Option<DNM>
If it exists, the DNM corresponding to this document
Implementations
sourceimpl<'d> Document<'d>
impl<'d> Document<'d>
sourcepub fn new(filepath: String, corpus: &'d Corpus) -> Result<Self, XmlParseError>
pub fn new(filepath: String, corpus: &'d Corpus) -> Result<Self, XmlParseError>
Load a new document
sourcepub fn get_heading_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn get_heading_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Obtain the problem-free logical headings of a libxml Document
sourcepub fn heading_iter(&self) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
pub fn heading_iter(&self) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
Get an iterator over the headings of the document
sourcepub fn get_paragraph_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn get_paragraph_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Obtain the problem-free logical paragraphs of a libxml Document
sourcepub fn paragraph_iter(&self) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
pub fn paragraph_iter(&self) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
Get an iterator over the paragraphs of the document
sourcepub fn extended_paragraph_iter(&self) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
pub fn extended_paragraph_iter(&self) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
Get an iterator over textual paragraphs of the document, in a loose sense, contents: abstract (first p), keywords, logical paragraphs, acknowledgement, table/figure captions
sourcepub fn get_math_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn get_math_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Obtain the MathML
sourcepub fn get_ref_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn get_ref_nodes(&self) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Obtain the <span[class=ltx_ref]> nodes of a libxml Document
sourcepub fn sentence_iter(&mut self) -> DNMRangeIterator<'_>ⓘNotable traits for DNMRangeIterator<'iter>impl<'iter> Iterator for DNMRangeIterator<'iter> type Item = ItemDNMRange<'iter>;
pub fn sentence_iter(&mut self) -> DNMRangeIterator<'_>ⓘNotable traits for DNMRangeIterator<'iter>impl<'iter> Iterator for DNMRangeIterator<'iter> type Item = ItemDNMRange<'iter>;
Get an iterator over the sentences of the document
sourcepub fn get_xpath_nodes(&self, xpath_str: &str) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
pub fn get_xpath_nodes(&self, xpath_str: &str) -> Vec<RoNode>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A>where
A: Allocator,
A: Allocator,
Obtain the nodes associated with the xpath evaluation over the underlying libxml Document
sourcepub fn get_xpath_node(&self, xpath_str: &str) -> Option<RoNode>
pub fn get_xpath_node(&self, xpath_str: &str) -> Option<RoNode>
Obtain the first node associated with the xpath evaluation over the underlying libxml
Document
sourcepub fn xpath_selector_iter(&self, xpath_str: &str) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
pub fn xpath_selector_iter(&self, xpath_str: &str) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
Get an iterator over a custom xpath selector over the document
sourcepub fn filter_iter(&self, filter: &dyn Fn(&RoNode) -> bool) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
pub fn filter_iter(&self, filter: &dyn Fn(&RoNode) -> bool) -> RoNodeIterator<'_>ⓘNotable traits for RoNodeIterator<'iter>impl<'iter> Iterator for RoNodeIterator<'iter> type Item = ItemDNM<'iter>;
Get an iterator using a custom closure predicate filter over the document (depth-first descent)