Hi,
I have a little problem.
I define in a collection a doctype. In this doctype I saved many xml documents.
I’d like cancel a xml’s tag
Ad ex:
From
tag1
tag2
To
tag1
how do I do? Update the tamino schema without cancel the xml documents inside?
thanks you!
Valentina
Hello Valentina
Updating schemas is always tricky. The reason is because if you make change to a schema, it affects how document instances are stored. So, for example, if your element is defined as required, and you insert documents into tamino, you might have trouble changing your schema after that.
If your schema modification says that no longer exists, then the current documents will not validate against this new schema.
In that case, you would need to “unload” the data (via SMH - System Management Hub is one way) into an xml file, and then either take out the element manually, or run it through an xslt sheet.
I personally prefer to modify such xml file manually, if the changes are not comples, by simply doing a find and replace. Some good IDE, such as Visual Studio .NET that I use, support wildcards and or regular expressions.
After you’ve unloaded the data from Tamino, undefine the schema, then define the new schema, and then load the modified data back into the DB.
O nthe other hand, if your documents don’t have to begin with (because was optional), then if you modify your schema so as not to have anymore, your documents will satisfy the new schema. To updefine your new schema, from your schema editor, go to the menu, database → define schema with instance check. This way, Tamino will check every document instance you have in tamino against the new schema. If all documents validate, your schema will define. If even one document doesn’t comply, it will not define and tell you which document failed to comply with the new schema. Then you could go and modify that oen particular doc and try the updefine again.
I must advise you that defining with instance check can be a very very long process, depending on how complex your schema is and how many documents you have in your DB already. If it is too long, just unload data, updefine your schema and then load back the data.
Hope this helps!
Peter Endisch
---------------------------------------
I’m a Zen Garden Maintenance Engineer
---------------------------------------
Hi Valentina
I’m not sure that I understood your intention correctly.
My understanding is: you have stored many documents of the structure
tag1
tag2
stored in Tamino - and you want to get rid of all child elements
in order to end up with
tag1
Correct?
You may do the following in order to acchieve that goal:
(1) Modify your schema and make optional (if not yet optional)
(2) Use Tamino’s XQuery update extensions to remove element from all instances
stored in the doctype
(3) Finaly you may remove from the schema (only possible with instance validation)
Best regards
Uli
Hi,
I try to remove tag2 from the schema from empty doctype but Tamino “says”
Invalid modification of components of all detected during schema update; old schema: tsd:doctype : Content0, ; xs:element : Content0, ; xs:complexType, ; xs:all , new schema: tsd:doctype : Content0, ; xs:element : Content0, ; xs:complexType, ; xs:all
thanks you for help
Valentina
Hello Valentina,
could you please post the schema you are using, and also let us know which version of Tamino you are using?
Thanks in advance,
Trevor.
In attach there is my schema, I tried to cancel “teaser” node, but don’t work.
The tamino version is 4.1.4
[This message was edited by Valentina Garotta on 25 May 2004 at 7:49.]
test.TSD (12 KB)
Valentina,
I guess the answer is that you have to do a “define with instance validation”. Explanation: Some schema modifications are uncritical even if
data are loaded (e.g. adding an optional attribute), others are not.
These are accepted by Tamino ony, if all data match the new schema.
By default, Tamino does not perfom the check, but declines the schema update. You can, however, force Tamino to perform the check (define with instance validation).
Unfortunately, this even holds if no data is loaded. But, define with instance validation in this case is as fast as teh “normal” define.
regards
Harald