How big is the document?
XmlReader is forward only. so you can't get to the kiosknavn element to find the correct one and then back up to the Kiosk element. So the best thing to do is to loop through till you find the kiosk element, extract the subtree then load the subtree into another XmlReader and check if its the correct one, if it is return it otherwise move on to the next one.
while(r.Read())
{
if( r.NodeType == XmlNodeType.Element && r.LocalName == "kiosk")
{
string s = r.GetOuterXml();
// etc.
}
}
Regards
RIchard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog http://www.dotnetconsult.co.uk
When I enter KIOSK001 in my textbox i want to search through the following
xml and look up <kiosknavn>:
<kiosk>
<kiosknavn>KIOSK001</kiosknavn>
<serienummer>099901500001</serienummer>
<kontaktperson>navn efternavn</kontaktperson>
<adresse>adresse</adresse>
<postnummer>postnummer</postnummer>
<by>by</by>
<kontakt_tlf>00000000</kontakt_tlf>
</kiosk>
<kiosk>
<kiosknavn>KIOSK002</kiosknavn>
<serienummer>099901200002</serienummer>
<kontaktperson>navn efternavn</kontaktperson>
....
</kiosk>
Then I want it to display the entire section between <kiosk>and </kiosk> in
my treeview. but only the section that has the correct <kiosknavn>
hope this makes sense... :)
//Jan
[color=blue]
> When you say you want a specific innerxml what exactly do you want to do
> with it?
>
> Do you want to return the xml fragment?
> Do you want to process this section internally?
> Do you want to return a value from this fragment?
>
> Regards
>
> Richard Blewett - DevelopMentor
>
http://www.dotnetconsult.co.uk/weblog
>
http://www.dotnetconsult.co.uk
>[/color]
[microsoft.public.dotnet.languages.csharp]