Fixed AttributeCount and m_state problems for use under Mono
Fixed AttributeCount and m_state problems for use under Mono

This change has been tested to work under mono 2.10.8.1 (Debian
2.10.8.1-1ubuntu2.1), under a relatively complex, but fixed (format)
dataset.

First thing fixed was the AttributeCount value. Under mono, the
AttributeCount is used iteratively in a for loop in order to enumerate
all the attributes under an element; however, in this implementation,
AttributeCount returns zero once the reader enters the Attr or AttrValue
state. This results in only the first attribute being written when
transferring elements from SgmlReader to XmlTextWriter.

refer to: http://lists.ximian.com/pipermail/mono-bugs/2007-September/061384.html

However, changing this alone did not solve the problem. The immediate
aftermath of this change is that System.Xml.XmlTextWriter (mono) threw
an InvalidArgumentException, complaining that an WriteFullEndElement
called was made when all elements have been ended. It appears that an
element state preservation statement failed to protect the state from
being overwritten by m_state = State.AttrValue. This issue has been
resolved.

MindTouch/SGMLReader,ExodusSistemas/SgmlReaderCore,olavorn/SGMLReader