[Mono-devel-list] Re: CodeDom in Compiler.cs

Andrew Skiba andrews at mainsoft.com
Mon Apr 4 11:35:26 EDT 2005


Atsushi Eno wrote:
>> Yes, that's what I meant. Other similar thing is at 
>> System.Xml.Schema/BuiltInDatatype.cs:36. Does it really need 
>> System.Security.Cryptography?
> 
> Yes. It uses FromBase64Transform.
> 

I see that FromBase64Transform was inserted there at svn revision 22077. 
What was the rationale of that fix? Why is FromBase64String better than 
Convert.FromBase64String? This is the relevant part of the patch:

--- System.Xml.Schema/ChangeLog (revision 22076)
+++ System.Xml.Schema/ChangeLog (revision 22077)
@@ -1,3 +1,15 @@
+2004-01-14  David Sheldon <dave-mono at earth.li>
+
+        * BuiltInDatatype.cs:
+          XsdBase64Binary - Added Length, and used more direct, less fussy,
+              Base64 decoder.

--- System.Xml.Schema/BuiltInDatatype.cs        (revision 22076)
+++ System.Xml.Schema/BuiltInDatatype.cs        (revision 22077)
@@ -12,6 +12,7 @@
  using System.Xml;
  using System.Xml.Schema;
  using System.Globalization;
+using System.Security.Cryptography;

  namespace Mono.Xml.Schema
  {
@@ -1126,21 +1094,83 @@
                 public override object ParseValue (string s,
                         XmlNameTable nameTable, XmlNamespaceManager nsmgr)
                 {
-                       return Convert.FromBase64String (Normalize (s));
+                       // If it isnt ASCII it isnt valid base64 data
+                       byte[] inArr = new 
System.Text.ASCIIEncoding().GetBytes(s);
+                       FromBase64Transform t = new FromBase64Transform();
+                       return t.TransformFinalBlock(inArr, 0, 
inArr.Length);
                 }




More information about the Mono-devel-list mailing list