SBML是系统生物学中的一种文件格式标准,它基于xml文件格式。当我在vb中使用xml序列化来读取sbml文件时,我遇到了问题,xml命名空间不正确,所以程序给我一个例外: System.Xml.dll中发生了'System.InvalidOperationException'类型的未处理异常 附加信息:XML文档中有错误(2,2)。 i认为这个错误发生在xml文件中xml根节点的位置:
< sbml xmlns = www.sbml/sbml/level2 version = 1 利el = 2 >第2行,以及xmlns属性的位置。 i将sbml文件与普通xml文件进行比较,很容易发现xml根节点中的命名空间不同:
< MetaCyc xmlns:xsi = www.w3/2001/ XMLSchema-instance xmlns:xsd = www.w3/2001/XMLSchema >所以我在vb中使用xml序列化时如何处理这个问题d sbml文件。
解决方案在反序列化数据之前,必须定义所需的类。您将需要xsd文件(即XML架构)和xsd.exe用于该prupose。有关详细信息,请参阅我的文章 Bernie的Trackviewer [ ^ ],我用GPX文件描述了这一点(用XML编码的gps数据)
SBML is a kind of file format standard in the systems biology, and it is base on the xml file format. when i using the xml Serialization in vb to read the sbml file, then i get a problem, the xml namespace is not correct, so the program throw a exception to me: An unhandled exception of type 'System.InvalidOperationException' occurred in System.Xml.dll Additional information: There is an error in XML document (2, 2). i think this error occur in the position of xml root node in a xml file :
<sbml xmlns="www.sbml/sbml/level2" version="1" level="2">line 2 , and the position at xmlns attribute. i compare the sbml file with the normal xml file, easily found out that the namespace in a xml root node is diferrent:
<MetaCyc xmlns:xsi="www.w3/2001/XMLSchema-instance" xmlns:xsd="www.w3/2001/XMLSchema">so how to deal with this problem when i using the xml Serialization in vb to read the sbml file.
解决方案 Before you can deserialize the data, you must define the required classes. You'll need the xsd file (i.e. XML schema) and xsd.exe for that prupose. For more details, see my article "Bernie’s Trackviewer[^]", where I described that with GPX files (gps data encoded in XML).更多推荐
xml序列化中的XML命名空间
发布评论