All Forums Aster
gtu4teradata 4 posts Joined 03/11
16 Nov 2015
Loading XML files in Aster

Hi,
I need to load an xml file in Aster Database
I need to use functions like XMLParser OR XMLRelation.
But both the above functions need a table as input. So how do I get this xml file into a table
 
Thanks,
Jeetu
 

shiboo18 6 posts Joined 06/16
21 Jun 2016

I know I am late to answer this question.
But hopefully, this will help people in future.
Two steps:
1. Create a table 
CREATE TABLE TEST( xid int, xml varchar);
2. Format the xml file into a single line using following cmd on linux -

perl -p -i -e 's/\R//g;' <filename>

 

Output of this cmd is that the file contains the formatted xml in a single line.

 

3. Open the file in a text editor like Notepad++ .

Add a fake xid column at the beginning of the file and add a tab .

The content of your file after editing should  look like :

XID    <TAB_SPACE>      XML_CONTENT_IN_ONE_LINE   

 

4. Lastly using Aster101 videos Module 3 , you can load the data from your file into the database.

 

You are ready to perform XML operations on the data.

 

 

You must sign in to leave a comment.