1

私はXMLファイルを持っています:

<shape type="obj">
    <string name="filename" value="meshes/cbox_luminaire.obj"/>
    <transform name="toWorld">
        <translate x="0" y="-0.5" z="0"/>
    </transform>

    <ref id="light"/>

    <emitter type="area">
        <spectrum name="radiance" value="400:0, 500:8, 600:15.6, 700:18.4"/>
    </emitter>
</shape>
<shape type="obj">
    <string name="filename" value="meshes/cbox_back.obj"/>

    <ref id="white"/>
</shape>

図形のファイル パスを抽出する必要があります。

    XMLElement * a = doc.FirstChildElement( "scene" );//->FirstChildElement("shape");

    for(XMLElement* elem = a->FirstChildElement(); elem != NULL; elem = elem->NextSiblingElement())
    {
        std::string elemName = elem->Value();
        if(elemName=="shape")
            toto.push_back(elem);
    }

  for(unsigned int i =0;i<toto.size();i++)
  {
    const XMLAttribute* tmp = toto[i]->FirstAttribute ();
    std::cout<<tmp->Name()<<":"<<tmp->Value()<<"\n";

  }

私が取得できる唯一のデータは、最初の属性別名 type:obj です。ファイル名、存在する場合は変換データ、およびその他のデータを取得するにはどうすればよいですか?

4

1 に答える 1