Beruflich Dokumente
Kultur Dokumente
Robin Brown
Principal Software Engineer, Progress Software
10-June-2014
Disclaimer
What we are going to say reflects our views on future projects. The information
contained herein is preliminary and subject to change. Any future product we ultimately
deliver may be materially different from what is described here.
Release 10
XML Sax-Writer Release 11
Version 9
XML Schema Validation More ProDataSet XML
XML X-Document Schema Support
ProDataSet to/from
XML Sax-Reader XML JSON OO-ABL API
1999 2000 2001 2002 2003 2004 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014
XML in OpenEdge
JSON in OpenEdge
Q&A
Why XML?
• Industry standard format for document/data exchange
Use Cases
• Sending structured data over the Internet
– Back bone of Web Services/SOAP
• Sharing data with 3rd party applications
– Crystal Reports
• Persistent storage between ABL sessions
– Context Management
hSax:PARSE( ).
Advantages Disadvantages
DOM • All data always available • Memory Intensive
• In-place updates - Cannot handle large docs
DataSet
ttOrder
WRITE-XML
WRITE-XMLSCHEMA
ttItem
READ-XML ttOline
READ-XMLSCHEMA
Syntax
WRITE-XML (target-type,
{file | stream | memptr | handle | longchar}
[,formatted [,encoding
[,schema-location [,write-schema [,min-schema
[,write-before-image [,omit-initial-values]]]]]])
WRITE-XMLSCHEMA (target-type,
{file | stream | memptr | handle | longchar}
[,formatted [,encoding [,min-schema [,omit-initial-values]]]])
XML-NODE-TYPE Buffer-Field
XML-DATA-TYPE Buffer-Field
NESTED Data-Relation
XML-NODE-NAME (10.1C) ProDataSet, Temp-Table and Buffer
FOREIGN-KEY-HIDDEN (10.2A) Data-Relation
SERIALIZE-NAME (10.2B) ProDataSet, Temp-Table and Buffer
SERIALIZE-HIDDEN (10.2B) Buffer-Field
CustNum not
present with
FOREIGN-KEY-
HIDDEN
Record marked as
“modified”
Record marked as
“created”
Before-image of
modified record
field-level
attributes
non-unique index
definition
READ-XML (source-type,
{file | memptr | handle | longchar}
, read-mode, schema-location, override-default-mapping
[, field-type-mapping [, verify-schema-mode ]])
READ-XMLSCHEMA (source-type,
{file | memptr | handle | longchar}
, override-default-mapping [, field-type-mapping
[, verify-schema-mode ]])
bproxsdto4gl
{ xml-schema-file ... }
bprowsdldoc
{ WSDL-URL ... }
Benefit
• Easier integration with 3rd party products
PARENT-ID-RELATION
• Child record has field with RECID of parent
– PARENT-ID-FIELD
• PARENT-FIELDS-BEFORE/AFTER
Availability:
• READ-XML/READ-XMLSCHEMA ( )
• xsdto4gl utility
• wsdldoc utility
<person>
<name>Ken</name>
<children>
<child age=“15”>Adam</child>
<child age=“20”>Elana</child>
</children>
</person>
XML in OpenEdge
JSON in OpenEdge
Q&A
Use Cases
• Web development - JavaScript Libraries support JSON
• OE can easily become the back end of a Rich Internet Application (RIA)
– AppServer
– WebSpeed
– REST Adapter and OE Mobile use JSON – 11.2
• Persistent storage between ABL sessions
– Less verbose than XML
24 © 2014 Progress Software Corporation. All rights reserved.
JSON Data Types
WRITE-JSON ( mode,
{ file | stream | stream-handle | memptr | longchar }
[, formatted [, encoding [, omit-initial-values
[,omit-outer-object [, write-before-image ] ] ] ] ] )
READ-JSON ( source-type,
{ file | memptr | handle | longchar | JsonArray | JsonObject }
[, read-mode ] )
NESTED Data-Relation
FOREIGN-KEY-HIDDEN (10.2A) Data-Relation
SERIALIZE-NAME (10.2B) ProDataSet, Temp-Table and Buffer
SERIALIZE-HIDDEN (10.2B) Buffer-Field
PARENT-ID-RELATION (11.0) Data-Relation
{"CustomerOrder": {
"Customer": [ CustNum not
{ /* Row */ present with
"CustNum": 1, /* Column */ FOREIGN-KEY-
"Name": ["L","Frank","Baum"], HIDDEN
"Balance": 55000.0,
"Order": [
{"OrderNum":100,"CustNum":1,"OrderDate":"2009-01-12"},
{"OrderNum":101,"CustNum":1,"OrderDate":"2009-01-12"}
]
}
]
}}
28 © 2014 Progress Software Corporation. All rights reserved.
WRITE-JSON – omit-outer-object – 11.0
{“tt”: [ [
{“f1”: 11, “f2”: 12}, {“f1”: 11, “f2”: 12},
{“f1”: 21, “f2”: 22}, {“f1”: 21, “f2”: 22},
{“f1”: 31, “f2”: 32} {“f1”: 31, “f2”: 32}
]} ]
{"dsCustomer": {
"prods:hasChanges": true,
"ttCust": [
{ Record marked as
"prods:id": "ttCust10497", “modified”
"prods:rowState": "modified",
"CustNum": 2,
"NAME": "Urpon Frisbee_NewName",
"Balance": 903.64
},
{
"prods:id": "ttCust10498",
"prods:rowState": "created",
"CustNum": 10,
"NAME": "Customer10", Record marked as
"Balance": 56000.0
“created”
}
],
"prods:before": {
"ttCust": [
{
"prods:id": "ttCust8449", Before-image of
"prods:rowState": "deleted", deleted record
"CustNum": 3,
"NAME": "Hoops",
"Balance": 1199.95
},
{
"prods:id": "ttCust10497",
"prods:rowState": "modified",
"CustNum": 2,
"NAME": "Urpon Frisbee", Before-image of
"Balance": 437.63 modified record
}
]
}
Syntax
SERIALIZE-ROW
( target-format, target-type,
{ file | stream | stream-handle | memptr | longchar }
[, formatted [, encoding [, omit-initial-values
[, omit-outer-object ] ] ] ] )
Progress.Json.ObjectModel.JsonObject
• Collection of name/value pairs
• No order
• Access by property name
• Object surrounded by curly braces { }
myLongchar:
{
"name" : "Dorothy Gale",
"age" : 38,
"region" : "Kansas, USA"
}
vChar = myObject:GetCharacter(“name”).
vInt = myObject:GetInteger(“age”).
35 © 2014 Progress Software Corporation. All rights reserved.
OOABL JSON API – JSON Array – 11.0
Progress.Json.ObjectModel.JsonArray
• Ordered list of unnamed values
• Strict order
• Access by array index
• Surrounded by square brackets [ ]
myLongchar:
[ 1, false, “jump rope”, null ]
myArray:Set(2, 6.0).
vDec = myArray:GetDecimal(2). /* vDec = 6.0 */
vLog = myArray:GetLogical(4). /* vLog = ? */
{
"salesRep" : { "name" : "Dorothy Gale",
"age" : 38,
"region" : "Kansas, USA"
},
"tractorSales" : { "2009Quarterly" : [ 13, 27, 18, 9 ],
"2008Quarterly" : [ 11, 17, 32, 5 ],
"2007Quarterly" : [ 9, 25, 16, 10 ]
}
}
JsonObject:Read ( )
• Dataset
• Temp-Table
• Temp-Table Buffer
JsonArray:Read ( )
• Temp-Table
READ-JSON ( ) Enhancement
• New source types
– JsonObject
– JsonArray
XML in OpenEdge
JSON in OpenEdge
Q&A
Advantages Disadvantages
XML • Extensible • More verbose than JSON
• Formal XML Schema support (W3C) • Can be memory Intensive
• Datasets can interoperate with .NET - READ-XML cannot handle large docs
format