使用JS / jQuery对xsd验证xml [英] Validate an xml against xsd with JS/jQuery

查看:269
本文介绍了使用JS / jQuery对xsd验证xml的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要知道,如果有一个解决方案适用于所有主流浏览器,可以针对xsd验证xml。我没有时间自己创建实际的验证功能。这是一个需要在两周内完成的项目,作为我的学徒考试。

I need to know, if there is a solution which works in all major browsers for validating an xml against an xsd. I don't have the time for creating the actual validation functionality myself. It's for a project which needs to be done in 2 weeks as an exam for my apprenticeship.

将xml验证器作为jQuery登录进行会很好。所以我有两个问题。

Doing an xml validator as a jQuery login would be nice. So i got 2 Questions.

JS或jQuery中有预制的xml验证插件/功能,如PHP的http://php.net/manual/de/domdocument.schemavalidate.php ?没有ActiveX,因为IE只支持ActiveX(afaik)。它是不方便的,如果我没记错的话,用户总是必须同意它。

Is there a pre-made xml validation plugin/functionality in JS or jQuery like PHP's http://php.net/manual/de/domdocument.schemavalidate.php ? No ActiveX, since ActiveX is just supported by IE (afaik). And it is unhandy, if i remember correctly, the user always has to agree with it.

我总是刚刚找到,自制的XML验证(没有架构)或制作的东西用ActiveX。所以,如果没有我可以通过xml和xsd的xml验证插件/功能,我想快速介绍一下我将如何自己做,所以我可以更好地成像。对xsd进行自己的xml验证可能很快就做了很多工作,对吗?

I always just found, selfmade validation of XML (no schemas) or stuff made with ActiveX. So, if there is no xml validation plugin/functionality to which i just can pass a xml and a xsd, i would like to get a quick introduction on how i would do it myself, so i can imagen it better. Probably it's quick a lot of work for making my own xml validation against xsd, right?

谢谢

推荐答案

我知道您更喜欢jQuery解决方案,但有些东西是用JS开发的,并且按照您想要的方式执行。

I know that you prefer a jQuery solution, but there is something that it was developed in JS, and performs just the way you want.

http://syssgx.github.io/xml.js/

此链接提供3种互动方式:

This link gives 3 ways of interaction:


  • (通过浏览器)拖放XML文件然后验证;

  • (通过浏览器)将XML内容复制并粘贴到textareas然后验证;

  • (import / inlcude)将JS文件添加到你的webapp然后验证(如页面所示)。

这篇关于使用JS / jQuery对xsd验证xml的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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