[
Lists Home |
Date Index |
Thread Index
]
This topic is hardly never tackled here or elsewhere ; I'm not sure that
people are interesting with it.
I thought about XNP when I've had to deal with a complex XML
configuration file that I used to drive my processes with declarative
sentences.
Declarative sentences are very concise and expressive (they express
whatever you want), so an application looks like :
<doIt/>
anyway, it is not really tunable, so let's add some more parameters :
<doIt param="likeThis"/>
or
<doIt>
<likeThis>
</doIt>
so, we can add attributes and sub-elements and so-on ; however, we are
limited in expressiveness by complexity : there is always a mean to add
more tags but we are telling to stop when the document became hard to
understand/read/maintain : it's just a configuration file !
Assume that I can express :
<doIt>
<likeThis>
</doIt>
and that I can also express :
<doIt>
<likeThat>
</doIt>
but in a certain case, i'd like to express :
<doIt>
<inThisCase how="likeThis">
<likeThis>
</inThisCase>
<inThisCase how="notLikeThis">
<likeThat>
</inThisCase>
</doIt>
but what I'm really interest in is not <inThisCase> but <likeThis> or
<likeThat> ; by adding the new element, I increase the complexity of my
document, and put off the same (recursive) problem...
there's another way to solve this problem :
-focus on basic features (<doIt>, <likeThis>, <likeThat>)
-delegate things that looks like alternatives to an imperative language
(<inThisCase>)
this implies that :
-my specific features are grouping together (in XML, grouping is done
with namespaces)
-they can be mix with procedure-oriented actions
-a data model is needed
-interaction with the environment is needed (system, I/O...)
<app:doIt>
<xcl:if test="...">
<app:likeThis>
</xcl:if>
<xcl:if test="...">
<app:likeThat>
</xcl:if>
</app:doIt>
I just reinvent the "if" statement ; even in the XML world, people
already use it : look at XSLT, that also mixes some declaration
sentences (<xsl:template>) with procedure-oriented statements (<xsl:if>)
; however, there's not an obvious way to extend XSLT with foreign
vocabularies (XSLT was not design for that purpose, even if the
extension mechanism may be useful in some rare case)
xcl stands for XML Control Language, and is bound to the "right"
namespace URI : it contains tags that allow loops, data assignation, etc...
the app prefix is bound to my application, that do what I expect (I hope)
Isn't that a way to build my application with components ?
I don't talk about taglibs in JSP, for example, because they are focused
on web problematics. A tool such as Ant focused on Java problematics
I found on the web some XNP tentative : water, SSML, PIA, DXP, XFA...
all focused on a single grammar (which is often based on imperative
languages), but none thought about mixing declarative sentences with
procedure oriented sentences
I think that a good framework for XNP should define :
-core libraries such as xcl, I/O, system, RDBMS...
-a way to define custom libraries such as my "app"
-a data model
-a mean to deal with data types (XML or not)
Perspectives :
an example that could be real : a schema (that i won't share) that draws
up a list of values available in an attribute with SQL
here is a snippet code that mixes Relax NG tags with SQL and xcl :
<attribute name="product">
<rdbms:connect db='products-db' driver='...' host='...'
name='products-db' passwd='...' user='...'/>
<rdbms:select connexion='{$products-db}' name='products'
query='SELECT * FROM orders WHERE id={@category}'/>
<choice>
<xcl:for-each name='product' select='{$products}'>
<value>{$product}</value>
</xcl:for-each>
</choice>
</attribute>
Is there anybody interested in such a framework ?
(I will publish mine soon)
--
Cordialement,
///
(. .)
-----ooO--(_)--Ooo-----
| Philippe Poulard |
-----------------------
|