Wednesday, October 14, 2009

RTTI & XmlSerial.pas Refactoring - SVN Changes

XmlSerial.pas started as really cool demo of what you can do with RTTI in Delphi 2010. Most of the time demo code is an example that should be looked at learned from and thrown away.

The problem I face is that I need XmlSerial to be far more than a Demo. I need a fully functional serializer that will inter-op with classes using the .NET XmlSerializer.

After committing a couple of my refactoring changes to make it more than just a demo. I realized that I did not want to keep committing all of my changes to the SVN
Trunk.
I really want to keep committing code each day that may not even remotely work. I have some major changes in design planned that will require that for a few days.

So as such I just created a branch for my RTTI work if you want to follow that work, while I refactor to provide an elegant and far more supportable framework. When this work stabilizes I will merge the changes back to Trunk.

Here are the few things that I intend to do to the code:

For example, I intend to create an Adapter for XML Parsing to allow current use of TxmlDocument to continue, but also allow for other types of Parsing that may not be DOM based to work. Specifically I am doing this because, I am concerned with the speed and memory footprint that is required by DOM.

I also want to create a set of adapters and factory that will allow things like TList, Dynamic Arrays and TDataset all to look the same to the serialization engine, so I don't have to write custom code in multiple places. Instead I can just delegate that functionality to a class that will hide the implementation details of how the data is stored. I can see this work being used in a variety of applications outside of XML Serialization.

Do you have specific needs for XML Serialization? I would like to know as now is the time to see if I can address them.

4 comments:

  1. Hello,
    I'm using the "XML Class Serializer" from DragonSoft, but this is a little buggy and outdated. Maybe i will switch to your Serializer, a very important feature for me would be the support of a TCollection.

    ReplyDelete
  2. Hello
    xml serial is really cool but I need a new attribute type, can you add it?

    I want an attribute to make a field ignored but if i add that node to xml it should be able to load it back to the field.

    The short story is I am building a settings class that can save itself but i dont want to reveal all my settings after I save. I want some to be enabled only if I add explicitly.

    ReplyDelete
  3. Hello

    In first sorry for my poor English.

    You RTTI Serializer is great. I take your rttiwork from your svn. And i replace embarcadero XMLDoc for amazing open source NativeXML from Nils Heack (http://www.simdesign.nl/xml.html). If you have interest, then you can download www.alphasystems.sk/_files_permanent/2013-04-28_rttiwork.zip . All test pass.

    I have only one uncertainty. In metod TXmlCustomTypeSerializer.DeSerializeValue (xmlserial.pas) on line 574. I don't know how is used atributes during deserialization. In would be best create Test for this feature.

    Kind regards

    Daniel Andrascik

    ReplyDelete
  4. Hello,

    your xmlserial is great. I need to store TList and dynamic arrays. Can you guide my a way to solve this? This would be great.

    Kind regards

    Christian

    ReplyDelete