View
2.248
Download
0
Category
Tags:
Preview:
Citation preview
ExtbaseObject to XML Mapping
Thomas Maroschik
Agenda
• XML basics
• Current state of EXT:palm
• Fail of EXT:palm
• Vision and the future
• Discussion
XML Basics
Key Technologies
• XML
• Schema
• DTD
• XSD
• RelaxNG
• XPath / XQuery
• XSLT
XML Document
XML Namespace
XML Namespaces
XML Schema (DTD)Deprecated, W3C Recommendation
XML Schema (XSD)Popular, W3C Recommendation
XML Schema (RelaxNG)Popular, Oasis/ISO Standard
XPath
/bookshelf/book/title/bookshelf/book[1]/title
/bookshelf/book/author/text()/bookshelf/book[price<37]/title
XSLT
Current State of EXT:palm
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
Example Domain Model
Example Palm Usage
Example Palm Merger Usage
Live Demo
Fail of EXT:palm
Inner Concept
• uses annotations for binding
• uses reflection for mapping
• serializing and unserializing is configurable by typoscript
• uses DOM for XML access
Serializer Concept
• iterates recursively over object
• builds DOMDocument directly
=> 2 in memory representations of data
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
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
But why does this fail?
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
Conclusion
• currently just usable for limited usecases
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)
Vision and the future
ConceptXML Schema
Classes
BindingXML Data
serialize
unserialize
Object
serialize
unserialize
generate
generate
use
use
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
How could the binding look like?
Example from jibx.sourceforge.net
What do you think?
Thanks!
Contact me via:
tmaroschik@dfau.de
@tom_noise
Contribute via:
forge.typo3.org/projects/extension-palm/
Recommended