Focal Point
[CLOSED] FOCUS 7.13 XML format not a "true" XML file why??

This topic can be found at:
https://forums.informationbuilders.com/eve/forums/a/tpc/f/7971057331/m/1681094022

March 28, 2007, 11:54 AM
Nailzz
[CLOSED] FOCUS 7.13 XML format not a "true" XML file why??
Good morning, I am working with an outside vendor who needs for us to submit data to them in an XML file. I have createf the file which is appearing as shown below. *******************************************
< ?xml version="1.0" encoding="ISO-8859-1" ? >
- < fxf version="1.0" data="hold" >
- < report records="65" lines="65" columns="48" rows="65" >
< target format="" version="" type="" destination="PSYCH_XML_IMPORT_DTD_20070201" / >
- < column_desc>
< col colnum="c0" fieldname="FACILITY_VISIT_ID" alias="E01" datatype="char" width="20" focus_format="A20" description="" accept="" help_message="" title="" within="" property="" reference="" valign="left" / >
< col colnum="c1" fieldname="ADMISSION_DATE" alias="E02" datatype="char" width="10" focus_format="A10" description="" accept="" help_message="" title="" within="" property="" reference="" valign="left" / >
< col colnum="c2" fieldname="ADMISSION_TYPE" alias="E03" datatype="char" width="3" focus_format="A3" description="" accept="" help_message="" title="" within="" property="" reference="" valign="left" / >
**********************************************

However, what I need for my output to be is like this; which is according to their specifications how my XML file is suppose to appear as a true XML format.

< ?xml version="1.0"? >
< !DOCTYPE qipsych SYSTEM "C:\Psych\dtd\Psych_xml_import_dtd_20070214.dtd" >
< qipsych >
< qip_case >
< case_id>Psych_Test2
< admission_date>1/2/2007
< admission_type>3
< admission_source>1
****************************************
Can anyone tell me how to make the above file appear in a "true" XML format as they have specified. I have asked the question on this board earlier but to no avail.

This message has been edited. Last edited by: <Kathryn Henning>,


WebFOCUS 7.1.3 on Win 2000
March 28, 2007, 12:18 PM
Tony A
Nailzz,

What data source are you using? If it is MS SQL then you could just perform the XML file creation without WF. Just because WF has an output format of XML doesn't mean you have to use it.

Right tool for the right job.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 28, 2007, 01:31 PM
Leah
quote:
< ?xml version="1.0"? >
< !DOCTYPE qipsych SYSTEM "C:\Psych\dtd\Psych_xml_import_dtd_20070214.dtd" >
< qipsych >
< qip_case >
< case_id>Psych_Test2
< admission_date>1/2/2007
< admission_type>3
< admission_source>1


I thought true XML had end tags as well, did the post mess up the code?


Leah
March 28, 2007, 01:32 PM
Nailzz
Thanks you Tony. Unfortunately, I am not proficient in writing SQL against our DB@ datasource. That at least helps me understand what needs to be done to get what they need.

Leah, yes it did. When I copied the code in the post it actual disappeared. I had to place a space before and after the tags so it would show my examples.


WebFOCUS 7.1.3 on Win 2000
March 28, 2007, 02:25 PM
Tony A
Nailzz,

The first thing to notice is the second line which intimates that they will also require a DTD file, which is like a schema structure file This is used to determine how the XML data should interpreted. WF doesn't create one of these so you're off to a dead stop immediately.

You could try and filedef a file and write the headers to it and then reopen the same file in append mode to target the output from a fex that controls the output you need. A lot of work and not one that I would suggest undertaking without a good understanding of a "real" XML suite of files (.xml, .dtd, .xsl etc.).

I would troll the interweb looking for articles on DTDs and XML to understand the relationship and then try and determine how best to proceed. Try the W3C web site for starters.

Good luck.

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
March 28, 2007, 04:56 PM
Bob Jude Ferrante
There's a standard DTD for the WebFOCUS XML report format already in the WebFOCUS path. It's called FXF.DTD. HOLD FORMAT XML always confirms to this DTD. So it doesn't publish a copy of that DTD for each hold file.


Bob Jude Ferrante
Director of Business and Development
WebFOCUS Performance Management
Bob_Ferrante@ibi.com
917-339-5105

I'll take any questions about PMF - business or technical - anytime!

March 28, 2007, 05:10 PM
Tony A
Thanks Bob,

Another item of info for the grey cells Smiler

T



In FOCUS
since 1986
WebFOCUS Server 8.2.01M, thru 8.2.07 on Windows Svr 2008 R2  
WebFOCUS App Studio 8.2.06 standalone on Windows 10 
April 04, 2007, 12:40 PM
hammo1j
I think hold format XML is IBI's own flavour used internally to pass info between applications.

Possibly you get the ability to ON TABLE HOLD FORMAT WHAT_MOST_PEOPLE_WOULD_EXPECT_IN_XML if you buy the XML adapter, since it could be quite easily done and would be extremely useful.

It would be quite easy to write a single seg hold file conversion to xml utility, but multi seg hierachic structures (format focus) would be harder.

Here is the pseudo code for a single seger assuming all outputs converted to alpha. Takers anyone?

tf syscolum
print name
if tbname eq 'holdname'
ots
end
-run

define file hold
xmlfield/a6000 =
-read save &fld while ioreturn ne 0
-set &fld = truncate(&fld)
'<&fld|>' | &fld | ''
-loop
;
END
TABLE FILE HOLD
PRINT XMLFIELD
OTS
END



Server: WF 7.6.2 ( BID/Rcaster) Platform: W2003Server/IIS6/Tomcat/SQL Server repository Adapters: SQL Server 2000/Oracle 9.2
Desktop: Dev Studio 765/XP/Office 2003 Applications: IFS/Jobscope/Maximo
April 04, 2007, 04:51 PM
Nailzz
Thanks this is worth the try. I will let you know how this works.


WebFOCUS 7.1.3 on Win 2000
April 05, 2007, 09:47 AM
Alan B
Just putting a little more meat on Johns pseudo code:
SET HOLDLIST = PRINTONLY
SET ASNAMES = ON
SET PAGE = NOPAGE
SET LINES = 99999

-* Set output file path and name for the XML file
FILEDEF XMLOUT DISK META/MYXML.XML

-* where to put the temp files
APP HOLD META

-* The main TABLE request
-* for this very simple version, ensure all fields are in ALPHA format,
-* otherwise you have to convert when creating the XML
DEFINE FILE CAR
MYDATE/A10 = EDIT('&DMYY','99/99/9999');
END
TABLE FILE CAR
PRINT CAR 
      COUNTRY 
      MODEL 
      BODY 
      SALES/A8
      MYDATE
BY COUNTRY NOPRINT

-* AS whatever_you_want
ON TABLE HOLD AS forxml_request001
END

-* Get the column names from the HOLD file
-* Make sure you have the SYSCOLUM master, or a copy, in your path.
TABLE FILE SYSCOLUM
PRINT NAME COLTYPE

-* Same name as HOLD file
IF TBNAME EQ forxml_request001

-* AS whatever_you_want
ON TABLE SAVE AS forxml_fields001
END
-RUN
-SET &numFields = &LINES;

-* Create the XML document from the HOLD file
DEFINE FILE forxml_request001
LINE1/A50='<?xml version="1.0"?>';

-* The following you might want to have set with &vars
LINE2/A80='<!DOCTYPE qipsych SYSTEM "C:\Psych\dtd\Psych_xml_import_dtd_"20070214.DTD">';
LINE3/A12='<qipsych>';
LINE4/A12='<qip_case>';
LINE5/A12='</qip_case>';
LINE6/A12='</qipsych>';

-* DUMMY stops a blank line appearing in the output.
DUMMY/A1=' ';
END
TABLE FILE forxml_request001
HEADING
"<LINE1"
"<LINE2"
"<LINE3"
"<LINE4"

-* Use only PRINT
PRINT

-SET &CNTR=0;

-* Repeat for the number of columns output from SYSCOLUM
-REPEAT :XMLLoop &numFields TIMES
-SET &CNTR=&CNTR+1;

-* READ the output from syscolum table
-READ forxml_fields001 &fieldName.A66

-* truncate the fieldnames
-SET &nameLength = ARGLEN(&fieldName.LENGTH,&fieldName,'I2');
-SET &SHORTNAME = SUBSTR(66,&fieldName,1,&nameLength.EVAL,&nameLength.EVAL,'A&nameLength.EVAL');

-* set fieldnames to lower case
-SET &shortName = LOCASE(&nameLength.EVAL,&SHORTNAME,'A&nameLength.EVAL')

COMPUTE RECORD_&CNTR /A200 = '<&shortName|>' || &SHORTNAME || '</&shortName|>'; AS ''

-IF &CNTR EQ &numFields GOTO :XMLLoop;
OVER
-:XMLLoop
BY DUMMY NOPRINT
ON DUMMY SUBFOOT
"<LINE5"
"<LINE6"

-* WP format suits this output best
ON TABLE SAVE AS XMLOUT FORMAT WP
END
gives:
  <?xml version="1.0"?>
  <!DOCTYPE qipsych SYSTEM "C:\Psych\dtd\Psych_xml_import_dtd_"20070214.DTD">
  <qipsych>
  <qip_case>
    <car>JAGUAR</car>
    <country>ENGLAND</country>
    <model>V12XKE AUTO</model>
    <bodytype>CONVERTIBLE</bodytype>
    <sales>000000</sales>
    <mydate>05/04/2007</mydate>
    <car>JAGUAR</car>
    <country>ENGLAND</country>
    <model>XJ12L AUTO</model>
    <bodytype>SEDAN</bodytype>
    <sales>012000</sales>
    <mydate>05/04/2007</mydate>
    <car>JENSEN</car>
    <country>ENGLAND</country>
    <model>INTERCEPTOR III</model>
    <bodytype>SEDAN</bodytype>
    <sales>000000</sales>
    <mydate>05/04/2007</mydate>
    <car>TRIUMPH</car>
    <country>ENGLAND</country>
    <model>TR7</model>
    <bodytype>HARDTOP</bodytype>
    <sales>000000</sales>
    <mydate>05/04/2007</mydate>
.
.
.
.
.
  </qip_case>
  </qipsych>

which I think gets near to what Nailzz was looking for. (Note: There is no such thing as a true XML file as the whole idea is that an XML document is user defined)

This message has been edited. Last edited by: Alan B,


Alan.
WF 7.705/8.007
January 05, 2009, 03:50 PM
FrankDutch
Alan

Thanks for this old answer.

I have got the basic idea to work for me, but I need some more complex extras based on 3 BY fields.

TABLE FILE CAR
PRINT CAR 
      COUNTRY 
      MODEL 
      BODY 
      SALES/A8
      MYDATE
BY COUNTRY NOPRINT
BY CAR NOPRINT
...


Should give me the report

 <qip_case>
   <country>ENGLAND
      <car>JAGUAR
        <model>V12XKE AUTO</model>
        <bodytype>CONVERTIBLE</bodytype>
        <sales>000000</sales>
        <mydate>05/04/2007</mydate>
        <model>XJ12L AUTO</model>
        <bodytype>SEDAN</bodytype>
        <sales>012000</sales>
        <mydate>05/04/2007</mydate>
      </car>
      <car>JENSEN
        <model>INTERCEPTOR III</model>
        <bodytype>SEDAN</bodytype>
        <sales>000000</sales>
        <mydate>05/04/2007</mydate>
      </car>
      <car>TRIUMPH
        ...
        ...
      </car>
   </country>
   <country>France
      <car>...
        ...
        ...
      </car>
   </country>
  </qip_case>


But how should I do this?

I was thinking on two extra loops, but also a subhead and subfoot might be a possibility.

Any suggestions?




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

January 05, 2009, 09:02 PM
Waz
I've built an include module that will output an MS ADO format XML document from any single segment source.

If you are interested ?


Waz...

Prod:WebFOCUS 7.6.10/8.1.04Upgrade:WebFOCUS 8.2.07OS:LinuxOutputs:HTML, PDF, Excel, PPT
In Focus since 1984
Pity the lost knowledge of an old programmer!

January 06, 2009, 03:09 AM
FrankDutch
Waz

I'm interested for sure....

my email adress is frank.terlien@gmail.com

thanks....




Frank

prod: WF 7.6.10 platform Windows,
databases: msSQL2000, msSQL2005, RMS, Oracle, Sybase,IE7
test: WF 7.6.10 on the same platform and databases,IE7

January 08, 2009, 07:00 AM
Frans
Me too, sounds interesting!

dortmont (at) gmail

Thanks


Test: WF 8.2
Prod: WF 8.2
DB: Progress, REST, IBM UniVerse/UniData, SQLServer, MySQL, PostgreSQL, Oracle, Greenplum, Athena.
January 09, 2009, 05:27 AM
Baillecl
Bonjour,
I'm surprised that DM is used for reading when Focus does it so far better.
Think that an old idea of WP Files with all the Power of Focus for SubFoot and Subhead should do better.
But before : "Me too, sounds interesting" :
Bailleul.Claude@neuf.fr
Cordialement and Focusement
PS : TonyA your "Old focus etc ..." is great.
30 km of sea make a big difference


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
January 09, 2009, 06:35 AM
Baillecl
Sorry to be back,
In fact I use the analysys of the Master (Check File Pict Hold) to generate A Focus request in a WP file.
There is so much DM in that 'Generator...' that I dare not show it ( It's a flower in a transparent plastic cube that some people call a Black Box).
An utilitarian extract the 80 chars of Focus line out of the WP file.
You just have to EX that file of Focus Code ...
The flexibility of DM is used to help Focus handle different Options, but in the end, it's Focus and not DM that access the Data.
Focusely
PS : I know it's time for me to get out of the game, but, you know, an Old Focus lover can turn into a bore ... I mean the idea is not so stupid, but the way to show it is awful !!!


Focus Mainframe 7.6.11
Dev Studio 7.6.11 and !!!
PC Focus, Focus for OS/2, FFW Six, MSO
March 20, 2014, 07:11 AM
Pedro
quote:
Originally posted by Waz:
I've built an include module that will output an MS ADO format XML document from any single segment source.

If you are interested ?


Hi Waz,
I'm very interested to your -include.
If you don't mind, can you please sending me a copy.

pierre.veronneau@telus.com


Production: WF 7.7.03 / OS: Solaris Sparc 64/ WebServer: Apache Tomcat/6.0/AppServer:WebLogic 10.3 /DB: Oracle 11.2/ Output formats: HTML, Excel, PDF, CSV, ZIP
July 08, 2014, 02:09 PM
Gurn
quote:
quote:
Originally posted by Waz:
I've built an include module that will output an MS ADO format XML document from any single segment source.

If you are interested ?


Hi Waz,
I am also interested in your -inlcude.
Like Pedro if you don't mind, can you send me a copy?

gselby@unomaha.edu


Version 8.01, Windows 7
Excel, PDF, HTML,CSV