Don't you need an XML Virtual Machine ?

P

Philippe Poulard

Hi,

RefleX is a Java tool that allows people that have no particular
knowledge of Java to write smart programs entirely in XML. The concepts
of native XML programming used in RefleX have been designed separately,
so that other implementations on other platforms/languages can be
considered. As the tags used are considered "active", the underlying
concepts have been named "Active Tags". Programming in XML allows
developers to efficiently produce batch scripts as well as Web
applications. With Active Tags, you can dramatically decrease the number
of lines you have to code.

RefleX 0.1.3, a general-purpose XML Virtual Machine, is available here :
http://reflex.gforge.inria.fr/

In this release, you'll find tutorials for mapping SQL to arbitrary
complex XML structures, and for experimenting the Active Schema Language
: express constraints on XML documents that you can't achieve with DTD,
W3C XML Schema, neither Relax NG, and define custom semantic data types.

Enjoy !

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
 
R

Roedy Green

RefleX is a Java tool that allows people that have no particular
knowledge of Java to write smart programs entirely in XML

That strikes me as like saying "X is is a tool for people who have not
yet learned to drive to drive blindfolded encased in bubblewrap." XML
adds many level of DIFFICULTY. Look at ant. Even the simplest things
become hideously awkward.
 
D

Daniel Dyer

That strikes me as like saying "X is is a tool for people who have not
yet learned to drive to drive blindfolded encased in bubblewrap." XML
adds many level of DIFFICULTY. Look at ant. Even the simplest things
become hideously awkward.

I am stumped trying to find a problem that this would solve.

Now what we really need is a mark-up format for XML, so we don't have to
write XML directly. Here's a first stab:

[Element name="myElement"]
[Attribute name="myAttribute" value="myValue" /]
[Content]My textual content.[/Content]
[/Element]

This would could then be compiled into the native XML. This approach
neatly decouples the document mark-up from the concrete implementation of
the mark-up language, allowing the data to me compiled to any
heirarchical, text-based mark-up language that you chose. Here's how the
XML output might look:

<myElement myAttribute="myValue">
Please somebody stop this nonsense.
</myElement>

Dan.
 
J

James McGill

[Element name="myElement"]
[Attribute name="myAttribute" value="myValue" /]
[Content]My textual content.[/Content]
[/Element]

I know you're joking, but I've seen meta-markup that was just as silly,
in a serious context.
 
J

James McGill

That strikes me as like saying "X is is a tool for people who have not
yet learned to drive to drive blindfolded encased in bubblewrap." XML
adds many level of DIFFICULTY. Look at ant. Even the simplest things
become hideously awkward.

I disagree, for ant, except in degenerate cases where the project is
simpler than the build script.

Now, XSLT functions. Iterating through a data structure, sorting,
searching, formatting, that sort of thing in XSLT is always a
nightmare.
 
O

Oliver Wong

Daniel Dyer said:
Now what we really need is a mark-up format for XML, so we don't have to
write XML directly. Here's a first stab:

[Element name="myElement"]
[Attribute name="myAttribute" value="myValue" /]
[Content]My textual content.[/Content]
[/Element]

This would could then be compiled into the native XML. This approach
neatly decouples the document mark-up from the concrete implementation of
the mark-up language, allowing the data to me compiled to any
heirarchical, text-based mark-up language that you chose. Here's how the
XML output might look:

<myElement myAttribute="myValue">
Please somebody stop this nonsense.
</myElement>

Yes, but then someone would have to actually LEARN your meta markup
language. We should have a descriptive language which allows you to define
the syntax for your language, and it should look as much like plain English
as possible, so that anybody could read it. We'd start off with an
identification division, so that we could uniquely refer to these template
languages for maximum re-use, then describe the encoding that the file uses
so that parsers could... well... parse them.

000100 IDENTIFICATION DIVISION.
000200 TEMPLATE-ID: DanielDyerMarkupLanguage.
000300 AUTHOR: Daniel Dyer, Oliver Wong.
000400 ENVIRONMENT DIVISION.
000500 SOURCE-ENCODING: ASCII.
000600 LINE-ENDINGS: Unix.
000650 FILENAME-EXTENSION: ".ddml".
000700 MAIN-DESCRIPTION DIVISION.
000800 CASE IS: Significant.
000900 WHITESPACE IS: Insignificant.
001000 TAG-OPENING-STRING IS "[".
001100 TAG-CLOSING-STRING IS "]".
001200 TAG-END-MARKER IS "/".
001300 SHORT-CUT-TAGS ARE Allowed.
001400 ELEMENT-STRING IS "Element".
001500 ATTRIBUTE-STRING IS "Attribute".
001600 NAME-ATTRIBUTE-STRING IS "name".
001700 VALUE-ATTRIBUTE-STRING IS "value".
001800 CONTENT-STRING IS "Content".
001900 END-MARKUP-DESCRIPTION.

There, now people (and more importantly, computers) can understand how
to use your generic markup language! The line numbers are present so that
copy-and-pasting code snippets in the wrong order can be detected and
rectified. The practice is to increment them by 100s, in case you need to
later insert a line (as I have done so; can you spot where?)

I wasn't sure if you intended for your markup language to be case
sensitive or not, so I arbitrarily guessed that it was.

- Oliver
 
C

Chris Uppal

Daniel said:
I am stumped trying to find a problem that this would solve.

I think the idea is that it /causes/ the problems...

[Element name="myElement"]
[Attribute name="myAttribute" value="myValue" /]
[Content]My textual content.[/Content]
[/Element]

[Grin/]

-- chris
 
P

Philippe Poulard

Roedy said:
That strikes me as like saying "X is is a tool for people who have not
yet learned to drive to drive blindfolded encased in bubblewrap."

I mean : people that have a knowledge of computer sciences can use
RefleX even if they don't know Java, because entire applications can be
written exclusively with tags in RefleX. But if you want to embed some
existing Java classes, you're welcome !

XML
adds many level of DIFFICULTY. Look at ant. Even the simplest things
become hideously awkward.

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
 
P

Philippe Poulard

Oliver said:
Now what we really need is a mark-up format for XML, so we don't have
to write XML directly. Here's a first stab:

[Element name="myElement"]
[Attribute name="myAttribute" value="myValue" /]
[Content]My textual content.[/Content]
[/Element]

This would could then be compiled into the native XML. This approach
neatly decouples the document mark-up from the concrete implementation
of the mark-up language, allowing the data to me compiled to any
heirarchical, text-based mark-up language that you chose. Here's how
the XML output might look:

<myElement myAttribute="myValue">
Please somebody stop this nonsense.
</myElement>


Yes, but then someone would have to actually LEARN your meta markup
language. We should have a descriptive language which allows you to
define the syntax for your language, and it should look as much like
plain English as possible, so that anybody could read it. We'd start off
with an identification division, so that we could uniquely refer to
these template languages for maximum re-use, then describe the encoding
that the file uses so that parsers could... well... parse them.

000100 IDENTIFICATION DIVISION.
000200 TEMPLATE-ID: DanielDyerMarkupLanguage.
000300 AUTHOR: Daniel Dyer, Oliver Wong.
000400 ENVIRONMENT DIVISION.
000500 SOURCE-ENCODING: ASCII.
000600 LINE-ENDINGS: Unix.
000650 FILENAME-EXTENSION: ".ddml".
000700 MAIN-DESCRIPTION DIVISION.
000800 CASE IS: Significant.
000900 WHITESPACE IS: Insignificant.
001000 TAG-OPENING-STRING IS "[".
001100 TAG-CLOSING-STRING IS "]".
001200 TAG-END-MARKER IS "/".
001300 SHORT-CUT-TAGS ARE Allowed.
001400 ELEMENT-STRING IS "Element".
001500 ATTRIBUTE-STRING IS "Attribute".
001600 NAME-ATTRIBUTE-STRING IS "name".
001700 VALUE-ATTRIBUTE-STRING IS "value".
001800 CONTENT-STRING IS "Content".
001900 END-MARKUP-DESCRIPTION.

There, now people (and more importantly, computers) can understand
how to use your generic markup language! The line numbers are present so
that copy-and-pasting code snippets in the wrong order can be detected
and rectified. The practice is to increment them by 100s, in case you
need to later insert a line (as I have done so; can you spot where?)

I wasn't sure if you intended for your markup language to be case
sensitive or not, so I arbitrarily guessed that it was.

- Oliver

SGML already did it like this before ;)
XML brought simplicity to SGML : there are no options like those above,
all is hard-coded in the spec ; it just remains the syntax, tags

But RefleX is not a question of syntax, it's a question of features ; I
didn't want another language that makes the stuff like others, I wanted
a language that of course has the characteristics of programming
languages, but that also could make things differents :
-allow to mix declarative-oriented sentences with imperative instructions
-allow to consider some objects like XML-friendly objects in order to
apply XPath expressions on them, and apply XUpdate-like operations to
modify them
-etc

the result is that when we designed a complete application with RefleX
which is in production today at INRIA, we did it with few tags (about
10% of the lines of codes that we should have to produce with Java),
despite the intrinsic verbosity of XML

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
 
C

Chris Uppal

Philippe said:
the result is that when we designed a complete application with RefleX
which is in production today at INRIA, we did it with few tags (about
10% of the lines of codes that we should have to produce with Java),
despite the intrinsic verbosity of XML

What did you use to edit the XML ? (Genuinely curious).

-- chris
 
P

Philippe Poulard

Chris said:
Philippe Poulard wrote:




What did you use to edit the XML ? (Genuinely curious).

a text editor...

for long times I have experimented SGML/XML editors, but they are
suitable for end-users ; developpers only need colour-syntaxic and a
smart way to close open tags : that's enough for me

I intend -one day, surely- to design the ultimate XML editor ;)


--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
 
R

Roedy Green

I mean : people that have a knowledge of computer sciences can use
RefleX even if they don't know Java, because entire applications can be
written exclusively with tags in RefleX. But if you want to embed some
existing Java classes, you're welcome !

Which is obviously far more awkward than coding in Java.
 
R

Roedy Green

Which is obviously far more awkward than coding in Java.

For example, show the following piece of Java code in XML


if ( s.endsWith( ".txt ) && s.length() > 5 )
{
System.out ( s + " is a text file" );
}
else
{
s = null;
}
 
O

Oliver Wong

Roedy Green said:
For example, show the following piece of Java code in XML


if ( s.endsWith( ".txt ) && s.length() > 5 )
{
System.out ( s + " is a text file" );
}
else
{
s = null;
}

Isn't that a single instruction?

<testIsTextFileByExtensionAndEmitToConsoleElseSetToNull ref="s"/>

Actually, I took a look at their site, and the language does not look
much easier to learn than Java, though it is quite concise for writing of
web apps. Personally, I find declarative programming confusing, and prefer
procedural, so I'd use PHP over this RefleX language, if I wanted to write
up a quick and dirty web app, but maybe that's just my personal opinion.

To the OP, I don't think you should market this as "easier to learn than
Java", especially in this newsgroup, because most people here already KNOW
Java, and so the "barrier of learning Java" isn't even an issue for them.
Look for other strengths in the product, and focus on those instead.

- Oliver
 
P

Philippe Poulard

Roedy said:
For example, show the following piece of Java code in XML


if ( s.endsWith( ".txt ) && s.length() > 5 )
{
System.out ( s + " is a text file" );
}
else
{
s = null;
}

I'm sure Java is better to deal with such low-level problems...

Now, let's reverse the question, for example :

consider that $dir handles a directory on any filesystem (local, webdav,
ftp, xmldb, zip, tar, jar...)
in RefleX you can use XPath to select files

-recursively under the tree :
$dir//*

-that are only files :
$dir//*[@io:is-file]

-which ends with 'txt'
$dir//*[@io:is-file][@io:extension='txt']

-who are not under a parent directory named 'WEB-INF'
$dir//*[@io:is-file][@io:extension='txt'][name(..)!='WEB-INF']

Now, do the same with Java ^^

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
 
P

Philippe Poulard

Oliver said:
Isn't that a single instruction?

<testIsTextFileByExtensionAndEmitToConsoleElseSetToNull ref="s"/>

:)

possible, although very useless
Actually, I took a look at their site, and the language does not look
much easier to learn than Java, though it is quite concise for writing
of web apps. Personally, I find declarative programming confusing, and
prefer procedural, so I'd use PHP over this RefleX language,

RefleX in not a language, it's an engine where several XML languages can
be run

I called this executable XML "Active Tags" ; Active Tags just specifies
a behaviour, not how you could implement it

if I wanted
to write up a quick and dirty web app, but maybe that's just my personal
opinion.

To the OP, I don't think you should market this as "easier to learn
than Java", especially in this newsgroup, because most people here
already KNOW Java, and so the "barrier of learning Java" isn't even an
issue for them. Look for other strengths in the product, and focus on
those instead.

it's not a barrier, as you can also use Java if you like, but you're
true, it's better to focus on RefleX's strengths ; there are many
reasons for which you should prefer Active Tags instead of other similar
technologies like PHP/ASP/JSP/Cocoon/etc :

-those mentioned above are all dedicated to a Web environment, whereas
RefleX can run XML programs in a Web environment as well as from the
command-line

-try to define a schema language with any of them ; it wouldn't be
obvious (at best), or would be simply impossible (at worst) ! RefleX
embeds one called the Active Schema Language, which goes a step further
than DTD, W3C XML Schema, and Relax NG (for example, ASL allows to
design dynamic content models and design semantic data types)

-there are also some smart features in Active Tags not available with
its competitors : in Active Tags you can consider some non-XML objects
as XML-friendly : use XPath to access them and apply XUpdate-like
operations to modify them

-programs written with Active Tags (that are called Active Sheets) can
dramatically decrease the amount of code to produce (we used it in a
production environment at INRIA for a real application, and estimate
that the number of lines to code was reduced to 10% (comparison with the
hypothetic lines of Java to write))

-you can extend Active Tags with custom modules (libraries) ; you can
design declarative-oriented grammar -which are very concise and
expressive- and make them runnable within RefleX ; RefleX also allows to
switch from declarative sentences to imperative instructions when you
have reached the intrinsic limits of the declarative grammar

-RefleX is self-descriptive, it is built upon itself : any built-in or
custom module is an application of RefleX ; Active Tags foundations are
very sane, based on the cooperation of few core modules, each focusing
on a single well-defined problematic

-you can define custom tags and functions with other tags (a kind of
macro mechanism)

-Active Tags is easy to use and easy to learn : what you need is only a
knowledge of computer sciences in general, XML + namespaces + XPath ;
Active Sheets are easy to read

-you can design entire applications with RefleX without writting any
Java code ; but you can also embed your own Java classes

-etc

now, Active Tags is very young, but it certainly bring some renewal in
XML technologies

I'm aware that Active Tags looks like JSP, JSTL/taglibs, XSLT, Ant,
Jelly, XMLBeans, Cocoon, etc ; I even hope that everyone recognize a
little of each in Active Tags, because Active Tags is a kind of
"all-in-one"

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
 
W

Wibble

Philippe said:
Roedy said:
For example, show the following piece of Java code in XML


if ( s.endsWith( ".txt ) && s.length() > 5 )
{ System.out ( s + " is a text file" );
}
else
{
s = null;
}


I'm sure Java is better to deal with such low-level problems...

Now, let's reverse the question, for example :

consider that $dir handles a directory on any filesystem (local, webdav,
ftp, xmldb, zip, tar, jar...)
in RefleX you can use XPath to select files

-recursively under the tree :
$dir//*

-that are only files :
$dir//*[@io:is-file]

-which ends with 'txt'
$dir//*[@io:is-file][@io:extension='txt']

-who are not under a parent directory named 'WEB-INF'
$dir//*[@io:is-file][@io:extension='txt'][name(..)!='WEB-INF']

Now, do the same with Java ^^
What does this have to do with XML? Don't you
just need a java library with that interface?
A file system agnostic directory class would be
nice.

And how is
$dir//*[@io:is-file][@io:extension='txt'][name(..)!='WEB-INF']

something a non-programmer can write?

Dont confuse terse with simple.
 
P

Philippe Poulard

Wibble said:
Philippe said:
Roedy said:
I mean : people that have a knowledge of computer sciences can use
RefleX even if they don't know Java, because entire applications
can be written exclusively with tags in RefleX. But if you want to
embed some existing Java classes, you're welcome !



Which is obviously far more awkward than coding in Java.




For example, show the following piece of Java code in XML


if ( s.endsWith( ".txt ) && s.length() > 5 )
{ System.out ( s + " is a text file" );
}
else
{
s = null;
}



I'm sure Java is better to deal with such low-level problems...

Now, let's reverse the question, for example :

consider that $dir handles a directory on any filesystem (local,
webdav, ftp, xmldb, zip, tar, jar...)
in RefleX you can use XPath to select files

-recursively under the tree :
$dir//*

-that are only files :
$dir//*[@io:is-file]

-which ends with 'txt'
$dir//*[@io:is-file][@io:extension='txt']

-who are not under a parent directory named 'WEB-INF'
$dir//*[@io:is-file][@io:extension='txt'][name(..)!='WEB-INF']

Now, do the same with Java ^^
What does this have to do with XML?

XPath is somewhat tightly related to XML :)

Don't you
just need a java library with that interface?

RefleX is such a library
A file system agnostic directory class would be
nice.

And how is
$dir//*[@io:is-file][@io:extension='txt'][name(..)!='WEB-INF']

something a non-programmer can write?

RefleX is not a tool for end-users
Dont confuse terse with simple.

If you know XPath and XML, it will be easy to understand programs
written with Active Tags

--
Cordialement,

///
(. .)
--------ooO--(_)--Ooo--------
| Philippe Poulard |
 
O

Oliver Wong

Philippe Poulard said:
it's not a barrier, as you can also use Java if you like, but you're true,
it's better to focus on RefleX's strengths ; there are many reasons for
which you should prefer Active Tags instead of other similar technologies
like PHP/ASP/JSP/Cocoon/etc :

-those mentioned above are all dedicated to a Web environment, whereas
RefleX can run XML programs in a Web environment as well as from the
command-line

I don't know about the others, but you can also run PHP from the command
line. Also, from my understanding, RefleX programs always emit XML documents
as output. Is this correct? If not, you may wish to update the tutorial (or
"Hello World" example) on your site to clarify this.

-try to define a schema language with any of them ; it wouldn't be obvious
(at best), or would be simply impossible (at worst) ! RefleX embeds one
called the Active Schema Language, which goes a step further than DTD, W3C
XML Schema, and Relax NG (for example, ASL allows to design dynamic
content models and design semantic data types)

-you can extend Active Tags with custom modules (libraries) ; you can
design declarative-oriented grammar -which are very concise and
expressive- and make them runnable within RefleX ; RefleX also allows to
switch from declarative sentences to imperative instructions when you have
reached the intrinsic limits of the declarative grammar

-RefleX is self-descriptive, it is built upon itself : any built-in or
custom module is an application of RefleX ; Active Tags foundations are
very sane, based on the cooperation of few core modules, each focusing on
a single well-defined problematic

-you can define custom tags and functions with other tags (a kind of macro
mechanism)
</groupOfFeatures>

I've grouped the above features together because, to me, they are
abstract, hard to understand, and it's not clear to me why they would help
me write programs faster. I think you should provide a concrete scenario
that a programmer might find themselves in, and then show what they might do
if they were using Java (if posting to a Java group; replace with some other
language if posting to a different group), and then compare what they would
do in RefleX, to show why RefleX is better.

For example, when you write "Try to define a schema language with any of
them", I think "Gee, when was the last time I was coding this Java
application, and I *really* wished I could define my own schema language?"
and the answer seems to be very rarely. So when I read about this "feature"
in RelaX, I'm thinking "It looks like this product solves a problem that I
don't have".

BTW, I'm not trying to be argumentative for the sake of arguing; rather,
I'm just trying to point out why the features of RelaX, as they have been
presented so far, might not be so appealing. I'm doing this because if RelaX
actually does turn out to be a decent time-saving tool, I'd like to know
about it. So I'm trying to give you a chance to illustrate all the strengths
of RelaX.
-programs written with Active Tags (that are called Active Sheets) can
dramatically decrease the amount of code to produce (we used it in a
production environment at INRIA for a real application, and estimate that
the number of lines to code was reduced to 10% (comparison with the
hypothetic lines of Java to write))

This is somewhat a weak argument, because we might suspect you of just
being a sloppy Java programmer. The example you posted in another branch of
this thread (recursively list all text files in a subdirectory which is not
in /WEBINF/) was a very good one, as it does seem shorter in Active Tags
than in Java. You should stick to concrete examples like these whenever
possible.
-there are also some smart features in Active Tags not available with its
competitors : in Active Tags you can consider some non-XML objects as
XML-friendly : use XPath to access them and apply XUpdate-like operations
to modify them

Okay, this sounds handy. I saw you gave an "XML-like" view of the OS
file system. What other kind of objects can you provide an XML-like view of?
-Active Tags is easy to use and easy to learn : what you need is only a
knowledge of computer sciences in general, XML + namespaces + XPath ;
Active Sheets are easy to read

This claim is also weak, after having looked at your sample code. I'm
fairly comfortable with Computer Science, XML and XPath, but I had a lot of
difficulty understanding the code posted on your site. It actually looks
like there's some other language embedded within the attributes and contents
of the XML, and THAT'S the programming language in which the behaviour of
the application is encoded, rather than in the XML itself.

For example, when you have a node like:

<rdbms:connect name="db" url="{ string(
$web:application/@web:init-param/@db-url ) }"/>

I'm wondering how many of those are keywords that I have to memorize, and
how many of them are names that were defined elsewhere (perhaps in some
external/included file?). Your tutorial needs a lot of work in this
direction. Right now it's almost "copy and paste these programs, and you'll
see these results", rather than "here's the structure of an ActivePage
program, and here's what all the instructions do".
-you can design entire applications with RefleX without writting any Java
code ; but you can also embed your own Java classes

This might be best for someone transitioning from Java to RefleX. Can
you show some concrete examples of these as well? Maybe given an example
scenario of where a Java programmer can write, say, 99% of his or her
application in Java, but then use a bit of RefleX to handle the cases where
RefleX excels at? The AspectJ tutorials that are out there take a similar
approach: They show how a cautious Java programmer can "test the waters"
with AspectJ, before diving in completely.

- Oliver
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,995
Messages
2,570,226
Members
46,815
Latest member
treekmostly22

Latest Threads

Top