axapta - Convert Common to and from XML -


in ax2009, possible convert record xml following:

salestable salestable; salestable.xml(); 

is there method somewhere convert xml string record?

no, there no build-in method convert xml string record.

record fields can assigned container, though, using custgroup example:

public initfromcon(container con) {     [this.custgroup, this.name] = con; } 

what remains extract field data xml convert container.

static void xml2contest(args _args) {     str xml = @"<student>                  <number>001</number>                  <name>stud_a</name>                   <class>8</class>               </student>";     xmldocument xmldocument = xmldocument::newxml(xml);     xmlnodelist nodelist = xmldocument.selectnodes('student/*');      container xml2con(xmlnodelist list)     {         xmlnodelistiterator = new xmlnodelistiterator(list);         xmlnode node;         container ret;         while (it.morevalues())         {             node = it.value();             ret += node.text();             it.nextvalue();         }         return ret;     }     ;     info(con2str(xml2con(nodelist))); } 

while xml2con returns container of strings, ax attempt conversion target type in container assignment:

int a; [a] = ['123']; 

this work!

which means can without worry:

custgroup.initfromcon(xml2con(nodelist)); 

you of cause responsible maintain database integrity, sure call validatefield each relevant field , validatewrite before doing insert.


Comments

Popular posts from this blog

c# - Binding a comma separated list to a List<int> in asp.net web api -

Delphi 7 and decode UTF-8 base64 -

html - Is there any way to exclude a single element from the style? (Bootstrap) -