XPath queries in your code vs pmd designer

1 view
Skip to first unread message

Alifiya Hussain

unread,
Apr 3, 2005, 4:44:15 PM4/3/05
to JCVSR...@googlegroups.com
hi guys,

I am playing around with XPath Queries for new metrics and I can't seem to
figure out how to get a query that works in pmd's Designer to work in your
code, and vice versa.

Eg, if I type in "ClassDeclaration:" or "InterfaceDeclaration:" into the
designer, it doesnt work, while they do in the code. At the same time,
"//ClassOrInterfaceDeclaration//MethodDeclaration" gives me the methods in
a class/interface but having this regexp returns a zero in the code.

Why is this?

Alifiya

David James

unread,
Apr 3, 2005, 5:08:02 PM4/3/05
to JCVSR...@googlegroups.com
PMD parses source code and converts it to a tree of objects. PMD
allows you to search this tree of objects using XPath. JCVSReport does
not.

Instead, JCVSReport takes the tree of objects returned by PMD and
dumps it out to a big string. JCVSReport allows you to search this big
string using a regular expression.

PMD designer shows you the 'big string' representation of any Java
class on screen. This is quite handy when you're writing regular
expressions for JCVSReport.

Cheers,

David


--
http://www.cs.toronto.edu/~james
Reply all
Reply to author
Forward
0 new messages