验证具有基于树的结构的文件 [英] Validating files having tree based structures

查看:19
本文介绍了验证具有基于树的结构的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个验证器来验证基于树结构的配置文件.例如a.student.name 乔a.学生.班级艺术

I am looking for a validator to validate tree structure based configuration files. e.g. a.student.name joe a.student.class arts

您能否提出有关验证此类配置的任何想法.到目前为止,我已经搜索过并且只能找到 xml 文件的验证器.

Can you suggest any ideas on validating such config. So far I have searched and I could find validator for xml files only.

推荐答案

遗憾的是,配置文件的架构验证在 XML 之外很少见.我知道的唯一其他选项是 Config4J(我写的).

Unfortunately, schema validation for configuration files is rare outside of XML. The only other option I am aware of is Config4J (which I wrote).

如果您访问该网站,则应向下滚动到主页底部以访问完整的手册集(PDF 和 HTML 版本).我建议您查看手册的以下部分,以大致了解 Config4J 并确定它是否满足您的验证需求.

If you visit the website, then you should scroll down to the bottom of the main web page to access the complete set of manuals (available in both PDF and HTML versions). I recommend you have a look at the following parts of the manuals to get an overview of Config4J and decide if it satisfies your needs for validation.

入门指南"的第 2 章和第 3 章概述了配置语法和 API.特别是,第 3.10 节提供了模式语言的快速示例.

Chapters 2 and 3 of the "Getting Started Guide" provide an overview of the configuration syntax and the API. In particular, Section 3.10 provides a quick example of the schema language.

入门指南"的第 9 章提供了模式语言的完整定义.

Chapter 9 of the "Getting Started Guide" provides a complete definition of the schema language.

Java API 指南"的第 3 章讨论了用于编写您自己的模式类型以扩展模式语言功能的 API.

Chapter 3 of the "Java API Guide" discusses the API for writing your own schema types to extend the functionality of the schema language.

更新:我从 kiran.kumar M 的回答中发现 YAML 有一个名为 Kwalify 的模式验证器.

Update: I discovered from the answer by kiran.kumar M that the Java and Ruby implementations of YAML have a schema validator called Kwalify.

更新:现在有一种 JSON 模式语言.

这篇关于验证具有基于树的结构的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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