2002-05-25 Dwivedi, Ajay kumar <adwiv@yahoo.com>
[mono.git] / mcs / class / System.XML / System.Xml.Schema / XmlSchemaUtil.cs
1 using System;\r
2 using System.Xml;\r
3 \r
4 namespace System.Xml.Schema\r
5 {\r
6         /// <summary>\r
7         /// Summary description for XmlSchemaUtil.\r
8         /// </summary>\r
9         public class XmlSchemaUtil\r
10         {\r
11                 private XmlSchemaUtil()\r
12                 {}\r
13 \r
14                 [MonoTODO]\r
15                 public static bool CheckID(string id)\r
16                 {\r
17                         //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#ID\r
18                         // 1. ID must be a NCName\r
19                         // 2. ID must be unique in the schema\r
20                         if(!CheckNCName(id)) \r
21                                 return false;\r
22                         //If !unique\r
23 \r
24                         return true;\r
25                 }\r
26                 [MonoTODO]\r
27                 public static bool CheckAnyUri(string uri)\r
28                 {\r
29                          //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#anyURI\r
30                          return true;\r
31                 }\r
32                 public static bool CheckToken(string token)\r
33                 {\r
34                         //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#token\r
35                         return true;\r
36                 }\r
37                 public static bool CheckLanguage(string lang)\r
38                 {\r
39                         //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#language\r
40                         return true;\r
41                 }\r
42                 public static bool CheckNCName(string name)\r
43                 {\r
44                         //check if the string conforms to http://www.w3.org/TR/2001/REC-xmlschema-2-20010502/datatypes.html#NCName\r
45                         try\r
46                         {\r
47                                 XmlConvert.VerifyNCName(name);\r
48                                 return true;\r
49                         }\r
50                         catch(Exception ex)\r
51                         {\r
52                                 return false;\r
53                         }\r
54                 }\r
55                 public static string[] SplitList(string ns)\r
56                 {\r
57                         return ns.Split(new char[]{' '});\r
58                 }\r
59 \r
60                 // To Be Removed\r
61                 public static XmlQualifiedName GetRandomQName()\r
62                 {\r
63                         return new XmlQualifiedName(new Random().Next(int.MaxValue).ToString());\r
64                 }\r
65         }\r
66 }\r