Reputation: 11
I have written a COBOL module for parsing a XML. XML value is stored in a DB2 table and I am running a select query to read the XML value. But while parsing, on the 1st instance itself it is throwing an exception with XML-CODE = 317. I did a search on this XML Code and found the description of this error as follows - 'The parser cannot determine the document encoding. The document may be damaged.'
There is no issue with the XML otherwise it would have thrown error while inserting into DB2 table. 1st tag in XML is which is also correct.
Can somebody please help me out in resolving this issue.
Thanks
Upvotes: 0
Views: 2405
Reputation: 10775
You have given us some useful information...
What CODEPAGE option was your COBOL code compiled with? There may be an automatic conversion taking place, perhaps the header and the encoding no longer match after retrieval from DB2.
Are you parsing a PIC X field or a PIC N field?
Also, I suggest using the compile option XMLPARSE(XMLSS) as the "native COBOL" parser is deprecated as of Enterprise COBOL 5.1.
Upvotes: 1
Reputation: 51553
You probably have to specify an encoding on your XML header.
Here are some example encodings.
<?xml version="1.0" encoding="us-ascii"?>
<?xml version="1.0" encoding="windows-1252"?>
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0" encoding="UTF-16"?>
Upvotes: 2