Re: adding elements to existing data

Posted by Anthony4321 on
URL: https://discuss.orbeon.com/adding-elements-to-existing-data-tp44007p3842708.html

Erik Bruchez wrote
> I've built my first form,
> which is basically a revised version of the Bookcast example
> application, and I've come up with a couple of questions.
>
> * I've added an element to my form, and it works just fine for new
>  entries, but there's no entry field for existing entries.  I'd like a
>  blank field (or maybe filled out w/ a default value) to show up for
>  existing entries.  What's the right approach here?  I can add an  
> empty
>  element in my eXist database directly - but is that the
>  usual/recommended approach?

The larger issue is: how to migrate data from a version v1 of an XML  
schema (as in "structure of an XML document", not as in "W3C XML  
Schema") to version v2?

In general answer is not easy.

For your specific case, since you know what changed, I think that yes,  
you could migrate all of your existing data by simply adding a blank  
element to all your documents. If you are using eXist, this should be  
easy with just a bit of XQuery.
I've only just come across Orbeon Forms and have never had to use XQuery before. Could you please provide an example of how you would do this within eXist?

We will be doing many form changes that we will want to be retroactive and all the open standards in Orbeon look appealing. As long as the changes are new elements or leave element identifiers the same this shouldn't break anything correct?

Cheers