📄 XML Validator

XML Validator - Check XML for well-formedness: tag pairing, quoted attributes and illegal characters, with error location. Free, browser-only.

📐 工作原理與說明
輸入為空時提示請貼上 XML 內容。用 XML 解析器按 XML 型別解析文本:若文件中存在解析錯誤節點則判定格式錯誤並展示錯誤詳情;否則判定 XML 格式良好,並給出根元素名與文件中的元素總數。解析過程丟擲異常時展示異常資訊
校驗 XML 文件是否規範。
  • 檢查項:標籤是否閉合、巢狀是否正確、屬性值是否加引號、特殊字元是否轉義、是否有唯一根元素。
  • 兩個層次:well-formed 指符合 XML 語法;valid 指還滿足 DTD 或 XSD 約束。
  • 常見錯誤:未轉義的 &、標籤大小寫不一致、缺少根元素、屬性未加引號。
  • 用途:介面資料與配置檔案的合法性檢查。
  • 行列號從 1 開始(首個字元 = 第 1 行第 1 列,取自瀏覽器 DOMParser 的報錯文本);本頁深度上限 不設上限;輸入上限 不設上限。

Formula & Standard References

Item Formula / Note Source / Standard
Well-formedness tags must nest and close, values quoted, single root W3C XML 1.0
Character escaping escape & < >; quotes inside attribute values W3C XML 1.0
Namespaces xmlns binds prefixes to URIs W3C Namespaces in XML
⚠️ 使用說明與注意事項

📋 常見錯誤

問題修正
標籤未閉合<br> → <br/>
屬性無引號id=x → id="x"
多個根用單個根包裹全部