Re: velocity and JET (java emitter templates)

2005-02-09 Thread Mike J Boyersmith
Sorry, I don't know anything about JET, but I was wondering if you
could share with us what you have found about the two. 
Shinobu Kawai Yoshida [EMAIL PROTECTED]


Sure thing, What I have found is that JET or Java Emitter Templates is an 
Eclipse technology www.eclipse.org and part of EMF (though I'm sure it 
could have been made a separate plugin). 
Similar to Velocity, JET takes templates, script and data objects and 
merges the three to create a final output.
JET uses a JSP like scripting language. JET also allows full translation 
from templates to resulting output
or you can compile your templates to java classes, and simply invoke the 
java class. 

If your interested in this I have found two really good tutorials on the 
technology which can be found at:

http://www.eclipse.org/articles/Article-JET/jet_tutorial1.html
and
http://www.eclipse.org/articles/Article-JET2/jet_tutorial2.html

I haven't really come to any conclusions other than JET is built into 
eclipse and supports eclipse projects. The few tests I have
ran with JET have been very favorable, I didn't run into any problems with 
what I Was trying to do. 

Performance wise I have no ideas how the two compare, though the compile 
to class feature might be nice. 

ALSO I thought I'd mention that while I was researching JET I ran into 
another new technology that is for reporting 
that is being worked on called BIRT (B.I.R.T.). Business Intelligence and 
Reporting Tools,  take a look at 

http://www.eclipse.org/birt/

Though thats about the extent of my knowledge at this point on it. 


lost '#'s inside #literal()/#end

2005-02-01 Thread Mike J Boyersmith

Return Receipt
   
Your  lost '#'s inside #literal()/#end 
document   
:  
   
was   Mike J Boyersmith/Beaverton/IBM  
received   
by:
   
at:   02/01/2005 09:37:13 PST  
   




velocity and JET (java emitter templates)

2005-01-28 Thread Mike J Boyersmith
Hi Does anyone have any any experience working with both of these template 
technologies?

I'm evaluating both and trying to get a feel for what they can and can't 
do, so far
I'm getting the impression that velocity provides a more flexible solution 
but wondering

whats your experiences out there might have been with both. 



JDOM and NOT using anakia ant task

2005-01-18 Thread Mike J Boyersmith
Its my understanding that if I want to use Anakia it needs to be ran from 
an ant build script?
so.. I want to execute a template against a loaded JDOM. like the 
following:

SAXBuilder builder;
Document root = null;
builder = new SAXBuilder(org.apache.xerces.parsers.SAXParser );
root = builder.build( XMLFile );
 
//Stuff the Document (or root Element) into the context:
VelocityContext context = new VelocityContext();
context.put(root, root );

/* write to file */
BufferedWriter writer = writer = new BufferedWriter(
new FileWriter(./output/StartPage.html));

if ( template != null)
   template.merge(context, writer);


BUT I am not having a whole lot of luck with it parsing my DOM correctly. 
I can dump my JDOM and it shows the tree correctly. 
but I am having problems doing simple things like getting at elements. 
heres an example

I have the following data

?xml version=1.0 encoding=UTF-8?
publish:project name=Published Items xmlns:publish=http://a/b/c;
  publish project
foo
this is foo
/foo
publish:link
 publish link 1
/publish:link
publish:link
 publish link 2
/publish:link
/publish:project

I'm TRYING to get output text for publish:link but no matter what I try 
I can't seem to get
the element. sigh.. I suspect I'm running into a namespace problem. If 
I try to fetch foo it works, but
if I try to fetch publish:link it doesn't. Any ideas?


Heres what I have tried in my script file(note the r, s, t, u, a , b, c , 
d is just to identify my output easier)

html
...
body
-see what kinds of URI, or prefixes we can fetch 
---br
r $root.getPrefix()br
s $root.getRootElement().getPrefix()br
t $root.getNamespaceURI()br
u $root.getRootElement().getNamespaceURI() //Works: RETURNS http://a/b/c

-- now try to get stuff --- br

a $root.getRootElement().getChild(foo).getText()br  //WORKS: returns 
text of foo element

 Everything from here on FAILS to do anything br
 (I got to the point of trying everything I could think 
of..and nadda working)br

b $root.getRootElement().getChild(publish:project, 
http://a/b/c;).getText()br
c $root.getRootElement().getChild(publish:project, 
http://a/b/c;).getText()br
d $root.getRootElement().getChild(project, http://a/b/c;).getText()br
e $root.getRootElement().getChild(project).getText()br 
f $root.getRootElement().getChild(publish:link).getText()br
g $root.getRootElement().getChild(link, http://a/b/c; ).getText()br
h $root.getRootElement().getChild(publish:link, http://a/b/c; 
).getText()br
i $root.getRootElement().getChild(link, publish).getText()br
j $root.getRootElement().getChild(publish:link, publish).getText()br
k $root.getRootElement().getChild(link).getText()br 

Try to get from getChild() directly  ---br
l $root.getChild(publish:link).getText()br
m $root.getChild(link, http://a/b/c; ).getText()br
n $root.getChild(publish:link, http://a/b/c; ).getText()br
o $root.getChild(link, publish).getText()br
p $root.getChild(publish:link, publish).getText()br
q $root.getChild(link).getText()br

/body
/html




Re: JDOM and NOT using anakia ant task (figured out the Namespace problem)

2005-01-18 Thread Mike J Boyersmith
Ok figured out the problem. I have to get an actual namespace object and 
pass it, versus just
passing the namespace text. 



I can dump my JDOM and it shows the tree correctly. 
but I am having problems doing simple things like getting at elements. 
heres an example
...
I'm TRYING to get output text for publish:link but no matter what I 
try 
I can't seem to get
the element. sigh.. I suspect I'm running into a namespace problem. 
If 
I try to fetch foo it works, but
if I try to fetch publish:link it doesn't. Any ideas?

anakia question and possible problem

2005-01-17 Thread Mike J Boyersmith
Having problems getting anakia to transform $root.getChild calls..

I have the following xml data file

?xml version=1.0 encoding=UTF-8?
document
   foo name=waka
 test
   /foo
/document

And the following vsl file (marked by !!! problem is here)

html
head
META content=text/html; charset=UTF-8 
http-equiv=Content-Type/
title Main Title /title
link href=mystyle.css rel=stylesheet type=text/css/
/head
body
img src=overview_banner.jpg/
p class=LargeTitle 
 !--    PROBLEM IS HERE  !! --
 title$root.getChild(foo).getText()/title
/p
/body
/html

and finally the following java code

-
   .
SAXBuilder builder;
Document root = null;
builder = new 
SAXBuilder(org.apache.xerces.parsers.SAXParser );
root = builder.build( XMLFile );
   ... 
//Stuff the Document (or root Element) into the context:
VelocityContext context = new VelocityContext();
context.put(root, root );

Template template =  null;
template = Velocity.getTemplate(templateFile);
.
BufferedWriter writer = writer = new BufferedWriter(
new FileWriter(./output/thePage.html));

if ( template != null)
template.merge(context, writer);

writer.flush();
writer.close();
..
--

When I execute the code and debug, I see the files get loaded and the 
merge, flush and close work fine.
However, my output html still has the literal string 

$root.getChild(foo).getText()

embedded in it. when I check the log I see the following message

 reference : template = StartPage.vsl [line 10,column 17] : 
 $root.getChild(foo).getText() is not a valid reference.

I have tried every variation of xml and $root command I can think of 
and they all give me the same error. The only thing that doesn't produce 
an
error is if I just have $root.

any Idea why my getChild() call isn't working?

thanks for any help here...

Also, anyone have any other examples of using anakia, I can only find one 
that comes with the SDK...bah.