摘要
在读取XML文件中的数据时经常会碰到数据类型不正确或元素属性不完整的情况。这会导致一系列的问题,如果正在利用序列化数据创建对象,碰到XML文件不完整的话,整个对象将无法创建。讨论了利用扩展方法侦测XML文件中缺失的元素,或属性避免因为部分数据丢失而整个对象都无法创建的情况。
Incorrect data type or incomplete element attribute is often encountered when reading data in XML files. It will lead to a series of problems. When creating objects with serialized data, if XML file is incomplete, the entire object cannot be created. It is issued how to detect the missing element or attribute by using extension methods, in order to avoid the situation that entire object cannot be created because of missing part of data.
出处
《电脑编程技巧与维护》
2012年第18期68-69,共2页
Computer Programming Skills & Maintenance