[C#]记一次解析XML转对象的笔记
项目中调用第三方API,返回格式是XML字符串,需要将XML反序列化为对象,格式如下:
<?xml version="1.0"?>
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" totalCount="" resultCode="ABC" resultMessage="测试">
<profile lastName="李" firstName="爽" dateOfBirth="XX0816" age="" gender="" address="浙江省 杭州富阳市 东州工业园区3号路1号杭州龙盛工贸有限公" email="htlslll@163.com" cellEmail="" socialMedia="" homePhone="" cellPhone="" contactabiltyMail="" contactabiltyEmail="" contactabiltyCellEmail="" contactabiltyHomePhone="" contactabiltyCellPhone="" contactabiltyText="" contactabiltySocialMedia="" vipLevel="" memberId="OC540C00016824" saAccount="" classa="小姐" homeStoreCode="OC54" />
<purchaseHistory>
<departmentPurchase totalLifeTimeSale="" totalTYAmount="" lastTxn="" totalTYUnitCnt="" firstTxn="">
<department categoryName="D08" tyAmount="" tyUnitCnt="" />
<department categoryName="D01" tyAmount="" tyUnitCnt="" />
<department categoryName="D02" tyAmount="" tyUnitCnt="" />
</departmentPurchase>
<ratePurchase totalLyAmount="" totalLyRate="" totalTyAmount="" totalTyRate="" totalLifeTimeAmount="" totalLifeTimeRate="">
<rate categoryName="Retail" lyAmount="" lyRate="" lyToDate="" tyAmount="" tyRate="" tyToDate="" lifeTimeAmount="" lifeTimeRate="" lyTyChange="" />
</ratePurchase>
<storeRatePurchase>
<storeRate />
</storeRatePurchase>
</purchaseHistory>
<vipStatus issueDate="" issueShop="OC54" ptsToUpgrade="" expiryDate="" upgradeShop="" ptsToRenew="" />
<comments comment="第一场雪" />
</Response>
按照这个格式我需要定义相应的对象来接收,定义如下:
/// <summary>
///
/// </summary>
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = false, ElementName = "Response")]
public class Response
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string totalCount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string resultCode { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string resultMessage { get; set; } [System.Xml.Serialization.XmlElementAttribute("profile", typeof(profile))]
public profile profile { get; set; } [System.Xml.Serialization.XmlElementAttribute("purchaseHistory", typeof(purchaseHistory))]
public purchaseHistory purchaseHistory { get; set; } [System.Xml.Serialization.XmlElementAttribute("vipStatus", typeof(vipStatus))]
public vipStatus vipStatus { get; set; } [System.Xml.Serialization.XmlElementAttribute("comments", typeof(comments))]
public comments comments { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class profile
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string lastName { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string firstName { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string dateOfBirth { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string age { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string gender { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string address { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string email { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string cellEmail { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string socialMedia { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string homePhone { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string cellPhone { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string contactabiltyMail { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string contactabiltyEmail { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string contactabiltyCellEmail { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string contactabiltyHomePhone { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string contactabiltyCellPhone { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string contactabiltyText { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string contactabiltySocialMedia { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string vipLevel { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string memberId { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string saAccount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string classa { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string homeStoreCode { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class purchaseHistory
{ [System.Xml.Serialization.XmlElementAttribute("departmentPurchase", typeof(departmentPurchase))]
public departmentPurchase departmentPurchase { get; set; } [System.Xml.Serialization.XmlElementAttribute("ratePurchase", typeof(ratePurchase))]
public ratePurchase ratePurchase { get; set; } [System.Xml.Serialization.XmlElementAttribute("storeRatePurchase", typeof(storeRatePurchase))]
public storeRatePurchase storeRatePurchase { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class departmentPurchase
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string totalTYAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string totalTYUnitCnt { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string firstTxn { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string lastTxn { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string totalLifeTimeSale { get; set; } [System.Xml.Serialization.XmlElementAttribute("department", typeof(List<department>), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = )]
public List<department> department { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class department
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string categoryName { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string tyAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string tyUnitCnt { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class ratePurchase
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string totalLyAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string totalLyRate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string totalTyAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string totalTyRate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string totalLifeTimeAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string totalLifeTimeRate { get; set; } [System.Xml.Serialization.XmlElementAttribute("rate", typeof(rate))]
public rate rate { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class rate
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string categoryName { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string lyAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string lyRate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string lyToDate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string tyAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string tyRate { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute()] public string tyToDate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string lifeTimeAmount { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string lifeTimeRate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string lyTyChange { get; set; } } [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class storeRatePurchase
{
public string storeRate { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class vipStatus
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string issueDate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string issueShop { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string ptsToUpgrade { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string expiryDate { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string upgradeShop { get; set; } [System.Xml.Serialization.XmlAttributeAttribute()]
public string ptsToRenew { get; set; }
} [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class comments
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string comment { get; set; }
}
解析代码如下
private static System.Xml.Serialization.XmlSerializer Serializer;
/// <summary>
/// 指定XML字符串序列化成对象
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="xml"></param>
/// <returns></returns>
public static T DeserializeForXml<T>(string xml) where T : class, new()
{
System.IO.StringReader stringReader = null;
try
{
Serializer = Serializer ?? new XmlSerializer(typeof(T));
stringReader = new StringReader(xml);
T result = Serializer.Deserialize(stringReader) as T;
return result;
}
finally
{
if ((stringReader != null))
{
stringReader.Dispose();
}
}
}
调用方式:
var rpXML = AcxiomXMLHelper.DeserializeForXml<CustomerDetails.Response>(returnXML);
好了,接下来就出现了问题
departmentPurchase 下面的department始终是没有数据,调试好久都找不到问题出现在哪里。
尝试找解决的办法,先实例化一个Response对象序列化后写入文件,再将文件内容读出来反序列化出来
Response response = new Response
{
totalCount = "",
resultCode = "ABC",
resultMessage = "测试",
profile = new profile { lastName = "李", firstName = "爽", dateOfBirth = "XX0816", age = "", gender = "", address = "浙江省 杭州富阳市 东州工业园区3号路1号杭州龙盛工贸有限公", email = "htlslll@163.com", cellEmail = "", socialMedia = "", homePhone = "", cellPhone = "", contactabiltyMail = "", contactabiltyEmail = "", contactabiltyCellEmail = "", contactabiltyHomePhone = "", contactabiltyCellPhone = "", contactabiltyText = "", contactabiltySocialMedia = "", vipLevel = "", memberId = "OC540C00016824", saAccount = "", classa = "小姐", homeStoreCode = "OC54" },
comments = new comments { comment = "第一场雪" },
purchaseHistory = new purchaseHistory
{
departmentPurchase = new departmentPurchase
{
totalTYAmount = "",
totalTYUnitCnt = "",
firstTxn = "",
lastTxn = "",
totalLifeTimeSale = "",
department = new List<department> {
new department { categoryName = "D08", tyAmount = "", tyUnitCnt = "" },
new department { categoryName = "D01", tyAmount = "", tyUnitCnt = "" },
new department { categoryName = "D02", tyAmount = "", tyUnitCnt = "" }
}
},
ratePurchase = new ratePurchase
{
totalLyAmount = "",
totalLyRate = "",
totalTyAmount = "",
totalTyRate = "",
totalLifeTimeAmount = "",
totalLifeTimeRate = "",
rate = new rate { categoryName = "Retail", lyAmount = "", lyRate = "", lyToDate = "", tyAmount = "", tyRate = "", tyToDate = "", lifeTimeAmount = "", lifeTimeRate = "", lyTyChange = "" }
},
storeRatePurchase = new storeRatePurchase { storeRate = string.Empty }
},
vipStatus = new vipStatus { issueDate = "", issueShop = "OC54", ptsToUpgrade = "", expiryDate = "", upgradeShop = "", ptsToRenew = "" }
}; FileStream stream = new FileStream(@"d:\xmlFormat.xml", FileMode.Create);
XmlSerializer xmlserilize = new XmlSerializer(typeof(Response));
xmlserilize.Serialize(stream, response); stream.Close(); using (FileStream xmlStream = new FileStream(@"d:\xmlFormat.xml", FileMode.Open))
{
using (XmlReader xmlReader = XmlReader.Create(xmlStream))
{
XmlSerializer serializer = new XmlSerializer(typeof(Response));
Response res = serializer.Deserialize(xmlReader) as Response;
}
}
代码中res是反序列化的结果,数据都正确。这就有点恼火了,怎么办呢?
比较我生成的文件和API返回的XML:
下面是我生成的XML格式
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" totalCount="" resultCode="ABC" resultMessage="测试">
<profile lastName="李" firstName="爽" dateOfBirth="XX0816" age="" gender="" address="浙江省 杭州富阳市 东州工业园区3号路1号杭州龙盛工贸有限公" email="htlslll@163.com" cellEmail="" socialMedia="" homePhone="" cellPhone="" contactabiltyMail="" contactabiltyEmail="" contactabiltyCellEmail="" contactabiltyHomePhone="" contactabiltyCellPhone="" contactabiltyText="" contactabiltySocialMedia="" vipLevel="" memberId="OC540C00016824" saAccount="" classa="小姐" homeStoreCode="OC54" />
<purchaseHistory>
<departmentPurchase totalLifeTimeSale="" totalTYAmount="" lastTxn="" totalTYUnitCnt="" firstTxn="">
<department>
<department categoryName="D08" tyAmount="" tyUnitCnt="" />
<department categoryName="D01" tyAmount="" tyUnitCnt="" />
<department categoryName="D02" tyAmount="" tyUnitCnt="" />
</department>
</departmentPurchase>
<ratePurchase totalLyAmount="" totalLyRate="" totalTyAmount="" totalTyRate="" totalLifeTimeAmount="" totalLifeTimeRate="">
<rate categoryName="Retail" lyAmount="" lyRate="" lyToDate="" tyAmount="" tyRate="" tyToDate="" lifeTimeAmount="" lifeTimeRate="" lyTyChange="" />
</ratePurchase>
<storeRatePurchase>
<storeRate />
</storeRatePurchase>
</purchaseHistory>
<vipStatus issueDate="" issueShop="OC54" ptsToUpgrade="" expiryDate="" upgradeShop="" ptsToRenew="" />
<comments comment="第一场雪" />
</Response>
仔细比对发现问题
在departmentPurchase 节点下我多了一层department节点,可我是按照接口的结果定义的对象啊
[System.CodeDom.Compiler.GeneratedCodeAttribute("System.Xml", "4.0.30319.34209")]
[System.SerializableAttribute()]
[System.ComponentModel.DesignerCategoryAttribute("code")]
[System.Xml.Serialization.XmlRootAttribute(Namespace = "", IsNullable = true)]
public class departmentPurchase
{
[System.Xml.Serialization.XmlAttributeAttribute()]
public string totalTYAmount { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute()]
public string totalTYUnitCnt { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute()]
public string firstTxn { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute()]
public string lastTxn { get; set; }
[System.Xml.Serialization.XmlAttributeAttribute()]
public string totalLifeTimeSale { get; set; }
[System.Xml.Serialization.XmlElementAttribute("department", typeof(List<department>), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = )]
public List<department> department { get; set; }
}
怎么搞呢?在网上不停的找答案,最终都无解。但是没有放弃,答案也往往在快要放弃的时候出现
我尝试的修改了department的定义
修改前
[System.Xml.Serialization.XmlElementAttribute("department", typeof(List<department>), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = )]
public List<department> department { get; set; }
修改后
[System.Xml.Serialization.XmlElementAttribute("department", typeof(department), Form = System.Xml.Schema.XmlSchemaForm.Unqualified, Order = )]
public List<department> department { get; set; }
重新运行,奇迹出现
<?xml version="1.0"?>
<Response xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" totalCount="" resultCode="ABC" resultMessage="测试">
<profile lastName="李" firstName="爽" dateOfBirth="XX0816" age="" gender="" address="浙江省 杭州富阳市 东州工业园区3号路1号杭州龙盛工贸有限公" email="htlslll@163.com" cellEmail="" socialMedia="" homePhone="" cellPhone="" contactabiltyMail="" contactabiltyEmail="" contactabiltyCellEmail="" contactabiltyHomePhone="" contactabiltyCellPhone="" contactabiltyText="" contactabiltySocialMedia="" vipLevel="" memberId="OC540C00016824" saAccount="" classa="小姐" homeStoreCode="OC54" />
<purchaseHistory>
<departmentPurchase totalLifeTimeSale="" totalTYAmount="" lastTxn="" totalTYUnitCnt="" firstTxn="">
<department categoryName="D08" tyAmount="" tyUnitCnt="" />
<department categoryName="D01" tyAmount="" tyUnitCnt="" />
<department categoryName="D02" tyAmount="" tyUnitCnt="" />
</departmentPurchase>
<ratePurchase totalLyAmount="" totalLyRate="" totalTyAmount="" totalTyRate="" totalLifeTimeAmount="" totalLifeTimeRate="">
<rate categoryName="Retail" lyAmount="" lyRate="" lyToDate="" tyAmount="" tyRate="" tyToDate="" lifeTimeAmount="" lifeTimeRate="" lyTyChange="" />
</ratePurchase>
<storeRatePurchase>
<storeRate />
</storeRatePurchase>
</purchaseHistory>
<vipStatus issueDate="" issueShop="OC54" ptsToUpgrade="" expiryDate="" upgradeShop="" ptsToRenew="" />
<comments comment="第一场雪" />
</Response>
问题解决。
原因就出在解析XML节点的
typeof(department) 与 typeof(List<department>)
[C#]记一次解析XML转对象的笔记的更多相关文章
- 记一次解析XML转对象的笔记
项目中调用第三方API,返回格式是XML字符串,需要将XML反序列化为对象,格式如下: <?xml version="1.0"?> <Response xmlns ...
- JAXB解析XML为对象
JAXB支持注解将XML转化为对象,具体看一个简单的例子: <?xml version="1.0" encoding="utf-8"?> <A ...
- 解析xml的问题未解决
工作上需要解析xml,目前的逻辑是:解析xml到对象中,然后对象再插入数据库.但这存在内存溢出的风险. 今天做的另外一件事是将循环用到工作上,暂时还没有测试,是否能保证程序的重启.有待观察 ##### ...
- Java高级特性 第14节 解析XML文档(2) - SAX 技术
一.SAX解析XML文档 SAX的全称是Simple APIs for XML,也即XML简单应用程序接口.与DOM不同,SAX提供的访问模式是一种顺序模式,这是一种快速读写XML数据的方式.当使用S ...
- Android SAX解析XML
本篇讲解一下SAX解析XML这种方式,首先来看一下它的基本介绍: SAX是一种以事件驱动的XML API,由它定义的事件流可以指定从解析器传到专门的处理程序的代码的XML结构,简单的讲,它是种解析速度 ...
- Java xml 操作(Dom4J修改xml + xPath技术 + SAX解析 + XML约束)
1 XML基础 1)XML的作用 1.1 作为软件配置文件 1.2 作为小型的"数据库" 2)XML语法(由w3c组织规定的) 标签: 标签名不能以数字开头,中间不能有空格,区分大 ...
- 利用Java反射机制完成XML到对象的解析
对于一些小批量的数据,如果采用数据库来存取的话,未免有点大题小作,使用XML文件是个不错的方法,尤其是在一些Web应用中,经常需要缓存一部分数据,如果将这些数据形成XML文件,解析后放入一个Hasht ...
- webservice04#对象与xml转换-jaxb#Stax解析xml#新建修改xml
1,Student类 package com.yangw.xml; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement / ...
- 遍历文件 创建XML对象 方法 python解析XML文件 提取坐标计存入文件
XML文件??? xml即可扩展标记语言,它可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言. 里面的标签都是可以随心所欲的按照他的命名规则来定义的,文件名为roi.xm ...
随机推荐
- B - Avoiding a disaster
Description Percy likes to be punctual. So much so that he always keeps three watches with him, so t ...
- Oracle包被锁定的原因分析及解决方案
http://blog.csdn.net/jojo52013145/article/details/7470812 在数据库的开发过程中,经常碰到包.存储过程.函数无法编译或编译时会导致PL/SQL ...
- 如何获取帮助———— QQ群讨论摘要
QQ群对话整理(删除一些简单的回应),对一些重要的地方,我做了一些加粗 宝玉 2015/9/21 1:49:05 这次题目还有个问题就是如何读取Excel,我想对于很多同学来说是个困难 ...
- 真实项目中VS2015中自建T4模板生成文件的使用
有可能许多小伙伴们发现,vs2015和2012的自带T4模板中的.tt文件改变非常之多,如果仅仅copyEF系统自己生成的模板文件,那可累了.以下是我自己整理的在2012和2015中都可以试用的代码. ...
- 10_python_函数进阶
一.函数参数-动态参数 形参:位置参数.默认值参数.动态参数 动态参数分为两种:动态接收位置参数 *args .动态接收关键字参数 *kwargs 1. *args def chi(*foo ...
- [Leetcode]315.计算右侧小于当前元素的个数 (6种方法)
链接 给定一个整数数组 nums,按要求返回一个新数组 counts.数组 counts 有该性质: counts[i] 的值是 nums[i] 右侧小于 nums[i] 的元素的数量. 示例: 输 ...
- [umbraco] 数据结构
我想此图就能说明一切了,不需要再废话了
- FireFox浏览器-xpath快速定位插件:Xpath Checker
FireFox浏览器-xpath快速定位插件:Xpath Checker 插件截图:
- 在MVC3中使用富文本编辑器:KindEditor的配置及上传图片
现在比较常用的富文本编辑挺多的,如ueditor.fckeditor.kingeditor等,本文主要介绍一下KindEditor的配置与使用. 先去官网http://www.kindsoft.net ...
- Spark集群测试
1. Spark Shell测试 Spark Shell是一个特别适合快速开发Spark原型程序的工具,可以帮助我们熟悉Scala语言.即使你对Scala不熟悉,仍然可以使用这一工具.Spark Sh ...