Thursday, 2024-03-28, 2:42 PM
Welcome Guest | RSS
Farhan Khalid
Main | Functional Programming - Forum | Registration | Login
[ New messages · Members · Forum rules · Search · RSS ]
  • Page 1 of 1
  • 1
Forum » Hacking & Cracking » Echo » Functional Programming
Functional Programming
farhan411
Messages: 288
Group: Administrators
Title: Admin
Reputation: 0
Status: Offline

Awards: 1Loading awards ...
Date:
Tuesday,
2009-02-24,
6:42 PM

Message # 1
Functional Programming
Every ECHO script can be thought of as a function; called with a given set of parameters, it produces an output. In the most common case, the inputs are bound to names as parameters in a context, and the output is XML.
Within an ECHO script, every element, whether in the ECHO namespace or otherwise, is either itself a function, or an ECHO modifier/commentary element. The simplest function is one which takes no parameters and produces a literal result.
Example 2. Literal Results
Code

<e:echo xmlns:e='http://namespaces.xmlecho.org/echo">
     <h2>Hello</h2>
</e:echo>
     

produces:
<h2>Hello</h2>
In the above example, an ECHO processor will treat the h2 element as a function which returns the literal results consisting of an element named "h2" and PCDATA contents of "Hello".
Example 3. A Parameterized Script
Code

<e:echo xmlns:e='http://namespaces.xmlecho.org/echo">
     <e:paramSet>
        <e:param name="yourName">Annie</e:param>
     </e:paramSet>  
     <h2>Hello <e:paramRef refParamName="yourName" /></h2>
</e:echo>


produces:
<h2>Hello Annie</h2>
In this example, the h2 is again producing the literal output element "h2" but performs a function call on the ECHO command, e:paramRef to complete the value of h2's PCDATA contents. The e:param element within the e:paramSet declares that the script will make use of a parameter named "yourName" and gives it a default value.
Since: 1) every ECHO command is an XML element, 2) every content element in an ECHO script is a function, and 3) all ECHO functions produce XML, ECHO commands and non-ECHO elements can be nested and composed into sophisticated processing chains.
The Processing Model
The Echo processor converts a request into a result by applying transformation rules. The transformation rules are applied at the data model level. Before the transformations are applied, the Echo request is parsed into an instance of the Echo XML data model.
Elements in the Echo namespace fall broadly into one of two categories:
1. Content producing elements which are evaluated and replaced with the results of their evaluation.
2. Command modifier and commentary elements which are not evaluated for output, but rather provide for the binding of context parameters to names, declaring Echo function parameter lists, or providing other machine or human accessible metadata.
The modifier/commentary elements are: context, paramSet, documentation and meta.


This user has not applied a signature yet.
HTML code to this post
BB-code to this post
Direct link to this post
Forum » Hacking & Cracking » Echo » Functional Programming
  • Page 1 of 1
  • 1
Search:

Copyright MyCorp © 2024

Hosted by uCoz