Re: [fpc-pascal] OOP and XML usage

2010-01-30 Thread Jorge Aldo G. de F. Junior
using my system you can retrieve the text by a typecast mytag.first; mytag.findofclass(TXMLText); <- will stop the search at the first object of specified class If mytag.child is TXMLText Then <- to guarantee that we have found something WriteLn((mytag.child as TXMLText).Content); <- will print

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Graeme Geldenhuys
Jorge Aldo G. de F. Junior wrote: > and actually i prefer to setup properties of objects using xml > properties instead of xml text > > instead of > 192.168.1.180 Both examples are valid XML, so I don't see any issue the way I am using it. My previous example was just that, an example. My actual

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Michael Van Canneyt
On Thu, 28 Jan 2010, Jorge Aldo G. de F. Junior wrote: i mean that FPC-XML tries to be too general and this leads to too cumbersome code in various situations (FPC-XML is clearly overkill for my needs). But FPC-XML is not meant for storing objects. It is meant to read any correctly formed X

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Jorge Aldo G. de F. Junior
"Example XML, and there isn't a limit to the nesting of options." no theres no limit for nested tags, they are stored in a tree plus a linear list indexed by instance names (nodes without instance names will receive a random instance name - and be basically out of reach by the linear list - but w

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Jorge Aldo G. de F. Junior
but theres a flaw in my model (that doesnot means much in what im doing): the properties in the XML file must match exactly the properties each object has. else the properties are lost.. (the xml file can have less properties than the object but not the other way around: the xml loader cannot fo

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Jorge Aldo G. de F. Junior
i mean that FPC-XML tries to be too general and this leads to too cumbersome code in various situations (FPC-XML is clearly overkill for my needs). 2010/1/28 Michael Van Canneyt : > > > On Thu, 28 Jan 2010, Jorge Aldo G. de F. Junior wrote: > >> im actually needing better RTTI as to allow easier m

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Jorge Aldo G. de F. Junior
each tag generates a new instance of the class you can add a property (that all objects have) called InstanceName something using the instance name the class factory can differentiate from other instances (factory.instance['blabla'] retrieves the correct instance, or, factory.dotnotation['rootta

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Graeme Geldenhuys
On 28 January 2010 16:10, Jorge Aldo G. de F. Junior wrote: > > Whenever the xml loader finds a it will > create an instance of TMyClass and set the published properties > accordingly (Using RTTI)... I like that idea, but how flexible is? By that I mean, I have nested tags (using the same elemen

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Michael Van Canneyt
On Thu, 28 Jan 2010, Jorge Aldo G. de F. Junior wrote: im actually needing better RTTI as to allow easier method invocation... But generally i feel my way of doing XML is better than FPC defaults (Too generic, tries to solve too many problems with the same code) What exactly do you mean by

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Jorge Aldo G. de F. Junior
im actually needing better RTTI as to allow easier method invocation... But generally i feel my way of doing XML is better than FPC defaults (Too generic, tries to solve too many problems with the same code) ___ fpc-pascal maillist - fpc-pascal@lists.f

Re: [fpc-pascal] OOP and XML usage

2010-01-28 Thread Jorge Aldo G. de F. Junior
with my system would be simply something like Type TMyClass = Class(TXMLNode) Private fSomething : String; Public Constructor Create(Const aInstanceName : String); Override; Class Function XMLTag: String; Override; Published Property Something : String Read fSomethi

Re: [fpc-pascal] OOP and XML usage

2010-01-27 Thread Anthony Walter
I've written some XML classes which expose themselves as interfaces. Usage goes something like this: procedure SaveSettings(const Settings: string); var Document: IDocument; Filer: IFiler; begin Document := CreateDocument; Filer := Document.ForceRoot('test') as IFiler; Filer.WriteTime('t

Re: [fpc-pascal] OOP and XML usage

2010-01-27 Thread Jorge Aldo G. de F. Junior
i dont like this way of working with XML files... im creating my own model using an Class factory and RTTI properties. you register your classes in the class factory and the XML loader uses a class function to select wich one to create for a given node. This lets you have a lot more control over

Re: [fpc-pascal] OOP and XML usage

2010-01-27 Thread Leonardo M . Ramé
Ramé http://leonardorame.blogspot.com --- On Wed, 1/27/10, Graeme Geldenhuys wrote: > From: Graeme Geldenhuys > Subject: [fpc-pascal] OOP and XML usage > To: "FPC-Pascal users discussions" > Date: Wednesday, January 27, 2010, 6:47 AM > Hi, > > The small projec

Re: [fpc-pascal] OOP and XML usage

2010-01-27 Thread Graeme Geldenhuys
Michael Van Canneyt wrote: > > Yes. > I use DOM to read the file, and then translate the found TDOMElement nodes to > the actual business classes. Thanks for the quick response. I'm glad I am on the right track and my idea is not totally dumb founded. :) Regards, - Graeme - -- fpGUI Toolki

Re: [fpc-pascal] OOP and XML usage

2010-01-27 Thread Michael Van Canneyt
On Wed, 27 Jan 2010, Graeme Geldenhuys wrote: Hi, The small project I am working on requires reading a XML file and using that data for various things, including building a GUI interface. Most of my projects are database driven and uses the tiOPF framework to do my load/saving work (plus a l

[fpc-pascal] OOP and XML usage

2010-01-27 Thread Graeme Geldenhuys
Hi, The small project I am working on requires reading a XML file and using that data for various things, including building a GUI interface. Most of my projects are database driven and uses the tiOPF framework to do my load/saving work (plus a lot of other things). As the title says, all my app