method to_cxs
Contract
Return typewob
No input parameters.
Water Contract
<method to_cxs/>
Returns a string representing the object in _subject that can be read back in to recreate the object. If to_path returns a string when called with a subject, then that string is returned. Otherwise, to_cxs is called to make a full representation of the object. If to_cxs is passed an instance that has fields containing other instances, they will all be printed out in full. If an instance appears more than once in the nested object being printed out, then a representation is printed that, upon being read back in, will have just one object at both locations. This is sometimes referred to as the ability to do "circular printing", since an object can be printed that has itself as a value of a field. Unlike to_cxs, to_cxs will make a path for the top level object if it can. to_xml makes an XML 1.0 syntax of an object whereas to_cxs makes a less verbose, more programmer friendly representation that's still very similar to pure XML.
number.<to_cxs/>"number"
<thing weight=246/>.<to_cxs/>"<thing weight=246/>"
When printing the object it is called with, it tries to print a full representation of the object. For instance, An object that appears more than once in the tree will be represented by exactly one object once the result of to_cxs is executed.
<class foo id=req subfoo=opt/>
<foo "xx" <foo "yy"/> />.<to_cxs/>
'<foo id="xx" subfoo=<foo id="yy"/>/>'
Example: save an object to a file
<file "datafile.cxs"/>.
     <set content=<foo "xx" <foo "yy"/> /> />
Example: Read back in and convert into an object
<execute source=<file "datafile.cxs"/>.content />
<foo id="xx" subfoo=<foo id="yy"/>/>
Example: Use the shortcut of execute on a file
<file "datafile.cxs"/>.<execute/>
<foo id="xx" subfoo=<thing.foo id="yy"/>/>
Calling execute will return the value of the last expression in the file. But you won't really care since executing the file will side-effect the appropriate classes by adding the cached instances to them.