Solved

Need Help Importing Xml into DataSet

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

Why You Need a DevOps Toolchain

IT needs to deliver services with more agility and velocity. IT must roll out application features and innovations faster to keep up with customer demands, which is where a DevOps toolchain steps in. View the infographic to see why you need a DevOps toolchain.

Question has a verified solution.

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

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Browsing the questions asked to the Experts of this forum, you will be amazed to see how many times people are headaching about monster regular expressions (regex) to select that specific part of some HTML or XML file they want to extract. The examp…
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

734 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