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
571 Views

Similar Articles

[PageSpeed] 45

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:

XML report to screen
Is it possible to output one of the Active Reports to the POS screen? I know you can have custom buttons open an HTML window. Can this HTML window display an Active xml Report? ...

how can I find and download a WAB DLL file for Outlook 2000
When trying to use outlook I get a error message "cannot find WAB DLL" I may have accidently removed it. What OS are you using? Curious since OL2000 isn't Vista compatible. "JEJE" <JEJE@discussions.microsoft.com> wrote in message news:E344280E-7FEC-4550-8255-E1069D4A8621@microsoft.com... > When trying to use outlook I get a error message "cannot find WAB DLL" I > may > have accidently removed it. if you are using vista, see http://www.outlook-tips.net/howto/vista_wab.htm otherwise, we need to know the version of windows. -- Diane Po...

get xml option in data menu
i can't find the xml option in the data menu? any ideas? using office 2003 sbe. ...

xlsx file opens blank
Not sure when it happened or if it's always like this. Upgraded from Office 2003 to 2007. Set everyone up to save to XLS by default, since most people can't use or view the XLSX crap. So, one customer mails us an XLSX file. This lady tries to open it and it opens blank. So, we're sitting at the Excel screen with a light blue background as if no file was opened. Yet, someone else was able to open the same file just fine. Any ideas? Did you try maximizing the document? I've had that happen to me if I have multiple files open, arrange to view all, then c...

Opening excel files
Hi everyone If I open an excel document from my documents, or other location, excel opens but then the file does not open. I can open excel files from excel and using the open command. but not staright from my documents. Any ideas? thanks Sometimes one of these works when you're having trouble with double clicking on the file in windows explorer: Tools|Options|General|Ignore other applications (uncheck it) --- or --- Close Excel and Windows Start Button|Run excel /unregserver then Windows Start Button|Run excel /regserver The /unregserver & /regserver stuff resets the win...

converting to UNICODE, _TCHAR and TCHAR, writing text files
Hi, i'm converting a MFC application to support unicode. I have some (probably noob) questions: - What is the difference between the types _TCHAR and TCHAR ? I see some UNICODE applications use _TCHAR and others TCHAR. - I have to convert the way textfiles are written. These text-files are send to machines using parallel port, so they have to stay the same as before (when my application had no _UNICODE preprocessor definition). The commands that are used to write these files are fputs, fopen, etc. When changing it to support wide characters are the textfiles still the same? example (_U...

double read receipt
I have a problem with this configuration: Clean install of a single server Exchange 2007. All users connect to exchange via pop3/smtp. When a user send a mail to another user of the same organization with a read-receipt request, it get 2 read-receipt. One in english and one in the locale language. I think one come from the exchange server, and one from the pop3 client. I have already cleared the flag "allow delivery report" in the Organization Configuration / Hub Transport / Remote Domains dialog box, but the problem persist for internal users. Any ideas ? Some help please ....

HOW TO redirect stderr to a file??? (freopen NOT supported)
Hi i'm doing a porting from an application console for win32 to pocketpc 2002, this applicancion have a lot of call to function similar to those: fprintf(stderr, "%s: Unknown error\n", msg); ................. ................. fprintf(stderr, "dropping packet #%u\n", seqno); ................ i want to preserve those functions and redirect stderr to a file but pocketpc sdk and EVC30 doe not support the function "freopen" anyone can soggest me a way to do that redirection? Thanks fclose(stderr); FILE * f = fopen("whatever.txt", "w"); st...

Open Last Modified File form Location
Hi, I have one folder, which has 20 files & I want macro to open last modified file in that folder. Is this can be done?? File Path: C:\Users\Glenys\Desktop\Glen_Macro\ Best Regards, Kam. One way using Dir().. Sub LastModifiedFilewithinFolder() Dim strFile As String, strFolder As String Dim dtLast As Date, strLMFile As String strFolder = "C:\" 'strFolder = "C:\Users\Glenys\Desktop\Glen_Macro\" strFile = Dir("c:\*.*", vbNormal) Do While strFile <> "" If FileDateTime(strFolder & strFile) > dtLast Then dtLas...

Folder List does not display files and folders
Under View, Page is selected with Toggle Pane set to Folder list. No folders or files are displayed. There are files in the default folder called My Web but I'm not able to see these in Folder List. Please can you advise? Thank you in advance. Have you opened a website using File->Open web or File->Open Site ? The file list will be blank until a website is opened in FrontPage. The folder My Documents\My webs is a website. -- Ron Symonds Microsoft MVP (Expression Web) http://www.rxs-enterprises.org/fp Reply only to group - emails will be deleted unread. ...

Remove File Extensions From a List of Files
I have a multiple very long lists containing file names. I'd like to strip the extensions off and compare names together. Does anyone know of a way to make xxxxx.prt turn into xxxxx Thanks justinfoote@freightliner.com> wrote in message news:1143068499.822470.242820@t31g2000cwb.googlegroups.com... >I have a multiple very long lists containing file names. I'd like to > strip the extensions off and compare names together. > Does anyone know of a way to make > xxxxx.prt > turn into > xxxxx > > Thanks If you have all files with a three letter extension, y...

Changing Publisher file to PDF file
Hello, I ma just learning to use Publisher. I cannot find the directions on how to change a Publisher file to PDF file if that is possible. I want to link the Publisher file to a website as a PDF file. Thanks Al Krismer Hi Al Krismer (anonymous@discussions.microsoft.com), in the newsgroups you posted: || I ma just learning to use Publisher. I cannot find the || directions on how to change a Publisher file to PDF file if || that is possible. I want to link the Publisher file to a || website as a PDF file. Visit www.primopdf.com for a free PDF converter. -- Brian Kvalheim Microsoft Publis...

Two Many Contact Files
Using Office 2003 Outlook. When I start to create a new email and write in the name it does not auto input the name as I enter it. I have the auto set OK. When I try and answer an email the auto name works OK. I also have another problem in that I have 4 contact lists. One of them has the addresses in it but the default one keeps telling me that the file has been moved or I do not have permission to use it. I have to manual set so that the second contact list opens when I go to the address book. The problem is that when I do that now the auto input of the address will not work. Is the...

Trying to get average of dollar values in one category of access.
I have created three tables recording donations received, Donations, Large Donations and Large Cash Donations. I now need to get the average of the large cash donations. I've read the Builder 'help' section several times, but can't get the expression right. Pls Advise. Use a totals query and change Group By to Average. -- KARL DEWEY Build a little - Test a little "Eileen Price-Engram" wrote: > I have created three tables recording donations received, Donations, Large > Donations and Large Cash Donations. I now need to get the average of the > larg...

XML schemas .NET 2.0
I have an XML schema and I am trying to validate any XML document sent against it. Here's some of the code: XmlReaderSettings xmlReaderSettings = new XmlReaderSettings(); xmlReaderSettings.Schemas.Add(@"http://myschema/myschema.xsd", "myschema.xsd"); xmlReaderSettings.ValidationEventHandler += new ValidationEventHandler(ValidationEvent); xmlReaderSettings.ValidationType = ValidationType.Schema; xmlReaderSettings.ValidationFlags = xmlReaderSettings.ValidationFlags | XmlSchemaValidationFlags.ReportValidationWarnings; ...

Multiple pst files #4
I trying to use multiple pst files. I get an memory error after two pst files are active. There is a KB file( 907651 ) that recommends an Hotkey edit. The issue is that my registry does not have the \PST in this Hotkey recommended. Does anyone have any idea on why this subkey does not exist here?? From KB 907651: 2. Click Start, click Run, type regedit in the Open box, and then click OK. 3. Locate and then click the following registry subkey: HKEY_CURRENT_USER\Software\Microsoft\Office\11.0\Outlook\PST 4. On the Edit menu, point to New, and then click DWORD Value. ...

mail merge to individual document (file)
Hi, is it possible to get Publisher to merge to individual files? I want to EVENTUALLY do the following; Create a Newsletter (using Publisher) Merge it with my client list (to individual files) Create individual PDF files from merge files. Email each customised Newsletter (now as a PDF) to my client base. I know this seems long winded, but I'm open to other suggestions if anyone has any. Thanks in advance Bails <andrewgbaillie@hotmail.com> was very recently heard to utter: > Hi, is it possible to get Publisher to merge to individual files? > > Create individual PDF f...

Condition-clause in XSLT using .Net System.Xml
Hi. I'm trying to execute a simple <xsl:if>-clause with a condition that reads: a<1 In MSXML 4 the clause <xsl:if test="a &lt; 1">do something...</xsl:if> works fine. But in .Net Xml it just doesn't work. I can't use the real character (<) because the XSLT wont be a valid XML. And if I use the encoded representation (&lt;) it wont compute at all. Anybody got a clue what to do??? // Magus - Il Dottore Magus wrote: > I'm trying to execute a simple <xsl:if>-clause with a > condition that reads: a<1 > In MSXML ...

Where are Outlook 2007 Personal file folders located on my HD?
I would like to transfer all emails within a number of Outlook 2007 Personal mail folders from one computer to another. I know that I can zip each folder, but would like to zip all of them at once and copy the zip file to a USB drive. If I am able to do this, can I simply copy the zipped file to another computer, unzip the folder contents and place them in the correct location so that Outlook will see and list the folders (and the messages therein) on the second computer? Both computers have Outlook 2007. I think that I need the directory location (and file extension?) for the ...

outlook pst file "access denide error"
I am trying to load the pst file from one computer to a new one. each time i use the export/import function I get to the point of importing the file to the new computer and I get an access denied message. since I own both machines how do I get my contacts and email to the new computer Thanks Did you move it to a CD? If so, then you need to Save it to your computer somewhere and then Right click on the saved file to bring up the properties. and remove the "Read Only" property attribute. PST files on a CD are READ ONLY. -- Nikki Peterson [MVP - Outlook] <anonymous@discussi...

packager can not package empty files
what does this mean? What are you doing when you get the message? -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP, originally posted via msnews.microsoft.com "packager can not display" <packager can not display@discussions.microsoft.com> wrote in message news:453E99EE-7B0C-419D-A1E3-015E1BEC8CC4@microsoft.com... > what does this mean? This same error message started showing up today on 90% of the computers in our school computer lab while trying...

sharing a .PST file over a network
Is it possible to access a .PST file on a remote system? We are NOT running Exchange server, yet we want 2 Outlooks running on 2 different systems to have access to the same .PST file. Both machines run XP Home with OUtlook 2003. In attempting open the .PST file with Outlook on the remote system I get a "You do not have permission" type of error. I have tried to remove the read-only attribute on the parent folder, but it seems to continually revert back to read-only. HOwever, if the folder is in fact READ-ONLY then why doesn't the local Outlook have any access i...

Serial Number from Excel File
Hi, It;s possible to extract from a Excel File the Serial number from which this file has been created?? Or other property which determine truly the owner / creator of this Excel File. ...

XML save issue in .NET
Hi, Currently we are using the .NET XMLDocument Class to manipulate some xml documents. The issue we are having is that when we save the XML files using the classes save method, empty xml tags will be saved with a CRLF instead of the empty value. This can be solved by setting the PreserveWhiteSpace property to true. But then the indentation is lost. E.g.:- Before Saving this is how the tags are. <Test></Test> After saving <Test> </Test> Has anybody come across this, is there any solution for this. Thanks Amendra. Amendra wrote: > Currently we are using ...

naming a new file
For some reason whenever I try to do a "save as" and type a name for a new worksheet it will only accept the first letter of the file name. If I try to name it alph.xls it will come up a.xls. any ideas. I have Office 97 on a Windows XP machine. I never had this problem before. Thanks There have been a few posts describing the same problem. I searched google and found this: http://google.com/groups?threadm=020101c30916%2442320250%24a501280a%40phx.gbl The last post in the thread suggested an answer. (I think it has something to do with WindowsXP). I don't think I've ev...