服务器端 CSS 选择器

server-side css selectors(服务器端 CSS 选择器)
本文介绍了服务器端 CSS 选择器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个工具,它将检查动态生成的 XHTML 并根据预期内容对其进行验证.

I am creating a tool that will check dynamically generated XHTML and validate it against expected contents.

我需要确认结构正确且特定属性存在/匹配.可能还有其他我不感兴趣的属性,所以直接字符串比较是不合适的.

I need to confirm the structure is correct and that specific attributes exist/match. There may be other attributes which I'm not interested in, so a direct string comparison is not suitable.

验证这一点的一种方法是使用 XPath,我已经实现了这一点,但我还想要一些不那么冗长的东西 - 我希望能够使用 CSS 选择器,就像我可以使用 jQuery 一样,但在服务器上 - 在CFML 代码 - 而不是在客户端上.

One way of validating this is with XPath, and I have implemented this already, but I would also like something less verbose - I want to be able to use CSS Selectors, like I can with jQuery, but on the server - within CFML code - as opposed to on the client.

是否有 CFML 或 Java 库允许我针对 XHTML 字符串使用 CSS 选择器?

推荐答案

我刚刚发布了一个开源项目,它是 Java 中的 W3C CSS Selectors Level 3 实现.请试一试.我一直在寻找同样的东西,并决定实现我自己的引擎.它的灵感来自 WebKit 等中的代码.

I've just released an open source project which is a W3C CSS Selectors Level 3 implementation in Java. Please give it a try. I was looking for the same thing and decided to implement my own engine. It's inspired by the code in WebKit etc.

http://github.com/chrsan/css-selectors/tree

这篇关于服务器端 CSS 选择器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

How can create a producer using Spring Cloud Kafka Stream 3.1(如何使用Spring Cloud Kafka Stream 3.1创建制片人)
Insert a position in a linked list Java(在链接列表中插入位置Java)
Did I write this constructor properly?(我是否正确地编写了这个构造函数?)
Head value set to null but tail value still gets displayed(Head值设置为空,但仍显示Tail值)
printing nodes from a singly-linked list(打印单链接列表中的节点)
Control namespace prefixes in web services?(控制Web服务中的命名空间前缀?)