MCPcopy Create free account
hub / github.com/daisy/MathCAT / get_text_from_element

Function get_text_from_element

src/xpath_functions.rs:38–45  ·  view source on GitHub ↗

@returns {String} -- the text of the (leaf) element otherwise an empty string

(e: Element)

Source from the content-addressed store, hash-verified

36
37// @returns {String} -- the text of the (leaf) element otherwise an empty string
38fn get_text_from_element(e: Element) -> String {
39 if e.children().len() == 1 {
40 if let ChildOfElement::Text(t) = e.children()[0] {
41 return t.text().to_string();
42 }
43 }
44 return "".to_string();
45}
46
47#[allow(non_snake_case)]
48// Same as 'is_tag', but for ChildOfElement

Callers 4

get_text_from_COEFunction · 0.85
is_common_fractionMethod · 0.85
evaluateMethod · 0.85
edge_nodeMethod · 0.85

Calls 1

lenMethod · 0.80

Tested by

no test coverage detected