Class XmlParseException

All Implemented Interfaces:
Serializable
Direct Known Subclasses:
SaxParseException

public class XmlParseException extends OpenXmlException
XML Parse Exception - Thrown when XML parsing fails XML 解析异常 - 当 XML 解析失败时抛出

This exception is thrown when the XML parser encounters malformed XML, encoding issues, or other parsing errors.

当 XML 解析器遇到格式错误的 XML、编码问题或其他解析错误时抛出此异常。

Features | 主要功能:

  • Exception for XML parsing failures with line/column info - 带行/列信息的 XML 解析失败异常
  • Extends OpenXmlException with specific context - 继承 OpenXmlException,带特定上下文

Usage Examples | 使用示例:

// Catch specific exception
try {
    // XML operation
} catch (XmlParseException e) {
    System.err.println(e.getMessage());
}

Security | 安全性:

  • Thread-safe: Yes (immutable exception) - 线程安全: 是(不可变异常)
  • Null-safe: No (message must not be null) - 空值安全: 否(消息不能为 null)
Since:
JDK 25, opencode-base-xml V1.0.3
Author:
Leon Soo www.LeonSoo.com
See Also:
  • Constructor Details

    • XmlParseException

      public XmlParseException(String message, int line, int column)
      Constructs a parse exception with message and location. 构造带消息和位置的解析异常。
      Parameters:
      message - the detail message | 详细消息
      line - the line number | 行号
      column - the column number | 列号
    • XmlParseException

      public XmlParseException(String message, int line, int column, Throwable cause)
      Constructs a parse exception with message, location and cause. 构造带消息、位置和原因的解析异常。
      Parameters:
      message - the detail message | 详细消息
      line - the line number | 行号
      column - the column number | 列号
      cause - the cause | 原因
    • XmlParseException

      public XmlParseException(String message)
      Constructs a parse exception with message only. 构造仅带消息的解析异常。
      Parameters:
      message - the detail message | 详细消息
    • XmlParseException

      public XmlParseException(String message, Throwable cause)
      Constructs a parse exception with message and cause. 构造带消息和原因的解析异常。
      Parameters:
      message - the detail message | 详细消息
      cause - the cause | 原因