Trying to read XML file into dataset

Hello.

Developing a web site in VS2005, SP1, VB, .NET 2.0, ASP.NET 2.0 on XP Pro,
SP2.

I eventually want to use a gridview table to view xml data, but right now i 
can't seem to get my xml data into a dataset so that i can use it.

I have an XML file and can open it in IE.  There is no XSD or XSL file to go 
with it.
I can't seem to get the XML data into a dataset.  I tried using the 
following code, but it just does nothing.  It doesn't give an error.  It 
just executes the code and does nothing.

            Dim dataSet As DataSet = New DataSet
            dataSet.ReadXml("c:\Trips.xml", XmlReadMode.Auto)

I tried the XmlReadMode.InferSchema, XmlReadMode.InferTypedSchema and 
XmlReadMode.ReadSchema options.

Any help would be gratefully appreciated.

Thanks,
Tony


0
Tony
3/28/2007 10:08:10 PM
dotnet.xml 7266 articles. 0 followers. Follow

7 Replies
605 Views

Similar Articles

[PageSpeed] 47

Your code should be
dataSet.ReadXml(@"c:\Trips.xml", XmlReadMode.Auto)
to account for the slash in the path.

Besides this, the same code works for me. I tested by printing
dataSet.GetXml()



0
3/29/2007 5:47:54 PM
Hello Latish.

My program will not compile with the "@" in there.  It says "Character is 
not valid".

If i put the "@" inside the quotes like "@C:\Trips.xml", when it runs, it 
gives a System.NotSupportedException {"The given path's format is not 
supported."}.

Thanks,
Tony

"Latish Sehgal" <latish.sehgal@gmail.com> wrote in message 
news:1175190474.117544.50560@n59g2000hsh.googlegroups.com...
> Your code should be
> dataSet.ReadXml(@"c:\Trips.xml", XmlReadMode.Auto)
> to account for the slash in the path.
>
> Besides this, the same code works for me. I tested by printing
> dataSet.GetXml()
>
>
> 


0
Tony
3/29/2007 7:02:23 PM
Sorry about that. Its a C# thing, i didn't realize it.

Have you tried copying the value of dataSet.GetXml()  to a string and
checking the value?

0
3/29/2007 7:33:26 PM
Well.  Sure enough.  The xml data is there.  Maybe i need to do something 
with the dataset after the ReadXml statement.

Maybe i'm misinterpreting the ReadXML function.  Is it supposed to create a 
table(s) in the dataset based on what it reads from the xml file?

Thanks,
Tony

"Latish Sehgal" <latish.sehgal@gmail.com> wrote in message 
news:1175196806.654090.134790@p15g2000hsd.googlegroups.com...
> Sorry about that. Its a C# thing, i didn't realize it.
>
> Have you tried copying the value of dataSet.GetXml()  to a string and
> checking the value?
> 


0
Tony
3/29/2007 7:51:14 PM
It should, but it probably depends on your xml.
Check out
http://samples.gotdotnet.com/quickstart/howto/doc/Xml/DataSetMapXMLData.aspx
for an example.

0
3/29/2007 8:55:41 PM
Hello Latish.

I tried that sample.  It doesn't give any errors, but it doesn't do 
anything.  It just executes the code.

Also, what is "Console.WriteLine" supposed to do?  Where does it write the 
output?

I looked in the Output, Immediate, Command and every other window.  I can't 
find the output.

Thanks,
Tony

"Latish Sehgal" <latish.sehgal@gmail.com> wrote in message 
news:1175201741.491524.311960@y66g2000hsf.googlegroups.com...
> It should, but it probably depends on your xml.
> Check out
> http://samples.gotdotnet.com/quickstart/howto/doc/Xml/DataSetMapXMLData.aspx
> for an example.
> 


0
Tony
3/30/2007 10:46:50 AM
Console.WriteLine would work in console apps, you can change it to
Debug.Write() or something for your debugging.
I just pointed out that example so that you can compare it with your
code and see if the tables can be created from the xml in that
example.

Probably you should post your xml here also.

0
3/30/2007 8:20:33 PM
Reply:

Similar Artilces:

How can I email an excel file using my outlook contacts?
"cheflady" <cheflady@discussions.microsoft.com> wrote in message news:F9C13E60-150D-4F03-B519-A8769F08CD0F@microsoft.com... > > <sigh> Please use the big white space to write your question........ exactly the same way you email ANY file..... go to file\send\mail recipient( as attachment) "Gordon" wrote: > "cheflady" <cheflady@discussions.microsoft.com> wrote in message > news:F9C13E60-150D-4F03-B519-A8769F08CD0F@microsoft.com... > > > > > > > <sigh> Please use the big white space to write you...

"Registered File Types" "Opens with" What if a common type is not "registered?" Advanced?
I sent a family member as short MPG file (<1MB) as an attachment to an e-mail. He could not open it. I told him to search for some other MPG file that might be on his HD, and see if it opened. He said the found file opened with Real Player. But it seems that there is no obvious way to choose which app opens an attachment. He and I apparently have different MPG-2 decoders, and trying to walk him thru it with my having what must be different versions of apps and utilities and plug-ins was a failure. So I phoned him and thought that I would have him set Windows Media Player ...

Special Pasting Quattro Pro 9 file as bitmap, how to manipulate now?
The only way I could find to get a Quattro Pro 9 file into Excel 2002, with gridlines and the exact diagram (property and house layout), was to copy and paste special it as a bitmap. Now that it's in Excel, I'd like to change some things in the diagram but the cursor, when over the copied part, shows as a 4 sided arrow (a compass rose with 4 arrows pointing to the N,S,E, and W.) and the actual cursor arrow attached to and on the SE part of this 4-sided arrow. This 4 sided arrow cursor can only move the copied part and nothing else . When I move the cursor off the copied part, it reve...

How to recover deleted files?
HELP!!! I messed up big time! I am running out of disk space on my laptop. I wanted to download a movie from UTorrent and was told I did not have enough space. I figured I would move some of my files onto a flash drive to free up space & then I would have room for the movie. Once I watched the movie, I was going to delete it. I share my laptop with my 3 children. There are 3 accounts on my laptop (my youngest child is 6, so he does not have his own account yet), mine and one each for my son and my daughter. I moved the "my documents" folder for both my children onto...

XmlNode and read as BinHex
Hi, I'm processing a document using XmlDocument and I have an XmlNode whose value is stored as a binhex encoded string... How can I get this string converted back to a byte[]... XmlConvert has some internal methods but is there no public .net framework classes or methods that will do this... Thanks Donal Hi Donal, You can use a static method XmlConvert.FromBinHexString to convert the BinHex encoded string to byte[]. You can check the following link for more information on this method. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/ frlrfsystem...

Archive from Inbox on Exchage Server to pst file
I am trying to execute the Auto Archive in a folder "INBOX" located in the Exchange Server, to a pst file located on the Hard Disk. The file "archive.pst" is created but the emails are not moved to the "INBOX" folder in the "archive.pst". How can I fix this problem? I am using the Windows 2000 with Outlook 2002 SP2 Autoarchive works on the "modified" date of the item - perhaps that's your issue. Rogerio wrote: > I am trying to execute the Auto Archive in a > folder "INBOX" located in the Exchange Server, to a pst &g...

What is the maximum no of bytes that can be stored in a excel file
what is the maximun of bytes that can be stored in a excel file I am trying to save records from another Quest TOOL called (TOAD) into MS- Excel. Please let me know. Eagerly waiting for your reply Thank -- prekid ----------------------------------------------------------------------- prekida's Profile: http://www.excelforum.com/member.php?action=getinfo&userid=2660 View this thread: http://www.excelforum.com/showthread.php?threadid=39879 The limit on bytes depends on your computer's RAM. The max number of rows Excel can have is 65536 and the max number of columns is 256....

Read receipt #12
When I "request a read receipt for this message" does this option only work with M/S Outlook? or can it work with other mail softwares? -- Thank-you Carl R It depends on the other mail programs, which you did not specify. Remember as well, recipients may have the option to decline sending a RR, which is my default action. --� Milly Staples [MVP - Outlook] Post all replies to the group to keep the discussion intact. All unsolicited mail sent to my personal account will be deleted without reading. After furious head scratching, Carl R asked: | When I "request a read re...

Trying to do mass update on label field in MS POS 2.0
I am trying to do a mass update on all of our items to make the labels be code 128. I am doing this so that we can print new shelf tags with the bar code on them. I am trying to make sense of the database and not having much luck. Can anyone tell me the table name and column name to do this? This is the field that appears on items in the option tab under label and bar code type. There is a drop down box that allows you to select the type of bar code. My goal is to do this in a SQL statement instead of opening up each of our 1500 items and choosing this manually. Thanks Patrick Patrick,...

Acrobat pdf form and Excel XML
Hello everyone, I have written a spreadsheet for some data and a chart to display that data. The data is over a two week period for shifts worked, sick leave days and overtime shifts. This is for administration staff to process. The next step was I wrote a pdf form in Lifestyle designer. The form has a layout for a two week period, the dates and columns for the information to be put in by the supervisor. Then there is a button on it for the supervisor to email the XML data to admin staff. The spreadsheet and pdf form work well. It is a problem I have with the XML data. Once the orig...

How can I embed a file as an unopened object in a worksheet or wo.
I want ot place Word, pdf, and other documents into a spreadsheet as objects that can be opened by clicking the icon. Have you tried Insert|object Goat Boy wrote: > > I want ot place Word, pdf, and other documents into a spreadsheet as objects > that can be opened by clicking the icon. -- Dave Peterson ...

Changing data from imported .txt file
When i import data from an old (dos based) program negative numbers appear with the minus behind the number. Does anyone have any idea how i can change them all from 1,234.56- to -1,234.56 so Excel will recognise them? Changing them by hand takes forever. Thank you. If you're using xl2002+ and are using File|Open to open a text file, you'll see a wizard popup. On step 3 of that wizard, there's an advanced button. Click it. There's an option to treat trailing minus signs as negative numbers. If you already have the data in the worksheet, you can use... Dana DeLouis pos...

Why does Excel in XP create new files?
Excel adds duplicate files - Assist Log (2).xle, asssits Log (3).xls. Why? Can I make this stop. It appears all the files are identical - so if I just delete the extra files will I be losing any data? hi, I think this is something new in xl relating to thier file recovery during a GPF shutdown. but i keep getting it even without a GPF. when i save, excel will just up and ask me which file i want to save leaveing me sitting there asking "what do you mean which file. i only have one." it's getting anoying. >-----Original Message----- >Excel adds duplicate files - ...

emf files
There are *.emf files with text in an excel worksheet that have inverted/mirrored letters. Okay indeed. What are emf files doing in an excel worksheet to begin with? These are a type of microsoft temp file. >-----Original Message----- >Okay. > >-- >Greeting from the Gulf Coast! >http://myweb.cableone.net/twodays >"Paul Osborne" <Paul.Osborne@halliburton.com> wrote in message >news:093301c34a17$c60f2390$a501280a@phx.gbl... >> There are *.emf files with text in an excel worksheet that >> have inverted/mirrored letters. > > &g...

Cant Transfer .pst file successfully.
Hi: I just got a new laptop and have been attempting to set up outlook on it (I am using a wireless network). I have copied the mailbox.pst file from my old system on to the laptop, but for some reason when I use file open on outlook it wont pick up the pst file and use it. Import and export wont work because they don't deal with .pst files it appears. Can someone suggest a good way to transfer the address book, especially from one system to the other? Thanks John Baker What do you mean File > Open "won't pick up the pst file?" Of course it will. How did you copy th...

Excel looking in wrong place for files
Hi, sometime ago I merged 2 partitions using PM8, and I was asked for a folder name, so I called My docs or something like that, and that folder was created on the said partition. Now when I go to open up a new file in excel it defaults to My Docs. So I formatted that partition changed all references in the Registry, rebooted and still excel is looking for new files in the wrong place. In fact the 'My Docs' folder no longer exists, so is there somewhere in Excel I can change its 'where to look' place? Thanks -- Bob H Leeds UK http://stores.ebay.co.uk/ContemporaryGifts4U...

Excel 2002 File Extensions
I created a drawing in Excel 2002 and I want to be able to save it in a file extension such as .jpg, .gif or .png so I can use it in Dreamweaver MX2004. I do not see any way to SAVE AS any file at ALL in those file extensions. Am I NOT able to do that? and if not, WHY not? Thank you for your feedback. I am grateful. Richard... Just try to copy/paste it on power point, it have with the right-click the save as picture option. I was unable to find the option directly on excel, however as excel and power point are from microsoft, you should not lose anything when you paste in on PP....

Comma separated files
my bank downloads my history and trans by way of comma separated files, i can nicely import to excel so the csv file is reconized. but money 04 does not seem to have a csv import option. any help would be greatly appreciated. i see 05 and 06 is out. purchased this pc recently and it shipped w/money and is legal Have a look at the bottom of this page. http://money.mvps.org/ofx.aspx -- Regards Bob Peel, Microsoft MVP - Money For UK tips & fixes see http://support.microsoft.com/default.aspx?scid=fh;EN-GB;mny. For wishes or suggestions see http://register.microsoft.com/mswish/sugg...

Powerpoint 2007 File Conversion
Version: 2004 Operating System: Mac OS X 10.4 (Tiger) Processor: Intel I recently created a presentation on my work computer in Powerpoint 2007 with the following extension - .pptx. I'm unable to open this file with my current version of Office for Mac v.11.5.1. I get a dialogue box telling me to download Office 2004 Update 11.5.0 so that I can use the Open XML File Format Converter for Mac. When I download the installer and try to run it, I get an error message that states: "The installer could not locate the correct version of the software required to install this update. See the...

Updater through Remote XML: Advice #2
I am implementing a very simple check routine that goes to my website and reads an XML file. The XML file basically contains all info for my apps and their current status. All I need to do is just read the version node and compare it to the current node and then advise the user to visit the website for the new version. Ive looked at ClickOnce and other methods but I would like to implement something simpler. Anyway, has anyone done this before? My XML will look something like this: <?xml version="1.0" encoding="utf-8"?> <Apps> <App id="0001"...

Email file does not retain same page content
The receiver of the email receives it with page 1 contents flowing onto page 2 . Page 2 picks up at end of the overflow and so on... Submitted via EggHeadCafe - Software Developer Portal of Choice BizTalk: Incorporating conditional If / Else Functoid Logic in a map. http://www.eggheadcafe.com/tutorials/aspnet/f6fc20ab-5c6a-4f04-8a0b-bba39e4bbcf0/biztalk-incorporating-co.aspx <Jetty donaldson> wrote in message news:2010416115618jetreal@cox.net... > The receiver of the email receives it with page 1 contents flowing onto page > 2 . Page 2 picks up > at end of t...

Vb macro stops when I try to create more than 89 charts
I created an Excel2002 VB macro that manipulates some data in different ways then it creates charts of the certain parts of data that I extracted. Every time when the macro is trying to create the 90th chart the macro stops (the VB Editor still says that the macro is running but nothing happen). When I press the pause or the stop button the Excel closes without any warning. Is there a limitation on how many charts I can create, or is something to do with my computer memory (and if that is the problem any suggestions on how to re-write the procedures to manage the memory better?) I have...

ASP.net DataSet WriteXml error in C#
mydataset.WriteXml(strPath + "/my.xml"); produces this error [ArgumentException: URI formats are not supported. System.IO.Path.GetFullPathInternal(String path) +27 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean useAsync, String msgPath, Boolean bFromProxy) +23 System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share) +4 System.Xml.XmlTextWriter..ctor(String filename, Encoding encoding) +3 System.Data.DataSet.WriteXml(String fileName, XmlWriteMode mode) +4 System.D...

Trying to install PS2002 under SBS2003
I'm trying to install Project Server 2003 under SBS 2003. I'm doing it as in this document: http://www.sbslinks.com/pdf/ProjectServer.pdf and something's wrong. After I finish when I click on PWA link it's showing me ....localweb/ProjectServer... and this page doesn't exist. When I change it to ...server/ProjectServer (server - name of my server), I can access PWA. But when I'm trying to conect from my Project Professional 2003 to server I'm getting message : Cannot connect. Project was unable to establish a connection with the selected Project Server. This could b...

Trying to modify XML X-REPORT
Following code segment looks good but the <IF> equates to true always and all departments print... What am I doing wrong? <ROW> "Non-Taxable Sales:" </ROW> <SET name="NonTaxableTotal" type="vbCurrency"> 0 </SET> <SET name="TATTOO" type="vbString"> "TATTOO" </SET> <SET name="BODYPIERCING" type="vbString"> "BODY PIERCING" </SET> <FOR each="ReportDepartment"> <IF> <CONDITION> Report.Department.Name = TAT...