Loading XML files in Aster

Aster

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

1 REPLY

Re: Loading XML files in Aster

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.