Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Need Help Importing Xml into DataSet

Posted on 2009-07-13
5
Medium Priority
?
176 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 1500 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

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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. 
In real business world data are crucial and sometimes data are shared among different information systems. Hence, an agreeable file transfer protocol need to be established.
This video shows how to quickly and easily deploy an email signature for all users in Office 365 and prevent it from being added to replies and forwards. (the resulting signature is applied on the server level in Exchange Online) The email signat…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an anti-spam), the admin…
Suggested Courses

876 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