示例#1
0
 public DTDChildElemente(string childrenQuellcode)
 {
     this._art         = DTDChildElementArten.Leer;
     this._children    = new ArrayList();
     this._defAnzahl   = DTDChildElementAnzahl.GenauEinmal;
     this._elementName = "";
     this._operator    = DTDChildElementOperatoren.Oder;
     this._quellcode   = childrenQuellcode;
     this._quellcode   = this._quellcode.Replace("\t", " ");
     this._quellcode   = this._quellcode.Replace("\r\n", " ");
     this._quellcode   = this._quellcode.Trim();
     if (this._quellcode.Length == 0)
     {
         this._art = DTDChildElementArten.Leer;
     }
     else
     {
         this.CodeAuslesen();
     }
 }
示例#2
0
        private void CodeAuslesen()
        {
            string text  = this._quellcode;
            string text2 = text.Substring(text.Length - 1, 1);

            switch (text2)
            {
            case "+":
                this._defAnzahl = DTDChildElementAnzahl.EinsUndMehr;
                text            = text.Remove(text.Length - 1, 1);
                break;

            case "*":
                this._defAnzahl = DTDChildElementAnzahl.NullUndMehr;
                text            = text.Remove(text.Length - 1, 1);
                break;

            case "?":
                this._defAnzahl = DTDChildElementAnzahl.NullOderEinmal;
                text            = text.Remove(text.Length - 1, 1);
                break;

            default:
                this._defAnzahl = DTDChildElementAnzahl.GenauEinmal;
                break;
            }
            text = text.Trim();
            if (text.Substring(0, 1) == "(" && text.Substring(text.Length - 1, 1) == ")")
            {
                text = text.Substring(1, text.Length - 2);
                this.ChildrenAuslesen(text);
            }
            else
            {
                this._art         = DTDChildElementArten.EinzelChild;
                this._elementName = text;
            }
        }