如何在android中解析这个xml文件?

时间:2014-03-12 06:12:31

标签: android xml xml-parsing android-xml

我只需要属性标签中的名称,位置,旋转,缩放,网格和材质标签中的texture1。

我尝试在此链接中使用解析器 http://androidexample.com/XML_Parsing_-_Android_Example/index.php?view=article_discription&aid=69&aaid=94

但它只检测到有一个字符串或vector3df,但我无法从标签内部获取数据。

<?xml version="1.0" encoding="UTF-8"?>
<irr_scene>
   <attributes>
      <int name="Id" value="1253903003" />
      <string name="Name" value="Scene" />
      <colorf name="AmbientLight" value="0.0, 0.0, 0.0, 0.0" />
      <color name="BackgroundColor" value="0" />
   </attributes>
   <node type="animatedMesh">
      <attributes>
         <string name="Name" value="AnimatedMesh1" />
         <bool name="Draggable" value="true" />
         <int name="Id" value="1139558345" />
         <vector3d name="Position" value="-20, 0, 0" />
         <vector3d name="Rotation" value="0.0, 0.0, 0.0" />
         <vector3d name="Scale" value="1, 1, 1" />
         <bool name="Visible" value="true" />
         <enum name="AutomaticCulling" value="false" />
         <int name="DebugDataVisible" value="0" />
         <bool name="IsDebugObject" value="false" />
         <string name="Mesh" value="sydney.md2" />
         <bool name="Looping" value="true" />
         <bool name="ReadOnlyMaterials" value="false" />
         <float name="FramesPerSecond" value="0.040000" />
         <string name="Animation-Name" value="stand" />
      </attributes>
      <materials>
         <attributes>
            <enum name="Type" value="solid" />
            <color name="Ambient" value="ffffffff" />
            <color name="Diffuse" value="ffffffff" />
            <color name="Emissive" value="00000000" />
            <color name="Specular" value="ffffffff" />
            <float name="Shininess" value="0.000000" />
            <float name="Param1" value="0.000000" />
            <float name="Param2" value="0.000000" />
            <texture name="Texture1" value="sydney.bmp" />
            <texture name="Texture2" value="" />
            <texture name="Texture3" value="" />
            <texture name="Texture4" value="" />
            <bool name="Wireframe" value="false" />
            <bool name="GouraudShading" value="true" />
            <bool name="Lighting" value="false" />
            <bool name="ZWriteEnable" value="true" />
            <int name="ZBuffer" value="1" />
            <bool name="BackfaceCulling" value="false" />
            <bool name="FrontfaceCulling" value="false" />
            <bool name="FogEnable" value="false" />
            <bool name="NormalizeNormals" value="false" />
            <bool name="BilinearFilter1" value="true" />
            <bool name="BilinearFilter2" value="true" />
            <bool name="BilinearFilter3" value="true" />
            <bool name="BilinearFilter4" value="true" />
            <bool name="TrilinearFilter1" value="false" />
            <bool name="TrilinearFilter2" value="false" />
            <bool name="TrilinearFilter3" value="false" />
            <bool name="TrilinearFilter4" value="false" />
            <bool name="AnisotropicFilter1" value="false" />
            <bool name="AnisotropicFilter2" value="false" />
            <bool name="AnisotropicFilter3" value="false" />
            <bool name="AnisotropicFilter4" value="false" />
            <enum name="TextureWrap1" value="texture_clamp_repeat" />
            <enum name="TextureWrap2" value="texture_clamp_repeat" />
            <enum name="TextureWrap3" value="texture_clamp_repeat" />
            <enum name="TextureWrap4" value="texture_clamp_repeat" />
         </attributes>
      </materials>
   </node>
</irr_scene>

0 个答案:

没有答案