Class MxParseUtils


  • public class MxParseUtils
    extends java.lang.Object
    Since:
    9.1.2
    • Constructor Summary

      Constructors 
      Constructor Description
      MxParseUtils()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static java.lang.String getBICFromDN​(java.lang.String dn)
      Distinguished Name structure: cn=name,ou=payment,o=bank,o=swift
      Example: o=spxainjj,o=swift
      static java.util.Optional<MxId> identifyMessage​(java.lang.String xml)
      Takes an XML with an MX message and detects the specific message type parsing just the namespace from the Document element.
      static java.lang.String makeXmlLenient​(java.lang.String xml)
      This method is intended to fix some malformed XML content that is not compliant with the XML specification to enable the parsing and processing of the payload to be lenient.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MxParseUtils

        public MxParseUtils()
    • Method Detail

      • getBICFromDN

        public static java.lang.String getBICFromDN​(java.lang.String dn)
        Distinguished Name structure: cn=name,ou=payment,o=bank,o=swift
        Example: o=spxainjj,o=swift
        Parameters:
        dn - the DN element content
        Returns:
        returns capitalized "bank", in the example SPXAINJJ
      • identifyMessage

        public static java.util.Optional<MxId> identifyMessage​(java.lang.String xml)
        Takes an XML with an MX message and detects the specific message type parsing just the namespace from the Document element. If the Document element is not present, or without the namespace or if the namespace url contains invalid content it will return null.

        Example of a recognizable Document element:
        <Doc:Document xmlns:Doc="urn:swift:xsd:camt.003.001.04" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

        The implementation is intended to be lightweight and efficient, based on XMLStreamReader

        Returns:
        id with the detected MX message type or empty if it cannot be determined.
      • makeXmlLenient

        public static java.lang.String makeXmlLenient​(java.lang.String xml)
        This method is intended to fix some malformed XML content that is not compliant with the XML specification to enable the parsing and processing of the payload to be lenient. For the moment, current implementation will just fix invalid case in the XML declaration, if present.
        Parameters:
        xml - original XML content
        Returns:
        modified XML content with the XML declaration fixed to be compliant with the XML specification
        Since:
        10.0.3