This would better be described by 'serialization' than 'interop', but I
didn't find a newsgroup that seems closer on topic.
The problem in a few words: I save data with DataSet.WriteXML, but I get
different data back when I read it later with DataSet.ReadXml.
More detail:
I'm saving a dataset containing a single datatable to an XML file
(DataSet.WriteXml), and its schema to an xsd file (DataSet.WriteXmlSchema).
Then in another app, I load them back into a new empty dataset using
DataSet.readXmlSchema and DataSet.ReadXml. The schema is read first.
What's "special" is that one of the columns doesn't contain a simple text
or numeric data type, but binary data (an array of BYTE, currently fixed at
8 bytes for testing, it will be replaced by variable-length encrypted data
later).
When it is saved into the XML file, the binary data are automatically
encoded in Base64.
Now the problem is that when this is read back later, nothing gets decoded.
Instead of a copy of the original bytes I put in, I get a larger array with
the Base64 representation.
The schema as saved by WriteXmlSchema looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="PasswordList" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="PasswordList" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="PasswordData">
<xs:complexType>
<xs:sequence>
<xs:element name="License" type="xs:base64Binary"
minOccurs="0" />
<xs:element name="Password" type="xs:base64Binary"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
Some sample (test) data from the XML file:
<PasswordList>
<PasswordData>
<License>QjAwMDAwMg==</License>
<Password>dzB2KnQ3eGc=</Password>
</PasswordData>
<PasswordData>
<License>QjAwMzMwMA==</License>
<Password>Q0wuNko5VTQ=</Password>
</PasswordData>
..... 5 3571
Sorry, forgot to specify: using VS2005 with all current updates, framework
2.0 SP1.
"Lucvdv" <re**********@null.netwrote in message
news:lq********************************@4ax.com...
This would better be described by 'serialization' than 'interop', but I
didn't find a newsgroup that seems closer on topic.
The problem in a few words: I save data with DataSet.WriteXML, but I get
different data back when I read it later with DataSet.ReadXml.
More detail:
I'm saving a dataset containing a single datatable to an XML file
(DataSet.WriteXml), and its schema to an xsd file
(DataSet.WriteXmlSchema).
Then in another app, I load them back into a new empty dataset using
DataSet.readXmlSchema and DataSet.ReadXml. The schema is read first.
What's "special" is that one of the columns doesn't contain a simple text
or numeric data type, but binary data (an array of BYTE, currently fixed
at
8 bytes for testing, it will be replaced by variable-length encrypted data
later).
When it is saved into the XML file, the binary data are automatically
encoded in Base64.
Now the problem is that when this is read back later, nothing gets
decoded.
Instead of a copy of the original bytes I put in, I get a larger array
with
the Base64 representation.
The schema as saved by WriteXmlSchema looks like this:
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="PasswordList" xmlns=""
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xs:element name="PasswordList" msdata:IsDataSet="true"
msdata:UseCurrentLocale="true">
<xs:complexType>
<xs:choice minOccurs="0" maxOccurs="unbounded">
<xs:element name="PasswordData">
<xs:complexType>
<xs:sequence>
<xs:element name="License" type="xs:base64Binary"
minOccurs="0" />
<xs:element name="Password" type="xs:base64Binary"
minOccurs="0" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:choice>
</xs:complexType>
</xs:element>
</xs:schema>
What is the column.DataType of the byte[] column after you have called
ReadXmlSchema?
--
--------------------------------------------------------------------------------
John Saunders | MVP - Windows Server System - Connected System Developer
On Tue, 18 Dec 2007 06:34:28 -0500, "John Saunders [MVP]" <john.saunders at
trizetto.comwrote:
"Lucvdv" <re**********@null.netwrote in message
news:lq********************************@4ax.com...
Then in another app, I load them back into a new empty dataset using
DataSet.readXmlSchema and DataSet.ReadXml. The schema is read first.
Now the problem is that when this is read back later, nothing gets
decoded.
Instead of a copy of the original bytes I put in, I get a larger array
with the Base64 representation.
What is the column.DataType of the byte[] column after you have called
ReadXmlSchema?
It's System.Byte[]
My original post was a little unclear about something when I re-read it
('one of the columns' wasn't accurate), so I'll fix that here: there are
two columns, each containing a byte array. The problem occurs for both.
On Tue, 18 Dec 2007 12:58:58 +0100, Lucvdv <re**********@null.netwrote:
On Tue, 18 Dec 2007 06:34:28 -0500, "John Saunders [MVP]" <john.saunders at
trizetto.comwrote:
"Lucvdv" <re**********@null.netwrote in message
news:lq********************************@4ax.com...
Then in another app, I load them back into a new empty dataset using
DataSet.readXmlSchema and DataSet.ReadXml. The schema is read first.
Now the problem is that when this is read back later, nothing gets
decoded.
Instead of a copy of the original bytes I put in, I get a larger array
with the Base64 representation.
What is the column.DataType of the byte[] column after you have called
ReadXmlSchema?
It's System.Byte[]
My original post was a little unclear about something when I re-read it
('one of the columns' wasn't accurate), so I'll fix that here: there are
two columns, each containing a byte array. The problem occurs for both.
And now it gets really strange: I closed Visual Studio for my lunch break,
reopen it when I get back, and the problem is gone.
I now get the correct data. Where I got an array of 15 bytes containing
what looked like the BASE64 data plus a few extra before, I now get an
array of 8 bytes containing the correct data.
Lucvdv wrote:
>And now it gets really strange: I closed Visual Studio for my lunch break, reopen it when I get back, and the problem is gone.
Which part is really strange - the part where you get a lunch break,
the part that you come back after lunch, or the part about the problem
being gone?
Tony Gravagno
Nebula Research and Development
Latest blog:
Stumped again - Strongly Typed Datasets from XML Schema
remove.munge.pleaseNebula-RnD.com/blog This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Peter Row |
last post by:
Hi all,
Here is my problem:
I have a SQL Server 2000 DB with various NVarChar, NText fields in its
tables.
For some stupid reason the data was inserted into these fields in UTF8
encoding.
...
|
by: geilen |
last post by:
I'm trying to use a dataset returned from a web service in an unmanaged C++
(MFC) client. The dataset is returned as a BSTR, and I'm having trouble
reading the BSTR into an XML document for...
|
by: adrin |
last post by:
hi,
i am writing a program that is supposed to create a database of my music
and albums.
i want it to consist of 3 'modules' input<->processing<->output. input
should enable reading data from cd...
|
by: ALI-R |
last post by:
Hi All;
I'm reading the following xml file into a Dataset but there are only 4
datatables in my dataset (which should be 5)
Is that because I have two nodes with the same name (detail) in my xml...
|
by: Dennis |
last post by:
Hi, I am hoping I can get some help with a small problem I have run
into using C#. U have an XML file that I load into a Dataset and then
display this in a Datagrid. No problems doing this at all....
|
by: Jason |
last post by:
I am having problems understanding how to access a datasource only
once, fill a single dataset, and then reference that dataset multiple
times through different user controls(ascx) found on the...
|
by: Nikhil Patel |
last post by:
Hi,
I bind a grid to a DataView object. I lose the reference to the underlying
DataTable and the DataSet in a postback.
Here is the code. Page_Load works fine and I am able to see the rows in...
|
by: Arne |
last post by:
How do I pass a dataset to a webservices? I need to submit a shoppingcart
from a pocket PC to a webservice.
What is the right datatype?
II have tried dataset as a datatype, but I can't get it to...
|
by: Bryan |
last post by:
I have an MS Access DB with a table' Isometric' . One of the columns
is named 'Sheet'. I am doin a test to see if I can change a value in
the dataset and update the Access table with the...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
| |