Solved

Need Help Importing Xml into DataSet

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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

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

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

839 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