Jump to content

Oracle Code generates incomplete XML tags in case of Spanish content


narayanan010

Recommended Posts

XML_Code.txtXML_Code.txtI am new to the world of XML, so need a little help on how to approach this issue. On trying to generate an XML file using an Oracle code, I obtain an incomplete XML tag at the end of the file. My guess is that the spanish content inside the XML is causing this. I have tried to change the encoding format from UTF-8 to ISO-8859-1, but the error still persisted. Here is a sample output:-

 

HTTP/1.1 200 OK
Server: Apache-Coyote/1.1
Server: DWS/4.1
Cache-Control: no-cache
Set-Cookie: JSESSIONID=2551F518D867AB17F8CA73885E7F9CA2; Path=/
Content-Type: text/XML;charset=UTF-8
Content-Length: 729
Date: Thu, 05 May 2016 12:56:37 GMT
<?xml version="1.0" encoding="ISO-8859-1"?><subscriptionHistoryMA version="2.0.1"><batchAdjustmentMA><transactionId>210411850725724</transactionId><subscriberNumber>59899427796</subscriberNumber><transactionDateTime>2016-05-04T00:00:00+00:00</transactionDateTime><originNodeId>ADM_CMA</originNodeId><originNodeType>ADM</originNodeType><originTransactionId>527600</originTransactionId><transactionType>TT01</transactionType><transactionCode>ADC</transactionCode><accountStatus>10000000</accountStatus><accountGroupId>NULL</accountGroupId><externalData1>prueba á é ü N° í ñ ó ú</externalData1><externalData2>NULL</externalData2></batchAdjustmentMA></subscriptionHi
This in turn causes a parsing error while trying to read the XML file through a browser, which is expected.

The code used to generate this XML file is attached for reference.
Any clues would be of great help.
Thanks,
Narayanan.XML_Code.txt
Edited by narayanan010
Link to comment
Share on other sites

You have a conflict here:

 

Content-Type: text/XML;charset=UTF-8

<?xml version="1.0" encoding="ISO-8859-1"?>

 

You should use UTF, not ISO-8859-1. It's probably cut off because the content-length header doesn't match the actual content because of the incorrect encoding.

Link to comment
Share on other sites

Originally, I had encoding format set to UTF-8. In that case the final tag was missing, and also the Spanish characters showed up as GARBAGE VALUES. I knew the source code for the Encoding version and was able to change it to ISO-8859-1.
Any tips on how to change the CHARSET value mentioned here?

Content-Type: text/XML;charset=UTF-8

Is this the CHARSET from OS or from the Database level, or is it hard-coded in some config file?

Link to comment
Share on other sites

The web server sends those headers but I can't guess what controls the values in your case.

 

If the UTF characters are showing up as "garbage values" then they are not correctly encoded as UTF, or you're just reporting the wrong encoding. It sounds like that's the problem. ISO-8859-1 is a single-byte encoding. If you want to support more characters and languages then you should use UTF anyway. The fact that the Spanish characters are being represented as multiple characters indicates that it's already using a multi-byte encoding like UTF, you just need to make sure that everything is on the same page. Make sure the text itself is properly encoded, and make sure the XML and HTTP headers are consistent and identify the correct encoding used in the text.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...