Re: Accessing the form's metadata and being able to add custom metadata
Posted by
Erik Bruchez on
Jan 20, 2011; 3:22am
URL: https://discuss.orbeon.com/Accessing-the-form-s-metadata-and-being-able-to-add-custom-metadata-tp3221052p3226879.html
This information is in the form definition, as you noticed.
Now if you want to access this from your persistence layer upon e.g. a save, you could:
* load the form definition (easy if it's handled by your persistence layer as well)
* parse the resulting XML
* search for the <metadata> element and its sub-elements in the form definition
The Form Runner summary page actually does something similar: in order to learn about which form fields to show, etc. it also loads the form definition.
That metadata section was initially designed for Form Builder/Runner use only.
We have recently started thinking about adding support for an envelope:
That would be more appropriate for what you are looking to do, but unfortunately it's not yet implemented.
This said, if you add your <department> element, Form Builder/Runner won't complain.
-Erik
On Mon, Jan 17, 2011 at 3:29 AM, ktangirala
<[hidden email]> wrote:
Hi,
I would like to know how to access the metadata of the form such as app
name, form name, title etc. If I see the XHTML source in the Form Builder
(using Edit Source link), it looks like this:
<xforms:instance id="fr-form-metadata" xxforms:readonly="true">
<metadata>
<application-name>testapp</application-name>
<form-name>testform</form-name>
<title xml:lang="en">Application for Citizenship</title>
<description xml:lang="en"/>
<author/>
<logo mediatype="" filename="" size=""/>
</metadata>
</xforms:instance>
I would like to access this metadata programmatically in a Java serverside
file (say, in my REST API persistence layer).
Optionally, I would also like to know how to add new metadata while
designing this form. For example, in my case, I want to store the department
name this form belongs to. Can I simply add the tag <department>My
Department</department> to the XHTML source? Is there any automatic way of
doing this since I will have to do this on hundreds of forms.
Any help would be appreciated.
Cheers,
K
--
View this message in context: http://orbeon-forms-ops-users.24843.n4.nabble.com/Accessing-the-form-s-metadata-and-being-able-to-add-custom-metadata-tp3221052p3221052.html
Sent from the Orbeon Forms (ops-users) mailing list archive at Nabble.com.
--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
--
You receive this message as a subscriber of the
[hidden email] mailing list.
To unsubscribe: mailto:
[hidden email]
For general help: mailto:
[hidden email]?subject=help
OW2 mailing lists service home page:
http://www.ow2.org/wws