在PHP中验证XHTML5? [英] Validating XHTML5 in PHP?

查看:174
本文介绍了在PHP中验证XHTML5?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

背景

我决定以任何方式向我的网站提供 application / xhtml + xml 接受。我知道有后果,我愿意接受的后果。

Background

I have made the decision to serve my website as application/xhtml+xml to anyone who will accept it. I understand that there are consequences, which consequences I'm willing to accept.

问题

我正在尝试在PHP中验证XHTML5。这样,如果验证失败,我可以将文件作为 text / html 提供(嘿,不是没有人完美)。不过,我的问题即使在我的情况之外也是有用的。

Problem

I'm trying to validate XHTML5 in PHP. That way, I can serve the file as text/html if validation fails (hey, ain't nobody perfect). My question has merit even when taken outside of my situation, though.

那么我有什么选择来验证XHTML5?

我做了什么:

我已经在我的源代码中使用PHP的 DOMDocument 作为模板的形式,所以我希望能够使用 DOMDocument :: relaxNGValidate DOMDocument :: schemaValidate 。我既不能找到 .xsd 也不能找到 .rng 。但是,我想我已经找到了一个目录来制作语法。在今天之前,我甚至从未听说过Relax NG。这个方向有什么帮助吗?

I'm already using PHP's DOMDocument in my source code as a form of templating, so I'd like to be able to use DOMDocument::relaxNGValidate or DOMDocument::schemaValidate. I can find neither .xsd nor .rng to use. However, I think I have found a directory to make an rng grammar out of. Before today, I'd never even heard of Relax NG. Any help on this direction?

推荐答案

new(Nu)HTML5 Validator 具有各种预设的RELAX NG模式,包括XHTML5

The new (Nu) HTML5 Validator has RELAX NG schema for various presets including XHTML5

参见 https://bitbucket.org/validator/syntax/src/ed90a83ab0fd/relaxng https://github.com/validator/validator/tree/master/syntax/relaxng

这是你正在寻找的还是我感到困惑?

Is this what you're looking for or am I confused?

这篇关于在PHP中验证XHTML5?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆