Using XML file as a Datasource

I cannot for the life of me find a good resource or starting point for using an XML file as a datasource.  Everything I have found in the last few days only give a a little bit of an answer, and so far I have been unsuccessful at piecing them all together into a solution.

The XML file I am using is intended to be a reference to query and assign page properties depending on a querystring result. As a new Dot Net developer, I have been trying to find a way to do this, but I may be holding myself back with my VBScript habits.
Can someone please point me the right direction to do this? Here is a sample of my code:

'create a new DataSet object
Dim dsMenu As New DataSet
Dim blnPageLoaded As Boolean = False
'use the path to the current virtual application
Dim strVirtualPath As String = "includes/base.xml"
'read the schema and data into the DataSet from an XML document on disk
'must use the Physical path to the file not the Virtual path
Dim drMenu As XmlReader
drMenu = drmenu.???
While drMenu.Read
If drMenu("id") = Request.QueryString("m") Then
lblHomeMessage.Text = drMenu("msg")
blnPageLoaded = True
End If
End While
Catch objError As Exception
Exit Sub ' and stop execution
End Try
'Assign page defaults
If lblHomeMessage.Text = "" Then lblHomeMessage.Text = "Welcome to ABCNet!" 'default message
lblHomeMessage.Visible = True 'make default message visible
If blnPageLoaded = False Then plcMainContent.Controls.Add(Page.LoadControl("home/default.ascx")) 'load the default page

3/5/2004 6:21:35 PM 7181 articles. 0 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 21

I thought for a moment I recognized some of that code...

If you are loading into a DataSet, and you know the value of the primary key of the row that you want, why not apply a filter to the table in the DataSet and then read the values from that row?

'get a reference to the "Books" DataTable object
Dim objTable As DataTable = objDataSet.Tables("table-name")
'create an array to hold the results then call the Select method
Dim objResults() As DataRow
objResults = objTable.Select("column-name = value, "")
3/5/2004 11:48:31 PM
I'm trying to convert Classic ASP pages using XML datastores into ASP.NET pages using the same datastores.

In Classic ASP I simply load the XML file into memory as a DOM and navigate through it, putting whatever data I need into Arrays for each node that I'm seeking. This works smoothly and fast in Classic ASP - and takes much less code than what I saw in the file (plus its component) which you quoted and which I examined on your excellent web site. I can then place the variables from the arrays wherever I want them on the page - giving me complete flexibility in layout.
Is there a similar way to do this in ASP.NET using XML files as datastores WITHOUT resorting to a component? I cannot afford Visual Studio.NET just yet so I'm using Web Matrix. I have to keep things simple and try to avoid using components at this stage of my learning curve.
I appreciate the power of .NET using XML, but I'm having a very frustrating time getting to grips with the complexity of it. No trouble with lots of other parts of ASP.NET, though. I cannot find a tutorial that shows me how to accomplish what I'm trying to do.
I posted an earlier request on this XML forum for guidance to a suitable tutorial, but have no response yet.
Contrary to many people, I find XML so easy in Classic ASP and so complex in .NET. I can do almost anything with it in Classic, but so far nothing in .NET - but I'm desperate to learn.
For the jobs I'm undertaking, I don't want to use datasets because I want to be able to access the data as individual variables in arrays.
I don't think I'm out of my depth - rather just trying to find my way through the ASP.NET XML jungle!
I would appreciate any directions anyone can point me in - rather than just back to Classic ASP.

3/6/2004 4:03:52 AM

Similar Artilces:

XML datasource from external website XML file
Hi all i need to extract some data into a page on my website, but the xml file is on different web server, not in our bunch, but out in the it possible to use this file as a datsource directly, or is there some security issue, and i have to grab it and use it locally...??? the file has been put somewhere it can be accessed with a web browseras this file changes on a daily basis, i would also like to automate the daily retrieval, i'm assuming this is something not too simple either. as you would need a service or something to fire up at a specific time each day?! any he...

How to get datasource name dynamically from .txt / .xml file using 2.0 with Mysql 5.0
I am using C#.Net 2.0 With MySql 5.0. I created a project and it works fine in my machine. But problem occurs when i try to run the project other than my machine. I wrote datasource=mysystem name in connection string. Is it possible to get datasource name dynamically from a text file (*.txt) or from .xml file for MySql.Regards,Tamizhselvi  Add an App.Config file to your project and you can drop a connection string in there like so:  <connectionStrings>    <add name="PICK A NAME" connectionString="YOUR CONNECTION STRING"/>...

using xml datasource with a dynamic xml output from a website
hi guys. need help regarding this problem. we're doing a project right now that gets the latest stocks info from a website. we're passing username, password, and a year into a querystring and the website will have an xml output. the problem is that the output looks something like this : i'm wondering how i could directly use this in the xmldatasource itself. any ideas?   Hi Use HttpWebRequest and HttpWebResponse class. You can get xml string as output then you can do whatever you want(deal with xmldatasour...

Creating a xml file with just field names and then binding the xml fields to a datasource???
I have an xml file I created called ReportFields.xml which looks like this: <?xml version="1.0" encoding="utf-8" ?> <ReportFields><AccountNumber></AccountNumber <FirstName></FirstName><LastName></LastName> </ReportFields> I then create a blank crystal report and go into the Database Expert and choose ADO.NET DataSets, I browse to the xml file I just created, in this case ReportFields and give it a Class Name of ReportFields.  Now under Database Fields, I have a ReportFields table with the following columns: ...

XML Transform to 1 XML file to another XML File
Hello All  I am a novice programmer. I want to transform 1 xml file to another xml file. I am looking for a example code where user will select source xml file and create another xml file in different file with different fields with some default validation of parsing date and default values.  Can anyone help me or let me know any available source code in C#/ASP.Net?  Ms Disha I am assuming you know xslt, if not, you would have to go look at that.  But if you do, then this document will help you out

XML File As DataSource
Can anybody tell me how to create a report using XML file as DataSource. Thanks. Mark As Answer if you found this post helpful...

How to write a xml file to another computer using path like this \\Server5\XML\XMLTest.xml?
Hi Guys,How can I write a xml file that read from a dataset to another computer in our network?something like this path "\\Server5\XML\XMLTest.xml"I am using below code to write xml file.----------------------------------------            // create a file name to write to.            string filename = "\\Server5\XML\XMLTest.xml";            // create the FileStream to write with.        &nb...

write xml file using xml control
Hi Guys, Environment: 2.0   I am trying to create a xml file using xml control at rumtime. I have a asp:xml control with DocumentSource property set to xml file myFile.xml. myFile.xml: <myRoot>          <EMPLOYEE>               <FNAME></FNAME>               <LNAME></LNAME>         &nbs...

reading data from xml service or xml datasource
Hi, I'm trying to figure out a way to import data (but not export to, I'm just trying to get their news section) from an external db (SqlServer 2000 or 2005) to a gridview and detailsview on my site (resides at a web host). I spoke to the organisation that owns the external db and they are willing to look into several solutions, whitout giving out their db password etc. Not suprisingly, I was reccomended using a web service. However, I believe I need to install stuff in order to enable one, and so, it won't be able for me (I guess), because of my web host's limitations. Instead, I am now t...

serialize a XML file to a VB.NET file (class) using xsd
Hello   I would like to serialize  a XML file to a VB.NET  file (class).   How can I use XSD.exe  to generate my xml file  C:\leye_g\Travaux\Fichiers de données\test.xml  to a VB.NET File ?   Best regardsf Hi XML Schema Definition Tool (Xsd.exe)  can generate runtime classes from  XSD files . XmlElementAttribute Is Missing for the Generated Class Members While Using Xsd.exe describes how to generate class from xml and reports a problem. And you could find more info here: Code Generation in the .NET Framework Using XML Sch...

Help needed on XML database . How to use insert , update etc operations on XML file used as database
Hi !!! I am using an xml file as my database . But I can't  do insert , update and delete ops !!! Some one please help me ...... Pleaseeee help !!!! Its urgent .....     Maybe you need XPath, take a look at:  Welcome to my SQL/ASPNET forum for Chinese

ReorderList and using a XML Datasource
Dear All I would like to use a XML structure as a Datasource for my specific ReorderList. The XML could be like: <Root> <Name="ABC" Id="1" /> <Name="EFG" Id="2" /> <Name="HIJ" Id="3" /> <Name="KLM" Id="4" /> </Root>   I would like to set the DataKey to "Id" of my ReorderList, how can I do it?   To load the xml structure I use the following code:   XmlDocument xmlDoc = new XmlDocument(); xmlDoc.LoadXml("<Root><Name="ABC" Id="1" /><Name="EFG" Id="2" /><Name="HIJ" Id="3" /><Name="KLM" Id="4" /></R...

GridView and XML file as datasource
Hello, I have a gridview  control with an XML datasource.  The xml file I made using - myDataTable.WriteXml("C:\myTable1.xml", XmlWriteMode.WriteSchema)   or myDataTable.WriteXml("C:\myTable1.xml", XmlWrite.IgnoreSchema) I used the XmlDataSource control to connected my gridview to my xml file.  I tryed doing several different things with no luck. I even typed in the column fields in my databound gridview with no luck.  I know my gridview columns at design time. THANK YOU! Steve  You could do it this waymyDataTable...

How do i use datasource to generate xml?
 hi, i doing a project which make use of google map, How do i make my datasource to generate xml file so that the google map can read my data? If you have your data in a DataSet, you could use it's WriteXML method. Website Design Darlington - - Experts, Information, Ideas & Knowledge - An online resource for professional ASP.NET developersPlease remember to click "Mark as Answer" on this post if it helped you...

Web resources about - Using XML file as a Datasource -

Datasource - Wikipedia, the free encyclopedia
A DataSource object has properties that can be modified when necessary. For example, if the data source is moved to a different server, the property ...

Inverness Graham Acquires DataSource
Inverness Graham , a lower middle market private equity firm headquartered in suburban Philadelphia, has acquired DataSource , a print supply ...

SmartGlance for iPad for iPad on the iTunes App Store
Read reviews, get customer ratings, see screenshots, and learn more about SmartGlance for iPad on the App Store. Download SmartGlance for iPad ...

Chaitanya Pandit (@chaitanyapandit) on Twitter
Sign in Sign up To bring you Twitter, we and our partners use cookies on our and other websites. Cookies help personalize Twitter content, tailor ...

Data source - Wikipedia, the free encyclopedia
... Data source A data source is any of the following types of sources for (mostly) digitized data: a database in the Java software platform, datasource ...

2ndQuadrant - PostgreSQL expertise from specialists with a source code level understanding of RDBMS ...
PostgreSQL expertise from specialists with a source code level understanding of RDBMS PostgreSQL Planets Gabriele’s PlanetPostgreSQL Gianni’s ...

Tagged entries for CLOUD COMPUTING
Alan Williamson's output as a Java Champion, Blog-City Architect, BlueDragon Creator, Author, Speaker and Internet Guru

Private equity deals
... of biometric identity management systems, applications and services. Inverness Graham Investment has acquired DataSource ...

C# C Sharp and Tutorials on C#
Learn the c# langauge to build web applications using our online tutorials with live demos. Participate in our forums and learn from others. ...

JavaScript UI Library, Ajax Components & HTML5 Framework - DHTMLX
DHTMLX offers a rich JavaScript library, UI components & HTML5 mobile framework. Build impressive web apps for both desktop and mobile devices. ...

Resources last updated: 1/16/2016 8:30:26 AM