87: ) AS
88: l_api_name VARCHAR2(30) := 'DOWNLOAD_PRE_PROCESSOR';
89: p_document_xml CLOB;
90: l_doc_clob CLOB;
91: l_doc_XML XMLType;
92: l_art_XML XMLType;
93: l_xpath_clause_elem VARCHAR2(1000);
94: l_xpath_temp VARCHAR2(1000);
95:
88: l_api_name VARCHAR2(30) := 'DOWNLOAD_PRE_PROCESSOR';
89: p_document_xml CLOB;
90: l_doc_clob CLOB;
91: l_doc_XML XMLType;
92: l_art_XML XMLType;
93: l_xpath_clause_elem VARCHAR2(1000);
94: l_xpath_temp VARCHAR2(1000);
95:
96: l_i NUMBER := 1;
117:
118: l_progress := 010;
119:
120: p_document_xml := regexp_replace(p_document_xml,'&','~');
121: l_doc_xml := xmltype(p_document_xml);
122:
123: --Initialize the xpaths
124: l_xpath_clause_elem := '//SectionsArticlesToPrintVORow['||to_char(l_i)||']';
125:
129: ##ARTICLEWML##
130: if (l_doc_xml.extract(l_xpath_temp) IS NOT NULL) then
131: l_art_XML := l_doc_xml.extract(l_xpath_temp);
132: l_xpath_temp := l_xpath_clause_elem||'/ArticleText[1]';
133: l_art_xml := xmltype('
134: select updateXML(l_doc_xml,l_xpath_temp,l_art_xml) into l_doc_xml FROM dual;
135: /*ELSE
136: l_xpath_temp := l_xpath_clause_elem||'/ArticleText[1]';
137: select updateXML(l_doc_xml,l_xpath_temp,'
197:
198: l_api_name VARCHAR2(30) := 'DOWNLOAD_POST_PROCESSOR';
199: p_document_xml CLOB;
200: l_doc_clob CLOB;
201: l_doc_XML XMLType;
202: l_art_XML XMLType;
203: l_var_XML XMLType;--Contains all variables in doc xml
204: l_xpath_clause_elem VARCHAR2(1000);
205: l_xpath_temp VARCHAR2(1000);
198: l_api_name VARCHAR2(30) := 'DOWNLOAD_POST_PROCESSOR';
199: p_document_xml CLOB;
200: l_doc_clob CLOB;
201: l_doc_XML XMLType;
202: l_art_XML XMLType;
203: l_var_XML XMLType;--Contains all variables in doc xml
204: l_xpath_clause_elem VARCHAR2(1000);
205: l_xpath_temp VARCHAR2(1000);
206: l_clob_temp CLOB;
199: p_document_xml CLOB;
200: l_doc_clob CLOB;
201: l_doc_XML XMLType;
202: l_art_XML XMLType;
203: l_var_XML XMLType;--Contains all variables in doc xml
204: l_xpath_clause_elem VARCHAR2(1000);
205: l_xpath_temp VARCHAR2(1000);
206: l_clob_temp CLOB;
207: l_i NUMBER := 1;
219:
220: l_listdefCount number;
221: l_listilfocount number;
222:
223: l_doc_xml_upd XMLType;
224:
225: l_clause_temp CLOB;
226:
227: n number;
258: -- Replace w:list with wlist
259: l_doc_clob := regexp_replace(p_document_xml,'w:list','wlist');
260:
261: -- Convert the clob into XML for XML Processing
262: l_doc_xml := XMLType(l_doc_clob);
263:
264: --Initialize the xpaths
265: l_xpath_clause_elem := '//ClauseTag['||to_char(l_i)||']';
266:
271: -- Get the Cat ID (OKC_K_ARTICLES_B.ID)
272: l_article_id := l_doc_xml.extract(l_xpath_clause_elem||'/@CatId').getNumberVal();
273:
274: --Get Article sub elements
275: l_var_XML := Xmltype('
276:
277: l_progress := '040';
278: --Get the clause text from individual clauses Word doc.
279: select VER.INSERT_BY_REFERENCE,VER.REFERENCE_TEXT,VER.article_text_in_word
290: END IF;
291:
292: --make the list related attributes as unique by appending the position no
293: --w:listDefId="[[:digit:]]{1}" ,w:ilfo="[[:digit:]]{1}",w:ilst w:val="[[:digit:]]{1}" & w:ilfo w:val="[[:digit:]]{1}"
294: if (xmltype(l_clob_temp).existsnode('/SOMETAG/wlists') > 0) then
295: l_list_prefix := l_i+1000;
296: --Remove previously added prefix.
297: /*l_clob_temp := regexp_replace(l_clob_temp,'w:listDefId="([[:digit:]]{4})','w:listDefId="');
298: l_clob_temp := regexp_replace(l_clob_temp,'w:ilfo="([[:digit:]]{4})','w:ilfo="');
305: l_clob_temp := regexp_replace(l_clob_temp,'w:ilfo w:val="([[:digit:]]{1})','w:ilfo w:val="'||to_char(l_list_prefix)||'\1');
306: end if;
307:
308: -- Get the article Body text
309: l_art_XML := xmltype(l_clob_temp).extract('/SOMETAG/wbody/*');
310:
311: l_progress := '050';
312: -- Resolve the Variables
313: l_art_XML := OKC_WORD_DOWNLOAD_UPLOAD.resolve_variables_download(l_art_XML,l_var_XML);
314: -- Store the resolved clause in a pl/sql table.
315: l_art_body_tbl(l_i) := '
316:
317:
318: if (xmltype(l_clob_temp).existsnode('//wlists') > 0) then
319:
320: select deleteXML(XMLType(l_clob_temp),'//wlistDef//wlsid').getClobVal() into l_clob_temp from dual;
321: l_doc_listdef_clob := l_doc_listdef_clob || xmltype(l_clob_temp).extract('//wlistDef').getClobVal();
322: l_doc_list_clob := l_doc_list_clob || xmltype(l_clob_temp).extract('//wlist').getClobVal();
316:
317:
318: if (xmltype(l_clob_temp).existsnode('//wlists') > 0) then
319:
320: select deleteXML(XMLType(l_clob_temp),'//wlistDef//wlsid').getClobVal() into l_clob_temp from dual;
321: l_doc_listdef_clob := l_doc_listdef_clob || xmltype(l_clob_temp).extract('//wlistDef').getClobVal();
322: l_doc_list_clob := l_doc_list_clob || xmltype(l_clob_temp).extract('//wlist').getClobVal();
323:
324: end if;
317:
318: if (xmltype(l_clob_temp).existsnode('//wlists') > 0) then
319:
320: select deleteXML(XMLType(l_clob_temp),'//wlistDef//wlsid').getClobVal() into l_clob_temp from dual;
321: l_doc_listdef_clob := l_doc_listdef_clob || xmltype(l_clob_temp).extract('//wlistDef').getClobVal();
322: l_doc_list_clob := l_doc_list_clob || xmltype(l_clob_temp).extract('//wlist').getClobVal();
323:
324: end if;
325:
318: if (xmltype(l_clob_temp).existsnode('//wlists') > 0) then
319:
320: select deleteXML(XMLType(l_clob_temp),'//wlistDef//wlsid').getClobVal() into l_clob_temp from dual;
321: l_doc_listdef_clob := l_doc_listdef_clob || xmltype(l_clob_temp).extract('//wlistDef').getClobVal();
322: l_doc_list_clob := l_doc_list_clob || xmltype(l_clob_temp).extract('//wlist').getClobVal();
323:
324: end if;
325:
326: l_i := l_i+1;
338: l_progress := '070';
339: -- Clause Processing --serukull changes
340: FOR i IN 1..l_i-1
341: LOOP
342: l_doc_xml := XMLtype.appendChildXML(l_doc_xml,'//ClauseTag['||to_char(i)||']',XMLTYPe(l_art_body_tbl(i)));
343: END LOOP;
344: l_doc_clob := l_doc_xml.getClobVal();
345:
346: l_progress := '80';
425: IF l_return_status <> G_RET_STS_SUCCESS THEN
426: raise_application_error(-20101, 'Error in OKC_WORD_SYNC_HOOK.DOWNLOAD_CONTRACT_EXT',TRUE);
427: END IF;
428: -- code to remove custom tags - start
429: select updateXML(xmltype(l_doc_clob),
430: '//SectionTag/@*','',
431: '//ClauseTag/@*','',
432: '//var/@*',''
433: ).getClobVal() into l_doc_clob from dual;
498: END LOOP;
499:
500:
501: v_clob := regexp_replace(regexp_replace(regexp_replace(v_clob,'w:body','wbody'),'w:list','wlist'),'w:lvlPicBulletId','wlvlPicBulletId');
502: v_clob := '
503: select deleteXML(XMLType(v_clob),'//wlvlPicBulletId').getClobVal() into v_clob from dual;
504:
505: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
506: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT ,
499:
500:
501: v_clob := regexp_replace(regexp_replace(regexp_replace(v_clob,'w:body','wbody'),'w:list','wlist'),'w:lvlPicBulletId','wlvlPicBulletId');
502: v_clob := '
503: select deleteXML(XMLType(v_clob),'//wlvlPicBulletId').getClobVal() into v_clob from dual;
504:
505: IF (FND_LOG.LEVEL_STATEMENT >= FND_LOG.G_CURRENT_RUNTIME_LEVEL) THEN
506: FND_LOG.STRING(FND_LOG.LEVEL_STATEMENT ,
507: G_MODULE||l_api_name,
537: l_api_name VARCHAR2(30) := 'UPLOAD_PRE_PROCESSOR';
538: l_doc_clob CLOB;
539: l_doc_clob1 CLOB;
540: l_doc_blob BLOB;
541: l_doc_xml XMLType;
542: l_doc_xml_temp XMLType;
543: l_doc_placeholder_xml XMLType;
544: l_dummy_article_text XMLType;
545:
538: l_doc_clob CLOB;
539: l_doc_clob1 CLOB;
540: l_doc_blob BLOB;
541: l_doc_xml XMLType;
542: l_doc_xml_temp XMLType;
543: l_doc_placeholder_xml XMLType;
544: l_dummy_article_text XMLType;
545:
546: TYPE id_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
539: l_doc_clob1 CLOB;
540: l_doc_blob BLOB;
541: l_doc_xml XMLType;
542: l_doc_xml_temp XMLType;
543: l_doc_placeholder_xml XMLType;
544: l_dummy_article_text XMLType;
545:
546: TYPE id_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
547: cat_id_tbl id_tbl_type;
540: l_doc_blob BLOB;
541: l_doc_xml XMLType;
542: l_doc_xml_temp XMLType;
543: l_doc_placeholder_xml XMLType;
544: l_dummy_article_text XMLType;
545:
546: TYPE id_tbl_type IS TABLE OF NUMBER INDEX BY BINARY_INTEGER;
547: cat_id_tbl id_tbl_type;
548: cat_id1_tbl id_tbl_type;
588: -- change_encoding
589: l_progress := '030';
590: l_doc_clob := change_encoding(l_doc_clob);
591:
592: -- convert the document to XMLType
593: l_progress := '040';
594: l_doc_xml := xmltype(regexp_replace(l_doc_clob,'w:body','wbody'));
595:
596: -- Get the place holder xml which is used for adding clause text
590: l_doc_clob := change_encoding(l_doc_clob);
591:
592: -- convert the document to XMLType
593: l_progress := '040';
594: l_doc_xml := xmltype(regexp_replace(l_doc_clob,'w:body','wbody'));
595:
596: -- Get the place holder xml which is used for adding clause text
597: l_progress := '050';
598: INSERT INTO okc_word_sync_t (id,doc_id,doc_type,CLOB_data)
599: select 10,p_doc_id,p_doc_type, deleteXML(l_doc_xml,'//wbody/*').getclobVal()
600: from dual;
601:
602:
603: l_doc_xml_temp := XmlType('
604:
605:
606: -- Build Article CLOBs From the Uploaded Document
607: l_progress := '060';
609: LOOP
610: ID_TBL(l_i) := l_i+100;
611: CAT_ID_TBL(l_i) := l_doc_xml_temp.Extract('//ClauseTag['||To_Char(l_i)||']/@CatId').getNumberVal();
612: ART_CLOB_TBL(l_i) := '
613: --ART_CLOB_TBL(l_i) := XMLType.appendChildXML(l_doc_placeholder_xml,'//wbody', l_doc_xml.Extract('//ClauseTag['||To_Char(l_i)||']/ArticleText[1]/*')).GetClobVal();
614:
615: IF (XMLType(ART_CLOB_TBL(l_i)).existsnode('//var')>0) THEN
616: l_progress := '070';
617: ART_CLOB_TBL(l_i) := OKC_WORD_DOWNLOAD_UPLOAD.resolve_variables_upload(ART_CLOB_TBL(l_i));
611: CAT_ID_TBL(l_i) := l_doc_xml_temp.Extract('//ClauseTag['||To_Char(l_i)||']/@CatId').getNumberVal();
612: ART_CLOB_TBL(l_i) := '
613: --ART_CLOB_TBL(l_i) := XMLType.appendChildXML(l_doc_placeholder_xml,'//wbody', l_doc_xml.Extract('//ClauseTag['||To_Char(l_i)||']/ArticleText[1]/*')).GetClobVal();
614:
615: IF (XMLType(ART_CLOB_TBL(l_i)).existsnode('//var')>0) THEN
616: l_progress := '070';
617: ART_CLOB_TBL(l_i) := OKC_WORD_DOWNLOAD_UPLOAD.resolve_variables_upload(ART_CLOB_TBL(l_i));
618: END IF;
619: ART_CLOB_TBL(l_i) := regexp_replace(regexp_replace(ART_CLOB_TBL(l_i),'wbody','w:body'),'
668: AND cat_id=cat_id1_tbl(i);
669: END IF;
670: -- Replace the Article Text with Dummy ARTWML so that the Java Layer Processing becomes lighter.
671: l_progress := '120';
672: l_dummy_article_text := XMLType('
673: SELECT UpdateXML(l_doc_xml,
674: '//ArticleText', l_dummy_article_text
675: )INTO l_doc_xml FROM dual;
676: l_doc_clob:= regexp_replace(regexp_replace(l_doc_xml.getClobVal(),'agsfddfsga','w:'),'wbody','w:body');
714: l_api_name VARCHAR2(30) := 'UPLOAD_POST_PROCESSOR';
715: l_doc_clob CLOB;
716: l_art_clob CLOB;
717: l_clob_temp CLOB;
718: l_art_XML XMLType;
719: l_art_blob BLOB;
720: l_i NUMBER := 1;
721: l_i_var NUMBER := 1;
722: l_xpath VARCHAR2(100);
723: l_xpath1 VARCHAR2(100);
724: l_xpath2 VARCHAR2(100);
725:
726: l_clause_id NUMBER;
727: l_wml_to_html XMLType;
728: t_xml XMLType;
729:
730:
731: CURSOR get_doc_data is
724: l_xpath2 VARCHAR2(100);
725:
726: l_clause_id NUMBER;
727: l_wml_to_html XMLType;
728: t_xml XMLType;
729:
730:
731: CURSOR get_doc_data is
732: SELECT OKC_WORD_DOWNLOAD_UPLOAD.blob_to_clob(FILE_DATA)
762: l_xpath := '//ClauseTag['||to_char(l_i)||']';
763: l_xpath1 := '//ClauseTag['||to_char(l_i)||']/ArticleText[1]/*';
764: l_xpath2 := '//ClauseTag['||to_char(l_i)||']/@CatId';
765:
766: select deleteXML(xmltype(l_doc_clob),'//wbody/*').getClobVal() into l_clob_temp from dual;
767:
768: while ((xmltype(l_doc_clob).existsnode(l_xpath) > 0)) LOOP
769:
770: IF (xmltype(l_doc_clob).extract(l_xpath2).getNumberVal() = p_cat_id) THEN
764: l_xpath2 := '//ClauseTag['||to_char(l_i)||']/@CatId';
765:
766: select deleteXML(xmltype(l_doc_clob),'//wbody/*').getClobVal() into l_clob_temp from dual;
767:
768: while ((xmltype(l_doc_clob).existsnode(l_xpath) > 0)) LOOP
769:
770: IF (xmltype(l_doc_clob).extract(l_xpath2).getNumberVal() = p_cat_id) THEN
771: l_art_XML := xmltype(l_doc_clob).extract(l_xpath1);
772: l_art_CLOB := xmltype.appendChildXML(xmltype(l_clob_temp),'//wbody',l_art_XML).getClobVal();
766: select deleteXML(xmltype(l_doc_clob),'//wbody/*').getClobVal() into l_clob_temp from dual;
767:
768: while ((xmltype(l_doc_clob).existsnode(l_xpath) > 0)) LOOP
769:
770: IF (xmltype(l_doc_clob).extract(l_xpath2).getNumberVal() = p_cat_id) THEN
771: l_art_XML := xmltype(l_doc_clob).extract(l_xpath1);
772: l_art_CLOB := xmltype.appendChildXML(xmltype(l_clob_temp),'//wbody',l_art_XML).getClobVal();
773: EXIT;
774: END IF;
767:
768: while ((xmltype(l_doc_clob).existsnode(l_xpath) > 0)) LOOP
769:
770: IF (xmltype(l_doc_clob).extract(l_xpath2).getNumberVal() = p_cat_id) THEN
771: l_art_XML := xmltype(l_doc_clob).extract(l_xpath1);
772: l_art_CLOB := xmltype.appendChildXML(xmltype(l_clob_temp),'//wbody',l_art_XML).getClobVal();
773: EXIT;
774: END IF;
775:
768: while ((xmltype(l_doc_clob).existsnode(l_xpath) > 0)) LOOP
769:
770: IF (xmltype(l_doc_clob).extract(l_xpath2).getNumberVal() = p_cat_id) THEN
771: l_art_XML := xmltype(l_doc_clob).extract(l_xpath1);
772: l_art_CLOB := xmltype.appendChildXML(xmltype(l_clob_temp),'//wbody',l_art_XML).getClobVal();
773: EXIT;
774: END IF;
775:
776: l_i := l_i+1;
780:
781: END LOOP;
782:
783: --Replace Variable Tags..
784: --while ((xmltype(l_art_CLOB).existsnode('//var[1]') > 0)) LOOP
785: --l_clob_temp :='
786: --select updateXML(xmltype(l_art_CLOB),'//var[1]',xmltype(l_clob_temp).extract('/DUMMY/*')).getClobVal() into l_art_CLOB from dual;
787: -- select updateXML(xmltype(l_art_CLOB),'//var','
788: --l_art_clob := regexp_replace(l_art_clob,'w#','w:');
781: END LOOP;
782:
783: --Replace Variable Tags..
784: --while ((xmltype(l_art_CLOB).existsnode('//var[1]') > 0)) LOOP
785: --l_clob_temp :='
786: --select updateXML(xmltype(l_art_CLOB),'//var[1]',xmltype(l_clob_temp).extract('/DUMMY/*')).getClobVal() into l_art_CLOB from dual;
787: -- select updateXML(xmltype(l_art_CLOB),'//var','
788: --l_art_clob := regexp_replace(l_art_clob,'w#','w:');
789: --END LOOP;
782:
783: --Replace Variable Tags..
784: --while ((xmltype(l_art_CLOB).existsnode('//var[1]') > 0)) LOOP
785: --l_clob_temp :='
786: --select updateXML(xmltype(l_art_CLOB),'//var[1]',xmltype(l_clob_temp).extract('/DUMMY/*')).getClobVal() into l_art_CLOB from dual;
787: -- select updateXML(xmltype(l_art_CLOB),'//var','
788: --l_art_clob := regexp_replace(l_art_clob,'w#','w:');
789: --END LOOP;
790: --l_art_CLOB := regexp_replace(regexp_replace(l_art_CLOB,'','@]');
783: --Replace Variable Tags..
784: --while ((xmltype(l_art_CLOB).existsnode('//var[1]') > 0)) LOOP
785: --l_clob_temp :='
786: --select updateXML(xmltype(l_art_CLOB),'//var[1]',xmltype(l_clob_temp).extract('/DUMMY/*')).getClobVal() into l_art_CLOB from dual;
787: -- select updateXML(xmltype(l_art_CLOB),'//var','
788: --l_art_clob := regexp_replace(l_art_clob,'w#','w:');
789: --END LOOP;
790: --l_art_CLOB := regexp_replace(regexp_replace(l_art_CLOB,'','@]');
791:
945: END INSERT_WML_TEXT;
946:
947:
948:
949: FUNCTION resolve_variables_download(p_art_XML XMLType,p_var_XML XMLType) RETURN XMLType IS
950: l_art_XML XMLType;
951: l_art_clob CLOB;
952: l_xpath VARCHAR2(1000);
953: l_repl_str VARCHAR2(2000);
946:
947:
948:
949: FUNCTION resolve_variables_download(p_art_XML XMLType,p_var_XML XMLType) RETURN XMLType IS
950: l_art_XML XMLType;
951: l_art_clob CLOB;
952: l_xpath VARCHAR2(1000);
953: l_repl_str VARCHAR2(2000);
954: l_var_str VARCHAR2(2000);
987: end loop;
988: l_art_clob := '
989: l_art_clob := regexp_replace(l_art_clob,'agsfddfsga1','[');
990: l_art_clob := regexp_replace(l_art_clob,'agsfddfsga2',']');
991: l_art_XML := XMLType(l_art_clob).extract('/DUMMY/*');
992: return l_art_XML;
993:
994: END resolve_variables_download;
995:
994: END resolve_variables_download;
995:
996:
997: FUNCTION resolve_variables_upload(p_art_CLOB CLOB) RETURN CLOB IS
998: l_art_XML XMLType;
999: l_var_XML XMLType;
1000: l_art_clob CLOB := p_art_CLOB;
1001: l_xpath VARCHAR2(1000);
1002: l_repl_str VARCHAR2(2000);
995:
996:
997: FUNCTION resolve_variables_upload(p_art_CLOB CLOB) RETURN CLOB IS
998: l_art_XML XMLType;
999: l_var_XML XMLType;
1000: l_art_clob CLOB := p_art_CLOB;
1001: l_xpath VARCHAR2(1000);
1002: l_repl_str VARCHAR2(2000);
1003: l_var_str VARCHAR2(2000);
1006: l_xpath1 VARCHAR2(1000);
1007: l_var_type VARCHAR2(1);
1008: BEGIN
1009:
1010: IF (XMLType(l_art_clob).existsnode('//var')>0) THEN
1011: l_art_XML := XMLType(l_art_clob);
1012: l_art_clob := '
1013: l_var_XML := XMLType(l_art_clob);
1014:
1007: l_var_type VARCHAR2(1);
1008: BEGIN
1009:
1010: IF (XMLType(l_art_clob).existsnode('//var')>0) THEN
1011: l_art_XML := XMLType(l_art_clob);
1012: l_art_clob := '
1013: l_var_XML := XMLType(l_art_clob);
1014:
1015: l_xpath := '//var['||to_char(l_i)||']';
1009:
1010: IF (XMLType(l_art_clob).existsnode('//var')>0) THEN
1011: l_art_XML := XMLType(l_art_clob);
1012: l_art_clob := '
1013: l_var_XML := XMLType(l_art_clob);
1014:
1015: l_xpath := '//var['||to_char(l_i)||']';
1016: l_xpath1 := '//var['||to_char(l_i)||']/@type';
1017:
1024: l_var_str := '
1025: ELSE
1026: l_var_str := '
1027: END IF;
1028: SELECT updateXML( l_art_XML,l_xpath,xmltype(l_var_str).extract('/DUMMY/*')) INTO l_art_XML FROM dual;
1029: l_i := l_i +1;
1030: l_xpath := '//var['||to_char(l_i)||']';
1031: end loop;
1032: l_art_clob:= regexp_replace(l_art_XML.getClobVal(),'agsfddfsga','w:');
1069:
1070: -------------------------------------------
1071: -- This procedure is not required
1072: -------------------------------------------
1073: FUNCTION GET_ARTICLE_WML(p_art_clob XMLtype,p_doc_clob CLOB) return BLOB AS
1074: l_api_name VARCHAR2(30) := 'GET_ARTICLE_WML';
1075: l_art_XML XMLType;
1076: l_art_clob CLOB;
1077:
1071: -- This procedure is not required
1072: -------------------------------------------
1073: FUNCTION GET_ARTICLE_WML(p_art_clob XMLtype,p_doc_clob CLOB) return BLOB AS
1074: l_api_name VARCHAR2(30) := 'GET_ARTICLE_WML';
1075: l_art_XML XMLType;
1076: l_art_clob CLOB;
1077:
1078:
1079: BEGIN
1076: l_art_clob CLOB;
1077:
1078:
1079: BEGIN
1080: SELECT deleteXML(xmltype(p_doc_clob),'//wbody/*').getClobVal() INTO l_art_clob FROM dual;
1081: l_art_XML := p_art_clob.extract('//ArticleText[1]/*');
1082: select appendChildXML(XMLTYPE(l_art_clob),'//wbody',l_art_XML).getClobVal()
1083: into l_art_CLOB from dual;
1084: l_art_CLOB := OKC_WORD_DOWNLOAD_UPLOAD.resolve_variables_upload(l_art_CLOB);
1078:
1079: BEGIN
1080: SELECT deleteXML(xmltype(p_doc_clob),'//wbody/*').getClobVal() INTO l_art_clob FROM dual;
1081: l_art_XML := p_art_clob.extract('//ArticleText[1]/*');
1082: select appendChildXML(XMLTYPE(l_art_clob),'//wbody',l_art_XML).getClobVal()
1083: into l_art_CLOB from dual;
1084: l_art_CLOB := OKC_WORD_DOWNLOAD_UPLOAD.resolve_variables_upload(l_art_CLOB);
1085: l_art_CLOB := regexp_replace(regexp_replace(l_art_CLOB,'wbody','w:body'),'
1086:
1096:
1097: BEGIN
1098: l_art_clob := blob_to_clob(p_art_blob);
1099: l_art_clob := regexp_replace(regexp_replace(l_art_clob,'w:body','wbody'),'w:t','wt');
1100: l_art_clob := xmltype(l_art_clob).extract('//wt/text()').getClobVal();
1101: l_art_clob := regexp_replace(l_art_clob,' ','');
1102:
1103: return l_art_clob;
1104:
1109: l_art_clob CLOB:=p_art_blob;
1110: BEGIN
1111: --l_art_clob := blob_to_clob(p_art_blob);
1112: l_art_clob := regexp_replace(regexp_replace(l_art_clob,'w:body','wbody'),'w:t','wt');
1113: l_art_clob := xmltype(l_art_clob).extract('//wt/text()').getClobVal();
1114: l_art_clob := regexp_replace(l_art_clob,' ','');
1115: return l_art_clob;
1116: END get_articleWML_Text;
1117:
1185: l_progress := '020';
1186: t_clob_data := regexp_replace(t_clob_data,'w:body', 'wbody');
1187:
1188: l_progress := '030';
1189: l_placeholder_xml := XmlType.appendchildXML(XmlType(l_placeholder_xml),'//wbody',xmltype(t_clob_data).extract('wbody/*')).getClobVal();
1190: l_placeholder_xml := regexp_replace(l_placeholder_xml,'wbody','w:body');
1191:
1192:
1193: x_action := t_action;
1234: FETCH get_placeholder_xml INTO l_placeholder_xml;
1235: CLOSE get_placeholder_xml;
1236:
1237: t_clob_data := regexp_replace(t_clob_data,'w:body', 'wbody');
1238: l_placeholder_xml := XmlType.appendchildXML(XmlType(l_placeholder_xml),'//wbody',xmltype(t_clob_data).extract('wbody/*')).GetClobVal();
1239: l_placeholder_xml := regexp_replace(l_placeholder_xml,'wbody','w:body');
1240: x_action := t_action;
1241: x_wml_blob := clob_to_blob(l_placeholder_xml);
1242:
1360: begin
1361: l_art_html := regexp_replace(regexp_replace(regexp_replace(regexp_replace(p_art_wml,'w:body','wbody'),'w:p','wp'),'w:t','wt'),'wx:s','wxs');
1362:
1363: --Get body
1364: l_art_html := xmltype(l_art_html).extract('//wbody').getClobVal();
1365: --remove section tags seen in docs created using MS Word 2003
1366: while (xmltype(l_art_html).existsnode('//wxsect')>0) loop
1367:
1368: l_tbl := '
1362:
1363: --Get body
1364: l_art_html := xmltype(l_art_html).extract('//wbody').getClobVal();
1365: --remove section tags seen in docs created using MS Word 2003
1366: while (xmltype(l_art_html).existsnode('//wxsect')>0) loop
1367:
1368: l_tbl := '
1364: l_art_html := xmltype(l_art_html).extract('//wbody').getClobVal();
1365: --remove section tags seen in docs created using MS Word 2003
1366: while (xmltype(l_art_html).existsnode('//wxsect')>0) loop
1367:
1368: l_tbl := '
1369:
1370: select updateXML(xmltype(l_art_html),'//wxsect[1]',XMLType(l_tbl).extract('/div/*')).getClobVal() into l_art_html from dual;
1371: end loop;
1372: --Remove subsections
1366: while (xmltype(l_art_html).existsnode('//wxsect')>0) loop
1367:
1368: l_tbl := '
1369:
1370: select updateXML(xmltype(l_art_html),'//wxsect[1]',XMLType(l_tbl).extract('/div/*')).getClobVal() into l_art_html from dual;
1371: end loop;
1372: --Remove subsections
1373: while (xmltype(l_art_html).existsnode('//wxsub-section')>0) loop
1374:
1375: l_tbl := '
1371: end loop;
1372: --Remove subsections
1373: while (xmltype(l_art_html).existsnode('//wxsub-section')>0) loop
1374:
1375: l_tbl := '
1376:
1377: select updateXML(xmltype(l_art_html),'//wxsub-section[1]',XMLType(l_tbl).extract('/div/*')).getClobVal() into l_art_html from dual;
1378: end loop;
1379: --Replace wml tables with html tables
1373: while (xmltype(l_art_html).existsnode('//wxsub-section')>0) loop
1374:
1375: l_tbl := '
1376:
1377: select updateXML(xmltype(l_art_html),'//wxsub-section[1]',XMLType(l_tbl).extract('/div/*')).getClobVal() into l_art_html from dual;
1378: end loop;
1379: --Replace wml tables with html tables
1380: while (xmltype(l_art_html).existsnode('//wtbl')>0) loop
1381: l_tbl := '
1377: select updateXML(xmltype(l_art_html),'//wxsub-section[1]',XMLType(l_tbl).extract('/div/*')).getClobVal() into l_art_html from dual;
1378: end loop;
1379: --Replace wml tables with html tables
1380: while (xmltype(l_art_html).existsnode('//wtbl')>0) loop
1381: l_tbl := ''||xmltype(l_art_html).extract('//wtbl[1]//wtr').getClobVal()||'
';
1382: l_tbl := convert_rows_to_html(l_tbl);
1383: select updateXML(xmltype(l_art_html),'//wtbl[1]',XMLType(l_tbl)).getClobVal() into l_art_html from dual;
1384: end loop;
1385: --Replace paras in subsections
1379: --Replace wml tables with html tables
1380: while (xmltype(l_art_html).existsnode('//wtbl')>0) loop
1381: l_tbl := '
1382: l_tbl := convert_rows_to_html(l_tbl);
1383: select updateXML(xmltype(l_art_html),'//wtbl[1]',XMLType(l_tbl)).getClobVal() into l_art_html from dual;
1384: end loop;
1385: --Replace paras in subsections
1386: /*while (xmltype(l_art_html).existsnode('//wxsub-section/wp')>0) loop
1387:
1388: begin
1389: l_tbl := '
1385: --Replace paras in subsections
1386: /*while (xmltype(l_art_html).existsnode('//wxsub-section/wp')>0) loop
1387:
1388: begin
1389: l_tbl := '
1390: l_tbl := convert_para_to_html(l_tbl);
1391: exception
1392: when others then
1393: l_tbl := '
1391: exception
1392: when others then
1393: l_tbl := '
1398:
1399:
1400: --Replace paras
1401:
1402: while (xmltype(l_art_html).existsnode('//wp')>0) loop
1403: begin
1404: l_tbl := '
'||xmltype(l_art_html).extract('//wp[1]//wt/text()').getClobVal()||'
';'||xmltype(l_art_html).extract('//wp[1]//wt/text()').getClobVal()||'
';
1400: --Replace paras
1401:
1402: while (xmltype(l_art_html).existsnode('//wp')>0) loop
1403: begin
1404: l_tbl := '
'||xmltype(l_art_html).extract('//wp[1]//wt/text()').getClobVal()||'
';
1405: exception
1406: when others then
1407: l_tbl := '
1408: end;
1409: select updateXML(xmltype(l_art_html),'//wp[1]',XMLType(l_tbl)).getClobVal() into l_art_html from dual;
1410: end loop;
1411:
1412: l_art_html := xmltype(l_art_html).extract('//p|//TABLE').getClobVal();
1413: -- l_art_html := regexp_replace(l_art_html,'tr>','p>');
1414: -- l_art_html := regexp_replace(regexp_replace(l_art_html,'
1419: l_table CLOB;
1420: l_row CLOB;
1421: begin
1422: l_table := p_table;
1423: while (xmltype(l_table).existsnode('//wtr')>0) loop
1424: l_row := '
1420: l_row CLOB;
1421: begin
1422: l_table := p_table;
1423: while (xmltype(l_table).existsnode('//wtr')>0) loop
1424: l_row := ''||xmltype(l_table).extract('//wtr[1]//wtc').getClobVal()||' ';
1425: l_row := convert_cells_to_html(l_row);
1426: select updateXML(xmltype(l_table),'//wtr[1]',XMLType(l_row)).getClobVal() into l_table from dual;
1427: end loop;
1428: return l_table;
1422: l_table := p_table;
1423: while (xmltype(l_table).existsnode('//wtr')>0) loop
1424: l_row := '
1433: l_cell CLOB;
1434: l_row CLOB;
1435: begin
1436: l_row := p_row;
1437: while (xmltype(l_row).existsnode('//wtc')>0) loop
1438: begin
1439: l_cell := '
1435: begin
1436: l_row := p_row;
1437: while (xmltype(l_row).existsnode('//wtc')>0) loop
1438: begin
1439: l_cell := '
1440: exception
1441: when others then
1442: l_cell:='
1455: --Ignore span tags around table element..
1456: l_html_diff := p_html_diff;
1457:
1458: --l_html_diff := '
1459: --if (xmltype(l_html_diff).existsnode('//TABLE')>0) THEN
1460: l_html_diff := regexp_replace(regexp_replace(regexp_replace(l_html_diff,'
1459: --if (xmltype(l_html_diff).existsnode('//TABLE')>0) THEN
1460: l_html_diff := regexp_replace(regexp_replace(regexp_replace(l_html_diff,'
1461: l_html_diff := regexp_replace(l_html_diff,'','
1462: l_html_diff := '
1463: l_html_diff := XMLType(l_html_diff).extract('//P|//TABLESTART|//TABLEEND|//TRSTART|//TREND|//TD').getClobVal();
1464: --l_html_diff := '
1465: --l_html_diff := XMLType(l_html_diff).extract('//P|//TABLE').getClobVal();
1466: l_html_diff := '
1467: select deleteXML(XMLType(l_html_diff),'//br').getClobVal() into l_html_diff from dual;
1468: l_html_diff := regexp_replace(regexp_replace(regexp_replace(l_html_diff,'
1463: l_html_diff := XMLType(l_html_diff).extract('//P|//TABLESTART|//TABLEEND|//TRSTART|//TREND|//TD').getClobVal();
1464: --l_html_diff := '
1465: --l_html_diff := XMLType(l_html_diff).extract('//P|//TABLE').getClobVal();
1466: l_html_diff := '
1467: select deleteXML(XMLType(l_html_diff),'//br').getClobVal() into l_html_diff from dual;
1468: l_html_diff := regexp_replace(regexp_replace(regexp_replace(l_html_diff,'
1466: l_html_diff := '
1467: select deleteXML(XMLType(l_html_diff),'//br').getClobVal() into l_html_diff from dual;
1468: l_html_diff := regexp_replace(regexp_replace(regexp_replace(l_html_diff,'
1473: /*else
1474: l_html_diff := p_html_diff;
1475: end if;
1476: l_html_diff := '
1477: select deleteXML(XMLType(l_html_diff),'//br').getClobVal() into l_html_diff from dual;
1478: l_html_diff := XMLType(l_html_diff).extract('/DUMMY2/*').getClobVal();*/
1479: return l_html_diff;
1480: END clean_html_diff;
1481:
1474: l_html_diff := p_html_diff;
1475: end if;
1476: l_html_diff := '
1477: select deleteXML(XMLType(l_html_diff),'//br').getClobVal() into l_html_diff from dual;
1478: l_html_diff := XMLType(l_html_diff).extract('/DUMMY2/*').getClobVal();*/
1479: return l_html_diff;
1480: END clean_html_diff;
1481:
1482: FUNCTION change_encoding (p_clob CLOB) RETURN CLOB is