Click here to Skip to main content
15,886,873 members
Home / Discussions / C#
   

C#

 
QuestionTypecode of an Array? Pin
TyronX1-Jan-05 10:30
TyronX1-Jan-05 10:30 
AnswerRe: Typecode of an Array? Pin
TyronX1-Jan-05 10:37
TyronX1-Jan-05 10:37 
AnswerRe: Typecode of an Array? Pin
Adam Goossens1-Jan-05 15:07
Adam Goossens1-Jan-05 15:07 
AnswerRe: Typecode of an Array? Pin
leppie1-Jan-05 17:56
leppie1-Jan-05 17:56 
Questionusing windows media format & encoder API? Pin
Member 16179991-Jan-05 9:14
Member 16179991-Jan-05 9:14 
GeneralJoystick control again Pin
TyronX1-Jan-05 4:22
TyronX1-Jan-05 4:22 
GeneralRe: Joystick control again Pin
TyronX1-Jan-05 10:05
TyronX1-Jan-05 10:05 
GeneralXml Reading in .NET 2 Pin
thepersonof1-Jan-05 4:09
thepersonof1-Jan-05 4:09 
Hi I have some xml:
<code>
<build>
<usings>
<item>System.Threading</item>
<item>System.Drawing</item>
<item>System.Windows.Forms</item>
<item>System.Diagnostics</item>
<item>System.Microsoft.DirectX</item>
<item>D3D = Microsoft.DirectX.Direct3D</item>
</usings>
<references>
<item>System.dll</item>
<item>microsoft.directx.dll</item>
<item>microsoft.directx.direct3dx.dll</item>
<item>microsoft.directx.direct3dx.dll</item>
<item>system.data.dll</item>
<item>system.drawing.dll</item>
<item>system.windows.forms.dll</item>
<item>system.xml.dll</item>
</references>
</build>
</code>

How can I read that data from each of the items in the references?

This is some code I have at the moment:
<code>
XmlTextReader reader = null;

try
{
//Load the reader with the XML file.
reader = new XmlTextReader("test.xml");

//Parse the XML and display the text content of each of the elements.
while (reader.Read())
{
if (reader.IsStartElement())
{
if (reader.IsEmptyElement)
Console.WriteLine("<{0}/>", reader.Name);
else
{
Console.Write("<{0}> ", reader.Name);
reader.Read(); //Read the start tag.
if (reader.IsStartElement()) //Handle nested elements.
Console.Write("\r\n<{0}>", reader.Name);
Console.WriteLine(reader.ReadString()); //Read the text content of the element.
}
}
}
Console.ReadLine();
reader.ReadToDescendant("usings");
reader.
Console.WriteLine(reader.Name);
Console.ReadLine();
}



finally
{
if (reader != null)
reader.Close();
}
</code>

Thanks
GeneralVisual Studio 2005 beta - an easy question Pin
McSam1-Jan-05 2:58
McSam1-Jan-05 2:58 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
Robert Rohde1-Jan-05 3:23
Robert Rohde1-Jan-05 3:23 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
McSam1-Jan-05 5:46
McSam1-Jan-05 5:46 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
Robert Rohde1-Jan-05 6:37
Robert Rohde1-Jan-05 6:37 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
Dennis C. Dietrich1-Jan-05 6:46
Dennis C. Dietrich1-Jan-05 6:46 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
McSam2-Jan-05 1:13
McSam2-Jan-05 1:13 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
Dennis C. Dietrich2-Jan-05 13:40
Dennis C. Dietrich2-Jan-05 13:40 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
McSam3-Jan-05 4:49
McSam3-Jan-05 4:49 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
Dennis C. Dietrich3-Jan-05 7:58
Dennis C. Dietrich3-Jan-05 7:58 
GeneralRe: Visual Studio 2005 beta - an easy question Pin
Dennis C. Dietrich1-Jan-05 5:43
Dennis C. Dietrich1-Jan-05 5:43 
Generalpopulate a dataset from the xml Pin
dhol31-Dec-04 23:48
dhol31-Dec-04 23:48 
GeneralPixel colors found using GDI+ are different!!!!! Pin
abcxyz8231-Dec-04 22:50
abcxyz8231-Dec-04 22:50 
GeneralRe: Pixel colors found using GDI+ are different!!!!! Pin
Heath Stewart31-Dec-04 23:02
protectorHeath Stewart31-Dec-04 23:02 
GeneralUsing &quot;using&quot; Pin
Identity Undisclosed31-Dec-04 20:50
Identity Undisclosed31-Dec-04 20:50 
GeneralRe: Using "using" Pin
Adam Goossens31-Dec-04 22:11
Adam Goossens31-Dec-04 22:11 
GeneralRe: Using "using" Pin
Heath Stewart31-Dec-04 22:56
protectorHeath Stewart31-Dec-04 22:56 
GeneralRe: Using "using" Pin
Adam Goossens31-Dec-04 23:21
Adam Goossens31-Dec-04 23:21 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.