commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stéphane MOR <stephane...@yahoo.fr>
Subject [jelly] <j:file>, CDATA, '&' and '<'
Date Wed, 28 Aug 2002 00:09:41 GMT
Hi,

I would like to use <j:file/> to generate a Perl Script (this can look 
weird, but anyway ...).

The file I want to generate could look like (this VERY simple script):

<j:file name="myscript.pl" omitXmlDeclaration="true">
#!/usr/bin/perl
sub CheckName{
  my ($name, $age);

  if ( $name != "Stéphane" && $age < 22) {
      $return = &Foo();
      $return .= "you're not the one I expected";
      return $return;
  }else{
      return "welcome !"
  }
}
</j:file>

I solved the problem of the '$' being removed by Jelly when I doubled 
them, ie:
my ($$name, $$age);

I tried to get it running and it said "org.xml.sax.SAXParseException: 
The entity "Foo" was referenced, but not declared."

So, I enclosed the whole thing in a <![CDATA[]]> section.
All run well, but the resulting output file was:

#!/usr/bin/perl
sub CheckName{
  my ($name, $age);

  if ( $name != "Stéphane" &amp;&amp; $age &lt; 22) {
      $return = &amp;Foo();
      $return .= "you're not the one";
      return $return;
  }else{
      return "welcome !"
  }
}

So, I'd like to know how i can output '&', '<' and '>' nicely in a 
<j:file/>, if possible.

Thanx!
Stéphane

PS: This occured while trying to make a Maven Wiki Plugin, using Maven 
HEAD (and the Jelly SNAPSHOT) on a Linux
box under JDK1.3.1.

___________________________________________________________
Do You Yahoo!? -- Une adresse @yahoo.fr gratuite et en français !
Yahoo! Mail : http://fr.mail.yahoo.com

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message