Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
XML hexBinary to byte[]
Message
General information
Forum:
ASP.NET
Category:
XML
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Network:
Windows 2000 Server
Miscellaneous
Thread ID:
01165151
Message ID:
01166615
Views:
15
>
>public static void Main(string[] args)
> {
>   Assignments myDataSet = new Assignments();
>   myDataSet.ReadXml("c:\\temp\\tester\\test.xml",XmlReadMode.Auto);
>   SoapBase64Binary sb = new SoapBase64Binary(myDataSet.Assignment[0].Payload);
>   Console.WriteLine("The object in XSD format is {0}.",sb.ToString());
>   Console.WriteLine();
>   Console.WriteLine("The conclusion is: your XSD is incorrect...?");
>   Console.WriteLine("Or possibly a different XmlReadMode would work...?");
>
> }
>
Lisa,

Thanks for testing the project and for your time! Actually, XSD is correct. Because I created the hexBinary sample data myself. This is what seems to be happening (and I couldn't find any documentation on it). ReadXML converts the hexBinary data to Base64Binary before it is stored in the byte[]. Of course, SoapHexBinary is expecting a hexBinary array, thus the saved string failes. If you write the xml and xsd to files from the dataset using WriteXml method, the Payload element is saved as Base64Binary type.

Again, I appreciate you taking the time and making the contribution,
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

Previous
Next
Reply
Map
View

Click here to load this message in the networking platform