MoveToAttribute() public method

See XmlReader.MoveToAttribute(string)
public MoveToAttribute ( string name ) : bool
name string
return bool
コード例 #1
0
 public void GetAttributeTest4()
 {
     XIncludingReader xir = new XIncludingReader("../../XInclude/tests/document2.xml");
     xir.MakeRelativeBaseUri = false;
     while (xir.Read())
     {
         if (xir.NodeType == XmlNodeType.Element && xir.Name == "disclaimer")
         {
             Assert.IsTrue(xir.AttributeCount == 1);
             xir.MoveToAttribute(0);
             Console.WriteLine(xir.Value);
             Assert.IsTrue(xir.Name == "xml:base");
             Assert.IsTrue(xir.Value.EndsWith("tests/disclaimerWithXmlBase.xml"));                                        
         }
     }
 }
コード例 #2
0
 public void GetAttributeTest3()
 {
     XIncludingReader xir = new XIncludingReader("../../XInclude/tests/document.xml");
     while (xir.Read())
     {
         if (xir.NodeType == XmlNodeType.Element && xir.Name == "disclaimer")
         {
             Assert.IsTrue(xir.AttributeCount == 1);
             xir.MoveToAttribute(0);
             Assert.IsTrue(xir.Name == "xml:base");
             Assert.IsTrue(xir.Value.EndsWith("disclaimer.xml"));
         }
     }
 }