Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Mapping Java to XML

Status
Not open for further replies.

jmcq

Technical User
May 10, 2002
2
IE
Say hypothetically, I wanted to create a tool that counted the number of methods in a Java program. The tool would parse the Java code looking for methods and count them.

But what if I had a C++ program and I wanted to count the number of methods in that program. I cannot use the tool I have developed since the syntax for a C++ method and a Java method are different.

My question is, would it be possible to define the syntax for a Java method using XML?
Then develop a tool (that uses the XML) to count the number of methods in a program.

Then the tool could be used for many languages - all that needs to change is the XML representation of a method.

Is this possible or can anyone see how it could be done?

Thanks.
 
You "could" use xml to describe the syntax...

You might want to look into using regular expessions to parse/count the functions...

In C++ there is little difference between a function and a variable, so it might get a little confusing, but, is still possible...

if memory serves...
Java uses the keyword function to mark a function such as...
function int FUN(){...}
Where C++ leaves the function word out...
int FUN(){...}

I think it would be an interesting project...

Goodluck,
-Josh

Visit My Site
PROGRAMMER: (n) Red-eyed, mumbling mammal capable of conversing with inanimate objects.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top