Download Delve® SOA Fast-Prototyping Toolkit (Beta 1.0)
| Tutorials - How To Add Logic to Dynamic Elements Generation |
Page 1 of 4 |
Document and element code can include any kinds of statements, not just the “element,” “elementi,” and “end” statements seen in a number of other lessons. This means that they are capable of generating structures and content based arbitrarily complex logic.
In this lesson, we will extend the “How to Dynamically Generate XML Elements” lesson code such that it varies the number and content of interior elements depending on what arguments are passed in. Our first step is to add a new “axle” element that will be nested within the “vehicle” document.

Each axle instance will have a number of “wheel” elements equal to “num-wheels,” so if the caller passes in “4” the axle will have four wheels. |
|
|