Показать сообщение отдельно
Старый 23.05.2010, 02:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
kamalblogs: Storing and retrieving an XML in Resource node in Dynamics Ax
Источник: http://kamalblogs.wordpress.com/2010...n-dynamics-ax/
==============

Resource node in Dynamics Ax can be used to store images, xml,  Gif files. In this article let’s see how to store and retrieve an Xml file in resource node through X++.

Read the xml from Resource node

X++:
private void initializeResourceNode()
{
    Xml                  loadXML;
    ResourceNode    gResNode;
    XmlDocument     gXml;
    ;
    //load element to resource node
    gResNode    = TreeNode::findNode(@'\Resources\SysVersionControlSystemMorphXDefFile');
   //load xml to co
    [loadXML]   = SysResource::getResourceNodeData(gResNode);
    gxml        = XMLDocument::newXml(loadXML);
}
Saving  the Xml after modifying contents

X++:
private void packResourceNode()
{
    TextBuffer      textBUffer;
    BinData         binData;
    ContainerClass  containerClass;
    ;

    //Load Xml to text buffer
    textBuffer = new TextBuffer();
    textBuffer.setText(gXml.xml());

    //Move it to container
    containerClass = new ContainerClass([[SysResourceType::XMLDoc],new ContainerClass([textBuffer.getText()]).toBlob()]);

   //Store container to bin data
    binData = new BinData();
    binData.setData(containerClass.toBlob());

   //Set data in resource node
    gResNode.AOTSetData(binData);
    gResNode.AOTsave();
}


Источник: http://kamalblogs.wordpress.com/2010...n-dynamics-ax/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.