0

I have created the Orbeon form. How do we save the form in XML format. Let's say I have created a button in my form. On click of the button I need to generate the XML for created form.

enter image description here

On click of the edit button It is showing the code for the form. Now I need to generate the same code in XML format on button click event.

Any suggestions?

Vinod
  • 2,263
  • 9
  • 55
  • 104
  • I don't understand what you would like to achieve. Your screenshot is from Form Builder, correct? The Edit Source shows the XML source for the form definition. However your button in your form will do something at *runtime*, when the form is published. At that point, that is when the form runs, the source of the form definition is not available to the form. Are you instead talking about saving the form data? – ebruchez Jan 20 '15 at 00:03
  • No, my target is to generate the models/POJO classes automatically by parsing the XML. Now In the form builder If I create a form and on click of save button I need save the form source in XML format and by parsing the XML I need to generate POJO classes. Is it possible to generate XML for forms by any click event? OR Is there a way to capture XML in easiest way? – Vinod Jan 20 '15 at 06:01

1 Answers1

0

So my understanding based on the comments above is that you would like to parse the XML of the form definition in order to create POJO classes.

In this case, I think the right time to do this is when the form is published.

If you have your own persistence layer implementation you could easily hook up when receiving a PUT of the form definition when it is published. But other than that the problem is that there are no hooks for this at this point.

You could place a button in the form which only works at design time, but that would be quite hacky: you would have to write your own XForms, probably in each form you create, and hide the button at runtime.

If at runtime, then the XML of the form definition is not available.

In short I don't think you can do this without making more involved changes to Form Builder.

ebruchez
  • 7,760
  • 6
  • 29
  • 41