|
-
Sep 3rd, 2005, 05:22 PM
#1
Thread Starter
PowerPoster
xml help[RESOLVED]
been trying and going insane
I have written an xml doc like he following:
<Main>
<Something1>valueHere</Something1>
<Something2>valueHere</Something2>
</Main>
but how do I read the first element (Something1) and then the text inbetween? (valueHere)
this is what I have:
Code:
XmlTextReader tr = new XmlTextReader(path);
while(tr.Read())
{
if (tr.NodeType == XmlNodeType.Text)
{
tr.ReadString();
if (tr.Name.Equals("Something1"))
{
//value/name
}
..
..
}
}
but it only gets the Name (Somethingx) but not the inner value.
any ideas?
Last edited by Techno; Sep 4th, 2005 at 10:37 AM.
-
Sep 4th, 2005, 02:44 PM
#2
Re: xml help[RESOLVED]
post your solution if you don't mind, in case someone else is looking for the same thing
rate my posts if they help ya!
Extract thumbnail without reading the whole image file: (C# - VB)
Apply texture to bitmaps: (C# - VB)
Extended console library: (VB)
Save JPEG with a certain quality (image compression): (C# - VB )
VB.NET to C# conversion tips!!
-
Sep 4th, 2005, 03:27 PM
#3
Thread Starter
PowerPoster
Re: xml help[RESOLVED]
sure
Code:
XmlTextReader reader = new XmlTextReader(@pathToXmlFile);
while (reader.Read())
{
reader.MoveToContent();
if (reader.NodeType == XmlNodeType.Element)
{
if (reader.Name.Equals("TagNameToLookFor"))
{
reader.ReadStartElement(reader.LocalName);
string theValueOfThisTag = reader.Value;
}
//..
//..
}
}
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|