Page 1 of 1
virtualtable loadfromfile with xml error;
Posted: Mon 12 Aug 2013 03:40
by xalion
I use virtualtable savetoxml function save a file,
and use loadfromfile function to load this file.
it can't load fileds value correct.
Re: virtualtable loadfromfile with xml error;
Posted: Mon 12 Aug 2013 03:42
by xalion
my delphi is xe4,
virtualtable is 9.02.
os is win7 , simplechinese.
Re: virtualtable loadfromfile with xml error;
Posted: Mon 12 Aug 2013 09:35
by AlexP
Hello,
If you are using Unicode symbols, you should create WideString and WideMemo instead of String and Memo for correct work. In this case, data will be stored and loaded correctly
Re: virtualtable loadfromfile with xml error;
Posted: Tue 13 Aug 2013 09:17
by xalion
Thank for your reply,
I have used follow code:
vt.Close;
cx.Open;
vt.Assign(cx); // cx is a adoquery
vt.open;
vt.SaveToXML('d:\mytest2.xml');
it saved a xml file;
and use follow code to load the xml file:
vt.Close;
vt.LoadFromFile('d:\mytest2.xml');
it shows error.
I don't know where to use ' create WideString and WideMemo instead of String and Memo'?
Re: virtualtable loadfromfile with xml error;
Posted: Tue 13 Aug 2013 09:27
by AlexP
Hello,
Please provide the script of the table used in ADO, as well as the text of the error message you get when loading from the file to VT
Re: virtualtable loadfromfile with xml error;
Posted: Tue 13 Aug 2013 10:56
by xalion
CREATE TABLE dev.dbo.aa (
dev_type nvarchar(50) NULL,
dev_name nvarchar(50) NULL
)
cx.sql='select * from aa'
error message:'parser:the unknown symbol'
the saved xml file is:
<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882' xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882' xmlns:rs='urn:schemas-microsoft-com:rowset' xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:updatable='true'>
<s:AttributeType name='dev_type' rs:number='1' rs:nullable='true' rs:writeunknown='true'>
<s:datatype dt:type='string' dt:maxLength='50' />
</s:AttributeType>
<s:AttributeType name='dev_name' rs:number='2' rs:nullable='true' rs:writeunknown='true'>
<s:datatype dt:type='string' dt:maxLength='50' />
</s:AttributeType>
<s:extends type='rs:rowbase' />
</s:ElementType>
</s:Schema>
<rs:data>
<z:row dev_type='张宝蓝,上明关心' dev_name='张宝蓝' />
<z:row dev_type='张宝蓝,上明关心' dev_name='张宝蓝' />
<z:row dev_type='张宝蓝,上明关心' dev_name='张宝蓝' />
<z:row dev_type='张宝蓝,上明关心' dev_name='张宝蓝' />
<z:row dev_type='张宝蓝,上明关心' dev_name='张宝蓝' />
<z:row dev_type='张宝蓝,上明关心' dev_name='张宝蓝' />
<z:row dev_type='张宝蓝,上明关心' dev_name='张宝蓝' />
</rs:data>
</xml>
Re: virtualtable loadfromfile with xml error;
Posted: Wed 14 Aug 2013 08:41
by AlexP
hello,
Please send the generated XML file to alexp*devart*com
Re: virtualtable loadfromfile with xml error;
Posted: Wed 14 Aug 2013 14:24
by xalion
ok,I send it to you.
Re: virtualtable loadfromfile with xml error;
Posted: Thu 15 Aug 2013 10:49
by AlexP
Hello,
The XML you have sent is loaded with no errors. Please send your table dump.
Re: virtualtable loadfromfile with xml error;
Posted: Thu 15 Aug 2013 13:11
by xalion
I can't load this xml file.
and what's "table dump"?
Re: virtualtable loadfromfile with xml error;
Posted: Thu 15 Aug 2013 13:32
by AlexP
Hello,
Create database backup (
http://technet.microsoft.com/en-us/libr ... 87510.aspx ), if your DB is large volume, move this table to a separate DB and create its backup, also please specify the exact version of SQL Server server and client. You can learn it from the Info sheet of TMSConnection Editor.
Re: virtualtable loadfromfile with xml error;
Posted: Thu 15 Aug 2013 16:37
by xalion
I don't think it's a MS's bug.
I traced the code.
in crxml.pas
in line 205.
Str := Encoding.Default.GetString(FTmpBlock, 0, FLastBlockSize);
I changed it to:
Str := Encoding.UTF8.GetString(FTmpBlock, 0, FLastBlockSize);
and in line 516:
GetXMLNodeAttributes(CRFunctions.UTF8Decode(AnsiString(Value)), FAttrNames, FAttrValues);
I changed it to:
GetXMLNodeAttributes(Value, FAttrNames, FAttrValues);
It works fine for me when record number<458.
but when record number>458. it show 'parser:the unknown symbol' again.
Re: virtualtable loadfromfile with xml error;
Posted: Mon 19 Aug 2013 09:52
by AlexP
Hello,
Please provide the exact regional settings of the Windows on which this problem occurs
Re: virtualtable loadfromfile with xml error;
Posted: Tue 20 Aug 2013 02:17
by xalion
my regional settings is china (codepage 936)
Re: virtualtable loadfromfile with xml error;
Posted: Tue 20 Aug 2013 09:32
by AlexP
Hello,
Thank you for the information. We have reproduced the problem and will fix it as soon as possible.