public final class XmlUtils extends Object
XmlUtils contains XML helper methods.| Modifier and Type | Field | Description |
|---|---|---|
static String |
XPATH_PROPERTY |
The constant XPATH_PROPERTY.
|
| Modifier and Type | Method | Description |
|---|---|---|
static boolean |
allAre(String target,
NodeList nodes) |
All are boolean.
|
static boolean |
anyIs(String target,
NodeList nodes) |
Any is boolean.
|
static Set<String> |
collectTextValues(NodeList nodes) |
Collect text values set.
|
static Set<TIN> |
collectTINs(NodeList tinNodes) |
Collects TINs (value + TypeOfTIN) from a NodeList of
|
static Object |
getChildObjectValue(eu.europa.ec.taxud.validation.ValidationContext context,
Node node,
String path,
QName type) |
Gets child object value.
|
static List<Element> |
getElements(NodeList list) |
convert NodeList to List
|
static Node |
getNode(eu.europa.ec.taxud.validation.ValidationContext context,
Element element,
String path) |
Gets node.
|
static String |
getNodeTextSafe(Node node) |
Gets node text safe.
|
static Object |
getObjectValue(eu.europa.ec.taxud.validation.ValidationContext context,
Node node,
String path,
QName type) |
Gets object value.
|
static String |
getSingleTextValue(Node node) |
Gets single text value.
|
static TIN |
getTIN(Node tinNode) |
Extracts a TIN object (value + TypeOfTIN) from a single
|
static boolean |
hasAtLeastOneNonEmpty(NodeList nodes) |
Has at least one non empty boolean.
|
static boolean |
isNonEmpty(Node node) |
Is non empty boolean.
|
static boolean |
isWithinMargin(BigDecimal actual,
BigDecimal expected,
BigDecimal marginPercent,
int scale) |
Is within margin boolean.
|
static boolean |
isWithinMarginWithDefaultMarginPercentAndScale(BigDecimal actual,
BigDecimal expected) |
Is within margin with default margin percent and scale boolean.
|
static boolean |
nodeHasGlobeStatus(Node parent,
XPathExpression xpathStatus,
String targetStatus) |
Node has globe status boolean.
|
static BigDecimal |
parseBigDecimalSafe(String input) |
Parse big decimal safe big decimal.
|
static BigDecimal |
parseBigDecimalSafeZeroEmptyValue(String input) |
Parse big decimal safe zero empty value big decimal.
|
public static final String XPATH_PROPERTY
public static List<Element> getElements(NodeList list)
list - NodeList to convert.public static Node getNode(eu.europa.ec.taxud.validation.ValidationContext context, Element element, String path) throws XPathExpressionException
context - the contextelement - the elementpath - the pathXPathExpressionException - the x path expression exceptionpublic static Object getObjectValue(eu.europa.ec.taxud.validation.ValidationContext context, Node node, String path, QName type)
context - the contextnode - the nodepath - the pathtype - the typepublic static Object getChildObjectValue(eu.europa.ec.taxud.validation.ValidationContext context, Node node, String path, QName type)
context - the contextnode - the nodepath - the pathtype - the typepublic static Set<String> collectTextValues(NodeList nodes)
nodes - the nodespublic static boolean nodeHasGlobeStatus(Node parent, XPathExpression xpathStatus, String targetStatus) throws Exception
parent - the parentxpathStatus - the xpath statustargetStatus - the target statusException - the exceptionpublic static String getNodeTextSafe(Node node)
node - the nodepublic static String getSingleTextValue(Node node)
node - the nodepublic static boolean hasAtLeastOneNonEmpty(NodeList nodes)
nodes - the nodespublic static boolean isNonEmpty(Node node)
node - the nodepublic static boolean allAre(String target, NodeList nodes)
target - the targetnodes - the nodespublic static boolean anyIs(String target, NodeList nodes)
target - the targetnodes - the nodespublic static BigDecimal parseBigDecimalSafe(String input)
input - the inputpublic static BigDecimal parseBigDecimalSafeZeroEmptyValue(String input)
input - the inputpublic static Set<TIN> collectTINs(NodeList tinNodes)
tinNodes - the tin nodespublic static TIN getTIN(Node tinNode)
tinNode - the tin nodepublic static boolean isWithinMargin(BigDecimal actual, BigDecimal expected, BigDecimal marginPercent, int scale)
actual - the actualexpected - the expectedmarginPercent - the margin percentscale - the scalepublic static boolean isWithinMarginWithDefaultMarginPercentAndScale(BigDecimal actual, BigDecimal expected)
actual - the actualexpected - the expectedCopyright © 2025. All rights reserved.