1 using System; 2 3 namespace Monodoc 4 { 5 public static class TypeUtils 6 { GetNamespaceAndType(string url, out string ns, out string type)7 public static bool GetNamespaceAndType (string url, out string ns, out string type) 8 { 9 int nsidx = -1; 10 int numLt = 0; 11 for (int i = 0; i < url.Length; ++i) { 12 char c = url [i]; 13 switch (c) { 14 case '<': 15 case '{': 16 ++numLt; 17 break; 18 case '>': 19 case '}': 20 --numLt; 21 break; 22 case '.': 23 if (numLt == 0) 24 nsidx = i; 25 break; 26 } 27 } 28 29 if (nsidx == -1) { 30 ns = null; 31 type = null; 32 return false; 33 } 34 ns = url.Substring (0, nsidx); 35 type = url.Substring (nsidx + 1); 36 37 return true; 38 } 39 } 40 } 41