Class XmlXPathException

All Implemented Interfaces:
Serializable

public class XmlXPathException extends OpenXmlException
XPath Exception - Thrown when XPath evaluation fails XPath 异常 - 当 XPath 求值失败时抛出

This exception is thrown when an XPath expression is invalid or cannot be evaluated against the given XML document.

当 XPath 表达式无效或无法针对给定的 XML 文档求值时抛出此异常。

Features | 主要功能:

  • Exception for XPath evaluation failures - XPath 求值失败的异常
  • Extends OpenXmlException with specific context - 继承 OpenXmlException,带特定上下文

Usage Examples | 使用示例:

// Catch specific exception
try {
    // XML operation
} catch (XmlXPathException 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

    • XmlXPathException

      public XmlXPathException(String xpath, Throwable cause)
      Constructs an XPath exception with expression and cause. 构造带表达式和原因的 XPath 异常。
      Parameters:
      xpath - the XPath expression | XPath 表达式
      cause - the cause | 原因
    • XmlXPathException

      public XmlXPathException(String xpath, String message)
      Constructs an XPath exception with expression and message. 构造带表达式和消息的 XPath 异常。
      Parameters:
      xpath - the XPath expression | XPath 表达式
      message - the detail message | 详细消息
  • Method Details

    • getXPath

      public String getXPath()
      Returns the XPath expression that caused the error. 返回导致错误的 XPath 表达式。
      Returns:
      the XPath expression | XPath 表达式