Ask the Expert

Using XML to wrap Java source code

I'd like to know what it would take (I'm sure a lot) to be able to use XML to wrap Java source code. The idea is to be able to use the features and facilities of XML to define the source code so that the source code could be queried with something like XPATH. For example, for requirements tracability to discretely define elements to properly identify source code that supports a given customer feature. The ability to run a query against the source code would make support a lot easier. Obviously, you can achieve the same results with other means, but not nearly as interesting possibilities.

    Requires Free Membership to View

Take a look at JavaML (

Most programming languages are based on formal grammars and have tree representations known as AST's (Abstract Syntax Trees). The AST for Java is available through tools like JavaCC and JJTree (

This was first published in April 2004

There are Comments. Add yours.

TIP: Want to include a code block in your comment? Use <pre> or <code> tags around the desired text. Ex: <code>insert code</code>

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
Sort by: OldestNewest

Forgot Password?

No problem! Submit your e-mail address below. We'll send you an email containing your password.

Your password has been sent to: