ASN1C C# Runtime Library  7.8
Public Member Functions | Protected Attributes | Properties | List of all members
Asn1XerSaxHandler Class Reference
Inheritance diagram for Asn1XerSaxHandler:
XmlSaxDefaultHandler XmlSaxContentHandler XmlSaxErrorHandler XmlSaxEntityResolver Asn1OpenType.SaxHandler Asn1XmlAnyElem.XsdAnySaxHandler Asn1XmlSaxSimpleType

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)
 
- Public Member Functions inherited from XmlSaxDefaultHandler
virtual void Characters (char[] ch, int start, int length)
 
virtual void EndDocument ()
 
virtual void EndElement (System.String ns, System.String localName, System.String qName)
 
virtual void EndPrefixMapping (System.String prefix)
 
virtual void IgnorableWhitespace (char[] chars, int start, int length)
 
virtual void ProcessingInstruction (System.String target, System.String data)
 
virtual XmlSource ResolveEntity (System.String publicId, System.String systemId)
 
virtual void SetDocumentLocator (XmlSaxLocator locator)
 
virtual void SkippedEntity (System.String name)
 
virtual void StartDocument ()
 
virtual void StartElement (System.String ns, System.String localName, System.String qName, XmlAttributes attributes)
 
virtual void StartPrefixMapping (System.String prefix, System.String uri)
 

Protected Attributes

bool mConsumedStartElement
 

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.

Member Function Documentation

◆ ConsumeStartElement()

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
Asn1XmlSaxUnexpElemExcif certain that some other element is expected.

◆ EndGroup()

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.

◆ Error()

override void Error ( System.Xml.XmlException  exception)
virtual

This method manage when an error exception ocurrs in the parsing process

Parameters
exceptionThe exception throws by the parser
Exceptions
System.Xml.XmlExceptionThe error exception

Reimplemented from XmlSaxDefaultHandler.

◆ FatalError()

override void FatalError ( System.Xml.XmlException  exception)
virtual

This method throws a fatal error exception.

Parameters
exceptionThe exception thrown by the parser
Exceptions
System.Xml.XmlExceptionThe error exception

Reimplemented from XmlSaxDefaultHandler.

◆ Init()

virtual void Init ( int  startLevel)
virtual

This method initializes the class member variables.

Parameters
startLevelThe XER level to begin

◆ IsDecodingAsGroup()

bool IsDecodingAsGroup ( )

Return true if this SAX handler is decoding a group of elements rather than a single element (and possibly its children elements).

◆ SetComplete()

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
InvalidOperationExceptionif mLevel != mStartLevel.

◆ Warning()

override void Warning ( System.Xml.XmlException  exception)
virtual

This method manage when a warning exception ocurrs in the parsing process

Parameters
exceptionThe exception Throws by the parser
Exceptions
System.Xml.XmlExceptionThe warning exception

Reimplemented from XmlSaxDefaultHandler.

Member Data Documentation

◆ mConsumedStartElement

bool mConsumedStartElement
protected

Flag used to signal whether startElement actually handled the given element. See the description of method consumeStartElement

Property Documentation

◆ Complete

bool Complete
get

Returns true when the SAX handler has finished decoding the group.

◆ State

virtual int State
get

Gets the current state of the event handler.

Value: current state