Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML hexBinary to byte[]
Message
General information
Forum:
ASP.NET
Category:
XML
Title:
XML hexBinary to byte[]
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01165151
Message ID:
01165151
Views:
80
Hi all,

I've generated a DataSet from a schema. One of the elements is defined as hexBinary type. In the DataSet it becomes a property (column) of a row in a table with the type byte[]. The name of the hexBinary element is PayLoad and it has an equivalent property name PayLoad of a row in a table named Assignment. Here is the portion of the code that loads the XML into the DataSet and writes to a file:
myDataSet.ReadXML(sXMLFile);
StreamWriter sw = StreamWriter("c:\temp2\payload.zip");
SoapHexBinary hb = new SoapHexBinary(myDataSet.Assignment[0].PayLoad);
sw.Write(hb.ToString());
sw.Close();
The problem is that the content saved in the file is quite different from what was transmitted in the PayLoad element. Therefore the saved zip file cannot be opened.

But if I write the XML to a file from the DataSet as follows:
myDataSet.WriteXML("c:\temp2\newxmlfile.xml");
The content in the PayLoad element is correct.


I'd be grateful for any help or suggestion.
Dawa Tsering


"Do not let any unwholesome talk come out of your mouths,
but only what is helpful for building others up according to their needs,
that it may benefit those who listen."

- Ephesians 4:29-30 NIV

Dare to Question -- Care to Answer

Time is like water in a sponge, as long as you are willing you can always squeeze some.

--Lu Xun, Father of Modern Chinese Literature

Next
Reply
Map
View

Click here to load this message in the networking platform