Hi All
I have a small program which uses XmlTextReader to
read through an XML file and get the appropriate
values from the file.
Following is my XML file.
<?xml version="1.0" encoding="UTF-8"?>
<customer>
<name>Nischal</name>
<address>
<currAddress>
<street></street>
<city></city>
<state></state>
</currAddress>
<prevAddress>
<street></street>
<city></city>
<state></state>
</prevAddress>
</address>
</customer>
I believe with XmlTextReader I cannot specify a
particular node name and get the Text of that node. I
am tryin to get the street of currAddress. In my code
I do this way
string strStreet="";
FileStream fs = new
FileStream(myXml.xml",FileMode.Open);
XmlTextReader myReader = new XmlTextReader(fs);
while(myReader.Read())
{
if(myReader.NodeType != XmlNodeType.EndElement)
{
switch(myReader.Name)
{
case "street":
strStreet = myReader.ReadString();
}
}
}
How can I specify that I need only the
currAddress/street
Any help greatly appreciated.
Thanks
Nischal
__________________________________________________
Do You Yahoo!?
Yahoo! - Official partner of 2002 FIFA World Cup
http://fifaworldcup.yahoo.com
You can read messages from the DOTNET archive, unsubscribe from DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.