private void ChildrenAuslesen(string code) { string str = code; this._art = DTDChildElementArten.ChildListe; int num = 0; StringBuilder stringBuilder = new StringBuilder(); while (code.Length > 0) { string text = code.Substring(0, 1); code = code.Remove(0, 1); string a = text; if (!(a == "(")) { if (a == ")") { num--; } } else { num++; } if (this.IstOperator(text)) { if (num == 0) { this._operator = this.GetOperatorFromChar(text); string text2 = stringBuilder.ToString().Trim(); if (text2.Length == 0) { throw new ApplicationException("Leerer ChildCode gefunden in '" + str + "'"); } this.SpeichereChildElement(text2); stringBuilder = new StringBuilder(); } else { stringBuilder.Append(text); } } else { stringBuilder.Append(text); } } if (stringBuilder.Length > 0) { this.SpeichereChildElement(stringBuilder.ToString()); } }
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(); } }
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; } }