You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Stéphane MOR <st...@yahoo.fr> on 2002/05/15 00:42:47 UTC

DVSL, Anakia or Texen ?

Hello,

I want to do something, but I am not sure how to do it.
Here it is : I have a XML file, and for each node, I would like to write 
a file.
To make it clearer, I'll show an example :

---------- The XML Snippet ------------
<shoppingcart>
    <meats>
        <meat>
            <name>Beef</name>
            <description>
                I need beef to be healthy.
            </description>
        </meat>
    </meats>
    <fruits>
        <fruit>
            <name>Orange</name>
            <description>
                    This fruit is orange, like the name of the color.
            </description>
        </fruit>
        <fruit>
            <name>Apple</name>
            <description>
                    This fruit is the emblem of Macintosh.
            </description>
        </fruit>
    </fruits>
</shoppingcart>

 From this file, I would like to make those 3 files :

- "meats/Beef.txt" contains the text "I need beef to be healthy."
- "fruits/Orange.txt" contains the text "This fruit is orange, like the 
name of the color."
- "fruits/Apple.txt"   contains the text "This fruit is the emblem of 
Macintosh."

How should I do it ?
The question is actually more "which tools ?" than "how ?".
I considered DVSL, Anakia, and Texen, but I feel that I would need to 
mix 2 of them ...

Any help is appreciated !

Thanks !

PS : as you may have guessed, my real goal is a bit more complex than 
the one
presented here, as I already know what are oranges and apples.  ;-)


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Re: DVSL, Anakia or Texen ?

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 5/14/02 7:18 PM, "Stéphane MOR" <st...@yahoo.fr> wrote:

>> 
>> DVSL
>> 
> Ok, thanks, I think I'll use Texen !   ;-)

I guess I deserve that one :)
 
>> 
>> Ok - I'm getting a bit punchy...
>> 
>> The thing to do here is make a little tool (one that I know I've sketched
>> out about 7 times for this same question...) that writes the file for you,
>> and you use it in the matching rule :
>> 
> Did the sketches come out as code or were they only sketches ?
> (just asking to know if I'll be able to code it !)

Well, I think in all cases they were sketches w/o warranty.  Lets sketch
some more :)
 
>> 
>> 
>> public DejaVu {
>> 
   BufferedWriter bw;

>>   public void open(String filename ) {

        bw = new BufferedWriter(new FileWriter(filename));
>>   }
>> 
>>   public void write(String output ) {

        bw.write(output);
>>    }
>> 
>>   public void close() {

        bw.close();

>>   }
>> }
>> 

Of course, error handling would be good, and I am sure some java.io.* nerd
is going to chop that to pieces :)
 
>> Ok - now make that available via the toolbox
>> 
>> 
>> Then, do match rules lke :
>> 
>> 
>> #match("fruit | meat ")
>> 
>>   $tool.open( "${node.text.value()}.txt")
>>   $tool.write( $node.description.value() )
>>   $tool.close()
>> 
>> #end
>> 
>> 
>> This clearly isn't perfect, but you might get the idea...
>> 
> I'll try that, thanks !
> 
> Stéphane
> 
> PS : you type too fast and answer too many mails in a too short time to
> be human.
> You ARE a bot, admit it !!  ;-)

Bots don't need sleep, and I need an awful lot right now... So I think
not...
 
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



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


Re: DVSL, Anakia or Texen ?

Posted by Stéphane MOR <st...@yahoo.fr>.
>
>
>>How should I do it ?
>>
>
>DVSL
>
>
>>The question is actually more "which tools ?" than "how ?".
>>I considered DVSL, Anakia, and Texen, but I feel that I would need to
>>mix 2 of them ...
>>
>
>DVSL
> 
>
>>Any help is appreciated !
>>
>
>DVSL
>
> 
>
>>Thanks !
>>
>
>DVSL
>
Ok, thanks, I think I'll use Texen !   ;-)

>
>Ok - I'm getting a bit punchy...
>
>The thing to do here is make a little tool (one that I know I've sketched
>out about 7 times for this same question...) that writes the file for you,
>and you use it in the matching rule :
>
Did the sketches come out as code or were they only sketches ?
(just asking to know if I'll be able to code it !)

>
>
> public DejaVu {
>
>   public void open(String filename ) {
>       ... Guess what...
>   }
>
>   public void write(String output ) {
>         ...
>    }
>
>   public void close() {
>      ...
>   }
>}
>
>
>Ok - now make that available via the toolbox
>
>
>Then, do match rules lke :
>
>
>#match("fruit | meat ")
>
>   $tool.open( "${node.text.value()}.txt")
>   $tool.write( $node.description.value() )
>   $tool.close()
>
>#end
>
>
>This clearly isn't perfect, but you might get the idea...
>
I'll try that, thanks !

Stéphane

PS : you type too fast and answer too many mails in a too short time to 
be human.
You ARE a bot, admit it !!  ;-)



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


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


Re: DVSL, Anakia or Texen ?

Posted by "Geir Magnusson Jr." <ge...@adeptra.com>.
On 5/14/02 6:42 PM, "Stéphane MOR" <st...@yahoo.fr> wrote:

> Hello,
> 
> I want to do something, but I am not sure how to do it.
> Here it is : I have a XML file, and for each node, I would like to write
> a file.
> To make it clearer, I'll show an example :
> 
> ---------- The XML Snippet ------------
> <shoppingcart>
>   <meats>
>       <meat>
>           <name>Beef</name>
>           <description>
>               I need beef to be healthy.
>           </description>
>       </meat>
>   </meats>
>   <fruits>
>       <fruit>
>           <name>Orange</name>
>           <description>
>                   This fruit is orange, like the name of the color.
>           </description>
>       </fruit>
>       <fruit>
>           <name>Apple</name>
>           <description>
>                   This fruit is the emblem of Macintosh.
>           </description>
>       </fruit>
>   </fruits>
> </shoppingcart>
> 
> From this file, I would like to make those 3 files :
> 
> - "meats/Beef.txt" contains the text "I need beef to be healthy."
> - "fruits/Orange.txt" contains the text "This fruit is orange, like the
> name of the color."
> - "fruits/Apple.txt"   contains the text "This fruit is the emblem of
> Macintosh."
> 
> How should I do it ?

DVSL


> The question is actually more "which tools ?" than "how ?".
> I considered DVSL, Anakia, and Texen, but I feel that I would need to
> mix 2 of them ...

DVSL
 
> Any help is appreciated !

DVSL

 
> Thanks !

DVSL

Ok - I'm getting a bit punchy...

The thing to do here is make a little tool (one that I know I've sketched
out about 7 times for this same question...) that writes the file for you,
and you use it in the matching rule :

 public DejaVu {

   public void open(String filename ) {
       ... Guess what...
   }

   public void write(String output ) {
         ...
    }

   public void close() {
      ...
   }
}


Ok - now make that available via the toolbox


Then, do match rules lke :


#match("fruit | meat ")

   $tool.open( "${node.text.value()}.txt")
   $tool.write( $node.description.value() )
   $tool.close()

#end


This clearly isn't perfect, but you might get the idea...

   
> 
> PS : as you may have guessed, my real goal is a bit more complex than
> the one
> presented here, as I already know what are oranges and apples.  ;-)
> 
> 
> _________________________________________________________
> Do You Yahoo!?
> Get your free @yahoo.com address at http://mail.yahoo.com
> 
> 
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> 

-- 
Geir Magnusson Jr.
Research & Development, Adeptra Inc.
geirm@adeptra.com
+1-203-247-1713



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