[Upgrade] XML & Encoding

Hi,
<u><b>Context</b></u>
I developed in a BW 3.0 environment an AJAX BSP application. I use the <i>CALL TRANSFORMATION id</i> to return a XML string to the calling page where some Javascript parses it (<i>getElementsByTagName</i>, ...) and updates input fields.
<b>In BW 3.0B</b>
The BSP pages were encoded in <b>iso8859-1</b>
The XML returned was also <b>iso8859-1</b> encoded.
<b>In BI 7</b>
Now, we upgraded to BI 7 with Unicode.
The BSP pages are now encoded in <b>utf-8</b>  (when I look at the HTTP Header Fields)
The XML returned is <b>utf-16</b> encoded  (it is the responseText attribute that I refer to)
The problem is that the responseXML object which I use in Javascript seems to be either corrupt or unreadable (I bet on encoding reasons).
I tried to specify the encoding like this :
CALL METHOD response->set_header_field( name  = 'Content-Type'
                                        value = 'text/xml; charset=utf-16' ).
but without success.
<u><b>Questions</b></u>
Do I have to :
1) Re-encode the XML string
2) Use binary instead of character
Besides, is there a way to inspect the responseXML (today, I launch alert(responseXML.childnodes.length);)
Thanks in advance.
Best regards,
Guillaume

Hi Raja,
Many thanks for these valuable insights !
I was able to<b> correct my code partly</b>.
Indeed, the responseXML object is back to normal with the following addition to CALL TRANSFORMATION id :
OPTIONS xml_header = 'WITHOUT_ENCODING'
But, as I am dealing with several tables that I gather into one XML string, <b>I use the cl_xml_document_base class</b> like this :
    CREATE OBJECT wcl_xml_doc_inputs.
    CALL METHOD wcl_xml_doc_inputs->parse_string( stream = w_xml_inputs ).
    CREATE OBJECT  wcl_xml_doc_except_msg.
    CALL METHOD wcl_xml_doc_except_msg->parse_string( stream = w_xml_except_msg ).
    wcl_node_inputs = wcl_node_inputs->get_parent( ).
    wcl_node_inputs->append_child( new_child = wcl_node_except_msg ).
    CALL METHOD wcl_xml_doc_inputs->render_2_string
      EXPORTING
        pretty_print = 'X'
      IMPORTING
        stream       = o_xml.
This might also affect the final encoding because the responseXML is unreadable yet again.
I tried to set some :
CALL METHOD wcl_xml_doc_inputs->set_encoding( charset = ... ).
with iso8859-1, utf8, utf-16 but still unsuccessful.
Thanks in advance.
Best regards,
Guillaume

Similar Messages

  • UNICODE System - XML Encoding Error

    Dear Experts,
    We've upgraded our SAP system to ECC 6.0 Unicode. One of our applications works with XML files and we've been experimenting some problems with the XML encoding since the machine is Unicode enabled. In the XML structure we obtain strange chinesse characters:
    This should be the right xml response:
    <?xml version="1.0" encoding="utf-8"?><OpenHR><employee><id>69900004</id><name>Employee 1, Romania</name><orgName>Test ROMANIA</orgName><role>EMPLOYEE</role><flex>NO</flex><company>NE</company></employee><labels><label id="delegation">Delegations</label>
    We obtain:
    ⸰㰿硭氠癥牳楯渽∱⸰u2220敮捯摩湧㴢畴昭㠢㼾㱏灥湈刾㱥浰汯祥放㱩搾㘹㤰〰〴㰯楤㸼湡浥㹅浰汯祥攠ㄬ⁒潭慮楡㰯湡浥㸼潲李慭放呥獴⁒位䅎䥁㰯潲李慭放㱲潬放䕍偌余䕅㰯牯汥㸼晬數㹎似⽦汥砾㱣潭灡湹㹎䕏㰯捯浰慮社㰯敭灬潹敥㸼污扥汳㸼污扥氠楤㴢摥汥条瑩潮∾䑥汥条瑩潮猼⽬慢敬㸼污扥氠楤㴢桥汰∾䡥汰㰯污扥氾㱬慢敬⁩搽≩湣楤敮捥獔楴汥∾健牳潮湥氠䅤浩湩獴牡瑩潮㰯污扥氾㱬慢敬⁩搽≮潄敬敧慴楯渢㹐汥慳攬⁲整畲渠瑯睮慬敮摡爠楦⁹潵⁷慮琠瑯捣敳猠瑯⁤敬敧慴楯湳㰯污扥氾㱬慢敬⁩搽≮潴敃潮晩牭兵敳瑩潮∾偲敳猠慣捥灴⁩映祯甠獨潵汤⁧整⁩琼
    Here is the code where we guess the problem is (we have tried with differente encoding types: ISO-8859-1, UTF-8, UTF-16 and DEFAULT).
    DATA:  S_ENCODING_TYPE TYPE STRING,
                 ENCODING TYPE REF TO IF_IXML_ENCODING.
    S_ENCODING_TYPE = 'iso-8859-1'.
    ENCODING = IXML->CREATE_ENCODING(     CHARACTER_SET = S_ENCODING_TYPE
                                                                           BYTE_ORDER = 0 ).
    CALL METHOD ODOCUMENT->SET_ENCODING
        EXPORTING ENCODING = ENCODING.
    CALL FUNCTION 'SDIXML_DOM_TO_XML'
           EXPORTING
                DOCUMENT         = ODOCUMENT
           IMPORTING
                SIZE                     = ISIZERAW
           TABLES
                XML_AS_TABLE = IDATA
           EXCEPTIONS
                NO_DOCUMENT  = 1
                OTHERS              = 2.
    (IDATA is the variable where we see the chinesse text)

    It will not give you any effect to set up encoding because this function module sets its own encoding inside:
    encoding = pixml->create_encoding( character_set = 'UTF-8' byte_order = 0 ).
    Renderer is created by the kernel:
    by kernel module abkm_iXML_CreateRenderer.
    Something may be wrong with the installation.

  • 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>

  • 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

  • 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.

  • How to set the Xml Encoding ISO-8859-1 to Transformer or DOMSource

    I have a xml string and it already contains an xml declaration with encoding="ISO-8859-1". (In my real product, since some of the element/attribute value contains a Spanish character, I need to use this encoding instead of UTF-8.) Also, in my program, I need to add more attributes or manipulate the xml string dynamically, so I create a DOM Document object for that. And, then, I use Transformer to convert this Document to a stream.
    My problme is: Firstly, once converted through the Transformer, the xml encoding changed to default UTF-8, Secondly, I wanted to check whether the DOM Document created with the xml string maintains the Xml Encoding of ISO-8859-1 or not. So, I called Document.getXmlEncoding(), but it is throwing a runtime error - unknown method.
    Is there any way I can maintain the original Xml Encoding of ISO-8859-1 when I use either the DOMSource or Transformer? I am using JDK1.5.0-12.
    Following is my sample program you can use.
    I would appreciate any help, because so far, I cannot find any answer to this using the JDK documentation at all.
    Thanks,
    Jin Kim
    import java.io.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Attr;
    import org.xml.sax.InputSource;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    public class XmlEncodingTest
        StringBuffer xmlStrBuf = new StringBuffer();
        TransformerFactory tFactory = null;
        Transformer transformer = null;
        Document document = null;
        public void performTest()
            xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                     .append("<TESTXML>\n")
                     .append("<ELEM ATT1=\"Yes\" />\n")
                     .append("</TESTXML>\n");
            // the encoding is set to iso-8859-1 in the xml declaration.
            System.out.println("initial xml = \n" + xmlStrBuf.toString());
            try
                //Test1: Use the transformer to ouput the xmlStrBuf.
                // This shows the xml encoding result from the transformer which will change to UTF-8
                tFactory = TransformerFactory.newInstance();
                transformer = tFactory.newTransformer();
                StreamSource ss = new StreamSource( new StringBufferInputStream( xmlStrBuf.toString()));
                System.out.println("Test1 result = ");
                transformer.transform( ss, new StreamResult(System.out));
                //Test2: Create a DOM document object for xmlStrBuf and manipulate it by adding an attribute ATT2="No"
                DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dfactory.newDocumentBuilder();
                document = builder.parse( new StringBufferInputStream( xmlStrBuf.toString()));
                // skip adding attribute since it does not affect the test result
                // Use a Transformer to output the DOM document. the encoding becomes UTF-8
                DOMSource source = new DOMSource(document);
                StreamResult result = new StreamResult(System.out);
                System.out.println("\n\nTest2 result = ");
                transformer.transform(source, result);
            catch (Exception e)
                System.out.println("<performTest> Exception caught. " + e.toString());
        public static void main( String arg[])
            XmlEncodingTest xmlTest = new XmlEncodingTest();
            xmlTest.performTest();
    }

    Thanks DrClap for your answer. With your information, I rewrote the sample program as in the following, and it works well now as I intended! About the UTF-8 and Spanish charaters, I think you are right. It looks like there can be many factors involved on this subject though - for example, the real character sets used to create an xml document, and the xml encoding information declared will matter. The special character I had a trouble was u00F3, and somehow, I found out that Sax Parser or even Document Builder parser does not like this character when encoding is set to "UTF-8" in the Xml document. My sample program below may not be a perfect example, but if you replaces ISO-8859-1 with UTF-8, and not setting the encoding property to the transfermer, you may notice that the special character in my example is broken in Test1 and Test2. In my sample, I decided to use ByteArrayInputStream instead of StringBufferInpuptStream because the documentation says StringBufferInputStream may have a problem with converting characters into bytes.
    Thanks again for your help!
    Jin Kim
    import java.io.*;
    import java.util.*;
    import org.w3c.dom.Document;
    import org.w3c.dom.Element;
    import org.w3c.dom.Node;
    import org.w3c.dom.NodeList;
    import org.w3c.dom.Attr;
    import org.xml.sax.InputSource;
    import javax.xml.parsers.DocumentBuilder;
    import javax.xml.parsers.DocumentBuilderFactory;
    import javax.xml.transform.Templates;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.dom.DOMSource;
    import javax.xml.transform.Source;
    import javax.xml.transform.stream.StreamSource;
    import javax.xml.transform.stream.StreamResult;
    * XML encoding test for Transformer
    public class XmlEncodingTest2
        StringBuffer xmlStrBuf = new StringBuffer();
        TransformerFactory tFactory = null;
        Document document = null;
        public void performTest()
            xmlStrBuf.append("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n")
                     .append("<TESTXML>\n")
                     .append("<ELEM ATT1=\"Resoluci�n\">\n")
                     .append("Special charatered attribute test")
                     .append("\n</ELEM>")
                     .append("\n</TESTXML>\n");
            // the encoding is set to iso-8859-1 in the xml declaration.
            System.out.println("**** Initial xml = \n" + xmlStrBuf.toString());
            try
                //TransformerFactoryImpl transformerFactory = new TransformerFactoryImpl();
                //Test1: Use the transformer to ouput the xmlStrBuf.
                tFactory = TransformerFactory.newInstance();
                Transformer transformer = tFactory.newTransformer();
                byte xmlbytes[] = xmlStrBuf.toString().getBytes("ISO-8859-1");
                StreamSource streamSource = new StreamSource( new ByteArrayInputStream( xmlbytes ));
                ByteArrayOutputStream xmlBaos = new ByteArrayOutputStream();
                Properties transProperties = transformer.getOutputProperties();
                transProperties.list( System.out); // prints out current transformer properties
                System.out.println("**** setting the transformer's encoding property to ISO-8859-1.");
                transformer.setOutputProperty("encoding", "ISO-8859-1");
                transformer.transform( streamSource, new StreamResult( xmlBaos));
                System.out.println("**** Test1 result = ");
                System.out.println(xmlBaos.toString("ISO-8859-1"));
                //Test2: Create a DOM document object for xmlStrBuf to add a new attribute ATT2="No"
                DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
                DocumentBuilder builder = dfactory.newDocumentBuilder();
                document = builder.parse( new ByteArrayInputStream( xmlbytes));
                // skip adding attribute since it does not affect the test result
                // Use a Transformer to output the DOM document.
                DOMSource source = new DOMSource(document);
                xmlBaos.reset();
                transformer.transform( source, new StreamResult( xmlBaos));
                System.out.println("\n\n****Test2 result = ");
                System.out.println(xmlBaos.toString("ISO-8859-1"));
                //xmlBaos.flush();
                //xmlBaos.close();
            catch (Exception e)
                System.out.println("<performTest> Exception caught. " + e.toString());
            finally
        public static void main( String arg[])
            XmlEncodingTest2 xmlTest = new XmlEncodingTest2();
            xmlTest.performTest();
    }

  • 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

  • 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 encoding for type XML B/L transaction property

    I need to change the XML encoding type from UTF-8 to UTF-16 for XML documents being sent to an external system via the web service action block. Is there any way to change this encoding in XMII?

    Musarrat,
    Of course it's possible....
    Tim,
    Instead of using the WebService action us the Post action and set the body of the post to be the WebService SOAP XML.  Since the operation of a WebService and POST are the same thing behind the scenes this will work without a problem.
    Hope this helps.
    Sam

  • Upgrade XML Publisher from 5.5.0 to 5.6.2

    Hi All,
    I am using Oracle Application 11.5.10.2. and XML Publisher 5.5.0. Now i want to Upgrade XML Publisher from 5.5.0 to 5.6.2.
    What patch sets i need to apply for this?
    Thanks
    XMLP User

    1. Shut down all your middle tier procesess
    2. Apply AD prerequisites
    - 4337683 - AD Patch 11i.AD.2
    - 4104924 - TXK (FND) AutoConfig Template Rollup Patch K (July 2005)
    3. Apply additional prerequisites
    - 1674407 - Update JavaMail API to version 1.2
    - 3412795 - ADSPLICE Patch for XDO
    4. Apply Oracle XML Publisher 5.6.2 Rollup Patch
    - 5097966
    5. Install Oracle XML Publisher Desktop
    - 5027437 Oracle XML Publisher Desktop 5.6.2
    - Review the readme file of the above patches to install all pre-req.
    - Oracle XML Publisher Core Rollup Patch 5.6.2 contains the core libraries only, If you want to utilize a full E-Business Suite implementation, you must apply one of the Oracle XML Publisher OA Rollup patches - Latest is ORACLE XML PUBLISHER OA ROLLUP PATCH 5.6.1 (Patch 4905678) - (Note: 357308.1)
    - Refer to note: 367394.1 (About Oracle XML Publisher Release 5.6.2) for more details.

  • Address book data is XML-encoded  in LDAP ?

    Hi,
    We are trying to find out how address book data is stored in the LDAP, and we've found several different ways apparently. Some format seems to use an XML encoded format (this is when you go in the UWC (JES5) and add a new group and in stead of selecting contacts to add, you just type a name, and an email address).
    This is how it looks like in the ldap:
    absi@nagios ~/ $ ldapsearch -D "cn=Directory manager" -w Jxxxxxxxxxx -b "o=PiServerDb" -h 192.168.xxx.50 "displayname=test_manueel"
    version: 1
    dn: piEntryID=e115cc045b373f,piPStoreOwner=adresboekadmin,o=xxxxxxxxxxxxxxt.be
    ,o=PiServerDb
    piEntryID: e115cc045b373f
    objectClass: PITYPEGROUP
    objectClass: piEntry
    objectClass: top
    memberOfPIBook: e114db3c213216f6
    displayName: test_manueel
    pipEntryXMLData:: PG9saT4KIDxHcm91cEV4TWVtYmVyPnRlc3QzJTVFU01UUCU1RXRlc3QzJTQ
    wdmxhYW1zcGFybGVtZW50LmJlPC9Hcm91cEV4TWVtYmVyPgogPEdyb3VwRXhNZW1iZXI+a2llcmV
    3aWV0JTVFU01UUCU1RWtpZXJld2lldCU0MHZsYWFtc3BhcmxlbWVudC5iZTwvR3JvdXBFeE1lbWJ
    lcj4KIDxHcm91cEV4TWVtYmVyPnRlc3Q0NSU1RVNNVFAlNUV0ZXN0NDUlNDBhYnNpLmJlPC9Hcm9
    1cEV4TWVtYmVyPgo8L29saT4K
    However, I can't find any usable reference to this ldap attribute 'pipEntryXMLData' , except that it's used by JES 2005Q1 onwards
    I'm also concerned by the following:
    - in case of problems, are there tools to read out / export this XML data in anything that is human readable / parseable ?
    - what about scalability, we will be having members with thousands of entries in their addressbook, is this method scalable or will we be experiencing delays when users are looking up contacts in their address books ?
    All info on this is more than welcom!
    regards,
    Tom.

    The ldapsearch tools are producing LDIF format (RFC 2849) which requires that non ascii values and values with some specific characters be Base64 encoded.
    XML is out of these formats that start with a special character with regards to LDIF ('<') and for which values must be base64 encoded.
    There are many decoders for base64 encoding.
    Alternately, you can use an LDAP API (C or Java) and the value will not be encoded.
    Regards,
    Ludovic.

  • Address book data is XML-encoded ?

    Hi,
    We are trying to find out how address book data is stored in the LDAP, and we've found several different ways apparently. Some format seems to use an XML encoded format (this is when you go in the UWC (JES5) and add a new group and in stead of selecting contacts to add, you just type a name, and an email address).
    This is how it looks like in the ldap:
    absi@nagios ~/ $ ldapsearch -D "cn=Directory manager" -w Jxxxxxxxxxx -b "o=PiServerDb" -h 192.168.xxx.50 "displayname=test_manueel"
    version: 1
    dn: piEntryID=e115cc045b373f,piPStoreOwner=adresboekadmin,o=xxxxxxxxxxxxxxt.be
    ,o=PiServerDb
    piEntryID: e115cc045b373f
    objectClass: PITYPEGROUP
    objectClass: piEntry
    objectClass: top
    memberOfPIBook: e114db3c213216f6
    displayName: test_manueel
    pipEntryXMLData:: PG9saT4KIDxHcm91cEV4TWVtYmVyPnRlc3QzJTVFU01UUCU1RXRlc3QzJTQ
    wdmxhYW1zcGFybGVtZW50LmJlPC9Hcm91cEV4TWVtYmVyPgogPEdyb3VwRXhNZW1iZXI+a2llcmV
    3aWV0JTVFU01UUCU1RWtpZXJld2lldCU0MHZsYWFtc3BhcmxlbWVudC5iZTwvR3JvdXBFeE1lbWJ
    lcj4KIDxHcm91cEV4TWVtYmVyPnRlc3Q0NSU1RVNNVFAlNUV0ZXN0NDUlNDBhYnNpLmJlPC9Hcm9
    1cEV4TWVtYmVyPgo8L29saT4K
    However, I can't find any usable reference to this ldap attribute 'pipEntryXMLData' , except that it's used by JES 2005Q1 onwards
    I'm also concerned by the following:
    - in case of problems, are there tools to read out / export this XML data in anything that is human readable / parseable ?
    - what about scalability, we will be having members with thousands of entries in their addressbook, is this method scalable or will we be experiencing delays when users are looking up contacts in their address books ?
    All info on this is more than welcom!
    regards,
    Tom.

    Hi,
    tom_absi wrote:
    We are trying to find out how address book data is stored in the LDAP, and we've found several different ways apparently. Some format seems to use an XML encoded format (this is when you go in the UWC (JES5) and add a new group and in stead of selecting contacts to add, you just type a name, and an email address).This isn't surprising as there wasn't any pre-existing attribute which could be used to add these values. So it appears they are using an XML 'blob' instead.
    This is how it looks like in the ldap:
    pipEntryXMLData:: PG9saT4KIDxHcm91cEV4TWVtYmVyPnRlc3QzJTVFU01UUCU1RXRlc3QzJTQ
    wdmxhYW1zcGFybGVtZW50LmJlPC9Hcm91cEV4TWVtYmVyPgogPEdyb3VwRXhNZW1iZXI+a2llcmV
    3aWV0JTVFU01UUCU1RWtpZXJld2lldCU0MHZsYWFtc3BhcmxlbWVudC5iZTwvR3JvdXBFeE1lbWJ
    lcj4KIDxHcm91cEV4TWVtYmVyPnRlc3Q0NSU1RVNNVFAlNUV0ZXN0NDUlNDBhYnNpLmJlPC9Hcm9
    1cEV4TWVtYmVyPgo8L29saT4KThis is base64 encoded and decodes as (http://www.opinionatedgeek.com/dotnet/tools/Base64Decode/):
    <oli>
    <GroupExMember>test3%5ESMTP%5Etest3%40vlaamsparlement.be</GroupExMember>
    <GroupExMember>kierewiet%5ESMTP%5Ekierewiet%40vlaamsparlement.be</GroupExMember>
    <GroupExMember>test45%5ESMTP%5Etest45%40absi.be</GroupExMember>
    </oli> However, I can't find any usable reference to this ldap attribute 'pipEntryXMLData' , except that it's used by JES 2005Q1 onwardsAppears to be a 'private' attribute. Although you can access the data because it is stored in an LDAP server I don't believe it is a public interface so it is bound to change.
    I'm also concerned by the following:
    - in case of problems, are there tools to read out / export this XML data in anything that is human readable / parseable ?The base64 decoded version seems parseable to me?
    - what about scalability, we will be having members with thousands of entries in their addressbook, is this method scalable or will we be experiencing delays when users are looking up contacts in their address books ?Assuming you have a sufficiently scoped/tuned directory server I don't see there is going to be a problem.
    Regards,
    Shane.

  • XML encoding

    Hi all,
    I'm using JAXB marshaller to get some XML strings....
    All works great, however, the marshaller adds in front of the XML string I'm interested in an XML encoding string.
    It looks like that "<?xml version="1.0" encoding="UTF-8" standalone="yes"?>"
    Is there a way to tell it NOT to add this string?
    Thanks

    Hi,
    Use a parser to serialize the Document object to disk, here is a sample using Apache xerces
    OutputStreamWriter out = new OutputStreamWriter(new FileOutputStream("C:/temp/Output.xml"), "UTF-8");
    OutputFormat formatter = new OutputFormat();
    formatter.setPreserveSpace(true);
    formatter.setOmitXMLDeclaration(true);
    XMLSerializer serializer = new XMLSerializer(out,formatter);
    serializer.serialize(doc);
    out.close();
    Hope this helps

  • How do I remove xml encoding?

    Hi,
    Is it possible to remove xml encoding?
    From
    <?xml version="1.0" encoding="UTF-8"?>
    To
    <?xml version="1.0"?>

    Hi Sander,
    Try this java mapping it shoudl work
    PS: I am hoping that you are in PI7.1 .. you need to import com.sap.xpi.ib.mapping.lib.jar file
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.InputStream;
    import java.io.InputStreamReader;
    import java.io.OutputStream;
    import java.io.Reader;
    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;
    * @author srsuraj
    public class GetContent extends AbstractTransformation {
         public void execute(InputStream in, OutputStream out)
                 throws StreamTransformationException {
                // Add your code here
                String inData = convertStreamToString(in);
                 String outData = inData.replaceFirst("encoding=\"UTF-8\"","");
                try
                //The JAVA mapping output payload is returned using the TransformationOutput class
                // arg1.getOutputPayload().getOutputStream()
                     out.write(outData.getBytes("UTF-8"));
                catch(Exception exception1) { }
          //Un comment to test the mapping as a standalone code
         /*public static void main(String[] args) {
            try {
               //InputStream in = new FileInputStream(new File("C:\\Suraj\\eclipse-jee-ganymede-SR2-win32\\Workspace\\JavaMapping\\in.txt"));
              InputStream in = new FileInputStream(new File("C:\\Suraj\\eclipse-jee-ganymede-SR2-win32\\Workspace\\JavaMapping\\test.xml"));
               OutputStream out = new FileOutputStream(new File("out.xml"));
              GetContent myMapping = new GetContent();
               myMapping.execute(in, out);
            } catch (Exception e) {
               e.printStackTrace();
          public void transform(TransformationInput arg0, TransformationOutput arg1) throws StreamTransformationException {
         getTrace().addInfo("JAVA Mapping Called");
         this.execute(arg0.getInputPayload().getInputStream(),
                              arg1.getOutputPayload().getOutputStream());     
          public String convertStreamToString(InputStream in){
         StringBuffer sb = new StringBuffer();
         try
         InputStreamReader isr = new InputStreamReader(in);
         Reader reader =
         new BufferedReader(isr);
         int ch;
         while((ch = in.read()) > -1) {
              sb.append((char)ch);}
              reader.close();
         catch(Exception exception) { }
         return sb.toString();
    Regards
    Suraj

  • Why doesn't Adobe upgrade CS6 Encoder

    Why doesn't Adobe upgrade CS6 Encoder and only CC Encoder?

    Hi rbnbrl,
    I would just like to reconfirm the eligibilities of purchansing CC at special offer price :
    The serial number which qualifies for special offer for CC has to be :
    1.CS3 & above
    2. Retail product (purchased for personal usage,with only two installs permitted)
    3.It can not be an Adobe product obtained as a bundle pack with purchase of any Electronic Item(e.g computer/printer/camera etc.)
    4.It can not be any purchase under Educational licenses
    5.It can not be any Volume License product(it is registered in www.licensing.adobe.com)
    Note:An OEM(Section 3) serial number, Educational serial number, few Volume licensing Serial number prior to CS6 can be registered in Adobe.com, they still do not qualify for special price offer.
    Please check :
    There is a  hyperlink of "Terms" in the purchasing in :
    https://creative.adobe.com/plans?plan=individual&store_code=us
    It states that (http://www.adobe.com/store/en_us/popup/offer/ccm_complete_offer.html)
    Regards,
    Rajshree

Maybe you are looking for

  • Why does my iPhone 4s lag so much on iOS 8.1.1

    i understand that the iPhone 4s is getting old now but come on remember the iPhone 3gs flawless running iOS 6 then comes the iPhone 4 it was ruined on iOS 7 and now Apple is killing the iPhone 4s already iphone 4s and iPad 2 users we promised perform

  • How to convert parameter in to proper date format in unix.

    My requirement is to convert parameter string (012011) as a date in unix without support from other like sql. then once it is converted into date format how to increment it by one day. Here i want to use my own date rather than system timestamp of un

  • Print out sql statement

    Is there any way to print out a sql statement to a window when using on session? I have a sql select statement which looks like the following: SQL SELECT * FROM table_name WHERE column_a = :Value1 ON SESSION lDBSession; I would like to be able to pri

  • Line tool Cursor

    Can someone tell me how to change the color of the cursor so when I am using the line tool on a black background, I can see the cursor

  • Where do my stdout and stderr go?

    I've installed the iPlanet Webserver 6.0SP1 for Solaris. I would like to know how could I have the stderr and stdout redirected to log files, in order to be able to see JSP's and servlet's System.out.print() and System.err.print() messages. Now it lo