Solved

Need Help Importing Xml into DataSet

Posted on 2009-07-13
5
166 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

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Suggested Solutions

Welcome my friends to the second instalment and follow-up to our Minify and Concatenate Your Scripts and Stylesheets (http://www.experts-exchange.com/Programming/Languages/.NET/ASP.NET/A_4334-Minify-and-Concatenate-Your-Scripts-and-Stylesheets.html)…
A long time ago (May 2011), I have written an article showing you how to create a DLL using Visual Studio 2005 to be hosted in SQL Server 2005. That was valid at that time and it is still valid if you are still using these versions. You can still re…
It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

747 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

13 Experts available now in Live!

Get 1:1 Help Now