Page 1 of 2
Timport XML and blob
Posted: Mon Jun 10, 2002 3:49 pm
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
Timport XML and blob
Posted: Mon Jun 10, 2002 4:40 pm
by mark
Use blob in your schema (not varchar) for blob fields.
Timport XML and blob
Posted: Mon Jun 10, 2002 5:38 pm
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
Timport XML and blob
Posted: Mon Jun 10, 2002 6:16 pm
by mark
Timport XML and blob
Posted: Mon Jun 10, 2002 8:19 pm
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!!
Timport XML and blob
Posted: Mon Jun 10, 2002 10:44 pm
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?
Timport XML and blob
Posted: Tue Jun 11, 2002 12:26 am
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!!
Timport XML and blob
Posted: Tue Jun 11, 2002 10:16 am
by mark
Simplest for that dataset is just use rex. Here's one way:
<rex row ">><z:row DOCID\='\P=[^']*'/>">
<$DOCID=$ret>
</rex>
Timport XML and blob
Posted: Tue Jun 11, 2002 10:58 am
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
Timport XML and blob
Posted: Tue Jun 11, 2002 11:50 am
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".