Solved

Need Help Importing Xml into DataSet

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

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finding and deleting duplicate (picture) files can be a time consuming task. My wife and I, our three kids and their families all share one dilemma: Managing our pictures. Between desktops, laptops, phones, tablets, and cameras; over the last decade…

739 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