Показать сообщение отдельно
Старый 21.07.2010, 22:06   #1  
Blog bot is offline
Blog bot
Участник
 
25,644 / 848 (80) +++++++
Регистрация: 28.10.2006
paruvella: De-serialization of string format XML in Dynamics Ax
Источник: http://paruvella.spaces.live.com/Blo...4DB0!546.entry
==============

For some requirements, we need to store XML as a string in some Ax-Tables and need to de-serialize this string field as a document at a later point of time.

During de-serialization process need to store the XML values in to some tables.

The following example will illustrate, how XML string can be read using X++ code.

static void PSReadXMLFileAsString(Args _args)
{

    XmlTextReader       xmlTextReader ;
    str                 xmlString = ''
                                    +''
                                    +'o130006'
                                    +'260005'
                                    +''
                                    +'';
   
    ;

    xmlTextReader = XmlTextReader::newXml(xmlString, true) ;

    xmlTextReader.read() ;

    while(xmlTextReader.read())
    {
        switch (xmlTextReader.NodeType())
            {
                case XmlNodeType::Element: // The node is an element.
                    print ("");
                    break;
                case XmlNodeType::Text: //Display the text in each element.
                    print (xmlTextReader.Value());
                    break;
                case XmlNodeType::EndElement: //Display the end of the element.
                    print ("");
                    break;
            }
    }
     pause;

}





Источник: http://paruvella.spaces.live.com/Blo...4DB0!546.entry
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.