Upload
tobias-schlitt
View
2.311
Download
3
Tags:
Embed Size (px)
DESCRIPTION
Slides from our XML workshop on the International PHP Conference 2009 in Karlsruhe. Not that much information in here, since we did a lot of live stuff. But hopefully still valueable.
Citation preview
Professional XML with PHP
Arne Blankerts <[email protected]>, TobiasSchlitt <[email protected]>
IPC 2009
2009-11-15
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 1 / 26
Outline
1 OverviewWelcomeOverview
2 XML
3 XML in PHP
4 Open part
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 2 / 26
Arne Blankerts
Arne Blankerts <[email protected]>
PHP since 1999 (10 years of PHP!)
Co-Founder of thePHP.cc
ballyhoo. werbeagentur.
Open source addicted
Inventor and lead developer of fCMS sitesystemContributor and translator for the PHP manual
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 3 / 26
Tobias Schlitt
Tobias Schlitt <[email protected]>
PHP since 2001
Freelancing consultant
Qualified IT Specialist
Studying CS at TU Dortmund(finishing 2010)
OSS addicted
PHPeZ ComponentsPHPUnit
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 4 / 26
So, what about you?
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 5 / 26
Conferences are about contacts
That is why both begin with con. . .
Who are you?
What is your business?
What is your intention behind coming to IPC?
What do you expect from this workshop?
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 6 / 26
What can you expect?
Workshop
Introduction to XML
Working on XML data withPHP
Practical tips and tricks
Interactive: What would you liketo know?
XPath
Tuesday, 13:45 - 14:45
XPath in depth
Validating XML
Tuesday, 15:15 - 16:15
DTD, XML Schema andRelaxNG
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 7 / 26
Rules for this workshop
Allways Stick to your place!
Never ask! Repeat: I will not ask anything!
We are not here to show you anything useful!
The only correct solution is told by us!
Do not give feedback on http://joind.in/1041
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 8 / 26
Rules for this workshop
Allways Stick to your place!
Never ask! Repeat: I will not ask anything!
We are not here to show you anything useful!
The only correct solution is told by us!
Do not give feedback on http://joind.in/1041
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 8 / 26
Outline
1 Overview
2 XMLOverviewGet into code. . .
3 XML in PHP
4 Open part
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 9 / 26
What is XML?
General specification for creating markup languages
Data exchange between computer systems
System independentHuman readableMost used on the webSuccessor of SGML
W3C recommendation
1.0 1998 (last update 2008-11-26)1.1 2004 (last update 2006-08-16)
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 10 / 26
XML languages by example
XHTML XML variant of the popular HTML
RSS Really Simply SyndicationProvide news / updates / ... of websitesRead by special clientsAggregation on portals / planets
SVG Scalable Vector GraphicsDescribe vector graphics in XMLPotentially interactive / animated(via ECMAScript)
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 11 / 26
Related technologies - Schemas
Schema
A schema defines the structure XML instance documents.
XMLSchema Written in XMLW3C recommendationPopular
RelaxNG 2 syntax variants
XML basedShort plain text based
OASIS / ISO standardPopular
DTD Plain textW3C recommendationDeprecated
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 12 / 26
Related technologies - Querying
Query
A query extracts a sub-set of information from a data source.
XPath W3C recommendationNavigation in XML documentsmore on that later...
XQuery Functional programming languageAllows complex queries
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 13 / 26
Practical
Let’s get into the code
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 14 / 26
Outline
1 Overview
2 XML
3 XML in PHPDOMXMLReader/-Writer
4 Open part
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 15 / 26
Overview
XML APIs
PHP has quite some XML APIs.
The most important are:
DOMXMLReader / XMLWriterSimpleXML
Deprecated are:
DOM XMLXML Parser
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 16 / 26
Overview - DOM
Document Object Model
Standardized API to access XML tree
W3C recommendationLevel 1 in 1999Currently: Level 3 (2004)
Available in many languages
CJavaPerlPython...
Represents XML nodes as objects
Loads full XML tree into memory
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 17 / 26
Overview - XMLReader/-Writer
Popular approach to access XML data
Similar implementations available in
JavaC#
Pull / push based
Does not load XML fully into memory
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 18 / 26
Overview - SimpleXml
Very simple access to XML data
Unique (?) to PHP
Represents XML structures as objects
Initial implementation hackish
Loads full XML tree into memory
You don’t want to use SimpleXML, seriously!
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 19 / 26
APIs compared
DOM XMLReader/-Writer SimpleXML
Read ? ? •Write ? ? ◦Manipulate ? • •Full control ? ? -
Namespaces ? ? ◦XPath ? - ?
Validate DTD DTD -Schema SchemaRelaxNG RelaxNG
Comfort • ◦ ?
? Fully supported
• Supported but not nice
◦ Poorly supported
- Not supported at all
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 20 / 26
Practical
Let’s get into the code
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 21 / 26
Practical
Let’s get into the code
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 22 / 26
Outline
1 Overview
2 XML
3 XML in PHP
4 Open part
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 23 / 26
What would you like to do?
Discuss a particular problem?
See a special XML technique in PHP?
Get to know related techniques?
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 24 / 26
Q/A
Are there any questions left?
Please give us some feedback!
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 25 / 26
The end
We hope you enjoyed the workshop!
Slides and material
Delivered by Software & Supporthttp://schlitt.info/opensourceOn Slideshare (http://slideshare.net)
Contact us:
Arne Blankerts <[email protected]>Tobias Schlitt <[email protected]>
Give us feedback on http://joind.in/1041
Arne Blankerts, Tobias Schlitt (IPC 2009) Professional XML with PHP 2009-11-15 26 / 26