{"id":52,"date":"2010-10-09T15:44:00","date_gmt":"2010-10-09T07:44:00","guid":{"rendered":"http:\/\/www.pufengdu.org\/srv\/blog\/?p=52"},"modified":"2014-11-08T19:51:30","modified_gmt":"2014-11-08T11:51:30","slug":"%e8%af%bb%e5%8f%96%e5%92%8c%e4%bd%bf%e7%94%a8xml%e6%a0%bc%e5%bc%8f%e7%9a%84uniprot%e6%95%b0%e6%8d%ae%e5%ba%93","status":"publish","type":"post","link":"https:\/\/www.pufengdu.org\/blog\/?p=52","title":{"rendered":"\u8bfb\u53d6\u548c\u4f7f\u7528XML\u683c\u5f0f\u7684UniProt\u6570\u636e\u5e93"},"content":{"rendered":"<p>UniProt\u6570\u636e\u5e93\u662f\u56fd\u9645\u516c\u7528\u86cb\u767d\u8d28\u5e8f\u5217\u548c\u6ce8\u91ca\u6570\u636e\u5e93\uff0c\u53ef\u514d\u8d39\u4e0b\u8f7d\u5168\u6587\u4f7f\u7528\u3002\u6570\u636e\u5e93\u63d0\u4f9b\u4e86Flat Text\uff0cXML\u548cRDF\u4e09\u79cd\u683c\u5f0f\u4f9b\u9009\u62e9\uff0c\u6211\u5728\u76ee\u524d\u7684\u7814\u7a76\u4e2d\uff0c\u7528\u4e86XML\u683c\u5f0f\u7684\u6570\u636e\u5e93\u3002\u8981\u8bfb\u53d6\u8fd9\u4e2aXML\u683c\u5f0f\u7684\u6570\u636e\u5e93\u9700\u8981\u4e00\u70b9\u70b9\u6280\u5de7\u3002<\/p>\n<p>\u9996\u5148\uff0c\u6211\u4eec\u6709XSD\u6587\u4ef6\u7528\u6765\u5b9a\u4e49XML\u7684 Data Schema\uff0c\u8fd9\u4e2a\u6587\u4ef6\u53ef\u4ee5\u76f4\u63a5\u4e0b\u8f7d\u5f97\u5230uniprot.xsd\u3002\u6709\u4e86\u8fd9\u4e2a\u6587\u4ef6\u4e4b\u540e\uff0c\u53ef\u4ee5\u76f4\u63a5\u91c7\u7528MS Platform SDK\u4e2d\u7684xsd.exe\u6765\u751f\u6210\u4e00\u4e2a\u7c7b\uff0c\u7528\u4ee5\u6267\u884c\u4eceXML\u53cd\u5e8f\u5217\u5316\u65f6\u7684\u7c7b\u578b\u5316\u8fc7\u7a0b\u3002<\/p>\n<pre>\r\nXSD.EXE \/C uniprot.xsd\r\n<\/pre>\n<p>\u5c31\u53ef\u4ee5\u5f97\u5230uniprot.cs\u8fd9\u4e2a\u6587\u4ef6\u4e86\u3002\u5c06\u8fd9\u4e2a\u6587\u4ef6\u5305\u542b\u5230\u4e00\u4e2aC#\u9879\u76ee\u4e2d\uff0c\u5e76\u4f7f\u7528XML\u53cd\u5e8f\u5217\u5316\u8fdb\u884c\u76f8\u5e94\u7684XML\u6570\u636e\u6587\u4ef6\u8bfb\u53d6\u3002XML\u6587\u4ef6\u5e94\u8be5\u662f\u4eceUniProtKB\u4e2d\u91c7\u7528\u67e5\u8be2\u65b9\u5f0f\u83b7\u5f97\u7684\u6570\u636e\u7247\u6bb5\u3002\u8bfb\u53d6XML\u7684\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre>\r\nusing System;\r\nusing System.Collections.Generic;\r\nusing System.Text;\r\nusing System.IO;\r\nusing System.Xml;\r\nusing System.Xml.Serialization;\r\n\r\nnamespace ParseUniProtXML\r\n{\r\n    class Program\r\n    {\r\n        static void Main(string[] args)\r\n        {\r\n            XmlSerializer s = new XmlSerializer(typeof(uniprot));\r\n            FileStream fs = new FileStream(args[0],FileMode.Open);\r\n            XmlReader r = new XmlTextReader(fs);\r\n            uniprot UniProt = (uniprot) s.Deserialize(r);\r\n            ...\r\n<\/pre>\n<p>\u4f46\u662f\uff0c\u8fd9\u4e2a\u65f6\u5019\u51e0\u4e4e\u4e00\u5b9a\u4f1a\u51fa\u9519\uff0c\u4f1a\u53cd\u6620<\/p>\n<pre>\r\n\u672a\u5904\u7406 System.InvalidOperationException Message=\" \u65e0\u6cd5\u751f\u6210\u4e34\u65f6\u7c7b(result=1)\u3002rnerror CS0030: \u65e0\u6cd5\u5c06\u7c7b\u578b\u201cgeneNameType[]\u201d\u8f6c\u6362\u4e3a\u201cgeneNameType\u201drnerror CS0029: \u65e0\u6cd5\u5c06\u7c7b\u578b\u201cgeneNameType\u201d\u9690\u5f0f\u8f6c\u6362\u4e3a\u201cgeneNameType[]\u201drn\"\r\nSource=\"System.Xml\"\r\nStackTrace:\r\n    \u5728 System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, XmlSerializerCompilerParameters xmlParameters, Evidence evidence)\r\n    \u5728 System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, XmlSerializerCompilerParameters parameters, Assembly assembly, Hashtable assemblies)\r\n    \u5728 System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)\r\n    \u5728 System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)\r\n    \u5728 System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)\r\n    \u5728 System.Xml.Serialization.XmlSerializer..ctor(Type type)\r\n    \u5728 ParseUniProtXML.Program.Main(String[] args)\r\n    \u5728 System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)\r\n    \u5728 System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)\r\n    \u5728 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()\r\n    \u5728 System.Threading.ThreadHelper.ThreadStart_Context(Object state)\r\n    \u5728 System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)\r\n    \u5728 System.Threading.ThreadHelper.ThreadStart()\r\nInnerException:\r\n<\/pre>\n<p>\u9020\u6210\u8fd9\u4e2a\u95ee\u9898\u7684\u539f\u56e0\u662funiprot.xsd\u4e0d\u662f\u6309\u7167xsd.exe\u6240\u9075\u5b88\u7684\u6807\u51c6\u7f16\u5199\u7684\uff0c\u7531\u6b64\u751f\u6210\u7684uniprot.cs\u4e0d\u80fd\u76f4\u63a5\u4f7f\u7528\uff0c\u9700\u8981\u6539\u4e00\u4e2a\u5730\u65b9\uff1a<\/p>\n<p>\u5728<\/p>\n<pre>\r\n[System.Xml.Serialization.XmlArrayItemAttribute(\"name\", typeof(geneNameType), IsNullable=false)]\r\n<\/pre>\n<p>\u8fd9\u4e00\u884c\u4e2d\u8fdb\u884c\u4fee\u6539<\/p>\n<pre>\r\n[System.Xml.Serialization.XmlArrayItemAttribute(\"name\", typeof(geneNameType[]), IsNullable=false)]\r\n<\/pre>\n<p>\u4e00\u4e2a\u4e2d\u62ec\u53f7\u540e\u7f00\uff0c\u5c31\u53ef\u4ee5\u89e3\u51b3\u95ee\u9898\u4e86\u3002<\/p>\n<p>\u81f3\u4e8e\u8fd9\u6837\u7684\u4fee\u6539\u662f\u4e0d\u662f\u80fd\u591f\u89e3\u51b3\u6240\u6709\u7684\u95ee\u9898\uff0c\u5e76\u4e14\u662f\u5426\u4f1a\u5f15\u8d77\u5176\u4ed6\u7684\u53d8\u5316\uff0c\u73b0\u5728\u8fd8\u4e0d\u77e5\u9053\u3002<\/p>\n<p>\u4f46\u662f\uff0c\u5728Uniprot\u6570\u636e\u5e93\u7684\u5168\u90e8\u6570\u636e\u4e0a\u8fdb\u884c\u8bfb\u53d6\u548c\u89e3\u6790\u6d4b\u8bd5\u662f\u5168\u90e8\u6210\u529f\u7684\uff0c1%\u6570\u636e\u62bd\u53d6\u624b\u5de5\u9a8c\u8bc1\u4e5f\u662f\u6b63\u786e\u7684\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u81f3\u5c11\u5728\u76ee\u524d\u7684\u6240\u6d89\u53ca\u7684\u6570\u636e\u8303\u56f4\u5185\uff0c\u8fd9\u4e2a\u4fee\u6539\u5e94\u8be5\u662f\u6709\u6548\u7684\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>UniProt\u6570\u636e\u5e93\u662f\u56fd\u9645\u516c\u7528\u86cb\u767d\u8d28\u5e8f\u5217\u548c\u6ce8\u91ca\u6570\u636e\u5e93\uff0c\u53ef\u514d\u8d39\u4e0b\u8f7d\u5168\u6587\u4f7f\u7528\u3002\u6570\u636e\u5e93 &hellip; <a href=\"https:\/\/www.pufengdu.org\/blog\/?p=52\">\u7ee7\u7eed\u9605\u8bfb <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"_links":{"self":[{"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/52"}],"collection":[{"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=52"}],"version-history":[{"count":5,"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions"}],"predecessor-version":[{"id":211,"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/52\/revisions\/211"}],"wp:attachment":[{"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=52"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=52"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pufengdu.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=52"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}