XML(可扩展标记语言)
XML 是一种灵活的标记语言,使用用户定义的标签来表示结构化数据。它广泛用于配置文件、数据订阅(RSS、Atom)、办公文档格式(DOCX、ODT)和企业数据交换(SOAP、SVG、XHTML)。
MIME 类型
application/xml
类型
文本
压缩
无损
优点
- + Self-describing with user-defined tags and schemas
- + Mature ecosystem: XPath, XSLT, XSD, SAX/DOM parsers
- + Standard for RSS/Atom feeds, SVG, XHTML, and SOAP
- + Supports namespaces for mixing vocabularies
缺点
- − Verbose syntax compared to JSON or YAML
- − Parsing is slower and more memory-intensive than JSON
- − Largely replaced by JSON for web APIs
何时使用 .XML
在文档标记、需要验证模式的配置文件、SOAP 服务和传统企业集成中使用 XML。
技术细节
XML 文档具有由元素组成的树形结构,包含开始和结束标签、属性和文本内容。模式(XSD、DTD、RELAX NG)用于验证结构,XSLT 可将 XML 转换为其他格式。
历史
W3C 于 1998 年发布了 XML 1.0,作为 SGML 的简化子集。在 2000 年代,XML 成为企业数据交换的基础,支撑着 SOAP Web 服务、RSS 订阅和办公文档格式。
从 .XML 转换
转换为 .XML
相关格式
相关术语
Learn More
File Format Conversion: A Complete Guide
Converting files between formats is a daily task for professionals across every industry. This comprehensive guide covers document, image, audio, …
JSON vs YAML vs TOML: Choosing a Configuration Format
Configuration files are the backbone of modern applications. JSON, YAML, and TOML each offer different trade-offs between readability, complexity, and …
Meta Tags for SEO: Title, Description, and Open Graph
Meta tags control how your pages appear in search results and social media shares. This guide covers the essential meta …
Text Encoding Explained: UTF-8, ASCII, and Beyond
Text encoding determines how characters are stored as bytes. Understanding UTF-8, ASCII, and other encodings prevents garbled text, mojibake, and …
CSV vs JSON vs XML: Data Exchange Formats Compared
Data exchange formats serve different needs. CSV excels at tabular data, JSON dominates web APIs, and XML powers enterprise integrations. …
How to Format and Validate JSON Data
Malformed JSON causes silent failures in APIs and configuration files. Learn how to format, validate, and debug JSON documents to …