Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.

Extbase object to xml mapping

The slides of my workshop during the TYPO3 Developer Days 2012 in Munich.

  • Login to see the comments

  • Be the first to like this

Extbase object to xml mapping

  1. 1. ExtbaseObject to XML Mapping Thomas Maroschik
  2. 2. Agenda• XML basics• Current state of EXT:palm• Fail of EXT:palm• Vision and the future• Discussion
  3. 3. XML Basics
  4. 4. Key Technologies• XML• Schema • DTD • XSD • RelaxNG• XPath / XQuery• XSLT
  5. 5. XML Document
  6. 6. XML Namespace
  7. 7. XML Namespaces
  8. 8. XML Schema (DTD)Deprecated, W3C Recommendation
  9. 9. XML Schema (XSD) Popular, W3C Recommendation
  10. 10. XML Schema (RelaxNG) Popular, Oasis/ISO Standard
  11. 11. XPath /bookshelf/book/title /bookshelf/book[1]/title /bookshelf/book/author/text()/bookshelf/book[price<37]/title
  12. 12. XSLT
  13. 13. Current State of EXT:palm
  14. 14. Features• Generate XML schema (XSD) from annotated Domain Models• Serialize instances of Domain Models to XML document• Unserialize XML document to instances of Domain Models• merging of XML data with existing data from repositories by rules• Backend module• Scheduler task• No XML Namespaces yet
  15. 15. Example Domain Model
  16. 16. Example Palm Usage
  17. 17. Example Palm Merger Usage
  18. 18. Live Demo
  19. 19. Fail of EXT:palm
  20. 20. Inner Concept• uses annotations for binding• uses reflection for mapping• serializing and unserializing is configurable by typoscript• uses DOM for XML access
  21. 21. Serializer Concept• iterates recursively over object• builds DOMDocument directly => 2 in memory representations of data
  22. 22. Unserializer Concept• iterates recursively over DOMDocument• maps the data to an array• array is mapped to object by property mapper => 3 in memory representations of data
  23. 23. Merger Concept• can import/merge external data by unserializing xml to object• fetches domain object from repository• compares objects and applies changes by rules => 4 in memory representations of data
  24. 24. But why does this fail?
  25. 25. Reasons for Fail• everything is defined global• domain object cannot be serialized to different xml outputs• configuration via TS in Extbase is flawed• massive memory consumption• reflection is quite slow
  26. 26. Conclusion• currently just usable for limited usecases
  27. 27. Hacks to get it work• import/merge all of a 2,2MB XML file takes of up to 2,5GB of memory• 2 scheduler tasks • one that populates a jobqueue • one that does just a single import/merge at a time (import of 60 aggregate roots takes 60 Minutes)
  28. 28. Vision and the future
  29. 29. Concept XML Schema generate use serialize serializeXML Data Binding Object unserialize unserialize use generate Classes
  30. 30. Implementation Concept • binding will be done by a binding document instead of annotations => xml and objects may have very different structure => custom un-/serializers for data types => no global configuration anymore • compile binding to php => no reflection at runtime anymore • use xml reader/writer instead DOM => save memory and gain speed
  31. 31. How could the binding look like? Example from
  32. 32. What do you think?
  33. 33. Thanks! Contact me via: @tom_noise Contribute