Hello,

  JT Paasch has written up a blog story titled "New
Thoth engine" that outlines what looks, sounds, and
works like a XAML parser for Flash.

   JT Paasch writes:

A while back I mentioned something about…what did I
call it?…’eXtensible Thoth’ I think (I’ll call it
‘xThoth’). Anyways, the idea was to create a simple
xml parser which would step through an xml fragment
recursively and invoke a class for each tag it
encounters. This is convenient because then you simply
have to write a class for any tag you want to use, and
you can thereby create xml-dialect libraries.

For example, I might want to use a tag called
<window>. To do that with this xThoth parser, you
would simply need to write a class called ‘window’,
and the xThoth parser would invoke that class whenever
it encounters a <window> tag. You can make the class
do whatever you like, but presumably the class would
render a window in your movie according to specified
attributes. So basically, the xThoth parser would no
longer be limited to the Thoth dialect. Anybody could
create any dialect they wanted simply by creating a
library of classes for any tags in the relevant
dialect.

So I started writing the parser, but I ran into a
number of problems which took some thinking to figure
out how to best handle these problems. The basic issue
is that the xThoth parser would need some API so any
classes you write can tell the xThoth parser to do
certain things. The two main needs were

(1) be able to provide an API to stop the parser and
to start the parser where it left off. For example, a
<stylesheet> tag may need to load and parse some css
document, and you may want the xThoth parser to stop
and wait until that loading is complete before
proceeding. So your ’stylesheet’ class which handles
the <stylesheet> tag will need to tell the xThoth
parser to stop parsing, and then when the stylesheet
has loaded and been parsed, the ’stylesheet’ class
would need to tell the xThoth parser to start parsing
again where it left off.

(2) be able to provide some way to handle multiple
dialects. That means it needs to handle different
namespaces and know how to associate particular
namespaces with particular class libraries.

I’m not particularly happy with how I did it, but both
(1) and (2) are now in the xThoth engine.

The first problem was solved simply by creating
another method which references the main parsing
method. The stopParsing () method simply sets this
other method to null, and the stopParsing () method
simply restores the reference to the main parsing
method. This works okay, but I’m not sure if I like
it. Unfortunately, I can’t figure out some other way
to accomplish the starting/stopping capability.

The second problem was solved by providing a special
‘dialect-library:namespacePrefix’ attribute to the
main <thoth> tag. Basically, this attribute pairs up a
namespace prefix with a class library. So you list the
namespace and its prefix with the traditional
‘xmlns:namespacePrefix’ attribute, and then you
specify the name of the class library with the
‘dialect-library:namespacePrefix’ attribute. That way
you can use as many dialects as you like in a single
document, and the xThoth parser will know which class
libraries to invoke for which tag. Again, I’m not sure
I like this solution, but it’s the most intuitive
thing I can come up with up at the moment.

All that is to say that the xThoth parser seems to be
more or less complete now. The next step is to try and
build some dialects. The first dialect I might try to
create is the ‘Thoth’ library. I might try and make it
even more like SVG this time around, but then again, I
may not. We’ll see. I’ll probably also try to create a
simple XUL dialect to show how the xThoth parser can
be used for client side XUL.

Anyways, if anybody wants a look at the xThoth parser
code, let me know and I’ll email it to you. Of course,
I’ll release it on absconditus.com when I’ve used it a
bunch and know it (more or less) works.

   Source:
http://www.absconditus.com/blog/index.php?p=8

   Has anyone tried out Thoth? Does anyone know any
other XAML-like alternatives for Flash? 

    - Gerald

PS: You can find out more about Thoth @
http://absconditus.com/thoth/guide0.69.html

-------------------
Gerald Bauer

XUL Alliance | http://xul.sourceforge.net  
United XAML  | http://xaml.sourceforge.net

Interested in hiring Gerald Bauer? Yes, I'm available.

If you know of an opportunity in Toronto or Vancouver,
please contact me today.



-------------------------------------------------------
This SF.Net email is sponsored by OSTG. Have you noticed the changes on
Linux.com, ITManagersJournal and NewsForge in the past few weeks? Now,
one more big change to announce. We are now OSTG- Open Source Technology
Group. Come see the changes on the new OSTG site. www.ostg.com
_______________________________________________
xul-talk mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/xul-talk

Reply via email to