Hello Hardhats,
       Kevin T has been helping me with code to get an Array directly to an XML format. I have taken the M programming course at the last WorldVistA conference, but we did not have time for any hands on work. So I am unfamiliar with getting GTM to go, (although I have it installed on my computer successfully.)

on the linux bash command line I type
>mumps
and then it prompts me for a file and I enter

array2XML.mumps

and I get the following error...

%GTM-E-FILEPARSE, Error parsing file specification: /var/www/html/php4/vista2mm/array2XML.mumps

I am running mumps from the same directory as the file. The contents of the file is at the end of the message. Note that any "real" code was generously given to me by Kevin. The only thing I did was to create my own array at the top of the file. I am sure that I am misusing white space and/or making other significant newbie errors. Feel free to point me to a FAQ, but a google got me no where. (As with all things Mumps/VistA, I was overwhelmed with the amount of data, and not sure where to start). So I am aware that this is very much a "how to get off the ground with GTM" question, and I did the due diligence.

Regards,
-FT

P.S. The contents of array2XML.mumps

file start>

set test("patient_id")=1111111
set test("patient_id","fname")="Fred"
set test("patient_id","lname")="Trotter"
set test("patient_id","socsec")=123121234
set test("patient_id","phone")="1112223333"
set test("patient_id","address_line1")="1005 E 8th #3023"
set test("patient_id","state")="AZ"
set test("patient_id","zip")=85281

do Array2XML("test","result",1)
zwr result(*)

Array2XML(pArray,pResult,indent)
       ;"Purpose: to convert an array into XML format
       ;"Input: pArray -- the NAME OF the array to convert (array can
be any format)
       ;"       pResult -- the NAME OF the output array.
       ;"              format:
       ;"                Result(0)="<?xml version='1.0'?>"
       ;"                Result(1)="<Node id="Node Name">Node Value</Node>
       ;"                Result(2)="  <Node id="Node Name">Node Value</Node>
       ;"                Result(3)="  <Node id="Node Name">Node Value</Node>
       ;"                Result(4)="  <Node id="Node Name">Node Value
  ;"<--- start subnode
       ;"                Result(5)="    <Node id="Node Name">Node Value</Node>
       ;"                Result(6)="    <Node id="Node Name">Node Value</Node>
       ;"                Result(7)="  </Node>
        ;"<---- end subnode
       ;"                Result(8)="  <Node id="Node Name">Node Value</Node>
       ;"       indent -- OPTIONAL.  if 1,  subnodes have whitespace
indent for pretty viewing
       ;"Output: pResult is filled
       ;"Result: none.
       ;"Note: example call  do Array2XML("MyArray","MyOutput",1)

       kill @pResult
       set @pResult@(0)=0
       if $get(indent)=1 set indent=""
       else  set indent=-1
       do A2XNode(pArray,pResult,.indent)
       set @pResult@(0)=$$XMLHDR^MXMLUTL

       quit


A2XNode(pArray,pResult,indent)
       ;"Purpose: To do the output for Array2XML
       ;"Input: pArray - the NAME OF the array to convert
       ;"       pResult - the NAME OF the output array.
       ;"              Format to be as described in Array2XML, except
Result(0)=MaxLine
       ;"       indent -- OPTIONAL.  if -1, subnodes WON't whitespace
indent for pretty viewing
       ;"                              otherwise, indent is string
holding space to indent
       ;"Result: none

       new i,s
       set indent=$get(indent)
       set i=$order(@pArray@(""))
       if i'="" for  do  quit:(i="")
       . set s="" if indent'=-1 set s=indent
       . set s=s_"<Node id="""_i_""">"_$get(@pArray@(i))
       . if $data(@pArray@(i))>1 do
       . . set @pResult@(0)=+$get(@pResult@(0))+1  ;"Increment maxline
       . . set @pResult@(@pResult@(0))=s
       . . new subIndent set subIndent=-1
       . . if indent'=-1 set subIndent=indent_"  "
       . . do A2XNode($name(@pArray@(i)),pResult,subIndent)
       . . set s="" if indent'=-1 set s=indent
       . . set s=s_"</Node>"
       . else  do
       . . set s=s_"</Node>"
       . set @pResult@(0)=+$get(@pResult@(0))+1  ;"Increment maxline
       . set @pResult@(@pResult@(0))=s
       . set i=$order(@pArray@(i))

       quit
<file end





--
Fred Trotter
SynSeer, Consultant
http://www.fredtrotter.com
http://www.synseer.com
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Hardhats-members mailing list
Hardhats-members@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/hardhats-members

Reply via email to