2.77 .dataselect[attribute]
This attribute at the same time defines the Data Model attribute specified as index and a selection pattern assigned as value for nodes of an XML Document.
Definition
-
Data type
string
-
Access
get, set
-
changed event
no
The defined Data Model attribute may then be used for linking to a View. Data changes are forwarded through the doccursor attribute specified in the index. The selection pattern describes the nodes of the XML Document where the data is retrieved or stored.
The syntax of the selection pattern is the same as for the pattern definition for the :select method of the doccursor.
The selection pattern of the non-indexed .dataselect attribute defines nodes as starting points for the indexed .dataselect attributes. The selection patterns of the indexed .dataselect attributes are then treated as relative IDM paths. They reference nodes within subtrees whose roots are selected by the non-indexed .dataselect attribute. In this case, the indexed .dataselectattributes do not access the entire XML Document, but only the subnodes of those nodes selected by the non-indexed .dataselect attribute.
For consistent handling of optional XML elements and attributes, the selection of a Data Model attribute returns an empty string if a value does not exist or is not contained within the preselected subtrees.
The attribute .dataselectattr can be used to determine whether the Data Model attribute is linked to the content or an attribute of a node. Data type and cardinality of the Data Model attribute can be controlled with the attributes .dataselecttype and .dataselectcount.
Example
In this example, the data for a list of Nobel laureates comes from an XML Document in which the information for each laureate is contained in a prize
node.
<?xml version="1.0"?> <nobelprizes> <category id="p">Physics</category> <category id="c">Chemistry</category> <prize year="1" category="p"> <merit>discovery of x-rays</merit> <winner>Wilhelm Conrad Röntgen</winner> </prize> <prize year="11" category="c"> <merit>discovery of radioactivity</merit> <winner>Marie Curie</winner> </prize> <prize year="18" category="p"> <merit>development of the concept of quanta</merit> <winner>Max Planck</winner> </prize> <prize year="70" category="c"> <merit>discovery of sugar nucleotides and their role in the biosynthesis of carbohydrates</merit> <winner>Luis Leloir</winner> </prize> </nobelprizes>
The XML nodes then for instance can be linked through Data Model attributes as follows:
... document Doc { doccursor DocCur { .dataselect "..prize"; .dataselect[.Winner] ".winner"; .dataselect[.Year] "."; .dataselect[.Discovery] "merit"; .dataselectattr[.Year] "year"; .dataselecttype[.Year] integer; .dataselectcount[.Year] integer; } } ...
Availability
See also
Attribute