SlideShare ist ein Scribd-Unternehmen logo
1 von 18
Downloaden Sie, um offline zu lesen
#phpbcat




FluentDOM
 Thomas Weinert
About Me

●   Application Developer
    ●   PHP
    ●   JavaScript
    ●   XSL
●   Papaya Software GmbH
    ●   papaya CMS
    ●   Technical Director
About You?
About FluentDOM

●   JQuery API
●   DOMNodeList replacement
●   Learning Project
    ●   Test driven development
    ●   Continous Integration
    ●   Parser
●   Tobias Schlitt
●   Bastian Feder, Thomas Weinert
Differences To jQuery

●   „Only“ Traversing, Manipulation and some Core
    functions
●   Xpath Expressions (not CSS Selectors)
●   No method html() but xml()
●   Callbacks have a $node parameter
Chaining

●   Methods return objects
Chaining Sample


$fd = FluentDOM($html, 'html')
  ->find('/html/head/title')
  ->add('//h1')
  ->add('//h2');
Traversing

●   find()      ●   children()       ●   first()
●   add()       ●   closest()        ●   last()
●   not()       ●   contents()       ●   prev()
●   filter()    ●   parent()         ●   prevAll()
●   has()       ●   parents()        ●   prevUntil()
●   end()       ●   parentsUntil()   ●   next()
●   andSelf()   ●   siblings()       ●   nextAll()
                                     ●   nextUntil()
Xpath

●   XML Path Language
●   W3C Recommendation 16 November 1999
●   Used by
    ●   XSLT 1
    ●   Xpointer
●   More specific then CSS
●   More powerful then CSS
Namespaces

●   Xpath depends on namespaces
●   Register your own namespaces prefixes
●   Method: namespaces()

$title = FluentDOM($xml)
  ->namespaces(
     array('project-atom' => 'http://www.w3.org/2005/Atom')
  )
  ->evaluate(
     'string(/project-atom:feed/project-atom:title)'
  );
Interfaces

●   IteratorAggregate
    ●   Iterator
    ●   RecursiveIterator
    ●   Seekable
●   Countable
●   ArrayAccess (read only)
Functions

●   Create FluentDOM object and load data
    ●   FluentDOM
    ●   FluentDOMStyle
Manipulation

●   append()        ●   appendTo()      ●   xml()
●   prepend()       ●   prependTo()     ●   text()
●   before()        ●   insertAfter()   ●   attr()
●   after()         ●   insertBefore() ● addClass()
●   remove()        ●   wrap()          ●   removeClass()
●   replaceAll()    ●   wrapAll()       ●   toggleClass()
●   replaceWith()   ●   wrapInner()
Loaders

●   Default Loaders
    ●   DOMDocument, DOMNode
    ●   XML (file and string)
    ●   HTML (file and string)
●   Additional Loaders
    ●   SimpleXMLElement
    ●   PDO
    ●   JSON
Own Loaders

●   Interface FluentDOMLoader
    ●   load() returns DOMDocument or DOMNode
Extending FluentDOM

●   FluentDOMCore
    ●   spawn()
    ●   push()
    ●   unique()
    ●   _applyContentsToNodes()
Future

●   CSS Selectors
●   ?
Get It

●   http://fluentdom.org
●   http://nightly.fluentdom.org
●   svn://svn.fluentdom.org

Weitere ähnliche Inhalte

Was ist angesagt?

Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandrashimi_k
 
Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11Åsa Pehrsson
 
Our local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesOur local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesxSawyer
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersJuho Teperi
 
Pandoc: the deep dive (PDXFunc presentation)
Pandoc: the deep dive (PDXFunc presentation)Pandoc: the deep dive (PDXFunc presentation)
Pandoc: the deep dive (PDXFunc presentation)Luc Perkins
 
Git internals
Git internalsGit internals
Git internalskhelll
 
Stripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe
 
iOS: Web Services and XML parsing
iOS: Web Services and XML parsingiOS: Web Services and XML parsing
iOS: Web Services and XML parsingJussi Pohjolainen
 
Monitoring with ElasticSearch
Monitoring with ElasticSearch Monitoring with ElasticSearch
Monitoring with ElasticSearch Kris Buytaert
 
Why do we need TypeScript?
Why do we need TypeScript?Why do we need TypeScript?
Why do we need TypeScript?Nitay Neeman
 

Was ist angesagt? (18)

Memory management
Memory managementMemory management
Memory management
 
Introduction to Cassandra
Introduction to CassandraIntroduction to Cassandra
Introduction to Cassandra
 
Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11Kotlin workshop 2018-06-11
Kotlin workshop 2018-06-11
 
Mongo db nosql (1)
Mongo db nosql (1)Mongo db nosql (1)
Mongo db nosql (1)
 
Our local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variablesOur local state, my, my - Understanding Perl variables
Our local state, my, my - Understanding Perl variables
 
HelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript DevelopersHelsinkiJS - Clojurescript for Javascript Developers
HelsinkiJS - Clojurescript for Javascript Developers
 
Pandoc: the deep dive (PDXFunc presentation)
Pandoc: the deep dive (PDXFunc presentation)Pandoc: the deep dive (PDXFunc presentation)
Pandoc: the deep dive (PDXFunc presentation)
 
Clojure Small Intro
Clojure Small IntroClojure Small Intro
Clojure Small Intro
 
JSON Learning
JSON LearningJSON Learning
JSON Learning
 
Git internals
Git internalsGit internals
Git internals
 
Stripe CTF3 wrap-up
Stripe CTF3 wrap-upStripe CTF3 wrap-up
Stripe CTF3 wrap-up
 
iOS: Web Services and XML parsing
iOS: Web Services and XML parsingiOS: Web Services and XML parsing
iOS: Web Services and XML parsing
 
Monitoring with ElasticSearch
Monitoring with ElasticSearch Monitoring with ElasticSearch
Monitoring with ElasticSearch
 
MongoDB
MongoDBMongoDB
MongoDB
 
Javascript ch8
Javascript ch8Javascript ch8
Javascript ch8
 
Performance (browser)
Performance (browser)Performance (browser)
Performance (browser)
 
Intelli J IDEA
Intelli J IDEAIntelli J IDEA
Intelli J IDEA
 
Why do we need TypeScript?
Why do we need TypeScript?Why do we need TypeScript?
Why do we need TypeScript?
 

Andere mochten auch

CBSib Core Pitch Module 1
CBSib Core Pitch Module 1CBSib Core Pitch Module 1
CBSib Core Pitch Module 1cnetbenson
 
Classification
ClassificationClassification
Classificationbigtb50
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHPThomas Weinert
 
Experiences With Pre Commit Hooks
Experiences With Pre Commit HooksExperiences With Pre Commit Hooks
Experiences With Pre Commit HooksThomas Weinert
 
Deliver Files With PHP
Deliver Files With PHPDeliver Files With PHP
Deliver Files With PHPThomas Weinert
 
Sistema de ecuaciones
Sistema de ecuacionesSistema de ecuaciones
Sistema de ecuacionesTaty Shelmi
 
Tendências para o Mercado de GTI para 2011
Tendências para o Mercado de GTI para 2011Tendências para o Mercado de GTI para 2011
Tendências para o Mercado de GTI para 2011rayfranrocha
 
Retencion en la fuente lore y yo
Retencion en la fuente lore y yoRetencion en la fuente lore y yo
Retencion en la fuente lore y yofundacion san mateo
 
Arranz orgaz javier_le1_tareas_tareacolaborativa
Arranz orgaz javier_le1_tareas_tareacolaborativaArranz orgaz javier_le1_tareas_tareacolaborativa
Arranz orgaz javier_le1_tareas_tareacolaborativaJavier Arranz Orgaz
 
Aspectos fisiologicos arroz estresse hidrico
Aspectos fisiologicos arroz estresse hidricoAspectos fisiologicos arroz estresse hidrico
Aspectos fisiologicos arroz estresse hidricomurilosabater
 
Retencion en la fuente lore y yo
Retencion en la fuente lore y yoRetencion en la fuente lore y yo
Retencion en la fuente lore y yofundacion san mateo
 
Diapositivas rafael
Diapositivas rafaelDiapositivas rafael
Diapositivas rafaelrapha08
 
Naty e ary 8° a
Naty e ary 8° aNaty e ary 8° a
Naty e ary 8° ahelenaleao
 
Presentacion del video tutorialde como crear blogs
Presentacion del video tutorialde como crear blogsPresentacion del video tutorialde como crear blogs
Presentacion del video tutorialde como crear blogsManolo Garcìa
 
Grupo sergio palacios_taller23
Grupo sergio palacios_taller23Grupo sergio palacios_taller23
Grupo sergio palacios_taller23spalacios76
 
Isaac e diego produtor tecnicos
Isaac e diego produtor tecnicosIsaac e diego produtor tecnicos
Isaac e diego produtor tecnicoshelenaleao
 
Avc m3 u4_reporte_recursos_web2.0_personal_actividad opcional
Avc m3 u4_reporte_recursos_web2.0_personal_actividad opcionalAvc m3 u4_reporte_recursos_web2.0_personal_actividad opcional
Avc m3 u4_reporte_recursos_web2.0_personal_actividad opcionalArmida_31
 

Andere mochten auch (20)

CBSib Core Pitch Module 1
CBSib Core Pitch Module 1CBSib Core Pitch Module 1
CBSib Core Pitch Module 1
 
Classification
ClassificationClassification
Classification
 
Mobile App Development Made Easy
Mobile App Development Made EasyMobile App Development Made Easy
Mobile App Development Made Easy
 
Asynchronous I/O in PHP
Asynchronous I/O in PHPAsynchronous I/O in PHP
Asynchronous I/O in PHP
 
Experiences With Pre Commit Hooks
Experiences With Pre Commit HooksExperiences With Pre Commit Hooks
Experiences With Pre Commit Hooks
 
Open Data Hackathon - A How to Guide
Open Data Hackathon - A How to GuideOpen Data Hackathon - A How to Guide
Open Data Hackathon - A How to Guide
 
Deliver Files With PHP
Deliver Files With PHPDeliver Files With PHP
Deliver Files With PHP
 
PHP 5.3/6
PHP 5.3/6PHP 5.3/6
PHP 5.3/6
 
Sistema de ecuaciones
Sistema de ecuacionesSistema de ecuaciones
Sistema de ecuaciones
 
Tendências para o Mercado de GTI para 2011
Tendências para o Mercado de GTI para 2011Tendências para o Mercado de GTI para 2011
Tendências para o Mercado de GTI para 2011
 
Retencion en la fuente lore y yo
Retencion en la fuente lore y yoRetencion en la fuente lore y yo
Retencion en la fuente lore y yo
 
Arranz orgaz javier_le1_tareas_tareacolaborativa
Arranz orgaz javier_le1_tareas_tareacolaborativaArranz orgaz javier_le1_tareas_tareacolaborativa
Arranz orgaz javier_le1_tareas_tareacolaborativa
 
Aspectos fisiologicos arroz estresse hidrico
Aspectos fisiologicos arroz estresse hidricoAspectos fisiologicos arroz estresse hidrico
Aspectos fisiologicos arroz estresse hidrico
 
Retencion en la fuente lore y yo
Retencion en la fuente lore y yoRetencion en la fuente lore y yo
Retencion en la fuente lore y yo
 
Diapositivas rafael
Diapositivas rafaelDiapositivas rafael
Diapositivas rafael
 
Naty e ary 8° a
Naty e ary 8° aNaty e ary 8° a
Naty e ary 8° a
 
Presentacion del video tutorialde como crear blogs
Presentacion del video tutorialde como crear blogsPresentacion del video tutorialde como crear blogs
Presentacion del video tutorialde como crear blogs
 
Grupo sergio palacios_taller23
Grupo sergio palacios_taller23Grupo sergio palacios_taller23
Grupo sergio palacios_taller23
 
Isaac e diego produtor tecnicos
Isaac e diego produtor tecnicosIsaac e diego produtor tecnicos
Isaac e diego produtor tecnicos
 
Avc m3 u4_reporte_recursos_web2.0_personal_actividad opcional
Avc m3 u4_reporte_recursos_web2.0_personal_actividad opcionalAvc m3 u4_reporte_recursos_web2.0_personal_actividad opcional
Avc m3 u4_reporte_recursos_web2.0_personal_actividad opcional
 

Ähnlich wie FluentDom

Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScriptJorg Janke
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausWomen in Technology Poland
 
Advanced PHP Simplified - Sunshine PHP 2018
Advanced PHP Simplified - Sunshine PHP 2018Advanced PHP Simplified - Sunshine PHP 2018
Advanced PHP Simplified - Sunshine PHP 2018Mark Niebergall
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsOWASP Kyiv
 
Balisage - EXPath - A practical introduction
Balisage - EXPath - A practical introductionBalisage - EXPath - A practical introduction
Balisage - EXPath - A practical introductionFlorent Georges
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015Jorg Janke
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra ExplainedEric Evans
 
In the DOM, no one will hear you scream
In the DOM, no one will hear you screamIn the DOM, no one will hear you scream
In the DOM, no one will hear you screamMario Heiderich
 
一种多屏时代的通用 web 应用架构
一种多屏时代的通用 web 应用架构一种多屏时代的通用 web 应用架构
一种多屏时代的通用 web 应用架构勇浩 赖
 
Structured web programming
Structured web programmingStructured web programming
Structured web programmingahfast
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoiddmethvin
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009Mario Heiderich
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATIONkrutitrivedi
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGlobalLogic Ukraine
 
The Lumber Mill - XSLT For Your Templates
The Lumber Mill  - XSLT For Your TemplatesThe Lumber Mill  - XSLT For Your Templates
The Lumber Mill - XSLT For Your TemplatesThomas Weinert
 

Ähnlich wie FluentDom (20)

Advanced PHP Simplified
Advanced PHP SimplifiedAdvanced PHP Simplified
Advanced PHP Simplified
 
Dart the Better JavaScript
Dart the Better JavaScriptDart the Better JavaScript
Dart the Better JavaScript
 
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan KrausHTML, CSS & Javascript Architecture (extended version) - Jan Kraus
HTML, CSS & Javascript Architecture (extended version) - Jan Kraus
 
Advanced PHP Simplified - Sunshine PHP 2018
Advanced PHP Simplified - Sunshine PHP 2018Advanced PHP Simplified - Sunshine PHP 2018
Advanced PHP Simplified - Sunshine PHP 2018
 
Andriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tipsAndriy Shalaenko - GO security tips
Andriy Shalaenko - GO security tips
 
Lumberjack XPath 101
Lumberjack XPath 101Lumberjack XPath 101
Lumberjack XPath 101
 
Balisage - EXPath - A practical introduction
Balisage - EXPath - A practical introductionBalisage - EXPath - A practical introduction
Balisage - EXPath - A practical introduction
 
Dart the better Javascript 2015
Dart the better Javascript 2015Dart the better Javascript 2015
Dart the better Javascript 2015
 
Cassandra Explained
Cassandra ExplainedCassandra Explained
Cassandra Explained
 
In the DOM, no one will hear you scream
In the DOM, no one will hear you screamIn the DOM, no one will hear you scream
In the DOM, no one will hear you scream
 
一种多屏时代的通用 web 应用架构
一种多屏时代的通用 web 应用架构一种多屏时代的通用 web 应用架构
一种多屏时代的通用 web 应用架构
 
Tp web
Tp webTp web
Tp web
 
Structured web programming
Structured web programmingStructured web programming
Structured web programming
 
jQuery Features to Avoid
jQuery Features to AvoidjQuery Features to Avoid
jQuery Features to Avoid
 
JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009JavaScript From Hell - CONFidence 2.0 2009
JavaScript From Hell - CONFidence 2.0 2009
 
Migrations
MigrationsMigrations
Migrations
 
Part 7
Part 7Part 7
Part 7
 
PHP BASIC PRESENTATION
PHP BASIC PRESENTATIONPHP BASIC PRESENTATION
PHP BASIC PRESENTATION
 
Go Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii ShapovalGo Is Your Next Language — Sergii Shapoval
Go Is Your Next Language — Sergii Shapoval
 
The Lumber Mill - XSLT For Your Templates
The Lumber Mill  - XSLT For Your TemplatesThe Lumber Mill  - XSLT For Your Templates
The Lumber Mill - XSLT For Your Templates
 

Mehr von Thomas Weinert

PHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHPPHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHPThomas Weinert
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHPThomas Weinert
 
Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesThomas Weinert
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 
The Lumber Mill Xslt For Your Templates
The Lumber Mill   Xslt For Your TemplatesThe Lumber Mill   Xslt For Your Templates
The Lumber Mill Xslt For Your TemplatesThomas Weinert
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend PerformanceThomas Weinert
 

Mehr von Thomas Weinert (8)

PHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHPPHPUG CGN: Controlling Arduino With PHP
PHPUG CGN: Controlling Arduino With PHP
 
Controlling Arduino With PHP
Controlling Arduino With PHPControlling Arduino With PHP
Controlling Arduino With PHP
 
Decoupling Objects With Standard Interfaces
Decoupling Objects With Standard InterfacesDecoupling Objects With Standard Interfaces
Decoupling Objects With Standard Interfaces
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
The Lumber Mill Xslt For Your Templates
The Lumber Mill   Xslt For Your TemplatesThe Lumber Mill   Xslt For Your Templates
The Lumber Mill Xslt For Your Templates
 
SVN Hook
SVN HookSVN Hook
SVN Hook
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 
Optimizing Your Frontend Performance
Optimizing Your Frontend PerformanceOptimizing Your Frontend Performance
Optimizing Your Frontend Performance
 

FluentDom

  • 2. About Me ● Application Developer ● PHP ● JavaScript ● XSL ● Papaya Software GmbH ● papaya CMS ● Technical Director
  • 4. About FluentDOM ● JQuery API ● DOMNodeList replacement ● Learning Project ● Test driven development ● Continous Integration ● Parser ● Tobias Schlitt ● Bastian Feder, Thomas Weinert
  • 5. Differences To jQuery ● „Only“ Traversing, Manipulation and some Core functions ● Xpath Expressions (not CSS Selectors) ● No method html() but xml() ● Callbacks have a $node parameter
  • 6. Chaining ● Methods return objects
  • 7. Chaining Sample $fd = FluentDOM($html, 'html') ->find('/html/head/title') ->add('//h1') ->add('//h2');
  • 8. Traversing ● find() ● children() ● first() ● add() ● closest() ● last() ● not() ● contents() ● prev() ● filter() ● parent() ● prevAll() ● has() ● parents() ● prevUntil() ● end() ● parentsUntil() ● next() ● andSelf() ● siblings() ● nextAll() ● nextUntil()
  • 9. Xpath ● XML Path Language ● W3C Recommendation 16 November 1999 ● Used by ● XSLT 1 ● Xpointer ● More specific then CSS ● More powerful then CSS
  • 10. Namespaces ● Xpath depends on namespaces ● Register your own namespaces prefixes ● Method: namespaces() $title = FluentDOM($xml) ->namespaces( array('project-atom' => 'http://www.w3.org/2005/Atom') ) ->evaluate( 'string(/project-atom:feed/project-atom:title)' );
  • 11. Interfaces ● IteratorAggregate ● Iterator ● RecursiveIterator ● Seekable ● Countable ● ArrayAccess (read only)
  • 12. Functions ● Create FluentDOM object and load data ● FluentDOM ● FluentDOMStyle
  • 13. Manipulation ● append() ● appendTo() ● xml() ● prepend() ● prependTo() ● text() ● before() ● insertAfter() ● attr() ● after() ● insertBefore() ● addClass() ● remove() ● wrap() ● removeClass() ● replaceAll() ● wrapAll() ● toggleClass() ● replaceWith() ● wrapInner()
  • 14. Loaders ● Default Loaders ● DOMDocument, DOMNode ● XML (file and string) ● HTML (file and string) ● Additional Loaders ● SimpleXMLElement ● PDO ● JSON
  • 15. Own Loaders ● Interface FluentDOMLoader ● load() returns DOMDocument or DOMNode
  • 16. Extending FluentDOM ● FluentDOMCore ● spawn() ● push() ● unique() ● _applyContentsToNodes()
  • 17. Future ● CSS Selectors ● ?
  • 18. Get It ● http://fluentdom.org ● http://nightly.fluentdom.org ● svn://svn.fluentdom.org