[xwiki-users] Creating XML from components
Hello Community, Just asking for some advice here ... I have an application in which I want to show a timeline (simile). Originally, it was getting its source from XML generated by some velocity in a dedicated page. Then, I reworked it so the XML would be pre-computed (to a file on server FS) and fed to the timeline, to improve performances. I supposed it could also be a macro encapsulated in {{cache}}. (note: that XML contains some inline HTML also, in some specific tags). Now, the application is being moved to real Java components. I first blindly converted my online velocity scripts, into a TimelineGenerator component. But producing XML/HTML from Java is not that clean ... and I'm not sure of what else to do. The original page with velocity seemed almost cleaner than that. To me it's not a Renderer use-case, as it doesn't really renders some syntax ... My current work is in [1], but is pretty much not tested and not working (dummy translation from velocity to java for now...). What would you kindly recommend ? Note: I admit this is not really related to xwiki apart from the fact that it's an xwiki based application, but I suppose this use-case is not new for you :) Thanks, Jeremie [1] - https://github.com/xwiki-contrib/xwiki-application-mailarchive/blob/master/x...
You should use a XML writer (either directly or by generating SAX event that are then written to the stream) when generating XML in Java instead of writing it by "hand". You can find one in most xml libraries, in XHTML renderer we are using the one from dom4j (org.dom4j.io.XMLWriter). On Mon, Jun 24, 2013 at 4:59 PM, Jeremie BOUSQUET <jeremie.bousquet@gmail.com> wrote:
Hello Community,
Just asking for some advice here ...
I have an application in which I want to show a timeline (simile). Originally, it was getting its source from XML generated by some velocity in a dedicated page. Then, I reworked it so the XML would be pre-computed (to a file on server FS) and fed to the timeline, to improve performances. I supposed it could also be a macro encapsulated in {{cache}}. (note: that XML contains some inline HTML also, in some specific tags).
Now, the application is being moved to real Java components. I first blindly converted my online velocity scripts, into a TimelineGenerator component. But producing XML/HTML from Java is not that clean ... and I'm not sure of what else to do. The original page with velocity seemed almost cleaner than that. To me it's not a Renderer use-case, as it doesn't really renders some syntax ... My current work is in [1], but is pretty much not tested and not working (dummy translation from velocity to java for now...).
What would you kindly recommend ?
Note: I admit this is not really related to xwiki apart from the fact that it's an xwiki based application, but I suppose this use-case is not new for you :)
Thanks, Jeremie
[1] - https://github.com/xwiki-contrib/xwiki-application-mailarchive/blob/master/x... _______________________________________________ users mailing list users@xwiki.org http://lists.xwiki.org/mailman/listinfo/users
-- Thomas Mortagne
participants (2)
-
Jeremie BOUSQUET -
Thomas Mortagne