logback.xml 的 XML 架构或 DTD?
我在网上看到过一些关于为 logback.xml 文件提供 XML 模式或 DTD 以便在 IDEA 或 Eclipse 等 IDE 中至少具有非常基本的验证和自动完成功能会有多棒的讨论,但我从未见过任何解决方案。
你有吗?
I've seen several discussions on the net about how great it would be to have an XML schema or DTD for logback.xml file to have at least the very basic validation and auto-completion in IDEs like IDEA or Eclipse, but I never saw any solution.
Did you?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(7)
只是为了摆脱 Eclipse 中烦人的警告,在
之后添加
>。
要在修复后消除感叹号图标,您可能需要通过右键单击文件并选择
验证
来再次触发验证。Just to get rid of the annoying warning in Eclipse add
<!DOCTYPE xml>
after<?xml version="1.0" encoding="UTF-8"?>
.To get rid of the exclamation point icon after you fix it, you might need to trigger the validation again by right-clicking the file and choosing
Validate
.截至 2011 年 6 月,官方文档指出
关于该主题有一个简短的帖子,但没有似乎哪儿也去不了。
As of June 2011, the official documentation states
There was a brief thread on the topic, but didn't seem to go anywhere.
根据文档官方不支持它,但是有一个独立的项目可以支持提供 Logback 的 Schema
但是,由于 Logback 配置的极大灵活性,Schema 无法支持所有可能的配置选项。
It is not supported officially according to the documentation, but there is an independent project to provide Schema for Logback
However, due to extreme flexibility of the Logback configuration, Schema cannot support all possible configuration options.
Sergey 提到的独立项目满足了我的大部分需求。
但是,缺少一些元素,我将它们添加到 https://github.com/nkatsar 上我自己的分叉上/logback-XSD。希望它们能够合并到主项目中。
The independent project mentioned by Sergey covered most of my requirements.
However, some elements were missing, I added them on my own fork on on https://github.com/nkatsar/logback-XSD. Hope they will get merged in the main project.
来自 GitHub“logback 的 XML 模式定义”
https://github.com/nkatsar/logback-XSD
from GitHub "An XML Schema Definition for logback"
https://github.com/nkatsar/logback-XSD
感谢 https://github.com/enricopulatzo/logback-XSD
这将允许 Eclipse自动完成并验证 xml 是否未使用插件或其他扩展机制:
Thanks to https://github.com/enricopulatzo/logback-XSD
This will allow eclipse to autocomplete and validate if xml is not using plugins or other extensions mechanisms:
使用这条线。它会自动从远程下载。我们不需要下载文件
use this lines . it download automatically from remote. we need not to downlaod the file