Package eu.europa.ec.taxud.dac8.vm.utils
Class XmlUtils
java.lang.Object
eu.europa.ec.taxud.dac8.vm.utils.XmlUtils
XmlUtils contains XML helper methods.-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanAll are boolean.static booleanAny is boolean.collectTextValues(NodeList nodes) Collect text values set.static ObjectgetChildObjectValue(eu.europa.ec.taxud.validation.ValidationContext context, Node node, String path, QName type) Gets child object value.getElements(NodeList list) convert NodeList to List. static NodeGets node.static StringgetNodeTextSafe(Node node) Gets node text safe.static ObjectgetObjectValue(eu.europa.ec.taxud.validation.ValidationContext context, Node node, String path, QName type) Gets object value.static StringgetSingleTextValue(Node node) Gets single text value.static booleanhasAtLeastOneNonEmpty(NodeList nodes) Has at least one non empty boolean.static booleanisNonEmpty(Node node) Is non empty boolean.static booleanisWithinMargin(BigDecimal actual, BigDecimal expected, BigDecimal marginPercent, Integer scale) Is within margin boolean.static booleanisWithinMarginWithDefaultMarginPercentAndScale(BigDecimal actual, BigDecimal expected) Is within margin with default margin percent and scale boolean.static BigDecimalparseBigDecimalSafe(String input) Parse big decimal safe big decimal.static BigDecimalParse big decimal safe zero empty value big decimal.
-
Field Details
-
XPATH_PROPERTY
The constant XPATH_PROPERTY.- See Also:
-
-
Method Details
-
getElements
convert NodeList to List. - Parameters:
list- NodeList to convert.- Returns:
- List of Element.
-
getNode
public static Node getNode(eu.europa.ec.taxud.validation.ValidationContext context, Element element, String path) throws XPathExpressionException Gets node.- Parameters:
context- the contextelement- the elementpath- the path- Returns:
- the node
- Throws:
XPathExpressionException- the x path expression exception
-
getObjectValue
public static Object getObjectValue(eu.europa.ec.taxud.validation.ValidationContext context, Node node, String path, QName type) Gets object value.- Parameters:
context- the contextnode- the nodepath- the pathtype- the type- Returns:
- the object value
-
getChildObjectValue
public static Object getChildObjectValue(eu.europa.ec.taxud.validation.ValidationContext context, Node node, String path, QName type) Gets child object value.- Parameters:
context- the contextnode- the nodepath- the pathtype- the type- Returns:
- the child object value
-
collectTextValues
Collect text values set.- Parameters:
nodes- the nodes- Returns:
- the set
-
getNodeTextSafe
Gets node text safe.- Parameters:
node- the node- Returns:
- the node text safe
-
getSingleTextValue
Gets single text value.- Parameters:
node- the node- Returns:
- the single text value
-
hasAtLeastOneNonEmpty
Has at least one non empty boolean.- Parameters:
nodes- the nodes- Returns:
- the boolean
-
isNonEmpty
Is non empty boolean.- Parameters:
node- the node- Returns:
- the boolean
-
allAre
All are boolean.- Parameters:
target- the targetnodes- the nodes- Returns:
- the boolean
-
anyIs
Any is boolean.- Parameters:
target- the targetnodes- the nodes- Returns:
- the boolean
-
parseBigDecimalSafe
Parse big decimal safe big decimal.- Parameters:
input- the input- Returns:
- the big decimal
-
parseBigDecimalSafeZeroEmptyValue
Parse big decimal safe zero empty value big decimal.- Parameters:
input- the input- Returns:
- the big decimal
-
isWithinMargin
public static boolean isWithinMargin(BigDecimal actual, BigDecimal expected, BigDecimal marginPercent, Integer scale) Is within margin boolean.- Parameters:
actual- the actualexpected- the expectedmarginPercent- the margin percentscale- the scale- Returns:
- the boolean
-
isWithinMarginWithDefaultMarginPercentAndScale
public static boolean isWithinMarginWithDefaultMarginPercentAndScale(BigDecimal actual, BigDecimal expected) Is within margin with default margin percent and scale boolean.- Parameters:
actual- the actualexpected- the expected- Returns:
- the boolean
-