I have an XML file which I process by extracting tag values and inserting them into a table. The problem comes when the file has multiple entries of the same type, like the one below. Is there any way to loop between the xml tag or between the Document tag. The problem is really simple (in theory), but I am not very experienced with transforming XML files with PL/SQL. Do you have any suggestions ?
<?xml version="1.0" encoding="UTF-8" ?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:ps.002.002.004"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BlaBluBli>
<GrpHdr>
<MsgId>GJ1</MsgId>
<Acbm>2010-09-22T14:47:05</Acbm>
<NbOfTxs>1</NbOfTxs>
<OtherTag >1.01</OtherTag>
<ThisTag>2015-02-09</ThisTag>
</GrpHdr>
</BlaBluBli>
</Document>
<?xml version="1.0" encoding="UTF-8" ?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:ps.002.002.004"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BlaBluBli>
<GrpHdr>
<MsgId>GJ2</MsgId>
<Acbm>2010-09-22T14:47:05</Acbm>
<NbOfTxs>1</NbOfTxs>
<OtherTag >2.01</OtherTag>
<ThisTag>2015-02-09</ThisTag>
</GrpHdr>
</BlaBluBli>
</Document>
<?xml version="1.0" encoding="UTF-8" ?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:ps.002.002.004"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BlaBluBli>
<GrpHdr>
<MsgId>GJ3</MsgId>
<Acbm>2010-09-22T14:47:05</Acbm>
<NbOfTxs>1</NbOfTxs>
<OtherTag >3.01</OtherTag>
<ThisTag>2015-02-09</ThisTag>
</GrpHdr>
</BlaBluBli>
</Document>
The result should be three files.
1-
<?xml version="1.0" encoding="UTF-8" ?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:ps.002.002.004"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BlaBluBli>
<GrpHdr>
<MsgId>GJ1</MsgId>
<Acbm>2010-09-22T14:47:05</Acbm>
<NbOfTxs>1</NbOfTxs>
<OtherTag >1.01</OtherTag>
<ThisTag>2015-02-09</ThisTag>
</GrpHdr>
</BlaBluBli>
</Document>
2-
<?xml version="1.0" encoding="UTF-8" ?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:ps.002.002.004"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BlaBluBli>
<GrpHdr>
<MsgId>GJ2</MsgId>
<Acbm>2010-09-22T14:47:05</Acbm>
<NbOfTxs>1</NbOfTxs>
<OtherTag >2.01</OtherTag>
<ThisTag>2015-02-09</ThisTag>
</GrpHdr>
</BlaBluBli>
</Document>
3-
<?xml version="1.0" encoding="UTF-8" ?>
<Document xmlns="urn:iso:std:iso:20022:tech:xsd:ps.002.002.004"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BlaBluBli>
<GrpHdr>
<MsgId>GJ3</MsgId>
<Acbm>2010-09-22T14:47:05</Acbm>
<NbOfTxs>1</NbOfTxs>
<OtherTag >3.01</OtherTag>
<ThisTag>2015-02-09</ThisTag>
</GrpHdr>
</BlaBluBli>
</Document>