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

Atsushi Eno ginga at kit.hi-ho.ne.jp
Thu Nov 13 10:34:24 EST 2003


Hello,

> 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. 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.

(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.

Just my 2 yen.

Atsushi Eno




More information about the Mono-devel-list mailing list