易截截图软件、单文件、免安装、纯绿色、仅160KB

一些工具函数 Xml 序列化

  public sealed class XmlHelper
{
public static void Serialize<T>(T obj,string fileName)
{
TextWriter writer = new StreamWriter(fileName);
try
{
XmlSerializer ser = new XmlSerializer(typeof(T));
ser.Serialize(writer, obj);
}
catch (Exception)
{
throw;
}
finally
{
if (writer != null)
{
writer.Close();
}
}
}
public static T Deserialize<T>(string fileName) where T:class
{
TextReader reader = new StreamReader(fileName);
T newObj ;
try
{
XmlSerializer mySerializer = new XmlSerializer(typeof(T));
newObj= mySerializer.Deserialize(reader) as T;
}
catch (Exception)
{
throw;
}
finally
{
if (reader != null)
{
reader.Close();
}
}
return newObj;
}
public static T Deserialize<T>(FileInfo file) where T : class
{
string fileName = file.FullName;
return Deserialize<T>(fileName);
}
}


相关文档:

dom4j(XML的解析)

1.   下载与安装  
   
     
   
  dom4j是sourceforge.net上的一个开源项目,主要用于对XML的解析。从2001年7月发布第一版以来,已陆续推出多个版本,目前最高版本为1.5。  
   
  dom4j专门针对Java开发,使用起来非常简单、直观, ......

java中使用dom4j写xml文件和简单教程

 
下载 dom4j-1.6.1.jar。
1: package org.zzp.common.xml.dom4j;
2:
3: import java.io.FileWriter;
4: import java.io.IOException;
5: import org.dom4j.Document;
6: import org.dom4j.DocumentHelper;
7: import org.dom4j.Element;
8: import org.dom4j.io.OutputFormat;
9: impor ......

android xml dom解释

private
NodeList root(
final
String url , 
final
String str){
      
NodeList root =
null
;
      
try
{
      
InputSource is=
new
InputSource(
new
InputStreamReader(
new
UR ......

SQLServer2005分解并导入xml文件

  SQLServer2005分解并导入xml文件 收藏
测试环境SQL2005,windows2003
DECLARE @idoc int;
DECLARE @doc xml;
 
SELECT @doc=bulkcolumn from OPENROWSET(
   BULK 'D: \test.xml',
   SINGLE_BLOB) AS x
 
EXEC sp_xml_preparedocument @Idoc OUTPUT, @doc
 
  ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号