This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Java in General and the fly likes Way to use the Java functions in Custom Tool Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Java » Java in General
Reply Bookmark "Way to use the Java functions in Custom Tool" Watch "Way to use the Java functions in Custom Tool" New topic
Author

Way to use the Java functions in Custom Tool

Mahesh Pinnamaneni
Ranch Hand

Joined: Jul 02, 2004
Posts: 100
Hi,

I am creating a tool that reads the XML document and process as per the instructions in XML and parses it.
In the XML document there is a tag where I can have something like this.
<transform>
area = area.toUpperCase();
location = location.substring(5);
</transform>

Like this I would like to use the Java functions.

Wondering how this can be achieved.

Thanks,
Mahesh
Jelle Klap
Bartender

Joined: Mar 10, 2008
Posts: 1408

You could take a look at XQJ (XQuery) implementations and their custom function capabilities.
DataDirect XQuery for instance.


Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 16687
    
  19

Mahesh Pinnamaneni wrote:In the XML document there is a tag where I can have something like this.
<transform>
area = area.toUpperCase();
location = location.substring(5);
</transform>

Like this I would like to use the Java functions.

Wondering how this can be achieved.


If you are using Java 6, one possibility is to use the Java Scripting API. By default, the API has Javascript installed, which looks very much like Java...

If you absolutely need to have Java, then there are about 2 dozen or so, other scripting engines that you can download and install, for this API -- a couple of them implement Java. See this page (https://scripting.dev.java.net/) for details.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Way to use the Java functions in Custom Tool
 
Similar Threads
XSLT to copy an XML document
XML -vs- HTML or others
how to stream text file into result tree using extensions
Urgent help needed! Can somebody reply right away?
XSLT Limitations