TinyXPath没有根据给定的属性查询过滤所需的dom元素?

时间:2011-07-21 06:45:18

标签: c++ xml xpath tinyxpath

示例XML是:

  <dgn>
      <sg>
        <nodes>
          <node name="Sphere 1" clsid="{CF21F965-203A-456A-83FE-A5F62D6D8E50}" type="MESH" id="{418ACDD5-65D2-410F-B43B-0B48E4010B75}" subtype="" version="2.0" cloneparentkey="" nextcloneparentkey="">
            <object id="{AC685AD2-3411-43B0-A29B-3B22086BAEF6}">Sphere 1</object>
            <material id="{D2029F35-4A85-4669-BBF3-E754568ED88C}">Standard 1</material>
            <controllers>
              <controller id="{989803FD-B575-45E4-B8A0-B5E69008145B}" weight="100" name="DEFAULT" inherit="-1">
                <tracks>
                  <track name="radius" type="PARAMETRIC" numkey="0" pathfollow="0">
                    <interpolator clsid="{ECC9C2C7-5175-4784-9108-1FA4C25D3383}" type="FLOAT">
                      <key frame="-1">75.000000,0.000000,0.000000,0.000000</key>
                    </interpolator>
                  </track>
                  </track>
                  <track name="scale" type="SRTV" numkey="101" pathfollow="0">
                    <interpolator clsid="{ECC9C2C7-5175-4784-9108-1FA4C25D3383}" type="FLOAT3">
                      <key frame="-1">1.000000,1.000000,1.000000,1.000000</key>
                    </interpolator>
                  </track>
                  <track name="rotation" type="SRTV" numkey="102" pathfollow="0">
                    <interpolator clsid="{ECC9C2C7-5175-4784-9108-1FA4C25D3383}" type="FLOAT3">
                      <key frame="-1">0.000000,0.000000,0.000000,0.000000</key>
                    </interpolator>
                  </track>
                 </tracks>
              </controller>
            </controllers>
            <customdata>
              <offsetmatrix>1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1</offsetmatrix>
              <poslinkvector>0.000000,0.000000,0.000000,0.000000</poslinkvector>
            </customdata>
          </node>
          <node name="Circle 1" clsid="{CF21F965-203A-456A-83FE-A5F62D6D8E50}" type="SHAPE" id="{418ACDD5-65D2-410F-B43B-0B48E4010B75}" subtype="" version="2.0" cloneparentkey="" nextcloneparentkey="">
            <object id="{AC685AD2-3411-43B0-A29B-3B22086BAEF6}">Sphere 1</object>
            <material id="{D2029F35-4A85-4669-BBF3-E754568ED88C}">Standard 1</material>
            <controllers>
              <controller id="{989803FD-B575-45E4-B8A0-B5E69008145B}" weight="100" name="DEFAULT" inherit="-1">
                <tracks>
                  <track name="radius" type="PARAMETRIC" numkey="0" pathfollow="0">
                    <interpolator clsid="{ECC9C2C7-5175-4784-9108-1FA4C25D3383}" type="FLOAT">
                      <key frame="-1">75.000000,0.000000,0.000000,0.000000</key>
                    </interpolator>
                  </track>
                  </track>
                  <track name="scale" type="SRTV" numkey="101" pathfollow="0">
                    <interpolator clsid="{ECC9C2C7-5175-4784-9108-1FA4C25D3383}" type="FLOAT3">
                      <key frame="-1">1.000000,1.000000,1.000000,1.000000</key>
                    </interpolator>
                  </track>
                  <track name="rotation" type="SRTV" numkey="102" pathfollow="0">
                    <interpolator clsid="{ECC9C2C7-5175-4784-9108-1FA4C25D3383}" type="FLOAT3">
                      <key frame="-1">0.000000,0.000000,0.000000,0.000000</key>
                    </interpolator>
                  </track>
                 </tracks>
              </controller>
            </controllers>
            <customdata>
              <offsetmatrix>1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1</offsetmatrix>
              <poslinkvector>0.000000,0.000000,0.000000,0.000000</poslinkvector>
            </customdata>
          </node>
        </nodes>
      </sg>
    </dgn>

当我的查询包含XPath“dgn / sg / nodes / node [@ type ='MESH']”时,它应该给我一个节点,但它选择两个节点(Sphere 1和Circle 1)。如果我将dom元素名称从“节点”更改为xml中的其他内容,即如果我将“节点”重命名为“abc”,然后查询此类XPath“dgn / sg / nodes / abc [@type],则不会发生这种情况='MESH']“它过滤所需的dom元素,即它只给出Sphere 1。     任何名称不是“node”的dom元素都不会发生这种情况。     节点是TinyXpath中的关键字还是别的???

为什么Dom Element命名为“node”????

0 个答案:

没有答案