public class MxParser extends Object
IMPORTANT: An MX message is conformed by a set of optional headers and a message payload or document with the actual specific MX message. The name of the envelope element that binds a Header to the message to which it applies is implementation/network specific and not part of the scope of the parser.
ApplicationHeader
and the ISO BusinessApplicationHeaderV01
.AbstractMX
by Prowide Integrator SDK.Modifier and Type | Class and Description |
---|---|
class |
MxParser.MxStructureInfo
Helper bean used by
analizeMessage() to return
structure information from an MX message |
Modifier and Type | Field and Description |
---|---|
static String |
DOCUMENT_LOCALNAME |
static String |
HEADER_LOCALNAME |
Constructor and Description |
---|
MxParser()
Deprecated.
the generic constructor is discouraged, use constructor with
specific source parameter
|
MxParser(File file)
Construct a parser for a file containing a single MX message
|
MxParser(InputStream stream)
Construct a parser for a stream containing a single MX message
|
MxParser(String message)
Creates the parser initializing its content source from the given string.
|
Modifier and Type | Method and Description |
---|---|
MxParser.MxStructureInfo |
analizeMessage()
Convenient API to get structure information from an MX message.
|
MxId |
detectMessage()
Takes an xml with an MX message and detects the specific message type
parsing just the namespace from the Document element.
|
static String |
getBICFromDN(String dn)
Distinguished Name structure: cn=name,ou=payment,o=bank,o=swift
Example: o=spxainjj,o=swift |
MxPayload |
mx()
Deprecated.
|
MxNode |
parse()
Non-namespace aware parse.
Parses the complete message content into an MxNode tree structure. |
MxNode |
parse(InputStream stream)
Deprecated.
initialize the parser with the stream instead an call the generic
parse() method |
MxNode |
parse(Reader reader)
Deprecated.
initialize the parser with the reader instead an call the generic
parse() method |
ApplicationHeader |
parseApplicationHeader()
Parses the application header (SWIFT legacy) from the internal message source.
|
static ApplicationHeader |
parseApplicationHeader(MxNode tree)
Parses the application header (SWIFT legacy) from the parameter node.
|
BusinessApplicationHeaderV01 |
parseBusinessApplicationHeaderV01()
Parses the application header (ISO) from the internal message source.
|
static BusinessApplicationHeaderV01 |
parseBusinessApplicationHeaderV01(MxNode tree)
Parses the application header (ISO) from the parameter node.
|
BusinessHeader |
parseBusinessHeader()
Detects the type of header and parses it as a legacy SWIFT Application Header or ISO Business Application Header.
|
static BusinessHeader |
parseBusinessHeader(Element e)
Parse the business header from an XML Element node
|
MxPayload |
payload()
Deprecated.
use
stripDocument() and stripHeader() instead |
String |
stripDocument()
Helper API to strip Document portion of message XML.
|
String |
stripHeader()
Helper API to strip AppHdr portion of message XML.
|
public static final String HEADER_LOCALNAME
public static final String DOCUMENT_LOCALNAME
@Deprecated public MxParser()
public MxParser(File file) throws IOException
file
- the file containing a single unit of a messageIOException
- if an error occurs during the read of the filepublic MxParser(InputStream stream) throws IOException
stream
- non null stream containing a single unit of messageIOException
public MxParser(String message)
@Deprecated public MxNode parse(InputStream stream)
parse()
method@Deprecated public MxNode parse(Reader reader) throws IOException
parse()
methodIOException
public MxNode parse()
MxNode
tree structure.
The parser should be initialized with a valid source.@Deprecated public MxPayload payload()
public BusinessHeader parseBusinessHeader()
null
if the content cannot be parsed or the header is not present in the XMLpublic static BusinessHeader parseBusinessHeader(Element e)
parseBusinessHeader()
public ApplicationHeader parseApplicationHeader()
null
if the content cannot be parsed or the header is not present in the XMLparseBusinessHeader()
public static ApplicationHeader parseApplicationHeader(MxNode tree)
null
if the content cannot be parsed or the header is not present in the XMLparseBusinessHeader()
public BusinessApplicationHeaderV01 parseBusinessApplicationHeaderV01()
null
if the content cannot be parsed or the header is not present in the XMLparseBusinessHeader()
public static BusinessApplicationHeaderV01 parseBusinessApplicationHeaderV01(MxNode tree)
null
if the content cannot be parsed or the header is not present in the XMLparseBusinessHeader()
public MxId detectMessage()
XMLStreamReader
public MxParser.MxStructureInfo analizeMessage()
XMLStreamReader
@Deprecated public MxPayload mx()
public static String getBICFromDN(String dn)
dn
- the DN element contentpublic String stripDocument()
analizeMessage()
public String stripHeader()
analizeMessage()
parseBusinessHeader()