Asn1XerSaxHandler Class Reference
Public Member Functions | |
bool | ConsumeStartElement (String namespaceURI, String localName, String qName, XmlAttributes atts) |
virtual void | EndGroup () |
override void | Error (System.Xml.XmlException exception) |
override void | FatalError (System.Xml.XmlException exception) |
virtual void | Init (int startLevel) |
bool | IsDecodingAsGroup () |
void | SetComplete () |
override void | Warning (System.Xml.XmlException exception) |
Protected Member Functions | |
internal | Asn1XerSaxHandler () |
Protected Attributes | |
bool | mConsumedStartElement |
internal int | mCurrElemID |
internal int | mCurrState |
internal int | mLevel |
internal readonly int | XERDATA = 2 |
internal readonly int | XEREND = 3 |
internal readonly int | XERINIT = 0 |
internal readonly int | XERSTART = 1 |
internal readonly int | XERUNKNOWN = - 1 |
Properties | |
bool | Complete [get] |
virtual int | State [get] |
Detailed Description
This class extends the DefaultHandler SAX handler class to add items specific to ASN.1 XER encoding.
Constructor & Destructor Documentation
internal Asn1XerSaxHandler | ( | ) | [protected] |
The default constructor creates an XER SAX parser instance.
Member Function Documentation
bool ConsumeStartElement | ( | String | namespaceURI, | |
String | localName, | |||
String | qName, | |||
XmlAttributes | atts | |||
) |
This method should be used in preference to invoking StartElement directly when a parent SAX handler is delegating to a child SAX handler.
Using this method gives the StartElement method the opportunity to set the mConsumedStartEvent flag to false to signal that the given element does not belong to the group and that the group is complete. This method invokes the StartElement event and returns the resulting value of the mConsumedStartElement flag (true, unless the StartElement method explicitly sets it to false). If mConsumedStartElement is set to false, this method will invoke SetComplete, marking the handler complete and triggering the EndGroup event, if it has not already fired.
If the StartElement method is certain that some other element is required instead of the one given, it is preferable to throw Asn1XmlSaxUnexpElemExc to indicate this. Otherwise, if the given element does not belong to the group being decoded, mConsumedStartElement can be set false and the element ignored. It is then up to the parent SAX handler to recognize the element as part of a different group or report it as an unexpected element. The StartElement method should not set mConsumedStartEvent false except when mLevel <= mStartLevel, since this is a precondition for SetComplete.
- Returns:
- true if the StartElement method consumed the given element or false if not.
- Exceptions:
-
Asn1XmlSaxUnexpElemExc if certain that some other element is expected.
virtual void EndGroup | ( | ) | [virtual] |
This event method should be invoked when the group being decoded by this handler is decided to be complete. Subclasses may implement this event method to do things such as check for missing required elements. This event will be triggerd, when appropriate, by ConsumeStartElement. Subclasses may invoke it directly when appropriate, but the preferred method is to invoke it indirectly by invoking SetComplete.
override void Error | ( | System.Xml.XmlException | exception | ) | [virtual] |
This method manage when an error exception ocurrs in the parsing process
- Parameters:
-
exception The exception throws by the parser
- Exceptions:
-
System.Xml.XmlException The error exception
Reimplemented from XmlSaxDefaultHandler.
override void FatalError | ( | System.Xml.XmlException | exception | ) | [virtual] |
This method throws a fatal error exception.
- Parameters:
-
exception The exception thrown by the parser
- Exceptions:
-
System.Xml.XmlException The error exception
Reimplemented from XmlSaxDefaultHandler.
virtual void Init | ( | int | startLevel | ) | [virtual] |
This method initializes the class member variables.
- Parameters:
-
startLevel The XER level to begin
bool IsDecodingAsGroup | ( | ) |
Return true if this SAX handler is decoding a group of elements rather than a single element (and possibly its children elements).
void SetComplete | ( | ) |
Invoke this method to mark this SAX handler as being complete. This method will trigger the EndGroup event, if it has not already fired. This is the preferred way for a subclass to trigger the EndGroup event, rather than to invoke EndGroup directly (mainly for consistency). Subclasses should consider invoking this method in the EndElement event when either of the following conditions obtain:
- mLevel returns to 0 (indicating the group must be complete)
- The group is self-delimiting and known to be complete on that basis. This method should only be invoked when mLevel <= mStartLevel. Otherwise, the handler could not possibly be complete (note that mLevel == mStartLevel does not entail the handler is complete, because this is a normal state of affairs between elements when decoding a group).
- Exceptions:
-
InvalidOperationException if mLevel != mStartLevel.
override void Warning | ( | System.Xml.XmlException | exception | ) | [virtual] |
This method manage when a warning exception ocurrs in the parsing process
- Parameters:
-
exception The exception Throws by the parser
- Exceptions:
-
System.Xml.XmlException The warning exception
Reimplemented from XmlSaxDefaultHandler.
Member Data Documentation
bool mConsumedStartElement [protected] |
Flag used to signal whether startElement actually handled the given element. See the description of method consumeStartElement
internal int mCurrElemID [protected] |
Variable holds the current element ID
internal int mCurrState [protected] |
Variable holds the current XER processing state
internal int mLevel [protected] |
Variable holds the start and current level
internal readonly int XERDATA = 2 [protected] |
XER characters (data) state
internal readonly int XEREND = 3 [protected] |
XER end element state
internal readonly int XERINIT = 0 [protected] |
XER initialization state
internal readonly int XERSTART = 1 [protected] |
XER start element state
internal readonly int XERUNKNOWN = - 1 [protected] |
XER unknown state
Property Documentation
bool Complete [get] |
Returns true when the SAX handler has finished decoding the group.
virtual int State [get] |
Gets the current state of the event handler.
Value:
current state