XMLROOT encoding chr ref = hex ref
We use xmlroot to create an XML file for our archival system directly from SQL.
The xml works fine but we have some "encoding" problem.
Our problem is the special character are in chr ref (html) format instead of hexadecimal ones.
for exemple: & will be written as & in our xml file. We would like it to be in hexadecimal instead:
& [source: http://myhandbook.info/codes_htmlchr.html]
To create our xml file we put the version as follow "VERSION '1.0" encoding="UTF-8' ".
Is there a way we can make it write the special characters directly in hexadecimal format ?
Thanks in advance !
Pier-Olivier
Not sure how you make them hexidecimal. What's the problem with them being the html version?
How are you setting the XML to be UTF-8? as the XMLROOT doesn't let you specify it (or it didn't in 10g when I last had to do that; have they changed it in 11g?) unless you fake the 'version' element to include it.
Here's an example of the method we have used to generate XML in UTF-8 format in the file...
SQL> ed
Wrote file afiedt.buf
1 declare
2 v_xml xmltype;
3 v_doc XMLDOM.DOMDocument;
4 begin
5 select xmlelement("AllDepartments",
6 xmlagg(
7 xmlelement("Department", xmlattributes(d.deptno as deptno, d.dname as dname),
8 xmlagg(
9 xmlelement("Employee", xmlattributes(e.empno as empno, e.mgr as mgr),
10 xmlelement("ename", ename),
11 xmlelement("job", job),
12 xmlelement("sal", sal)
13 )
14 )
15 )
16 )
17 )
18 into v_xml
19 from dept d left outer join emp e on (e.deptno = d.deptno)
20 group by d.deptno, d.dname;
21 v_doc := DBMS_XMLDOM.NEWDOMDOCUMENT(v_xml);
22 DBMS_XMLDOM.WRITETOFILE(v_doc, 'TEMP_DIR\emp.xml', 'UTF-8');
23 DBMS_XMLDOM.FREEDOCUMENT(v_doc);
24* end;
SQL> /
Similar Messages
-
XML Encoding Issue - Format UTF-16 to ISO-8859-1
Dear Groupmates,
I have data in my Internal table which i am converting to XML using custom Transformation.
Data is going to third party.The third party system requires data in ISO-8859-1 Format but SAP is generating the same in UTF-16 Format.I have been able to change the format of file from
utf-16 to ISO-8859-1 format but after conversion i am getting invalid tag information in form of characters
like < , > etc..in my file.
Here is the code i have used to set the encoding to ISO-8859-1 :-
DATA: xmlout TYPE xstring.
DATA: ixml TYPE REF TO if_ixml,
streamfactory TYPE REF TO if_ixml_stream_factory,
encoding TYPE REF TO if_ixml_encoding,
ixml_ostream TYPE REF TO if_ixml_ostream.
ixml = cl_ixml=>create( ).
streamfactory = ixml->create_stream_factory( ).
ixml_ostream = streamfactory->create_ostream_xstring( xmlout ).
encoding = ixml->create_encoding(
character_set = 'ISO-8859-1' byte_order = 0 ).
ixml_ostream->set_encoding( encoding = encoding ).
Sample Output :-
<?xml version="1.0" encoding="iso-8859-1"?>
<AMS_DOC_XML_EXPORT_FILE><AMS_DOCUMENT AUTO_DOC_NUM="FALSE" DOC_CAT="CA" DOC_CD="CA" DOC_DEPT_CD="045" DOC_ID="XR10281060830400001" DOC_IMPORT_MODE="OE" DOC_TYP="CH" DOC_UNIT_CD ="NULL" DOC_VERS_NO="01">
<CH_DOC_HDR AMSDataObject="Y">
<DOC_CAT Attribute="Y"><![CDATA[CA]]></DOC_CAT>
<DOC_TYP Attribute="Y"><![CDATA[CH]]></DOC_TYP>
Please let me know if anyone has idea how i can get rid of the invalid tag information.
Thanks !
With Regards,
Darshan MulmuleDarshan,
Did you get an answer for this question? We have same requirement to create XML file in ISO-8859-1 format with Attributes is set to "Y" and CDATA is being used for data.
Can you please let me know if you still remember how did you achieve it?
Satyen... -
Encoding XML in ISO-8859-1 from a unicode system
Hello
I want to generate an XML with an encoding ISO-8859-1. I'm on a unicode platform.
I've done the following program :
It works well with the line 'encoding UTF-16.
With the line encoding 'encoding ISO ...', I have special characters in the sting xml_string.
NB : The program works correctly on a non-unicode platform.
Can you help me ?
Thank you
REPORT .
DATA : xml_string TYPE string.
DATA : BEGIN OF l_id,
numero(10),
systeme TYPE gsval,
date TYPE d,
heure TYPE uzeit,
type(7),
nb_nid TYPE i,
END OF l_id.
DATA: ixml TYPE REF TO if_ixml,
streamfactory TYPE REF TO if_ixml_stream_factory,
encoding TYPE REF TO if_ixml_encoding,
ixml_ostream TYPE REF TO if_ixml_ostream.
START-OF-SELECTION.
l_id-date = sy-datum.
l_id-heure = sy-uzeit.
l_id-type = 'BATCH'.
ixml = cl_ixml=>create( ).
streamfactory = ixml->create_stream_factory( ).
ixml_ostream = streamfactory->create_ostream_cstring( xml_string ).
encoding = ixml->create_encoding( character_set = 'ISO-8859-1' byte_order = 0 ).
encoding = ixml->create_encoding( character_set = 'UTF-16' byte_order = 0 ).
ixml_ostream->set_encoding( encoding = encoding ).
CALL TRANSFORMATION ztest_xml
SOURCE id = l_id
RESULT XML ixml_ostream.
BREAK-POINT.Forum rules say: no mail (we must share the solution)
I didn't understand what was exactly his issue, and what he exactly meant by "then to convert with the good encoding".
His first sentence means that he used the following program (using Xstring instead of string):
REPORT .
DATA : xml_xstring TYPE xstring.
DATA : BEGIN OF l_id,
numero(10),
systeme TYPE gsval,
date TYPE d,
heure TYPE uzeit,
type(7),
nb_nid TYPE i,
END OF l_id.
DATA: ixml TYPE REF TO if_ixml,
streamfactory TYPE REF TO if_ixml_stream_factory,
encoding TYPE REF TO if_ixml_encoding,
ixml_ostream TYPE REF TO if_ixml_ostream.
START-OF-SELECTION.
l_id-date = sy-datum.
l_id-heure = sy-uzeit.
l_id-type = 'BATCH'.
ixml = cl_ixml=>create( ).
streamfactory = ixml->create_stream_factory( ).
ixml_ostream = streamfactory->create_ostream_xstring( xml_xstring ).
encoding = ixml->create_encoding( character_set = 'ISO-8859-1' byte_order = 0 ).
ixml_ostream->set_encoding( encoding = encoding ).
CALL TRANSFORMATION id
SOURCE id = l_id
RESULT XML ixml_ostream.
* in debug here, you'll see that xml_xstring contains
* XML result in ISO-8859-1 encoding
BREAK-POINT. -
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. -
Hi guys,
Relating to Anonymizer enconding I'm having some trouble in using the ISO-8859-1 encoding.
On the JMS channel I've the CCSID set to 00819 and the anonymizer.encoding property set to ISO-8859-1. Nevertheless I'm getting on the message monitoring the following exception:
Anonimizer: failed to anonymized due to java.io.IOException: com.sap.engine.lib.xml.parser.NestedSAXParserException: Fatal Error: com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 41(:main:, row:23, col:33)(:main:, row=23, col=33) -> com.sap.engine.lib.xml.parser.ParserException: Unsupported character: 41(:main:, row:23, col:33)
This exception is related to a special character which appears on row 23, col 33, namely 'Ç' .
Can you guys help me or have any suggestions?Hi,
As in above post its mentaioned that the Anonymizer encoding can not be used in sender adapter and this possible to use with XI3.0 SP16 or above and PI7.0 or above.
Starting from SAP NetWeaver Exchange Infrastructure 3.0 SP16 you can use this module to change the encoding of an XML document.
The parameter for this purpose is:
anonymizer.encoding = <charset>
You have to define all namespaces and prefixes of the XML document in the
parameter anonymizer.acceptNamespaces to prevent them from being
removed.
More information: SAP Note 880173 - XI 3.0 Adapter Framework XML Anonymizer
Module
https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/502991a2-45d9-2910-d99f-8aba5d79fb42
Please I kindly request you to confirm about it.
It is not possible to use this module in the sender JMS or SOAP adapter as this adapter type does not support any additional modules.
Can I request you to once again confirm about the the parameters of the XMLAnonymizerBean
anonymizer.acceptNamespaces
Enter an alternating list of all allowed namespaces and the corresponding prefixes devided by space. If you want a namespace without prefix, enter '' (two single quotes) as prefix. All namespaces which are not in this list are removed from the XML message.
Example: http://namespace1 '' http://namespace2 ns
anonymizer.quote
Enter the character that should be used for attribute quotes, usually ' or "
anonymizer.encoding
Enter the encoding that should be used in the XML declaration, if you want to change the default UTF-8. The XML file is changed to this encoding
Please refer below link to varify the parameters for module XMLAnonymizerBean
/people/stefan.grube/blog/2007/02/02/remove-namespace-prefix-or-change-xml-encoding-with-the-xmlanonymizerbean
Note : the link is for SOAP adapter , but for JMS also you will have same parameters.
Thanks
Swarup
Edited by: Swarup Sawant on Jan 26, 2008 7:37 PM -
Encode/Decode a String containing Chinese etc. characters to/from unicode
Hi, I am working to encode a multilingual String (English, chinese, japanese, Latin etc) as unicode. The encoded string is used as follows
1)decoded by the User Interface for display purpose. The user interface is a web UI and
2)read by user. So it should be human readable when it contains only English and special characters.
Thus having a string that contains letters from English, Japanese, CHinese etc, we want the Japanese/Chinese characters to be encoded by the hex values such as 私 be encoded as %E7%A7%81.
However, it is preferable that other special characters like ! ? , space etc not be encoded and left as such.
The encoding of characters is achievable by using Java.net.URLEncoder but it also replaces all special characters including space character, which becomes a pain for the reader.
Unfortunately URLEncoder.java does not have any API to configure which characters to encode. Any suggestions how I can proceed, or what encoder i can use?
Thanks in advance!
RegardsI have to say that I disagree that "%E7%A7%81" is "human-readable". On the contrary, I would say that "私" is human-readable; even though I don't understand it myself, there are a lot of humans who do.
But let's say that "human-readable" wasn't the right term. Maybe you just wanted a representation of an arbitrary Unicode string in ASCII characters only. In which case I would recommend Base-64 encoding. It does make everything unreadable, though, whereas your requirements appear to be to only make languages other than English be unreadable. So if you don't like that you are going to have to write your own encoder.
Note also that your original premise:
Hi, I am working to encode a multilingual String (English, chinese, japanese, Latin etc) as unicode.is misguided, since all data in Java Strings is already Unicode characters. -
Convert syncronous serial data into sequence of hex values
Hi,
I have a problem analysing captured data of a digital I/O board. I hope one of you can give me an advice/hint on this.
Used Software: Labview Express 7.0
Problem description:
The captured digital data contains on channel 0 a clock signal, on channel 1 a reset signal and on channel 3 a data signal. The data signal is syncronized to the clock and consists out of 8 serial data bits. My problem is, how to convert this clock syncronized serial data signal into a sequence (array) of bytes each represented by 2 hex digits?
More details on the problem environment:
- The captured data comes from an ASCII file which contains data samples of a 16bit digital I/O card. Every line contains one sample encoded as 4 hex digits
- The file is converted by a VI to a digital waveform and plotted by a digital waveform graph.
One of my core problem on the way to a solution lies in the area, of how to "Trigger and Gate" the digital waveform based on the rising edge of channel 0.
Thanks in advance for your help!
Tryber.I checked with the 7.0 express version we have loaded on an older computer still and the part that I think you can use was in that version. In the second loop I had made a note: Boolean Crossing PtByPt. This looks at a binary input and can output a true pulse (one iteration) based on the direction input condition. This has three options; False-True (rising), True-False (falling), or Either which is the option I had used in that vi. This should allow you to detect a false-true state change on the clock channel. Now, you say that the clock pulse is not consistant, but what about the information pulses? That was the reason for the first two loops on my program. To insure that the digital value was measured during one input pulse to avoid turning two or more input pulses into one digital value.
As far as your question about trigger functions between the two, I'm not too sure. I believe they offer the same options that I tend to use so I havnt had a problem with either. On your block diagram menu select All Functions > Analyze > Point by Point > Other Functions PtbyPt. There are some very handy tools in that menu. -
German umlaut in idoc to file scenario
Hi,
in our scenario we send MATMAS idocs to XI, map them and create a file using file adapter.
Settings in file receiver communication channel: file type = text and file encoding = UTF8. I also tried file encoding = ISO-8859-1 - both with the same result:
German umlauts are not converted. E.g. the material short text "Hängematte" is shown as "Hängematte" in the created file. The receiving system errors out. Acceptable would be
"H& #228;ngematte". (of course without the blank but I have to add it herer else the forum would replace this by "ä" )Any help is appreciated.
Regards,
PhilippHi,
Follow the steps:-
1>In your adapter -> Set File type to TEXT -> use Encoding and provide ISO-8859-1 (http://en.wikipedia.org/wiki/ISO/IEC_8859-1)
To know more about other encoding standards refer -
http://en.wikipedia.org/wiki/Character_encoding
2>file type==>binary
Regards,
AshwinM
Reward If helpful -
Hi friends,
I am trying Abap mapping in my scenario.
I am using DOM parsers
By default the first line of the output xml document generated is
<b><?xml version="1.0" ?></b>
But I want to add encoding to it. i.e it should be
<b><?xml version="1.0" encoding="UTF-8"?></b>
I have written the code to change this , but it is not working. my code is
data: temp1 type string.
temp1 = 'UTF-8'.
data : encode type ref to IF_IXML_ENCODING.
encode->set_character_set( CHARSET = 'UTF-8' ).
data: odocument type ref to if_ixml_document.
odocument = ixmlfactory->create_document( ).
odocument->SET_ENCODING( encode ).
This code is giving exception
- <u><CX_XMS_SYSTEM_ERROR>
<ID>APPLICATION_PROGRAM_ERROR</ID>
<P1>Z_COSTCENTER_ABAP_MAPPING</P1>
<P2>SAP-ABAP</P2>
<P3>UNCAUGHT_EXCEPTION</P3>
<P4>Program Z_COSTCENTER_ABAP_MAPPING=====CP Include Z_COSTCENTER_ABAP_MAPPING=====CM001 Line 1</P4>
<INFO />
<CATEGORY />
<AREA />
<RETRY />
</CX_XMS_SYSTEM_ERROR>
<CX_XMS_SYSERR_MAPPING />
</cls:CX_XMS_SYSERR_MAPPING>
- <cls:CX_SY_NO_HANDLER id="o215">
- <CX_ROOT>
<TEXTID>1F09B73915F6B645E10000000A11447B</TEXTID>
<PREVIOUS href="#o216" />
<KERNEL_ERRID>UNCAUGHT_EXCEPTION</KERNEL_ERRID>
- <INTERNAL_SOURCE_POS>
<PROGID>196</PROGID>
<CONTID>47</CONTID>
</INTERNAL_SOURCE_POS>
</CX_ROOT>
<CX_NO_CHECK />
- <CX_SY_NO_HANDLER>
<CLASSNAME><b>CX_SY_REF_IS_INITIAL</b></CLASSNAME>
</CX_SY_NO_HANDLER></u>
Can anyone please tell me how to add the encoding parameter in the Output XML document which we are building through ABAP MAPPING.
Thanks,
YomeshHi Yomesh,
Did you solve this problem. If yes could you please tell. I am also facing the same problem.
Regards,
Dinakar -
Content Conversion - Special Characters
How content conversion behaves with special characters?
Do we need to avoid any text in the input string that needs to be converted?
ThanksHow content conversion behaves with special characters?
Do we need to avoid any text in the input string that needs to be converted?
>>>
There is no link between the content conversion and special characters directly. The dependency is actually on the encoding standard used. You can set your encoding standard in the file adapter.
Option:
File Type
Specify the document data type.
1. Binary
2. Text
Under File Encoding, specify a code page.
For encoding standard ref. the post by another SDNer in this thread itself. -
Hi to all!
The purpose of my application: monitoring of the motion control system.
Monitored equipment:
1. Motion controller + motor.
http://www.yetmotion.com/YetIsrael/Products.asp?Currentcategory_id=44&Currenttat_category_id=70
http://www.yetmotion.com/YetIsrael/ProductDetails.asp?ID=15
Monitoring equipment:
1. NI PXI-6602
2. Quadrature encoder with Z – index. (The encoder is connected to the shaft of the motor).
Right now the encoder not defined. Instead of the encoder I’m using PG-out of my motion controller. It works exactly as usual quadrature encoder.
The application is written in labview 8.2.1 and right now it is nothing more than "Meas Angular Position-Buffered-Cont-Ext Clk.vi" from labview examples.
I need an application that performs counter reset not each z-index.
My motion controller implements command such as SLIDE(velocity), Home_C and so on.
Command sequence (for my motion controller):
Slide 1000 – my motor revolves with 1000rpm (The duration of the movement is not configured).
After 10 min the position is 312445878 ticks (The number is for exemplifying).
In my encoder Z-index comes every 16384 ticks
Home_C 100 – perform homing on C-pulse. (Go to the Z-index and reset the actual position of my controller).
In this example Z-index happened 312445878/16384=19070 times, and only when I send Home_C command, on the next Z-index it will reset the position value.
So, what I want is that PXI-6602 will monitor the actual position value according to the circumstances.
Thanks in advance!
Izia
YET
www.yetmotion.comHi Izia,
Technically, a position-capture task is an edge-counting task with a little more configuration done for you. In this case, you are probably best to use one of the Angular Position examples. The example that you specified should work fine. I think that I originally misunderstood the question.
In order to reset the z index count, you will need to configure the z index using the DAQmx Create Channel function. From the LabVIEW help:
z index enable specifies whether to use Z indexing for the channel.
z index value specifies in units the value to which to reset the measurement when signal Z is high and signal A and signal B are at the states you specify with z index phase.
z index phase specifies the states at which signal A and signal B must be while signal Z is high for NI-DAQmx to reset the measurement. If signal Z is never high while signal A and signal B are high, for example, you must choose a phase other than A High B High.
When signal Z transitions to high and how long it stays high varies from encoder to encoder. Refer to the documentation for the encoder to determine the timing of signal Z with respect to signal A and signal B.
A High B High (10040)
Reset the measurement when signal A and signal B are high.
A High B Low (10041)
Reset the measurement when signal A is high and signal B is low.
A Low B High (10042)
Reset the measurement when signal A is low and signal B high.
A Low B Low (10043)
Reset the measurement when signal A and signal B are low.
Lastly, I recommend that you look at this knowledge base article for more information about resetting the z index.
I think that the example you are using should give the desired results if configured correctly. Please let us know if you have further questions.
Thanks,
Luke
Applications Engineer
National Instruments -
Closing tag in xml transformation
Hi experts,
I have the following ABAP code:
ABAP itab to XML string
CALL TRANSFORMATION id SOURCE data = ti_stocks[]
RESULT XML ps_output.
The result in ps_output should be an xml like this
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DATA>
<ZTABLE_STO>
<FIELD1 /> ABC</FIELD1>
<FIELD2 />0300</FIELD2>
<FIELD3 />1</FIELD3>
</ZTABLE_STO>
etc.
However, if my internal table ti_stocks contains the field1 with an empty value then the xml is incorrect without its corresponding closing tag:
<?xml version="1.0" encoding="utf-16" ?>
<asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
<asx:values>
<DATA>
<ZTABLE_STO>
<FIELD1 />
<FIELD2 />0300</FIELD2>
<FIELD3 />1</FIELD3>
</ZTABLE_STO>
etc.
How can I resolve this problem? I would like to have an open tag and a closing tag for every field.
FIELD1 is a char type field.
Thank you,
Oscar
Edited by: Oscar Arranz on Jan 26, 2012 2:46 PMHello everyone, sorry for my english, I had the same requeriment for the end tag, the simple transformation give this result <xxx/> when the value was empty, and I did something similar to Oscar,
i did the simple transformation and the result whas and xstring, i used a function to pass it to string, and then I make a replacement.
here is some code:
* Genera XML
data: xml_xstring type xstring.
data: w_xml type string.
data: ixml type ref to if_ixml,
streamfactory type ref to if_ixml_stream_factory,
encoding type ref to if_ixml_encoding,
ixml_ostream type ref to if_ixml_ostream.
data: resstream type ref to if_ixml_ostream.
****Create an instance of the Ixml Processor
ixml = cl_ixml=>create( ).
* ****Create the Stream Factory
streamfactory = ixml->create_stream_factory( ).
* ****Create an Endcoding and Byte Order
encoding = ixml->create_encoding( character_set = 'ISO-8859-1' byte_order = 0 ).
* * ****Create the output stream with a pointer to our binary string
ixml_ostream = streamfactory->create_ostream_xstring( xml_xstring ).
* ****Set the Encoding into a stream
ixml_ostream->set_encoding( encoding = encoding ).
****Call simple Transformation
call transformation zdte_libros
source zcaratula = x_doc
result xml ixml_ostream.
*From xstring to string.
call function 'HR_RU_CONVERT_HEX_TO_STRING'
exporting
xstring = xml_xstring
importing
cstring = w_xml.
* <xxx/> to <xxx><xxx/>
replace all occurrences of regex '<([^><\s]+)( [^><]+)?/>' in w_xml with '<$1$2></$1>'.
Hope it helps someone with the same problem . -
제품 : ORACLE SERVER
작성날짜 : 2003-09-24
CHARACTERSET이 다른 DB 간의 한글 조회 방법
=========================================
PURPOSE
다음의 방법을 single byte 7 bit encoding 을 사용하는 US7ASCII,
WE8DEC 등과 double byte encoding을 사용하는 KO16KSC5601에서 쌍반 간에
한글 data 조회를 가능하게 하는 방법이다.
이 방법은 한 문자에 대한 각 ascii code값에 대해 비교하고 계산하기에
data가 많거나 성능이 문제시 된다면 사용하는 것을 권장하지 않습니다.
Explanation
방법은 다음과 같습니다. 한글 '가'를 예로 들어 설명한다.
1. '가' 라는 data가 있는 쪽에서 다음과 같이 작업합니다.
1) hexa값으로 전환
rawtohex('가') ==> 'B0A1'
'가'를 hexa값으로 전환한다.
2) 일련의 ascii code값을 얻가 위해 변환한다.
translate(rawtohex('가'),'ABCDEF',':;<=>?') ==> ';0:1'
위에서 'ABCDEF'는 숫자 다음에 오는 문자이며 이 문자를 대신하여 ':;<=>?'
로 전환한다.
':;<=>?'는 ASCII의 숫자 다음에 오는 문자이다.
이와 같이 작업을 하는 이유는 16진수 경우 9라는 숫자 다음에 오는 A,B..F가
숫자 다음의 ascii code 값을
갖지 않기 때문에 그 다음의 문자로 대체한다.
3) data가 있는 쪽에서 view를 만든다.
SELECT translate(rawtohex(column_name),'ABCDEF',':;<=>?') as name FROM
tablename;
2. data를 보려는 쪽에서 다음과 같이 view를 만들거나 select한다.
위에서 저장된 data를 보면 ';0:1' 인데 이의 각 문자별 ascii code값은
59,48,58,49이다.
이를 원래의 ascii code값으로 변경한다.
single byte 7 bit encoding에서는 다음의 방법으로 계산된다. (48은 0의
ascii code값이다)
((59-48)*16)+(48-48))||((58-48)*16)+(49-48) 즉, 176 || 161
하지만 double byte encoding에서는 위의 방법이 불가하며
chr(176*256 + 161) 해야 '가' 가 반환된다.
single byte 7 bit encoding에서는 '가'에 대한 문자가 각 8bit에 대해
chr(176)||chr(161)으로 계산이 가능하나 double byte encoding에서는 이 방
법은 불가하며 앞의 8bit에 대해서 2의 8승인 256을 곱해야 정상적인 문자가
반환이 된다.
또한 한글과 영문, 숫자가 섞여 있을 경우는 무조건 256만을 곱할 수가 없다.
한글만 256을 곱한다.
이에 대한 예는 아래의 function에서 설명한다.
3. 각 case별 test 내역
test는 US7ASCII와 KO16KSC5601 db간의 한글 data를 조회한 예이다.
KO16KSC561의 younkim table과 US7ASCII의 younkim2 table에 대한 data는
다음과 같다. (data내용은 같게했음)
NO NAME
1 김재연
2 김은영
3 이상헌
4 ADAMS
5 SCOTT
6 JAMES
7 이상헌2
8 test12임
9 30하하
10 scott동생
US7ASCII에서 KO16KSC5601 의 한글조회시 다음과 같다.
SQL> select * from younkim@ko;
NO NAME
1 ???
2 ???
3 ???
4 ADAMS
5 SCOTT
6 JAMES
7 ???2
8 test12?
9 30??
10 scott??
물론 KO16KSC5601에서 US7ASCII의 한글 조회시도 다음과 같이 알아 볼수가
없다.
SQL> select * from younkim2@us;
NO NAME
1 1h@g?,
2 1h@:?5
3 @L;sGe
4 ADAMS
5 SCOTT
6 JAMES
7 @L;sGe2
8 test12@S
9 30GOGO
10 scott5?;}
1) US7ASCII에서 KO16KSC560에 있는 data조회 방법
a. KO16KSC5601에서 view를 만든다.
먼저 US7ASCII에서 KO16KSC560에 있는 younkim table에 대한 data를 조회하기
위해서는 다음과 같이 먼저
KO16KSC5601에서 view를 만든다.
SQL> create view younkim_v
2 as select translate(rawtohex(name),'ABCDEF',':;<=>?') as name from
younkim
3 ;
View created.
이를 조회하면 다음과 같다.
SQL> select * from younkim_v;
NAME
;1>8<0>7;?:<
;1>8<0;:;?;5
<0<<;;?3<7>5
4144414=53
53434?5454
4:414=4553
<0<<;;?3<7>532
746573743132<0=3
3330<7<?<7<?
73636?7474;5;?;;?=
10 rows selected.
b. US7ASCII에서도 view를 만들어서 한글 data를 query한다.
create view younkim_usv
as select chr(((ascii(substr(name,1,1)) - 48 )* 16) +
(ascii(substr(name,2,1)) - 48 )) ||
chr( ((ascii(substr(name,3,1)) - 48 )* 16) +
(ascii(substr(name,4,1)) - 48 )) ||
chr( ((ascii(substr(name,5,1)) - 48 )* 16) +
(ascii(substr(name,6,1)) - 48 )) ||
chr( ((ascii(substr(name,7,1)) - 48 )* 16) +
(ascii(substr(name,8,1)) - 48 )) ||
chr( ((ascii(substr(name,9,1)) - 48 )* 16) +
(ascii(substr(name,10,1)) - 48 )) ||
chr( ((ascii(substr(name,11,1)) - 48 )* 16) +
(ascii(substr(name,12,1)) - 48 )) ||
chr( ((ascii(substr(name,13,1)) - 48 )* 16) +
(ascii(substr(name,14,1)) - 48 )) ||
chr( ((ascii(substr(name,15,1)) - 48 )* 16) +
(ascii(substr(name,16,1)) - 48 )) ||
chr( ((ascii(substr(name,17,1)) - 48 )* 16) +
(ascii(substr(name,18,1)) - 48 )) ||
chr( ((ascii(substr(name,19,1)) - 48 )* 16) +
(ascii(substr(name,20,1)) - 48 )) name
from younkim_v@ko, dual
SQL> select * from younkim_usv;
NAME
김재연
김은영
이상헌
ADAMS
SCOTT
JAMES
이상헌2
test12임
30하하
scott동생
10 rows selected.
2) KO16KSC560에서 US7ASCII에 있는 data조회 방법
a. US7ASCII에서 view를 만든다.
create view younkim2_v
as SELECT translate(rawtohex(name),'ABCDEF',':;<=>?') as name FROM
younkim2;
b. KO16KSC560에서 다음과 같이 function을 만들어서 이를 통한 조회를
한다.
한글을 제외하고 한 문자의 ascii code에 대한 hexadecimal값은 00 ~ 7f범위
안에 있으며 view를 통해 생성된 값은 맨 앞의 값이 7보다 크다면 이는 한글이므로 아래와 같이 7보다 큰 ascii code값으로 비교한다.
위의 data를 예로 들어 '김재연'의 경우 ';1>8<0>7;?:<'값으로 미리 view에
만들었으며 '김'에 대한 값은 ';1>8'으로 지정되어 있으며 다음 문자인 '재'를 읽으려면 4번째 다음부터 읽어야 한다.
하지만 영문 data인 'ADAMS'의 경우는 '4144414=53'이며 'A'에 대한 값은
'41'이며 다음 값은 2번째 다음부터 읽어야 한다.
한 문자에 대해 한글이냐 영문, 숫자냐에 따라서 읽고 계산 방법을 다음과
같이 다르게 한다.
create or replace function conv(name varchar2) return varchar2
as
i integer;
kscstring varchar2(100);
begin
i := 1;
kscstring := '';
WHILE i <= lengthb(name) LOOP
IF(ascii(substr(name,i,1)) > ascii('7')) THEN
kscstring := kscstring || chr( ( (ascii(substr(name,i,1)) - 48)*16 +
(ascii(substr(name,i+1,1)) - 48) )*256 + (ascii(substr(name,i+2,1)) -
48)*16 + (ascii(substr(name,i+3,1)) - 48) );
i := i + 4;
ELSE
kscstring := kscstring || chr( (ascii(substr(name,i,1)) - 48)*16 +
(ascii(substr(name,i+1,1)) - 48) );
i := i + 2;
END IF;
END LOOP;
return kscstring;
end;
SQL> select conv(name) from younkim2_v@us;
CONV(NAME)
김재연
김은영
이상헌
ADAMS
SCOTT
JAMES
이상헌2
test12임
30하하
scott동생
10 rows selected. -
Error upon ResolveCallbackMessage class for Failed to handle dispatch msg
Hello,
I'm using Oracle BPEL Manager on Windows XP,
the version of Eclipse is 3.0.0, build id 200406111814,
and j2sdk1.4.2_04.
I have deployed from the Developer Prompt the Seller and the Buyer processes, and from the Oracle BPEL console started 3 instances for the Buyer with values for the CID and Order respectively: 1,1; 2,2; 3,3.
After several seconds, I had 3 instances for the Seller with state 'completed' and 3 instances for the Buyer with state 'running'.
At the same time, appeared 3 error messages on the Start BPEL Process Manager Console with the same content:
<ERROR> <default.collaxa.cube.engine.dispatch> <BaseScheduledWorker::process> Failed to handle dispatch message ... exception Message handle error.
An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.delivery.ResolveCallbackMessage"; the exception is: Transaction was rolled back: java.lang.ClassCastException; nested exception is: java.lang.ClassCastException
These processes use correltation defined and it seems the the Oracle BPEL Server does not recognize when there is more then 1 running instances and is received message, to which instances to apply it according to the correlation property.
Need help if there is something else to be configured this to work,
Thank you in advance,
Best RegardsHi,
I've tested the Seller and buyer Samples by reproducing the upper situation - several running instance of Buyer process,
and everything works fine - no errors.
But, the situation if I'm using a new created process leads to the same error.
Here what I'm doing:
Process test1: (async. oracle bpel process)
=============================================
The test1.bpel file is:
<!-- test1 BPEL Process [Generated by the Oracle BPEL Designer] -->
<process name="test1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:cor="http://acm.org/samples" targetNamespace="http://acm.org/samples" suppressJoinFailure="yes" xmlns:tns="http://acm.org/samples" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension">
<partnerLinks>
<partnerLink name="client" partnerLinkType="tns:test1" myRole="testProvider" partnerRole="testRequester"/>
</partnerLinks>
<variables>
<variable name="input" messageType="tns:Order1RequestMessage"/>
<variable name="output" messageType="tns:echoResponseMessage"/>
<variable name="DeliveryS" messageType="tns:DeliveryRequestMessage"/>
<variable name="result" type="xsd:string"/>
</variables>
<correlationSets>
<correlationSet name="id123" properties="tns:id123"/>
</correlationSets>
<sequence name="main">
<receive name="receiveInput" partnerLink="client" portType="tns:test1" operation="order123" variable="input" createInstance="yes">
<correlations>
<correlation set="id123" initiate="yes"/>
</correlations>
</receive>
<assign>
<copy>
<from variable="input" part="payload" query="//onInitate123/rumiBegin"/>
<to variable="result"/>
</copy>
</assign>
<receive name="getDelivery" partnerLink="client" portType="tns:test1" operation="dlv" variable="DeliveryS" createInstance="no">
<correlations>
<correlation set="id123" initiate="no"/>
</correlations>
</receive>
<assign>
<copy>
<from variable="DeliveryS" part="payload" query="//onDelivery123/rumiEnd"/>
<to variable="result"/>
</copy>
</assign>
<invoke name="callbackClient" partnerLink="client" portType="tns:testCallback" operation="onResult" inputVariable="output"/>
</sequence>
</process>
==============================================
The test1.wsdl file is:
<?xml version="1.0"?>
<definitions name="test1"
targetNamespace="http://acm.org/samples"
xmlns:tns="http://acm.org/samples"
xmlns:plnk="http://schemas.xmlsoap.org/ws/2003/05/partner-link/"
xmlns="http://schemas.xmlsoap.org/wsdl/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/"
>
<types>
<schema attributeFormDefault="qualified"
elementFormDefault="qualified"
targetNamespace="http://acm.org/samples"
xmlns="http://www.w3.org/2001/XMLSchema"
>
<element name="onInitate123" type="tns:Order" />
<complexType name="Order">
<sequence>
<element name="rumiBegin" type="string" />
</sequence>
</complexType>
<element name="onDelivery123" type="tns:Delivery" />
<complexType name="Delivery">
<sequence>
<element name="rumiEnd" type="string" />
</sequence>
</complexType>
<element name="echoResponse">
<complexType>
<sequence>
<element name="result" type="string"/>
</sequence>
</complexType>
</element>
</schema>
</types>
<message name="Order1RequestMessage">
<part name="payload" element="tns:onInitate123"/>
</message>
<message name="Order1ResponseMessage">
<part name="payload" element="tns:echoResponse"/>
</message>
<message name="DeliveryRequestMessage">
<part name="payload" element="tns:onDelivery123"/>
</message>
<message name="DeliveryResponseMessage">
<part name="payload" element="tns:echoResponse"/>
</message>
<message name="echoResponseMessage">
<part name="payload" element="tns:echoResponse"/>
</message>
<portType name="test1">
<operation name="order123">
<input message="tns:Order1RequestMessage"/>
</operation>
<operation name="dlv">
<input message="tns:DeliveryRequestMessage"/>
</operation>
</portType>
<portType name="testCallback">
<operation name="onResult">
<input message="tns:echoResponseMessage"/>
</operation>
</portType>
<plnk:partnerLinkType name="test1">
<plnk:role name="testProvider">
<plnk:portType name="tns:test1"/>
</plnk:role>
<plnk:role name="testRequester">
<plnk:portType name="tns:testCallback"/>
</plnk:role>
</plnk:partnerLinkType>
<bpws:property name="id123" type="xsd:string"/>
<bpws:propertyAlias propertyName="tns:id123"
messageType="tns:Order1RequestMessage" part="payload"
query="/onInitate123/rumiBegin"/>
<bpws:propertyAlias propertyName="tns:id123"
messageType="tns:DeliveryRequestMessage" part="payload"
query="/onDelivery123/rumiEnd"/>
</definitions>
================================================
From a different SOAP Server I'm sending message for the operation 'order123' to the Oracle Server
using as endpoint location http://leon:9700/orabpel/default/test1
and the message looks like this:
(the value for the correlation is 101)
<SOAP:Envelope
SOAP:encodingType='http://schemas.xmlsoap.org/soap/encoding/'
SOAP:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ref="http://schemas.xmlsoap.org/ws/2002/04/reference/"
xmlns:dt='urn:schemas-microsoft-com:datatypes'><SOAP:Body>
<order123><onInitate123><rumiBegin>101</rumiBegin></onInitate123></order123></SOAP:Body>
</SOAP:Envelope>
As a result there is an instance with state running for the process test1 on the Oracle BPEL Console.
After this, I'm sending again from the same SOAP Server message for the operation 'dlv' like this:
(the value for the correlation is 101)
<SOAP:Envelope
SOAP:encodingType='http://schemas.xmlsoap.org/soap/encoding/'
SOAP:encodingStyle='http://schemas.xmlsoap.org/soap/encoding/'
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:SOAP="http://schemas.xmlsoap.org/soap/envelope/"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:ref="http://schemas.xmlsoap.org/ws/2002/04/reference/"
xmlns:dt='urn:schemas-microsoft-com:datatypes'><SOAP:Body>
<dlv><onDelivery123><rumiEnd>101</rumiEnd></onDelivery123></dlv></SOAP:Body></SOAP:Env
elope>
AS a result the instance created before continues to have state 'running' (which is supposed to be 'completed' as by using the same correlation value)
and the error is given on the Oracle BPEL Server Console:
<2004-08-24 14:56:02,200> <ERROR> <default.collaxa.cube.engine.dispatch> <BaseScheduledWorker::process>
Failed to handle dispatch message ... exception Message handle error.
An exception occurred while attempting to process the message "com.collaxa.cube.engine.dispatch.message.delivery.ResolveCallbackMessage";
the exception is: Transaction was rolled back: java.lang.ClassCastException; nested exception is: java.lang.ClassCastException -
Writing chinese character into a file
Hi,
I need to write chinese characters into a file,I used FileOutputStream, using the method write(byte[] b)...
whereby I will convert the chinese word into bytes....
but it couldn't work...
Please Help!!you can write the unicode hex string (e.g. 606D559C53D18D22 for Gong Xi Fa Chai) into a text file by using the following code
PrintWriter out2 = new PrintWriter(new BufferedWriter(new OutputStreamWriter(new FileOutputStream("chinese_out.txt", false), "UTF-8")));
int countChineseChar = chineseHex.length()/4;
int index = 0;
String c = "";
int b;
for(int i=0; i<countChineseChar-1; i++)
c = new String(chineseHex.substring(index, index+4));
b = Integer.parseInt(c, 16);
out2.write(b);
index+=4;
Note that the OutputStreamWriter uses the UTF-8 to encode the unicode hex. I'm assuming that the hex is fixed at 4 digits each character
syam
Maybe you are looking for
-
How does one get an iPod nano to turn on other than the "normal" way? This one has been dropped and all I can get is a blank screen. I have tried holding down the HOME button to restart it but no go. When I connect it to my computer, I am told to ent
-
Java.io.File and output.write to newly created file
I'm using output.write(""); in conjunction with java.io.File to create a file with field data from a form submit. The file gets created and includes anything I add between the quotes rather then searching for it's value. My question is what is the sy
-
H: not found when insert the card of flash drive for auto import In Lightroom CC
when i try to auto import Inside Lightroom 6 or CC getting an error "H: not found" as soon as i plug the memory card or any flash drive to the computer. i'm using lightroom CC win 7 64 bit
-
Cannot load a RAW file from Nikon D7200 into Elements 9!
trying to open a RAW (NEF) file from my Nikon D7200 into Elements 9 (version 9.0.3) and I get the message that "cannot open because it is the wrong type of file". Can some one help me? I have the RAW 6.5 plug-in installed
-
Returning Date in a Cursor.
I have a SQL select which will get 'dates' stored in table (field defined as 'date' in table). Which one is a valid statement below? Select TO_DATE(start_date, 'MM/DD/YYYY') from table; Or Select TO_DATE(TO_CHAR(start_date,'MM/DD/YYYY'), 'MM/DD/YYYY'