Linux command
xml-validate 命令
文件
复制后可按需替换文件名、目录或参数。
常用示例
Validate against embedded DTD
xml val [file.xml]
Validate against an XSD schema
xml val --xsd [schema.xsd] [file.xml]
Validate against a RelaxNG schema
xml val --relaxng [schema.rng] [file.xml]
Check well-formedness only
xml val --well-formed [file.xml]
Validate multiple files
xml val [file1.xml] [file2.xml]
Validate using embedded schema reference
xml val -E [file.xml]
说明
xml val (or `xml validate`) validates XML documents against schemas. Part of the XMLStarlet toolkit. Supports DTD, XML Schema (XSD), and RelaxNG validation. Returns exit code 0 if valid, non-zero otherwise.
参数
- --xsd _file_
- Validate against XML Schema.
- --dtd _file_
- Validate against DTD.
- --relaxng _file_
- Validate against RelaxNG schema.
- --well-formed
- Check well-formedness only.
- -E, --embed
- Use embedded schema.
- -e, --err
- Print errors.
FAQ
What is the xml-validate command used for?
xml val (or `xml validate`) validates XML documents against schemas. Part of the XMLStarlet toolkit. Supports DTD, XML Schema (XSD), and RelaxNG validation. Returns exit code 0 if valid, non-zero otherwise.
How do I run a basic xml-validate example?
Run `xml val [file.xml]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does --xsd _file_ do in xml-validate?
Validate against XML Schema.