SlideShare a Scribd company logo
1 of 216
Download to read offline
XML demystified
4D Summit Europe 2014
4D Summit 2014 • Paris • Celebrating 30 years
Bruno LEGAY
Responsable Bureau d’Etudes
A&C Consulting
www.ac-consulting.fr
4D Summit 2014 • Paris • Celebrating 30 years
What is xml ?
4D Summit 2014 • Paris • Celebrating 30 years
What is xml ?
• Markup langage
4D Summit 2014 • Paris • Celebrating 30 years
What is xml ?
• Markup langage
• Serialization
4D Summit 2014 • Paris • Celebrating 30 years
What is xml ?
• Markup langage
• Serialization
• Data structure
4D Summit 2014 • Paris • Celebrating 30 years
What is xml ?
• Markup langage
• Serialization
• Data structure
• Data exchange
4D Summit 2014 • Paris • Celebrating 30 years
What is xml ?
• Markup langage
• Serialization
• Data structure
• Data exchange
• Data storage
4D Summit 2014 • Paris • Celebrating 30 years
Where is xml ?
4D Summit 2014 • Paris • Celebrating 30 years
Where is xml ?
• Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom,
Rest, xhtml)
4D Summit 2014 • Paris • Celebrating 30 years
Where is xml ?
• Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom,
Rest, xhtml)
• Office documents
4D Summit 2014 • Paris • Celebrating 30 years
Where is xml ?
• Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom,
Rest, xhtml)
• Office documents
• User interface (XUL/XAML)
4D Summit 2014 • Paris • Celebrating 30 years
Where is xml ?
• Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom,
Rest, xhtml)
• Office documents
• User interface (XUL/XAML)
• Preference files (4D, OS X, etc...)
4D Summit 2014 • Paris • Celebrating 30 years
Where is xml ?
• Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom,
Rest, xhtml)
• Office documents
• User interface (XUL/XAML)
• Preference files (4D, OS X, etc...)
• Svg
4D Summit 2014 • Paris • Celebrating 30 years
Where is xml ?
• Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom,
Rest, xhtml)
• Office documents
• User interface (XUL/XAML)
• Preference files (4D, OS X, etc...)
• Svg
• etc...
4D Summit 2014 • Paris • Celebrating 30 years
History of XML
Where does it come from ?
4D Summit 2014 • Paris • Celebrating 30 years
4D Summit 2014 • Paris • Celebrating 30 years
GML
1969 : Generalized Markup Language (IBM)!
Documentation
4D Summit 2014 • Paris • Celebrating 30 years
GML
SGML
1986 : Standard Generalized Markup Language (ISO)!
Documentation
1969 : Generalized Markup Language (IBM)!
Documentation
4D Summit 2014 • Paris • Celebrating 30 years
GML
SGML
1991 : Hypertext Markup Language (CERN/W3C)!
Hypertext documents
1986 : Standard Generalized Markup Language (ISO)!
Documentation
1969 : Generalized Markup Language (IBM)!
Documentation
HTML
4D Summit 2014 • Paris • Celebrating 30 years
GML
SGML
XML
1991 : Hypertext Markup Language (CERN/W3C)!
Hypertext documents
1998 : eXtensible Markup Language (W3C)!
Anything
1986 : Standard Generalized Markup Language (ISO)!
Documentation
1969 : Generalized Markup Language (IBM)!
Documentation
HTML
4D Summit 2014 • Paris • Celebrating 30 years
GML
SGML
XML
XHTML
2000 : XHTML (W3C)!
1991 : Hypertext Markup Language (CERN/W3C)!
Hypertext documents
1998 : eXtensible Markup Language (W3C)!
Anything
1986 : Standard Generalized Markup Language (ISO)!
Documentation
1969 : Generalized Markup Language (IBM)!
Documentation
HTML
4D Summit 2014 • Paris • Celebrating 30 years
GML
SGML
XML
XHTML
HTML5
2008 : HTML5 (WHATWG / W3C)
2000 : XHTML (W3C)!
1991 : Hypertext Markup Language (CERN/W3C)!
Hypertext documents
1998 : eXtensible Markup Language (W3C)!
Anything
1986 : Standard Generalized Markup Language (ISO)!
Documentation
1969 : Generalized Markup Language (IBM)!
Documentation
HTML
4D Summit 2014 • Paris • Celebrating 30 years
GML
SGML
XML
XHTML
HTML5
2008 : HTML5 (WHATWG / W3C)
2000 : XHTML (W3C)!
1991 : Hypertext Markup Language (CERN/W3C)!
Hypertext documents
1998 : eXtensible Markup Language (W3C)!
Anything
1986 : Standard Generalized Markup Language (ISO)!
Documentation
1969 : Generalized Markup Language (IBM)!
Documentation
SVG
MathML
HTML
4D Summit 2014 • Paris • Celebrating 30 years
XML / HTML
XML HTML
strict loose
4D Summit 2014 • Paris • Celebrating 30 years
XML / HTML
XML HTML
strict loose
case-sensitive case-insensitive
4D Summit 2014 • Paris • Celebrating 30 years
XML / HTML
XML HTML
strict loose
case-sensitive case-insensitive
<emptyTag/> <emptyTag>
4D Summit 2014 • Paris • Celebrating 30 years
XML / HTML
XML HTML
strict loose
case-sensitive case-insensitive
<emptyTag/> <emptyTag>
unlimited tags predefined tags
4D Summit 2014 • Paris • Celebrating 30 years
Why XML ?
4D Summit 2014 • Paris • Celebrating 30 years
Before xml
4D Summit 2014 • Paris • Celebrating 30 years
Before xml
• Flat text files
4D Summit 2014 • Paris • Celebrating 30 years
Before xml
• Flat text files
• csv
4D Summit 2014 • Paris • Celebrating 30 years
Before xml
• Flat text files
• csv
• Binary files
4D Summit 2014 • Paris • Celebrating 30 years
Before xml
• Flat text files
• csv
• Binary files
• Propriatery file formats
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml
• Meta markup language
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml
• Meta markup language
• Flexible data structure
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml
• Meta markup language
• Flexible data structure
• Text based
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml
• Meta markup language
• Flexible data structure
• Text based
• Self documented
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml
• Meta markup language
• Flexible data structure
• Text based
• Self documented
• Easy to read
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml
• Meta markup language
• Flexible data structure
• Text based
• Self documented
• Easy to read
• Strict
4D Summit 2014 • Paris • Celebrating 30 years
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
• Validity checking
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
• Validity checking
• Multiple encoding support (us-ascii, macroman,
windows1252, iso-8859-1, utf-8, etc...)
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
• Validity checking
• Multiple encoding support (us-ascii, macroman,
windows1252, iso-8859-1, utf-8, etc...)
• Introspection
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
• Validity checking
• Multiple encoding support (us-ascii, macroman,
windows1252, iso-8859-1, utf-8, etc...)
• Introspection
• Namespaces
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
• Validity checking
• Multiple encoding support (us-ascii, macroman,
windows1252, iso-8859-1, utf-8, etc...)
• Introspection
• Namespaces
• Rich toolset
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
• Validity checking
• Multiple encoding support (us-ascii, macroman,
windows1252, iso-8859-1, utf-8, etc...)
• Introspection
• Namespaces
• Rich toolset
• Compression friendly
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
• Validity checking
• Multiple encoding support (us-ascii, macroman,
windows1252, iso-8859-1, utf-8, etc...)
• Introspection
• Namespaces
• Rich toolset
• Compression friendly
• Comments
Advantages of xml (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
Examples
start tag end tag
attribute
4D Summit 2014 • Paris • Celebrating 30 years
Empty elements
4D Summit 2014 • Paris • Celebrating 30 years
Element vs Attribute
Element Attribute
Unique no yes
4D Summit 2014 • Paris • Celebrating 30 years
Element vs Attribute
Element Attribute
Unique no yes
Ordered yes no
4D Summit 2014 • Paris • Celebrating 30 years
Element vs Attribute
Element Attribute
Unique no yes
Ordered yes no
Can have children yes no
4D Summit 2014 • Paris • Celebrating 30 years
Element vs Attribute
Element Attribute
Unique no yes
Ordered yes no
Can have children yes no
Can have attributes yes no
4D Summit 2014 • Paris • Celebrating 30 years
Element vs Attribute
Element Attribute
Unique no yes
Ordered yes no
Can have children yes no
Can have attributes yes no
Normalized no yes
4D Summit 2014 • Paris • Celebrating 30 years
Hierarchy
4D Summit 2014 • Paris • Celebrating 30 years
Hierarchy
4D Summit 2014 • Paris • Celebrating 30 years
Common mistake
redundant information
4D Summit 2014 • Paris • Celebrating 30 years
XML document
4D Summit 2014 • Paris • Celebrating 30 years
XML document
prolog
4D Summit 2014 • Paris • Celebrating 30 years
XML document
prolog
xml declaration
4D Summit 2014 • Paris • Celebrating 30 years
XML document
prolog
xml declaration
Document type declaration
4D Summit 2014 • Paris • Celebrating 30 years
XML document
prolog
xml declaration
root element
Document type declaration
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
• Prolog is optional
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
• Prolog is optional
• XML declaration is optional
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
• Prolog is optional
• XML declaration is optional
• version is mandatory (usually “1.0”)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
• Prolog is optional
• XML declaration is optional
• version is mandatory (usually “1.0”)
• encoding is optional (default “UTF-8”)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
• Prolog is optional
• XML declaration is optional
• version is mandatory (usually “1.0”)
• encoding is optional (default “UTF-8”)
• standalone is optional (default “no”)
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
• Prolog is optional
• XML declaration is optional
• version is mandatory (usually “1.0”)
• encoding is optional (default “UTF-8”)
• standalone is optional (default “no”)
• DTD (Document Type Definition) is optional
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
XML prolog
• Prolog is optional
• XML declaration is optional
• version is mandatory (usually “1.0”)
• encoding is optional (default “UTF-8”)
• standalone is optional (default “no”)
• DTD (Document Type Definition) is optional
• Unicode BOM (Byte Order Mark) is allowed
<?xml version="1.0" encoding="UTF-8" standalone="no"?>

<!DOCTYPE html>

…
4D Summit 2014 • Paris • Celebrating 30 years
Comments
comments
4D Summit 2014 • Paris • Celebrating 30 years
Predefined entities
Name Character Unicode xml html
quot " U+0022 (34) xml 1.0 html 2.0
amp & U+0026 (38) xml 1.0 html 2.0
apos ' U+0027 (39) xml 1.0 xhtml 1.0
lt < U+003C (60) xml 1.0 html 2.0
gt > U+003E (62) xml 1.0 html 2.0
4D Summit 2014 • Paris • Celebrating 30 years
Character entity decimal :
Character entities
4D Summit 2014 • Paris • Celebrating 30 years
Character entity decimal :
Character entity hexadecimal :
Character entities
4D Summit 2014 • Paris • Celebrating 30 years
Character entity decimal :
Character entity hexadecimal :
Character entities
4D Summit 2014 • Paris • Celebrating 30 years
Custom entities
Declaration :
4D Summit 2014 • Paris • Celebrating 30 years
Custom entities
Declaration :
Usage :
4D Summit 2014 • Paris • Celebrating 30 years
Custom entities
Declaration :
Usage :
4D Summit 2014 • Paris • Celebrating 30 years
Namespace
Default namespace
4D Summit 2014 • Paris • Celebrating 30 years
Namespace
Default namespace
Custom namespace
4D Summit 2014 • Paris • Celebrating 30 years
Mixed content
4D Summit 2014 • Paris • Celebrating 30 years
Mixed content
4D Summit 2014 • Paris • Celebrating 30 years
PCDATA (parsed) vs CDATA (unparsed)
4D Summit 2014 • Paris • Celebrating 30 years
PCDATA (parsed) vs CDATA (unparsed)
4D Summit 2014 • Paris • Celebrating 30 years
PCDATA (parsed) vs CDATA (unparsed)
4D Summit 2014 • Paris • Celebrating 30 years
Validation
4D Summit 2014 • Paris • Celebrating 30 years
Validation
• “Well formed” : xml syntax is ok
4D Summit 2014 • Paris • Celebrating 30 years
Validation
• “Well formed” : xml syntax is ok
• Well formed is mandatory
4D Summit 2014 • Paris • Celebrating 30 years
Validation
• “Well formed” : xml syntax is ok
• Well formed is mandatory
• “Valid” : schema follows DTD or Schema (.xsd)
4D Summit 2014 • Paris • Celebrating 30 years
Validation
• “Well formed” : xml syntax is ok
• Well formed is mandatory
• “Valid” : schema follows DTD or Schema (.xsd)
• DTD or Schema describe the structure of an xml
document
4D Summit 2014 • Paris • Celebrating 30 years
Validation
• “Well formed” : xml syntax is ok
• Well formed is mandatory
• “Valid” : schema follows DTD or Schema (.xsd)
• DTD or Schema describe the structure of an xml
document
• Validation is optional (but it will make your code
simpler and more resilient)
4D Summit 2014 • Paris • Celebrating 30 years
DTD vs Schema
DTD Schema
Extension .dtd .xsd
4D Summit 2014 • Paris • Celebrating 30 years
DTD vs Schema
DTD Schema
Extension .dtd .xsd
Syntax specific xml
4D Summit 2014 • Paris • Celebrating 30 years
DTD vs Schema
DTD Schema
Extension .dtd .xsd
Syntax specific xml
Embedded possible no
4D Summit 2014 • Paris • Celebrating 30 years
DTD vs Schema
DTD Schema
Extension .dtd .xsd
Syntax specific xml
Embedded possible no
Flexibility good best
4D Summit 2014 • Paris • Celebrating 30 years
DTD vs Schema
DTD Schema
Extension .dtd .xsd
Syntax specific xml
Embedded possible no
Flexibility good best
Type checking limited powerful
4D Summit 2014 • Paris • Celebrating 30 years
DTD vs Schema
DTD Schema
Extension .dtd .xsd
Syntax specific xml
Embedded possible no
Flexibility good best
Type checking limited powerful
Custom entity yes no
4D Summit 2014 • Paris • Celebrating 30 years
DTD vs Schema
DTD Schema
Extension .dtd .xsd
Syntax specific xml
Embedded possible no
Flexibility good best
Type checking limited powerful
Custom entity yes no
Part of XML specs yes no
4D Summit 2014 • Paris • Celebrating 30 years
DTD example
4D Summit 2014 • Paris • Celebrating 30 years
External DTD example
4D Summit 2014 • Paris • Celebrating 30 years
Schema example
4D Summit 2014 • Paris • Celebrating 30 years
XPath
4D Summit 2014 • Paris • Celebrating 30 years
XPath
• XPath allows selection of nodes of an xml document with
expressions
4D Summit 2014 • Paris • Celebrating 30 years
XPath
• XPath allows selection of nodes of an xml document with
expressions
• Indexed selection
/children/child[2]
4D Summit 2014 • Paris • Celebrating 30 years
XPath
• XPath allows selection of nodes of an xml document with
expressions
• Indexed selection
/children/child[2]
• More powerful selection (functions, boolean operators, etc...)
/children/child[@name="Orville"]
4D Summit 2014 • Paris • Celebrating 30 years
XSLT
4D Summit 2014 • Paris • Celebrating 30 years
XSLT
• Extensible Stylesheet Language Transformations
4D Summit 2014 • Paris • Celebrating 30 years
XSLT
• Extensible Stylesheet Language Transformations
• XSLT purpose is to process an xml document and generate an
output (xml, html, text, etc...)
4D Summit 2014 • Paris • Celebrating 30 years
XSLT
• Extensible Stylesheet Language Transformations
• XSLT purpose is to process an xml document and generate an
output (xml, html, text, etc...)
• Relies on XPath
4D Summit 2014 • Paris • Celebrating 30 years
Storage
4D Summit 2014 • Paris • Celebrating 30 years
Storage
• Text or blob ?
4D Summit 2014 • Paris • Celebrating 30 years
Storage
• Text or blob ?
• Text encoding can be ambiguous if non Unicode is
used
4D Summit 2014 • Paris • Celebrating 30 years
Storage
• Text or blob ?
• Text encoding can be ambiguous if non Unicode is
used
• Blob can be compressed
4D Summit 2014 • Paris • Celebrating 30 years
Storage
• Text or blob ?
• Text encoding can be ambiguous if non Unicode is
used
• Blob can be compressed
• Check that your xml is well formed
4D Summit 2014 • Paris • Celebrating 30 years
Tools
4D Summit 2014 • Paris • Celebrating 30 years
Tools
4D Summit 2014 • Paris • Celebrating 30 years
Tools
• Basic text editor (TextEdit, Notepad, vi, etc...)
4D Summit 2014 • Paris • Celebrating 30 years
Tools
• Basic text editor (TextEdit, Notepad, vi, etc...)
• Advanced text editor (TextWrangler, Notepad++, etc...)
4D Summit 2014 • Paris • Celebrating 30 years
Tools
• Basic text editor (TextEdit, Notepad, vi, etc...)
• Advanced text editor (TextWrangler, Notepad++, etc...)
• XML Editor (oXygen, XMLSpy, etc...)
4D Summit 2014 • Paris • Celebrating 30 years
Tools
• Basic text editor (TextEdit, Notepad, vi, etc...)
• Advanced text editor (TextWrangler, Notepad++, etc...)
• XML Editor (oXygen, XMLSpy, etc...)
• xmllint (part of libxml2)
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
• Don’t treat xml as a text file, use xml commands
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
• Don’t treat xml as a text file, use xml commands
• 4D (SAX, DOM, Schemas, XSLT)
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
• Don’t treat xml as a text file, use xml commands
• 4D (SAX, DOM, Schemas, XSLT)
• SAX, DOM and Schemas : Xerces
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
• Don’t treat xml as a text file, use xml commands
• 4D (SAX, DOM, Schemas, XSLT)
• SAX, DOM and Schemas : Xerces
• XSLT : Xalan
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
• Don’t treat xml as a text file, use xml commands
• 4D (SAX, DOM, Schemas, XSLT)
• SAX, DOM and Schemas : Xerces
• XSLT : Xalan
• “XSLT plugin” (Miyako) : libxml
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
• Don’t treat xml as a text file, use xml commands
• 4D (SAX, DOM, Schemas, XSLT)
• SAX, DOM and Schemas : Xerces
• XSLT : Xalan
• “XSLT plugin” (Miyako) : libxml
• XML Plugin (Pluggers) : Libxml & Libxslt
4D Summit 2014 • Paris • Celebrating 30 years
Dealing with XML in 4D
• Don’t treat xml as a text file, use xml commands
• 4D (SAX, DOM, Schemas, XSLT)
• SAX, DOM and Schemas : Xerces
• XSLT : Xalan
• “XSLT plugin” (Miyako) : libxml
• XML Plugin (Pluggers) : Libxml & Libxslt
• Expat 4D (Mark Mitchenall) : based on Expat
4D Summit 2014 • Paris • Celebrating 30 years
SAX / DOM
4D Summit 2014 • Paris • Celebrating 30 years
SAX / DOM
• 4D has two parser APIs
4D Summit 2014 • Paris • Celebrating 30 years
SAX / DOM
• 4D has two parser APIs
• SAX : Simple API for XML
4D Summit 2014 • Paris • Celebrating 30 years
SAX / DOM
• 4D has two parser APIs
• SAX : Simple API for XML
• SAX parser reads a file sequentially
4D Summit 2014 • Paris • Celebrating 30 years
SAX / DOM
• 4D has two parser APIs
• SAX : Simple API for XML
• SAX parser reads a file sequentially
• DOM : Document Object Model
4D Summit 2014 • Paris • Celebrating 30 years
SAX / DOM
• 4D has two parser APIs
• SAX : Simple API for XML
• SAX parser reads a file sequentially
• DOM : Document Object Model
• W3C standard for xml and html
4D Summit 2014 • Paris • Celebrating 30 years
SAX / DOM
• 4D has two parser APIs
• SAX : Simple API for XML
• SAX parser reads a file sequentially
• DOM : Document Object Model
• W3C standard for xml and html
• DOM parser loads the xml “in memory”
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
Scalablity good limited
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
Scalablity good limited
Validation no yes
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
Scalablity good limited
Validation no yes
Xpath no yes
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
Scalablity good limited
Validation no yes
Xpath no yes
Type Read|Write Read+Write
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
Scalablity good limited
Validation no yes
Xpath no yes
Type Read|Write Read+Write
Modification no yes
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
Scalablity good limited
Validation no yes
Xpath no yes
Type Read|Write Read+Write
Modification no yes
Target File
File, text,
blob, http
4D Summit 2014 • Paris • Celebrating 30 years
SAX vs DOM
SAX DOM
Memory footprint small proportional
Document Size big small
Scalablity good limited
Validation no yes
Xpath no yes
Type Read|Write Read+Write
Modification no yes
Target File
File, text,
blob, http
* SAX is a read only API. 4D has a “SAX” parser/reader. 4D has also a sequential xml writer named “SAX”.
4D Summit 2014 • Paris • Celebrating 30 years
DOM with large XML...
4D Summit 2014 • Paris • Celebrating 30 years
SAX Examples
4D Summit 2014 • Paris • Celebrating 30 years
Sax parsing
4D Summit 2014 • Paris • Celebrating 30 years
Sax parsing
4D Summit 2014 • Paris • Celebrating 30 years
Sax writing
4D Summit 2014 • Paris • Celebrating 30 years
DOM Examples
4D Summit 2014 • Paris • Celebrating 30 years
Parse
4D Summit 2014 • Paris • Celebrating 30 years
Parse
4D Summit 2014 • Paris • Celebrating 30 years
HTTP get + parse
4D Summit 2014 • Paris • Celebrating 30 years
Sample xml
4D Summit 2014 • Paris • Celebrating 30 years
New xml document
4D Summit 2014 • Paris • Celebrating 30 years
Count all child elements
4D Summit 2014 • Paris • Celebrating 30 years
List all child elements
4D Summit 2014 • Paris • Celebrating 30 years
List all attributes
4D Summit 2014 • Paris • Celebrating 30 years
Pitfall
4D Summit 2014 • Paris • Celebrating 30 years
Pitfall
4D Summit 2014 • Paris • Celebrating 30 years
Pitfall
4D Summit 2014 • Paris • Celebrating 30 years
Pitfall
4D Summit 2014 • Paris • Celebrating 30 years
Process 4D Tags
4D Summit 2014 • Paris • Celebrating 30 years
Office file formats
4D Summit 2014 • Paris • Celebrating 30 years
Office file formats
OpenDocument Office Open XML
OASIS Microsoft
Open Office MS Office : Word, Excel
odf
WordML
SpreadsheetML
ooxml
2005 2003 2007
.odt, .ods,
etc...
.xml
.docx, .xlsx,
etc...
zip + xml xml zip + xml
4D Summit 2014 • Paris • Celebrating 30 years
SVG
4D Summit 2014 • Paris • Celebrating 30 years
SVG
4D Summit 2014 • Paris • Celebrating 30 years
SVG
• SVG :“ScalableVector Graphics” image format
4D Summit 2014 • Paris • Celebrating 30 years
SVG
• SVG :“ScalableVector Graphics” image format
• xml based
4D Summit 2014 • Paris • Celebrating 30 years
SVG
• SVG :“ScalableVector Graphics” image format
• xml based
• Light, scales smoothly
4D Summit 2014 • Paris • Celebrating 30 years
SVG
• SVG :“ScalableVector Graphics” image format
• xml based
• Light, scales smoothly
• Supported in most modern browser
4D Summit 2014 • Paris • Celebrating 30 years
SVG
• SVG :“ScalableVector Graphics” image format
• xml based
• Light, scales smoothly
• Supported in most modern browser
• Supported in 4D (natively)
4D Summit 2014 • Paris • Celebrating 30 years
SVG
• SVG :“ScalableVector Graphics” image format
• xml based
• Light, scales smoothly
• Supported in most modern browser
• Supported in 4D (natively)
• 4D provides “SVG Component” and “SVG Area”
4D Summit 2014 • Paris • Celebrating 30 years
SVG example
4D Summit 2014 • Paris • Celebrating 30 years
SVG example
4D Summit 2014 • Paris • Celebrating 30 years
SVG in plain 4D
4D Summit 2014 • Paris • Celebrating 30 years
SVG with “4D SVG”
component
4D Summit 2014 • Paris • Celebrating 30 years
C_OBJET and
JSON
4D Summit 2014 • Paris • Celebrating 30 years
JSON format
4D Summit 2014 • Paris • Celebrating 30 years
JSON format
4D Summit 2014 • Paris • Celebrating 30 years
JSON format
4D Summit 2014 • Paris • Celebrating 30 years
JSON format
4D Summit 2014 • Paris • Celebrating 30 years
JSON example
<children><child dob="1867-04-16" name="Wilbur"/><child dob="1871-08-19" name="Orville"/></children>
{"child":[{"name":"Orville","dob":"1871-08-19"},{"name":"Orville","dob":"1871-08-19"}]}
JSON :
XML :
JSON compact :
XML compact :
4D Summit 2014 • Paris • Celebrating 30 years
C_OBJECT to JSON
code
4D Summit 2014 • Paris • Celebrating 30 years
JSON to C_OBJECT
code
4D Summit 2014 • Paris • Celebrating 30 years
Can C_OBJECT work
with XML ?
4D Summit 2014 • Paris • Celebrating 30 years
C_OBJECT to XML
code
4D Summit 2014 • Paris • Celebrating 30 years
C_OBJECT to XML
code (cont.)
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
Encoding many utf-8
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
Encoding many utf-8
Comments yes no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
Encoding many utf-8
Comments yes no
Mixed mode yes no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
Encoding many utf-8
Comments yes no
Mixed mode yes no
Namespace yes no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
Encoding many utf-8
Comments yes no
Mixed mode yes no
Namespace yes no
Conformity dtd, schema no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
Encoding many utf-8
Comments yes no
Mixed mode yes no
Namespace yes no
Conformity dtd, schema no
Direct Access yes (xpath) no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON
XML JSON
Approach tree list
Arrays no yes
Encoding many utf-8
Comments yes no
Mixed mode yes no
Namespace yes no
Conformity dtd, schema no
Direct Access yes (xpath) no
Transformation yes (xslt) no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON (in 4D)
XML JSON
Debugger friendly no yes
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON (in 4D)
XML JSON
Debugger friendly no yes
Native type no yes
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON (in 4D)
XML JSON
Debugger friendly no yes
Native type no yes
Memory leak possible no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON (in 4D)
XML JSON
Debugger friendly no yes
Native type no yes
Memory leak possible no
Large documents yes (sax) no
4D Summit 2014 • Paris • Celebrating 30 years
XML vs JSON (in 4D)
XML JSON
Debugger friendly no yes
Native type no yes
Memory leak possible no
Large documents yes (sax) no
Available since 4D v2003 4D v14
4D Summit 2014 • Paris • Celebrating 30 years
Does JSON make XML
obsolete ?
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
• XML is an industry standard
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
• XML is an industry standard
• XML has rich tool set
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
• XML is an industry standard
• XML has rich tool set
• JSON features are a subset of XML features
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
• XML is an industry standard
• XML has rich tool set
• JSON features are a subset of XML features
• JSON is relevant in a “small” subset of XML
“market” (web 2.0, web-services)
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
• XML is an industry standard
• XML has rich tool set
• JSON features are a subset of XML features
• JSON is relevant in a “small” subset of XML
“market” (web 2.0, web-services)
• Performance gain should be measured not guessed
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
• XML is an industry standard
• XML has rich tool set
• JSON features are a subset of XML features
• JSON is relevant in a “small” subset of XML
“market” (web 2.0, web-services)
• Performance gain should be measured not guessed
• Web-Services APIs can provide both XML and JSON
4D Summit 2014 • Paris • Celebrating 30 years
Why XML is still
relevant
• XML is an industry standard
• XML has rich tool set
• JSON features are a subset of XML features
• JSON is relevant in a “small” subset of XML
“market” (web 2.0, web-services)
• Performance gain should be measured not guessed
• Web-Services APIs can provide both XML and JSON
• Choice is good
4D Summit 2014 • Paris • Celebrating 30 years
Demonstration
4D Summit 2014 • Paris • Celebrating 30 years
Thank you!
http://www.w3.org/TR/xml/
http://www.w3.org/TR/xml11/
http://www.w3schools.com
http://www.oxygenxml.com/
http://www.saxproject.org
https://github.com/miyako/4d-plugin-xslt
4D Summit 2014 • Paris • Celebrating 30 years
Thank you!
Bruno LEGAY
Responsable Bureau d’Etudes
A&C Consulting
www.ac-consulting.fr

More Related Content

Viewers also liked

Viewers also liked (10)

4D Summit2013 refactoring
4D Summit2013 refactoring4D Summit2013 refactoring
4D Summit2013 refactoring
 
Xml
XmlXml
Xml
 
Xml
XmlXml
Xml
 
XML's validation - XML Schema
XML's validation - XML SchemaXML's validation - XML Schema
XML's validation - XML Schema
 
XML Schema (2002)
XML Schema (2002)XML Schema (2002)
XML Schema (2002)
 
XML
XMLXML
XML
 
Xsd examples
Xsd examplesXsd examples
Xsd examples
 
XML
XMLXML
XML
 
Webservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and RESTWebservices Overview : XML RPC, SOAP and REST
Webservices Overview : XML RPC, SOAP and REST
 
XML, DTD & XSD Overview
XML, DTD & XSD OverviewXML, DTD & XSD Overview
XML, DTD & XSD Overview
 

Similar to 4D Summit Europe 2014 - Conférence d'A&C Consulting "XML Demystified"

Web & Apps Design for Mobile Devices
Web & Apps Design for Mobile DevicesWeb & Apps Design for Mobile Devices
Web & Apps Design for Mobile Devices
lerichard
 

Similar to 4D Summit Europe 2014 - Conférence d'A&C Consulting "XML Demystified" (20)

Go from a PHP Perspective
Go from a PHP PerspectiveGo from a PHP Perspective
Go from a PHP Perspective
 
ION Cape Town - IETF Update and How to Get Involved
ION Cape Town - IETF Update and How to Get InvolvedION Cape Town - IETF Update and How to Get Involved
ION Cape Town - IETF Update and How to Get Involved
 
ION Belfast - IETF Update - Chris Grundemann
ION Belfast - IETF Update - Chris GrundemannION Belfast - IETF Update - Chris Grundemann
ION Belfast - IETF Update - Chris Grundemann
 
Rudder: what's new and what's next? Roadmap, vision and thoughts
Rudder: what's new and what's next? Roadmap, vision and thoughtsRudder: what's new and what's next? Roadmap, vision and thoughts
Rudder: what's new and what's next? Roadmap, vision and thoughts
 
Galichet XML Workflow Brief History NISO
Galichet XML Workflow Brief History NISOGalichet XML Workflow Brief History NISO
Galichet XML Workflow Brief History NISO
 
Automatic transcription of video files sig media
Automatic transcription of video files   sig mediaAutomatic transcription of video files   sig media
Automatic transcription of video files sig media
 
Galichet XML for Standards Publishers October 9
Galichet XML for Standards Publishers October 9Galichet XML for Standards Publishers October 9
Galichet XML for Standards Publishers October 9
 
Using VIM for PHP/Symfony development
Using VIM for PHP/Symfony developmentUsing VIM for PHP/Symfony development
Using VIM for PHP/Symfony development
 
DrupalCon Austin - Absolute Beginner's Guide to Drupal
DrupalCon Austin - Absolute Beginner's Guide to DrupalDrupalCon Austin - Absolute Beginner's Guide to Drupal
DrupalCon Austin - Absolute Beginner's Guide to Drupal
 
Introduction to Digital Humanities: Metadata standards and ontologies
Introduction to Digital Humanities: Metadata standards and ontologies Introduction to Digital Humanities: Metadata standards and ontologies
Introduction to Digital Humanities: Metadata standards and ontologies
 
Why I don't use Semantic Web technologies anymore, event if they still influe...
Why I don't use Semantic Web technologies anymore, event if they still influe...Why I don't use Semantic Web technologies anymore, event if they still influe...
Why I don't use Semantic Web technologies anymore, event if they still influe...
 
The Catalan Research portal: ready to go
The Catalan Research portal: ready to goThe Catalan Research portal: ready to go
The Catalan Research portal: ready to go
 
FluentD for end to end monitoring
FluentD for end to end monitoringFluentD for end to end monitoring
FluentD for end to end monitoring
 
Ci/CD platform with drone and gogs
Ci/CD platform with drone and gogsCi/CD platform with drone and gogs
Ci/CD platform with drone and gogs
 
Lean and Collaborative Content - Workshop
Lean and Collaborative Content - WorkshopLean and Collaborative Content - Workshop
Lean and Collaborative Content - Workshop
 
2018-10-23 7 A - All about documents in Office 365 - Sébastien Paulet
2018-10-23 7 A - All about documents in Office 365 - Sébastien Paulet2018-10-23 7 A - All about documents in Office 365 - Sébastien Paulet
2018-10-23 7 A - All about documents in Office 365 - Sébastien Paulet
 
GraphTalk Wien - Intelligente Lösungen mit Graphen erstellen
GraphTalk Wien - Intelligente Lösungen mit Graphen erstellenGraphTalk Wien - Intelligente Lösungen mit Graphen erstellen
GraphTalk Wien - Intelligente Lösungen mit Graphen erstellen
 
Overview of the SPARQL-Generate language and latest developments
Overview of the SPARQL-Generate language and latest developmentsOverview of the SPARQL-Generate language and latest developments
Overview of the SPARQL-Generate language and latest developments
 
Web & Apps Design for Mobile Devices
Web & Apps Design for Mobile DevicesWeb & Apps Design for Mobile Devices
Web & Apps Design for Mobile Devices
 
Building search and discovery services for Schibsted (LSRS '17)
Building search and discovery services for Schibsted (LSRS '17)Building search and discovery services for Schibsted (LSRS '17)
Building search and discovery services for Schibsted (LSRS '17)
 

Recently uploaded

Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
vu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
giselly40
 

Recently uploaded (20)

Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
04-2024-HHUG-Sales-and-Marketing-Alignment.pptx
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024A Call to Action for Generative AI in 2024
A Call to Action for Generative AI in 2024
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
Advantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your BusinessAdvantages of Hiring UIUX Design Service Providers for Your Business
Advantages of Hiring UIUX Design Service Providers for Your Business
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 

4D Summit Europe 2014 - Conférence d'A&C Consulting "XML Demystified"

  • 2. 4D Summit 2014 • Paris • Celebrating 30 years Bruno LEGAY Responsable Bureau d’Etudes A&C Consulting www.ac-consulting.fr
  • 3. 4D Summit 2014 • Paris • Celebrating 30 years What is xml ?
  • 4. 4D Summit 2014 • Paris • Celebrating 30 years What is xml ? • Markup langage
  • 5. 4D Summit 2014 • Paris • Celebrating 30 years What is xml ? • Markup langage • Serialization
  • 6. 4D Summit 2014 • Paris • Celebrating 30 years What is xml ? • Markup langage • Serialization • Data structure
  • 7. 4D Summit 2014 • Paris • Celebrating 30 years What is xml ? • Markup langage • Serialization • Data structure • Data exchange
  • 8. 4D Summit 2014 • Paris • Celebrating 30 years What is xml ? • Markup langage • Serialization • Data structure • Data exchange • Data storage
  • 9. 4D Summit 2014 • Paris • Celebrating 30 years Where is xml ?
  • 10. 4D Summit 2014 • Paris • Celebrating 30 years Where is xml ? • Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom, Rest, xhtml)
  • 11. 4D Summit 2014 • Paris • Celebrating 30 years Where is xml ? • Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom, Rest, xhtml) • Office documents
  • 12. 4D Summit 2014 • Paris • Celebrating 30 years Where is xml ? • Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom, Rest, xhtml) • Office documents • User interface (XUL/XAML)
  • 13. 4D Summit 2014 • Paris • Celebrating 30 years Where is xml ? • Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom, Rest, xhtml) • Office documents • User interface (XUL/XAML) • Preference files (4D, OS X, etc...)
  • 14. 4D Summit 2014 • Paris • Celebrating 30 years Where is xml ? • Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom, Rest, xhtml) • Office documents • User interface (XUL/XAML) • Preference files (4D, OS X, etc...) • Svg
  • 15. 4D Summit 2014 • Paris • Celebrating 30 years Where is xml ? • Web (xml-rpc, web-services/SOAP,Ajax, Rss, Atom, Rest, xhtml) • Office documents • User interface (XUL/XAML) • Preference files (4D, OS X, etc...) • Svg • etc...
  • 16. 4D Summit 2014 • Paris • Celebrating 30 years History of XML Where does it come from ?
  • 17. 4D Summit 2014 • Paris • Celebrating 30 years
  • 18. 4D Summit 2014 • Paris • Celebrating 30 years GML 1969 : Generalized Markup Language (IBM)! Documentation
  • 19. 4D Summit 2014 • Paris • Celebrating 30 years GML SGML 1986 : Standard Generalized Markup Language (ISO)! Documentation 1969 : Generalized Markup Language (IBM)! Documentation
  • 20. 4D Summit 2014 • Paris • Celebrating 30 years GML SGML 1991 : Hypertext Markup Language (CERN/W3C)! Hypertext documents 1986 : Standard Generalized Markup Language (ISO)! Documentation 1969 : Generalized Markup Language (IBM)! Documentation HTML
  • 21. 4D Summit 2014 • Paris • Celebrating 30 years GML SGML XML 1991 : Hypertext Markup Language (CERN/W3C)! Hypertext documents 1998 : eXtensible Markup Language (W3C)! Anything 1986 : Standard Generalized Markup Language (ISO)! Documentation 1969 : Generalized Markup Language (IBM)! Documentation HTML
  • 22. 4D Summit 2014 • Paris • Celebrating 30 years GML SGML XML XHTML 2000 : XHTML (W3C)! 1991 : Hypertext Markup Language (CERN/W3C)! Hypertext documents 1998 : eXtensible Markup Language (W3C)! Anything 1986 : Standard Generalized Markup Language (ISO)! Documentation 1969 : Generalized Markup Language (IBM)! Documentation HTML
  • 23. 4D Summit 2014 • Paris • Celebrating 30 years GML SGML XML XHTML HTML5 2008 : HTML5 (WHATWG / W3C) 2000 : XHTML (W3C)! 1991 : Hypertext Markup Language (CERN/W3C)! Hypertext documents 1998 : eXtensible Markup Language (W3C)! Anything 1986 : Standard Generalized Markup Language (ISO)! Documentation 1969 : Generalized Markup Language (IBM)! Documentation HTML
  • 24. 4D Summit 2014 • Paris • Celebrating 30 years GML SGML XML XHTML HTML5 2008 : HTML5 (WHATWG / W3C) 2000 : XHTML (W3C)! 1991 : Hypertext Markup Language (CERN/W3C)! Hypertext documents 1998 : eXtensible Markup Language (W3C)! Anything 1986 : Standard Generalized Markup Language (ISO)! Documentation 1969 : Generalized Markup Language (IBM)! Documentation SVG MathML HTML
  • 25. 4D Summit 2014 • Paris • Celebrating 30 years XML / HTML XML HTML strict loose
  • 26. 4D Summit 2014 • Paris • Celebrating 30 years XML / HTML XML HTML strict loose case-sensitive case-insensitive
  • 27. 4D Summit 2014 • Paris • Celebrating 30 years XML / HTML XML HTML strict loose case-sensitive case-insensitive <emptyTag/> <emptyTag>
  • 28. 4D Summit 2014 • Paris • Celebrating 30 years XML / HTML XML HTML strict loose case-sensitive case-insensitive <emptyTag/> <emptyTag> unlimited tags predefined tags
  • 29. 4D Summit 2014 • Paris • Celebrating 30 years Why XML ?
  • 30. 4D Summit 2014 • Paris • Celebrating 30 years Before xml
  • 31. 4D Summit 2014 • Paris • Celebrating 30 years Before xml • Flat text files
  • 32. 4D Summit 2014 • Paris • Celebrating 30 years Before xml • Flat text files • csv
  • 33. 4D Summit 2014 • Paris • Celebrating 30 years Before xml • Flat text files • csv • Binary files
  • 34. 4D Summit 2014 • Paris • Celebrating 30 years Before xml • Flat text files • csv • Binary files • Propriatery file formats
  • 35. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml
  • 36. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml • Meta markup language
  • 37. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml • Meta markup language • Flexible data structure
  • 38. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml • Meta markup language • Flexible data structure • Text based
  • 39. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml • Meta markup language • Flexible data structure • Text based • Self documented
  • 40. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml • Meta markup language • Flexible data structure • Text based • Self documented • Easy to read
  • 41. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml • Meta markup language • Flexible data structure • Text based • Self documented • Easy to read • Strict
  • 42. 4D Summit 2014 • Paris • Celebrating 30 years Advantages of xml (cont.)
  • 43. 4D Summit 2014 • Paris • Celebrating 30 years • Validity checking Advantages of xml (cont.)
  • 44. 4D Summit 2014 • Paris • Celebrating 30 years • Validity checking • Multiple encoding support (us-ascii, macroman, windows1252, iso-8859-1, utf-8, etc...) Advantages of xml (cont.)
  • 45. 4D Summit 2014 • Paris • Celebrating 30 years • Validity checking • Multiple encoding support (us-ascii, macroman, windows1252, iso-8859-1, utf-8, etc...) • Introspection Advantages of xml (cont.)
  • 46. 4D Summit 2014 • Paris • Celebrating 30 years • Validity checking • Multiple encoding support (us-ascii, macroman, windows1252, iso-8859-1, utf-8, etc...) • Introspection • Namespaces Advantages of xml (cont.)
  • 47. 4D Summit 2014 • Paris • Celebrating 30 years • Validity checking • Multiple encoding support (us-ascii, macroman, windows1252, iso-8859-1, utf-8, etc...) • Introspection • Namespaces • Rich toolset Advantages of xml (cont.)
  • 48. 4D Summit 2014 • Paris • Celebrating 30 years • Validity checking • Multiple encoding support (us-ascii, macroman, windows1252, iso-8859-1, utf-8, etc...) • Introspection • Namespaces • Rich toolset • Compression friendly Advantages of xml (cont.)
  • 49. 4D Summit 2014 • Paris • Celebrating 30 years • Validity checking • Multiple encoding support (us-ascii, macroman, windows1252, iso-8859-1, utf-8, etc...) • Introspection • Namespaces • Rich toolset • Compression friendly • Comments Advantages of xml (cont.)
  • 50. 4D Summit 2014 • Paris • Celebrating 30 years Examples start tag end tag attribute
  • 51. 4D Summit 2014 • Paris • Celebrating 30 years Empty elements
  • 52. 4D Summit 2014 • Paris • Celebrating 30 years Element vs Attribute Element Attribute Unique no yes
  • 53. 4D Summit 2014 • Paris • Celebrating 30 years Element vs Attribute Element Attribute Unique no yes Ordered yes no
  • 54. 4D Summit 2014 • Paris • Celebrating 30 years Element vs Attribute Element Attribute Unique no yes Ordered yes no Can have children yes no
  • 55. 4D Summit 2014 • Paris • Celebrating 30 years Element vs Attribute Element Attribute Unique no yes Ordered yes no Can have children yes no Can have attributes yes no
  • 56. 4D Summit 2014 • Paris • Celebrating 30 years Element vs Attribute Element Attribute Unique no yes Ordered yes no Can have children yes no Can have attributes yes no Normalized no yes
  • 57. 4D Summit 2014 • Paris • Celebrating 30 years Hierarchy
  • 58. 4D Summit 2014 • Paris • Celebrating 30 years Hierarchy
  • 59. 4D Summit 2014 • Paris • Celebrating 30 years Common mistake redundant information
  • 60. 4D Summit 2014 • Paris • Celebrating 30 years XML document
  • 61. 4D Summit 2014 • Paris • Celebrating 30 years XML document prolog
  • 62. 4D Summit 2014 • Paris • Celebrating 30 years XML document prolog xml declaration
  • 63. 4D Summit 2014 • Paris • Celebrating 30 years XML document prolog xml declaration Document type declaration
  • 64. 4D Summit 2014 • Paris • Celebrating 30 years XML document prolog xml declaration root element Document type declaration
  • 65. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 66. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog • Prolog is optional <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 67. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog • Prolog is optional • XML declaration is optional <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 68. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog • Prolog is optional • XML declaration is optional • version is mandatory (usually “1.0”) <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 69. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog • Prolog is optional • XML declaration is optional • version is mandatory (usually “1.0”) • encoding is optional (default “UTF-8”) <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 70. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog • Prolog is optional • XML declaration is optional • version is mandatory (usually “1.0”) • encoding is optional (default “UTF-8”) • standalone is optional (default “no”) <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 71. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog • Prolog is optional • XML declaration is optional • version is mandatory (usually “1.0”) • encoding is optional (default “UTF-8”) • standalone is optional (default “no”) • DTD (Document Type Definition) is optional <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 72. 4D Summit 2014 • Paris • Celebrating 30 years XML prolog • Prolog is optional • XML declaration is optional • version is mandatory (usually “1.0”) • encoding is optional (default “UTF-8”) • standalone is optional (default “no”) • DTD (Document Type Definition) is optional • Unicode BOM (Byte Order Mark) is allowed <?xml version="1.0" encoding="UTF-8" standalone="no"?>
 <!DOCTYPE html>
 …
  • 73. 4D Summit 2014 • Paris • Celebrating 30 years Comments comments
  • 74. 4D Summit 2014 • Paris • Celebrating 30 years Predefined entities Name Character Unicode xml html quot " U+0022 (34) xml 1.0 html 2.0 amp & U+0026 (38) xml 1.0 html 2.0 apos ' U+0027 (39) xml 1.0 xhtml 1.0 lt < U+003C (60) xml 1.0 html 2.0 gt > U+003E (62) xml 1.0 html 2.0
  • 75. 4D Summit 2014 • Paris • Celebrating 30 years Character entity decimal : Character entities
  • 76. 4D Summit 2014 • Paris • Celebrating 30 years Character entity decimal : Character entity hexadecimal : Character entities
  • 77. 4D Summit 2014 • Paris • Celebrating 30 years Character entity decimal : Character entity hexadecimal : Character entities
  • 78. 4D Summit 2014 • Paris • Celebrating 30 years Custom entities Declaration :
  • 79. 4D Summit 2014 • Paris • Celebrating 30 years Custom entities Declaration : Usage :
  • 80. 4D Summit 2014 • Paris • Celebrating 30 years Custom entities Declaration : Usage :
  • 81. 4D Summit 2014 • Paris • Celebrating 30 years Namespace Default namespace
  • 82. 4D Summit 2014 • Paris • Celebrating 30 years Namespace Default namespace Custom namespace
  • 83. 4D Summit 2014 • Paris • Celebrating 30 years Mixed content
  • 84. 4D Summit 2014 • Paris • Celebrating 30 years Mixed content
  • 85. 4D Summit 2014 • Paris • Celebrating 30 years PCDATA (parsed) vs CDATA (unparsed)
  • 86. 4D Summit 2014 • Paris • Celebrating 30 years PCDATA (parsed) vs CDATA (unparsed)
  • 87. 4D Summit 2014 • Paris • Celebrating 30 years PCDATA (parsed) vs CDATA (unparsed)
  • 88. 4D Summit 2014 • Paris • Celebrating 30 years Validation
  • 89. 4D Summit 2014 • Paris • Celebrating 30 years Validation • “Well formed” : xml syntax is ok
  • 90. 4D Summit 2014 • Paris • Celebrating 30 years Validation • “Well formed” : xml syntax is ok • Well formed is mandatory
  • 91. 4D Summit 2014 • Paris • Celebrating 30 years Validation • “Well formed” : xml syntax is ok • Well formed is mandatory • “Valid” : schema follows DTD or Schema (.xsd)
  • 92. 4D Summit 2014 • Paris • Celebrating 30 years Validation • “Well formed” : xml syntax is ok • Well formed is mandatory • “Valid” : schema follows DTD or Schema (.xsd) • DTD or Schema describe the structure of an xml document
  • 93. 4D Summit 2014 • Paris • Celebrating 30 years Validation • “Well formed” : xml syntax is ok • Well formed is mandatory • “Valid” : schema follows DTD or Schema (.xsd) • DTD or Schema describe the structure of an xml document • Validation is optional (but it will make your code simpler and more resilient)
  • 94. 4D Summit 2014 • Paris • Celebrating 30 years DTD vs Schema DTD Schema Extension .dtd .xsd
  • 95. 4D Summit 2014 • Paris • Celebrating 30 years DTD vs Schema DTD Schema Extension .dtd .xsd Syntax specific xml
  • 96. 4D Summit 2014 • Paris • Celebrating 30 years DTD vs Schema DTD Schema Extension .dtd .xsd Syntax specific xml Embedded possible no
  • 97. 4D Summit 2014 • Paris • Celebrating 30 years DTD vs Schema DTD Schema Extension .dtd .xsd Syntax specific xml Embedded possible no Flexibility good best
  • 98. 4D Summit 2014 • Paris • Celebrating 30 years DTD vs Schema DTD Schema Extension .dtd .xsd Syntax specific xml Embedded possible no Flexibility good best Type checking limited powerful
  • 99. 4D Summit 2014 • Paris • Celebrating 30 years DTD vs Schema DTD Schema Extension .dtd .xsd Syntax specific xml Embedded possible no Flexibility good best Type checking limited powerful Custom entity yes no
  • 100. 4D Summit 2014 • Paris • Celebrating 30 years DTD vs Schema DTD Schema Extension .dtd .xsd Syntax specific xml Embedded possible no Flexibility good best Type checking limited powerful Custom entity yes no Part of XML specs yes no
  • 101. 4D Summit 2014 • Paris • Celebrating 30 years DTD example
  • 102. 4D Summit 2014 • Paris • Celebrating 30 years External DTD example
  • 103. 4D Summit 2014 • Paris • Celebrating 30 years Schema example
  • 104. 4D Summit 2014 • Paris • Celebrating 30 years XPath
  • 105. 4D Summit 2014 • Paris • Celebrating 30 years XPath • XPath allows selection of nodes of an xml document with expressions
  • 106. 4D Summit 2014 • Paris • Celebrating 30 years XPath • XPath allows selection of nodes of an xml document with expressions • Indexed selection /children/child[2]
  • 107. 4D Summit 2014 • Paris • Celebrating 30 years XPath • XPath allows selection of nodes of an xml document with expressions • Indexed selection /children/child[2] • More powerful selection (functions, boolean operators, etc...) /children/child[@name="Orville"]
  • 108. 4D Summit 2014 • Paris • Celebrating 30 years XSLT
  • 109. 4D Summit 2014 • Paris • Celebrating 30 years XSLT • Extensible Stylesheet Language Transformations
  • 110. 4D Summit 2014 • Paris • Celebrating 30 years XSLT • Extensible Stylesheet Language Transformations • XSLT purpose is to process an xml document and generate an output (xml, html, text, etc...)
  • 111. 4D Summit 2014 • Paris • Celebrating 30 years XSLT • Extensible Stylesheet Language Transformations • XSLT purpose is to process an xml document and generate an output (xml, html, text, etc...) • Relies on XPath
  • 112. 4D Summit 2014 • Paris • Celebrating 30 years Storage
  • 113. 4D Summit 2014 • Paris • Celebrating 30 years Storage • Text or blob ?
  • 114. 4D Summit 2014 • Paris • Celebrating 30 years Storage • Text or blob ? • Text encoding can be ambiguous if non Unicode is used
  • 115. 4D Summit 2014 • Paris • Celebrating 30 years Storage • Text or blob ? • Text encoding can be ambiguous if non Unicode is used • Blob can be compressed
  • 116. 4D Summit 2014 • Paris • Celebrating 30 years Storage • Text or blob ? • Text encoding can be ambiguous if non Unicode is used • Blob can be compressed • Check that your xml is well formed
  • 117. 4D Summit 2014 • Paris • Celebrating 30 years Tools
  • 118. 4D Summit 2014 • Paris • Celebrating 30 years Tools
  • 119. 4D Summit 2014 • Paris • Celebrating 30 years Tools • Basic text editor (TextEdit, Notepad, vi, etc...)
  • 120. 4D Summit 2014 • Paris • Celebrating 30 years Tools • Basic text editor (TextEdit, Notepad, vi, etc...) • Advanced text editor (TextWrangler, Notepad++, etc...)
  • 121. 4D Summit 2014 • Paris • Celebrating 30 years Tools • Basic text editor (TextEdit, Notepad, vi, etc...) • Advanced text editor (TextWrangler, Notepad++, etc...) • XML Editor (oXygen, XMLSpy, etc...)
  • 122. 4D Summit 2014 • Paris • Celebrating 30 years Tools • Basic text editor (TextEdit, Notepad, vi, etc...) • Advanced text editor (TextWrangler, Notepad++, etc...) • XML Editor (oXygen, XMLSpy, etc...) • xmllint (part of libxml2)
  • 123. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D
  • 124. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D • Don’t treat xml as a text file, use xml commands
  • 125. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D • Don’t treat xml as a text file, use xml commands • 4D (SAX, DOM, Schemas, XSLT)
  • 126. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D • Don’t treat xml as a text file, use xml commands • 4D (SAX, DOM, Schemas, XSLT) • SAX, DOM and Schemas : Xerces
  • 127. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D • Don’t treat xml as a text file, use xml commands • 4D (SAX, DOM, Schemas, XSLT) • SAX, DOM and Schemas : Xerces • XSLT : Xalan
  • 128. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D • Don’t treat xml as a text file, use xml commands • 4D (SAX, DOM, Schemas, XSLT) • SAX, DOM and Schemas : Xerces • XSLT : Xalan • “XSLT plugin” (Miyako) : libxml
  • 129. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D • Don’t treat xml as a text file, use xml commands • 4D (SAX, DOM, Schemas, XSLT) • SAX, DOM and Schemas : Xerces • XSLT : Xalan • “XSLT plugin” (Miyako) : libxml • XML Plugin (Pluggers) : Libxml & Libxslt
  • 130. 4D Summit 2014 • Paris • Celebrating 30 years Dealing with XML in 4D • Don’t treat xml as a text file, use xml commands • 4D (SAX, DOM, Schemas, XSLT) • SAX, DOM and Schemas : Xerces • XSLT : Xalan • “XSLT plugin” (Miyako) : libxml • XML Plugin (Pluggers) : Libxml & Libxslt • Expat 4D (Mark Mitchenall) : based on Expat
  • 131. 4D Summit 2014 • Paris • Celebrating 30 years SAX / DOM
  • 132. 4D Summit 2014 • Paris • Celebrating 30 years SAX / DOM • 4D has two parser APIs
  • 133. 4D Summit 2014 • Paris • Celebrating 30 years SAX / DOM • 4D has two parser APIs • SAX : Simple API for XML
  • 134. 4D Summit 2014 • Paris • Celebrating 30 years SAX / DOM • 4D has two parser APIs • SAX : Simple API for XML • SAX parser reads a file sequentially
  • 135. 4D Summit 2014 • Paris • Celebrating 30 years SAX / DOM • 4D has two parser APIs • SAX : Simple API for XML • SAX parser reads a file sequentially • DOM : Document Object Model
  • 136. 4D Summit 2014 • Paris • Celebrating 30 years SAX / DOM • 4D has two parser APIs • SAX : Simple API for XML • SAX parser reads a file sequentially • DOM : Document Object Model • W3C standard for xml and html
  • 137. 4D Summit 2014 • Paris • Celebrating 30 years SAX / DOM • 4D has two parser APIs • SAX : Simple API for XML • SAX parser reads a file sequentially • DOM : Document Object Model • W3C standard for xml and html • DOM parser loads the xml “in memory”
  • 138. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional
  • 139. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small
  • 140. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small Scalablity good limited
  • 141. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small Scalablity good limited Validation no yes
  • 142. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small Scalablity good limited Validation no yes Xpath no yes
  • 143. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small Scalablity good limited Validation no yes Xpath no yes Type Read|Write Read+Write
  • 144. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small Scalablity good limited Validation no yes Xpath no yes Type Read|Write Read+Write Modification no yes
  • 145. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small Scalablity good limited Validation no yes Xpath no yes Type Read|Write Read+Write Modification no yes Target File File, text, blob, http
  • 146. 4D Summit 2014 • Paris • Celebrating 30 years SAX vs DOM SAX DOM Memory footprint small proportional Document Size big small Scalablity good limited Validation no yes Xpath no yes Type Read|Write Read+Write Modification no yes Target File File, text, blob, http * SAX is a read only API. 4D has a “SAX” parser/reader. 4D has also a sequential xml writer named “SAX”.
  • 147. 4D Summit 2014 • Paris • Celebrating 30 years DOM with large XML...
  • 148. 4D Summit 2014 • Paris • Celebrating 30 years SAX Examples
  • 149. 4D Summit 2014 • Paris • Celebrating 30 years Sax parsing
  • 150. 4D Summit 2014 • Paris • Celebrating 30 years Sax parsing
  • 151. 4D Summit 2014 • Paris • Celebrating 30 years Sax writing
  • 152. 4D Summit 2014 • Paris • Celebrating 30 years DOM Examples
  • 153. 4D Summit 2014 • Paris • Celebrating 30 years Parse
  • 154. 4D Summit 2014 • Paris • Celebrating 30 years Parse
  • 155. 4D Summit 2014 • Paris • Celebrating 30 years HTTP get + parse
  • 156. 4D Summit 2014 • Paris • Celebrating 30 years Sample xml
  • 157. 4D Summit 2014 • Paris • Celebrating 30 years New xml document
  • 158. 4D Summit 2014 • Paris • Celebrating 30 years Count all child elements
  • 159. 4D Summit 2014 • Paris • Celebrating 30 years List all child elements
  • 160. 4D Summit 2014 • Paris • Celebrating 30 years List all attributes
  • 161. 4D Summit 2014 • Paris • Celebrating 30 years Pitfall
  • 162. 4D Summit 2014 • Paris • Celebrating 30 years Pitfall
  • 163. 4D Summit 2014 • Paris • Celebrating 30 years Pitfall
  • 164. 4D Summit 2014 • Paris • Celebrating 30 years Pitfall
  • 165. 4D Summit 2014 • Paris • Celebrating 30 years Process 4D Tags
  • 166. 4D Summit 2014 • Paris • Celebrating 30 years Office file formats
  • 167. 4D Summit 2014 • Paris • Celebrating 30 years Office file formats OpenDocument Office Open XML OASIS Microsoft Open Office MS Office : Word, Excel odf WordML SpreadsheetML ooxml 2005 2003 2007 .odt, .ods, etc... .xml .docx, .xlsx, etc... zip + xml xml zip + xml
  • 168. 4D Summit 2014 • Paris • Celebrating 30 years SVG
  • 169. 4D Summit 2014 • Paris • Celebrating 30 years SVG
  • 170. 4D Summit 2014 • Paris • Celebrating 30 years SVG • SVG :“ScalableVector Graphics” image format
  • 171. 4D Summit 2014 • Paris • Celebrating 30 years SVG • SVG :“ScalableVector Graphics” image format • xml based
  • 172. 4D Summit 2014 • Paris • Celebrating 30 years SVG • SVG :“ScalableVector Graphics” image format • xml based • Light, scales smoothly
  • 173. 4D Summit 2014 • Paris • Celebrating 30 years SVG • SVG :“ScalableVector Graphics” image format • xml based • Light, scales smoothly • Supported in most modern browser
  • 174. 4D Summit 2014 • Paris • Celebrating 30 years SVG • SVG :“ScalableVector Graphics” image format • xml based • Light, scales smoothly • Supported in most modern browser • Supported in 4D (natively)
  • 175. 4D Summit 2014 • Paris • Celebrating 30 years SVG • SVG :“ScalableVector Graphics” image format • xml based • Light, scales smoothly • Supported in most modern browser • Supported in 4D (natively) • 4D provides “SVG Component” and “SVG Area”
  • 176. 4D Summit 2014 • Paris • Celebrating 30 years SVG example
  • 177. 4D Summit 2014 • Paris • Celebrating 30 years SVG example
  • 178. 4D Summit 2014 • Paris • Celebrating 30 years SVG in plain 4D
  • 179. 4D Summit 2014 • Paris • Celebrating 30 years SVG with “4D SVG” component
  • 180. 4D Summit 2014 • Paris • Celebrating 30 years C_OBJET and JSON
  • 181. 4D Summit 2014 • Paris • Celebrating 30 years JSON format
  • 182. 4D Summit 2014 • Paris • Celebrating 30 years JSON format
  • 183. 4D Summit 2014 • Paris • Celebrating 30 years JSON format
  • 184. 4D Summit 2014 • Paris • Celebrating 30 years JSON format
  • 185. 4D Summit 2014 • Paris • Celebrating 30 years JSON example <children><child dob="1867-04-16" name="Wilbur"/><child dob="1871-08-19" name="Orville"/></children> {"child":[{"name":"Orville","dob":"1871-08-19"},{"name":"Orville","dob":"1871-08-19"}]} JSON : XML : JSON compact : XML compact :
  • 186. 4D Summit 2014 • Paris • Celebrating 30 years C_OBJECT to JSON code
  • 187. 4D Summit 2014 • Paris • Celebrating 30 years JSON to C_OBJECT code
  • 188. 4D Summit 2014 • Paris • Celebrating 30 years Can C_OBJECT work with XML ?
  • 189. 4D Summit 2014 • Paris • Celebrating 30 years C_OBJECT to XML code
  • 190. 4D Summit 2014 • Paris • Celebrating 30 years C_OBJECT to XML code (cont.)
  • 191. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list
  • 192. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes
  • 193. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes Encoding many utf-8
  • 194. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes Encoding many utf-8 Comments yes no
  • 195. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes Encoding many utf-8 Comments yes no Mixed mode yes no
  • 196. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes Encoding many utf-8 Comments yes no Mixed mode yes no Namespace yes no
  • 197. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes Encoding many utf-8 Comments yes no Mixed mode yes no Namespace yes no Conformity dtd, schema no
  • 198. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes Encoding many utf-8 Comments yes no Mixed mode yes no Namespace yes no Conformity dtd, schema no Direct Access yes (xpath) no
  • 199. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON XML JSON Approach tree list Arrays no yes Encoding many utf-8 Comments yes no Mixed mode yes no Namespace yes no Conformity dtd, schema no Direct Access yes (xpath) no Transformation yes (xslt) no
  • 200. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON (in 4D) XML JSON Debugger friendly no yes
  • 201. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON (in 4D) XML JSON Debugger friendly no yes Native type no yes
  • 202. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON (in 4D) XML JSON Debugger friendly no yes Native type no yes Memory leak possible no
  • 203. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON (in 4D) XML JSON Debugger friendly no yes Native type no yes Memory leak possible no Large documents yes (sax) no
  • 204. 4D Summit 2014 • Paris • Celebrating 30 years XML vs JSON (in 4D) XML JSON Debugger friendly no yes Native type no yes Memory leak possible no Large documents yes (sax) no Available since 4D v2003 4D v14
  • 205. 4D Summit 2014 • Paris • Celebrating 30 years Does JSON make XML obsolete ?
  • 206. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant
  • 207. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant • XML is an industry standard
  • 208. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant • XML is an industry standard • XML has rich tool set
  • 209. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant • XML is an industry standard • XML has rich tool set • JSON features are a subset of XML features
  • 210. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant • XML is an industry standard • XML has rich tool set • JSON features are a subset of XML features • JSON is relevant in a “small” subset of XML “market” (web 2.0, web-services)
  • 211. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant • XML is an industry standard • XML has rich tool set • JSON features are a subset of XML features • JSON is relevant in a “small” subset of XML “market” (web 2.0, web-services) • Performance gain should be measured not guessed
  • 212. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant • XML is an industry standard • XML has rich tool set • JSON features are a subset of XML features • JSON is relevant in a “small” subset of XML “market” (web 2.0, web-services) • Performance gain should be measured not guessed • Web-Services APIs can provide both XML and JSON
  • 213. 4D Summit 2014 • Paris • Celebrating 30 years Why XML is still relevant • XML is an industry standard • XML has rich tool set • JSON features are a subset of XML features • JSON is relevant in a “small” subset of XML “market” (web 2.0, web-services) • Performance gain should be measured not guessed • Web-Services APIs can provide both XML and JSON • Choice is good
  • 214. 4D Summit 2014 • Paris • Celebrating 30 years Demonstration
  • 215. 4D Summit 2014 • Paris • Celebrating 30 years Thank you! http://www.w3.org/TR/xml/ http://www.w3.org/TR/xml11/ http://www.w3schools.com http://www.oxygenxml.com/ http://www.saxproject.org https://github.com/miyako/4d-plugin-xslt
  • 216. 4D Summit 2014 • Paris • Celebrating 30 years Thank you! Bruno LEGAY Responsable Bureau d’Etudes A&C Consulting www.ac-consulting.fr