Inner Classes

The generation of code for XER causes the following inner class definition to be generated:

   public class SaxHandler : Asn1XerSaxHandler {
      Asn1XerSaxHandler mElemSaxHandler;
      StringBuffer mCurrElemValue;

      internal SaxHandler() {
         <code ..>
      }

      public void StartElement (string namespaceURI, string localName,
                                string qName, Attributes atts)
      {
         <code ..>
      }

      public void Characters (char[] ch, int start, int length)
      {
         <code ..>
      }

      public void EndElement (string namespaceURI,
                              string localName, string qName)
      {
         <code ..>
      }
   }

This is an implementation of a standard SAX content handler class. As the XML parser software parses messages, the methods within this class are invoked with the parsed content. The StartElement method is invoked after a start element tag (<tag>) is parsed. The Characters method is invoked one or more times to pass the content between tags into the application. The EndElement method is invoked when an end element tag (</tag>) is encountered.

The ASN1C compiler generates custom code for each ASN.1 type within a given specification to parse the XML contents and fill in the generated C# objects.