Reputation: 3
I'm working on an Android app using Kotlin and trying to establish an ISO8583 connection to send and receive ISO8583 messages from an ISO server. I'm using the j8583 library and referencing an XML configuration file (j8583.xml
) and a DTD file (j8583.dtd
) for the connection.
When I attempt to build my Android app in Android Studio, I encounter the following error:
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:parseDebugLocalResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ParseLibraryResourcesTask$ParseResourcesRunnable
> Failed to parse XML file 'C:\Users\Tatweer\StudioProjects\testcompose\app\build\intermediates\packaged_res\debug\xml\j8583.xml'
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
==============================================================================
2: Task failed with an exception.
-----------
* What went wrong:
Execution failed for task ':app:mergeDebugResources'.
> A failure occurred while executing com.android.build.gradle.internal.res.ResourceCompilerRunnable
> Resource compilation failed (Failed to compile resource file: C:\Users\Tatweer\StudioProjects\testcompose\app\src\main\res\xml\j8583.xml: . Cause: javax.xml.stream.XMLStreamException: ParseError at [row,col]:[1,2]
Message: The markup declarations contained or pointed to by the document type declaration must be well-formed.). Check logs for more details.
Additionally, I see the following fatal error:
[Fatal Error] j8583.dtd:1:2: The markup declarations contained or pointed to by the document type declaration must be well-formed.
This is how I'm creating the messageFactory:
val messageFactory = ConfigParser.createFromClasspathConfig("res/xml/j8583.xml")
val responseIsoMessage = messageFactory.parseMessage(response.toByteArray(), 4)
Here's my j8583.xml file:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE j8583-config PUBLIC "-//J8583//DTD CONFIG 1.0//EN"
"http://j8583.sourceforge.net/j8583.dtd">
<j8583-config>
<!-- These are the ISO headers to be prepended to the message types specified -->
<header type="0210">ISO015000055</header>
<!-- The client example uses this to read the responses -->
<parse type="0210">
<field num="2" type="LLVAR" length="19" />
<field num="3" type="NUMERIC" length="6" />
<field num="4" type="AMOUNT" />
<field num="11" type="NUMERIC" length="6" />
<field num="12" type="TIME" />
<field num="13" type="DATE4" />
<field num="14" type="DATE14" />
<field num="25" type="NUMERIC" length="2" />
<field num="28" type="NUMERIC" length="8" />
<field num="35" type="LLVAR" />
<field num="37" type="NUMERIC" length="12" />
<field num="39" type="NUMERIC" length="2" />
<field num="41" type="ALPHA" length="8" />
<field num="42" type="ALPHA" length="15" />
<field num="49" type="ALPHA" length="3" />
</parse>
</j8583-config>
I can't build my app ,problem cased when I try build or run my android application.
From my understanding, the error seems to be related to the well-formedness of the j8583.dtd or j8583.xml file. I have tried checking the files for syntax errors and ensuring that they match the DTD's requirements, but the issue persists.
Does anyone have any insight into what could be causing this issue or how I might resolve it?
Thank you in advance for your help!
I tried to establish an ISO8583 connection in my Android app using the j8583 library. My goal was to send and receive ISO8583 messages from an ISO server using an XML configuration file (j8583.xml) and a DTD file (j8583.dtd). To achieve this, I referenced the XML configuration file in my Kotlin code using the following line:
val messageFactory = ConfigParser.createFromClasspathConfig("res/xml/j8583.xml")
val responseIsoMessage = messageFactory.parseMessage(response.toByteArray(), 4)
I expected the app to build successfully and establish the ISO8583 connection based on the configuration provided in the XML file.
Upvotes: 0
Views: 49