How to parse an XMl without using prefix in the namespace and elements?

Hi
The following is a sample of the xml that I need to parse.
Without the prefix in the namespace section I am getting an error but when i just put in the prefix it works fine. Any help here would be greatly appreciated.
I think i need to change something in the parser set up...may be the somewhere in the bolded lines....but i am clueless...
//Xml begins
<?xml version="1.0" encoding="utf-8" ?>
- <Statemessages xsi:schemaLocation="http://www.SomeLocation.com/SomeXSD.xsd" xmlns="http://www.abcd.com/BSN" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
- <FileControl>
<CreationDate>2008-08-11</CreationDate>
- <Source>
<SystemID>SAP4BSN</SystemID>
<MandantID>100</MandantID>
</Source>
- <Destination>
<SystemID>CWL</SystemID>
<MandantID>746</MandantID>
</Destination>
<SequenceNumber>000000004</SequenceNumber>
<Counter>000000001</Counter>
</FileControl>
- <Message>
- <PartyRegistrationID>
<ID>2101576347</ID>
<Type>RG</Type>
<ID>2101576347</ID>
<Type>AG</Type>
</PartyRegistrationID>
<CustomerGroupID>02</CustomerGroupID>
<Name>Lewicki</Name>
<Subname>Hans Bruno Michel</Subname>
<DateTime>2008-08-11T23:59:59</DateTime>
- <DefaultOfPayment>
<MessageID>00000001</MessageID>
<GrossAmountBefore>0.0</GrossAmountBefore>
<GrossAmountCurrent>-17.9</GrossAmountCurrent>
<Currency>EUR</Currency>
<SettlementOfBalance>Nein</SettlementOfBalance>
<IncludingSubsidiaryClaim>Ja</IncludingSubsidiaryClaim>
</DefaultOfPayment>
- <ContractsWithDefaultOfPayment>
<ContractID>0148863732</ContractID>
</ContractsWithDefaultOfPayment>
- <Messagedetails>
- <ReturnDebitNote>
<MessageID>00000002</MessageID>
<KindOf>BA</KindOf>
<Reason>E2</Reason>
<Date>2008-08-11</Date>
<GrossAmount>-15.4</GrossAmount>
<Currency>EUR</Currency>
</ReturnDebitNote>
</Messagedetails>
</Message>
</Statemessages>
//XML end
I am using the following stored procedure to try this;
create or replace PROCEDURE CompleteSaveXML_1 AS
XMLMessage2 XMLTYPE;
v_parser dbms_xmlparser.Parser;
v_clob CLOB;
v_sent DATE;
v_doc xmldom.DOMDocument;
v_nl xmldom.DOMNodeList;
v_nFCL xmldom.DOMNodeList;
v_nFCN xmldom.DOMNode;
v_nFCSourceL xmldom.DOMNodeList;
v_nFCSourceN xmldom.DOMNode;
v_nFCDestinationL xmldom.DOMNodeList;
v_nFCDestinationN xmldom.DOMNode;
m_nl xmldom.DOMNodeList;
m_n xmldom.DOMNode;
v_n xmldom.DOMNode;
v_n3 xmldom.DOMNodeList;
v_n4 xmldom.DOMNode;
v_b xmldom.DOMNode;
v_d xmldom.DOMNode;
v_a xmldom.DOMNodeList;
v_c xmldom.DOMNodeList;
m_prg xmldom.DOMNodeList;
m_pr xmldom.DOMNode;
condf_nl xmldom.DOMNodeList;
condf_n xmldom.DOMNode;
msgdtl_nl xmldom.DOMNodeList;
msgdtl_n xmldom.DOMNode;
rtndbt_nl xmldom.DOMNodeList;
rtndbt_n xmldom.DOMNode;
dnlt_nl xmldom.DOMNodeList;
dnlt_n xmldom.DOMNode;
cancl_nl xmldom.DOMNodeList;
cancl_n xmldom.DOMNode;
conid_nl xmldom.DOMNodeList;
conid_n xmldom.DOMNode;
canclid_nl xmldom.DOMNodeList;
canclid_n xmldom.DOMNode;
par_ref number(10) :=0;
msgnum number(20):=0;
var1 number(30):=0;
rtnnum number(20):=0;
dnnum number(20):=0;
tpmsg number(20):=0;
condfpmt number(20):=0;
canclnum number(20):=0;
--Added the next variable
sequence_no     number(20):=0;
--These are the new variables
condfpmt1 number(20):=0;
rtnnum1 number(20):=0;
dnnum1 number(20):=0;
tpmsg1 number(20):=0;
canclnum1 number(20):=0;
--changing
part_refid_value number(20);
parid_typ_n xmldom.DOMNode;
parid_typ_nl xmldom.DOMNodeList;
parid_id_nl xmldom.DOMNodeList;
parid_id_n     xmldom.DOMNode;
party_ref_node xmldom.DOMNode;
var_pr_reg_typ VARCHAR2(2);
msgrtdbt_nl xmldom.DOMNodeList;
msgrtdbt_n xmldom.DOMNode;
kndrtdbt_nl xmldom.DOMNodeList;
kndrtdbt_n xmldom.DOMNode;
rsnrtdbt_nl xmldom.DOMNodeList;
rsnrtdbt_n xmldom.DOMNode;
datrtdbt_nl xmldom.DOMNodeList;
datrtdbt_n xmldom.DOMNode;
grssrtdbt_nl xmldom.DOMNodeList;
grssrtdbt_n xmldom.DOMNode;
currtdbt_nl xmldom.DOMNodeList;
currtdbt_n xmldom.DOMNode;
rtnnum2 number(20):=0;
msgdnlt_nl xmldom.DOMNodeList;
msgdnlt_n xmldom.DOMNode;
lvdnlt_nl xmldom.DOMNodeList;
lvdnlt_n xmldom.DOMNode;
datdnlt_nl xmldom.DOMNodeList;
datdnlt_n xmldom.DOMNode;
grsdnlt_nl xmldom.DOMNodeList;
grsdnlt_n xmldom.DOMNode;
curdnlt_nl xmldom.DOMNodeList;
curdnlt_n xmldom.DOMNode;
limdnlt_nl xmldom.DOMNodeList;
limdnlt_n xmldom.DOMNode;
lvimp number(20);
nullchk varchar2(30) ;
chk_flseq number(10);
fl_seq number(30);
--these are the new variables
TYPE tab_type IS TABLE OF FileControl%ROWTYPE;
t_tab_FC tab_type := tab_type();
TYPE tab_type1 IS TABLE OF MessageTab%ROWTYPE;
t_tab1 tab_type1 := tab_type1();
TYPE tab_type2 IS TABLE OF ContractsWithDefaultOfPayment%ROWTYPE;
t_tab2 tab_type2 := tab_type2();
TYPE tab_type3 IS TABLE OF CancellationTab%ROWTYPE;
t_tab3 tab_type3 := tab_type3();
TYPE tab_type4 IS TABLE OF ReturnDebitNoteTab%ROWTYPE;
t_tab4 tab_type4 := tab_type4();
TYPE tab_type5 IS TABLE OF DunningLettersTab%ROWTYPE;
t_tab5 tab_type5 := tab_type5();
cursor MessageCursor is
select * from OM_BSN_STATEMSGS
where PROCESSED is null AND SENT in(Select min(SENT) from OM_BSN_STATEMSGS
where PROCESSED is null)
order by sent asc;
v_statemsgs OM_BSN_STATEMSGS%ROWTYPE;
BEGIN
DBMS_OUTPUT.put_line('creating parser');
-- v_parser := DBMS_XMLPARSER.NEWPARSER;
v_parser := DBMS_XMLPARSER.NEWPARSER();
DBMS_OUTPUT.put_line('done creating');
DBMS_XMLPARSER.setValidationMode(v_parser, true);
DBMS_XMLPARSER.showWarnings(v_parser, true);
open MessageCursor;
loop
fetch MessageCursor into v_statemsgs;
exit when MessageCursor%NOTFOUND;
DBMS_XMLPARSER.PARSECLOB(P => v_parser, DOC => v_statemsgs.MESSAGE);
-- xmlparser.parse(v_parser, File_Location);
v_doc := xmlparser.getDocument(v_parser);
dbms_xmlparser.freeParser(v_parser); DBMS_OUTPUT.put_line('Step 1');
v_nFCL := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/FileControl');
v_nFCN := xmldom.item(v_nFCL,0);
Source
v_nFCSourceL := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/FileControl/Source');
v_nFCSourceN := xmldom.item(v_nFCSourceL,0);
Destination
v_nFCDestinationL := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/FileControl/Destination');
v_nFCDestinationN := xmldom.item(v_nFCDestinationL,0);
-- Populate tab type for ORFC
t_tab_FC.extend;
t_tab_FC(t_tab_FC.last).creation_date := to_date(xslprocessor.valueOf(v_nFCN,'CreationDate'),'YYYY-MM-DD');
t_tab_FC(t_tab_FC.last).src_sys_id := xslprocessor.valueOf(v_nFCSourceN,'SystemID');
t_tab_FC(t_tab_FC.last).src_mandant_id := xslprocessor.valueOf(v_nFCSourceN,'MandantID');
t_tab_FC(t_tab_FC.last).dest_sys_id := xslprocessor.valueOf(v_nFCDestinationN,'SystemID');
t_tab_FC(t_tab_FC.last).dest_mandant_id := xslprocessor.valueOf(v_nFCDestinationN,'MandantID');
t_tab_FC(t_tab_FC.last).seq_no := xslprocessor.valueOf(v_nFCN,'SequenceNumber');
t_tab_FC(t_tab_FC.last).counter := xslprocessor.valueOf(v_nFCN,'Counter');
--Saving the value of this seq_no so that it can be inserted in the message tab.
sequence_no:= xslprocessor.valueOf(v_nFCN,'SequenceNumber');
--Insert into ORFC TAB
fl_seq := xslprocessor.valueOf(v_nFCN,'SequenceNumber');
select count(*) into chk_flseq from FileControl where SEQ_NO =fl_seq;
if (chk_flseq =0) then
FOR each_FC IN t_tab_FC.first .. t_tab_FC.last LOOP
INSERT INTO FileControl
creation_date,
src_sys_id,
src_mandant_id,
dest_sys_id,
dest_mandant_id,
seq_no,
counter)
VALUES
t_tab_FC(each_FC).creation_date,
t_tab_FC(each_FC).src_sys_id ,
t_tab_FC(each_FC).src_mandant_id,
t_tab_FC(each_FC).dest_sys_id,
t_tab_FC(each_FC).dest_mandant_id,
t_tab_FC(each_FC).seq_no,
t_tab_FC(each_FC).counter
END LOOP;
end if;
DBMS_OUTPUT.put_line('Step 2');
if (chk_flseq =0) then /* chk the xml's filecontrol seq exists in filecontrltab */
-- Use XPATH syntax to assign values to he elements of the collection.
v_nl := xslprocessor.selectNodes(xmldom.makeNode(v_doc),'/Statemessages/Message');
tpmsg := xmldom.getLength(v_nl);
DBMS_OUTPUT.put_line('Message node length'||tpmsg);
if (tpmsg>0) then
FOR cur_emp IN 0 .. xmldom.getLength(v_nl) - 1 LOOP
v_n := xmldom.item(v_nl, cur_emp);
select (BISON_OM_MessageID.NEXTVAL) into var1 from dual;
t_tab1.extend;
t_tab1(t_tab1.last).message_id := var1;
t_tab1(t_tab1.last).seq_no     := sequence_no;
---party reg
m_prg := xslprocessor.selectNodes(v_n,'PartyRegistrationID');
FOR Ref_Id_Loop IN 0 .. xmldom.getLength(m_prg) - 1 LOOP
party_ref_node := xmldom.item(m_prg,0);
part_refid_value := xslprocessor.valueOf(party_ref_node,'.');
end loop;
m_pr := xmldom.item(m_prg, 0);
--changing
--chang id
parid_id_nl := xslprocessor.selectNodes(m_pr,'ID');
DBMS_OUTPUT.put_line('Going to read PartyRegistrationID');
FOR cur_parid_id IN 0 .. xmldom.getLength(parid_id_nl) - 1 LOOP
parid_id_n := xmldom.item(parid_id_nl,cur_parid_id);
DBMS_OUTPUT.put_line('Value of id:'|| xslprocessor.valueOf(parid_id_n,'.'));
t_tab1(t_tab1.last).party_ref_id := xslprocessor.valueOf(parid_id_n,'.');
exit;
end loop ;
---- change id
parid_typ_nl := xslprocessor.selectNodes(m_pr,'Type');
FOR cur_parid_typ IN 0 .. xmldom.getLength(parid_typ_nl) - 1 LOOP
parid_typ_n := xmldom.item(parid_typ_nl,cur_parid_typ);
var_pr_reg_typ := xslprocessor.valueOf(parid_typ_n,'.');
if var_pr_reg_typ='RG' then
t_tab1(t_tab1.last).PARTY_REG_TYPE_RG := var_pr_reg_typ;
elsif var_pr_reg_typ='AG' then
t_tab1(t_tab1.last).PARTY_REG_TYPE_AG := var_pr_reg_typ;
end if;
end loop;
--Chang
-- t_tab1(t_tab1.last).PARTY_REG_TYPE_AG := xslprocessor.valueOf(m_pr,'Type');
par_ref :=xslprocessor.valueOf(m_pr,'ID');
t_tab1(t_tab1.last).customer_grp_id := xslprocessor.valueOf(v_n,'CustomerGroupID');
t_tab1(t_tab1.last).name := xslprocessor.valueOf(v_n,'Name');
t_tab1(t_tab1.last).subname := xslprocessor.valueOf(v_n,'Subname');
t_tab1(t_tab1.last).datetime := xslprocessor.valueOf(v_n,'DateTime');
DBMS_OUTPUT.put_line('Step 3 ContractsWithDefaultOfPayment');
m_nl := xslprocessor.selectNodes(v_n,'DefaultOfPayment');
m_n := xmldom.item(m_nl, 0);
t_tab1(t_tab1.last).payment_msg_id := xslprocessor.valueOf(m_n,'MessageID');
t_tab1(t_tab1.last).gross_amt_before := xslprocessor.valueOf(m_n,'GrossAmountBefore');
t_tab1(t_tab1.last).gross_amt_current := xslprocessor.valueOf(m_n,'GrossAmountCurrent');
t_tab1(t_tab1.last).currency := xslprocessor.valueOf(m_n,'Currency');
t_tab1(t_tab1.last).settlemen_of_balance := xslprocessor.valueOf(m_n,'SettlementOfBalance');
t_tab1(t_tab1.last).including_subsidiary_claim := xslprocessor.valueOf(m_n,'IncludingSubsidiaryClaim');
condf_nl := xslprocessor.selectNodes(v_n,'ContractsWithDefaultOfPayment');
condf_n := xmldom.item(condf_nl,0);
condfpmt := xmldom.getLength(condf_nl);
if (condfpmt > 0) then
conid_nl := xslprocessor.selectNodes(condf_n,'ContractID');
FOR cur_conid IN 0 .. xmldom.getLength(conid_nl) - 1 LOOP
conid_n := xmldom.item(conid_nl,cur_conid);
t_tab2.extend;
t_tab2(t_tab2.last).message_id := var1;
t_tab2(t_tab2.last).contract_id := xslprocessor.valueOf(conid_n,'.');
end loop;
condfpmt1 := 1;
end if;
cancl_nl := xslprocessor.selectNodes(v_n,'Cancellation');
cancl_n := xmldom.item(cancl_nl,0);
DBMS_OUTPUT.put_line('No of cancellations'||xmldom.getLength(cancl_nl) );
canclnum := xmldom.getLength(cancl_nl) ;
if (canclnum > 0) then
canclid_nl := xslprocessor.selectNodes(cancl_n,'MessageID');
FOR cur_canclid IN 0 .. xmldom.getLength(canclid_nl) - 1 LOOP
canclid_n := xmldom.item(canclid_nl,cur_canclid);
t_tab3.extend;
t_tab3(t_tab3.last).message_id := var1;
t_tab3(t_tab3.last).cancellation_msg_id := xslprocessor.valueOf(canclid_n,'.');
end loop;
canclnum1 :=1;
end if; -- canclnum
msgdtl_nl := xslprocessor.selectNodes(v_n,'Messagedetails');
msgnum := xmldom.getLength(msgdtl_nl) ;
dbms_output.put_line('msgggg::::'||msgnum);
if (msgnum >0) then
msgdtl_n := xmldom.item(msgdtl_nl,0);
rtndbt_nl := xslprocessor.selectNodes(msgdtl_n,'ReturnDebitNote');
rtndbt_n := xmldom.item(rtndbt_nl,0);
rtnnum := xmldom.getLength(rtndbt_nl) ;
if (rtnnum >0) then
--return debit note
msgrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'MessageID');
kndrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'KindOf');
rsnrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'Reason');
datrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'Date');
grssrtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'GrossAmount');
currtdbt_nl := xslprocessor.selectNodes(rtndbt_n,'Currency');
rtnnum2 :=0;
FOR cur_msgrtndbt IN 0 .. xmldom.getLength(msgrtdbt_nl) - 1 LOOP
msgrtdbt_n := xmldom.item(msgrtdbt_nl,cur_msgrtndbt);
kndrtdbt_n := xmldom.item(kndrtdbt_nl,cur_msgrtndbt);
rsnrtdbt_n := xmldom.item(rsnrtdbt_nl,cur_msgrtndbt);
datrtdbt_n := xmldom.item(datrtdbt_nl,cur_msgrtndbt);
grssrtdbt_n := xmldom.item(grssrtdbt_nl,cur_msgrtndbt);
currtdbt_n := xmldom.item(currtdbt_nl,cur_msgrtndbt);
t_tab4.extend;
t_tab4(t_tab4.last).message_id := var1;
t_tab4(t_tab4.last).ret_debitnote_msg_id := xslprocessor.valueOf(msgrtdbt_n,'.');
t_tab4(t_tab4.last).kind_of := xslprocessor.valueOf(kndrtdbt_n,'.');
t_tab4(t_tab4.last).Reason := xslprocessor.valueOf(rsnrtdbt_n,'.');
t_tab4(t_tab4.last).debit_note_date := to_date(xslprocessor.valueOf(datrtdbt_n,'.'),'YYYY-MM-DD');
t_tab4(t_tab4.last).gross_amt := xslprocessor.valueOf(grssrtdbt_n,'.');
t_tab4(t_tab4.last).currency := xslprocessor.valueOf(currtdbt_n,'.');
rtnnum1 :=rtnnum1 + 1;
rtnnum2 := rtnnum2 + 1;
dbms_output.put_line('message_id::::'||var1);
dbms_output.put_line('rtnnum2::::'||rtnnum2);
dbms_output.put_line('ret_debitnote_msg_id:::'||t_tab4(t_tab4.last).ret_debitnote_msg_id);
end loop;
----return debit note
t_tab4(t_tab4.last).message_id := var1 ;
t_tab4(t_tab4.last).ret_debitnote_msg_id := xslprocessor.valueOf(rtndbt_n,'MessageID');
t_tab4(t_tab4.last).kind_of := xslprocessor.valueOf(rtndbt_n,'KindOf');
t_tab4(t_tab4.last).reason := xslprocessor.valueOf(rtndbt_n,'Reason');
t_tab4(t_tab4.last).debit_note_date := to_date(xslprocessor.valueOf(rtndbt_n,'Date'),'YYYY-MM-DD');
t_tab4(t_tab4.last).gross_amt := xslprocessor.valueOf(rtndbt_n,'GrossAmount');
t_tab4(t_tab4.last).currency := xslprocessor.valueOf(rtndbt_n,'Currency');
rtnnum1 :=1;
end if;
dnlt_nl := xslprocessor.selectNodes(msgdtl_n,'DunningLetter');
dnlt_n := xmldom.item(dnlt_nl, 0);
dnnum := xmldom.getLength(dnlt_nl) ;
if (dnnum >0) then
-- t_tab5.extend;
--dunning letter
msgdnlt_nl := xslprocessor.selectNodes(dnlt_n,'MessageID');
lvdnlt_nl := xslprocessor.selectNodes(dnlt_n,'Level');
datdnlt_nl := xslprocessor.selectNodes(dnlt_n,'Date');
grsdnlt_nl := xslprocessor.selectNodes(dnlt_n,'GrossAmount');
curdnlt_nl := xslprocessor.selectNodes(dnlt_n,'Currency');
limdnlt_nl := xslprocessor.selectNodes(dnlt_n,'LevelImprovement');
FOR cur_msgdnlt IN 0 .. xmldom.getLength(msgdnlt_nl) - 1 LOOP
msgdnlt_n := xmldom.item(msgdnlt_nl,cur_msgdnlt);
lvdnlt_n := xmldom.item(lvdnlt_nl,cur_msgdnlt);
datdnlt_n := xmldom.item(datdnlt_nl,cur_msgdnlt);
grsdnlt_n := xmldom.item(grsdnlt_nl,cur_msgdnlt);
curdnlt_n := xmldom.item(curdnlt_nl,cur_msgdnlt);
limdnlt_n := xmldom.item(limdnlt_nl,cur_msgdnlt);
t_tab5.extend;
t_tab5(t_tab5.last).message_id := var1;
t_tab5(t_tab5.last).dunning_msg_id := xslprocessor.valueOf(msgdnlt_n,'.');
t_tab5(t_tab5.last).d_level := xslprocessor.valueOf(lvdnlt_n,'.');
t_tab5(t_tab5.last).dunning_date := to_date(xslprocessor.valueOf(datdnlt_n,'.'),'YYYY-MM-DD');
t_tab5(t_tab5.last).gross_amt := xslprocessor.valueOf(grsdnlt_n,'.');
t_tab5(t_tab5.last).currency := xslprocessor.valueOf(curdnlt_n,'.');
lvimp := xmldom.getLength(limdnlt_nl);
begin
t_tab5(t_tab5.last).level_improvement := xslprocessor.valueOf(limdnlt_n,'.');
EXCEPTION
WHEN OTHERS THEN
t_tab5(t_tab5.last).level_improvement := null;
end;
dnnum1 :=dnnum1 + 1;
-- dnnum2 := dnnum2 + 1;
dbms_output.put_line('message_id::::'||var1);
end loop;
----dunning letter
t_tab5(t_tab5.last).message_id := var1;
t_tab5(t_tab5.last).dunning_msg_id := xslprocessor.valueOf(dnlt_n,'MessageID');
t_tab5(t_tab5.last).d_level := xslprocessor.valueOf(dnlt_n,'Level');
t_tab5(t_tab5.last).dunning_date := to_date(xslprocessor.valueOf(dnlt_n,'Date'),'YYYY-MM-DD');
t_tab5(t_tab5.last).gross_amt := xslprocessor.valueOf(dnlt_n,'GrossAmount');
t_tab5(t_tab5.last).currency := xslprocessor.valueOf(dnlt_n,'Currency');
t_tab5(t_tab5.last).level_improvement := xslprocessor.valueOf(dnlt_n,'LevelImprovement');
dnnum1 :=1; */
end if;
end if;
END LOOP;
-- Insert data into the real EMP table from the table collection.
-- Form better performance multiple collections should be used to allow
-- bulk binding using the FORALL construct but this would make the code
-- too long-winded for this example.
DBMS_OUTPUT.put_line('Step 5');
FOR cur_emp IN t_tab1.first .. t_tab1.last LOOP
INSERT INTO MessageTab
message_id,
PARTY_REF_ID,
PARTY_REG_TYPE_AG,
party_reg_type_rg,
customer_grp_id,
name,
subname,
datetime,
payment_msg_id,
gross_amt_before,
gross_amt_current,
currency,
settlemen_of_balance,
including_subsidiary_claim,
seq_no)
VALUES
t_tab1(cur_emp).message_id,
t_tab1(cur_emp).PARTY_REF_ID,
t_tab1(cur_emp).PARTY_REG_TYPE_AG,
t_tab1(cur_emp).PARTY_REG_TYPE_RG,
t_tab1(cur_emp).customer_grp_id,
t_tab1(cur_emp).name,
t_tab1(cur_emp).subname,
t_tab1(cur_emp).datetime,
t_tab1(cur_emp).payment_msg_id,
t_tab1(cur_emp).gross_amt_before,
t_tab1(cur_emp).gross_amt_current,
t_tab1(cur_emp).currency,
t_tab1(cur_emp).settlemen_of_balance,
t_tab1(cur_emp).including_subsidiary_claim,
t_tab1(cur_emp).seq_no
END LOOP;
DBMS_OUTPUT.put_line('Step 6');
if (condfpmt1 > 0) then
FOR cur_cnf IN t_tab2.first .. t_tab2.last LOOP
INSERT INTO ContractsWithDefaultOfPayment
(message_id,contract_id)
values
(t_tab2(cur_cnf).message_id,t_tab2(cur_cnf).contract_id );
end loop;
end if; -- condfpmt
if (canclnum1 > 0) then
FOR cur_cancl IN t_tab3.first .. t_tab3.last LOOP
INSERT INTO CancellationTab
(message_id,cancellation_msg_id)
VALUES
(t_tab3(cur_cancl).message_id,t_tab3(cur_cancl).cancellation_msg_id);
END LOOP;
end if;
DBMS_OUTPUT.put_line('Step 7');
if (rtnnum1 >0) then
FOR cur_rtndb IN t_tab4.first .. t_tab4.last LOOP
INSERT INTO ReturnDebitNoteTab
(message_id,
ret_debitnote_msg_id,
kind_of,
reason,
debit_note_date,
gross_amt,
currency
VALUES
(t_tab4(cur_rtndb).message_id,
t_tab4(cur_rtndb).ret_debitnote_msg_id,
t_tab4(cur_rtndb).kind_of,
t_tab4(cur_rtndb).reason,
t_tab4(cur_rtndb).debit_note_date,
t_tab4(cur_rtndb).gross_amt,
t_tab4(cur_rtndb).currency);
END LOOP;
end if;
if (dnnum1 >0) then
FOR cur_dnl IN t_tab5.first .. t_tab5.last LOOP
INSERT INTO DunningLettersTab
(message_id,
dunning_msg_id,
d_level,
dunning_date,
gross_amt,
currency,
level_improvement)
VALUES
(t_tab5(cur_dnl).message_id,
t_tab5(cur_dnl).dunning_msg_id,
t_tab5(cur_dnl).d_level,
t_tab5(cur_dnl).dunning_date,
t_tab5(cur_dnl).gross_amt,
t_tab5(cur_dnl).currency,
t_tab5(cur_dnl).level_improvement
END LOOP;
DBMS_OUTPUT.put_line('Step 8');
end if; -- dnn
end if; -- top msg
end if; --- fl_seq chk
COMMIT;
-- Free any resources associated with the document now it
-- is no longer needed.
xmldom.freeDocument(v_doc);
/* refresh array */
t_tab_FC.delete;
t_tab1.delete;
t_tab2.delete;
t_tab3.delete;
t_tab4.delete;
t_tab5.delete;
/* refsh */
end loop;
close MessageCursor;
END ;
//

Errors thrown by Oracle always show a line number (even if it points to the FOR loop that the error occurred within). When you run it, what is the error stack that is being returned. Copy and paste that, don't summarize it.
If you are still uncertain, add a final
EXCEPTION
  WHEN OTHERS THEN
     dbms_output.put_line(DBMS_UTILITY.FORMAT_ERROR_BACKTRACE);to have it written out where your normal dbms_output goes. This is your friend in 10g for tracking down errors.
"But as soon as i add a prefix in the header everything works fine."
Is that header in the sample XML you provided? Regardless what are you adding? Your data is a clob so you can always tweak it before converting it to a DOMDocument just by doing simple string manipulation.
Since you are in 10g, you should be using dbms_xmldom instead of xmldom. I think xmldom is just a synonym for dbms_xmldom though. Review the dbms_xmldom documentation. You can go straight from a clob to a DOMDocument via DBMS_XMLDOM.NEWDOMDOCUMENT. You can also parse the document completely using dbms_xmldom calls instead of xslprocessor calls.
Other random things to evaluate:
Consider turning
         FOR each_FC IN t_tab_FC.first .. t_tab_FC.last LOOP
            INSERT INTO FileControl
into a
         FORALL i IN t_tab_FC.first .. t_tab_FC.last LOOP
            INSERT INTO FileControl
             ...Better performance because one two context switches (PL/SQL -> SQL -> PL/SQL) instead of 2*n switches.
I like this construct better
   TYPE tab_type IS TABLE OF FileControl%ROWTYPE INDEX BY BINARY_INTEGER;
   t_tab_FC tab_type := tab_type;because then you don't have to       t_tab_FC.extend;you can just do something like     index := 1;
     LOOP
        t_tab_FC(index).creation_date := <whatever>;
        index := index + 1;
     END LOOPYou also have the option of parsing your XML as a XMLType, including purely in SQL, but you can research that avenue at a later date.
Forgot to mention, wrap any code examples in [ pre ] [ pre ] (without the spaces) to retain your formatting.

Similar Messages

  • How to parse nested xml file using dom

    i want to parse nested xml file
    please tell me how to parse nested xml
    for eg.
    <xml>
    <row>
    <name>Rahul<name>
    <row><newXml>
    <newXML>
    <Row>
    <code>12</code>
    </Row>
    <newXML>
    <XML>
    please tell how to parse this file

    Normally if you have no idea about X, the first thing you should do is google "X tutorial". You will find plenty of them out there. And the advantage is, they are better written than whatever we spend two minutes throwing together here. Not to mention that it saves us the two minutes.
    But if you have specific questions with your SAX parser when you get it going, then ask them here. Actually, ask them in the XML forum here, not this one.

  • How to Parse an XML file using SAXParser in java.

    Hi all
    Am a bit new to XML files and have no idea about SAXParsers ... Now my problem is to parse this XML file below
    <?xml version="1.0" encoding="UTF-8"?>
    <sc:memory_segmentation xmlns:sc="sc_memory_segmentation.xsd">
       <sc:architecture name="MPC55xx"></sc:architecture>
       <sc:derivative name=""></sc:derivative>
       <sc:configuration name=""></sc:configuration>
       <sc:memory name="Internal ROM" type="ROM">
          <sc:area-list>
             <sc:area name="Bootmanager" type="BOOTMANAGER">
                 <sc:segment-list>
                   <sc:segment name="ROM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                 </sc:segment-list>
             </sc:area>
             <sc:area name="Bootloader SWE" type="BOOTLOADER">
                 <sc:segment-list>
                   <sc:segment name="ROM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 1" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 6">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="ROM page 7">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 2" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 8">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 3" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 9">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
             <sc:area name="Application SWE 4" type="APPLICATION">
                <sc:segment-list>
                   <sc:segment name="ROM page 10">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
       <sc:memory name="Internal RAM" type="RAM">
          <sc:area-list>
             <sc:area name="RAM" type="RAM">
                <sc:segment-list>
                   <sc:segment name="RAM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="RAM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
       <sc:memory name="Internal EEPROM" type="EEPROM">
          <sc:area-list>
             <sc:area name="EEPROM" type="EEPROM">
                <sc:segment-list>
                   <sc:segment name="EEPROM page 1">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 2">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 3">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 4">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                   <sc:segment name="EEPROM page 5">
                      <sc:start></sc:start>
                      <sc:end></sc:end>
                   </sc:segment>
                </sc:segment-list>
             </sc:area>
          </sc:area-list>
       </sc:memory>
    </sc:memory_segmentation> And from this file I need to make 3 Hashtables out of it one for ROM , RAM and EEPROM containg Segment information i.e. Segment start and end addresses and Area type of the segment....
    If anyone could at least guide me with the basic commands and structure of the parser it would be really really great ...
    Thanks a lot
    Anisha

    Normally if you have no idea about X, the first thing you should do is google "X tutorial". You will find plenty of them out there. And the advantage is, they are better written than whatever we spend two minutes throwing together here. Not to mention that it saves us the two minutes.
    But if you have specific questions with your SAX parser when you get it going, then ask them here. Actually, ask them in the XML forum here, not this one.

  • Parsing a XML file using Jdom-Problem.

    Hi all,
    I am reposting it as I was told to format the code and send it again.
    I am trying to parse a xml file using a jdom java code.This code works fine if I remove xmlns attribute in the root element. (I get the expected result) .If the "xmlns" attribute is put in the xml as it should be then the parsing and retrieving returns null. Please tell me how to fix this issue.
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Xml
    <process name="CreateKBEntryService" targetNamespace="http://serena.com/CreateKBEntryService" suppressJoinFailure="yes" xmlns:tns="http://serena.com/CreateKBEntryService" xmlns="http://schemas.xmlsoap.org/ws/2003/03/business-process/" xmlns:bpelx="http://schemas.oracle.com/bpel/extension" xmlns:ora="http://schemas.oracle.com/xpath/extension" xmlns:nsxml0="http://localhost:8080/axis/services/CreateKBEntryService" xmlns:nsxml1="http://DefaultNamespace" xmlns:bpws="http://schemas.xmlsoap.org/ws/2003/03/business-process/">
    <partnerLinks>
    <partnerLink name="client" partnerLinkType="tns:CreateKBEntryService" myRole="CreateKBEntryServiceProvider"/>
    <partnerLink name="CreateKBEntryPartnerLink" partnerLinkType="nsxml0:CreateKBEntryLink" partnerRole="CreateKBEntryProvider"/>
    </partnerLinks>
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~`
    Java:
    import java.io.*;
    import java.util.*;
    import org.jdom.Document;
    import org.jdom.Element;
    import org.jdom.input.SAXBuilder;
    public class sample1 {
    public static void main(String[] args) throws Exception {
    // create a XML parser and read the XML file
    SAXBuilder oBuilder = new SAXBuilder();
    Document oDoc = oBuilder.build(new File("**xml file location**"));
    Element root = oDoc.getRootElement();
    System.out.println(root.getName());
    String tgtns= root.getAttributeValue("targetNamespace");
    System.out.println("tgt ns "+ tgtns);
    List list= root.getChildren("partnerLinks");
    Iterator it1= list.iterator();
    System.out.println("Iterator 1 - "+list.size());
    while(it1.hasNext()){
    Element partnerlinks = (Element)it1.next();
    List list2= partnerlinks.getChildren("partnerLink");
    System.out.println("iterator 2 - "+list2.size());
    }~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    Result:
    Without Xmlns in xml file(Expected and correct output)
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 1//expected and correct result that comes when I remove xmlns attribute from xml
    iterator 2 - 2
    Result with xmlns:
    process
    tgt ns http://serena.com/CreateKBEntryService
    Iterator 1 - 0 //instead of 0 should return 1

    LOL
    This is what you get for working 12 hours straight....
    I changed:
    xmlObject["mydoc"]["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]<br>
    to:
    #mydoc["modelglue"]["event-handlers"]["event-handler"][i].xmlAttrib utes["name"]#<br>
    xmlObject is the name of my xml object in memory, and then you reference from the root of the xml doc down the chain.
    Sorry for the inconvenience,
    Rich

  • How to parse SOAP XML output and load to oracle9i table

    Below is the SOAP output response and I need to load the data into oracle 9i database tables.
    I am able to parse regular XML without namespaces but unable to parse the data with namespaces.
    I would need help in parsing this XML.
    <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" xmlns:u="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
    <s:Header>
    <o:Security s:mustUnderstand="1" xmlns:o="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd">
    <u:Timestamp u:Id="_0">
    <u:Created>2011-11-04T23:16:08.437Z</u:Created>
    <u:Expires>2011-11-04T23:21:08.437Z</u:Expires>
    </u:Timestamp>
    </o:Security>
    </s:Header>
    <s:Body>
    <AssetGetListResponse xmlns="http://dev.services.xerox.com">
    <AssetGetListResult xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS" xmlns:i="http://www.w3.org/2001/XMLSchema-instance">
    <a:AssetFeed>
    <a:AccountID>de5862bf-f223-e011-bd3b-0024e861b15c</a:AccountID>
    <a:AccountName>MPS-API Sandbox</a:AccountName>
    <a:AssetID>ecf1545a-f1e9-e011-8a8a-0024e861b15c</a:AssetID>
    <a:AssetNumber>57119B28</a:AssetNumber>
    <a:AssetTag3rdParty i:nil="true"/>
    <a:ChargebackCodeID>1a5962bf-f223-e011-bd3b-0024e861b15c</a:ChargebackCodeID>
    <a:ContractNumber i:nil="true"/>
    <a:ContractTypeDescription i:nil="true"/>
    <a:ControlID i:nil="true"/>
    <a:Group i:nil="true"/>
    <a:GroupID i:nil="true"/>
    <a:InScope>false</a:InScope>
    <a:MACAddress>0000AA713E97</a:MACAddress>
    <a:Manufacturer>Xerox</a:Manufacturer>
    <a:Model>WorkCentre Pro 265</a:Model>
    <a:ModifiedDate>2011-11-02T16:52:12.947Z</a:ModifiedDate>
    <a:PricePlanID>c25a62bf-f223-e011-bd3b-0024e861b15c</a:PricePlanID>
    <a:SerialNumber>UTU101993N</a:SerialNumber>
    <a:VersionNumber>634558495329470000</a:VersionNumber>
    </a:AssetFeed>
    <a:AssetFeed>
    <a:AccountID>de5862bf-f223-e011-bd3b-0024e861b15c</a:AccountID>
    <a:AccountName>MPS-API Sandbox</a:AccountName>
    <a:AssetID>b33b5160-f1e9-e011-8a8a-0024e861b15c</a:AssetID>
    <a:AssetNumber>7EE42ADC</a:AssetNumber>
    <a:AssetTag3rdParty i:nil="true"/>
    <a:ChargebackCodeID>1a5962bf-f223-e011-bd3b-0024e861b15c</a:ChargebackCodeID>
    <a:ContractNumber i:nil="true"/>
    <a:ContractTypeDescription i:nil="true"/>
    <a:ControlID i:nil="true"/>
    <a:Group i:nil="true"/>
    <a:GroupID i:nil="true"/>
    <a:InScope>false</a:InScope>
    <a:MACAddress>0800379B4C2A</a:MACAddress>
    <a:Manufacturer>Xerox</a:Manufacturer>
    <a:Model>WorkCentre 7428</a:Model>
    <a:ModifiedDate>2011-11-02T16:52:14.383Z</a:ModifiedDate>
    <a:PricePlanID>c25a62bf-f223-e011-bd3b-0024e861b15c</a:PricePlanID>
    <a:SerialNumber>PBB015012</a:SerialNumber>
    <a:VersionNumber>634558495343830000</a:VersionNumber>
    </a:AssetFeed>
    </AssetGetListResult>
    </AssetGetListResponse>
    </s:Body>
    </s:Envelope>
    This is what I tried.
    declare
    lp_parser xmlParser.Parser;
    lx_xmldoc xmlDom.DOMDocument;
    ln_doc_node xmlDom.DOMNode;
    lnl_product xmlDom.DOMNodeList;
    lnl_meter xmlDom.DOMNodeList;
    ln_product xmlDom.DOMNode;
    ln_meter xmlDom.DOMNode;
    li_product_cnt NUMBER;
    li_product_max NUMBER;
    li_meter_cnt NUMBER;
    li_meter_max NUMBER;
    lnl_asset_meter_nodes xmldom.DOMNodeList;
    ln_asset_meter_node xmldom.DOMNode;
    ls_batch_number VARCHAR2(30);
    ldt_proc_dt DATE;
    ls_batch_item VARCHAR2(30);
    ls_place_id place.place_id%TYPE;
    ls_product_id product.product_id%TYPE := ' ';
    ls_contract_id contract.contract_id%TYPE;
    li_contract_version contract.contract_version%TYPE;
    li_contract_sequence contr_product.sequence%TYPE;
    ls_meter_id meter_log.meter_id%TYPE;
    ls_read_type meter_log.read_type%TYPE;
    ldt_reading_dt meter_log.reading_dt%TYPE;
    li_meter_value meter_log.meter_value%TYPE;
    li_adjust_copies meter_log.meter_value%TYPE;
    ls_meter_type VARCHAR2(20);
    ls_serial_id product.serial_id%TYPE;
    ls_meter_read_type VARCHAR2(50);
    invalid_parsing EXCEPTION;
    PRAGMA EXCEPTION_INIT(invalid_parsing, -20100);
    BEGIN
    FOR meter_xml_rec IN (SELECT SOAP_RESPONSE
    FROM temp_table
    WHERE call_id=2) LOOP
    lp_parser := xmlparser.newParser;
    xmlparser.parseClob(lp_parser, meter_xml_rec.SOAP_RESPONSE);
    lx_xmldoc := xmlparser.getDocument(lp_parser);
    xmlparser.freeParser(lp_parser);
    ln_doc_node := xmlDom.makeNode(lx_xmldoc);
    ls_batch_number := xslProcessor.valueOf(ln_doc_node, 'AssetGetListResponse/AssetGetListResult/AssetFeed/AccountID');
    lnl_product := xslprocessor.selectNodes(ln_doc_node, 'AssetGetListResponse/AssetGetListResult/a:AssetFeed');
    li_product_max := xmlDom.getLength(lnl_product)-1;
    FOR li_product_cnt IN 0..li_product_max LOOP
    ln_product := xmlDom.item(lnl_product, li_product_cnt);
    ls_batch_item := xslProcessor.valueOf(ln_product, 'AccountName');
    END LOOP;
    END LOOP;
    END;
    OUTPUT:
    =========================================
    3:32:41 PM *
    **3:32:41 PM ORA-20100: Error occurred while processing: Namespace prefix 'a' used but not declared.**
    3:32:41 PM ORA-06512: at "SYS.XSLPROCESSOR", line 22
    3:32:41 PM ORA-06512: at "SYS.XSLPROCESSOR", line 502
    3:32:41 PM ORA-06512: at line 50
    3:32:41 PM *** Script stopped due to error ***
    3:32:41 PM End SQL Editor Execution

    Hi,
    Something like this :
    lnl_product := xslprocessor.selectNodes(
                     ln_doc_node
                   , '/s:Envelope/s:Body/AssetGetListResponse/AssetGetListResult/a:AssetFeed'
                   , 'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/", xmlns="http://dev.services.xerox.com", xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS"'
    li_product_max := xmlDom.getLength(lnl_product)-1;
    FOR li_product_cnt IN 0..li_product_max LOOP
      ln_product := xmlDom.item(lnl_product, li_product_cnt);
      ls_batch_item := xslProcessor.valueOf(ln_product, 'a:AccountName', 'xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS"');
    END LOOP;
    ...Or, using a single query :
    SQL> SELECT extractValue(value(x), '/AssetFeed/AccountID', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AccountID
      2       , extractValue(value(x), '/AssetFeed/AccountName', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AccountName
      3       , extractValue(value(x), '/AssetFeed/AssetID', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AssetID
      4       , extractValue(value(x), '/AssetFeed/AssetNumber', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as AssetNumber
      5       , extractValue(value(x), '/AssetFeed/SerialNumber', 'xmlns="http://schemas.datacontract.org/2004/07/Xerox.MPS"') as SerialNumber
      6  FROM temp_table t
      7     , TABLE(
      8         XMLSequence(
      9           EXTRACT(
    10             XMLType(t.soap_response)
    11           , '/s:Envelope/s:Body/AssetGetListResponse/AssetGetListResult/a:AssetFeed'
    12           , 'xmlns:s="http://schemas.xmlsoap.org/soap/envelope/", xmlns="http://dev.services.xerox.com", xmlns:a="http://schemas.datacontract.org/2004/07/Xerox.MPS"'
    13           )
    14         )
    15       ) x
    16  WHERE t.call_id = 2
    17  ;
    ACCOUNTID                                      ACCOUNTNAME           ASSETID                                   ASSETNUMBER    SERIALNUMBER
    de5862bf-f223-e011-bd3b-0024e861b15c           MPS-API Sandbox       ecf1545a-f1e9-e011-8a8a-0024e861b15c      57119B28       UTU101993N
    de5862bf-f223-e011-bd3b-0024e861b15c           MPS-API Sandbox       b33b5160-f1e9-e011-8a8a-0024e861b15c      7EE42ADC       PBB015012

  • How to create new XML file using retreived XML content by using SAX API?

    hi all,
    * How to create new XML file using retreived XML content by using SAX ?
    * I have tried my level best, but output is coming invalid format, my code is follows,
    XMLFileParser.java class :-
    import java.io.StringReader;
    import java.io.StringWriter;
    import javax.xml.transform.OutputKeys;
    import javax.xml.transform.Transformer;
    import javax.xml.transform.TransformerConfigurationException;
    import javax.xml.transform.TransformerException;
    import javax.xml.transform.TransformerFactory;
    import javax.xml.transform.dom.DOMResult;
    import javax.xml.transform.sax.SAXSource;
    import javax.xml.transform.sax.SAXTransformerFactory;
    import javax.xml.transform.sax.TransformerHandler;
    import javax.xml.transform.stream.StreamResult;
    import org.w3c.dom.Document;
    import org.xml.sax.Attributes;
    import org.xml.sax.InputSource;
    import org.xml.sax.SAXException;
    import org.xml.sax.helpers.XMLFilterImpl;
    public class PdfParser extends XMLFilterImpl {
        private TransformerHandler handler;
        Document meta_data;
        private StringWriter meta_data_text = new StringWriter();
        public void startDocument() throws SAXException {
        void startValidation() throws SAXException {
            StreamResult streamResult = new StreamResult(meta_data_text);
            SAXTransformerFactory factory = (SAXTransformerFactory) SAXTransformerFactory.newInstance();
            try
                handler = factory.newTransformerHandler();
                Transformer transformer = handler.getTransformer();
                transformer.setOutputProperty(OutputKeys.ENCODING, "UTF-8");
                transformer.setOutputProperty(OutputKeys.INDENT, "yes");
                handler.setResult(streamResult);
                handler.startDocument();
            catch (TransformerConfigurationException tce)
                System.out.println("Error during the parse :"+ tce.getMessageAndLocation());
            super.startDocument();
        public void startElement(String namespaceURI, String localName,
                String qualifiedName, Attributes atts) throws SAXException {
            handler.startElement(namespaceURI, localName, qualifiedName, atts);
            super.startElement(namespaceURI, localName, qualifiedName, atts);
        public void characters(char[] text, int start, int length)
                throws SAXException {
            handler.characters(text, start, length);
            super.characters(text, start, length);
        public void endElement(String namespaceURI, String localName,
                String qualifiedName) throws SAXException {
            super.endElement("", localName, qualifiedName);
            handler.endElement("", localName, qualifiedName);
        public void endDocument() throws SAXException {
        void endValidation() throws SAXException {
            handler.endDocument();
            try {
                TransformerFactory transfactory = TransformerFactory.newInstance();
                Transformer trans = transfactory.newTransformer();
                SAXSource sax_source = new SAXSource(new InputSource(new StringReader(meta_data_text.toString())));
                DOMResult dom_result = new DOMResult();
                trans.transform(sax_source, dom_result);
                meta_data = (Document) dom_result.getNode();
                System.out.println(meta_data_text);
            catch (TransformerConfigurationException tce) {
                System.out.println("Error occurs during the parse :"+ tce.getMessageAndLocation());
            catch (TransformerException te) {
                System.out.println("Error in result transformation :"+ te.getMessageAndLocation());
    } CreateXMLFile.java class :-
    Sax.startDocument();
    Sax.startValidation();
    Sax.startElement("", "pdf", "pdf", new AttributesImpl());
    Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());          
    String xmp_str = new String(meta_data.getByteArray(),"UTF8");
    char[] xmp_arr = xmp_str.toCharArray();
    Sax.characters(xmp_arr, 0, xmp_arr.length);
    Sax.endElement("", "pdf", "pdf");
    Sax.endValidation();
    Sax.endDocument();
    Sax.endElement("", "basic-metadata", "basic-metadata");* In CreateXMLFile.java
    class, I have retreived the xml content in the meta_data object, after that i have converted into character array and this will be sends to SAX
    * In this case , the XML file created successfully but the retreived XML content added as an text in between basic-metadata Element, that is, retreived XML content
    is not an XML type text, it just an Normal text Why that ?
    * Please help me what is the problem in my code?
    Cheers,
    JavaImran

    Sax.startDocument();
    Sax.startValidation();
    Sax.startElement("", "pdf", "pdf", new AttributesImpl());
    Sax.startElement("", "basic-metadata", "basic-metadata", new AttributesImpl());          
    String xmp_str = new String(meta_data.getByteArray(),"UTF8");
    char[] xmp_arr = xmp_str.toCharArray();
    Sax.characters(xmp_arr, 0, xmp_arr.length);
    </code><code>Sax.endElement("", "basic-metadata", "basic-metadata");</code>
    <code class="jive-code jive-java">Sax.endElement("", "pdf", "pdf");
    Sax.endValidation();
    Sax.endDocument();     
    * I HAVE CHANGED MY AS PER YOUR SUGGESTION, NOW SAME RESULT HAS COMING.
    * I AM NOT ABLE TO GET THE EXACT OUTPUT.,WHY THAT ?
    Thanks,
    JavaImran{code}

  • How quickly parse big XML file (60 MB) ???

    How quickly parse big XML file (60 MB) ???

    I assume you mean load it into XML DB ?. Fundamentally your document is about the upper limit for 9.2.x. I would strongly recommend trying to break it up into a set of smaller documents using a SAX parser before trying to load it into XML DB. In 10g it should be possible to load much bigger documents than this.

  • How to retrieve data (xml file) using jsp

    I am a newbie to xml. I have decided to store my information in the xml file. may I know how can I retrieve my information from the xml file?
    Thanx in advance.

    I am a newbie to xml. I have decided to store my
    information in the xml file. may I know how can I
    retrieve my information from the xml file?
    Thanx in advance.You can get the information from the XML file using one of the parsers available, such as Xerces http://xml.apache.org, and JDOM as an API.
    Using this you have the option of having a SAXParser or a DOMParser.
    SAX (Simple API for XML) is an event based parser, so if you know the XML structure, and need to find a certain element, you can just look for the element name,and retrieve the value of the element, it's attributes and its children.
    DOM(Document Object Model)represents the XML as a tree, but uses more resources as it stores the entire tree in memory. But it is good in that you can traverse the whole tree.
    JDOM would be a good idea too. If you download this, you can use it's API, which is very good, that will use the parser on your system (Xerces). I would definately recommend JDOM.

  • HT5570 My six-year old grandson appears to be able to make purchases on the TV without having to enter the password and yet every other device i use (e.g. iPad, iPhone, iPod) is password protected. How is that possible?

    My six-year old grandson appears to be able to make purchases on the TV without having to enter the password and yet every other device i use (e.g. iPad, iPhone, iPod) is password protected. How is that possible when I have to use my password to access such services on all other devices?

    DominicDeBurca wrote:
    My six-year old grandson appears to be able to make purchases on the TV without having to enter the password and yet every other device i use (e.g. iPad, iPhone, iPod) is password protected. How is that possible when I have to use my password to access such services on all other devices?
    Having AppleTV remember the password is optional.
    Logout of iTunes store, log back in and hopefully next time you come to purchase you'll be prompted for your password but decline the option to remember it.  You might also want to look out of parental controls on the unit.
    AC

  • Does anyone know how to export photos on MacBook Pro to iPad without using iTunes?  The iPad is synched to another Mac and I don't want to synch the iPad to my Mac but just transfer photos

    Does anyone know how to transfer photos from a MacBook Pro to an iPad3 without using iTunes?
    The iPad is synched to another Mac and I don't want to change the synch relationship of the iPad but want to transfer some photos.

    https://www.dropbox.com
    being a Mac newbie try to google to do research.

  • I want to use my IPOD Classic 160gb for notepad entries in addition to the music and books I listen to. It is set to "Open ITunes when connected to computer" and "manually manage music and videos". How can I do that without losing some of the features

    I want to use my IPOD Classic 160gb for notepad entries in addition to the music and books I listen to. It is set to "Open ITunes when connected to computer" and "manually manage music and videos".  How can I do that without losing some of the features of those two?   I just want to add a feature.  Thanks

    Settings>Store (or iTunes & App Stores if you are running iOS6)>Apple ID. Tap your son's ID and sign out. Sign in with your ID and password.
    You shouldn't lose the music, but if you try to update any apps that you bought with the family ID, you will have to use that password that is linked with that ID in order to update.
    Avoid downloading past purchased content with the old ID if you can since you will associate the iPad with the old ID for 90 days and you will lock yourself out of your own, new ID for that period of time. Read more about associated devices in iTunes here.
    iTunes Store: Associating a device or computer to your Apple ID

  • How do i install opensolaris without using the virtual box??

    hi.
    i am new to solaris
    i am currently using a windows XP OS
    i got down the opensolaris cd from SUN
    how do i install opensolaris without using a virtual box ?

    The OpenSolaris CD is a "Live CD". You can boot off of the CD, and either run the OpenSolaris operating system directly, or you can select the "Install" icon on the LiveCD desktop. You can find full instructions here: http://dlc.sun.com/osol/docs/content/IPS/getst1.html
    Do you want to keep your Windows OS on the disk? If so, then you want to follow the instructions for partitioning your disk (unless you already have a spare partition).
    -- Alan

  • Problem in parsing a xml string using dom parser

    i want to parse a Xml String using a Dom parser......the parse function in dom parser takes only input stream as argument.......so i made the code as
    InputStream inputstream = new StringBufferInputStream(XmlData) ;
    InputSource inputSource = new InputSource(inputstream );
    but saxexception is coming and also warning called
    "java.io.StringBufferInputStream in java.io has been deprecated"
    please help me.........

    i want to parse a Xml String using a Dom
    parser......the parse function in dom parser takes
    only input stream as argument.......This is not true of the DOM parser in Java 1.4. So you might want to get rid of your old parser and replace it by something more current. Or perhaps you are using 1.4 and you just didn't read all of the API docs.

  • How to set item values without using fields in branch's ACTION block?

    Okay, I will try to say this in a easy way so it is not weird.
    I have created a button, SAVE, that has a Branch of branch type: Branch To Function Returning A Page. This is my code for the branch:
    if :P2008_NAP_SUPPORTING_MATERIALS = 'Yes' then
    return '2092';
    else
    return '2040';
    end if;
    The code for this type of branch is stored in the ACTION block of the Branch page. The ACTION block for a Branch of branch type: Branch To Function Returning A Page is different than the ACTION block for a Branch of branch type: Branch To Page Or URL.
    I need to set some item values with some specific values, which I can do with a branch type: Branch To Page Or URL. This is not possible with the branch type: Branch To Function Returning A Page. The ACTION block is totally different.
    How can I set some values on say Page 2040 from Page 2008 without using fields in the branch's ACTION block?
    Thank you in advance,
    Maggie

    Andy and Scott,
    I love seeing different perspectives in solving problems, it opens my eyes to new ways of looking at/using the tools (reserved words and 'Function returning a Page', etc.).
    One of my pet peeves has been that on branches I was limited to only 10 variables to be passed (I know, who would want more - but there was an instance where I had to pass more), and an even more frustrating time when using report Column Linking, which limits me to 3 variables.
    At least with the Branch linking I can use your suggestion Andy and add the variable setting statements into the function. I am assuming of course (and I should be able to) that I will be able to set more that 10 variables in a IF condition prior to the RETURN statement. This method will be much more understandable, for me, when looking through the branch at a later time to see what is happening, than an URL link where all the variable are strung out 'in a line' so to speak.
    I will still need to use URL Target branching on Links contained within a Column Attribute when I need to pass more than 3 variables, of which I have several places where I do this.
    Thomas

  • How to connect to AD without using ADWS?

    How to connect to AD without using ADWS? Is it possible to do it? If yes, can teach me how to connect to AD and find their attributed?

    Hi Noobycy,
    There are few tools to find AD attributes without ADWS. See options you have below
    1.ADFIND -
    http://www.joeware.net/freetools/tools/adfind/  This is a command Line tool
    2.
    The ADSIEDIT tool
    from the Windows Support Tools is a great tool to "explore" the AD.
    http://technet.microsoft.com/en-us/library/cc731547.aspx
    3. ADUC -
    http://www.boostsolutions.com/blog/how-to-find-attributes-of-objects-in-active-directory/
    Regards, MassonTech

Maybe you are looking for

  • Missing Tax information of Customer Master data

    Dear all, I have an error with Customer Account Group. I create a customer account group as Z001 (Domestic customer). After that, I go through Financial Accounting - Account Receivable and Account payable - Customer Account - Master Data - Preparatio

  • Create Accounting could not be done after voiding some payment.

    Hi, I am facing a unique problem. We have some payments which have been accounted properly and transferred to GL. But for some business issue we have to cancel those payments. But when we have voided those payments and tried to create account it it s

  • Mac Address flickering

    I have an All-in-one hp touchsmart 600 PC. I have connected it on LAN via ethernet cable. It was working fine then one day the mac address of my hp touchsmart 600 PC changed (The last four digits changed) resulting in port violation on switch. The lo

  • How do I delete duplicate fonts in font folder?

    Multiple copies of TimesSem  Oct 21, 2013  7:24 PM  Zero bytes  Document  are in my font folder. Exactly 147,134 copies. I've been deleting them in batches and emptying the Trash but it's taking a long time. How do I get rid of them quicker? What may

  • 9iAS v9.0.3 installation  PROBLEM !!

    I am trying to install Oracle9iAS J2EE and Web Cache v9.0.3 on to a XP Pro machine. But I am getting an error while running the Installer. The error msg is the following: Oracle9i Application Server requires Service Pack 1 or higher for Windows2000 m