Solved

Need Help Importing Xml into DataSet

Posted on 2009-07-13
5
167 Views
Last Modified: 2013-12-17
The xml in question (or a small sample of it) is attached in code. I'm trying to populate a DataSet object using the ReadXml method but it's telling me that 'MacRoman' encoding isn't supported. Is there a workaround for this?
<dataset>

  <table name="dbo.someData">

    <column>GameNum</column>

    <column>EventNum</column>

    <column>TCIN</column>

    <column>TCOUT</column>

    <column>ISCI</column>

    <column>IMAGEID</column>

    <column>DATA1</column>

    <column>DATA2</column>

    <row>

      <value>3_416_det_pit_0809</value>

      <value>PIT60</value>

      <value>20:15:49:03</value>

      <value>20:16:11:28</value>

      <value>3_416_det_pit_0809</value>

      <value>1001</value>

      <value>ZETTERBERG SHOT ON</value>

      <value>PERIOD 1</value>

    </row>

    <row>

      <value>3_416_det_pit_0809</value>

      <value></value>

      <value>20:16:24:00</value>

      <value>20:16:39:11</value>

      <value>3_416_det_pit_0809</value>

      <value>1002</value>

      <value>NEW HIGHLIGHT</value>

      <value>PERIOD 1</value>

    </row>

  </table>

</dataset>

Open in new window

0
Comment
Question by:Russ Suter
  • 3
  • 2
5 Comments
 
LVL 4

Expert Comment

by:phdesign
ID: 24846264
Try specifying the encoding like this:
<?xml version="1.0" encoding="utf-8"?>

<dataset>

  <table name="dbo.someData">

    <column>GameNum</column>

    <column>EventNum</column>

    <column>TCIN</column>

    <column>TCOUT</column>

    <column>ISCI</column>

    <column>IMAGEID</column>

    <column>DATA1</column>

    <column>DATA2</column>

    <row>

      <value>3_416_det_pit_0809</value>

      <value>PIT60</value>

      <value>20:15:49:03</value>

      <value>20:16:11:28</value>

      <value>3_416_det_pit_0809</value>

      <value>1001</value>

      <value>ZETTERBERG SHOT ON</value>

      <value>PERIOD 1</value>

    </row>

    <row>

      <value>3_416_det_pit_0809</value>

      <value></value>

      <value>20:16:24:00</value>

      <value>20:16:39:11</value>

      <value>3_416_det_pit_0809</value>

      <value>1002</value>

      <value>NEW HIGHLIGHT</value>

      <value>PERIOD 1</value>

    </row>

  </table>

</dataset>

Open in new window

0
 
LVL 20

Author Comment

by:Russ Suter
ID: 24846339
I'm not creating the xml file. I'm trying to import it from an existing location. The encoding is already specified for me. Unfortunately, this doesn't help.
0
 
LVL 4

Expert Comment

by:phdesign
ID: 24846804
Perhaps try reading the xml to a string and using ReadXML() from that.
0
 
LVL 4

Accepted Solution

by:
phdesign earned 500 total points
ID: 24846818
Or read the file to a stream or an XmlReader first.
0
 
LVL 20

Author Closing Comment

by:Russ Suter
ID: 31603076
That is an acceptable workaround. Thanks.
0

Featured Post

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

896 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now