Sei sulla pagina 1di 25

XML and the

Progress 4GL
Robbert Dees
Principal Technical Support Engineer
PTS-EMEA
XML and the Progress 4GL
Agenda
 Technology Overview
 4GL Language Additions
 Current Issues and Limitations
 Demos <TABLE>

 XML Futures <TBODY>

 Questions <TR> <TR>

<TD> <TD> <TD> <TD>

Shady Grove Aeolian Over the River, Dorian


Charlie

2 © 2000, Progress Software Corporation


Technology
Overview
XML Parser Technology

 IBM XML Parser for C++ 2.3.1


– Validating Parser (DTD)
– DOM Level 1 and SAX Interface
– Open Source
 IBM International Classes for Unicode 1.3
– Unicode 3.0 Standard
– Wide Variety of Encodings

4 © 2000, Progress Software Corporation


Document Object Model (DOM)

 DOM Level 1 W3C Recommendation


– http://www.w3.org/TR/REC-DOM-Level-1/
 Object Oriented and Flattened API
 Progress includes subset of Node
Interface and Document Interface plus
some extensions

5 © 2000, Progress Software Corporation


DTD Validation

 Internal and External DTDs


 External DTDs must be files
– No support for HTTP
 DTD MUST be available if specified

6 © 2000, Progress Software Corporation


4GL Language
Additions
XML Handles

 Two new Handles added


– X-DOCUMENT represents a Document
– X-NODEREF represents a Node in a
Document
 X-DOCUMENT inherits from X-NODEREF
 SUBTYPE attribute returns Node type

8 © 2000, Progress Software Corporation


X-DOCUMENT and X-NODEREF
Examples

 Load an XML Document


– xDoc:LOAD(“FILE”, “c:\data.xml”, False).
 Retrieve Root Node
– xDoc:GET-DOCUMENT-ELEMENT(xNode).
 Create an Element Node
– xDoc:CREATE-NODE(xNode, “Customer”, “element”).
 Create an Attribute
– xNode:SET-ATTRIBUTE(“CustNum”, “12345”).
 Walking the Tree
– xNode:GET-CHILD(xChild, 1).
 Save an XML Document
– xDoc:SAVE(“STREAM”, “WEBSTREAM”).

9 © 2000, Progress Software Corporation


Input-Output Support

 Files and MEMPTR supported for input


 Files, MEMPTR, and STREAMS supported
for output
 Documents POSTed to WebSpeed
– Requires Content-type to be text/xml or
application/xml
 ENCODING attribute sets output encoding
– Defaults to utf-8 if ENCODING = ?

10 © 2000, Progress Software Corporation


WebSpeed XML Enhancements

 WEB-CONTEXT Handle extended


– IS-XML
– AUTO-DELETE-XML
– VALIDATE-XML
– X-DOCUMENT
 Validation must be against an embedded DTD
 Only text/xml and application/xml recognized as
XML files
 Parsing occurs on first access of X-DOCUMENT
attribute

11 © 2000, Progress Software Corporation


Issues, Tips, and
Tricks For Using
XML in Progress 9.1A
Encoding Issues

 Encodings not limited by what Progress


session is using
– $DLC/lib/icu/data/convrtrs.txt
– $DLC\bin\icu\data\convrtrs.txt
 Wide character Encodings not supported
in this release

13 © 2000, Progress Software Corporation


Copying And Reuse Of Handles

 Only shallow copies done


– You can not “save” a handle by copying it
(xNode1 = xNode2.)
 You can not reuse a handle as a parameter
on its own method call
– xNode:GET-CHILD(xNode, 1).

14 © 2000, Progress Software Corporation


Copying A Handle To A Temp-Table

gotChild = phElement:GET-CHILD(hText,1) NO-ERROR.


IF NOT gotChild THEN DO:
phElement:GET-PARENT(hParent).
hParent:GET-CHILD(tTag.hEle, phElement:CHILD-NUM).
END.
ELSE
hText:GET-PARENT(tTag.hEle).

15 © 2000, Progress Software Corporation


Working With DTDs

 Incomplete support for DTDs


– Can not programmatically create a DTD
reference
– Limitation of DOM Level 1 and bugs in
IBM’s implementation
– Will not write DTD reference when saving

16 © 2000, Progress Software Corporation


Dos and Don’ts

 Never ASSUME a particular structure


 Check return values
 Delete your handles

17 © 2000, Progress Software Corporation


XML Demos
News Aggregation Web Site

 Uses 4GL SOCKET to read XML files from


Web Sites via HTTP
 XML files in Netscape Rich Site Summary
(RSS) format
 Parses file and populates a TEMP-TABLE
 Multiple Web Site headlines are displayed

19 © 2000, Progress Software Corporation


SOAP Demo

 Simple Object Access Protocol


– Created by Developmentor, Microsoft, IBM,
and Userland Software
– Internet RPC protocol
– Uses HTTP as the transport
– Uses XML as the serialization format
 WebSpeed app parses SOAP request and
calls AppServer

20 © 2000, Progress Software Corporation


XML Futures
XML Futures

 Move to IBM XML Parser 3.1.0


– Same parser used in Apache Xerces
project
– Supports DOM Level 2
– Improved DTD support
– XML Namespace support
 Provide tools for mapping XML instances
to Progress Data Objects

22 © 2000, Progress Software Corporation


XML Resources

 Microsoft XML Development Center


– http://msdn.microsoft.com/xml
 IBM XML Development Center
– http://www.ibm.com/developer/xml
 XML.COM
– http://www.xml.com
 XML Hack
– http://www.xmlhack.com
 Eclectic XML-DEV Weblog
– http://weblogs.userland.com/eclectic

23 © 2000, Progress Software Corporation


Call To Action

 Evaluate where XML makes sense in your


organization
 Provide XML representation of your
application data
 Subscribe to the XML PEG mailing list
 Talk to complimentary Progress
Application Partners about integrating
your applications

24 © 2000, Progress Software Corporation

Potrebbero piacerti anche