XML encoding to UTF-8 charset - Oracle 9i

Hi Masters
Database Version : 9i
Can you please help me here.. I am in a process of writing an Inventory Adjustment tool that will generate the XML and encode it to utf-8 charset…
I have successfully written the code to generate the XML in this format
<?xml version="1.0" encoding="ISO-8859-1" ?>
<InvAdjustDesc>
<dc_dest_id>323</dc_dest_id>
<InvAdjustDtl>
<item_id>12345678</item_id>
<adjustment_reason_code>383</adjustment_reason_code>
<unit_qty>4</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition/>
<user_id>e7062159</user_id>
<create_date>
<year>2012</year>
<month>10</month>
<day>29</day>
<hour>14</hour>
<minute>59</minute>
<second>25</second>
</create_date>
<ww_liability_code>353</ww_liability_code>
<ww_ref_1/>
<ww_ref_2/>
<ww_tran_id>25863399875</ww_tran_id>
<ww_alloc_no/>
<ww_final_store>353</ww_final_store>
</InvAdjustDtl>
</InvAdjustDesc>
And now as part of the AIT requirement this XML needs to be encoded to utf-8 and look like this
<?xml version="1.0" encoding="UTF-8"?><RibMessages><ribMessage><family>InvAdjust</family><type>INVADJUSTCRE</type><id>54601557</id><ribmessageID>3</ribmessageID><publishTime>2012-10-29 15:03:12.000 SAST</publishTime><messageData>&lt;?xml version=&quot;1.0&quot; encoding=&quot;ISO-8859-1&quot; ?&gt;&lt;InvAdjustDesc&gt;&lt;dc_dest_id&gt;323&lt;/dc_dest_id&gt;&lt;InvAdjustDtl&gt;&lt;item_id&gt;12345678&lt;/item_id&gt;&lt;adjustment_reason_code&gt;383&lt;/adjustment_reason_code&gt;&lt;unit_qty&gt;4&lt;/unit_qty&gt;&lt;from_disposition&gt;ATS&lt;/from_disposition&gt;&lt;to_disposition/&gt;&lt;user_id&gt;e7062159&lt;/user_id&gt;&lt;create_date&gt;&lt;year&gt;2012&lt;/year&gt;&lt;month&gt;10&lt;/month&gt;&lt;day&gt;29&lt;/day&gt;&lt;hour&gt;14&lt;/hour&gt;&lt;minute&gt;59&lt;/minute&gt;&lt;second&gt;25&lt;/second&gt;&lt;/create_date&gt;&lt;ww_liability_code&gt;353&lt;/ww_liability_code&gt;&lt;ww_ref_1/&gt;&lt;ww_ref_2/&gt;&lt;ww_tran_id&gt;25863399875&lt;/ww_tran_id&gt;&lt;ww_alloc_no/&gt;&lt;ww_final_store&gt;353&lt;/ww_final_store&gt;&lt;/InvAdjustDtl&gt;&lt;/InvAdjustDesc&gt;</messageData><customFlag>F</customFlag></ribMessage></RibMessages>
I am not quite familiar with xml encoding do you have any suggestion on how i can accomplish this?
Thanks

Hi Odie
I found a way of writing the encoded xml thanks for your help my man, much appreciated...
But now can you help me here this xml I am generating needs to be like the one at the bottom...
Here is my SQL I am using....
SELECT XMLELEMENT
("InvAdjustDesc"
,XMLFOREST
(inv.dc_dest_id AS "dc_dest_id"
,XMLFOREST
(NVL(inv.item_id, ' ') AS "item_id"
,NVL(inv.adjustment_reason_code, ' ') AS "adjustment_reason_code"
,NVL(inv.unit_qty, 0) AS "unit_qty"
,NVL(inv.from_disposition, ' ') AS "from_disposition"
,NVL(inv.to_disposition, ' ') AS "to_disposition"
,NVL(inv.user_id, ' ') AS "user_id"
,XMLFOREST(TO_CHAR(SYSDATE, 'yyyy') AS "year"
,TO_CHAR(SYSDATE, 'mm') AS "month"
,TO_CHAR(SYSDATE, 'dd') AS "day"
,TO_CHAR(SYSDATE, 'hh') AS "hour"
,TO_CHAR(SYSDATE, 'mi') AS "minute"
,TO_CHAR(SYSDATE, 'ss') AS "second"
) AS create_date
,NVL(inv.ww_liability_code, ' ') AS "ww_liability_code"
,NVL(inv.ww_ref_1, ' ') AS "ww_ref_1"
,NVL(inv.ww_ref_2, ' ') AS "ww_ref_2"
,NVL(inv.ww_tran_id, ' ') AS "ww_tran_id"
,NVL(inv.ww_alloc_no, ' ') AS "ww_alloc_no"
,NVL(inv.ww_final_store, ' ') AS "ww_final_store"
) AS InvAdjustDtl)) AS InvAdjustDesc
FROM invadjust inv
WHERE inv.dc_dest_id = 342
and rownum <= 3;
I need to have a leading <InvAdjustDesc> with a node <dc_dest_id> with repeating <InvAdjustDtl>
I did try to put XMLAGG to group all of my <InvAdjustDtl> nodes but the output I get is two entries of <InvAdjustDtl> as follows
<InvAdjustDesc>
<dc_dest_id>323</dc_dest_id>
<INVADJUSTDTL>
<InvAdjustDtl>
<item_id>20144791</item_id>
<adjustment_reason_code>6</adjustment_reason_code>
<unit_qty>-4</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition />
<user_id>r7052891</user_id>
<CREATE_DATE>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>10</hour>
<minute>15</minute>
<second>44</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751178</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</InvAdjustDtl>
<InvAdjustDtl>
<item_id>6009173222220</item_id>
<adjustment_reason_code>6</adjustment_reason_code>
<unit_qty>-1</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition />
<user_id>r7052891</user_id>
<CREATE_DATE>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>10</hour>
<minute>15</minute>
<second>44</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751179</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</InvAdjustDtl>
<InvAdjustDtl>
<item_id>2034180000008</item_id>
<adjustment_reason_code>6</adjustment_reason_code>
<unit_qty>-1</unit_qty>
<from_disposition>ATS</from_disposition>
<to_disposition />
<user_id>r7052891</user_id>
<CREATE_DATE>
<year>2012</year>
<month>10</month>
<day>31</day>
<hour>10</hour>
<minute>15</minute>
<second>44</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751180</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</InvAdjustDtl>
</INVADJUSTDTL>
</InvAdjustDesc>cond>11</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751180</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</INVADJUSTDTL>
</InvAdjustDesc>cond>11</second>
</CREATE_DATE>
<ww_liability_code>342</ww_liability_code>
<ww_ref_1 />
<ww_ref_2 />
<ww_tran_id>342021751180</ww_tran_id>
<ww_alloc_no />
<ww_final_store>342</ww_final_store>
</INVADJUSTDTL>
</InvAdjustDesc>
--------------------------------------Desired Output___________________
<?xml version="1.0" encoding="ISO-8859-1" ?>
<InvAdjustDesc>
     <dc_dest_id>852</dc_dest_id>
     <InvAdjustDtl>
          <item_id>12345</item_id>
          <adjustment_reason_code>989</adjustment_reason_code>
          <unit_qty>4</unit_qty>
          <from_disposition>ats</from_disposition>
          <to_disposition>tst</to_disposition>
          <user_id>w759862</user_id>
          <create_date>
               <year>2012</year>
               <month>10</month>
               <day>31</day>
               <hour>09</hour>
               <minute>14</minute>
               <second>23</second>
          </create_date>
          <ww_liability_code>852</ww_liability_code>
          <ww_ref_1/>
          <ww_ref_2/>
          <ww_tran_id>12358965</ww_tran_id>
          <ww_alloc_no/>
          <ww_final_store>323</ww_final_store>
     </InvAdjustDtl>
     <InvAdjustDtl>
          <item_id>78952675</item_id>
          <adjustment_reason_code>987</adjustment_reason_code>
          <unit_qty>5</unit_qty>
          <from_disposition>ats</from_disposition>
          <to_disposition>asr</to_disposition>
          <user_id>w7889526</user_id>
          <create_date>
               <year>2012</year>
               <month>10</month>
               <day>31</day>
               <hour>09</hour>
               <minute>15</minute>
               <second>02</second>
          </create_date>
          <ww_liability_code>456</ww_liability_code>
          <ww_ref_1/>
          <ww_ref_2/>
          <ww_tran_id>482665226</ww_tran_id>
          <ww_alloc_no/>
          <ww_final_store>456</ww_final_store>
     </InvAdjustDtl>
</InvAdjustDesc>

Similar Messages

  • Change XML Encoding to UTF-8

    Dear SDNers:
    Hello!
    I face an issue of sending some XML documents from SAP to a non SAP System. This non SAP System stores XML documents in UTF-8 encoding format. When I create an XML document using CALL TRANSFORMATION in ABAP, the XML code generated has encoding as "ISO-...". Could anyone of you please guide me on how to have this changed to UTF-8?
    In case of no solution, I would eventually have to pick the XML generated code and replace the "ISO-..." thing with "UTF-8" at runtime within the program. However, I feel that's not a quality method.
    So, if anyone of you can suggest/opine of something better, it would be truly appreciated and rewarded.
    Have a Nice Day!
    Vivek.

    Hello Uwe:
    Currently we are on 6.20. But an upgrade is very near and I should expect these Classes to be handy then. I will explore them individually and post back. However, regarding my issue: the XML code generated by program is something like:
    <?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><SOURCE>42</SOURCE>
    <?xml version="1.0" encoding="iso-8859-1"?>#<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0"><asx:values><SOURCE>42</SOURCE>.......
    My need here is to replace the - encoding="iso-8859-1" with "UTF-8". So if you suggest proper methods to do so then it will be a good step for me.
    Thanks for the relevant information anyways.
    Have a nice day!

  • Changing the xml encoding from UTF-8 to ISO-8859-1

    Hi,
    I have created an xml file in xMII transaction that I feed into a webservice as input. As of now, the data in the xml file is entirely english text (it would be changing to have European text soon).  I gave the encoding as UTF-8.
    I get an error on the webservice side(not xMII code) that the its not able to parse. The error is 'SaxParseException: Invalid 1 of 1-byte UTF-8 sequence). I know that an easy fix is if tI change the encoding to iso-8859-1.
    But the reference document doesnot let me put anythign other than UTF-8. Even if I put <?xml version="1.0" encoding="iso-8859-1"?> as the first line, when I save it and open it back, i see <?xml version="1.0" encoding="UTF-8"?>
    Is there any way to change the encoding? Or better still, anyway idea why this invalid sequence is coming from?
    Thanks,
    Ravi.

    Hi Ravi,
    We have encountered scenarios where we needed to take the <?xml version="1.0" encoding="UTF-8"?> out completely.  As xMII was providing the Web Service, it needed a workaround.
    In your case, it seems that you wish to pass it from xMII to an external Web Service provider.  One option might be to pass the XML document as string.
    Once you convert it to a string, it may escape all XMl characters (i.e. '<' into '&lt;').  You could perform a string manipulation and remove the <?xml version="1.0" encoding="UTF-8"?> from the string.  You may also need to play around with xmlDecode( string ) function in the Link Editor.
    I would suggest that before you try this option, create a string variable will the contents, but without the <?xml version="1.0" encoding="UTF-8"?> and try assigning it to the input.
    You may also wish to try a string variable that has <?xml version="1.0" encoding="iso-8859-1"?> as the first line.  If this works, you should be able to perform string manipulations to convert your XML document into this modified string.
    Cheers,
    Jai.

  • IsSchemaValid does chang the xml-encoding header from UTF-8 to WINDOWS-1252

    I found the following effect:
    isSchemaValid does changing the encoding - entry of the xml-file-header
    generating xml-file by using DBMS_XMLGEN :
    xmldoc := DBMS_XMLGEN.getXML(ctx);
    with the header of the file is
    <?xml version="1.0" encoding="UTF-8"?>
    change the xmldoc to a xmlType
    and validate it against the schema
    xmldoc_xmlType:=(xmltype(xmldoc)) ;
    xmldoc_xmlType.isSchemaValid ( bSchemalocation)
    after this the header of the file is
    <?xml version="1.0" encoding="WINDOWS-1252"?>
    my DB:
    R11_2_0_2 / Windows 64
    the same in
    R11_2_0_1 / Windows 32
    select name, value from v$parameter where upper(name) like '%NLS%'
    nls_calendar     
    nls_comp          BINARY
    nls_currency     
    nls_date_format     
    nls_date_language     
    nls_dual_currency     
    nls_iso_currency     
    nls_language          AMERICAN
    nls_length_semantics     BYTE
    nls_nchar_conv_excp     FALSE
    nls_numeric_characters     
    nls_sort     
    nls_territory          AMERICA
    nls_time_format     
    nls_timestamp_format     
    nls_timestamp_tz_format     
    nls_time_tz_format     
    register my schema by:
    dbms_xmlschema.registerSchema(
    schemaurl => vschemaurl,
    schemadoc => xsd_file,
    local      => FALSE,      
    gentypes      => TRUE,      
    genbean      => FALSE,      
    gentables      => TRUE,      
    force      => FALSE,
    owner      => dbuser
    ,CSID      => nls_charset_id('AL32UTF8')
    How can I let or change back the xml-encoding entry to UTF-8 ?
    regards

    Your solution should not be relied upon...
    C:\Temp>sqlplus /nolog @t1 %CD%
    SQL*Plus: Release 11.2.0.2.0 Production on Fri Mar 4 09:41:32 2011
    Copyright (c) 1982, 2010, Oracle.  All rights reserved.
    SQL> spool testcase.log
    SQL> --
    SQL> connect sys/oracle as sysdba
    Connected.
    SQL> --
    SQL> set define on
    SQL> set timing on
    SQL> --
    SQL> def XMLDIR = &1
    SQL> --
    SQL> def USERNAME = XDBTEST
    SQL> --
    SQL> def PASSWORD = &USERNAME
    SQL> --
    SQL> def USER_TABLESPACE = USERS
    SQL> --
    SQL> def TEMP_TABLESPACE = TEMP
    SQL> --
    SQL> drop user &USERNAME cascade
      2  /
    old   1: drop user &USERNAME cascade
    new   1: drop user XDBTEST cascade
    User dropped.
    Elapsed: 00:00:00.24
    SQL> grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
      2  /
    old   1: grant create any directory, drop any directory, connect, resource, alter session, create view to &USERNAME identified by &PASSWORD
    new   1: grant create any directory, drop any directory, connect, resource, alter session, create view to XDBTEST identified by XDBTEST
    Grant succeeded.
    Elapsed: 00:00:00.07
    SQL> alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
      2  /
    old   1: alter user &USERNAME default tablespace &USER_TABLESPACE temporary tablespace &TEMP_TABLESPACE
    new   1: alter user XDBTEST default tablespace USERS temporary tablespace TEMP
    User altered.
    Elapsed: 00:00:00.00
    SQL> set long 100000 pages 0 lines 256 trimspool on timing on
    SQL> --
    SQL> connect &USERNAME/&PASSWORD
    Connected.
    SQL> --
    SQL> create or replace directory XMLDIR as '&XMLDIR'
      2  /
    old   1: create or replace directory XMLDIR as '&XMLDIR'
    new   1: create or replace directory XMLDIR as 'C:\Temp'
    Directory created.
    Elapsed: 00:00:00.00
    SQL> create table XML_DEFAULT of XMLTYPE
      2  /
    Table created.
    Elapsed: 00:00:00.11
    SQL> create table XML_CLOB of XMLTYPE
      2  XMLTYPE store as CLOB
      3  /
    Table created.
    Elapsed: 00:00:00.01
    SQL> select *
      2    from nls_database_parameters
      3   where parameter in ('NLS_LANGUAGE', 'NLS_TERRITORY', 'NLS_CHARACTERSET')
      4  /
    NLS_LANGUAGE                   AMERICAN
    NLS_TERRITORY                  AMERICA
    NLS_CHARACTERSET               AL32UTF8
    Elapsed: 00:00:00.02
    SQL> declare
      2    XML_DEFAULT XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      3    XML_CLOB    XMLType := xmltype('<?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>') ;
      4  begin
      5    delete XML_DEFAULT;
      6    delete XML_CLOB;
      7    insert into XML_DEFAULT values (XML_DEFAULT);
      8    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT.xml');
      9    IF  XML_DEFAULT.isSchemaValid ( 'SCHEMALOCATION_DOES_NO_MATTER_FOR_TEST_CASE.XSD', 'SCHEMA_NO_MATTER') = 1 THEN  null; ELSE  null; END IF;
    10    commit;
    11    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_IS_VALID.xml',nls_charset_id('WE8MSWIN1252'));
    12    dbms_xslprocessor.clob2file( XML_DEFAULT.getclobval() , 'XMLDIR','XML_DEFAULT_WIN1252.xml');
    13    insert into XML_CLOB values (XML_CLOB);
    14    dbms_xslprocessor.clob2file( XML_CLOB.getclobval() , 'XMLDIR','XML_CLOB.xml');
    15    commit;
    16  end ;
    17  /
    PL/SQL procedure successfully completed.
    Elapsed: 00:00:00.27
    SQL> --
    SQL> host type XML_DEFAULT.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_IS_VALID.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_DEFAULT_WIN1252.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <TEST>SELECT</TEST>
    SQL> --
    SQL> host type XML_CLOB.xml
    <?xml version="1.0" encoding="WINDOWS-1252"?><TEST>SELECT</TEST>
    SQL> --
    SQL>First, the character set changes because isSchemaValid() causes the document to be parsed and converted to the internal database character set, as does storing it in a table.
    It appear that your solution works in SQL because the semantics of SQL are such that it causes a 'copy' of the XMLType to take place before running the isSchemaValid() processing, were we to optimize away that copy as a result of a patch or performance optimization project then you solution would break...
    If you want the output in a particular character set you should force that using XMLSerialize or getBlobVal(charsetid). Unfortunately we don't have a convience method for writing BLOBS on DBMS_XSLPROCESSOR...

  • Xml payload encoding from utf to iso

    Hi Experts,
    Could you please let me know how can I encode he xml payload from utf-8 to ISO-8859-1.
    its bit urgent any help is appreciated.
    Thanks & Regards,
    Ranganath.

    Hi Ranganath,
    Here is the java mapping for PI 7.1 and above which will transform encoding type from utf-8 to ISO-8859-1.
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import com.sap.aii.mapping.api.AbstractTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    import com.sap.aii.mapping.api.TransformationInput;
    import com.sap.aii.mapping.api.TransformationOutput;
    public class addAttributeToTag2 extends AbstractTransformation {
          * @param args
         public void execute(InputStream in, OutputStream out)
                   throws StreamTransformationException {
              // TODO Auto-generated method stub
              try
                   int c;
                   int count=0;
                   String s="";
                   while(1>0)
                        c=in.read();
                        if(c<0)
                             break;
                        if(count<=2 && (char)c=='?')
                             count++;
                        if(count<=2)
                             s=s+(char)c;
                             if(count==2)
                                  s=s.replaceAll("utf-8","ISO-8859-1");
                                  s=s.replaceAll("UTF-8","ISO-8859-1");
                                  count=3;
                                  out.write(s.getBytes());
                             continue;
                        out.write(c);
                        //System.out.print((char)c);
                   in.close();
                   out.close();
              catch(Exception e)
         public void setParameter(Map arg0) {
              // TODO Auto-generated method stub
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              try{
                   addAttributeToTag2 genFormat=new addAttributeToTag2();
                   FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\copy.xml");
                   FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\copy1.xml");
                   genFormat.execute(in,out);
                   catch(Exception e)
                   e.printStackTrace();
         public void transform(TransformationInput arg0, TransformationOutput arg1)
                   throws StreamTransformationException {
              this.execute(arg0.getInputPayload().getInputStream(), arg1.getOutputPayload().getOutputStream());
    if you are working in PI 7.0 the you need following code
    import java.io.FileInputStream;
    import java.io.FileOutputStream;
    import java.io.InputStream;
    import java.io.OutputStream;
    import java.util.Map;
    import com.sap.aii.mapping.api.StreamTransformation;
    import com.sap.aii.mapping.api.StreamTransformationException;
    public class addAttributeToTag2 implements StreamTransformation {
          * @param args
         public void execute(InputStream in, OutputStream out)
                   throws StreamTransformationException {
              // TODO Auto-generated method stub
              try
                   int c;
                   int count=0;
                   String s="";
                   while(1>0)
                        c=in.read();
                        if(c<0)
                             break;
                        if(count<=2 && (char)c=='?')
                             count++;
                        if(count<=2)
                             s=s+(char)c;
                             if(count==2)
                                  s=s.replaceAll("utf-8","ISO-8859-1");
                                  s=s.replaceAll("UTF-8","ISO-8859-1");
                                  count=3;
                                  out.write(s.getBytes());
                             continue;
                        out.write(c);
                        //System.out.print((char)c);
                   in.close();
                   out.close();
              catch(Exception e)
         public void setParameter(Map arg0) {
              // TODO Auto-generated method stub
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              try{
                   addAttributeToTag2 genFormat=new addAttributeToTag2();
                   FileInputStream in=new FileInputStream("C:\\Apps\\my folder\\sdn\\copy.xml");
                   FileOutputStream out=new FileOutputStream("C:\\Apps\\my folder\\sdn\\copy1.xml");
                   genFormat.execute(in,out);
                   catch(Exception e)
                   e.printStackTrace();
    However as Krish has pointedf out file adapter has option to set encoding type, you can try that option first.
    regards
    Anupam

  • XML encoding "UTF-8" ignored

    HI all,
    we try to post an XML message (cXML invoice) to a receiver but it doesn´t work.
    We use a communication channel "http-destination" where we configure content-type "text/xml" together with XML encoding "UTF-8".
    The configured URL works fine and can be tested in SM59.
    The XML payload itself has a declaration <?xml version="1.0" encoding="UTF-8"?>
    but the strange thing that happens is that all these declarations are being ignored and instead US-ASCII is used. Which leads to an error due to some special german characters within the contents of the XML (e.g. ä, ö, etc.).
    Does anybody of you know how I can achieve that the pre-set UTF-8 will be used as encoding type???
    Many thanky in advance!
    Willi Wuerstlin

    Hi.
    I am trying to map the standard cXML invoice to SAP's standard idoc INVOIC01 - This is how the file looks like
    <?xml version="1.0" ?>
    <!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.014/InvoiceDetail.dtd">
    <cXML version="" payloadID="2008-07-29T04:51:08-06:00.cXML.TEST4101V002" timestamp="2008-07-29T04:51:08-06:00" xml:lang="en-US">
         <Header>...</Header>
    ...</cxml>
    I am having problem with the line <!DOCTYPE cXML SYSTEM "http://xml.cXML.org/schemas/cXML/1.2.014/InvoiceDetail.dtd"> - when the payload is having this line XI is not accepting the message.
    Please let me know how to address this.
    Thanks.

  • Xml Parse throws SaxParseException.Encoding is UTF-8 insteadof ISO-8859-1 ?

    Hi All,
    I'm having some korean characters in my xml. when i tried to parse the xml i'm getting SaxParseException .
    <?xml version="1.0" encoding="UTF-8"?> --- Throwing Exception
    <?xml version="1.0" encoding="ISO-8859-1"?> --- No Exception, successfully parsed
    I'm not sure why UTF-8 is failing and ISO is passing. But I'm always getting xml with UTF-8 format? Can anyone know the reason?
    I also like to know the differences between UTF-8 and ISO, i don't find any good article/document for this.
    Thanks,
    J.Kathir

    When SAX throws an exception when the encoding is set to UTF-8, then the XML contains something that is not a valid UTF-8 code (i.e. your source file is not encoded using UTF-8). Also: whenever you ask about an exception you should definitely post the entire exception, including message and stack trace.
    If it doesn't throw an exception when it is set to ISO-8859-1, then it does not mean that this is the correct choice. ISO-8859-1 is defined from 0 up to 255, so any byte stream is correct in that encoding ('though not necessarily meaninful).
    You absolutely have to find out which encoding the file really is, before you can parse it. If it should contain Korean characters then it is definitely not ISO-8859-1 (or any other encoding from the ISO-8859 family), as those only support latin, cyrillic and similar scripts.

  • Can I force JDBC Driver use UTF-8 Charset to encode?

    The similiar way is in MySQL, like
    jdbc:mysql://localhost:3306/test?useUnicode=true&amp;characterEncoding=UTF-8
    Thanks,

    You must describe your requirements in more details. There is generally nothing special in reading/writing into a database that has UTF-8 (AL32UTF8) as its database character set. Data is read into/written from String variables, which are encoded in UTF-16 by Java design. JDBC transparently converts between UTF-16 and UTF-8.
    If you want to output a string into a file in UTF-8 encoding, it is no longer an Oracle problem but a normal Java programming issue. You need to create an appropriate OutputStreamWriter for your FileOutputStream.
    new OutputStreamWriter( new FileOutputStream(file), "UTF-8" );
    -- Sergiusz

  • How do I supress the encoding of UTF-8 characters in a f:param element

    Hello,
    I have a keyboard displayed on my page, which won't work properly because of the used german characters.
    I have an icon for every button embedded in a link, which adds the selected character to the searchstring.
    For example adding an a works like this:
    from keyboard.xhtml:
    <s:link><f:param name="#{keyname}" value="#{keyword}a"/><h:graphicImage value="key_a.png"/></s:link>keyname and keyword are parameters submitted by the including form:
    from myform.xhtml:
    <ui:param name="keyword" value="#{end}"/>
    <ui:param name="keyname" value="end"/>This works great as long as the character is a standard one, but on as soon as I have a german umlaut in the string, the umlaut gets encoded/escaped with every single character that i add to the searchstring:
    The string makes it's way correctly to the keyboard-template, I can use a h:outputText to show it on the page and it doesn't get escaped.
    So, how can I prevent the escaping of my characters in the f:params elements?
    I really need to get this to work. so any hint or even solution would be fabulous.
    Thanks in advance, Peter
    PS: maybe my web server is doing something nasty, so it would be nice, if someone can check this code:
    <s:link><f:param name="test" value="�"/>INIT</s:link><br/>
    <s:link><f:param name="test" value="#{test}"/>REPEAT</s:link><br/>
    INFO: <h:outputText value="#{test}" /><br/>here is the same one with h:outputLink
    <h:outputLink><f:param name="test" value="�"/>INIT</h:outputLink><br/>
    <h:outputLink><f:param name="test" value="#{test}"/>REPEAT</h:outputLink><br/>
    INFO: <h:outputText value="#{test}" /><br/>EDIT: I found the solution, it was my beloved jboss application server, after adding a parameter to the server.xml, everything worked as expected:
    use page settings:
    <Connector port="8080" .....
    useBodyEncodingForURI="true" ..../>hardcoded:
    <Connector port="8080" .....
    URIEncoding="UTF-8" ..../> Edited by: pete007 on Mar 12, 2008 1:47 PM

    "Encoding" refers to the charset used to convert the Unicode data into bytes. But since you're writing to a String, you aren't converting the data to bytes and therefore UTF-16 is the appropriate encoding. It doesn't make sense to ask for your data to be encoded in UTF-8 when you aren't producing bytes.
    You could read this tutorial about XML and Unicode and encodings for more information:
    http://skew.org/xml/tutorial/

  • Validate xml encoding - BPEL

    Hi!
    I would like to validate the xml encoding in the BPEL process, does anyone know how to do this?
    I mean, I have a BPEL process that receives an xml as the input. The input xml has a encoding specified. For example encoding="UTF-8". What I want to validate is that all the characters in the xml are valid in UTF-8 encoding (or whatever encoding is specified in the xml header).
    I have used <property name="validateXML">true</property> in the bpel.xml. This works to validate the xml against the schema, but does not validate the encoding.
    Please, I need help with this issue.
    Thanks in advance,
    Zaloa

    when using the validate activity in the bpel itself, your instance is already created
    You can enable payload validation per composite of global
    If you go to the Em console > your composite > click the button at the top middle 'Settings' > Payload Validation
    http://download.oracle.com/docs/cd/E15523_01/integration.1111/e10226/bp_config.htm
    9.1 Configuring BPEL Process Service Engine Properties
    Payload Validation

  • Retrieve xml data from a relational table(oracle) with datatype as xmltyp

    Hello Avijit, any resolution for this issue?

    hi .... I am trying to retrieve xml data from a relational table with datatype as xmltyp. The SQ is retrieving rows but the xml parser give transformation error . The transformation retrieve xml data from a relational table(oracle) with datatype as xmltyp returned a row error status on receiving an input row on group retrieve xml data from a relational table(oracle) with datatype as xmltyp.  ERROR : An XML document was truncated and thus not processed. Input row from SQ_XMLTYPE_TEST: Rowdata: ( RowType=0(insert) Src Rowid=5 Targ Rowid=5 DOCUMENT (DataInput:Char.64000:): "<?xml version='1.0' encoding='UTF-8'?><main><DATA_RECORD> <OFFER_ID>434345</OFFER_ID> <ADDR>sec -2 salt lake</ADDR> <CITY>kolkata</CITY> (DISPLAY TRUNCATED)(TRUNCATED)" )  thanks in advance Avijit

  • When creating new table in sqllite db via Flex it become encoded as "utf-16le"

    Hi Guys
    I have some annoying problem with my AIR application
    The application is communicating with a local DB (sqllite).
    as part of initial installation I'm checking if the db exist.
    in case not then:
    I create one (file)
    create the relevent tables inside
    and populate them.
    For some reason, on the tables creation step the sqllite db become encoded as UTF-16le instead of UTF-8.
    The question is how can I make the tables creation step to leave the db as UTF-8
    thanks in advance for your help.
    This is my creation code
    the "connection" is from flash.data.SQLConnection type
    The "file" contain the following information
    <sql>
    <statement>
    CREATE TABLE IF NOT EXISTS MYTABLE
          MYTABLE_VERSION                NUMBER NOT NULL,
           MYTA|BLE_INSERT_DATE                 DATE NOT NULL
    </statement></sql>
    The below is the relevent code:
    var stream:FileStream = new FileStream();
                stream.open(file, FileMode.READ);
                var xml:XML = XML(stream.readUTFBytes(stream.bytesAvailable));
                stream.close();
                var statement:XML = null;
                try
                    connection.begin(lockType);
                    for each (statement in xml.statement)
                        var stmt:SQLStatement = new SQLStatement();
                        stmt.sqlConnection = connection;
                        stmt.text = statement;
                        stmt.execute();           
                } catch(err:Error)
                    connection.rollback();
                    throw err;
                connection.commit();

    It doesn't look like you're using DBSequence domain for the OrderLinesId attribute. If you are then you do not need to fill in the sequence as you've done in the create method.
    Getting back to create issue, You may want to set the 'order' id (foreign key) values before calling super and then call the getOrder() (or getXXX where XXX is the order accessor in this entity) method to verify if the order of the given ID exists/found in the cache.
    By the way, are you also using a similar create() in order with DBSequence as the type for the pK and you force a sequence value on top of it via setAttribute?
    Yes, this is the create method inside CrpOrderLinesImpl.java
    protected void create(AttributeList attributeList) {
    super.create(attributeList);
    SequenceImpl s = new SequenceImpl("CRP_ORDER_LINES_ID_SEQ", getDBTransaction());
    setAttribute("OrderLinesId",s.getSequenceNumber());
    Thanks,
    Brad

  • How to set File Encoding to UTF-8 On Save action in JDeveloper 11G R2?

    Hello,
    I am facing issue when I am modifying a File using JDeveloper 11G R2. JDeveloper is changing the Encoding of the File to System default Encoding (ANSI) instead of UTF-8. I have updated the Encoding to UTF-8 in "Tools | Preferences | Environment | Encoding" option and restarted the JDeveloper. I have also updated "Project Properties | Compiler | Character Encoding" option to UTF-8. None of them are working.
    I am using below version of JDeveloper,
    Oracle JDeveloper 11g Release 2 11.1.2.3.0
    Studio Edition Version 11.1.2.3.0
    Product Version: 11.1.2.3.39.62.76.1
    I created a file in UTF-8 Encoding. I opened it, do some changes and Save it.
    When I open the "Properties" tab using "Help | About" Menu, I can see that the Properties of JDeveloper are showing encoding as Cp1252. Is it related?
    Properties
    sun.jnu.encoding
    Cp1252
    file.encoding
    Cp1252
    Any idea how to make sure JDeveloper saves the File in UTF-8 always?
    - Sujay

    I have already done that. That is the first thing I did as mentioned in my Thread. I have also added below 2 options in jdev.conf and restarted JDeveloper, but that also did not work.
    AddVMOption -Dfile.encoding=UTF-8
    AddVMOption -Dsun.jnu.encoding=UTF-8
    - Sujay

  • XML encoding in mail adapter

    Hi,
    i send via E-Mail Adapter an XML File.
    Is there a possibility to change the xml encoding.
    from:
    <?xml version="1.0" encoding="UTF-8" ?>
    to
    <?xml version="1.0" encoding="ISO-8859-1" ?>
    regards,
    robin

    hi
    check the below links
    XI: Sender mail adapter - PayloadSwapBean - Step by step                              
    /people/michal.krawczyk2/blog/2005/12/18/xi-sender-mail-adapter--payloadswapbean--step-by-step                              
    Mail Adapter (XI) - how to implement dynamic mail address                              
    /people/michal.krawczyk2/blog/2005/03/07/mail-adapter-xi--how-to-implement-dynamic-mail-address                         
    Note: reward points if solution found helpfull
    Regards
    Chandrakanth.k

  • Jaxb & XML & encoding problem                      *URGENT*

    Hello,
    ***Do not be scared because of the length of the question please. I tried to explain problem clearly.***
    I am developing a Web service for a particular client. The client has provided .wsdl and some .xsd files for me.
    I used JWSDP-2.0 to generate holder classes from those .xsd files. In order to specify the root elemnen, I added "@XmlRootElement" annotation in front of the ServiceInfo class (, and also imported "javax.xml.bind.annotation.XmlRootElement"). I am using Eclipse in this project.
    I prepared the Web service exactly as specified by the client, but when I test it with the client the client application cannot show the XML data that it receives as a response to its request. The client application opens a file, writes the XML response to that file and also shows the response on the client application window. However, that file is always empty and I see nothing on the client application window. I do not have the client application's source code, but I do know that client application has no bug.
    NOTE: I have a guideline for developing the Web Service for this particular client and it says there: "ServiceInfo is transfered as a Unicode string, and then encoded as UTF-16."
    (Actually I don't know whether this is the reason of my problem but it is still sth that should be known I guess.)
    Here is the code of my method:
    public java.lang.String getServiceInfo() throws java.rmi.RemoteException {
    JAXBContext servInfoContext = JAXBContext.newInstance("com.gw.oms.serviceinfo"); //com.gw.oms.serviceinfo is the directory where all generated java (from serviceinfo.xsd file) files are stored.
    // create an ObjectFactory instance, create instances of holder classes
    // (root element is "serviceInfo") and set their values.
              try {
                   StringWriter writer = new StringWriter();
                   Marshaller marshaller = servInfoContext.createMarshaller();
                   marshaller.setProperty(Marshaller.JAXB_ENCODING, "UTF-16");
                   marshaller.marshal(serviceInfo, writer);
                   return writer.toString();
              } catch (JAXBException e) {
                   throw new RemoteException("Error marshalling serviceInfo", e);
    I guess the code piece in the try-catch block is true, but maybe I am continuously missing sth. Can you see any wrong thing in the code?
    In order to see what is happenning in the communication between my Web Service and the client application I analyzed the traffic between them via Ethereal network sniffing tool. Here is some info:
    FROM CLIENT TO WEB SERVICE: (Data Content of HTTP packet)
    <?xml version="1.0" encoding="UTF-8"?>
    <soap:Envelope
    xmlns:soap="http://schema.xmlsoap.org/soap/envelope"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <soap:Body>
    <GetServiceInfo
    xmlns="http://....XXX....."/>
    </soap:Body>
    </soap:Envelope>
    FROM WEB SERVICE TO CLIENT: (Data Content of HTTP packet)
    <?xml version="1.0" encoding="UTF-8"?>
    <soapenv:Envelope
    xmlns:soap="http://schema.xmlsoap.org/soap/envelope"
    xmlns:xsd="http://www.w3.org/2001/XMLSchema"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
    <GetServiceInfoResult
    xmlns=""/> **>> WARNING 1 <<**
    <?xml version="1.0" encoding="UTF-16" standalone="yes"?>\n<serviceInfo xmlns="http://....XXX..../serviceInfo"><serviceProvider>Service Provider Name< **>> WARNING 2 <<**
    </GetServiceInfoResult>
    </soapenv:Body>
    </soapenv:Envelope>
    **>> WARNING 1 <<**: WHY IS 'XMLNS' EMPTY HERE??? SHOULDN'T IT BE "http://....XXX....." ALSO????
    **>> WARNING 2 <<**: WHY DON'T I SEE THE COMPLETE SERVICEINFO HERE? ONLY 1 HTTP RESPONSE PACKET IS BEING SENT TO THE CLIENT BY MY WEB SERVICE.
    If I make Eclipse write to the console what I am sending, I see the result below:
    <?xml version="1.0" encoding="UTF-16"?>
    <serviceInfo xmlns="http://....XXX...../serviceInfo">
    <serviceProvider>MY UNIVERSITY</serviceProvider>
    <serviceUri>http://myserviceuri.com</serviceUri>
    <signUpPage>http://signupmyservice/services/ITUServiceSoap</signUpPage>
    <targetLocale>1053</targetLocale>
    <localName>MIN SERVIS</localName>
    <englishName>MY SERVICE</englishName>
    <authenticationType>other</authenticationType>
    <supportedService>
    <SMS_SENDER maxSbcsPerMessage="160" maxRecipientsPerMessage="400" maxMessagesPerSend="5" maxDbcsPerMessage="0"/>
    </supportedService>
    </serviceInfo>
    Somehow the client application cannot receive (or validate) the serviceinfo that my Web service sends. I suspect that sth is wrong with my Java code. Can any one see any error in this schema?
    I am really stucked. Any recommendation would be very valuable for me.
    Thanks & Regards

    I feel like nobody is following this forum anymore.. :)
    Does anybody have any idea...?
    Regards

Maybe you are looking for

  • Stuck with Labview?

    So your stuck with Labview. Don't let that restrict your choice of DAQ boards. Amplicon provide PC based data acquisition boards with a range of software support, including Labview drivers. Take the ADLink DAQ2200 for example: http://www.amplicon.co.

  • Hi i need help from u ........people.........

    hi, i  need some answers....... Q1. how to open a session from the report without going into the SM35? Q2.how to modify the script without modifying the predefined print program using form routines?procedure please? Q3.if we want to copy the fields i

  • Help! My RAW files are VERY grainy! :-(

    Hi, I've not long started shooting in RAW with my Nikon D700 and have had some pleasing results so far. However, I've just started editing in Lightroom and have noticed that my RAW images are incredibly grainy. I don't think it's the ISO because this

  • DCNM v5.2(2),S104 Discovery for 6500s Very Slow

    It's been discovering a 6513 for over 90 minutes. Is this an expected duration or is something likely malfunctioning or is it just the sheer # of interfaces that it must process? The Nexus 5k's that it has discovered progressed fairly quickly.

  • How can configure weblogic for use Hibernate

    Hello everybody, my question is how can I configureit weblogic for use hibernate. I'm using JDeveloper 11g but I did not show any error when I run my jsp page, the page shows me all, but it is as if it never made the connection. the data of my table