项目中调用第三方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转对象的笔记的更多相关文章

  1. [C#]记一次解析XML转对象的笔记

    项目中调用第三方API,返回格式是XML字符串,需要将XML反序列化为对象,格式如下: <?xml version="1.0"?> <Response xmlns ...

  2. JAXB解析XML为对象

    JAXB支持注解将XML转化为对象,具体看一个简单的例子: <?xml version="1.0" encoding="utf-8"?> <A ...

  3. 解析xml的问题未解决

    工作上需要解析xml,目前的逻辑是:解析xml到对象中,然后对象再插入数据库.但这存在内存溢出的风险. 今天做的另外一件事是将循环用到工作上,暂时还没有测试,是否能保证程序的重启.有待观察 ##### ...

  4. Java高级特性 第14节 解析XML文档(2) - SAX 技术

    一.SAX解析XML文档 SAX的全称是Simple APIs for XML,也即XML简单应用程序接口.与DOM不同,SAX提供的访问模式是一种顺序模式,这是一种快速读写XML数据的方式.当使用S ...

  5. Android SAX解析XML

    本篇讲解一下SAX解析XML这种方式,首先来看一下它的基本介绍: SAX是一种以事件驱动的XML API,由它定义的事件流可以指定从解析器传到专门的处理程序的代码的XML结构,简单的讲,它是种解析速度 ...

  6. Java xml 操作(Dom4J修改xml   + xPath技术  + SAX解析 + XML约束)

    1 XML基础 1)XML的作用 1.1 作为软件配置文件 1.2 作为小型的"数据库" 2)XML语法(由w3c组织规定的) 标签: 标签名不能以数字开头,中间不能有空格,区分大 ...

  7. 利用Java反射机制完成XML到对象的解析

    对于一些小批量的数据,如果采用数据库来存取的话,未免有点大题小作,使用XML文件是个不错的方法,尤其是在一些Web应用中,经常需要缓存一部分数据,如果将这些数据形成XML文件,解析后放入一个Hasht ...

  8. webservice04#对象与xml转换-jaxb#Stax解析xml#新建修改xml

    1,Student类 package com.yangw.xml; import javax.xml.bind.annotation.XmlRootElement; @XmlRootElement / ...

  9. 遍历文件 创建XML对象 方法 python解析XML文件 提取坐标计存入文件

    XML文件??? xml即可扩展标记语言,它可以用来标记数据.定义数据类型,是一种允许用户对自己的标记语言进行定义的源语言. 里面的标签都是可以随心所欲的按照他的命名规则来定义的,文件名为roi.xm ...

随机推荐

  1. 用css改变console.log的输出样式

    console.log允许你通过css来格式化输出,格式如下: console.log('%c字符串[%c字符串]', 样式1, [样式2]) 其中"%c"为模板字符串 例子: 1 ...

  2. 爬虫之爬取网贷之家在档P2P平台基本数据并存入数据库

    python 版本 :3.5.2 Jupyter Notebook 使用库: reuqests (For human) json (用来加载JSON数据) datetime (用来记录抓取所花时间,也 ...

  3. webForm系列 前端框架快速引用

    Html的确定就是不能重用,MVC可以在_Layout.cshtml中将每个页面都需要的js和css文件(如jq,bootstrap等)都引用进去,webform就麻烦一点. webForm需要给所以 ...

  4. [MongoDB] - Window7下安装及BSON基本介绍

    MongoDB是一种NOSQL(Not Only SQL)类型的文档型数据库.NoSQL数据库与传统的关系型数据库相比,它具有操作简单.完全免费.源码公开.随时下载等特点,并可以用于各种商业目的.Mo ...

  5. POJ 2914 Minimum Cut Stoer Wagner 算法 无向图最小割

    POJ 2914 题意:给定一个无向图 小于500节点,和边的权值,求最小的代价将图拆为两个联通分量. Stoer Wagner算法: (1)用类似prim算法的方法求"最大生成树" ...

  6. BZOJ 1103: [POI2007]大都市meg(dfs序,树状数组)

    本来还想链剖的,结果才发现能直接树状数组的= = 记录遍历到达点与退出点的时间,然后一开始每个到达时间+1,退出时间-1,置为公路就-1,+1,询问直接点1到该点到达时间求和就行了- - CODE: ...

  7. 使用hubuild,mui开发微信app—首页(一)

    写在前面 本系列文章我将介绍一下从零开始利用hubuild,mui实现微信app的开发,该系列是个人学习记录,所以在每篇文章中,都是从怎么去实现开始讲解,然后再把实例中涉及知识点做一个概述. 创建一个 ...

  8. Javascript定时器中的this指向

    使用js中的定时器(setInterval,setTimeout),很容易会遇到this指向的问题. 直接上例子: var name = 'my name is window'; var obj = ...

  9. 关于c# 基础运算符的应用

    运算符 分为5种 1 算数预算符 +,-,*,/,分别为加减乘除 ++为加1,--为减1, 前++   后++  的区别 int a = 10, b = a++;            Console ...

  10. PCB行业ERP解决方案

    普实PCB管理系统包括PCB企业从接到订单开始,编排生产计划.制作工程指示.生产工具.准备物料.品质保障.工序生产.设备维护等一系列与企业运作密切相关的环节,使得企业的各个部门能够紧密联系.相互协调, ...