Using xmldom.writeToClob to update xml clob corrupts clob
We are storing an xml document in a clob field in the db. As part of a data check we need to parse the xml and possibly remove a node. I can do that, and check the results using 'xmldom.writeToBuffer'.
When I try to write the data back to the db using 'xmldom.writeToClob' I get strange results. Data seems to be appended to the end of the clob and contains chr(13) characters at the end of each line.
Also does anyone know if the existence of whitespace in the xml clob would cause a parse/search to be slower?
I am new to xml and might be missing something fairly basic in the following code. Thanks in advance for any help.
Here is some of the code:
doc xmldom.DOMDocument;
curNode xmldom.DOMNode;
parentNode xmldom.DOMNode;
theNodeList xmldom.DOMNodeList;
str varchar2(4000);
begin
-- open xml_rec cursor (xml is the clob field opened for update)
-- Loop through all item elements
theNodeList := xmldom.getElementsByTagName(doc, 'item');
for m in 0..xmldom.getLength(theNodeList)-1 loop
curNode := xmldom.item(theNodeList,m);
--perform a check and possibly delete the current node
parentNode := xmldom.getParentNode(curNode);
parentNode := xmldom.removechild(parentNode, curNode);
xmldom.writeToBuffer(doc, str);
--I check the results here and everything looks good
xmldom.writeToClob(doc, xml_rec.xml);
--When I check the clob the data is incorrect.
null
The next cod is a sample of the implementation xmldom.writeToClob used xmldom.DOMNode in the parameter of input.
DECLARE
XMLOut CLOB := EMPTY_CLOB();
XMLIn Varchar2(2000);
XSLPath Varchar2(2000);
BEGIN
DBMS_LOB.CREATETEMPORARY(XMLOut,TRUE); -- Give permit
DBMS_LOB.OPEN (XMLOut, DBMS_LOB.LOB_READWRITE); --open the file of read and write
XSLPath := '/users/gcardona/plantillas/report.xsl';
GE_BSXMLCONVERT.createElementName('COLUMN');
GE_BSXMLCONVERT.createElementAttribute('name', 'OUTXML');
GE_BSXMLCONVERT.addElement();
GE_BSXMLCONVERT.createElementName('table');
GE_BSXMLCONVERT.createElementAttribute('name', 'X1');
GE_BSXMLCONVERT.createElementAttribute('width', '100');
GE_BSXMLCONVERT.addElement();
XMLIn := GE_BSXMLCONVERT.toXML();
XSLTranform(XMLIn, XSLPath, XMLOut);--XMLOut is a variable in out in the procedure,
--here is where is return the file XML Process
insert into in_prueba (ID,XML_CLOB) values (200, XMLOut);
DBMS_LOB.CLOSE (XMLOut); -- Close File
DBMS_LOB.FREETEMPORARY(XMLOut); --free memory
GE_BSXMLCONVERT.clearMemory();
commit;
END;
null
Similar Messages
-
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 -
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 -
Steve, why is xmldom.writetoclob so slow ??
I am using xmldom.writetoclob, which is OK when transfering small ( < 1MG ) documents to a CLOB, but as the documetns get bigger it is very slow..
It takes 15 minutes to transfer a 5MB document to a clob using xmldom.writetoclob.
Anything I should be doing to see better results ?
Thanks.
I am using the PL/SQL parserwhat is your java_pool_size?
-
Urgent Issue: Error Mapping Existing Forms to manually updated XML
Hi All,
We are working on pretty complex InfoPath form which contains 150+ fields. Based on new requirements, we added few sections containing
repeating tables with default data of multiple rows (using default values feature). To make sure that existing forms get these repeating table values correctly we wrote a PowerShell script to update the existing forms (xml files) directly.
This is done so that when an existing form is opened data should get properly mapped. But unfortunately only few repeating tables are showing the correct data and other repeating tables are showing only first record multiple times. This is working for new
forms exactly the way we expect.
We tried to download the xml file and updating the changed xml section from new form xml but it still does not work and shows the same issue. But when we open the existing
form, save it, download it and then change the xml with xml from new form, it works. Somehow when we open existing forms, the mapping is not correct.
Please guide me on this issue. Appreciate your help.
Please let me know if I need to provide more details.
Thanks,
Rahul Babar
ASP.NET, C# 4.0, Sharepoint 2007/2010, Infopath 2007/2010 Developer http://sharepoint247.wordpress.com/Dear Rahul,
The problem is very well clear, but in order to suggest in your solution I recommend to post the code you used in PowerShell to update xml, any XSLT customization, custom code related to the repeating table you have implemented etc.
If you find this information as helpful please mark this as ANSWER or HELPFUL. Thanks -
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. -
Using XMLDOM to process document in XML DB
I am new to XML and especially XML DB which I however see as an excellent platform on which to base XML based solutions. I have a specific question and apologise beforehand should any of my assumptions be incorrect.
I wish to create an application which from a number of XML fragments, together with rules governing the behaviour of the fragments (insertion points, overwrite rules etc) are merged together to finally leave me with a complete and valid XML document in XML DB.
I thought at first that I could use DBMS_XMLDOM to perform this low level processing required. I have however not managed to understand how this can be used together with XMLDB. I am reluctant to use XMLDOM without XMLDB as I am afraid that I will surpass the limits in XML document size apparently imposed by XMLDOM.
I see a solution where I create a schema based resource in XML DB containing the initial XML structure and then processing any number of the above mentioned fragments to finaly be left with a complete XML document.
Can I use XMLDOM to do this or am I barking up the wrong tree?
I would be grateful for any input on techniques that I can apply to perform elementary search/replace/insert on an XML document which I am, from PLSQL, compiling.
Thanks
Hans ChristiansenHi
The size of the documents I want to compose are expected vary from a few Kb to 1 or 2 Gb! In a FAQ found somewhere on OTN there was an entry which mentioned that somebody was having trouble with a 50Mb XML document. The recommendation was to use SAX but I am under the impression that this is more useful when the processing is of a more sequential nature.
The main thread of my question is to gain clarity in the most suitable technique to use when actualy compsing the XML.
What I want to do is:
Create resource (XML document) in XML DB.
Loop through XML fragments together with rules:
For each fragment process according to rules and insert
fragment or update existing XML based on fragment contents.
At the end of the loop the XML document is complete and ready for further processing.
XMLDOM seems to give me the tools to do this but I am unsure of how to do this and have XMLDOM work directly against the contents in the resource controlled by XML DB (making use of possible indexes and the scalable nature of XMLDB). I get the feeling that if I simply read the XML from XMLDB resource into a DOM document I am still using the memory based representation of the XML until I write the XML back to XMLDB - is this a correct assumption.
Alternatively is it the functionality offered by XPath, extract(), updatexml() etc. that I should be looking at?
Does this make my question more understandable?
Hans -
Update XML data stored in CLOB Column
Hi All,
i am new to Oracle and new to SQL
i am trying to update XML data stored in CLOB cloumn,data is stored with the follwoing format
<attrs><attr name="name"><string>Schade</string></attr></attrs>
i am using the following query for updating the value
UPDATE PRODUCT p SET ATTRIBUTES_nl_nl=UPDATEXML(XMLTYPE.createXML(ATTRIBUTES_nl_nl),'/attrs/attr[@name="name"]/string/text()','Schade').getClobVal() WHERE p.sku='000000000000040576_200911-5010057'
this query is working fine but it changing the data to the following format
<attrs><attr name="name">Schade</attr></attrs>
some how it is ommiting the <string> tag from it, i am unable to figure it out whats the reason.
any help in this regard will b e much appriciated
Thanks in Advance
-UmeshHi,
You should have created your own thread for this, and included database version.
This works for me on 11.2.0.2 and 10.2.0.5 :
SQL> create table t_org ( xml_clob clob );
Table created
SQL>
SQL> insert into t_org
2 values(
3 '<Message>
4 <Entity>
5 <ASSIGNMENT>
6 <OAVendorLocation> </OAVendorLocation>
7 <Vendorid>1</Vendorid>
8 </ASSIGNMENT>
9 </Entity>
10 </Message>'
11 );
1 row inserted
SQL> commit;
Commit complete
SQL> select '*' ||
2 extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
3 || '*' as result
4 from t_org;
RESULT
SQL> update t_org set xml_clob =
2 updatexml(xmltype(xml_clob),
3 '/Message/Entity/ASSIGNMENT/OAVendorLocation/text()','LONDON').getClobVal()
4 ;
1 row updated
SQL> select '*' ||
2 extractvalue(xmltype(xml_clob),'/Message/Entity/ASSIGNMENT/OAVendorLocation')
3 || '*' as result
4 from t_org;
RESULT
*LONDON*
Does the OAVendorLocation really have a whitespace value?
If not then it's expected behaviour, you're trying to update a text() node that doesn't exist. In this case, the solution is to use appendChildXML to create the text() node, or update the whole element.
Is it your real document? Do you actually have some namespaces? -
INSERTION OF XML DATA INTO THE TABLE USING XMLDOM
hello,
i am using XMLDOM to insert the data into the table
i am using different function of it.
but i am facing the problem to retrive the the multiple entry.
like in my example i have two entry of the ' po number '
& i am using the function
dbms_xmldom.item(l_nodelist, 0)
i which i have to pass index no.
& through this i am getting only single entry according to the index no.
Example on which i am working is
declare
l_xml_data CLOB;
l_xml_doc dbms_xmldom.domdocument;
l_nodelist dbms_xmldom.DOMNodeList;
l_node dbms_xmldom.domnode;
l_xmltype XMLTYPE;
l_po_num VARCHAR2(30);
l_cust_ord VARCHAR2(30);
l_item_code VARCHAR2(30);
begin
l_xml_data := '<?xml version="1.0" encoding="UTF-8"?>
<!--DOCTYPE MobileInventoryResponse SYSTEM "MobileInventoryResponse.dtd"-->
<MobileInventoryResponse>
<message>
<message-header>
<message-id>16244182</message-id>
<transaction-name>ship-advice</transaction-name>
<partner-name>cbeyond</partner-name>
<source-url>http://www.brightpoint.com</source-url>
<create-timestamp>20080826150709</create-timestamp>
<response-request>1</response-request>
</message-header>
<ship-advice>
<header>
<customer-id>297859</customer-id>
<shipment-information>
<ship-first-name>RA_13Aug_1</ship-first-name>
<ship-last-name>MIND</ship-last-name>
<ship-address1>test</ship-address1>
<ship-city>test</ship-city>
<ship-state>VA</ship-state>
<ship-post-code>22102-4931</ship-post-code>
<ship-country-code>US</ship-country-code>
<ship-phone1>0040726335068</ship-phone1>
<ship-email>[email protected]</ship-email>
<ship-via>FX01</ship-via>
<ship-request-date>20080826</ship-request-date>
<ship-request-warehouse>CBY1</ship-request-warehouse>
</shipment-information>
<purchase-order-information>
<purchase-order-number>380928</purchase-order-number>
<purchase-order-number>380929</purchase-order-number> ----modi by Ananda Dubey
<account-description/>
<purchase-order-amount>0.0</purchase-order-amount>
<currency-code>USD</currency-code>
</purchase-order-information>
<order-header>
<customer-order-number>0002759</customer-order-number>
<customer-order-date>20080826</customer-order-date>
<order-sub-total>19.0</order-sub-total>
<order-discount>0.0</order-discount>
<order-tax1>0.0</order-tax1>
<order-tax2>0.0</order-tax2>
<order-tax3>0.0</order-tax3>
<order-shipment-charge>18.0</order-shipment-charge>
<order-total-net>0.0</order-total-net>
<order-status>Completed</order-status>
<order-type/>
<brightpoint-order-number>35028788</brightpoint-order-number>
<warehouse-id>CBY1</warehouse-id>
<ship-date>20080826</ship-date>
</order-header>
</header>
<detail>
<line-item>
<line-no>1</line-no>
<item-code>SKU1</item-code>
<universal-product-code>0</universal-product-code>
<ship-quantity>1.0</ship-quantity>
<unit-of-measure>EA</unit-of-measure>
<serial-list>
<serial-numbers>
<esn>TIMI000013</esn>
</serial-numbers>
</serial-list>
<line-status/>
<base-price>0.0</base-price>
<line-discount>0.0</line-discount>
<line-tax1>0.0</line-tax1>
<line-tax2>0.0</line-tax2>
<line-tax3>0.0</line-tax3>
<bill-of-lading>929406733828</bill-of-lading>
<scac>FX01</scac>
</line-item>
</detail>
</ship-advice>
<transactionInfo>
<eventID>16244182</eventID>
</transactionInfo>
</message>
</MobileInventoryResponse>';
l_xml_doc := dbms_xmldom.newDomDocument(l_xml_data);
-- Method 1 to get data
l_nodelist := dbms_xmldom.getelementsbytagname(l_xml_doc, 'purchase-order-number');
l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from list
l_po_num := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_node));
dbms_output.put_line(l_po_num);
l_nodelist := dbms_xslprocessor.selectnodes(dbms_xmldom.makenode(l_xml_doc),
'/MobileInventoryResponse/message/ship-advice/detail/line-item/item-code');
l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from list
l_item_code := dbms_xmldom.getnodevalue(dbms_xmldom.getfirstchild(l_node));
dbms_output.put_line(l_item_code);
l_xmltype := XMLTYPE(l_xml_data);
l_cust_ord := l_xmltype.extract('/MobileInventoryResponse/message/ship-advice/header/order-header/customer-order-number/text()').getStringVal();
dbms_output.put_line(l_cust_ord);
dbms_xmldom.freeDocument(l_xml_doc);
end;
/In the following code
l_nodelist := dbms_xmldom.getelementsbytagname(l_xml_doc, 'purchase-order-number');
l_node := dbms_xmldom.item(l_nodelist, 0); -- gets first item from listYou need to understand what the second parm on the .item call does. See [dbms_xmldom.item|http://download.oracle.com/docs/cd/B19306_01/appdev.102/b14258/d_xmldom.htm#i1126138]
The nodelist is a 0 based array of information and you are only requesting to pull the node info in the first array position. So to get the info in the second array position, you need to use ", 1)". You can also use .getLength and a loop to parse through everything in the node list. -
Migrating V9 to V10: Update XML Fragment CLOB does not work anymore
I have an XML Schema that contains an element, named Operazione, mapped to a CLOB.
I just migrate to Oracle 10.1.0.2.0 from version 9.2.0.2.0 and the code I developed does not work anymore.
To get a CLOB on v 9.2.0.2.0 I issued the following statement:
select extractValue(value(p),'/operazione.log/Operazione') from XMT_OPERAZIONE_LOG p
where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
To make it working on V10 I have to change it as follow:
select extract(value(p),'/operazione.log/Operazione').getClobVal() from XMT_OPERAZIONE_LOG p
where existsNode(value(p),'/operazione.log/Journal[NumeroElettronico=1234567890]') = 1
So using extract intead of extractValue and adding getClobVal() I was able to read the CLOB.
The problem that I was not able to solve is related to CLOB update. In V9 just adding the âfor updateâ clause I was able to change the CLOB value on DB.
In V10 if I run the V9 statement I get the error:
ORA-03113: end-of-file on communication channel
If I use the statement modified for V10, adding the âfor updateâ clause, I get the CLOB and I can change the CLOB value but nothing goes on the DB. Probably I am working on a copy of the DB CLOB.
If I remove the getClobVal() I get an OPAQUE type that I can use on a XMLType but, still, nothing is stored on DB.
Any suggestion ?
I tried with both OCI and Thin ClientCan anybody help me ?
Is it better to use different strategies ( eg. Stored Procedure, DBMS_XMLSTORE etc, etc. ) ?
Any experience updatating XML Fragment CLOB on Oracle V10 ? -
Form or form on report to update XML tagS stored in CLOB field.
I would like to create a form or a form on a report
where i can update xml tags. The xml data is stored in a CLOB field.
sample CLOB DATA
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE preferences SYSTEM 'http://java.sun.com/dtd/preferences.dtd'>
<preferences EXTERNAL_XML_VERSION="1.0">
<root type="user">
<map />
<node name="com">
<map />
<node name="mynode">
<map />
<node name="utils">
<map />
<node name="properties">
<map>
<entry key="Save" value="ON" />
<entry key="TM_PORT" value="55555" />
<entry key="TM_PORT2" value="7777" />
<entry key="SubID" value="all" />
<entry key="UserDBUsr" value="myuser" />
<entry key="JMS_JDBC" value="OFF" />
<entry key="Side" value="BUY" />
<entry key="HEALTH_MONITOR_CRITICAL_DISK_SPACE" value="500" />
<entry key="HEALTH_MONITOR_WARNING_DISK_SPACE" value="750" />
<entry key="HEALTH_MONITOR_PERIOD" value="600000" />
</map>
</node>
</node>
</node>
</node>
</root>
</preferences>
the goal is to have a form where i can view and update the "value" of following:
TM_PORT
TM_PORT2
SubID
UserDBUsr
JMS_JDBC
Side
HEALTH_MONITOR_CRITICAL_DISK_SPACE
HEALTH_MONITOR_WARNING_DISK_SPACE
HEALTH_MONITOR_PERIOD
I have searched around this forum but could not find an example.
it would be cool if I could also load the an xml file into the clob.
Thank you.Hi,
I think you just study first the topics about XML DB to understand how to manupulate xml data in the database.
See:
http://www.oracle.com/technology/tech/xml/xmldb/index.html
and
XML DB
Regards,
Cafer -
Revision: 20696
Revision: 20696
Author: [email protected]
Date: 2011-03-08 14:09:49 -0800 (Tue, 08 Mar 2011)
Log Message:
update build.properties values that are used for flex-sdk-description.xml. release.version = 4.5.1 release = Superhero
QE notes: no
Doc notes: no
Bugs: no
Reviewer: lauren
Tests run: no
Is noteworthy for integration: most likely FB will have to be aware of this
Modified Paths:
flex/sdk/trunk/build.propertiesThats good news.
Maybe you are looking for
-
Oracle 11gR1 Installation problem on RH 5.6
Hi to all, I try to create a new Oracle 11g R1 database using the following script: create database MDO01XXI MAXINSTANCES 1 MAXLOGHISTORY 1752 MAXLOGFILES 8 MAXLOGMEMBERS 2 MAXDATAFILES 666 CHARACTER SET UTF8 NATIONAL CHARACTER SET UTF8 set default S
-
I would like to recover a license from an iMac that has died. How do I do it?
An iMac died and has been replaced. I know my product key but how do I de-register the product from the dead machine and register it to the new machine? Thank you, Rod
-
Hi I am new to Hibernate and trying to find as much information as possible about it. I know there are quite a few differences between Hibernate 2 and 3 and version 3 is not backwards compatible. If I was to choose between Hibernate 2 and 3 for a pro
-
Hi, It is client's reqt to post invoices up to 5 decimal places. The amounts posted in FI shows correctly up to 5 decimal places e.g. 1,008.12000. But when checked against std PCA report S_ALR_87013340 , the actual line item amount is 1,008,120.00.
-
HELP, about DB_AUTO_COMMIT
look at the following codes, the compilation can be successful, but when executing it, ret=dbp->put(dbp,txn,&key,&data,0); will return non-zero, if db_flags is db_create|db_auto_commit, the execution can be normal, I do not know why, why can not I se