In the examples which follow, AM represents an attribute mark, VM a value mark and SVM a subvalue mark. The results are generated from a dynamic array containing the following data:
CognosVMNorthgate Information SolutionsAM Westerly PointAM Market StreetVMBoundary WayAM BracknellSVMBerkshireVMHemel HempsteadSVMHertsAM RG12 1QBVMHP2 7HU
<address> <line2>svm2svm</line2> </address>
<address> <line2>Westerly Point</line2> </address>
Extracts attribute 2 from the array and inserts it as the value of the node
<line2>
.
<address> <line1>svm1,2svm</line1> </address>
<address> <line1>Northgate Information Solutions</line1> </address>
Extracts attribute 1, value 2 from the array and inserts it as the value of
the node <line1>
.
<address> <line4>svm4,2,1svm</line4> </address>
<address> <line4>Hemel Hempstead</line4> </address>
Extracts attribute 4, value 2, subvalue 1 from the array and inserts it as
the value of the node <line4>
.
<address> <line1>svm1,2svm</line1> <line3>svm3,2svm</line3> <line4>svm4,2,1svm</line4> <postcode>svm5,2svm<postcode> </address>
<address> <line1>Northgate Information Solutions</line1> <line3>Boundary Way</line3> <line4>Hemel Hempstead</line4> <postcode>HP2 7HU</postcode> </address>
Extracts value 2 from each of attributes 1, 3 and 5, and subvalue 1 from value 2 of attribute 4, and inserts them as the values of appropriate XML nodes.
<address> <line1>svm1,1svm</line1> VM <line2>svm2,1svm</line2>VM <line3>svm3,1svm</line3> <line4>svm4,1,1svm</line4> <postcode>svm5,1svm<postcode> </address>
<address> <line1>Cognos</line1> <line2>Westerly Point</line2> <line3>Market Street</line3> <line4>Bracknell</line4> <postcode>RG12 1QB</postcode> </address>
This is similar to Example 4,
but the <line2>
node has been added as optional data, referencing
attribute 2, value 1 of the array. Because this evaluates to the text "Westerly Point",
the <line2>
node is included in the result.
<address> <line1>svm1,2svm</line1> VM <line2>svm2,2svm</line2>VM <line3>svm3,2svm</line3> <line4>svm4,2,1svm</line4> <postcode>svm5,2svm<postcode> </address>
<address> <line1>Northgate Information Solutions</line1> <line3>Boundary Way</line3> <line4>Hemel Hempstead</line4> <postcode>HP2 7HU</postcode> </address>
This is similar to Example 5, but in
this case, the optional node references attribute 2, value 2 of the array.
Because this evaluates to a null string, the <line2>
node is omitted
from the result.
<address line1="svm1,1svm" vmline2="svm2,1svm" vmpostcode="svm5,1svm"> </address>
<address line1="Cognos" line2="Westerly Point" postcode="RG12 1QB"> </address>
This shows how you can set the values of node attributes, rather than node
values. The line2
attribute is optional, but is included in the result
because attribute 2, value 1 of the array evaluates to the text "Westerly Point".
<address line1="svm1,2svm" vmline2="svm2,2svm" vmpostcode="svm5,2svm"> </address>
<address line1="Northgate Information Solutions" postcode="HP2 7HU"> </address>
This is similar to Example 7, but the
optional line2
attribute is omitted from the result because attribute
2, value 1 of the array evaluates to a null string.
<__nis_cont paramDelim="%" optionalDelim="$"/> <address> <line1>%1,2%</line1> $ <line2>%2,2%</line2>$ <line3>%3,2%</line3> <line4>%4,2,1%</line4> <postcode>%5,2%<postcode> </address>
<address> <line1>Northgate Information Solutions</line1> <line3>Boundary Way</line3> <line4>Hemel Hempstead</line4> <postcode>HP2 7HU<postcode> </address>
This is similar to Example 6, but the delimiters have been changed to percent signs instead of subvalue marks, and dollar signs instead of value marks.