Created
December 14, 2011 19:57
-
-
Save davidalencar/1478208 to your computer and use it in GitHub Desktop.
Trabalhando com BLOB, BinData e .NET no Dynamics AX
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
static container EFDocumentXML2Binary(str XMLDoc) | |
{ | |
System.Xml.XmlDocument xmlDoc; | |
System.IO.MemoryStream ms; | |
SysOutgoingEmailData outgoingEmailData; | |
container data; | |
str strdata; | |
BinData binData; | |
System.Xml.XmlWriterSettings xmlWS; | |
System.Xml.XmlWriter xmlW; | |
; | |
new InteropPermission(InteropKind::ClrInterop).assert(); | |
try | |
{ | |
ms = new System.IO.MemoryStream(); | |
xmlWS = new System.Xml.XmlWriterSettings(); | |
xmlWS.set_Encoding(System.Text.Encoding::get_UTF8()); | |
xmlW = System.Xml.XmlWriter::Create(ms,xmlWS); | |
xmlDoc = new System.Xml.XmlDocument(); | |
xmlDoc.LoadXml(XMLDoc); | |
xmlDoc.Save(xmlW); | |
strdata = System.Convert::ToBase64String(ms.GetBuffer()); | |
binData = new BinData(); | |
binData.setData(BinData::loadFromBase64(strdata)); | |
data = binData.getData(); | |
} | |
catch | |
{ | |
error(AifUtil::getClrErrorMessage()); | |
} | |
return data; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment