Re: xml to array
Hi Olivier Am I missing a method called "Uty_Arrays_SetSize" I am trying to get it to run in a demo version of v16, and the test file chokes at the line with that command in It appears the command document to text is different in v13, Ill have to try and work round this once I have it working in v16 thanks -pm On Tue, Mar 27, 2018 at 1:50 PM, Peter Mew wrote: > Hi > Is there a 4D command that will take a block of xml, and turn it into a > number of arrays (or pairs of arrays (attribute and value) > Or is this a stupid question > Thanks > -pm > ** 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 **
RE: xml to array
Peter et al, The method was actually written by David Dancy. It was part of some XML methods he shared with the 4D community a number of years ago. Sure miss his presence in the 4D Dev world. Hope this helps. Tom // // User name(OS): ddancy // Date and time: 30/7/10, 01:15:07 // // Method: DOM_DisplayXML // Description // Format XML element names and values for display in Hierarchical List // // // History // // 30/7/10-ddancy: Created // // Parameters // C_TEXT($1;$Root_xml) C_LONGINT($2;$Level_l) $Root_xml:=$1 $Level_l:=$2 C_TEXT($Element_xml;$Child_xml) $Element_xml:=$Root_xml C_TEXT($ElementName_t) C_TEXT($ElementValue_t) C_TEXT($AttrList_t) Repeat DOM GET XML ELEMENT NAME($Element_xml;$ElementName_t) DOM GET XML ELEMENT VALUE($Element_xml;$ElementValue_t) $AttrList_t:="" C_LONGINT($Attr_l;$AttrCount_l) $AttrCount_l:=DOM Count XML attributes($Element_xml) C_TEXT($AttrName_t;$AttrValue_t) For ($Attr_l;1;$AttrCount_l) DOM GET XML ATTRIBUTE BY INDEX($Element_xml;$Attr_l;$AttrName_t;$AttrValue_t) $AttrList_t:=$AttrList_t+" "+$AttrName_t+"="+"\""+$AttrValue_t+"\"" End for APPEND TO ARRAY(DOM_Reference_at;$Element_xml) APPEND TO ARRAY(DOM_ElementName_at;($Level_l*" ")+"<"+$ElementName_t+$AttrList_t+">") APPEND TO ARRAY(DOM_ElementValue_at;$ElementValue_t) $Child_xml:=DOM Get first child XML element($Element_xml) If ((OK=1)) DOM_DisplayXML ($Child_xml;$Level_l+1) End if $Element_xml:=DOM Get next sibling XML element($Element_xml) Until ((OK=0)) OK:=1 Tom From: Peter Mew [mailto:peterm3...@gmail.com] Sent: Tuesday, March 27, 2018 2:09 PM To: Benedict, Tom Cc: 4d_tech@lists.4d.com Subject: Re: xml to array Hi Tom I would very much like to see your method thanks -pm On Tue, Mar 27, 2018 at 10:04 PM, Benedict, Tom mailto:tom.bened...@optum.com>> wrote: Hi Peter, > >Is there a 4D command that will take a block of xml, and turn it into a number >of arrays (or pairs of arrays (attribute and value) Or is this a stupid >question Thanks –pm I have a method to do this. Let me know if you need it. Tom Benedict Optum Inc This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. ** 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 **
Re: xml to array
Hi Tom I would very much like to see your method thanks -pm On Tue, Mar 27, 2018 at 10:04 PM, Benedict, Tom wrote: > Hi Peter, > > > > > > > >Is there a 4D command that will take a block of xml, and turn it into a > number of arrays (or pairs of arrays (attribute and value) Or is this a > stupid question Thanks –pm > > > > I have a method to do this. Let me know if you need it. > > > > Tom Benedict > > Optum Inc > > > > > This e-mail, including attachments, may include confidential and/or > proprietary information, and may be used only by the person or entity > to which it is addressed. If the reader of this e-mail is not the intended > recipient or his or her authorized agent, the reader is hereby notified > that any dissemination, distribution or copying of this e-mail is > prohibited. If you have received this e-mail in error, please notify the > sender by replying to this message and delete this e-mail immediately. > ** 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 **
Re: xml to array
Hi Peter, > >Is there a 4D command that will take a block of xml, and turn it into a number >of arrays (or pairs of arrays (attribute and value) Or is this a stupid >question Thanks -pm I have a method to do this. Let me know if you need it. Tom Benedict Optum Inc This e-mail, including attachments, may include confidential and/or proprietary information, and may be used only by the person or entity to which it is addressed. If the reader of this e-mail is not the intended recipient or his or her authorized agent, the reader is hereby notified that any dissemination, distribution or copying of this e-mail is prohibited. If you have received this e-mail in error, please notify the sender by replying to this message and delete this e-mail immediately. ** 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 **
Re: xml to array
Hi, Arnaud de Montard publised some time ago a method to convert XML to JSON. May it can help you to do what you are looking for. Here is the link : http://forums.4d.com/Post/FR/18847378/1/20786990#20786990 Patrick - Patrick EMANUEL Administrator www.association-qualisoft.eu (Soft1002, Simply Asso & QS_Toolbox) -- Sent from: http://4d.1045681.n5.nabble.com/4D-Tech-f1376241.html ** 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 **
Re: xml to array
Am 27.03.2018 um 14:50 schrieb Peter Mew via 4D_Tech <4d_tech@lists.4d.com>: > > Is there a 4D command that will take a block of xml, and turn it into a > number of arrays (or pairs of arrays (attribute and value) > Or is this a stupid question No and No Cheers Alex ** 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 **
xml to array
Hi Is there a 4D command that will take a block of xml, and turn it into a number of arrays (or pairs of arrays (attribute and value) Or is this a stupid question Thanks -pm ** 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 **