spring xml中的propery 的name属性名自来源
今天在运用spring的PropertyPlaceholderConfigurer时发现一个有意思的内容,当你在applicationContext中配置一个PropertyPlaceholderConfigurer的bean时,有location和locations的属性,不明思意location对应一个.properties文件,
locations对应多个.properties文件,冲着想看一下PropertyPlaceholderConfigurer的实现机制,于是查看了spring的源码,发现在PropertyPlaceholderConfigurer中并没有location和locations的属性,于是一路向上在父类PropertiesLoaderSupport中找到了locations的属性,但是没有location属性,奇怪?但在PropertiesLoaderSupport中却有setLocation和setLocations两个方法:
/**
* Set a location of a properties file to be loaded.
* <p>Can point to a classic properties file or to an XML file
* that follows JDK 1.5's properties XML format.
*/
public void setLocation(Resource location) {
this.locations = new Resource[] {location};
}
/**
* Set locations of properties files to be loaded.
* <p>Can point to classic properties files or to XML files
* that follow JDK 1.5's properties XML format.
*/
public void setLocations(Resource[] locations) {
this.locations = locations;
}
这样看来applicationContext.xml中的bean的property的name属性的值,并不是和对应类类中的属性内容是一致的
相关文档:
IsolatedStorageFile:包含文件和数据的独立存储区
dataset数据存储到本地xml文档,代码处理如下
public static void WriteDataToXML(DataSet dataset, string dataname)
{
try
{
IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForAssembly(); / ......
和Android UI layout一样,我们也可以在XML中定义应用程序的菜单。通过在菜单的onCreateOptionsMenu方法中膨胀菜单layout。这样做会使我们的程序代码简单多了,而且尽可能的将更多的界面设计部分放到XML,便于浏览。
1. 在工程的/res/文件夹下创建menu文件夹,用来保存你为应用程序定义的菜单XML文件。
在菜单XML ......
/// <summary>
/// DataTable-------------------->XML --String
/// </summary>
public static String ToXmlString(DataTable dt)
{
StringWriter tr = new StringWriter();
try
{
dt.WriteXml(tr); ......
public int createXMLFile(String filename) {
int returnValue = 0;
Document document = DocumentHelper.createDocument(); //生成Document,用于管理XML文档
Element booksElement = document.addElement("books"); //添加 ......
1,浅串行化:只串行化类的公共字段和属性
公共属性必须是可读且可写的
使用命名空间:using System.Xml.Serialization;
以Book类为例:
串行化模板:
public ......