Shannon Braun's Weblog
"Assembly Required"
« Using InfoPath to post to my blog (cont....
Latest post
Gateway Connected DVD - here and gone »
Pulling Images from InfoPath Xml
Sunday, November 23, 2003 8:54:54 PM (Central Standard Time, UTC-06:00)
Working on my InfoPath RSS Poster thing (for the lack of a better name). Now that I can easily post to my blog using InfoPath I wanted to start taking advantage of also including images in the posts. Well, I thought it would be pretty straight forward. I had discovered after doing some exploratory coding that InfoPath happened to be using a serialization technique that was consistent with the XmlSerializer class.
I could serialize an image to xml (storing the image data in a byte array), then manually paste it into InfoPath from my serialization harness and it would render correctly. Well for about the next four hours I pulled out every thing I could think of to figure out exactly how they were serializing the byte array to Xml. I leveraged some research I had done for a serialization presentation and took advantage of a
post
that Douglas Purdy had blogged on XmlSerialization (it described how to find the *.cs files created during dynamic compilation). That's how I found that the XmlSerializer was calling ToByteArrayBase64. Then I spent some time digging around the System.Xml.Serialization.XmlSerializationReader class in Rotor code to figure out exactly how it read the string contained in the xml to a byte[]. I found the answer in Rotor's
xmlserializationreader.cs
, they were using Base64 encoding on the byte array. The "magic" code is found
here
.
Now with just a couple of lines of code, I can read the Base64 encoded string and persist it to file as an image. Getting closer now to having images in my posts…
Posted in |
Comments [0]
Comments are closed.
Archives
October, 2008 (4)
September, 2008 (5)
August, 2008 (1)
April, 2008 (4)
March, 2008 (4)
February, 2008 (1)
January, 2008 (3)
December, 2007 (2)
October, 2007 (1)
September, 2007 (1)
June, 2007 (5)
May, 2007 (1)
April, 2007 (1)
March, 2007 (7)
February, 2007 (4)
January, 2007 (2)
December, 2006 (1)
November, 2006 (7)
October, 2006 (7)
September, 2006 (5)
August, 2006 (4)
July, 2006 (2)
June, 2006 (2)
May, 2006 (4)
April, 2006 (2)
March, 2006 (1)
February, 2006 (4)
January, 2006 (6)
December, 2005 (2)
June, 2005 (1)
May, 2005 (7)
April, 2005 (1)
March, 2005 (2)
February, 2005 (1)
January, 2005 (2)
December, 2004 (1)
November, 2004 (4)
October, 2004 (6)
July, 2004 (1)
May, 2004 (2)
April, 2004 (4)
March, 2004 (6)
February, 2004 (2)
January, 2004 (5)
December, 2003 (10)
November, 2003 (9)
October, 2003 (12)
January, 2003 (2)
Category Cloud
Architecture and Design (9)
Code (24)
Development (35)
Presentations (13)
TidByte (40)
Visual Studio .NET (12)
WPF (19)
Blogroll
David Chappell
David Ing
Harry Pierson
Rockey Lhotka
Scott Hanselman
Links
Home
MSDN
Microsoft Architecture Center
The MS Architect Journal
.NET Windows Forms
Asp.NET
Windows Communication Foundation
Microsoft Patterns/Practices
About
Sysknowlogy
Sign In