[Mono-devel-list] Re: Another XML API: SAX

Karl Waclawek karl at waclawek.net
Thu Nov 13 10:52:02 EST 2003


> > So, you recommend turning the getters/setters into properties.
> > Anyone else with an opinion? 
> 
> Well, as to XML stuff, transition from W3C DOM to System.Xml.XmlNode and
> its derived classes might be informative. 

OK, will have a look.

> Just my ideas:
> 
> (1) constant flag value can be written as Enum. For example:
> 
> const unsigned short ELEMENT_NODE = 1;
> const unsigned short ATTRIBUTE_NODE = 2;
> const unsigned short TEXT_NODE = 3;
> ...
> 
> into:
> 
> public enum XmlNodeType
> {
>   Element = 1,
>   Attribute = 2,
>   Text = 3,
>   ...
> }
> 
> Doing it enables to ensure strict flag value checking.

Having a Delphi background I wouldn't do it any other way.

> (2) In some places, event can be used to replace event listener model.
> However, .NET event model (especially delegate) is not suitable for
> derivation of classes (for example, I could not beautifully derive
> XmlValidatingReader, because it does not expose OnValidationError() or
> so), so I don't recommend such replacement this time.

I didn't even think of replacing interface call-backs with
delegates. That would move too far away from how SAX is designed.
In Delphi we have both, and there is a place for both.
I like the grouping of related call-backs that interfaces provide.

Karl



More information about the Mono-devel-list mailing list