如何将XML有效内容中的数据保存到Blob存储?
输入
<root>
<alexIsAwesome>yes he is</alexIsAwesome>
<bytes>sdfsdfjijOIJOISJDFQPWORPJkjsdlfkjlksdf==</bytes>
</root>
所需结果
<root>
<alexIsAwesome>yes he is</alexIsAwesome>
<bytes>/blob/path/toSavedPayload</bytes>
</root>
我们如何使用数据工厂从XML中提取节点并将其保存到Blob?
答案 0 :(得分:2)
在这种情况下,您必须使用一些自定义代码来执行此操作。我会从这些选项中选择
答案 1 :(得分:2)
由于Azure数据工厂本身不支持XML,所以建议您使用SSIS包。
using Microsoft.WindowsAzure.Storage;
using Microsoft.WindowsAzure.Storage.Auth;
using Microsoft.WindowsAzure.Storage.Blob;
// Retrieve storage account from connection string.
CloudStorageAccount storageAccount = CloudStorageAccount.Parse("StorageKey");
// Create the blob client.
CloudBlobClient blobClient = storageAccount.CreateCloudBlobClient();
// Retrieve reference to a previously created container.
CloudBlobContainer container = blobClient.GetContainerReference("mycontainer");
// Retrieve reference to a blob named "myblob".
CloudBlockBlob blockBlob = container.GetBlockBlobReference("myblob");
byte[] byteArrayIn = Dts.Variables["User::ImageVariable"].Value;
// Create or overwrite the "myblob" blob with contents from a local file.
using (var memoryStream = new MemoryStream(byteArrayIn);)
{
blockBlob.UploadFromStream(memoryStream);
}
答案 2 :(得分:1)
当前,ADF本身不支持XML。但是