BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

TClientDataSet Loading from a XML

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML
View previous topic :: View next topic  
Author Message
Marco Azevedo
Guest





PostPosted: Thu Sep 01, 2005 12:50 pm    Post subject: TClientDataSet Loading from a XML Reply with quote




Hi,

The application wich I developed Save and Load xmls using ClientDataSet. Sometimes the xml files can be updated by third party applications. Often this third party application can make mistakes. Some mistakes the ClientDataSet raise an exception so there's ok, I get the exception and everybody is happy(smile). But some mistakes the ClientDataSet does not raise an exception and does not do nothing !!! It breaks my application. If you wanna cause this problem,
first of all save any ClientDataSet Data to a XML file
After that edit this XML file with notepad and exclude any </ROWDATA> tag
finally try do that ClientDataSet.LoadFromFile(MyFile.xml)

So the error occurs.

How can I solve that?

Thank you very much and sorry my english is begginer yet.

Back to top
Douglas Wehmeyer
Guest





PostPosted: Thu Sep 01, 2005 2:55 pm    Post subject: Re: TClientDataSet Loading from a XML Reply with quote



Marco,

You could try loading the doc into a TXMLDocument before loading the
Dataset. This should catch the error in the XML.

Example

procedure TForm1.Button2Click(Sender: TObject);
var
doc : TxmlDocument;
begin
try
doc := TxmlDocument.Create('C:MyXMLFile.xml');
ShowMessage(doc.XML.Text);
finally
doc.Free;
end;
cds.LoadFromFile('C:MyXMLFile.xml');
DataSource1.DataSet := cds;
end;

Sorry Marco I hit the wrong button to reply.

"Marco Azevedo" <azevedomt (AT) hotmail (DOT) com> wrote

Quote:

Hi,

The application wich I developed Save and Load xmls using
ClientDataSet. Sometimes the xml files can be updated by third party
applications. Often this third party application can make mistakes. Some
mistakes the ClientDataSet raise an exception so there's ok, I get the
exception and everybody is happy(smile). But some mistakes the
ClientDataSet does not raise an exception and does not do nothing !!! It
breaks my application. If you wanna cause this problem,
first of all save any ClientDataSet Data to a XML file
After that edit this XML file with notepad and exclude any </ROWDATA> tag
finally try do that ClientDataSet.LoadFromFile(MyFile.xml)

So the error occurs.

How can I solve that?

Thank you very much and sorry my english is begginer yet.




Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi XML All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.