5 Replies - 67534 Views - Last Post: 15 April 2008 - 02:47 PM Rate Topic: -----

#1 cool263  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-July 07

read XML file using C#

Post icon  Posted 15 April 2008 - 02:27 PM

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:


<?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!

Is This A Good Question/Topic? 0
  • +

Replies To: read XML file using C#

#2 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: read XML file using C#

Posted 15 April 2008 - 02:32 PM

You're in luck, we happen to have a tutorial on working with XML files in the C# Tutorial section :)
Was This Post Helpful? 1
  • +
  • -

#3 cool263  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-July 07

Re: read XML file using C#

Posted 15 April 2008 - 02:36 PM

Cool. My project is web based....will this tutorial still work?
Was This Post Helpful? 0
  • +
  • -

#4 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: read XML file using C#

Posted 15 April 2008 - 02:41 PM

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 :)

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 :)

This post has been edited by PsychoCoder: 15 April 2008 - 02:42 PM

Was This Post Helpful? 1

#5 cool263  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 19
  • Joined: 17-July 07

Re: read XML file using C#

Posted 15 April 2008 - 02:43 PM

Ok. Thanks!
Was This Post Helpful? 0
  • +
  • -

#6 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1641
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: read XML file using C#

Posted 15 April 2008 - 02:47 PM

No problem :)
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1