virtualtable loadfromfile with xml error;

Discussion of open issues, suggestions and bugs regarding Virtual Data Access Components for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

virtualtable loadfromfile with xml error;

Post by xalion » Mon 12 Aug 2013 03:40

I use virtualtable savetoxml function save a file,
and use loadfromfile function to load this file.
it can't load fileds value correct.

xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

Re: virtualtable loadfromfile with xml error;

Post by xalion » Mon 12 Aug 2013 03:42

my delphi is xe4,
virtualtable is 9.02.
os is win7 , simplechinese.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: virtualtable loadfromfile with xml error;

Post by AlexP » Mon 12 Aug 2013 09:35

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

xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

Re: virtualtable loadfromfile with xml error;

Post by xalion » Tue 13 Aug 2013 09:17

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'?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: virtualtable loadfromfile with xml error;

Post by AlexP » Tue 13 Aug 2013 09:27

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

xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

Re: virtualtable loadfromfile with xml error;

Post by xalion » Tue 13 Aug 2013 10:56

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>

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: virtualtable loadfromfile with xml error;

Post by AlexP » Wed 14 Aug 2013 08:41

hello,

Please send the generated XML file to alexp*devart*com

xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

Re: virtualtable loadfromfile with xml error;

Post by xalion » Wed 14 Aug 2013 14:24

ok,I send it to you.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: virtualtable loadfromfile with xml error;

Post by AlexP » Thu 15 Aug 2013 10:49

Hello,

The XML you have sent is loaded with no errors. Please send your table dump.

xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

Re: virtualtable loadfromfile with xml error;

Post by xalion » Thu 15 Aug 2013 13:11

I can't load this xml file.
and what's "table dump"?

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: virtualtable loadfromfile with xml error;

Post by AlexP » Thu 15 Aug 2013 13:32

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.

xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

Re: virtualtable loadfromfile with xml error;

Post by xalion » Thu 15 Aug 2013 16:37

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.

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: virtualtable loadfromfile with xml error;

Post by AlexP » Mon 19 Aug 2013 09:52

Hello,

Please provide the exact regional settings of the Windows on which this problem occurs

xalion
Posts: 124
Joined: Fri 20 May 2005 10:08

Re: virtualtable loadfromfile with xml error;

Post by xalion » Tue 20 Aug 2013 02:17

my regional settings is china (codepage 936)

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Re: virtualtable loadfromfile with xml error;

Post by AlexP » Tue 20 Aug 2013 09:32

Hello,

Thank you for the information. We have reproduced the problem and will fix it as soon as possible.

Post Reply