MACROMEDIA COLDFUSION MX 61-DEVELOPING COLDFUSION MX Develop Manual page 501

Developing coldfusion mx applications
Table of Contents

Advertisement

Code
<h2>Object Classes</h2>
<table border="1">
<tr>
<th>Name</th>
<th>Superior class</th>
<th>Must have</th>
<th>May have</th>
</tr>
<cfloop index = "thisElement" list =
#Entrylist2.objectclasses#>
<cfscript>
thisElement = Trim(thisElement);
nameloc = Find("NAME",
thisElement);
descloc = Find("DESC",
thisElement);
suploc = Find("SUP", thisElement);
mustloc = Find("MUST",
thisElement);
mayloc = Find("MAY", thisElement);
endloc = Len(thisElement);
</cfscript>
<tr>
<td><cfoutput>#Mid(thisElement,
nameloc+6, descloc-nameloc-8)
#</cfoutput></td>
<cfif #suploc# NEQ 0>
<td><cfoutput>#Mid(thisElement,
suploc+5, mustloc-suploc-7)#
</cfoutput></td>
<cfelse>
<td>NONE</td>
</cfif>
<cfif #mayloc# NEQ 0>
<td><cfoutput>#Replace
(Mid(thisElement, mustloc+6,
mayloc-mustloc-9), " $ ", ", ",
"all")#</cfoutput></td>
<td><cfoutput>#Replace
(Mid(thisElement, mayloc+5,
endloc-mayloc-8), " $ ", ", ",
"all")#</cfoutput></td>
<cfelse>
<td><cfoutput>#Replace
(Mid(thisElement, mustloc+6,
endloc-mustloc-9), " $ ", ", ",
"all")#</cfoutput></td>
<td>NONE</td>
</cfif>
</tr>
</cfloop>
</table>
Description
Displays the object class name, superior
class, required attributes, and optional
attributes for each object class in a table.
The schema contains the definitions of all
object classes in a comma delimited list, so
the code uses a list type
The thisElement variable contains the object
class definition. Trim off any leading or
trailing spaces, then use the class definition
field keywords in
Find
starting locations of the required fields,
including the Object class ID. (The ID is not
displayed.)
Gets the length of the thisElement string for
use in later calculations.
Displays the field values. Uses the
function to extract individual field values
from the thisElement string.
The top object class does not have a
superior class entry. Handles this special
case by testing the suploc location variable.
If the value is not 0, handles normally,
otherwise, output "NONE".
There might not be any optional attributes.
Handles this case similarly to the superior
class. The calculation of the location of
required attributes uses the location of the
optional attributes if the field exists;
otherwise, uses the end of the object class
definition string.
Advanced topics
tag.
cfloop
functions to get the
Mid
501

Advertisement

Table of Contents
loading

This manual is also suitable for:

Coldfusion mx

Table of Contents