it depends on what you mean by efficient; fewer 4D code does not necessarily 
mean better performance, it all depends on the internal implementation (xerces).

if you don't know already there is this

> $dom:=DOM Create XML Ref("root")
> $e:=DOM Create XML element($dom;"root/element[10]")  //10 childs
>
> ARRAY TEXT($elements;0)
> $e:=DOM Find XML element($dom;"root/element";$elements)  //10 children

the advantage here is that you make fewer calls to "DOM Create".

you still need to loop over your array in 4D code to set values,
but a loop (For, While, Repeat) in compiled mode is as fast as any "batch" 
command in 4D,
and I don't see its as inefficient at all, you already have the DOM references.

something else, XML does not have the concept of arrays.
you could have many sibling elements that share the same name,
but that would only be a pretence of an array, open to interpretation.

it is expected that there are no standards to convert an arrays or JSON to XML.

> 2018/04/11 23:45、Sujit Shah via 4D_Tech <4d_tech@lists.4d.com> のメール:
> Is there a more efficient way that a large number of sub - elements can be
> added to the root element? At the moment we are using a For Loop.
> (I am looking for something like SELECTION TO JSON or JSON Stringify array
> for XML..)



**********************************************************************
4D Internet Users Group (4D iNUG)
FAQ:  http://lists.4d.com/faqnug.html
Archive:  http://lists.4d.com/archives.html
Options: https://lists.4d.com/mailman/options/4d_tech
Unsub:  mailto:4d_tech-unsubscr...@lists.4d.com
**********************************************************************

Reply via email to