Bug in JavaScript code parsing a large XML document returns truncated values
I believe I am seeing this old bug (https://bugzilla.mozilla.org/show_bug.cgi?id=449219) in Firefox ESR v10.0.3. Could this be a regression or new version of the same bug? Or is the ESR build separate from the normal trunk releases and could this bug not have been patched onto the ESR branch?
Firefox ESR is based upon the Firefox 10 version with some security patches applied from later Firefox versions, so you shouldn't see bug that were fixed in Firefox 3 versions.
Please update to the latest Firefox 10.0.11 ESR version.
*http://www.mozilla.org/en-US/firefox/organizations/all.html
*http://www.mozilla.org/en-US/firefox/10.0.11/releasenotes/
Similar Messages
-
Hi everyone again :) Just sitting here trying to load a large XML document (it's ~13Mb). I know that's a massive XML document, but that's the way it is. The problem that I am having is that when I try to load the document I get an out of memory exception.
Frankly, I'm not surprised, but is there a remedy? Any thoughts/ideas/solutions would be greatly appreciated. :)
BenSounds like you are using DOM. The DOM parser you are using must be loading the whole Document tree right away. DOM really eats up memory. There are two possible solutions:
1. Look into using a SAX parser. I don't know what you are doing with the xml, so I can't say whether or not that will work for you.
2. Configure the DOM parser to defer loading nodes until they are requested, or if that option is not available with your parser, get a parser that will defer node loading.
If option 2 sounds like what you need, then I suggest looking into the Apache Xerces parser. I am pretty sure it defers loading. You shouldn't have to change your code to work with the Xerces parser, you just have to make sure you set the proper system properties so that Java will automatically use the Xerces parser. -
Large XML document performance
We are using XDB 9.2.0.4. I am seeing a severe performance degradation when attempting to extract larger XML documents from XDB (somewhere over 3M). Smaller documents appear to be working fine.
I have been reading in the forum that the problem I am running into is most likely related to the storage model being used. ie) There are several repeating elements within the schema.
I have added xdb:storeVarrayAsTable="true" statement to the schema and re-registered. I can see, based on user_nested_tables, that XDB appears to be storing the repeating elements as nested tables vs varrays.
The change to the storage model does not seem to have significantly changed the queries performance.
The schemas I am using can be found at http://www.sasked.gov.sk.ca/xsd/sl/1.x/SLMessage.xsd & http://www.sasked.gov.sk.ca/xsd/sl/1.x/SDSElements.xsd
The schema documentation can be found at http://www.sasked.gov.sk.ca/sds/xml/SchemaDocumentation/SLMessage.html
The element /SL_Message/SL_Event/SL_ObjectData/SL_EventObject is the primary repeating element
I am using a table with an XMLType column
CREATE TABLE XML_SL_MESSAGE
(XML_SL_MESSAGE_ID NUMBER(11) NOT NULL
,DTE_TIMESTAMP TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
,ORIGINAL_XML_SL_MESSAGE_ID NUMBER(11)
,VALID_SL_MESSAGE_XML sys.XMLType
,INVALID_XML CLOB
,ERROR_MESSAGE VARCHAR2(4000)
) xmltype column valid_sl_message_xml XMLSCHEMA "http://www.sasked.gov.sk.ca/xsd/sl/1.x/SLMessage.xsd" element "SL_Message"
The SQL I am using is attempting to bring the XMLType back as a clob, the query seems to be intensive in both CPU and I/O. (looks like it is the getClobVal function)
select xsm.xml_sl_message_id
,xsm.dte_timestamp
,nvl(xsm.valid_sl_message_xml.getClobVal(),xsm.invalid_xml) as xml_clob
,xsm.error_message
,xsm.original_xml_sl_message_id
from xml_sl_message xsm
where xsm.dte_timestamp > sysdate 1
I guess what I am wondering is what are my options ? Changing the storage model ? Applying Indexes ?
On an unrelated topic, Are there many differences in XDB 9.2.0.5 and 9.2.0.4 ? (I dont believe 10g will be an option here yet)
Thanx in advance
TrentI have applied the 9.2.0.5.0 patches and created the relational table with the following attributes:
CREATE TABLE XML_SL_MESSAGE
(XML_SL_MESSAGE_ID NUMBER(11) NOT NULL
,DTE_TIMESTAMP TIMESTAMP DEFAULT SYSTIMESTAMP NOT NULL
,PSE_SYS_USR_ID NUMBER(11) NOT NULL
,ORIGINAL_XML_SL_MESSAGE_ID NUMBER(11)
,VALID_SL_MESSAGE_XML sys.XMLType
,INVALID_XML CLOB
,ERROR_MESSAGE VARCHAR2(4000)
xmltype column valid_sl_message_xml
STORE AS OBJECT RELATIONAL
XMLSCHEMA "http://www.sasked.gov.sk.ca/xsd/sl/1.x/SLMessage.xsd" ELEMENT "SL_Message"
-- 1:1 ----------------------
varray valid_sl_message_xml."XMLDATA"."SL_Event"."SL_ObjectData"."SL_EventObject"
store as table SL_EVENTOBJECT2_TB(
(constraint SL_EVENTOBJECT2_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 2:2 ----------------------
varray "SchoolTerm"
store as table SCHOOLTERM2_TB(
(constraint SCHOOLTERM2_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 3:2 ----------------------
varray "SchoolClass"
store as table SCHOOLCLASS3_TB(
(constraint SCHOOLCLASS3_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 6:2 ----------------------
varray "StudentCourseHistory"
store as table STUDENTCOURSEHISTORY6_TB(
(constraint STUDENTCOURSEHISTORY6_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 7:2 ----------------------
varray "StudentSupplementalMark"
store as table STUDENTSUPPLEMENTALMARK7_TB(
(constraint STUDENTSUPPLEMENTALMARK7_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 8:2 ----------------------
varray "StudentClassMark"
store as table STUDENTCLASSMARK8_TB(
(constraint STUDENTCLASSMARK8_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 9:2 ----------------------
varray "StudentExamRegistration"
store as table STUDENTEXAMREGISTRATION9_TB(
(constraint STUDENTEXAMREGISTRATION9_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 10:2 ----------------------
varray "StudentClassEnrollment"
store as table STUDENTCLASSENROLLMENT10_TB(
(constraint STUDENTCLASSENROLLMENT10_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 11:2 ----------------------
varray "StudentPersonal"
store as table STUDENTPERSONAL11_TB(
(constraint STUDENTPERSONAL11_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 18:2 ----------------------
varray "StudentProgramEnrollment"
store as table STUDENTPROGRAMENROLLMENT18_TB(
(constraint STUDENTPROGRAMENROLLMENT18_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 19:2 ----------------------
varray "StudentSchoolEnrollment"
store as table STUDENTSCHOOLENROLLMENT19_TB(
(constraint STUDENTSCHOOLENROLLMENT19_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 26:1 ----------------------
varray valid_sl_message_xml."XMLDATA"."SL_Response"."SL_ObjectData"."SL_EventObject"
store as table SL_EVENTOBJECT26_TB(
(constraint SL_EVENTOBJECT26_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 27:2 ----------------------
varray "SchoolTerm"
store as table SCHOOLTERM27_TB(
(constraint SCHOOLTERM27_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 28:2 ----------------------
varray "SchoolClass"
store as table SCHOOLCLASS28_TB(
(constraint SCHOOLCLASS28_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 31:2 ----------------------
varray "StudentProgramEnrollment"
store as table STUDENTPROGRAMENROLLMENT31_TB(
(constraint STUDENTPROGRAMENROLLMENT31_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 32:2 ----------------------
varray "StudentExamRegistration"
store as table STUDENTEXAMREGISTRATION32_TB(
(constraint STUDENTEXAMREGISTRATION32_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 33:2 ----------------------
varray "StudentClassEnrollment"
store as table STUDENTCLASSENROLLMENT33_TB(
(constraint STUDENTCLASSENROLLMENT33_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 34:2 ----------------------
varray "StudentPersonal"
store as table STUDENTPERSONAL34_TB(
(constraint STUDENTPERSONAL34_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 41:2 ----------------------
varray "StudentSchoolEnrollment"
store as table STUDENTSCHOOLENROLLMENT41_TB(
(constraint STUDENTSCHOOLENROLLMENT41_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 48:2 ----------------------
varray "StudentClassMark"
store as table STUDENTCLASSMARK48_TB(
(constraint STUDENTCLASSMARK48_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 49:2 ----------------------
varray "StudentCourseHistory"
store as table STUDENTCOURSEHISTORY49_TB(
(constraint STUDENTCOURSEHISTORY49_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 50:2 ----------------------
varray "StudentSupplementalMark"
store as table STUDENTSUPPLEMENTALMARK50_TB(
(constraint STUDENTSUPPLEMENTALMARK50_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 51:1 ----------------------
varray valid_sl_message_xml."XMLDATA"."SL_Response"."SL_Ack"."SL_Error"
store as table SL_ERROR51_TB(
(constraint SL_ERROR51_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
-- 52:1 ----------------------
varray valid_sl_message_xml."XMLDATA"."SL_Request"."SL_Query"."SL_QueryObject"
store as table SL_QUERYOBJECT52_TB(
(constraint SL_QUERYOBJECT52_PK primary key (NESTED_TABLE_ID,ARRAY_INDEX))
tablespace data
ALTER TABLE XML_SL_MESSAGE
ADD (CONSTRAINT XML_SL_MESSAGE_PK PRIMARY KEY
(XML_SL_MESSAGE_ID))
ALTER TABLE XML_SL_MESSAGE
ADD (CONSTRAINT XMLSLMSG_ORIGINAL_XMLSLMSG_UK UNIQUE
(ORIGINAL_XML_SL_MESSAGE_ID))
ALTER TABLE XML_SL_MESSAGE ADD (CONSTRAINT
XMLSLMSG_SYSUSR_FK FOREIGN KEY
(PSE_SYS_USR_ID) REFERENCES PSE_SYS_USR
(PSE_SYS_USR_ID))
ALTER TABLE XML_SL_MESSAGE ADD (CONSTRAINT
XMLSLMSG_ORIGINAL_XMLSLMSG_FK FOREIGN KEY
(ORIGINAL_XML_SL_MESSAGE_ID) REFERENCES XML_SL_MESSAGE
(XML_SL_MESSAGE_ID))
-- Create a unique index for the XML Message id
CREATE UNIQUE INDEX XMLSLMSG_MSGID_UNIQUE ON XML_SL_MESSAGE
((substr(extractValue(valid_sl_message_xml,'//SL_MsgId'),1,255)))
tablespace indx
COMPUTE STATISTICS
Here is the nested table structure of the XMLType table created during the schema registration:
select level
,parent_table_column
from user_nested_tables
connect by prior table_name = parent_table_name
start with parent_table_name = 'SL_Message4724_TAB'
LEVEL PARENT_TABLE_COLUMN
1 "XMLDATA"."SL_Event"."SL_ObjectData"."SL_EventObject"
2 SchoolTerm
2 StudentSchoolEnrollment
3 "StudentInfo"."Name"
3 "StudentInfo"."Demographics"."CountryOfCitizenship"
3 "StudentInfo"."StudentAddress"
3 "StudentInfo"."PhoneNumber"
3 "StudentInfo"."Demographics"."Language"
3 "StudentInfo"."Email"
2 SchoolClass
3 "ClassInfo"."DeptAssignedCourseId"
3 "ClassInfo"."EducatorCertificateNumber"
2 StudentProgramEnrollment
2 StudentClassEnrollment
2 StudentClassMark
2 StudentCourseHistory
2 StudentSupplementalMark
2 StudentExamRegistration
2 StudentPersonal
3 "StudentInfo"."Name"
3 "StudentInfo"."Email"
3 "StudentInfo"."Demographics"."CountryOfCitizenship"
3 "StudentInfo"."StudentAddress"
3 "StudentInfo"."PhoneNumber"
3 "StudentInfo"."Demographics"."Language"
1 "XMLDATA"."SL_Request"."SL_Query"."SL_QueryObject"
1 "XMLDATA"."SL_Response"."SL_ObjectData"."SL_EventObject"
2 SchoolTerm
2 SchoolClass
3 "ClassInfo"."DeptAssignedCourseId"
3 "ClassInfo"."EducatorCertificateNumber"
2 StudentProgramEnrollment
2 StudentClassEnrollment
2 StudentClassMark
2 StudentCourseHistory
2 StudentSupplementalMark
2 StudentExamRegistration
2 StudentPersonal
3 "StudentInfo"."Name"
3 "StudentInfo"."Email"
3 "StudentInfo"."Demographics"."Language"
3 "StudentInfo"."PhoneNumber"
3 "StudentInfo"."StudentAddress"
3 "StudentInfo"."Demographics"."CountryOfCitizenship"
2 StudentSchoolEnrollment
3 "StudentInfo"."Name"
3 "StudentInfo"."Demographics"."Language"
3 "StudentInfo"."PhoneNumber"
3 "StudentInfo"."StudentAddress"
3 "StudentInfo"."Demographics"."CountryOfCitizenship"
3 "StudentInfo"."Email"
1 "XMLDATA"."SL_Response"."SL_Ack"."SL_Error"
52 rows selected.
When I attempt to insert to previously valid XML documents I get a core dump Here are the insert statements:
insert into xml_sl_message (
xml_sl_message_id, dte_timestamp, pse_sys_usr_id, original_xml_sl_message_id, valid_sl_message_xml, invalid_xml,error_message
select xml_sl_message_id, dte_timestamp, pse_sys_usr_id, original_xml_sl_message_id, xmltype(valid_sl_message_clob), invalid_xml,error_message
from xml_sl_message_temp where xml_sl_message_id in (5154,5155)
Here are the details on the exception:
Oracle9i Enterprise Edition Release 9.2.0.5.0 - 64bit Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.5.0 - Production
ORACLE_HOME = /opt/app/oracle/product/9.2.0
System name: SunOS
Node name: *****
Release: 5.8
Version: Generic_117000-01
Machine: sun4u
Instance name: EDDSDS
Redo thread mounted by this instance: 1
Oracle process number: 76
Unix process pid: 11460, image: oracle@***** (TNS V1-V3)
*** 2004-06-22 09:24:34.603
*** SESSION ID:(29.159) 2004-06-22 09:24:34.602
Exception signal: 11 (SIGSEGV), code: 1 (Address not mapped to object), addr: 0x20, PC: [0x101e41830, 0000000101E41830]
*** 2004-06-22 09:24:34.606
ksedmp: internal or fatal error
ORA-07445: exception encountered: core dump [0000000101E41830] [SIGSEGV] [Address not mapped to object] [0x000000020] [] []
Current SQL statement for this session:
insert into xml_sl_message (
xml_sl_message_id, dte_timestamp, pse_sys_usr_id, original_xml_sl_message_id, valid_sl_message_xml, invalid_xml,error_message
select xml_sl_message_id, dte_timestamp, pse_sys_usr_id, original_xml_sl_message_id, xmltype(valid_sl_message_clob), invalid_xml,error_message
from xml_sl_message_temp where xml_sl_message_id in (5154,5155)
I have tried a couple different storage sections (with different levels of nesting) and still the same problem ..
Is there something wrong with my storage section ?
What is the "return as LOCATOR" clause for? -
Date insertion from large XML document (clob) into relation table very slow
Hi Everybody!
I'm working with Oracle 9.2.0.5 on Microsoft Windows Server 2003 Enterprise Edition.
The server (a test server) is a Pentium 4 2.8 GHz, 1GB of RAM.
I use a procedure called PARITOP_TRAITERXMLRESULTMASSE to insert the data contained in the pXMLDOC clob parameter in the table pTABLENAME. (You can see the format of the XML document below). The first step on this procedure is to verify that the XML document is not empty. If not, the procedure needs to add a node in the document, in every <ROW> tag. This added node is named âRST_IDâ. Itâs the foreign key of each record. I can retrieve the value of each <RST_ID> node in an other table in which the data has been previously added (by the calling procedure). When each of the <ROW> elements has been treated, the PARITOP_INSERTXML procedure is called. This procedure uses DBMS_XMLSAVE.INSERTXML to insert the data contained in the XML document in the specified table.
(Below, you can see the code of my procedures.)
With this information, can you tell me why this treatment is very very very slow with a large XML document and how I can improve it?
Thank you for your help!
Anne-Marie
CREATE OR REPLACE PROCEDURE "PARITOP_TRAITERXMLRESULTMASSE" (
pPRC_ID IN PARITOP_PARC.PRC_ID%TYPE,
pRST_MONDE IN PARITOP_RESULTAT.RST_MONDE%TYPE,
pXMLDOC IN CLOB,
pTABLENAME IN VARCHAR2)
AS
Objectif :Insérer le contenu du XML passé en paramètre (pXMLDOC) à la table passée en paramètre (pTABLENAME)
La table passée en paramètre doit être une table ayant comme clé étrangère le champs "RST_ID" .
(Le noeud RST_ID est donc ajouté à tous les document XML. Ce rst_id est
déterminé à partir de la table PARITOP_RESULTAT grâce à pPRC_ID et
pRstMonde fournis en paramètre)
result_doc CLOB;
XMLDOMDOC XDB.DBMS_XMLDOM.DOMDOCUMENT;
NODE_ROWSET DBMS_XMLDOM.DOMNODE;
NODE_ROW DBMS_XMLDOM.DOMNODE;
vUE_ID PARITOP_RESULTAT.UE_ID%TYPE;
vRST_ID PARITOP_RESULTAT.RST_ID%TYPE;
nodeList DBMS_XMLDOM.DOMNODELIST;
BEGIN
BEGIN
vUE_ID := 0;
vRST_ID := 0;
XMLDOMDOC := DBMS_XMLDOM.NEWDOMDOCUMENT(pXMLDOC);
IF NOT GESTXML_PKG.FN_PARITOP_DOCUMENT_IS_NULL(XMLDOMDOC) THEN
NODE_ROWSET := DBMS_XMLDOM.item(DBMS_XMLDOM.GETCHILDNODES (DBMS_XMLDOM.MAKENODE(XMLDOMDOC)),0);
for i in 0..dbms_xmldom.getLength(DBMS_XMLDOM.getchildnodes(NODE_ROWSET))-1 loop
NODE_ROW := DBMS_XMLDOM.ITEM(DBMS_XMLDOM.GETCHILDNODES(NODE_ROWSET), i) ;
nodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(DBMS_XMLDOM.makeelement(NODE_ROW) , 'UE_ID');
IF vUE_ID <> DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0))) THEN
vUE_ID := DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0)));
--on ramasse le rst_id
SELECT RST_ID INTO vRST_ID
FROM PARITOP_RESULTAT RST
WHERE RST.PRC_ID = pPRC_ID
AND RST.UE_ID = vUE_ID
AND RST.RST_MONDE = pRST_MONDE
AND RST_A_SUPPRIMER = 0;
END IF;
GESTXML_PKG.PARITOP_ADDNODETOROW(XMLDOMDOC, NODE_ROW, 'RST_ID', vRST_ID);
end loop;
RESULT_DOC := ' '; --Ã garder, pour ne pas que ca fasse d'erreur lors du WriteToClob.
dbms_xmldom.writeToClob(DBMS_XMLDOM.MAKENODE(XMLDOMDOC), RESULT_DOC);
--Insertion du document XML dans la table "tableName"
GESTXML_PKG.PARITOP_INSERTXML(RESULT_DOC, pTABLENAME);
DBMS_XMLDOM.FREEDOCUMENT( XMLDOMDOC);
end if;
EXCEPTION
[â¦exception treatementâ¦]
END;
END;
The format of a XML clob is :
<ROWSET>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6223</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>92.307692307692307</CMP_INDICESELECTION>
<CMP_PVRES>94900</CMP_PVRES>
<CMP_PVAJUSTE>72678.017699115066</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>72678.017699115095</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>72678.017699115037</CMP_PVAJUSTEMAX>
<CMP_PV>148000</CMP_PV>
<CMP_VALROLE>129400</CMP_VALROLE>
<CMP_PVRESECART>4790</CMP_PVRESECART>
<CMP_PVRHAB>101778.01769911509</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>148000</CMP_PVA>
</ROW>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6235</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>76.92307692307692</CMP_INDICESELECTION>
<CMP_PVRES>117800</CMP_PVRES>
<CMP_PVAJUSTE>118080</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>118080</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>118080</CMP_PVAJUSTEMAX>
<CMP_PV>172000</CMP_PV>
<CMP_VALROLE>134800</CMP_VALROLE>
<CMP_PVRESECART>0</CMP_PVRESECART>
<CMP_PVRHAB>147180</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>172000</CMP_PVA>
</ROW>
</ROWSET>
PARITOP_COMPARABLE TABLE :
RST_ID NUMBER(10) NOT NULL,
VEN_ID NUMBER(10) NOT NULL,
CMP_SELMAN NUMBER(1) NOT NULL,
CMP_UTILISE NUMBER(1) NOT NULL,
CMP_INDICESELECTION FLOAT(53) NOT NULL,
CMP_PVRES FLOAT(53) NULL,
CMP_PVAJUSTE FLOAT(53) NULL,
CMP_PVRHAB FLOAT(53) NULL,
CMP_TVM FLOAT(53) NULL
ROCEDURE PARITOP_INSERTXML (xmlDoc IN clob, tableName IN VARCHAR2)
AS
insCtx DBMS_XMLSave.ctxType;
rowss number;
BEGIN
--permet d'insérer les champs du XML dans la table passée en paramètre.
--il suffit que les champs XML aient le même nom que les champs de la table
BEGIN
insCtx := DBMS_XMLSave.newContext(tableName); -- get context handle
DBMS_XMLSAVE.SETDATEFORMAT( insCtx, 'yyyy-MM-dd HH:mm:ss');--attention, case sensitive
DBMS_XMLSAVE.setIgnoreCase(insCtx, 1);
rowss := DBMS_XMLSAVE.INSERTXML(insCtx , xmlDoc);
DBMS_XMLSave.closeContext(insCtx);
EXCEPTION
[â¦]
END;
END;
PROCEDURE PARITOP_ADDNODETOROW (
XMLDOMDOC DBMS_XMLDOM.DOMDOCUMENT,
NODE_ROW dbms_xmldom.DOMNode,
NOM_NOEUD VARCHAR2,
VALEUR_NOEUD VARCHAR2)
AS
--PERMET D'AJOUTER UN NOEUD AVEC 1 SEULE VALEUR DANS une ROW D'UN XML.
--UTILE SURTOUT POUR LES CLÃS ÃTRANGÃRES
domElemAInserer DBMS_XMLDOM.DOMELEMENT;
NODE dbms_xmldom.DOMNode;
NODE_TMP dbms_xmldom.DOMNode;
BEGIN
domElemAInserer := DBMS_XMLDOM.createElement(XMLDOMDOC, NOM_NOEUD) ;
NODE := DBMS_XMLDOM.MAKENODE(domElemAInserer); --cast
NODE := DBMS_XMLDOM.APPENDCHILD(NODE_ROW,NODE);
NODE_TMP := DBMS_XMLDOM.MAKENODE(DBMS_XMLDOM.CREATETEXTNODE(XMLDOMDOC, VALEUR_NOEUD ) );
NODE := DBMS_XMLDOM.APPENDCHILD(NODE,NODE_TMP );
END;Hi Everybody!
I'm working with Oracle 9.2.0.5 on Microsoft Windows Server 2003 Enterprise Edition.
The server (a test server) is a Pentium 4 2.8 GHz, 1GB of RAM.
I use a procedure called PARITOP_TRAITERXMLRESULTMASSE to insert the data contained in the pXMLDOC clob parameter in the table pTABLENAME. (You can see the format of the XML document below). The first step on this procedure is to verify that the XML document is not empty. If not, the procedure needs to add a node in the document, in every <ROW> tag. This added node is named âRST_IDâ. Itâs the foreign key of each record. I can retrieve the value of each <RST_ID> node in an other table in which the data has been previously added (by the calling procedure). When each of the <ROW> elements has been treated, the PARITOP_INSERTXML procedure is called. This procedure uses DBMS_XMLSAVE.INSERTXML to insert the data contained in the XML document in the specified table.
(Below, you can see the code of my procedures.)
With this information, can you tell me why this treatment is very very very slow with a large XML document and how I can improve it?
Thank you for your help!
Anne-Marie
CREATE OR REPLACE PROCEDURE "PARITOP_TRAITERXMLRESULTMASSE" (
pPRC_ID IN PARITOP_PARC.PRC_ID%TYPE,
pRST_MONDE IN PARITOP_RESULTAT.RST_MONDE%TYPE,
pXMLDOC IN CLOB,
pTABLENAME IN VARCHAR2)
AS
Objectif :Insérer le contenu du XML passé en paramètre (pXMLDOC) à la table passée en paramètre (pTABLENAME)
La table passée en paramètre doit être une table ayant comme clé étrangère le champs "RST_ID" .
(Le noeud RST_ID est donc ajouté à tous les document XML. Ce rst_id est
déterminé à partir de la table PARITOP_RESULTAT grâce à pPRC_ID et
pRstMonde fournis en paramètre)
result_doc CLOB;
XMLDOMDOC XDB.DBMS_XMLDOM.DOMDOCUMENT;
NODE_ROWSET DBMS_XMLDOM.DOMNODE;
NODE_ROW DBMS_XMLDOM.DOMNODE;
vUE_ID PARITOP_RESULTAT.UE_ID%TYPE;
vRST_ID PARITOP_RESULTAT.RST_ID%TYPE;
nodeList DBMS_XMLDOM.DOMNODELIST;
BEGIN
BEGIN
vUE_ID := 0;
vRST_ID := 0;
XMLDOMDOC := DBMS_XMLDOM.NEWDOMDOCUMENT(pXMLDOC);
IF NOT GESTXML_PKG.FN_PARITOP_DOCUMENT_IS_NULL(XMLDOMDOC) THEN
NODE_ROWSET := DBMS_XMLDOM.item(DBMS_XMLDOM.GETCHILDNODES (DBMS_XMLDOM.MAKENODE(XMLDOMDOC)),0);
for i in 0..dbms_xmldom.getLength(DBMS_XMLDOM.getchildnodes(NODE_ROWSET))-1 loop
NODE_ROW := DBMS_XMLDOM.ITEM(DBMS_XMLDOM.GETCHILDNODES(NODE_ROWSET), i) ;
nodeList := DBMS_XMLDOM.GETELEMENTSBYTAGNAME(DBMS_XMLDOM.makeelement(NODE_ROW) , 'UE_ID');
IF vUE_ID <> DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0))) THEN
vUE_ID := DBMS_XMLDOM.GETNODEVALUE(DBMS_XMLDOM.GETFIRSTCHILD(DBMS_XMLDOM.ITEM(nodeList, 0)));
--on ramasse le rst_id
SELECT RST_ID INTO vRST_ID
FROM PARITOP_RESULTAT RST
WHERE RST.PRC_ID = pPRC_ID
AND RST.UE_ID = vUE_ID
AND RST.RST_MONDE = pRST_MONDE
AND RST_A_SUPPRIMER = 0;
END IF;
GESTXML_PKG.PARITOP_ADDNODETOROW(XMLDOMDOC, NODE_ROW, 'RST_ID', vRST_ID);
end loop;
RESULT_DOC := ' '; --Ã garder, pour ne pas que ca fasse d'erreur lors du WriteToClob.
dbms_xmldom.writeToClob(DBMS_XMLDOM.MAKENODE(XMLDOMDOC), RESULT_DOC);
--Insertion du document XML dans la table "tableName"
GESTXML_PKG.PARITOP_INSERTXML(RESULT_DOC, pTABLENAME);
DBMS_XMLDOM.FREEDOCUMENT( XMLDOMDOC);
end if;
EXCEPTION
[â¦exception treatementâ¦]
END;
END;
The format of a XML clob is :
<ROWSET>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6223</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>92.307692307692307</CMP_INDICESELECTION>
<CMP_PVRES>94900</CMP_PVRES>
<CMP_PVAJUSTE>72678.017699115066</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>72678.017699115095</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>72678.017699115037</CMP_PVAJUSTEMAX>
<CMP_PV>148000</CMP_PV>
<CMP_VALROLE>129400</CMP_VALROLE>
<CMP_PVRESECART>4790</CMP_PVRESECART>
<CMP_PVRHAB>101778.01769911509</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>148000</CMP_PVA>
</ROW>
<ROW>
<PRC_ID>193</PRC_ID>
<UE_ID>8781</UE_ID>
<VEN_ID>6235</VEN_ID>
<RST_MONDE>0</RST_MONDE>
<CMP_SELMAN>0</CMP_SELMAN>
<CMP_INDICESELECTION>76.92307692307692</CMP_INDICESELECTION>
<CMP_PVRES>117800</CMP_PVRES>
<CMP_PVAJUSTE>118080</CMP_PVAJUSTE>
<CMP_PVAJUSTEMIN>118080</CMP_PVAJUSTEMIN>
<CMP_PVAJUSTEMAX>118080</CMP_PVAJUSTEMAX>
<CMP_PV>172000</CMP_PV>
<CMP_VALROLE>134800</CMP_VALROLE>
<CMP_PVRESECART>0</CMP_PVRESECART>
<CMP_PVRHAB>147180</CMP_PVRHAB>
<CMP_UTILISE>1</CMP_UTILISE>
<CMP_TVM>1</CMP_TVM>
<CMP_PVA>172000</CMP_PVA>
</ROW>
</ROWSET>
PARITOP_COMPARABLE TABLE :
RST_ID NUMBER(10) NOT NULL,
VEN_ID NUMBER(10) NOT NULL,
CMP_SELMAN NUMBER(1) NOT NULL,
CMP_UTILISE NUMBER(1) NOT NULL,
CMP_INDICESELECTION FLOAT(53) NOT NULL,
CMP_PVRES FLOAT(53) NULL,
CMP_PVAJUSTE FLOAT(53) NULL,
CMP_PVRHAB FLOAT(53) NULL,
CMP_TVM FLOAT(53) NULL
ROCEDURE PARITOP_INSERTXML (xmlDoc IN clob, tableName IN VARCHAR2)
AS
insCtx DBMS_XMLSave.ctxType;
rowss number;
BEGIN
--permet d'insérer les champs du XML dans la table passée en paramètre.
--il suffit que les champs XML aient le même nom que les champs de la table
BEGIN
insCtx := DBMS_XMLSave.newContext(tableName); -- get context handle
DBMS_XMLSAVE.SETDATEFORMAT( insCtx, 'yyyy-MM-dd HH:mm:ss');--attention, case sensitive
DBMS_XMLSAVE.setIgnoreCase(insCtx, 1);
rowss := DBMS_XMLSAVE.INSERTXML(insCtx , xmlDoc);
DBMS_XMLSave.closeContext(insCtx);
EXCEPTION
[â¦]
END;
END;
PROCEDURE PARITOP_ADDNODETOROW (
XMLDOMDOC DBMS_XMLDOM.DOMDOCUMENT,
NODE_ROW dbms_xmldom.DOMNode,
NOM_NOEUD VARCHAR2,
VALEUR_NOEUD VARCHAR2)
AS
--PERMET D'AJOUTER UN NOEUD AVEC 1 SEULE VALEUR DANS une ROW D'UN XML.
--UTILE SURTOUT POUR LES CLÃS ÃTRANGÃRES
domElemAInserer DBMS_XMLDOM.DOMELEMENT;
NODE dbms_xmldom.DOMNode;
NODE_TMP dbms_xmldom.DOMNode;
BEGIN
domElemAInserer := DBMS_XMLDOM.createElement(XMLDOMDOC, NOM_NOEUD) ;
NODE := DBMS_XMLDOM.MAKENODE(domElemAInserer); --cast
NODE := DBMS_XMLDOM.APPENDCHILD(NODE_ROW,NODE);
NODE_TMP := DBMS_XMLDOM.MAKENODE(DBMS_XMLDOM.CREATETEXTNODE(XMLDOMDOC, VALEUR_NOEUD ) );
NODE := DBMS_XMLDOM.APPENDCHILD(NODE,NODE_TMP );
END; -
RE: (forte-users) XML Parser - Reading an XML document intothe Document
Hi Laks
Here is an example of converting a XML doc to a DOM object.
The method is ParseXML(pXMLString:TextData, pListType:CSAListInterface).
Hope this helps.
Argyris Simakis
Corporate Services Applications ITB
Sydney AUSTRALIA
-----Original Message-----
From: Narayanan, Lakshmi [mailto:lnarayanoxhp.com]
Sent: Thursday, April 06, 2000 8:31 AM
To: 'kamranaminyahoo.com'
Subject: (forte-users) XML Parser - Reading an XML document into the
Document Object
Importance: High
Hi guys,
I have been trying to read an XML file and feed it into the XMLParser.
I have read about the DOM API, and i can work with the DOM API in java
scripts. How
will i play with it in TOOL implementation of DOM API. Can anyone guide me
in this
process.
Thanks for your help.
Laks
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.comHi Laks
Here is an example of converting a XML doc to a DOM object.
The method is ParseXML(pXMLString:TextData, pListType:CSAListInterface).
Hope this helps.
Argyris Simakis
Corporate Services Applications ITB
Sydney AUSTRALIA
-----Original Message-----
From: Narayanan, Lakshmi [mailto:lnarayanoxhp.com]
Sent: Thursday, April 06, 2000 8:31 AM
To: 'kamranaminyahoo.com'
Subject: (forte-users) XML Parser - Reading an XML document into the
Document Object
Importance: High
Hi guys,
I have been trying to read an XML file and feed it into the XMLParser.
I have read about the DOM API, and i can work with the DOM API in java
scripts. How
will i play with it in TOOL implementation of DOM API. Can anyone guide me
in this
process.
Thanks for your help.
Laks
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com -
RE: (forte-users) XML Parser - Reading an XML document intothe D ocumen
Hi Simakis,
Your attachments explained the exact start i was looking for.
Thanks a lot for sharing.
Thanks
Laks
-----Original Message-----
From: Simakis, Argyris [mailto:Argyris.Simakisdet.nsw.edu.au]
Sent: Thursday, April 06, 2000 12:35 AM
To: 'Narayanan, Lakshmi'
Cc: 'kamranaminyahoo.com'
Subject: RE: (forte-users) XML Parser - Reading an XML document into the
D ocument Object
Hi Laks
Here is an example of converting a XML doc to a DOM object.
The method is ParseXML(pXMLString:TextData, pListType:CSAListInterface).
Hope this helps.
Argyris Simakis
Corporate Services Applications ITB
Sydney AUSTRALIA
-----Original Message-----
From: Narayanan, Lakshmi [mailto:lnarayanoxhp.com]
Sent: Thursday, April 06, 2000 8:31 AM
To: 'kamranaminyahoo.com'
Subject: (forte-users) XML Parser - Reading an XML document into the
Document Object
Importance: High
Hi guys,
I have been trying to read an XML file and feed it into the XMLParser.
I have read about the DOM API, and i can work with the DOM API in java
scripts. How
will i play with it in TOOL implementation of DOM API. Can anyone guide me
in this
process.
Thanks for your help.
Laks
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.comHi Simakis,
Your attachments explained the exact start i was looking for.
Thanks a lot for sharing.
Thanks
Laks
-----Original Message-----
From: Simakis, Argyris [mailto:Argyris.Simakisdet.nsw.edu.au]
Sent: Thursday, April 06, 2000 12:35 AM
To: 'Narayanan, Lakshmi'
Cc: 'kamranaminyahoo.com'
Subject: RE: (forte-users) XML Parser - Reading an XML document into the
D ocument Object
Hi Laks
Here is an example of converting a XML doc to a DOM object.
The method is ParseXML(pXMLString:TextData, pListType:CSAListInterface).
Hope this helps.
Argyris Simakis
Corporate Services Applications ITB
Sydney AUSTRALIA
-----Original Message-----
From: Narayanan, Lakshmi [mailto:lnarayanoxhp.com]
Sent: Thursday, April 06, 2000 8:31 AM
To: 'kamranaminyahoo.com'
Subject: (forte-users) XML Parser - Reading an XML document into the
Document Object
Importance: High
Hi guys,
I have been trying to read an XML file and feed it into the XMLParser.
I have read about the DOM API, and i can work with the DOM API in java
scripts. How
will i play with it in TOOL implementation of DOM API. Can anyone guide me
in this
process.
Thanks for your help.
Laks
For the archives, go to: http://lists.xpedior.com/forte-users and use
the login: forte and the password: archive. To unsubscribe, send in a new
email the word: 'Unsubscribe' to: forte-users-requestlists.xpedior.com -
Bulk Loader Program to load large xml document
I am looking for a bulk loader database program that will load a very large xml document. The simple bulk loader application available on the oracle site will not load this document due to its size which is approximately 20MG. Please advise asap. Thank you.
From the above document:
Storing XML Data Across Tables
Question
Can XML- SQL Utility store XML data across tables?
Answer
Currently XML-SQL Utility (XSU) can only store to a single table. It maps a canonical representation of an XML document into any table/view. But of course there is a way to store XML with the XSU across table. One can do this using XSLT to transform any document into multiple documents and insert them separately. Another way is to define views over multiple tables (object views if needed) and then do the inserts ... into the view. If the view is inherently non-updatable (because of complex joins, ...), then one can use INSTEAD-OF triggers over the views to do the inserts.
-- I've tried this, works fine. -
XMLTYPE as CLOB storage "inserting large xml document in xml type column"
Hi All,
i have a table containing an xml datatype(non schema based)
i would like to insert a large xml document in it
but an exception is thrown-->"string literal too long"
i tried to use bind variables as a solution"prepared statements as i write in java"
but it didn't work....as xml document is large
when i tried to change the column type to CLOB,it worked but without xml validataion,
although the xml type is mapped to a CLOB in storage, xml type couldn't insert the document
if anyone have a solution plz tell,i needed it urgently
thanks,in advance :-)thx it was very useful :-)
but i am not having any success getting the following statement working using a JDBC connection pool rather than a hard coded URL connection
tempClob = CLOB.createTemporary(conn, true, CLOB.DURATION_SESSION);
it works with:
"jdbc:oracle:thin:@server:port:dbname"
Does NOT work with:
datasource.getConnection()
if anyone colud help... -
Parsing the large XML ( 1GB) using SAX PARSER
We have very large XMLs being generated by processes. These XMLs should be validated first and then parsed next. We have implementation that works for small files. My question is
how can we validate and parse large XMLs with SAX parser?The same way as parsing a small XML file, no? Why don't you try it? Then if you have problems that you can't solve, ask about them here.
-
Best parser for handling very large XML document
which is the best parser whenread and extract information from very large XML document
Any SAX-parser, since DOM would use 6 times as much primary memory as the file-size.
Xerces SAX-parser is in my experience the fastest.
Gil -
Parse and output XML document while preserving attribute order
QUESTION: How can I take in an element with attributes from an XML and output the same element and attributes while preserving the order of those attributes?
The following code will parse and XML document and generate (practically) unchanged output. However, all attributes are ordered a-z
Example: The following element
<work_item_type work_item_db_site="0000000000000000" work_item_db_id="0" work_item_type_code="3" user_tag_ident="Step" name="Work Step" gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_site="0000000000000000" last_upd_db_id="0" rstat_type_code="1">
</work_item_type>is output as:
<work_item_type gmt_last_updated="2008-12-31T18:00:00.000000000" last_upd_db_id="0" last_upd_db_site="0000000000000000" name="Work Step" rstat_type_code="1" user_tag_ident="Step" work_item_db_id="0" work_item_db_site="0000000000000000" work_item_type_code="3">
</work_item_type>As you may notice, there is no difference in these besides order of the attributes!
I am convened that the problem is not in the stylesheet.xslt but if you are not then it is posted bellow.
Please, someone help me out with this! I have a feeling the solution is simple
The following take the XML from source.xml and outputs it to DEST_filename with attributes in a-z order
Code:
private void OutputFile(String DEST_filename, String style_filename){
//StreamSource stylesheet = new StreamSource(style_filename);
try{
File dest_file = new File(DEST_filename);
if(!dest_file.exists())
dest_file.createNewFile();
TransformerFactory tranFactory = TransformerFactory.newInstance();
Transformer aTransformer = tranFactory.newTransformer();
aTransformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
Source src = new DOMSource("source.xml");
Result dest = new StreamResult(dest_file);
aTransformer.transform(src, dest);
System.out.println("Finished");
catch(Exception e){
System.err.print(e);
System.exit(-1);
}You can't. The reason is, the XML Recommendation explicitly says the order of attributes is not significant. Therefore conforming XML serializers won't treat it as if it were significant.
If you have an environment where you think that the order of attributes is significant, your first step should be to reconsider. Possibly it isn't really significant and you are over-reaching in some way. Or possibly someone writing requirements is ignorant of this fact and the requirement can be discarded.
Or possibly your output is being given to somebody else who has a defective parser which expects the attributes to be in a particular order. You could quote the XML Recommendation to those people but often XML bozos are resistant to change. If you're stuck writing for that parser then you'll have to apply some non-XML processing to your output to fix it up on their behalf. -
How to parse XML document returned by webservices
Hi,
I have a form (version 10.1.2.0) which has to display the credit card types using webservices. I created the webstub and jar file through jdeveloper and then after adding the jar files in the respective classpaths, I import it in the forms. I write the code in when-button-pressed and it gives the result in xml document like this:
<?xml version="1.0" encoding="UTF-8"?><WSAnswerTO><error>false</error><errorMessage></errorMessage><
results><CardTypeTO><carTypId>3</carTypId><type>AMERICAN
EXPRESS</type><numLength>15</numLength><cvvLength>4</cvvLength><comments>1 800-639-0002</comments></CardTypeTO><CardTypeTO><carTypId>4</carTypId><type>DISCOVER</type><numLength>16</numLength><cvvLength>3</cvvLength><comments>1 800-347-2683</comments></CardTypeTO><CardTypeTO><carTypId>1</carTypId><type>MASTERCARD</type><numLength>16</numLength><cvvLength>3</cvvLength><comments>1 800-633-7367</comments></CardTypeTO><CardTypeTO><carTypId>2</carTypId><type>VISA</type><numLength>16</numLength><cvvLength>3</cvvLength><comments>1 800-945-2000</comments></CardTypeTO></results></WSAnswerTO>
From the above xml document, I only need to display the type (such as AMERICAN EXPRESS, VISA, ETC) in my forms. Can somebody please tell me how to do it. Do I need to store the values in a table first and then retrieve it. Please advise. I have already read a otn document in xml parsing but I didnt understand anything from it.
Please help. Thanks in advance.Hello,
It probably exists a database package/function to parse this kind of stuff.
If you want to keep the process into the Forms, here is a PL/SQL package you can use:
CREATE OR REPLACE PACKAGE Pkg_Tools AS
-- Types --
-- table of strings --
TYPE TYP_TAB_CHAR IS TABLE OF VARCHAR2(4000) INDEX BY BINARY_INTEGER;
-- Methodes --
-- function that return all contents for a given XML tag --
FUNCTION Get_Xml_Tag
PC$XmlContent IN VARCHAR2, -- XML string
PC$Tag IN VARCHAR2, -- searched tag
PC$NewLine IN VARCHAR2 DEFAULT CHR(10) -- defaull NL character
RETURN TYP_TAB_CHAR ;
END Pkg_Tools;
CREATE OR REPLACE PACKAGE BODY Pkg_Tools
IS
-- fonction de retour du contenu d'une balise XML --
FUNCTION Get_Xml_Tag
PC$XmlContent IN VARCHAR2, -- contenu XML
PC$Tag IN VARCHAR2, -- tag recherche
PC$NewLine IN VARCHAR2 DEFAULT CHR(10) -- defaull NL character
RETURN TYP_TAB_CHAR
IS
TC$Table TYP_TAB_CHAR ;
LC$Ligne VARCHAR2(32000) ;
LC$Xml VARCHAR2(32000) ;
LN$INDEX PLS_INTEGER := 0 ;
LN$TagDeb PLS_INTEGER ;
LN$TagFin PLS_INTEGER ;
LN$TagLength PLS_INTEGER ;
LN$LigLength PLS_INTEGER ;
LN$Occur PLS_INTEGER := 1 ;
BEGIN
IF ( PC$XmlContent IS NOT NULL AND PC$Tag IS NOT NULL ) THEN
LC$Xml := REPLACE( PC$XmlContent, CHR(13), '' ) ;
LN$TagLength := LENGTH( PC$Tag ) ;
LOOP
LN$TagDeb := INSTR( LC$Xml, PC$Tag, 1, LN$Occur ) ;
LN$TagFin := INSTR( LC$Xml, '</' || SUBSTR(PC$Tag,2, 256), 1, LN$Occur ) ;
LN$LigLength := (LN$TagFin - ( LN$TagDeb + LN$TagLength ) ) ;
IF (LN$TagDeb > 0 AND LN$TagFin > 0 ) THEN
LN$Occur := LN$Occur + 1 ;
LC$Ligne := SUBSTR( LC$Xml, LN$TagDeb + LN$TagLength, LN$LigLength ) ;
LOOP
LN$INDEX := LN$INDEX + 1 ;
LN$TagDeb := INSTR( LC$Ligne, PC$NewLine ) ;
IF LN$TagDeb > 0 THEN
IF Trim( SUBSTR( LC$Ligne, 1, LN$TagDeb - 1 )) IS NOT NULL THEN
TC$Table(LN$INDEX) := SUBSTR( LC$Ligne, 1, LN$TagDeb - 1 ) ;
ELSE
LN$INDEX := LN$INDEX - 1 ;
END IF ;
LC$Ligne := SUBSTR( LC$Ligne, LN$Tagdeb + LENGTH( PC$NewLine ), 30000 ) ;
ELSE
IF Trim(LC$Ligne) IS NOT NULL THEN
TC$Table(LN$INDEX) := LC$Ligne ;
END IF ;
EXIT ;
END IF ;
END LOOP ;
ELSE
EXIT ;
END IF ;
END LOOP ;
END IF ;
RETURN TC$Table ;
END Get_Xml_Tag ;
END Pkg_Tools;
/Then the call:
DECLARE
LC$t VARCHAR2(2000);
LT$Table Pkg_Tools.TYP_TAB_CHAR ;
BEGIN
lc$t := '<?xml version="1.0" encoding="UTF-8"?><WSAnswerTO><error>false</error><errorMessage></errorMessage><results>'
||'<CardTypeTO><carTypId>3</carTypId><TYPE>AMERICAN EXPRESS</TYPE><numLength>15</numLength><cvvLength>4</cvvLength>'
||'<comments>1 800-639-0002</comments></CardTypeTO><CardTypeTO><carTypId>4</carTypId><TYPE>DISCOVER</TYPE>'
||'<numLength>16</numLength><cvvLength>3</cvvLength><comments>1 800-347-2683</comments></CardTypeTO>'
||'<CardTypeTO><carTypId>1</carTypId><TYPE>MASTERCARD</TYPE><numLength>16</numLength><cvvLength>3</cvvLength>'
||'<comments>1 800-633-7367</comments></CardTypeTO><CardTypeTO><carTypId>2</carTypId><TYPE>VISA</TYPE>'
||'<numLength>16</numLength><cvvLength>3</cvvLength><comments>1 800-945-2000</comments></CardTypeTO></results></WSAnswerTO>' ;
LT$Table := Pkg_Tools.Get_Xml_Tag(LC$T,'<TYPE>') ;
IF LT$Table.COUNT > 0 THEN
FOR i IN LT$Table.First .. LT$Table.Last LOOP
dbms_output.put_line( 'Table(' || i || ')=' || LT$Table(i) ) ;
END LOOP ;
ELSE
dbms_output.put_line( 'tag xml not found' ) ;
END IF ;
END;Francois -
We are using Oracle's XSQL servlet engine 9.0.2.0.0A to query an Oracle Database using xsql:include-owa. This xsql document uses a custom serializer to write the resulting XML to a file on the webserver. We have run into a problem with writing XML documents larger than approximatly 7MB. The file is written but just contains a Malformed XML Document error. We have tried tracking down the problem and it seems to be occuring before the custom serializer is given control of the document. Attached below is the xsql document and the Java source of our serializer if it would be of any help.
-Eric Dalquist
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="simple_transform_xml.xsl" serializer="XMLWriter"?>
<BASE_TAG connection="XXXXXXXX" xmlns:xsql="urn:oracle-xsql">
<xsql:set-page-param name="save-file" value="XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/applInfo.xml"/>
<xsql:include-owa >
STUDEV.STUADMSDSET.P_GET_RECRUIT_INFO('A','C');
</xsql:include-owa>
</BASE_TAG>-----------------------------------------
* Author: Eric Dalquist
* E-Mail: [email protected]
* Date Created: 10-03-2001
* Last Modified: 10-03-2001
* Modified By: Eric Dalquist
* Description: This class writes out the contents of the final document produced by the xsql servlet.
package com.mtu.XSQLSerializers;
import java.io.FileOutputStream;
import oracle.xml.xsql.*;
import oracle.xml.parser.v2.XMLDocument;
import org.w3c.dom.Document;
* <P>
* XMLWriter is an implementation of the abstract XSQLDocumentSerializer class. It is passed a refrence to a DOM Document
* and the servlet environment. The XMLWriter takes the document and writes it out to the servlet's output stream. There
* is also the option that the saveFile xsql page parameter can be set to a fully qualified path and file name to write the
* document to.
* </P>
* <P>
* Here is an example of setting the saveFile page paramter. This line would be the first tag inside the root xsql servlet tag.
* </P>
* <PRE>
* <xsql:set-page-param name="save-file" value="/u01/oracle/ias10210/xdk/java/xsql/Repository/Course_List/XMLDocument.xml"/>
* </PRE>
* @author Eric B. Dalquist
* @version 1.0 10/03/2001
public class XMLWriter implements XSQLDocumentSerializer
/** the header we send if we are returning XML */
private static final String MIME_XML = "text/xml";
/** the name of the page parameter we look for to get the path and name to save the XML document to */
private static final String ATTR_FILE = "save-file";
* The serialize is called by the servlet engine and is passed the DOM Docuement result
* from the XSLT transformation if there was one and a refrence to the XSQL servlet environment
* @param doc The document representation of the XML output of the xsql servlet.
* @param env A refrence to the servlet's environment.
* @throws Throwable Any unhandled error is handled by the servlet by default.
public void serialize(Document doc, XSQLPageRequest env) throws Throwable
System.out.print("start ... ");
FileOutputStream fos = null;
String reqType = env.getRequestType();
String saveFile = env.getParameter(ATTR_FILE);
if (!reqType.equals("Command Line"))
env.setContentType(MIME_XML);
((XMLDocument)doc).print(env.getOutputStream());
env.getOutputStream().close();
if (saveFile != null && !saveFile.equals("") && saveFile.indexOf("..") == -1 && saveFile.indexOf("~") == -1)
fos = new FileOutputStream(saveFile);
((XMLDocument)doc).print(fos);
fos.close();
System.gc();
System.out.println("end");
}Technically DBMS_XMLSAVE and it's alter ego DBMS_XMLQUERY are not considered part of XML DB. DBMS_XMLSAVE and DBMS_XMLQUERY are legacy Java implementations.
In 9.2.x these routines were replaced by DBMS_XMLSTORE and DBMS_XMLGEN which are written in 'C' and should be much faster in most cases and address a number of limitations inherant in the older implementations. DBMS_XMLSTORE and DBMS_XMLGEN are part of XML DB and the minimum supported release for XML DB is 9.2.0.3.0.
DBMS_XMLSAVE issues are addressed in the TECH/XML forum
http://forums.oracle.com/forums/category.jspa?categoryID=51 -
Schema Parsing to create xml documents(Urgent)
Hi,
I'm new to XML and need some help for my course project. I need to parse xml schema and get the values of element name, attributes etc so that user can input values to create xml documents. Also I need to write a code that extracts the schema once the user selects schema of his choice. So its basically I need to provide dynamic interface for user to input values based on various schema.
It would be helpful if some advices me or let me know where I can proceed.
Thanx
swethaHello Swetha,
If you choose an XML binding technology go with JAXB 2.0. This is an industry standard included in Java since Java SE 6. Oracle offers a JAXB implementation as part of the TopLink product see the latest tech preview), and has recently open sourced it through Eclipse (Eclipse Persistence Services or EclipseLink). EclipseLink/TopLink offers features beyond what is available in standard JAXB that you may need.
TopLink object-to-XML/JAXB:
http://www.oracle.com/technology/products/ias/toplink/oxm/index.html
EclipseLink:
http://www.eclipse.org/eclipselink/
http://wiki.eclipse.org/EclipseLink
You may also consider using SDO. SDO can be viewed as a dynamic object model, the metadata can be loaded from XML Schemas (even the XML Schema for XML Schema). TopLink & EclipseLink include SDO implementations. The dynamic model is very rich in metadata which may be useful to you in creating a dynamic interface. For more information on SDO see:
http://www.osoa.org/display/Main/Service+Data+Objects+Specifications
If you are interested in the SDO approach post back, and I can provide more details.
-Blaise -
Performance issues with FDK in large XML documents
In my current project with FrameMaker 8 I'm experiencing severe performance issues with some FDK API calls.
The documents are about 3-8 MBytes in size. Fortmatted they cover 150-250 pages.
When importing such an XML document I do some extensive "post-processing" using FDK. This processing happens in Sr_EventHandler() during the SR_EVT_END_READER event. I noticed that some FDK functions calls which modify the document's structure, like F_ApiSetAttribute() or F_ApiNewElementInHierarchy(), take several seconds, for the larger documents even minutes, to complete one single function call. I tried to move some of these calls to earlier events, mostly to SR_EVT_END_ELEM. There the calls work without a delay. Unfortunately I can't rewrite the FDK client to move all the calls that are lagging to earlier events.
Does anybody have a clue why such delays happen, and possibly can make a suggestion, how to solve this issue? Thank you in advance.
PS: I already thought of splitting such a document in smaller pieces by using the FrameMaker book function. But I don't think, the structure of the documents will permit such an automatic split, and it definitely isn't an option to change the document structure (the project is about migrating documents from Interleaf to XML with the constraint of keeping the document layout identical).FP_ApplyFormatRules sounds really good--I'll give it a try on Monday. Wonder how I could miss it, as I already tried FP_Reformatting and FP_Displaying at no avail?! By the way, what is actually meant with FP_Reformatting (when I used it I assumed it would do exactly what FP_ApplyFormatRules sounds to do), or is that one another of Lynne's well-kept secrets?
Thank's for all the helpful suggestions, guys. On Friday I already had my first improvements in a test version of my client: I did some (not all necessary) structural changes using XSLT pre-processing, and processing went down from 8 hours(!) to 1 hour--Yeappie! I was also playing with the idea of writing a wrapper to F_ApiNewElementInHierarchy() which actually pastes an appropriate element created in a small flow on the reference pages at the intended insertion location. But now, with FP_ApplyFormatRules on the horizon, I'm quite confident to get even the complicated stuff under control, which cannot be handled by the XSLT pre-processing, as it is based on the actual formatting of the document at run-time and cannot be anticipated in pre-processing.
--Franz
Maybe you are looking for
-
Need a little help with this code
Hi, right now I'm going through the xmlmenu tutorial, which I've found at kirupa.com. It's pretty much clear to me. Then I decided to try to import a blur filter. And as soon as I wright the import flash.filter line, I get a syntax error. Where is th
-
Can I get some help with CF8 and Unix from this forum?
I did my dev in my local machine running windowsXP and CF8 In prod. environment, my CF8 runs in Unix and I'm not familiar with Unix at all. My manager is out for awhile and I want to do this if I could without waiting for him because in windows it is
-
Apex 3.2 - Global notification message
How can I restrict global notification message which can be specified at shared components --> Definition --> Global Notification to home page only. i.e. to display on a specific page(s) only. Thanks in advance - Chan
-
Slow report performance when filter by 1 date
Post Author: poh_michelle CA Forum: Formula Record selection formula : {PartTran.TransDate} in {?FromDate} to {?ToDate} Report performance was okay when i select #08/10/2007# for {?FromDate} and #10/10/2007# fro ; report displayed within 5 seconds.Ho
-
Zen Accessories, good or bad? need help with charg
I recently bought a creative Zen 4Gb player( the one that's the size of a credit card) .. [well long story short, i bought 3 and this ones finally working!!]and i bought a Plug-In Charger for it online, are these good Will they overcharge the player