You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@cocoon.apache.org by "gabor.bartha" <ga...@axelero.hu> on 2002/08/08 09:45:50 UTC

Java in XML

Hi all,

I'm new in xml, I'm sure I will ask basic questions.
I have an ttt.xml, an ttt.xsl, an sitemap.xmap, and a myjar.jar files in
my cocoon/mount/tmp dir.

ttt.xml:

<myxml>
<myapplet></myapplet>
</myxml>


ttt.xsl:

<?xml version="1.0"?>

<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
version="1.0">
<xsl:template match="/">
<html><basefont face="Verdana" size="2"/><body>
<xsl:apply-templates />
</body></html>
</xsl:template>

<xsl:template match="myapplet">
<applet codebase="." archive="myjar.jar" code="start" width="100"
height="100"></applet>
</xsl:template>

</xsl:stylesheet>

sitemap.xmsp:

<?xml version="1.0" encoding="iso-8859-1"?>
<map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0" >

<!-- use the standard components -->
<map:components>
<map:generators default="file"/>
<map:transformers default="xslt"/>
<map:readers default="resource"/>
<map:serializers default="html"/>
<map:selectors default="browser"/>
<map:matchers default="wildcard"/>
<map:transformers default="xslt"/>
</map:components>
<map:pipelines>
<map:pipeline>

<map:match pattern="*.html">
<map:generate src="{1}.xml"/>
<map:transform src="ttt.xsl"/>
<map:serialize type="html"/>
</map:match>

</map:match>
</map:pipeline>
</map:pipelines>
</map:sitemap>

When I open /mount/tmp/ttt.html I can see the page and a 100x100 square
instead of the applet, it cannot be started, and I got a
FilenotFoundException in my Java console. The jar file couldn't be found.

WHY?

If I want to use classes and methods from myjar, where I have to copy
it, and how can I call its functions?

Thanks,
Gabor






---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>


Re: Java in XML

Posted by Justin Fagnani-Bell <ju...@paraliansoftware.com>.
Gabor,

   You need a reader for your jar file. Add something like this to your 
pipelines section

<map:match pattern="*.jar">
   <map:read src="{1}.jar" mime-type="application/java-archive"/>
</map>

Justin

On Thursday, August 8, 2002, at 12:45 AM, gabor.bartha wrote:

> Hi all,
>
> I'm new in xml, I'm sure I will ask basic questions.
> I have an ttt.xml, an ttt.xsl, an sitemap.xmap, and a myjar.jar files in
> my cocoon/mount/tmp dir.
>
> ttt.xml:
>
> <myxml>
> <myapplet></myapplet>
> </myxml>
>
>
> ttt.xsl:
>
> <?xml version="1.0"?>
>
> <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
> version="1.0">
> <xsl:template match="/">
> <html><basefont face="Verdana" size="2"/><body>
> <xsl:apply-templates />
> </body></html>
> </xsl:template>
>
> <xsl:template match="myapplet">
> <applet codebase="." archive="myjar.jar" code="start" width="100"
> height="100"></applet>
> </xsl:template>
>
> </xsl:stylesheet>
>
> sitemap.xmsp:
>
> <?xml version="1.0" encoding="iso-8859-1"?>
> <map:sitemap xmlns:map="http://apache.org/cocoon/sitemap/1.0" >
>
> <!-- use the standard components -->
> <map:components>
> <map:generators default="file"/>
> <map:transformers default="xslt"/>
> <map:readers default="resource"/>
> <map:serializers default="html"/>
> <map:selectors default="browser"/>
> <map:matchers default="wildcard"/>
> <map:transformers default="xslt"/>
> </map:components>
> <map:pipelines>
> <map:pipeline>
>
> <map:match pattern="*.html">
> <map:generate src="{1}.xml"/>
> <map:transform src="ttt.xsl"/>
> <map:serialize type="html"/>
> </map:match>
>
> </map:match>
> </map:pipeline>
> </map:pipelines>
> </map:sitemap>
>
> When I open /mount/tmp/ttt.html I can see the page and a 100x100 square
> instead of the applet, it cannot be started, and I got a
> FilenotFoundException in my Java console. The jar file couldn't be 
> found.
>
> WHY?
>
> If I want to use classes and methods from myjar, where I have to copy
> it, and how can I call its functions?
>
> Thanks,
> Gabor
>
>
>
>
>
>
> ---------------------------------------------------------------------
> Please check that your question  has not already been answered in the
> FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>
>
> To unsubscribe, e-mail:     <co...@xml.apache.org>
> For additional commands, e-mail:   <co...@xml.apache.org>
>


---------------------------------------------------------------------
Please check that your question  has not already been answered in the
FAQ before posting.     <http://xml.apache.org/cocoon/faq/index.html>

To unsubscribe, e-mail:     <co...@xml.apache.org>
For additional commands, e-mail:   <co...@xml.apache.org>