filecount 0.1.0

A modern high-performance open source file analysis library for automating localization tasks.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub fn extract_text_from_node(node: roxmltree::Node) -> Vec<String> {
    let mut vec = Vec::new();                
    for node in node.descendants().filter(|n| n.is_text()) {
        match node.text() {
            Some(t) => vec.push(String::from(t)),
            None => (),
        }
    }
    vec
}

pub fn extract_text_from_nodes(nodes: Vec<roxmltree::Node>) -> Vec<String> {
    nodes.iter().flat_map(|n| extract_text_from_node(*n)).collect()
}