I response to a forum post, someone wrote the code below, which creates an xowiki object. I am trying to work with the code but am not sure what some of it means. Here is the code, with questions below.<br>-------------------------------------------------------------------------<br>
# -*- tcl-*-<br># Sample prototype page to show different output formats<br># Gustaf Neumann, May 2008<br>::xowiki::Object new -title "Multiple Output Types" -text {<br><br> my initialize -parameter {<br> {-format "text"}<br>
}<br><br> proc content {} {<br> my get_parameters<br><br> switch $format {<br> xml {<br> set content_type text/xml<br> set content {<br> <districts><br> <district><br>
<COE_DISTRICT_NAME>VICKSBURG</COE_DISTRICT_NAME><br> <DISTRICT_ABBREVIATION>MVK</DISTRICT_ABBREVIATION><br> </district><br> <district><br>
<COE_DISTRICT_NAME>NEW ORLEANS</COE_DISTRICT_NAME><br> <DISTRICT_ABBREVIATION>MVN</DISTRICT_ABBREVIATION><br> </district><br> <district><br>
<COE_DISTRICT_NAME>ST. PAUL</COE_DISTRICT_NAME><br> <DISTRICT_ABBREVIATION>MVP</DISTRICT_ABBREVIATION><br> </district><br> </districts><br>
}<br> }<br> csv {<br> set content_type text/csv<br> ns_set put [ns_conn outputheaders] Content-Disposition "attachment;filename=sample.csv"<br> set content {<br> VICKSBURG,MVK<br>
NEW ORLEANS,MVN<br> ST. PAUL,MVP<br> }<br> }<br> json {<br> set content_type text/plain<br> set content "<br> \{<br> districts:\{<br> district:\[<br>
\{<br> coe_district_name:'VICKSBURG',<br> district_abbreviation:'MVK'<br> \},<br> \{<br>
coe_district_name:'NEW ORLEANS',<br> district_abbreviation:'MVN'<br> \},<br> \{<br> coe_district_name:'ST. PAUL',<br>
district_abbreviation:'MVP'<br> \}<br> \]<br> \}<br> \}<br> "<br> }<br> default {<br> return [[my info parent] description]<br>
}<br> }<br> ::xo::cc set_parameter master 0<br> ::xo::cc set_parameter content-type $content_type<br> return $content<br> }<br>} -description {<br> I am just a sample service that can return its content in different<br>
formats. <br>Call me e.g. with format<br> <a href='multiple-output-types?format=xml'>xml</a>,<br> <a href='multiple-output-types?format=csv'>csv</a>, or<br> <a href='multiple-output-types?format=json'>json</a>.<br>
}<br>---------------------------------------------------------------------<br>in the lines:<br> ::xo::cc set_parameter master 0<br>
::xo::cc set_parameter content-type $content_type<br>what does the "::xo::cc" mean?<br><br>If the object is being created, how do I reference the object? For instance, I would like to set a variable to "content". How would I do this?<br>
<br>Thank you for any help.<br>