Hi everyone !
I'm new in this forum, and I'm french so sorry if my english is bad (hum very bad ^^)...
I'm using the eclipse pmd version 5. I'm sorry if I'm wrong but for the xml language, don't we have need to specify the version of xml in the arguments to execute PMD ?
like that : D:\testpmd\test.xml text D:\wkspace-pmd\pmd-5.0\rulesets\jsp\basic_moi.xml -version xml 1.0 ?
If so, the line about XML in the enumeration "LanguageVersion" in "LanguageVersion.java" must be :
XML(Language.XML, "1.0", new XmlHandler(), true);
instead of :
XML(Language.XML, "", new XmlHandler(), true);
Is this correct ?
Hi,
First as both Xavier Le Vourch and I are French I assume this forum is "french safe" (however we should keep this discussion in english to ensure other can contribute).
Could you tell us what you are trying to do ?
Thank you for your answer, I'll try to explain in english...
I think it's my fault :
First, I tried to run Pmd without the optionals arguments about languages (-version). But it did not work. It made me an error about the arguments.
So, I tried to change the LanguageVersion.java adding "1.0" in the enumeration like I explained in my first post. And it works.
But now it works without these arguments, I don't understand what I have made.
I'm very sorry...
Hi,
No problem ;)
It sounds that you have fixed your issue so I closed it. As you seems to be a newbie to PMD, if you run into more trouble, please ask for helps in the forum rather than create a bug.
A Language in PMD having multiple versions is used to coordinate the selection of a Parser and Rules appropriate for a version. For example, Java 5+ parses quite differently than Java 4 (ie. generics), and there are rules which apply only to Java 5 (or 4) code.
The declaration we have for XML merely says, there are no special versions, treat them all the same. In other words, PMD has to make no internal decisions about how to parse the XML (the DOM parser does the hard part).
The coupling however does prevent creating Rules specific to XML 1.0 and XML 1.1. I am unable to come up with a use case in which PMD Rules need to apply to specific versions of XML. This may just be my ignorance. Do you have an example of a Rule different for XML 1.0 say versus 1.1?
Another issues... PMD currently assumes all files for a given Language are the same version. It's quite possible to throw multiple XML files at PMD from different "versions" of XML. Doing so for Java would be rather strange! Fixing this would be a fair bit of effort.
I did rather extensive research on XML last year and frankly change from 1.0 to 1.1 are really misc. (If I remember correctly this is mostly about encoding issues related to some old mainframes... but I could be wrong, it has been a long time).