Obsolete children on import

Previous Next

An obsolete child is a child record that is considered to be no longer relevant if new information about the parent and its children is imported.

You can instruct XML.Import to delete obsolete children when importing new parent-child information. This applies when you pass parent and child records in a USoft multi-table XML document to XML.Import.

Whether or not XML.Import deletes obsolete children depends on the Type of Relationship of the Relationship between parent and child.

If Type Of Relationship = Reference (the default), child records in the database that do not exist in the XML are NOT deleted.

If Type Of Relationship = Composition, child records in the database that do not exist in the XML ARE deleted.

A child record is considered "not to exist" (see Example 2) in the XML only if both of the following apply:

The wrapper element with the child table's Object Name Plural is in the XML.

Inside this wrapper, no record exists with the primary key value(s) of the child record.

There is a processing instruction called "relationship-behaviour" with which you can direct the engine to treat "Composition" relationships as if they were "Reference" relationships. See Example 4 or go to " usoft-xml processing instruction " for details.

The following examples are imported into this sample database, where the relationship between EMPLOYEE and EMPLOYEE_LANGUAGE_SKILL has Type Of Relationship = Composition:

Table: EMPLOYEE

ID

NAME

101

CELINE

102

ANJA

Table: EMPLOYEE_LANGUAGE_SKILL

EMP_ID

LANG

101

NL

101

SP

102

NL

102

SP

 

 

collapseExample 1: Child records in XML
collapseExample 2: Empty table wrapper element in XML
collapseExample 3: Table is not referred to in XML
collapseExample 4: relationship-behaviour="as-reference"

 

 

See also