Class NamespaceReader
- java.lang.Object
-
- com.prowidesoftware.swift.model.mx.NamespaceReader
-
public class NamespaceReader extends java.lang.Object
Helper API to extract information from an XML using lightweight XML streams API- Since:
- 9.2.1
-
-
Constructor Summary
Constructors Constructor Description NamespaceReader()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
elementExists(java.lang.String xml, java.lang.String localName)
Checks if an element exists in the XMLstatic java.util.Optional<java.lang.String>
findAppHdrNamespace(java.lang.String xml)
Extracts the header namespace from the XML, if the AppHdr element is presentstatic java.util.Optional<java.lang.String>
findDocumentNamespace(java.lang.String xml)
Extracts the document namespace from the XML, if the Document element is presentstatic java.util.Optional<java.lang.String>
findNamespaceForLocalName(java.lang.String xml, java.lang.String localName)
Extracts the namespace for a given element
-
-
-
Method Detail
-
findDocumentNamespace
public static java.util.Optional<java.lang.String> findDocumentNamespace(java.lang.String xml)
Extracts the document namespace from the XML, if the Document element is present- Parameters:
xml
- the XML content- Returns:
- found namespace or empty if the Document is not found or does not contain a namespace
-
findAppHdrNamespace
public static java.util.Optional<java.lang.String> findAppHdrNamespace(java.lang.String xml)
Extracts the header namespace from the XML, if the AppHdr element is present- Parameters:
xml
- the XML content- Returns:
- found namespace or empty if the AppHdr is not found or does not contain a namespace
-
findNamespaceForLocalName
public static java.util.Optional<java.lang.String> findNamespaceForLocalName(java.lang.String xml, java.lang.String localName)
Extracts the namespace for a given element- Parameters:
xml
- the XML contentlocalName
- the element local name- Returns:
- found namespace or empty if the element is not found or does not contain a namespace
-
elementExists
public static boolean elementExists(java.lang.String xml, java.lang.String localName)
Checks if an element exists in the XML- Parameters:
xml
- the XML contentlocalName
- the element name- Returns:
- true if at least one element with the given name is found
-
-