C# Xml中映射为类数据结构(报文)
[System.Runtime.Serialization.DataMemberAttribute()]
public Information Archive {
get {
return this.archiveField;
}
set {
this.archiveField = value;
}
}
[System.Xml.Serialization.XmlAttributeAttribute()]
[System.Runtime.Serialization.DataMemberAttribute()]
public string Xmlns {
get {
return this.xmlnsField;
}
set {
this.xmlnsField = value;
}
}
【[System.Xml.Serialization.XmlAttributeAttribute()]】描述该属性为XML节点属性。
相关文档:
{
SqlConnection cnn = new SqlConnection
("context connection=true");
cnn.Open();
SqlCommand cmd = new SqlCommand();
cmd.Connection = cnn;
cmd.CommandText = "select * from customers";
SqlDataReader reader = cmd.ExecuteReader();
SqlContext.Pipe.Send(reader);
reader.Close();
cnn.Close();
}
......
XML 和 JSON 是当今常用的两种数据描述与传输的格式,特别是涉及到 JS 时使用 JSON 颇为频繁。自然,在 Java 的世界里少不了完成 JavaBean 与这两种格式相互转换的组件,那就是 XStream 和 JSON-lib。这里我简单记下 XStream 的用法。
其实相类似的工具早已有之。如果用过 DWR 的同志,一定有印像,DWR 进行远 ......
1.route.xml文件内容
<?xml version="1.0" encoding="GBK"?>
<root>
<route id="1111">
<id>111</id>
<name>四川</name>
<path>www.baidu.com/hehe.html</path>
</route>
</root>
2.test.html代码
<html>
<body>
<script> ......
1 在Action实现类方面的对比:Struts 1要求Action类继承一个抽象基类;Struts 1的一个具体问题是使用抽象类编程而不是接口。Struts 2 Action类可以实现一个Action接口,也可以实现其他接口,使可选和定制的服务成为可能。Struts 2提供一个ActionSupport基类去实现常用的接口。即使Action接口不是必须实现的,只有一 ......