error converting the HEX EBCDIC string (in lower case) to xml

172 views
Skip to first unread message

LS

unread,
May 17, 2013, 4:50:28 PM5/17/13
to legsta...@googlegroups.com

Hi,

        Im getting a SAXparseException while converting a hex EBCIDIC in lower case to xml.

The copybook and xsd are attached.


HEX o/p = a3993f953f8283848586878889919293949596979899a2a3a4a5a6a7f1f2f3f4f5

character Encoding = IBM1140

AccountBalanceRequestXmlTransformers.toXml(host, writer, "IBM01140");


error: org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 148; An invalid XML character (Unicode: 0x1a) was found in the element content of the document.


thanks

LS





GetAccountBalanceRequest.copybook
getaccountbalancerequest.xsd

Fady

unread,
May 18, 2013, 2:08:48 AM5/18/13
to legsta...@googlegroups.com
Can you provide the complete stack trace?

Thanks

LS

unread,
May 20, 2013, 1:05:47 PM5/20/13
to legsta...@googlegroups.com

org.xml.sax.SAXParseException; lineNumber: 1; columnNumber: 148; An invalid XML character (Unicode: 0x1a) was found in the element content of the document.

       at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:254)

       at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:300)

       at com.parasoft.soavirt.messages.copybook.CopybookMessage.createDocument(CopybookMessage.java:167)

LS

unread,
May 20, 2013, 2:54:58 PM5/20/13
to legsta...@googlegroups.com
Im trying to convert it into xml document.

AccountBalanceRequestXmlTransformers.toXml(host, writer, "IBM01140");
String xmlString = writer.toString();
DocumentBuilderFactory dbfac = DocumentBuilderFactory.newInstance();
DocumentBuilder docBuilder = null;
docBuilder = dbfac.newDocumentBuilder();
document = docBuilder.parse(new InputSource(new StringReader(
xmlString)));

Fady

unread,
May 20, 2013, 3:18:12 PM5/20/13
to legsta...@googlegroups.com
Is it possible that the XML generated contains a UTF-8 character that starts with 0x1A? Have you looked in the xmlString variable?

LS

unread,
May 23, 2013, 1:16:17 PM5/23/13
to legsta...@googlegroups.com
Hi Fady,
              I did look in the xmlString variable and the conclusion is, it is working fine when the host data is in upper case. But it converts all the lower case alphabets from a to r into '_' when the host data is in EBCIDIC.

 trying to convert: tranabcdefghijklmnopqrstuvwx12345

Request HEX i/p =  74 72 61 6E 61 62 63 64 65 66 67 68 69 6A 6B 6C 6D 6E 6F 70 71 72 73 74 75 76 77 78 31 32 33 34 35

expected  Response HEX o/p =  A3 99 81 95 81 82 83 84 85 86 87 88 89 91 92 93 94 95 96 97 98 99 A2 A3 A4 A5 A6 A7 F1 F2 F3 F4 F5

but getting A3 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F 3F A2 A3 A4 A5 A6 A7 F1 F2 F3 F4 F5

xmlString:  xmlString : <?xml version="1.0" encoding="UTF-8" standalone="yes"?><ns2:AccountBalanceRequest xmlns:ns2="$coxbHelper.getXmlNamespace($binding)"><transaction>t___</transaction><token>__________________stuvwx</token><acctNum>12345</acctNum></ns2:AccountBalanceRequest>

Fady

unread,
May 23, 2013, 2:19:11 PM5/23/13
to legsta...@googlegroups.com
Sorry, never heard of a case where lowercase characters don't get converted.

I also notice that your xml contains unresolved placeholders : $coxbHelper.getXmlNamespace($binding). This does not happen when the product is used in a standard way.

LS

unread,
May 24, 2013, 2:22:49 PM5/24/13
to legsta...@googlegroups.com
Fady,
           I'm running a simple test ,  I have generated host/xml transformers.
The host data is EBCIDIC representation of  lower case 'a' 

byte[] hostBytes= "a".getBytes("IBM01140"); // is this the correct way to get the byte[] of EBCIDIC representation "a"?

TestLegstarXmlTransformers transformers = new TestLegstarXmlTransformers();
StringWriter writer = new StringWriter();
       transformers.toXml(hostBytes, writer,"IBM01140");

How to generate hostBytes for this test?

Fady

unread,
May 25, 2013, 3:34:13 AM5/25/13
to legsta...@googlegroups.com
Yes, you can generate ebcdic with String#getBytes. Just be careful that this only works for characters. If the mainframe payload contains numeric data, such as COMP or COMP-3, then it is harder to generate test data manually.

Another way is to use the legstar transformer toHost method starting from java or xml..
Reply all
Reply to author
Forward
0 new messages