private void ChildrenAuslesen(string code) { string str1 = code; this._art = DTDChildElemente.DTDChildElementArten.ChildListe; int num = 0; StringBuilder stringBuilder = new StringBuilder(); while (code.Length > 0) { string code1 = code.Substring(0, 1); code = code.Remove(0, 1); string str2 = code1; if (!(str2 == "(")) { if (str2 == ")") { --num; } } else { ++num; } if (this.IstOperator(code1)) { if (num == 0) { this._operator = this.GetOperatorFromChar(code1); string code2 = stringBuilder.ToString().Trim(); if (code2.Length == 0) { throw new ApplicationException("Leerer ChildCode gefunden in '" + str1 + "'"); } this.SpeichereChildElement(code2); stringBuilder = new StringBuilder(); } else { stringBuilder.Append(code1); } } else { stringBuilder.Append(code1); } } if (stringBuilder.Length <= 0) { return; } this.SpeichereChildElement(stringBuilder.ToString()); }
private void CodeAuslesen() { string str1 = this._quellcode; string str2 = str1.Substring(str1.Length - 1, 1); if (!(str2 == "+")) { if (!(str2 == "*")) { if (str2 == "?") { this._defAnzahl = DTDChildElemente.DTDChildElementAnzahl.NullOderEinmal; str1 = str1.Remove(str1.Length - 1, 1); } else { this._defAnzahl = DTDChildElemente.DTDChildElementAnzahl.GenauEinmal; } } else { this._defAnzahl = DTDChildElemente.DTDChildElementAnzahl.NullUndMehr; str1 = str1.Remove(str1.Length - 1, 1); } } else { this._defAnzahl = DTDChildElemente.DTDChildElementAnzahl.EinsUndMehr; str1 = str1.Remove(str1.Length - 1, 1); } string str3 = str1.Trim(); if (str3.Substring(0, 1) == "(" && str3.Substring(str3.Length - 1, 1) == ")") { this.ChildrenAuslesen(str3.Substring(1, str3.Length - 2)); } else { this._art = DTDChildElemente.DTDChildElementArten.EinzelChild; this._elementName = str3; } }
public DTDChildElemente(string childrenQuellcode) { this._art = DTDChildElemente.DTDChildElementArten.Leer; this._children = new ArrayList(); this._defAnzahl = DTDChildElemente.DTDChildElementAnzahl.GenauEinmal; this._elementName = ""; this._operator = DTDChildElemente.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 = DTDChildElemente.DTDChildElementArten.Leer; } else { this.CodeAuslesen(); } }