记一次解析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>)
记一次解析XML转对象的笔记的更多相关文章
- [C#]记一次解析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 ...
随机推荐
- Win8下,以管理员身份启动VS项目
之前一直是先以管理员身份启动VS,然后再打开项目的,比较麻烦,找了好久,总算有一个处理方案了 在Windows7下 通常使用修改属性的方式:在任意快捷方式上右击,选择属性,选择高级,选择以管理员身份启 ...
- Java生成、解析二维码
今天遇到需求,使用Java生成二维码图片,网搜之后,大神们早就做过,个人总结一下. 目标:借助Google提供的ZXing Core工具包,使用Java语言实现二维码的生成和解析. 步骤如下: 1.m ...
- html中如何修改选中 用input做的搜索框 的边框颜色
html中如何修改选中 用input做的搜索框 的边框颜色 如图,当我鼠标选中输入框时,内边框会变成蓝色 我的问题是: 1.如何把蓝色去掉? 2.如何改成别的颜色? 首先感谢 UI设计师提出的需求,解 ...
- javascript的方法
1. decodeURIComponent() decodeURIComponent() 函数可对 encodeURIComponent() 函数编码的 URI 进行解码. 语法: decodeURI ...
- 关于Console控制台输出的玩法
你在浏览网页的时候,是否注意过这些网页的控制台输出了什么? Console这种东西,其实一般只有前端工作者才会注意到.console在我们实际开发中可是个宝贝,他是各种error和warning的展示 ...
- JS 基础学习随想
2012年就已经接触过了js,给我的印象:这是一门谈不上复杂的语言.大概这就是所谓的学的越浅,用的越少,觉得自己会的东西好像得更多吧!开始做基础练习题的时候觉得好像都十分简单.可是后来在做到对象数组的 ...
- c++STL排序算法注意事项
关于算法中的比较函数 #include<iostream> #include<algorithm> using namespace std; int compare(doubl ...
- tornado学习 - TCPServer 实现聊天功能
最近学习tornado框架,其中有很多值得学习的模块,鉴于某位学长的建议,也决定好好看看tornado.tcpserver. 关于TCP协议详细介绍可查阅wiki. 对于TCP服务器,基本的操作tor ...
- Spring+SpringMVC+MyBatis+easyUI整合基础篇(二)牛刀小试
承接上文,该篇即为项目整合的介绍了. 废话不多说,先把源码和项目地址放上来,重点要写在前面. github地址为ssm-demo 你也可以先体验一下实际效果,点击这里就行啦 账号:admin 密码:1 ...
- 用react分页显示数据
去年年底,尝试着用react写个组件化的页面! demo地址 里面有一个list页面弄了一下数据的分页展示 展示一下主要三个组件:父组件listBox.列表组件List.按钮组件PageButton ...