ERROR WITH XMLDOM.WRITETOCLOB
Hi,
I have written the following procedure...............
procedure Prc_UpdateNodes(clString in out clob, nodename varchar2, nodeValue varchar2) is
l_doc_node xmldom.DOMNode;
l_xml_out varchar2(2000);
begin
domDocument := Fn_GetXmlDocument(clString);
nodeList := xmldom.getElementsByTagName(domDocument, nodename);
intNoOfNode := xmldom.getLength(nodeList);
l_doc_node := xmldom.item(nodeList, 0);
for loopCount_int in 0.. intNoOfNode - 1 loop
node := XmlDom.item(nodeList, loopCount_int);
valueNode := XmlDom.getFirstChild(node);
XmlDom.setNodeValue(valueNode,nodeValue);
end loop;
XmlDom.writeToClob(domDocument,clString);
end;
This below XML Is passed as the first parameter
The output after this operation for an xml should be..
<ROWSET>
<ROW>
<SITE_NO Key="Yes">1</SITE_NO>
<PARAMETER_VALUE_NO Key="Yes">0</PARAMETER_VALUE_NO>
<PARENT_PARAMETER_SPEC_NO>0</PARENT_PARAMETER_SPEC_NO>
<PARAMETER_SPEC_NO>1</PARAMETER_SPEC_NO>
<REF_TABLE_KEY_NO>0</REF_TABLE_KEY_NO>
<REF_TABLE_KEY_TYPE>S</REF_TABLE_KEY_TYPE>
<SEQ_NO>1</SEQ_NO>
<SUB_SEQN_NO>0</SUB_SEQN_NO>
<DATA_TYPE_NO>1</DATA_TYPE_NO>
<INTEGER_VALUE>0</INTEGER_VALUE>
<STRING_VALUE>00039</STRING_VALUE>
<NUMERIC_VALUE>0</NUMERIC_VALUE>
<DATE_VALUE>01/01/1600</DATE_VALUE>
<CREATED_ON>0</CREATED_ON>
<MODIFIED_ON>0</MODIFIED_ON></ROW>
<ROW>
<SITE_NO Key="Yes">1</SITE_NO>
<PARAMETER_VALUE_NO Key="Yes">0</PARAMETER_VALUE_NO>
<PARENT_PARAMETER_SPEC_NO>0</PARENT_PARAMETER_SPEC_NO>
<PARAMETER_SPEC_NO>2</PARAMETER_SPEC_NO>
<REF_TABLE_KEY_NO>0</REF_TABLE_KEY_NO>
<REF_TABLE_KEY_TYPE>S</REF_TABLE_KEY_TYPE>
<SEQ_NO>2</SEQ_NO><SUB_SEQN_NO>0</SUB_SEQN_NO>
<DATA_TYPE_NO>2</DATA_TYPE_NO>
<INTEGER_VALUE>0</INTEGER_VALUE>
<STRING_VALUE/>
<NUMERIC_VALUE>0</NUMERIC_VALUE>
<DATE_VALUE/>
<CREATED_ON>0</CREATED_ON>
<MODIFIED_ON>0</MODIFIED_ON>
</ROW>
</ROWSET>
But the output I get is ……….
<ROWSET>
<ROW>
<SITE_NO Key="Yes">1</SITE_NO>
<PARAMETER_VALUE_NO Key="Yes">0</PARAMETER_VALUE_NO>
<PARENT_PARAMETER_SPEC_NO>0</PARENT_PARAMETER_SPEC_NO>
<PARAMETER_SPEC_NO>1</PARAMETER_SPEC_NO>
<REF_TABLE_KEY_NO>0</REF_TABLE_KEY_NO>
<REF_TABLE_KEY_TYPE>S</REF_TABLE_KEY_TYPE>
<SEQ_NO>1</SEQ_NO>
<SUB_SEQN_NO>0</SUB_SEQN_NO>
<DATA_TYPE_NO>1</DATA_TYPE_NO>
<INTEGER_VALUE>0</INTEGER_VALUE>
<STRING_VALUE>00039</STRING_VALUE>
<NUMERIC_VALUE>0</NUMERIC_VALUE>
<DATE_VALUE>01/01/1600</DATE_VALUE>
<CREATED_ON>0</CREATED_ON>
<MODIFIED_ON>0</MODIFIED_ON></ROW>
<ROW>
<SITE_NO Key="Yes">1</SITE_NO>
<PARAMETER_VALUE_NO Key="Yes">0</PARAMETER_VALUE_NO>
<PARENT_PARAMETER_SPEC_NO>0</PARENT_PARAMETER_SPEC_NO>
<PARAMETER_SPEC_NO>2</PARAMETER_SPEC_NO>
<REF_TABLE_KEY_NO>0</REF_TABLE_KEY_NO>
<REF_TABLE_KEY_TYPE>S</REF_TABLE_KEY_TYPE>
<SEQ_NO>2</SEQ_NO><SUB_SEQN_NO>0</SUB_SEQN_NO>
<DATA_TYPE_NO>2</DATA_TYPE_NO>
<INTEGER_VALUE>0</INTEGER_VALUE>
<STRING_VALUE/>
<NUMERIC_VALUE>0</NUMERIC_VALUE>
<DATE_VALUE/>
<CREATED_ON>0</CREATED_ON>
<MODIFIED_ON>0</MODIFIED_ON>
</ROW>
</ROWSET>
0</MODIFIED_ON>
</ROW>
</ROWSET>
The letter in bold above are the newly introduced junk letters
I think this problem is due to the buffer isssues………….
Do we have any solution for clearing the buffer….
Also this error doesnt occur all the time.........
Sometimes it comes, Sometimes it works fine
The error is introduced during execution of the statement
XmlDom.writeToClob(domDocument,clString);
Can anyone help me on this front?????
Thanks
Message was edited by:
user609257
Thx for your response
the program looks like this:
I executed it from a Form;
PROCEDURE PRUEBA IS
xml clob;
vxml varchar2(100);
len integer := 1;
pos integer := 1;
f utl_file.file_type;
doc xmldom.DOMDocument;
ppal_node xmldom.DOMNode;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
user_node xmldom.DOMNode;
tercer_node xmldom.DOMNode;
item_node xmldom.DOMNode;
ppal_elmt xmldom.DOMElement;
root_elmt xmldom.DOMElement;
item_elmt xmldom.DOMElement;
item_text xmldom.DOMText;
--Elementos de la cabecera
header_pi xmldom.DOMProcessingInstruction;
header_node xmldom.DOMNode;
CURSOR MODULOS IS
SELECT T_COAPI AS COAPI,
T_DNAPI AS DNAPI
FROM T
WHERE T_COAPI = 'PES';
BEGIN
--Creamos un nuevo DOM document
doc := xmldom.newDOMDocument();
ppal_node := xmldom.makeNode(doc);
FOR Modulo IN Modulos LOOP
-- El nodo es cada modulo
root_elmt := xmldom.createElement(doc, 'Modulo');
root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
--COAPI
item_elmt := xmldom.createElement(doc, lit_COAPI);
item_node := xmldom.appendChild(root_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, Modulo.COAPI);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
--DNAPI
item_elmt := xmldom.createElement(doc, lit_DNAPI);
item_node := xmldom.appendChild(root_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, Modulo.DNAPI);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
END LOOP
f := utl_file.fopen('TEMP_DIR','PRUEBA.xml','w');
--Obtenemos la longitud del xml lob
len := dbms_lob.getlength(xml);
DBMS_LOB.CreateTemporary(xml,TRUE);
xmldom.writeToClob(doc,xml); -- HERE I GET THE ERROR
dbms_xmldom.WriteToFile(f,xml);
WHILE (pos < len) LOOP
vxml := dbms_lob.substr(xml,100,pos);
utl_file.put(f,vxml);
pos := pos+100;
END LOOP;
utl_file.fclose(f);
END;
Similar Messages
-
Potential problem with XMLDOM.writeToClob()
I'm really hoping that someone can help me with this. Last fall, wrote some code that used XMLDOM to build a document and send it to a web service. I remember having problems with WriteToBuffer and WriteToClob during my development efforts, which I thought were successfully resolved. Now it looks like the problem may be occurring at a client who recently upgraded to use this code. I can't get this to fail in-house, so I can't do much debugging on it. So I'm hoping that someone else has come across a problem like this and remembers what they did to fix it.
Basically, what happened was, WriteToClob (or sometimes WriteTuBuffer) didn't return anything, even though the DOM document was not empty. I remember going back and forth between WriteToBuffer and WriteToClob, trying to get it resolved. But I don't remember specifically finding any "magic bullet". Here's what I currently have in the code:
DBMS_LOB.createtemporary (v_source_data, TRUE);
DBMS_LOB.OPEN (v_source_data, DBMS_LOB.lob_readwrite);
xmldom.writetoclob (v_main_doc, v_source_data);
DBMS_LOB.CLOSE (v_source_data);
Has anyone had a similar problem, and remember what the fix was? I'm also not sure that the Open/Close calls are necessary. Or what TRUE means on CreateTemporary (aside from some generic comment about "buffer cache" without telling me what a buffer cache is).I'm really hoping that someone can help me with this. Last fall, wrote some code that used XMLDOM to build a document and send it to a web service. I remember having problems with WriteToBuffer and WriteToClob during my development efforts, which I thought were successfully resolved. Now it looks like the problem may be occurring at a client who recently upgraded to use this code. I can't get this to fail in-house, so I can't do much debugging on it. So I'm hoping that someone else has come across a problem like this and remembers what they did to fix it.
Basically, what happened was, WriteToClob (or sometimes WriteTuBuffer) didn't return anything, even though the DOM document was not empty. I remember going back and forth between WriteToBuffer and WriteToClob, trying to get it resolved. But I don't remember specifically finding any "magic bullet". Here's what I currently have in the code:
DBMS_LOB.createtemporary (v_source_data, TRUE);
DBMS_LOB.OPEN (v_source_data, DBMS_LOB.lob_readwrite);
xmldom.writetoclob (v_main_doc, v_source_data);
DBMS_LOB.CLOSE (v_source_data);
Has anyone had a similar problem, and remember what the fix was? I'm also not sure that the Open/Close calls are necessary. Or what TRUE means on CreateTemporary (aside from some generic comment about "buffer cache" without telling me what a buffer cache is). -
Xmldom.writeToClob error. [URGENT]
Any idea why I get the following error when I call:
xmldom.writeToClob(root, xml_out);
ORA-20000: An internal error has occurred: CLOB to write to can not be null ORA-06512: at "XML.XMLDOM", line 37 ORA-06512: at "XML.XMLDOM", line 358 ORA-06512: at line 131
'xml_out' is initialised with null, but 'root' have some nodes and elements, but no text nodes. I do not get this error if I use
xmldom.writeToBuffer(root, v_xml);
Thanks
nullThx for your response
the program looks like this:
I executed it from a Form;
PROCEDURE PRUEBA IS
xml clob;
vxml varchar2(100);
len integer := 1;
pos integer := 1;
f utl_file.file_type;
doc xmldom.DOMDocument;
ppal_node xmldom.DOMNode;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
user_node xmldom.DOMNode;
tercer_node xmldom.DOMNode;
item_node xmldom.DOMNode;
ppal_elmt xmldom.DOMElement;
root_elmt xmldom.DOMElement;
item_elmt xmldom.DOMElement;
item_text xmldom.DOMText;
--Elementos de la cabecera
header_pi xmldom.DOMProcessingInstruction;
header_node xmldom.DOMNode;
CURSOR MODULOS IS
SELECT T_COAPI AS COAPI,
T_DNAPI AS DNAPI
FROM T
WHERE T_COAPI = 'PES';
BEGIN
--Creamos un nuevo DOM document
doc := xmldom.newDOMDocument();
ppal_node := xmldom.makeNode(doc);
FOR Modulo IN Modulos LOOP
-- El nodo es cada modulo
root_elmt := xmldom.createElement(doc, 'Modulo');
root_node := xmldom.appendChild(main_node, xmldom.makeNode(root_elmt));
--COAPI
item_elmt := xmldom.createElement(doc, lit_COAPI);
item_node := xmldom.appendChild(root_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, Modulo.COAPI);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
--DNAPI
item_elmt := xmldom.createElement(doc, lit_DNAPI);
item_node := xmldom.appendChild(root_node, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, Modulo.DNAPI);
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
END LOOP
f := utl_file.fopen('TEMP_DIR','PRUEBA.xml','w');
--Obtenemos la longitud del xml lob
len := dbms_lob.getlength(xml);
DBMS_LOB.CreateTemporary(xml,TRUE);
xmldom.writeToClob(doc,xml); -- HERE I GET THE ERROR
dbms_xmldom.WriteToFile(f,xml);
WHILE (pos < len) LOOP
vxml := dbms_lob.substr(xml,100,pos);
utl_file.put(f,vxml);
pos := pos+100;
END LOOP;
utl_file.fclose(f);
END; -
Error While Writing DOM to a CLOB i.e. xmldom.writeToClob
I am running into error while writng and reading from a clob. The Sample Code is as follows :
declare
p xmlparser.Parser;
doc xmldom.DOMDocument;
i_tmp CLOB;
i_tmp1 CLOB;
i_buffer varchar2(32767);
i_amount pls_integer;
begin
p := xmlParser.NewParser;
xmlparser.setbaseDir(p,'/sqlcom/inbound');
xmlparser.setValidationMode(p, TRUE);
xmlparser.showwarnings(p, TRUE);
xmlparser.seterrorlog(p, '/sqlcom/inbound/veshaal.err');
xmlparser.parse(p,'/sqlcom/inbound/mpoi.xml');
doc := xmlparser.getDocument(p);
dbms_lob.createtemporary(i_tmp1,true,dbms_lob.session);
xmldom.writeToClob(doc,i_tmp1);
xmldom.writeToFile(doc,'/sqlcom/inbound/veshaal_out.xml');
dbms_lob.createtemporary(i_tmp,true,dbms_lob.session);
xmldom.writeTobuffer(doc,i_buffer);
dbms_lob.write(i_tmp,length(i_buffer),1,i_buffer);
i_amount := dbms_lob.getLength(i_tmp);
dbms_lob.read(i_tmp,i_amount,1,i_buffer);
dbms_lob.freetemporary(i_tmp1);
commit;
exception
when others then
dbms_lob.freetemporary(i_tmp1);
dbms_output.put_line(SQLERRM);
end;
The oracle Error is as follows:
declare
ERROR at line 1:
ORA-03113: end-of-file on communication channel
ORA-24323: value not allowed
Error accessing package DBMS_APPLICATION_INFO
ERROR:
ORA-03114: not connected to ORACLE
The above code works while I try to write to a buffer or a file using xmldom.writeToFile or xmldom.writeToBuffer.
The xmlparser v2 is running inside the 8i ( 8.1.5.0. ) database.
The alert file has the following entry :
Errors in file /home/applrt/db/superbwl/log/superbwl_ora_2371.trc:
ORA-07445: exception encountered: core dump [EE1F05DC] [SIGSEGV] [Address not mapped to object] [0] [] []
Any help will be appreciated.
Thanks
nullUTL_FILE comes as part of the database, you shouldn't have to install it, and you most certainly shouldn't install it as SCOTT. System packages should be installed using a system user such as sys.
Firstly, I would suggest dropping the UTL_FILE package from your scott schema and then logging on as sys and granting execute permission on UTL_FILE to the scott user.
Secondly...
The UTL_FILE_DIR parameter has been deprecated by oracle in favour of direcory objects because of it's security problems.
The correct thing to do is to create a directory object e.g.:
CREATE OR REPLACE DIRECTORY mydir AS 'c:\myfiles';Note: This does not create the directory on the file system. You have to do that yourself and ensure that oracle has permission to read/write to that file system directory.
Then, grant permission to the users who require access e.g....
GRANT READ,WRITE ON DIRECTORY mydir TO myuser;Then use that directory object inside your FOPEN statement e.g.
fh := UTL_FILE.FOPEN('MYDIR', 'myfile.txt', 'r');Note: You MUST specify the directory object name in quotes and in UPPER case for this to work as it is a string that is referring to a database object name which will have been stored in uppercase by default. -
Problem with special characters and xmldom.writetoclob
Hi!
I have a problem with oracle parser in pl/sql.
My situation:
i have a clob with valid xml with for example decoded characters:
(spaces between & and # are for good representing characters by browser - in really there is no spaces)
<xml>
<any><![CDATA[ & #187; ]]> text <![CDATA[ & #187; ]]></any>
</xml>
i read this xml from clob, parse it and put into another clob by using
xmldom.writetoclob procedure.
And in second clob i have"
<xml>
<any>& #38;#187; text & #38;#187; </any>
</xml>
(ampersand is representing as & #38; !) Why there is not the cdata sections ?
Why the value of these sections changed?
Any ideas? I'm using newset xdk (9202) in 8.1.7.3 database.
Please help!Hi John,
According to your description, my understanding is that the Author showed incorrect character in SharePoint 2013 search result page.
I tested the same scenario per your post in my environment, and the Müller showed correctly in SharePoint search result page.
I recommend to reset the index in Search Service Application and run a full crawl to see if the issue still occurs.
Best regards.
Thanks
Victoria Xia
TechNet Community Support -
Xmldom.writetoclob hanging forever when writing a domnode to a temp clob
Hi
Wondering has anyone come across anything similar (or know a work around)
1. Basically the the procedure below loads an XML file. (OK)
2. Removes reference to external dtd, ref was causing and error (OK)
3. Parses the XML (OK)
4. Gets a list of the "item" tags (OK) - should be up to 500 item elements in XML
5. Loops on all elements
a. writes node to temp clob *(PROBLEM HERE)*
b. Creates xmltype from clob (OK)
c. transforms xmltype and assigns to another xmltype (OK)
d. inserts new xmltype (OK)
This procedure is used by a threaded os java app to load thousands of files to db.
It works fine 99% of the time but for some files the procedure is hanging at (5.a : write domnode to clob using xmldom.writetoclob)
I am absolutely sure the problem is due to the characters in the domnode as all files that have hung on processing contain these bizarre characters,
the db character set is Unicode AL32UTF8 so it should be able to handle almost anything, saying that, if the it is a prob with the characters then why does
the loadclobfromfile procedure succeed.
Developed on Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit
I have no prob rejecting node and continue processing but procedure just hangs and i have to kill the thread on the os.
Is there a way to
1. Test for invalid AL32UTF8 chars and skip on error.
or
2. Get around the xmldom.writetoclob procedure and create an xmltype from the xmldom.domnode (i tried to convert domnode -> domdocument -> xmltype, no joy)
or
Open to suggestions
PROCEDURE
PROCEDURE process_blog_xml_file (
p_file_name IN VARCHAR2,
p_insert_date IN VARCHAR2,
p_dir IN VARCHAR2 DEFAULT NULL
IS
newsurl VARCHAR2 (80);
parser xmlparser.parser;
newsxml xmldom.domdocument;
titles xmldom.domnodelist;
titles_found NUMBER;
curnode xmldom.domnode;
textchild xmldom.domnode;
dest_clob CLOB;
l_temp_clob CLOB;
src_clob BFILE := BFILENAME (g_zip_file_dir, p_file_name);
dst_offset NUMBER := 1;
src_offset NUMBER := 1;
lang_ctx NUMBER := DBMS_LOB.default_lang_ctx;
warning NUMBER;
l_xml XMLTYPE;
xsldata XMLTYPE;
xmldata XMLTYPE;
l_dir VARCHAR2 (1000);
BEGIN
LOG ( 'Start Processing file '
|| p_file_name
|| ' from zip '
|| p_insert_date
IF p_dir IS NULL
THEN
SELECT directory_path
INTO l_dir
FROM all_directories
WHERE directory_name = g_zip_file_dir;
ELSE
l_dir := p_dir;
END IF;
IF g_xsl_clob IS NULL
THEN
init_xsl_clob;
END IF;
com_polecat_xmldb_utils.set_load_date
(TO_DATE (REPLACE (REPLACE (p_insert_date,
'.zip',
'DD-MM-YYYY'
LOG ('ITEM.Loaddate set : ' || com_polecat_xmldb_utils.get_load_date);
xsldata := XMLTYPE.createxml (g_xsl_clob);
LOG ('Read xsl file to clob');
DBMS_LOB.OPEN (src_clob, DBMS_LOB.lob_readonly);
DBMS_LOB.createtemporary (dest_clob, TRUE);
DBMS_LOB.loadclobfromfile (dest_lob => dest_clob,
src_bfile => src_clob,
amount => DBMS_LOB.getlength
(src_clob),
dest_offset => dst_offset,
src_offset => src_offset,
bfile_csid => NLS_CHARSET_ID
('AL32UTF8'),
lang_context => lang_ctx,
warning => warning
LOG ('Read xml file to clob');
DBMS_LOB.CLOSE (src_clob);
parser := xmlparser.newparser;
dest_clob := REPLACE (dest_clob, g_blog_dtd_remove, '');
LOG ('Parse xml ');
xmlparser.parseclob (parser, dest_clob);
DBMS_LOB.freetemporary (dest_clob);
newsxml := xmlparser.getdocument (parser);
xmlparser.freeparser (parser);
titles := xmldom.getelementsbytagname (newsxml, 'item');
LOG ('Load blogs items to ITEM table. ');
FOR j IN 1 .. xmldom.getlength (titles)
LOOP
curnode := xmldom.item (titles, j - 1);
DBMS_LOB.freetemporary (l_temp_clob);
DBMS_LOB.createtemporary (l_temp_clob, TRUE);
LOG ('write node to temp clob ' || j);
xmldom.writetoclob (curnode, l_temp_clob); <-- Hanging Here
LOG ('create xml type from clob ' || j);
l_xml := XMLTYPE.createxml (l_temp_clob);
LOG ('apply xsl transform to xml ' || j);
xmldata := l_xml.transform (xsldata);
LOG ('Insert to item table ' || j);
BEGIN
INSERT INTO item
VALUES (xmldata);
EXCEPTION
WHEN OTHERS
THEN
LOG ('Error:: ' || SQLERRM);
END;
END LOOP;
xmldom.freedocument (newsxml);
LOG ( 'Finished Processing file '
|| p_file_name
|| ' from zip '
|| p_insert_date
EXCEPTION
WHEN OTHERS
THEN
LOG (SQLERRM);
END;note variables starting with g_ are defined in package spec
Cheers
Ian
Edited by: user3604054 on 01-Apr-2010 06:52
Edited by: user3604054 on 01-Apr-2010 14:57
Edited by: user3604054 on 01-Apr-2010 15:00
Edited by: user3604054 on 01-Apr-2010 15:00
Edited by: user3604054 on 01-Apr-2010 15:05
Edited by: user3604054 on 01-Apr-2010 15:062. Get around the xmldom.writetoclob procedure and create an xmltype from the xmldom.domnode (i tried to convert domnode -> domdocument -> xmltype, no joy) Which version of Oracle (4 digits)?
Also look in the FAQ in the upper right for how to use the tag to wrap PL/SQL to retain formatting to make it easier for all to read. -
To : Oracle Team.. xmldom.writetoclob is too slow
HI;
I had Oracle 8.1.6, Used the xmldom package a lot to manipulate and create xml documents ( all sizes ). then I used xmldom.writetoclob which it was giving a GREAT performance.
I UPGRADED ti Oracle 8.1.7 and xmldom.writetoclob is TOO SLOW now, I have the same settings ( java_pool_size, share_pool, etc)
What changed from 8.1.6 to 8.1.7 ??
Why xmldom.writetoclob is so much slower in 8.1.7 ??
when tranfering a 300 KB document with 8.1.6 it used to take 30 seconds, no with 8.1.7 IT TAKES 2-1/2 minutes ?????
WHY ? ? ? ? ?
Tahnks for any information..My guess is that you are creating a clob with cached set to false
e.g
dbms_lob.createtemporary(v_myclob,false);
When set to false any time the clob is written to the characters are written to the disk. causing it to be slow.
try
dbms_lob.createtemporary(v_myclob,true);
I had the same problem. This speeds it up significantly
Rick Laird -
Xmldom.writetoclob give wrong character set
I use xmldom to create a xml clob. I create document for xml as follow:
doc := xmldom.NewDomDocument;
xmldom.setVersion(doc, '1.0');
xmldom.setStandalone(doc, 'no');
xmldom.setCharSet(doc, 'ISO-8859-1'); -- Should be character set for danish.
Create xml clob as follow:
xmldom.writeToClob(root, out_xml);
Problem: Now is danish 'x, f, e' replace with ??.
When a use 'xmldom.WriteToFile(root, 'd:\test_document');' I get correctly danish 'x, f, e'!
I have seen you can use procedure/function 'SetEncoding', but I can not find this function in my Oracle installation (8.1.7.1.1).The character set you specify via setCharset() procedure is ignored unless you use writeToFile() later.
http://docs.oracle.com/cd/E11882_01/appdev.112/e25788/d_xmldom.htm#CHDCGDDB
Usage Notes
This is used for WRITETOFILE Procedures if not explicitly specified at that time.You can also use something like this :
SQL> set serveroutput on
SQL>
SQL> declare
2
3 export_file clob;
4 prolog clob := '<?xml version="1.0" encoding="UTF-8"?>';
5
6 begin
7
8 select prolog || chr(10) ||
9 xmlserialize(document
10 xmlelement("TextTranslation"
11 , xmlattributes(
12 '1.0' as "version"
13 , 'ja' as "language"
14 , 'DEMOAND' as "module"
15 , 'VC' as "type"
16 )
17 )
18 indent
19 )
20 into export_file
21 from dual ;
22
23 dbms_output.put_line ( export_file );
24
25 end;
26 /
<?xml version="1.0" encoding="UTF-8"?>
<TextTranslation version="1.0" language="ja" module="DEMOAND" type="VC"/>
PL/SQL procedure successfully completed -
Problem with XMLDOM package (Oracle 10.2.0.1.0)
Hi,
I am using the dbms_xmldom package to generate xml files (specific structure).
Below is the code but It produces nothing (dbms_output does not return) :
DECLARE
doc xmldom.DOMDocument;
main_node xmldom.DOMNode;
root_node xmldom.DOMNode;
root_elmt xmldom.DOMElement;
transmissionHeaderNode xmldom.DOMNode;
transmissionHeaderElement xmldom.DOMElement;
item_node xmldom.DOMNode;
item_elmt xmldom.DOMElement;
item_text xmldom.DOMText;
buffer_problem CLOB;
BEGIN
doc := xmldom.newDOMDocument;
main_node := xmldom.makeNode(doc);
xmldom.setversion(doc,'1.0');
root_elmt := xmldom.createElement(doc, 'InvoiceTransmission');
root_node := xmldom.appendChild( main_node, xmldom.makeNode(root_elmt));
transmissionHeaderElement := xmldom.createElement(doc, 'TransmissionHeader');
transmissionHeaderNode := xmldom.appendChild(root_node, xmldom.makeNode(transmissionHeaderElement));
item_elmt := xmldom.createElement(doc, 'TransmissionDateTime');
item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, TO_CHAR(SYSDATE,'DD-MM-YYYY'));
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
item_elmt := xmldom.createElement(doc, 'IssuingOrganiszationID');
item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc,'0258');
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
item_elmt := xmldom.createElement(doc, 'Version');
item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, 'IATA:ISXMLInvoiceV3.0');
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
xmldom.writetobuffer(doc, buffer_problem);
dbms_output.put_line(buffer_problem);
xmldom.freeDocument(doc);
END;
That's strange because when remove a code part like :
item_elmt := xmldom.createElement(doc, 'Version');
item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
item_text := xmldom.createTextNode(doc, 'IATA:ISXMLInvoiceV3.0');
item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
I can get the ouput xml :
<?xml version="1.0"?>
<InvoiceTransmission>
<TransmissionHeader>
<TransmissionDateTime>26-10-2010</TransmissionDateTime>
<IssuingOrganiszationID>0258</IssuingOrganiszationID>
</TransmissionHeader>
</InvoiceTransmission>
I don't if it's a problem with xmldom or with dbms_output package...
Please someone can help me ?Works fine for me
Connected to Oracle Database 10g Enterprise Edition Release 10.2.0.4.0
SQL> set serveroutput on;
SQL>
SQL> DECLARE
2 doc xmldom.DOMDocument;
3 main_node xmldom.DOMNode;
4 root_node xmldom.DOMNode;
5 root_elmt xmldom.DOMElement;
6
7 transmissionHeaderNode xmldom.DOMNode;
8 transmissionHeaderElement xmldom.DOMElement;
9 item_node xmldom.DOMNode;
10 item_elmt xmldom.DOMElement;
11 item_text xmldom.DOMText;
12
13 buffer_problem CLOB;
14
15 BEGIN
16
17 doc := xmldom.newDOMDocument;
18 main_node := xmldom.makeNode(doc);
19 xmldom.setversion(doc,'1.0');
20 root_elmt := xmldom.createElement(doc, 'InvoiceTransmission');
21 root_node := xmldom.appendChild( main_node, xmldom.makeNode(root_elmt));
22
23 transmissionHeaderElement := xmldom.createElement(doc, 'TransmissionHeader');
24 transmissionHeaderNode := xmldom.appendChild(root_node, xmldom.makeNode(transmissionHeaderElement));
25
26 item_elmt := xmldom.createElement(doc, 'TransmissionDateTime');
27 item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
28 item_text := xmldom.createTextNode(doc, TO_CHAR(SYSDATE,'DD-MM-YYYY'));
29 item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
30
31 item_elmt := xmldom.createElement(doc, 'IssuingOrganiszationID');
32 item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
33 item_text := xmldom.createTextNode(doc,'0258');
34 item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
35
36 item_elmt := xmldom.createElement(doc, 'Version');
37 item_node := xmldom.appendChild(transmissionHeaderNode, xmldom.makeNode(item_elmt));
38 item_text := xmldom.createTextNode(doc, 'IATA:ISXMLInvoiceV3.0');
39 item_node := xmldom.appendChild(item_node, xmldom.makeNode(item_text));
40
41 --buffer_problem := 'a'; -- added to initialize clob
42 xmldom.writetobuffer(doc, buffer_problem); -- change to writetoclob
43 dbms_output.put_line(buffer_problem);
44 xmldom.freeDocument(doc);
45
46 END;
47 /
<?xml version="1.0"?>
<InvoiceTransmission>
<TransmissionHeader>
<TransmissionDateTime>26-10-2010</TransmissionDateTime>
<IssuingOrganiszationID>0258</IssuingOrganiszationID>
<Version>IATA:ISXMLInvoiceV3.0</Version>
</TransmissionHeader>
</InvoiceTransmission>Suggestions:
- Use dbms_xmldom instead of just xmldom. Oracle changed the name in the 9i days and xmldom is a synonym to dbms_xmldom.
- Use .writeToClob intead of .writeToBuffer
- I would suggest trying to upgrade to .4 as you pick up a lot of improvements and bug fixes. Whether what you are encountering is a bug I cannot say but would seem so.
- See the FAQ under your sign-in name to learn how to use the tag to format the code like I did above. -
Using xmldom.writetoclob
I am using the procedure xmldom.writetoclob with the PL/SQL
XDK.
I am running into speed concerns.
Below are some results of tests I have done.
As you can see the time taken to write the contents of the
DOM out to a clob can quickly become problem for a user waiting
for a reponse.
Can any one tell me of a way to speed up this process or a
work around?
Thanks very much
Rick Laird
clob size= 2913
start xmldom.writetoclob= 01:57:53
end xmldom.writetoclob= 01:57:54
clob size= 8909
start xmldom.writetoclob= 01:58:06
end xmldom.writetoclob= 01:58:12
clob size= 14905
start xmldom.writetoclob= 01:58:45
end xmldom.writetoclob= 01:58:55
clob size= 22400
start xmldom.writetoclob= 01:59:44
end xmldom.writetoclob= 01:59:59
clob size= 29895
start xmldom.writetoclob= 02:01:09
end xmldom.writetoclob= 02:01:29
clob size= 172300
start xmldom.writetoclob= 02:05:59
end xmldom.writetoclob= 02:07:54
clob size= 286224
start xmldom.writetoclob= 02:15:34
end xmldom.writetoclob= 02:18:42what version of XDK are you using ?
How much memory do you have ?
I am getting this results :
Writting to clob 01/09/2002 9:51:07 AM
Done writting to clob 01/09/2002 9:51:13 AM
Size of clob : 370433 01/09/2002 9:51:13 AM -
Xmldom.writetoClob()
Hi ,
I've some problem saving back my xml document in Clob:
If I performe the procedure
xmldom.writetobuffer(DomDocument,variable_of_output);
the variable_of_output in varchar2 is well valorized.
Instead
If I performe the procedure
xmldom.writetoClob(DomDocument,variable_of_output);
where the variable_of_output is Clob
THE CODE STOP. The problem is present Even if i inizialize variable_of_output:=empty_clob();
Answer my question,Please.
Thanks youHi,
It probably depends on your database version. If your using 9i, you should use dbms_xmldom instead of xmldom. Furthermore, you might consider to use the following code (instead of the empty clob code):
DECLARE
t_doc DBMS_XMLDOM.DOMDocument;
t_clob CLOB;
BEGIN
... do stuff to fill t_doc
DBMS_LOB.createTemporary(t_clob, FALSE);
DBMS_XMLDOM.writeToClob(t_doc, t_clob);
DBMS_XMLDOM.freeDocument(t_doc);
... do stuff with t_clob
DBMS_LOB.freeTemporary(t_clob);
END;
I'm certain that dbms_xmldom replaces xmldom (v9.2+), I only can't remember the URL which says so...
Kind regards,
Michiel -
HelloThank's for your helpsI hope this document is helpfulBest Regards,
Date: Sun, 22 Jun 2014 17:10:17 -0700
From: [email protected]
To: [email protected]
Subject: when i open pdf file it open all the pages but some pages give error massage (there was error processing a page,there was a problem reading this document 110) but if i open this page which give me error with google chrome it's work ? if you can help me th
when i open pdf file it open all the pages but some pages give error massage (there was error processing a page,there was a problem reading this document 110) but if i open this page which give me error with google chrome it's work ? if you can help m
created by Anoop9178 in Adobe Reader - View the full discussion
Hi,
Would it be possible for you to share the document?
Regards,
Anoop
Please note that the Adobe Forums do not accept email attachments. If you want to embed a screen image in your message please visit the thread in the forum to embed the image at https://forums.adobe.com/message/6485431#6485431
Replies to this message go to everyone subscribed to this thread, not directly to the person who posted the message. To post a reply, either reply to this email or visit the message page:
To unsubscribe from this thread, please visit the message page at . In the Actions box on the right, click the Stop Email Notifications link.
Start a new discussion in Adobe Reader by email or at Adobe Community
For more information about maintaining your forum email notifications please go to http://forums.adobe.com/thread/416458?tstart=0.thank's for reply and your help
i did the step's that you told me but i still have the same problem
i have the latest v.11.0.7
i
i disable the protected mode -
Odd Error with decode function in Order By Clause
I am trying to compile a procedure and can't get around an error with a dynamic order by that doesn't make much sense to me. I can repoduce the error with a plain select statment in sql plus so I can rule out a declaration error. Here is an example with 2 numeric columns and a date column.
select task_id, display_date, remark_id from task_list
where task_id > 1000
order by decode('Task_ID', 'Task_ID',Task_ID, 'Display_Date', Display_Date, 'Remark_ID',Remark_ID)
returns the error:
select task_id, display_date, remark_id from task_list
ERROR at line 1:
ORA-00932: inconsistent datatypes: expected NUMBER got DATE
I'm not sure why this error is occuring, because it doesn't even hit the Display_Date field in the Decode statment. If I take the Display_date out of the statement, it runs properly. If I change Display_Date to To_Char(Display_Date) it also runs fine, but the sorting is incorrect. Also I'm running 9.2, and do not want to use dynamic sql to build my query. Any Ideas out there as to the cause of this error?I did find a workaround to this issue by breaking the decode statment into three separate statement, but I still think that the way it is written above should work, and may be a bug, or an error that I don't understand fully.
The Order by was rewritten like this:
order by decode(pSort, 'Task_ID',Task_ID), decode(pSort, 'Display_Date', Display_Date),
decode(pSort, 'Remark_ID',Remark_ID);
Thanks -
XML Publisher Error with reports published in XML publisher
Hi All,
I am geting the following error with a report published using XML Publisher
The XML page cannot be displayed
Cannot view XML input using style sheet. Please correct the error and then click the Refresh button, or try again later.
The system cannot locate the resource specified. Error processing resource 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.d...
How can i Rectify this?Hi Ark,
In order to generate a report using xml publisher. we need the following.
1. XML Data
2. Template file (RTF/PDF/..)
XML data will not be created by the template file.
We will be required to create XML data. One of the easiest way to create xml output is using the RDF. We can change the rdf output type in the concurrent program to XML.
Once the xml and the template is available, "XML Report Publisher" will be able to generate the output in the required format.
Thanks,
K.Nataraja Suthan, -
Graphic problems/errors with Mainstage 3 and MBP (15'' 2011)
Hi,
I bought Mainstage 3 for my MBP (15'' 2011).
When i click con "perform" i get graphic errors.
I have the same issue with the old Mainstage version since Mountain Lion.
Also a fresh installation didn't help.
I think i'm not the only one with this issue!
I don't know how to report a bug?
Perhaps someone can help me.
(and I'm probably not the only one (see feedback in Apple Store) If you also have this problem, please add a comment with your configuration (Hardware, Software))
/forgotten ebi
So, here an example how it looks like when i click on "perform":Same configuration,same problem. BUT I found a workaround.
Mainstage has this error with the AMD video card and/or a second monitor connected.
With a little app (http://gfx.io) it's possible to really force the MBPro to use the Intel Graphics card.
This will work only with the internal screen, not with a second screen connected.
And sometimes you need to restart, to really make the Intel video card free.
This works fine...In the meantime of a fix.
Maybe you are looking for
-
Regarding changing smartform LE_SHP_DELNOTE
Hello experts, Avi here .... i am new for smartform developement can any one suggest me how to change the system inbuilt smartform LE_SHP_DELNOTE as it is my requirement..... how to have those privileges to change any system inbuilt
-
Preview arrows not showing in web search
I have noticed today that when I am searching the web the preview arrows are missing so unable to preview a page quickly before deciding to open. Can anyone help, has anything changed with Safari? (Normally use Google) Any help appreciated!
-
Cannot install software for 2nd iPod
I have iPod software already installed for my 1st iPod. To set up the 2nd iPod I have tried the following: - insert iPod sofware CD that came with the iPod. But when run, it asks if I want to remove the application. I've tried saying OK to remove, th
-
Hi Experts, PLease explain me abt the mass change of Material Master.. the detailed steps to be followed for the change I know the tcode MM17, please explain the process in that transaction
-
After a big loss of out-pulled hair here is the code: setInterval() calls getNewMess function but it happens nothing with onNewMess function. Instead, if i click refresh-button, it gives me result correctly.