Class XmlUtils

java.lang.Object
eu.europa.ec.taxud.dac8.vm.utils.XmlUtils

public final class XmlUtils extends Object
XmlUtils contains XML helper methods.
  • Field Details

  • Method Details

    • getElements

      public static List<Element> getElements(NodeList list)
      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 context
      element - the element
      path - 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 context
      node - the node
      path - the path
      type - 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 context
      node - the node
      path - the path
      type - the type
      Returns:
      the child object value
    • collectTextValues

      public static Set<String> collectTextValues(NodeList nodes)
      Collect text values set.
      Parameters:
      nodes - the nodes
      Returns:
      the set
    • getNodeTextSafe

      public static String getNodeTextSafe(Node node)
      Gets node text safe.
      Parameters:
      node - the node
      Returns:
      the node text safe
    • getSingleTextValue

      public static String getSingleTextValue(Node node)
      Gets single text value.
      Parameters:
      node - the node
      Returns:
      the single text value
    • hasAtLeastOneNonEmpty

      public static boolean hasAtLeastOneNonEmpty(NodeList nodes)
      Has at least one non empty boolean.
      Parameters:
      nodes - the nodes
      Returns:
      the boolean
    • isNonEmpty

      public static boolean isNonEmpty(Node node)
      Is non empty boolean.
      Parameters:
      node - the node
      Returns:
      the boolean
    • allAre

      public static boolean allAre(String target, NodeList nodes)
      All are boolean.
      Parameters:
      target - the target
      nodes - the nodes
      Returns:
      the boolean
    • anyIs

      public static boolean anyIs(String target, NodeList nodes)
      Any is boolean.
      Parameters:
      target - the target
      nodes - the nodes
      Returns:
      the boolean
    • parseBigDecimalSafe

      public static BigDecimal parseBigDecimalSafe(String input)
      Parse big decimal safe big decimal.
      Parameters:
      input - the input
      Returns:
      the big decimal
    • parseBigDecimalSafeZeroEmptyValue

      public static BigDecimal parseBigDecimalSafeZeroEmptyValue(String input)
      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 actual
      expected - the expected
      marginPercent - the margin percent
      scale - 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 actual
      expected - the expected
      Returns:
      the boolean