Welcome to Dream.In.Code
Getting C# Help is Easy!

Join 136,075 C# Programmers for FREE! Get instant access to thousands of C# experts, tutorials, code snippets, and more! There are 1,592 people online right now. Registration is fast and FREE... Join Now!




read XML file using C#

 
Reply to this topicStart new topic

read XML file using C#

cool263
15 Apr, 2008 - 01:27 PM
Post #1

New D.I.C Head
*

Joined: 17 Jul, 2007
Posts: 19


My Contributions
I'm a newbie trying to learning C#. I have been tasked with needing to read an XML file using C# in ASP.NET 2.0, My XML file looks something like this:

CODE


<?xml version="1.0" encoding="utf-8"?>
<table1>
    <Detail_Collection>
        <Detail Subject="ADS : Alcohol and Drug Studies" Course="ADS 102" Title="Drug Use and Addiction" Credits="3.00" Description="An examination of commonly abused drugs with emphasis on the physical, psychological and behavioral consequences of these drugs.  Includes drug chemistry, physiological effects of drug use upon the body and specific treatment formats and techniques. [As Announced]" />
        <Detail Subject="ADS : Alcohol and Drug Studies" Course="ADS 150" Title="Basic Counseling and Addiction" Credits="3.00" Description="Introduction to the theory and practice of addictions counseling.  Students will examine various counseling theories and begin developing their own approach to addictions counseling.  Students will participate in guided practice to facilitate skill development. [As Announced]" />

    </Detail_Collection>
</table1>


I need to format each Subject, Course, Title, Credits, and Description. I'm not sure how to read/get each item, especially in this format. The XML file is created automatically on the server.

If someone could show me some code to get this going, I would be extremely greatful!

User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Read XML File Using C#
15 Apr, 2008 - 01:32 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8525
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
You're in luck, we happen to have a tutorial on working with XML files in the C# Tutorial section smile.gif
User is online!Profile CardPM
+Quote Post

cool263
RE: Read XML File Using C#
15 Apr, 2008 - 01:36 PM
Post #3

New D.I.C Head
*

Joined: 17 Jul, 2007
Posts: 19


My Contributions
Cool. My project is web based....will this tutorial still work?
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Read XML File Using C#
15 Apr, 2008 - 01:41 PM
Post #4

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8525
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
When working with C# (or any .Net language) the language and syntax is the same whether its web based or Windows based. Unlike previous Microsoft languages, ie; VBScript-ASP and Visual Basic 6, those were entirely different languages. With .Net, the C# you use for a Windows application is the same language you would use with ASP.NET for a web application smile.gif

I havent fully read that tutorial, there may be some minor modifications that need to be made, but you can work that out. The tutorial will at least give you the foundation for working with XML files smile.gif

This post has been edited by PsychoCoder: 15 Apr, 2008 - 01:42 PM
User is online!Profile CardPM
+Quote Post

cool263
RE: Read XML File Using C#
15 Apr, 2008 - 01:43 PM
Post #5

New D.I.C Head
*

Joined: 17 Jul, 2007
Posts: 19


My Contributions
Ok. Thanks!
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: Read XML File Using C#
15 Apr, 2008 - 01:47 PM
Post #6

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8525
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
No problem smile.gif
User is online!Profile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/1/08 07:21PM

Live C# Help!

C# Tutorials

Reference Sheets

C# Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month