Timport XML and blob

skalyanaraman
Posts: 109
Joined: Tue May 29, 2001 9:13 pm

Timport XML and blob

Post by skalyanaraman »

Hi,
I am trying Timport with an xml file as source. I searched in the message board and got lots of useful info. I am finally at a point where I got the schema ready, xml file ready. But the timport is failing with the following message:

015 Field types differ for field "tbldisctemp.DOCTEXT": table says blob(14), schema says varchar(66)

The table tbldisctemp is already there and the DOCTEXT field is blob. any reason why it is failing?
When I use timport with the -D option is is dumping out the correct info to the screen.

Thanks
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Timport XML and blob

Post by mark »

Use blob in your schema (not varchar) for blob fields.
skalyanaraman
Posts: 109
Joined: Tue May 29, 2001 9:13 pm

Timport XML and blob

Post by skalyanaraman »

Thanks for help. That worked. But now I have a problem where I dont get one record per tag. For example, I have,
the xml,
<xml>
<rs:data>
<z:row DOCID=”CRD000000001_MSG”>test</z:row>
<z:row DOCID=”CRD000000002_MSG”>ttaa</z:row>
</rs:data>
</xml>

and the schema,
database f:\database\xmltimp
table tbltemp
xml nohtml
keepfirst
multiple
noid tbltemp

# Name Type Tag
field DOCID varchar(255) xml/rs:data/z:row@DOCID

WHen I try to display by -D I see,
301 33 tbltemp.DOCID="CRD000000001_MSG
CRD000000002_MSG"

why? I would like two records out of the xml file.

Help please.. Thanks
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Timport XML and blob

Post by mark »

skalyanaraman
Posts: 109
Joined: Tue May 29, 2001 9:13 pm

Timport XML and blob

Post by skalyanaraman »

Thanks for the help, again. I seem to be hitting more problems as I go deep into this. I was successful in getting the multiple records from the while and I got this error after it went through the xml data someway,

DOCID: CRD000000025_MSG
<!-- 011 skimport:22: Not enough space -->
<!-- 011 skimport:15: Can't alloc 5041 bytes of memory: No error in the function
vx_dupdata -->

This is my code,


<read "f:\database\bostontest\testsch2.txt"><$sch=$ret>

<read "f:\database\bostontest\timporttemp.xml"><$data=$ret>

<$recorddata="">
<$xmldata='<xml>'>

<rex ROW ">><z:row=!/>+/>" $data>
<sum %s $recorddata $ret>
<$recorddata=$ret>
<sum %s $xmldata $recorddata '</xml>'>

<$xmldata=$ret>

<timport ROW $sch $xmldata>

DOCID: $DOCID
</timport>

<$recorddata="">
<$xmldata='<xml>'>

</rex>

Thanks!!
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Timport XML and blob

Post by mark »

That's just twisty. Why are you parsing the data with rex, reformatting it, then parsing again with timport? What's the real job trying to be accomplished?
skalyanaraman
Posts: 109
Joined: Tue May 29, 2001 9:13 pm

Timport XML and blob

Post by skalyanaraman »

Well, here is what I wanted to do. I get data from sqlserver as
<xml>
<rs:data>
<z:row DOCID='test'/>
<z:row DOCID='tada'/>
<rs:data></xml>

When I try to the timport directly on this I could not get multiple rows, just like conversation 3 above.
So, I am trying to faux the xml I have in the format,
<xml> <z:row...></xml>
so that I could get multiple records out and hence the format and timport and so on...

any other easier ways of doing this?
thanks!!
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Timport XML and blob

Post by mark »

Simplest for that dataset is just use rex. Here's one way:
<rex row ">><z:row DOCID\='\P=[^']*'/>">
<$DOCID=$ret>
</rex>
skalyanaraman
Posts: 109
Joined: Tue May 29, 2001 9:13 pm

Timport XML and blob

Post by skalyanaraman »

Thanks. I just gave an example before. The z:row has more than DOCID. It is a list of fields from a sqlserver table like,
DOCID,DOCTEXT,BATES,DATE1 and so on...
So the xml is
<xml>
<rs:data> <z:row DOCID='test' DOCTEXT='testdoctest' BATES='12312' .../> </rs:data></xml>
That is why I used timport after the format as I can easily tear the data out by using a schema.
In the above way, I may have to write a bunch of Rex expressions for each field, right? Even then to get a record out of it is going to be not easy to put it into Texis, like a row of DOCID,DOCTEXT,BATES,DATE1,..

Am I explaining it is well? sorry if it is confusing.
thanks
User avatar
mark
Site Admin
Posts: 5519
Joined: Tue Apr 25, 2000 6:56 pm

Timport XML and blob

Post by mark »

We can't help if we get inaccurate information. Please provide a complete sample output including 2 complete "records" so we can see what you're really dealing with. (If there's a large text portion you can abbreviate that.) Also indicate what you're considering a "record".
Post Reply