Solved

Need Help Importing Xml into DataSet

Posted on 2009-07-13
5
170 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

MIM Survival Guide for Service Desk Managers

Major incidents can send mastered service desk processes into disorder. Systems and tools produce the data needed to resolve these incidents, but your challenge is getting that information to the right people fast. Check out the Survival Guide and begin bringing order to chaos.

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…
Many times as a report developer I've been asked to display normalized data such as three rows with values Jack, Joe, and Bob as a single comma-separated string such as 'Jack, Joe, Bob', and vice versa.  Here's how to do it. 
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

756 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