Skip to Main Content

DevOps, CI/CD and Automation

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Appending a header to an XML file

ApexPhilJan 6 2016 — edited Mar 5 2016

A company is supplying an XML file which can't be read as an XMLTYPE because it doesn't have a proper header. We aren't able to get them to amend it and I'd prefer not to amend it ourselves with an operating system script, although that would be the last resort.


As they will be supplying files like this on an ongoing basis, is there a way in the database to wrap the following header and footer around the XML file?


Header at the start: xmltype('<?xml version="1.0" encoding="ISO-8859-1"?><route>')

The file: This would be xmltype(bfilename('IMPORT_DIR', 'test_file.xml'), nls_charset_id('ISO-8859-1'))  except it doesn't work as an XMLTYPE at the moment due to not having a valid header. Therefore we just have a file called test_file.xml which I need to wrap a header and footer around.

Footer at the end:   xmltype('</route>'


I know the correct way would be to get the company fix the rubbish they are sending us but it isn't an option.

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Apr 2 2016
Added on Jan 6 2016
3 comments
2,709 views