| 1 | C0CEWD1   ; CCDCCR/GPL - CCR FILEMAN utilities; 12/6/08 | 
|---|
| 2 | ;;0.1;CCDCCR;nopatch;noreleasedate | 
|---|
| 3 | ;Copyright 2009 George Lilly.  Licensed under the terms of the GNU | 
|---|
| 4 | ;General Public License See attached copy of the License. | 
|---|
| 5 | ; | 
|---|
| 6 | ;This program is free software; you can redistribute it and/or modify | 
|---|
| 7 | ;it under the terms of the GNU General Public License as published by | 
|---|
| 8 | ;the Free Software Foundation; either version 2 of the License, or | 
|---|
| 9 | ;(at your option) any later version. | 
|---|
| 10 | ; | 
|---|
| 11 | ;This program is distributed in the hope that it will be useful, | 
|---|
| 12 | ;but WITHOUT ANY WARRANTY; without even the implied warranty of | 
|---|
| 13 | ;MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the | 
|---|
| 14 | ;GNU General Public License for more details. | 
|---|
| 15 | ; | 
|---|
| 16 | ;You should have received a copy of the GNU General Public License along | 
|---|
| 17 | ;with this program; if not, write to the Free Software Foundation, Inc., | 
|---|
| 18 | ;51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 
|---|
| 19 | ; | 
|---|
| 20 | Q | 
|---|
| 21 | ; | 
|---|
| 22 | TEST(filepath) ; filepath IS THE PATH/FILE TO BE READ IN | 
|---|
| 23 | i $g(^%ZISH)["" d  ; if the VistA Kernal routine %ZISH exists | 
|---|
| 24 | . n zfile,zpath,ztmp s (zfile,zpath,ztmp)="" | 
|---|
| 25 | . s zfile=$re($p($re(filepath),"/",1)) ;file name | 
|---|
| 26 | . s zpath=$p(filepath,zfile,1) ; file path | 
|---|
| 27 | . s ztmp=$na(^CacheTempEWD($j,0)) | 
|---|
| 28 | . s ok=$$FTG^%ZISH(zpath,zfile,ztmp,2) ; import the file incrementing subscr 2 | 
|---|
| 29 | q | 
|---|
| 30 | ; | 
|---|
| 31 | TEST2 ; | 
|---|
| 32 | s zfilepath="/home/vademo2/CCR/PAT_780_CCR_V1_0_17.xml" | 
|---|
| 33 | ;s ok=$$gtmImportFile^%zewdHTMLParser(zfilepath) | 
|---|
| 34 | s ok=$$LOAD(zfilepath) ;load the XML file to the EWD global | 
|---|
| 35 | s ok=$$parseDocument^%zewdHTMLParser("DerekDOM",0) | 
|---|
| 36 | ;s ok=$$parseXMLFile^%zewdAPI(zfilepath,"fourthDOM") | 
|---|
| 37 | w ok,! | 
|---|
| 38 | q | 
|---|
| 39 | ; | 
|---|
| 40 | LOAD(filepath) ; load an xml file into the EWD global for DOM processing | 
|---|
| 41 | ; need to call s error=$$parseDocument^%zewdHTMLParser(docName,isHTML) | 
|---|
| 42 | ; after to process it to the DOM - isHTML=0 for XML files | 
|---|
| 43 | n i | 
|---|
| 44 | i $g(^%ZISH)["" d  QUIT i ; if VistA Kernal routine %ZISH exists - gpl 2/23/09 | 
|---|
| 45 | . n zfile,zpath,ztmp,zok s (zfile,zpath,ztmp)="" | 
|---|
| 46 | . s zfile=$re($p($re(filepath),"/",1)) ;file name | 
|---|
| 47 | . s zpath=$p(filepath,zfile,1) ; file path | 
|---|
| 48 | . s ztmp=$na(^CacheTempEWD($j,0)) | 
|---|
| 49 | . s zok=$$FTG^%ZISH(zpath,zfile,ztmp,2) ; import the file increment subscr 2 | 
|---|
| 50 | . s i=$o(^CacheTempEWD($j,""),-1) ; highest line number | 
|---|
| 51 | q i | 
|---|
| 52 | ; | 
|---|
| 53 | Q(ZQ,ZD) ; SEND QUERY ZQ TO DOM ZD AND DIPLAY NODES RETURNED | 
|---|
| 54 | I '$D(ZD) S ZD="DerekDOM" | 
|---|
| 55 | s error=$$select^%zewdXPath(ZQ,ZD,.nodes) ; | 
|---|
| 56 | d displayNodes^%zewdXPath(.nodes) | 
|---|
| 57 | q | 
|---|
| 58 | ; | 
|---|
| 59 | GET1URL0(URL) ; | 
|---|
| 60 | s ok=$$httpGET^%zewdGTM(URL,.gpl) | 
|---|
| 61 | D INDEX^C0CXPATH("gpl","gpl2") | 
|---|
| 62 | W !,"S URL=""",URL,"""",! | 
|---|
| 63 | S G="" | 
|---|
| 64 | F  S G=$O(gpl2(G)) Q:G=""  D  ; | 
|---|
| 65 | . W " S VDX(""",G,""")=""",gpl2(G),"""",! | 
|---|
| 66 | W ! | 
|---|
| 67 | Q | 
|---|