Focal Point
[SOLVED] Display XML file stored in SQL Table

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

August 13, 2010, 05:49 PM
Mighty Max
[SOLVED] Display XML file stored in SQL Table
I am trying to display a XML file that is stored in column of a SQL table but have had no luck.
The data is coming from a stored procedure.

Here is the master.
  
FILENAME=MIS_LOAD_XML_MSG, SUFFIX=SQLMSS  , $
  SEGMENT=INPUT, SEGTYPE=S0, $
    FIELDNAME=@MSGID, ALIAS=P0001, USAGE=A38V, ACTUAL=A38V,
      MISSING=ON, ACCESS_PROPERTY=(NEED_VALUE), $
  SEGMENT=OUTPUT, SEGTYPE=S0, PARENT=INPUT, $
    FIELDNAME=@RETURN_VALUE, ALIAS=P0000, USAGE=I11, ACTUAL=I4, $
  SEGMENT=RS, SEGTYPE=S0, PARENT=INPUT, $
    FIELDNAME=RAWMSG, ALIAS=RawMsg, USAGE=TX50, ACTUAL=TX, $


Here is the report.
TABLE FILE MIS_LOAD_XML_MSG
PRINT
     RAWMSG
WHERE @MSGID EQ '21EC2020-3AEA-1069-A2DD-08002B30309D'
END


Doing straight SQL passthru doesn't work either.
  
SET SQLENGINE=SQLMSS
SQL SQLMSS SET DEFAULT_CONNECTION MIS_DBConnect
SQL SQLMSS EX mis.dbo.usp_MIS_GetXMLMsg '21EC2020-3AEA-1069-A2DD-08002B30309D';

TABLE FILE SQLOUT
PRINT *
ON TABLE HOLD AS H1
END
-RUN

TABLE FILE H1
PRINT *
END


There is some layer of transalation that WebFOCUS is missing. I tried the technique in [SOLVED] Reporting from XML stored in a text column.
But I don't need to make a report off of the XML file I just need to display its contents to the user.

This message has been edited. Last edited by: Mighty Max,


WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files
August 14, 2010, 09:30 AM
GamP
Are you getting error messages? If so, which?

If not, then what do you mean with
quote:
I am trying to display a XML file that is stored in column of a SQL table but have had no luck.

It could then be that the data that is being shown is interpreted by the browser to be unintelligable html tags and therefor not shown. Check this by doing a view source in the resulting page. If that's the case, then either do some other form of output (like pdf) or have the field content preceded by the pre-tag (< pre >).

Otherwise please let us know what exactly you are experiencing.


GamP

- Using AS 8.2.01 on Windows 10 - IE11.
in Focus since 1988
August 15, 2010, 05:47 PM
Waz
If you just want to return the XML document to the browser, then hold it and use HTMLFORMTYPE.

e.g.
TABLE FILE MIS_LOAD_XML_MSG
PRINT
     RAWMSG
WHERE @MSGID EQ '21EC2020-3AEA-1069-A2DD-08002B30309D'
ON TABLE HOLD AS MY_XML
END
-RUN
SET HTMLFORMTYPE=XML
-RUN
-HTMLFORM MY_XML



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!

August 16, 2010, 02:30 PM
Mighty Max
I got it working but I had to do some tweaking.

1. Changed the field RAWMSG to Alpha format in the master.
2. Use FILEDEF to place the hold file into a .htm file.
3. Use ON TABLE SAVE not ON TABLE HOLD
4. Use SET HTMLFORMTYPE=XML

For some reason ON TABLE HOLD did not work. I had to use ON TABLE SAVE. I guess it would of worked if I had used an APP HOLD instead of FILEDEF.
Thanks for the help everyone.
  
FILENAME=MIS_LOAD_XML_MSG, SUFFIX=SQLMSS  , $
  SEGMENT=INPUT, SEGTYPE=S0, $
    FIELDNAME=@MSGID, ALIAS=P0001, USAGE=A38V, ACTUAL=A38V,
      MISSING=ON, ACCESS_PROPERTY=(NEED_VALUE), $
  SEGMENT=OUTPUT, SEGTYPE=S0, PARENT=INPUT, $
    FIELDNAME=@RETURN_VALUE, ALIAS=P0000, USAGE=I11, ACTUAL=I4, $
  SEGMENT=RS, SEGTYPE=S0, PARENT=INPUT, $
    FIELDNAME=RAWMSG, ALIAS=RawMsg, USAGE=A5000, ACTUAL=A5000, $

  
FILEDEF XMLOUT DISK MIS/XMLMSG.HTM
-RUN

TABLE FILE MIS_LOAD_XML_MSG
PRINT
     RAWMSG AS ''
WHERE @MSGID EQ '21EC2020-3AEA-1069-A2DD-08002B30309D'
ON TABLE SET PAGE-NUM OFF
ON TABLE SET PAGE NOPAGE
ON TABLE NOTOTAL
ON TABLE SAVE AS XMLOUT FORMAT ALPHA
END
-RUN

SET HTMLFORMTYPE=XML
-HTMLFORM BEGIN
!IBI.FIL.XMLOUT;
-HTMLFORM END



WebFOCUS 8.1.05M Unix Self-Service/MRE/Report Caster - Outputs Excel, PDF, HTML, Flat Files