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
Similar Messages
-
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><?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></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?
ThanksHi 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> -
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,
robinhi
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 -
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 WuerstlinHi.
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();
} -
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,
Zaloawhen 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 ?
regardsYour 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 -
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. -
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. -
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 -
hi you all
still got a problem with my XML Encoder
I fail encoding my TableModel. I've checked I can serialize it, and serialize it well. But the XML document that is created (encoding a JPanel and everything that's in it) and thus records the table, records no trace of the TableModel.
feel desesperate!
thanxCan you show me your code block?
Thanks
Tajul islam -
Inserting XML encoded ampersands into tables with OracleXMLSave / XMLLoader
Hi,
I've an XMLLoader application based on Steve Muench's design.
My client has given me XML documents with XML encoded ampersands.
The XMLloader (OracleXMLSave) is treating the ampersand as a substitution token and is adding chunks of unexpected text when it inserts the strings containing ampersands.
How do I turn off the substition within the JDBC?
Thanks,
Steve.If your XML Document looks like:
<ROWSET>
<ROW>
<FIELD1>val-1</FIELD1>
<FIELD12>val-12</FIELD12>
</ROW>
</ROWSET>
it will insert into just those two
fields, the rest will be null for
the purposes of the insert. -
Has anyone managed to get the new XML Encoder or XML decoder working under 1.3.
I may not be able to use 1.4 / Merlin for at least a year in my development cycle but would love to use the xml encoder and decoder stuff. Does anyone know if this is possible????Using JDK1.3.1 U can use XML parser to parse any XML file, U can still work on JDK1.3 for XML parsing but U should be good at DTD for using DOM.
Maybe you are looking for
-
I bought a used i pod 4 for my daughter and it does not have the message icon on it ( not even in settings) how can I get the message icon on it so it can receive and send messages
-
Converting video to swf files in flash for breeze
Hello, I am using Adobe Premiere Pro 2 and wanted to know what the best video codec and audio codec to use when I export to create a video file to insert into flash to convert to a swf file for breeze? I am having trouble with the audio, must I demux
-
Hi Gurus, I'm new to FSCM. My requirement is that I have to implement the BADI UKM_CHECK_STEP so that a Sales Order is blocked when the Payment Term has value 'XXXX' even if the customer has sufficient available credit limit. Can anybody please sugge
-
I had to re-import my iTunes library as yesterday it was suddenly empty... but now all my mobile apps do not appear. As with my entire library yesterday, all the music, apps, videos appear in the itunes music folder... but despite copying the library
-
SMDIAG_WIZARD and XML template for EWA
Hi all experts, I'm in SolMan 4.0 SP12 want to make a EWA report from Enterprise Portal 6.0. 1) I have a problem when I run SMDIAG_WIZARD to my Enterprise Portal 6.0. error : <i>Localization failed: ResourceBundle='com.sap.engine.services.rfcengine.R