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 3517
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: Rina0 |
last post by:
Cybersecurity engineering is a specialized field that focuses on the design, development, and implementation of systems, processes, and technologies that protect against cyber threats and...
|
by: erikbower65 |
last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps:
1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal.
2. Connect to...
|
by: kcodez |
last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
|
by: Taofi |
last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same
This are my field names
ID, Budgeted, Actual, Status and Differences
...
|
by: Rina0 |
last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
|
by: lllomh |
last post by:
Define the method first
this.state = {
buttonBackgroundColor: 'green',
isBlinking: false, // A new status is added to identify whether the button is blinking or not
}
autoStart=()=>{
|
by: lllomh |
last post by:
How does React native implement an English player?
|
by: Mushico |
last post by:
How to calculate date of retirement from date of birth
|
by: DJRhino |
last post by:
Was curious if anyone else was having this same issue or not....
I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...
| |