public final class DocumentParserTool
extends java.lang.Object
XML document parsing tool class.
Constructor and Description |
---|
DocumentParserTool() |
Modifier and Type | Method and Description |
---|---|
static void |
checkAttributeValue(java.lang.String value, java.lang.String msg)
Check whether the attribute value of the node is empty, if it is empty, then throw the specified information of the document resolution exception.
|
static void |
checkNode(org.w3c.dom.Node node, java.lang.String msg)
Check if the XML node is null, and if it is null, the document resolution exception for the specified information is thrown.
|
static javax.xml.xpath.XPath |
createXPath(javax.xml.namespace.NamespaceContext context)
Create an XPath object from the namespace context.
|
public static javax.xml.xpath.XPath createXPath(javax.xml.namespace.NamespaceContext context)
Create an XPath object from the namespace context.
context
- Namespace context.public static void checkNode(org.w3c.dom.Node node, java.lang.String msg) throws ParseException
Check if the XML node is null, and if it is null, the document resolution exception for the specified information is thrown.
node,
- the XML node to judge.msg,
- the exception information when the node is null.ParseException,
- if the node is null, the document resolution exception for the specified information is thrown.ParseException
public static void checkAttributeValue(java.lang.String value, java.lang.String msg) throws ParseException
Check whether the attribute value of the node is empty, if it is empty, then throw the specified information of the document resolution exception.
If the attribute value is empty, it is null, the string length is 0, or the string is blank.
value,
- the node attribute value to determine.msg,
- the exception detail information when the node is null.ParseException,
- if the node attribute value is empty, the XML document parsing exception is thrown.ParseException