如何在vb.net中访问xml文件的属性

时间:2011-11-14 09:10:20

标签: xml vb.net

<xml xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"           
xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:rs="urn:schemas-microsoft- 
com:rowset" xmlns:z="#RowsetSchema">
- <s:Schema id="RowsetSchema">
- <s:ElementType name="row" content="eltOnly">
- <s:AttributeType name="EffectId" rs:number="1" rs:nullable="true" rs:maydefer="true" 
rs:writeunknown="true">
<s:datatype dt:type="int" dt:maxLength="4" rs:precision="10" rs:fixedlength="true" /> 
</s:AttributeType>
- <s:AttributeType name="EffectName" rs:number="2" rs:nullable="true"   
rs:maydefer="true" rs:writeunknown="true">
<s:datatype dt:type="string" dt:maxLength="255" /> 
</s:AttributeType>
<s:extends type="rs:rowbase" /> 
</s:ElementType>
</s:Schema>
- <rs:data>
<z:row EffectId="0" EffectName="No Effect or Stop" /> 
<z:row EffectId="1" EffectName="Flash" /> 
<z:row EffectId="2" EffectName="Reversal AND Flash" /> 
<z:row EffectId="3" EffectName="Laser" /> 
<z:row EffectId="4" EffectName="scroling" /> 
<z:row EffectId="23" EffectName="LONG_SENTENCE_scroling" /> 
<z:row EffectId="5" EffectName="To the left" /> 
<z:row EffectId="6" EffectName="To the Right" /> 
<z:row EffectId="7" EffectName="To the Up Side" /> 
<z:row EffectId="8" EffectName="To the Down Side" /> 
<z:row EffectId="9" EffectName="Scale Up" /> 
<z:row EffectId="10" EffectName="Up -- Middle - Down" /> 
<z:row EffectId="11" EffectName="Twist Left and Right" /> 
<z:row EffectId="12" EffectName="Module horizontal Blind" /> 
<z:row EffectId="13" EffectName="Move to Center" /> 
<z:row EffectId="14" EffectName="Left - Middle -- Right" /> 
<z:row EffectId="15" EffectName="Up - Middle -- Down" /> 
<z:row EffectId="16" EffectName="Expand to Left and Right" /> 
<z:row EffectId="17" EffectName="Expand to Up and Down" /> 
<z:row EffectId="18" EffectName="Laser Down" /> 
<z:row EffectId="19" EffectName="Blind" /> 
<z:row EffectId="20" EffectName="Left - Middle -- Right" /> 
<z:row EffectId="21" EffectName="Twist Up and Down" /> 
<z:row EffectId="22" EffectName="Module Vertical Blind" /> 
</rs:data>
</xml>

这是我的Effect.xml文件。我正在使用vb.net访问此xml文件。 实际上我想在输入特效id时访问效果名称。所以当我将效果id作为输入值时,我将获得效果名称的属性值 我怎么能用vb.net

1 个答案:

答案 0 :(得分:1)

System.xml命名空间提供了许多功能。我更喜欢XQuery作为您需求的第一选择。请参阅:http://msdn.microsoft.com/en-us/library/system.xml.aspx