PugiXML 不遍历嵌套标签

PugiXML doesn't traverse nested tags

我在互联网上找到了 pugixml,它是一个非常好的库,尤其是它的格式(只是一个 header/source 组合,没有 dll 依赖项)。我的问题是,我为我的引擎制作了一个格式,但我无法获得所有 xml 节点,只有前三个节点,然后整个乐趣就停止了。我的 xml 看起来像这样

<Model>
    <Actor childcount="394" meshcount="0" name="sponza.obj">
        <Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
        <Actor childcount="0" meshcount="1" name="sponza_00">
            <Mesh name="sponza_00-0.mesh" />
            <Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
        </Actor>
        <Actor childcount="0" meshcount="1" name="sponza_01">
            <Mesh name="sponza_01-0.mesh" />
            <Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
        </Actor>
        <Actor childcount="0" meshcount="1" name="defaultobject">
            <Mesh name="defaultobject-0.mesh" />
            <Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
        </Actor>
        <Actor childcount="0" meshcount="1" name="sponza_03">
            <Mesh name="sponza_03-0.mesh" />
            <Transform 00="1" 01="0" 02="-0" 03="0" 10="0" 11="1" 12="-0" 13="0" 20="-0" 21="-0" 22="1" 23="-0" 30="0" 31="0" 32="-0" 33="1" />
        </Actor>
    </Actor>
</Model>

我正在使用示例树步行器

struct simple_walker : pugi::xml_tree_walker
{
    virtual bool for_each(pugi::xml_node& node)
    {

        for (int i = 0; i < depth(); ++i) std::cout << "  "; // indentation

        std::cout << "- name='" << node.name()  << "'\n";


        return true; // continue traversal
    }
};

但是应用程序只写了这个

- name='Model'
  - name='Actor'
    - name='Transform'

即使 xml 文档中的标签明显更多。

问题是 XML 格式不正确。 属性名称不能以数字开头,即 00="1" 无效 XML.