Skip to content

Cannot find sub-children, but the document say it could! #46

@MatthD

Description

@MatthD

Hello

I have a simple XML loaded and parsed when I try to get an element via get_child it does not find it via get_child("infos") and return NONE, but the documentation say we can do it, or am I wrong ?

https://docs.rs/xmltree/latest/xmltree/struct.Element.html#method.get_child

My XML:

<!DOCTYPE article PUBLIC "my doctype of doom" "mydoctype.dtd">
<xpath>
    <to>
        <my>
            <infos attrib="example">trezaq</infos>
            <infosdust>23</infosdust>
        </my>
    </to>
</xpath>

Is there any way to not do something like this :

let infosdust = root_element.get_child("to").unwrap().get_child("my").unwrap().get_child("infos").unwrap().get_text().unwrap();
            assert_eq!(infosdust, "trezaq");

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions