问题描述
我想检查内部网页,所以不能使用 W3C验证服务直接地.我设法在本地运行XHTML验证器,但是css-validator出现了一些问题.我真的不想设置 Tomcat 或拼图,以便能够运行Java servlet,并且命令行选项给我一条错误消息
I want to check internal web pages, so I cannot use the W3C validation service directly. I managed to run the XHTML validator locally, however, I have some problems with the css-validator. I do not really want to setup Tomcat or Jigsaw in order to be able to run Java servlet, and the commandline option gives me an error message
Exception in thread "main" java.lang.NoClassDefFoundError:
org.w3c.tools.resources.ProtocolException at
org.w3c.css.css.CssValidator.main(CssValidator.java:164)
如何在Linux机器上验证本地CSS?
How can I validate local CSS on a Linux box?
推荐答案
您可以调用 W3C验证程序:
任何装有Java的计算机都可以 还可以从 终端/控制台作为命令行 工具.下载css-validator.jar jar存档(或使用ant jar构建它) 并以:
Any computer with Java installed can also run the validator from the terminal/console as a commandline tool. Download the css-validator.jar jar archive (or build it with ant jar) and run it as :
java -jar css-validator.jar http://www.w3.org/
注意:css-validator.jar
文件必须 位于与以下位置完全相同的位置 lib/文件夹即可正常工作.
Note : the css-validator.jar
file must be located at the exact same level as the lib/ folder to work properly.
更新:要使其正常运行,我从CVS中检出了完整发行版,并使用随附的build.xml
运行了ant
.它下载了除servlet.jar
以外的所有依赖项.为了解决这个问题,我下载了 Tomcat 6 的二进制发行版并提取了它.然后,我为css-validator
编辑了build.xml
以反映servlet.lib
的位置:
Update: To get it to work, I checked out the full distribution from CVS and ran ant
using the included build.xml
. It downloaded all dependencies except for servlet.jar
. To deal with that, I downloaded the binary distribution of Tomcat 6 and extracted it. Then, I edited the build.xml
for css-validator
to reflect the location of servlet.lib
:
<property name="servlet.lib"
value="E:/Downloads/apache-tomcat-6.0.20/lib/servlet-api.jar"/>
然后再次运行ant
.这会在从CVS中检出的目录的顶级中生成css-validator.jar
文件,其中的lib
子目录包含其依赖的其他jar
.然后,我能够成功运行验证器:
Then ran ant
again. This produced the css-validator.jar
file in the top level of the directory checked out from CVS with the lib
subdirectory containing the other jar
s it depends on. Then, I was able to run the validator successfully:
C:\Temp\validator\2002\css-validator> java -jar css-validator.jar http://www.unur.com/
这篇关于如何验证内部网页上的CSS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!