On 2013-04-10 10:25, Lukas Eder wrote:
Hello,
JCR shares many features with XML. It also supports exporting /
importing JCR data in XML format, following rules defined in the JCR
specs. However, it does so at a very low level without leveraging
popular standard APIs, such as org.w3c.dom. I have implemented a quick
draft version of a DOM implementation wrapping JCR entities into their
corresponding DOM types:
- javax.jcr.Node -> org.w3c.dom.Element
- javax.jcr.NodeIterator -> org.w3c.dom.NodeList
- javax.jcr.Property -> org.w3c.dom.Attr
- javax.jcr.PropertyIterator -> org.w3c.dom.NamedNodeMap
- javax.jcr.Item -> org.w3c.dom.Node
- javax.jcr.Session -> org.w3c.dom.Document
With this model, it is very easy to perform sophisticated XPath
queries, XSL transformations, JAXB bindings, and use higher-level
DOM-based XML APIs, such as jOOX and many others. An important
advantage of such a feature addition would be the possibility of
natively supporting XSLT as an alternative rendering mechanism in
Apache Sling, instead of JSP -> HTML or JSON dumping.
Unlike going through Session.exportXXXView(), having a "lazy" DOM API
wrapping the actual repository seems much more natural and will lead
to much better results, performance-wise.
I have pushed the current status of my draft implementation, along
with some examples and unit tests here:
https://github.com/lukaseder/jcr-stuff
Please let me know what you think, and if this idea should make it
into Jackrabbit (I think it should!)
...
That sounds awesome.
Best regards, Julian