(cvc-model-group.1) on UPDATE

i have an element with inside a sequence of instance element.Each instance consist on 2 different element named watcher and tupleid.

a
b
1
3


My desire is to add a new element watcher. So with jdom i do:

List watchers = instance.getChildren(“watcher”);
Element newatcher = new Element(“watcher”);
newatcher.setText(“c”);
watchers.add(newatcher);
but i get:
Update Error:com.softwareag.tamino.db.api.accessor.TUpdateException
Access Failure:
ReturnValue:7730
Code:INOXDE7730
MessageText:(cvc-model-group.1):invalid end of sequence
MessageLine:Line 15, Column 2: [element “watcher” in element “instance”]
effectively printing the element i get right expected:


a
b
1
3
c


something like the Muller Karla insert in ProcessPersonwithSchema in the TAmino example.
But i don’t understand why because i have taken only the list of childen named “watcher”…
What’s wrong?

BEST REGARDs
@nto

I can reproduce this JDOM problem and my bypass is pretty ugly but it works…

If you create two lists (in your case), one of watchers and one of TupleIDs, then when you have finished adding watchers you can create a single list from both of these, and set the new combined list as the children of the parent node:

watchers.add(newwatcher);
List tupleIDs  = instance.getChildren("tupleID");
watchers.addAll(watchers.size(),tupleIDs);
instance.setChildren(watchers);

This could get really nasty if the tree structure was more complex - does anyone know a better way?

i found i solution!!!
watchers.add(0,newatcher);
i add it in the first position, so the element sequence in my TSD is respected!!!
it’s look so a fast (not too smart) solution!!!

Thanks
@nto

Yes or you can add to the end of the list with

watchers.add(watchers.size(),newatcher);