C# XML反序列化与序列化举例:XmlSerializer
- using System;
- using System.IO;
- using System.Xml.Serialization;
- namespace XStream
- {
- /// <summary>
- /// <remarks>Xml序列化与反序列化</remarks>
- /// <creator>zhangdapeng</creator>
- /// </summary>
- public class XmlSerializeUtil
- {
- #region 反序列化
- /// <summary>
- /// 反序列化
- /// </summary>
- /// <param name="type">类型</param>
- /// <param name="xml">XML字符串</param>
- /// <returns></returns>
- public static object Deserialize(Type type, string xml)
- {
- using (StringReader sr = new StringReader(xml))
- {
- XmlSerializer xmldes = new XmlSerializer(type);
- return xmldes.Deserialize(sr);
- }
- }
- /// <summary>
- /// 反序列化
- /// </summary>
- /// <param name="type"></param>
- /// <param name="xml"></param>
- /// <returns></returns>
- public static object Deserialize(Type type, Stream stream)
- {
- XmlSerializer xmldes = new XmlSerializer(type);
- return xmldes.Deserialize(stream);
- }
- #endregion
- #region 序列化
- /// <summary>
- /// 序列化
- /// </summary>
- /// <param name="type">类型</param>
- /// <param name="obj">对象</param>
- /// <returns></returns>
- public static string Serializer(Type type, object obj)
- {
- MemoryStream Stream = new MemoryStream();
- XmlSerializer xml = new XmlSerializer(type);
- //序列化对象
- xml.Serialize(Stream, obj);
- Stream.Position = 0;
- StreamReader sr = new StreamReader(Stream);
- string str = sr.ReadToEnd();
- sr.Dispose();
- Stream.Dispose();
- return str;
- }
- #endregion
- }
- }
using System;
using System.IO;
using System.Xml.Serialization; namespace XStream
{
/// <summary>
/// <remarks>Xml序列化与反序列化</remarks>
/// <creator>zhangdapeng</creator>
/// </summary>
public class XmlSerializeUtil
{
#region 反序列化
/// <summary>
/// 反序列化
/// </summary>
/// <param name="type">类型</param>
/// <param name="xml">XML字符串</param>
/// <returns></returns>
public static object Deserialize(Type type, string xml)
{
using (StringReader sr = new StringReader(xml))
{
XmlSerializer xmldes = new XmlSerializer(type);
return xmldes.Deserialize(sr);
}
}
/// <summary>
/// 反序列化
/// </summary>
/// <param name="type"></param>
/// <param name="xml"></param>
/// <returns></returns>
public static object Deserialize(Type type, Stream stream)
{
XmlSerializer xmldes = new XmlSerializer(type);
return xmldes.Deserialize(stream);
}
#endregion #region 序列化
/// <summary>
/// 序列化
/// </summary>
/// <param name="type">类型</param>
/// <param name="obj">对象</param>
/// <returns></returns>
public static string Serializer(Type type, object obj)
{
MemoryStream Stream = new MemoryStream();
XmlSerializer xml = new XmlSerializer(type);
//序列化对象
xml.Serialize(Stream, obj);
Stream.Position = 0;
StreamReader sr = new StreamReader(Stream);
string str = sr.ReadToEnd(); sr.Dispose();
Stream.Dispose(); return str;
} #endregion
}
}
这个类是个实体类
- using System.Collections.Generic;
- using System.Xml.Serialization;
- namespace XStream
- {
- /// <summary>
- /// <creator>zhangdapeng</creator>
- /// </summary>
- [XmlRoot("skycenter")]
- public class AdsbEntity
- {
- private string _type;
- [XmlAttribute("type")]
- public string Type
- {
- get { return _type; }
- set { _type = value; }
- }
- private string _source;
- [XmlAttribute("source")]
- public string Source
- {
- get { return _source; }
- set { _source = value; }
- }
- private string _reality;
- [XmlAttribute("reality")]
- public string Reality
- {
- get { return _reality; }
- set { _reality = value; }
- }
- private string _rcvTime;
- [XmlAttribute("rcvTime")]
- public string RcvTime
- {
- get { return _rcvTime; }
- set { _rcvTime = value; }
- }
- private Head _head;
- //属性的定义
- [XmlElement("head")]
- public Head Head
- {
- set //设定属性
- {
- _head = value;
- }
- get //从属性获取值
- {
- return _head;
- }
- }
- private List<Unit> data = new List<Unit>();
- [XmlArray("data")]
- [XmlArrayItem("unit")]
- public List<Unit> Unit
- {
- get { return data; }
- }
- public void addUnit(Unit e)
- {
- data.Add(e);
- }
- private string _msg;
- public string msg
- {
- get { return _msg; }
- set { _msg = value; }
- }
- }
- }
using System.Collections.Generic;
using System.Xml.Serialization; namespace XStream
{
/// <summary>
/// <creator>zhangdapeng</creator>
/// </summary>
[XmlRoot("skycenter")]
public class AdsbEntity
{
private string _type; [XmlAttribute("type")]
public string Type
{
get { return _type; }
set { _type = value; }
}
private string _source;
[XmlAttribute("source")]
public string Source
{
get { return _source; }
set { _source = value; }
}
private string _reality;
[XmlAttribute("reality")]
public string Reality
{
get { return _reality; }
set { _reality = value; }
}
private string _rcvTime;
[XmlAttribute("rcvTime")]
public string RcvTime
{
get { return _rcvTime; }
set { _rcvTime = value; }
}
private Head _head;
//属性的定义
[XmlElement("head")]
public Head Head
{
set //设定属性
{
_head = value;
}
get //从属性获取值
{
return _head;
}
} private List<Unit> data = new List<Unit>(); [XmlArray("data")]
[XmlArrayItem("unit")]
public List<Unit> Unit
{
get { return data; }
}
public void addUnit(Unit e)
{
data.Add(e);
} private string _msg; public string msg
{
get { return _msg; }
set { _msg = value; }
} }
}
- using System.Xml.Serialization;
- namespace XStream
- {
- /// <summary>
- /// <creator>zhangdapeng</creator>
- /// </summary>
- public class Head
- {
- private string _datagramId;
- [XmlElement("datagramId")]
- public string DatagramId
- {
- set
- {
- _datagramId = value;
- }
- get
- {
- return _datagramId;
- }
- }
- private string _priority;
- [XmlElement("priority")]
- public string Priority
- {
- get { return _priority; }
- set { _priority = value; }
- }
- private string _an;
- [XmlElement("an")]
- public string An
- {
- get { return _an; }
- set { _an = value; }
- }
- private string _fi;
- [XmlElement("fi")]
- public string Fi
- {
- get { return _fi; }
- set { _fi = value; }
- }
- private string _rcvAddress;
- [XmlElement("rcvAddress")]
- public string RcvAddress
- {
- get { return _rcvAddress; }
- set { _rcvAddress = value; }
- }
- private string _sndAddress;
- [XmlElement("sndAddress")]
- public string SndAddress
- {
- get { return _sndAddress; }
- set { _sndAddress = value; }
- }
- private string _bepTime;
- [XmlElement("bepTime")]
- public string BepTime
- {
- get { return _bepTime; }
- set { _bepTime = value; }
- }
- private string _smi;
- [XmlElement("smi")]
- public string Smi
- {
- get { return _smi; }
- set { _smi = value; }
- }
- private string _dsp;
- [XmlElement("dsp")]
- public string Dsp
- {
- get { return _dsp; }
- set { _dsp = value; }
- }
- private string _rgs;
- [XmlElement("rgs")]
- public string Rgs
- {
- get { return _rgs; }
- set { _rgs = value; }
- }
- private string _msn;
- [XmlElement("msn")]
- public string Msn
- {
- get { return _msn; }
- set { _msn = value; }
- }
- private string _datagramType;
- [XmlElement("datagramType")]
- public string DatagramType
- {
- get { return _datagramType; }
- set { _datagramType = value; }
- }
- private string _icao24;
- [XmlElement("icao24")]
- public string Icao24
- {
- get { return _icao24; }
- set { _icao24 = value; }
- }
- private string _callcode;
- [XmlElement("callcode")]
- public string Callcode
- {
- get { return _callcode; }
- set { _callcode = value; }
- }
- }
- }
using System.Xml.Serialization; namespace XStream
{
/// <summary>
/// <creator>zhangdapeng</creator>
/// </summary>
public class Head
{ private string _datagramId;
[XmlElement("datagramId")]
public string DatagramId
{
set
{
_datagramId = value;
}
get
{
return _datagramId;
}
} private string _priority;
[XmlElement("priority")]
public string Priority
{
get { return _priority; }
set { _priority = value; }
} private string _an;
[XmlElement("an")]
public string An
{
get { return _an; }
set { _an = value; }
} private string _fi;
[XmlElement("fi")]
public string Fi
{
get { return _fi; }
set { _fi = value; }
} private string _rcvAddress;
[XmlElement("rcvAddress")]
public string RcvAddress
{
get { return _rcvAddress; }
set { _rcvAddress = value; }
} private string _sndAddress;
[XmlElement("sndAddress")]
public string SndAddress
{
get { return _sndAddress; }
set { _sndAddress = value; }
} private string _bepTime;
[XmlElement("bepTime")]
public string BepTime
{
get { return _bepTime; }
set { _bepTime = value; }
} private string _smi;
[XmlElement("smi")]
public string Smi
{
get { return _smi; }
set { _smi = value; }
} private string _dsp;
[XmlElement("dsp")]
public string Dsp
{
get { return _dsp; }
set { _dsp = value; }
} private string _rgs;
[XmlElement("rgs")]
public string Rgs
{
get { return _rgs; }
set { _rgs = value; }
} private string _msn;
[XmlElement("msn")]
public string Msn
{
get { return _msn; }
set { _msn = value; }
} private string _datagramType;
[XmlElement("datagramType")]
public string DatagramType
{
get { return _datagramType; }
set { _datagramType = value; }
} private string _icao24;
[XmlElement("icao24")]
public string Icao24
{
get { return _icao24; }
set { _icao24 = value; }
} private string _callcode;
[XmlElement("callcode")]
public string Callcode
{
get { return _callcode; }
set { _callcode = value; }
} }
}
- using System.Xml.Serialization;
- namespace XStream
- {
- /// <summary>
- /// <creator>zhangdapeng</creator>
- /// </summary>
- [XmlRootAttribute("unit")]
- public class Unit
- {
- private string _name;
- [XmlAttribute("name")]
- public string Name
- {
- get { return _name; }
- set { _name = value; }
- }
- private string _name_value;
- [XmlTextAttribute]
- public string Name_value
- {
- get { return _name_value; }
- set { _name_value = value; }
- }
- }
- }
using System.Xml.Serialization; namespace XStream
{
/// <summary>
/// <creator>zhangdapeng</creator>
/// </summary>
[XmlRootAttribute("unit")]
public class Unit
{
private string _name; [XmlAttribute("name")]
public string Name
{
get { return _name; }
set { _name = value; }
} private string _name_value; [XmlTextAttribute]
public string Name_value
{
get { return _name_value; }
set { _name_value = value; }
}
}
}
主类:
- using System;
- using System.Xml;
- namespace XStream
- {
- /// <summary>
- /// <creator>zhangdapeng</creator>
- /// </summary>
- class Program
- {
- static void Main(string[] args)
- {
- string path = System.AppDomain.CurrentDomain.BaseDirectory;
- XmlDocument xmlDoc = new XmlDocument();
- xmlDoc.Load(@path+"../../test.xml");
- Console.WriteLine(xmlDoc.OuterXml);
- AdsbEntity ad = XmlSerializeUtil.Deserialize(typeof(AdsbEntity), xmlDoc.OuterXml) as AdsbEntity;
- Console.WriteLine(ad.Head.DatagramId);
- Console.WriteLine(ad.Head.Fi);
- string xml = XmlSerializeUtil.Serializer(typeof(AdsbEntity), ad);
- Console.WriteLine(xml);
- Console.ReadKey();
- }
- }
- }
using System;
using System.Xml; namespace XStream
{
/// <summary>
/// <creator>zhangdapeng</creator>
/// </summary>
class Program
{
static void Main(string[] args)
{ string path = System.AppDomain.CurrentDomain.BaseDirectory;
XmlDocument xmlDoc = new XmlDocument(); xmlDoc.Load(@path+"../../test.xml");
Console.WriteLine(xmlDoc.OuterXml); AdsbEntity ad = XmlSerializeUtil.Deserialize(typeof(AdsbEntity), xmlDoc.OuterXml) as AdsbEntity;
Console.WriteLine(ad.Head.DatagramId);
Console.WriteLine(ad.Head.Fi); string xml = XmlSerializeUtil.Serializer(typeof(AdsbEntity), ad);
Console.WriteLine(xml); Console.ReadKey(); }
}
}
原始输入:test.xml文件
- <?xml version="1.0" encoding="UTF-8"?>
- <skycenter type="ADSBResult" source="ADSB" reality="T" rcvTime="2014-02-25 07:23:31">
- <head>
- <!--报文id 注:空节点-->
- <datagramId>127</datagramId>
- <!--priority 注:空节点-->
- <priority>18</priority>
- <!--机尾号-->
- <an>B-5662</an>
- <!--航班号-->
- <fi>HU7782</fi>
- <!--接收地址 注:空节点-->
- <rcvAddress>1</rcvAddress>
- <!--发送地址 注:空节点-->
- <sndAddress>1</sndAddress>
- <!--bepTime 注:空节点-->
- <bepTime>1</bepTime>
- <!--SMI 注:空节点-->
- <smi>1</smi>
- <!--DSP服务商 注:空节点-->
- <dsp>1</dsp>
- <!--地面站-->
- <rgs>PEK</rgs>
- <!--流水号 注:空节点-->
- <msn>1</msn>
- <!--报文类型,都是POS 注:空节点-->
- <datagramType>1</datagramType>
- <!--ICAO24位地址码-->
- <icao24>7808a3</icao24>
- <!--呼号-->
- <callcode>CHH7782</callcode>
- </head>
- <data>
- <!--纬度 看前面的字母“N”或“S”,格式“DDMMSS.SS”-->
- <unit name="LAT">N31414709</unit>
- <!--经度 看前面的字母“E”或“W”,格式“DDDMMSS.SS”-->
- <unit name="LON">E118463546</unit>
- <!--气压高度,单位是米-->
- <unit name="ALT">396.24</unit>
- <!--计算空速 单位海里每小时-->
- <unit name="CAS">127.00</unit>
- <!--航向 正北是0°,顺时针,0到360°-->
- <unit name="VEC">58.18</unit>
- <!--收到报文的UTC时间 hh24mmss-->
- <unit name="UTC">072331</unit>
- </data>
- <msg>11</msg>
- </skycenter>
<?xml version="1.0" encoding="UTF-8"?>
<skycenter type="ADSBResult" source="ADSB" reality="T" rcvTime="2014-02-25 07:23:31">
<head>
<!--报文id 注:空节点-->
<datagramId>127</datagramId>
<!--priority 注:空节点-->
<priority>18</priority>
<!--机尾号-->
<an>B-5662</an>
<!--航班号-->
<fi>HU7782</fi>
<!--接收地址 注:空节点-->
<rcvAddress>1</rcvAddress>
<!--发送地址 注:空节点-->
<sndAddress>1</sndAddress>
<!--bepTime 注:空节点-->
<bepTime>1</bepTime>
<!--SMI 注:空节点-->
<smi>1</smi>
<!--DSP服务商 注:空节点-->
<dsp>1</dsp>
<!--地面站-->
<rgs>PEK</rgs>
<!--流水号 注:空节点-->
<msn>1</msn>
<!--报文类型,都是POS 注:空节点-->
<datagramType>1</datagramType>
<!--ICAO24位地址码-->
<icao24>7808a3</icao24>
<!--呼号-->
<callcode>CHH7782</callcode>
</head>
<data>
<!--纬度 看前面的字母“N”或“S”,格式“DDMMSS.SS”-->
<unit name="LAT">N31414709</unit>
<!--经度 看前面的字母“E”或“W”,格式“DDDMMSS.SS”-->
<unit name="LON">E118463546</unit>
<!--气压高度,单位是米-->
<unit name="ALT">396.24</unit>
<!--计算空速 单位海里每小时-->
<unit name="CAS">127.00</unit>
<!--航向 正北是0°,顺时针,0到360°-->
<unit name="VEC">58.18</unit>
<!--收到报文的UTC时间 hh24mmss-->
<unit name="UTC">072331</unit>
</data>
<msg>11</msg>
</skycenter>
结果:
- </pre><pre class="html" name="code"><?xml version="1.0" encoding="UTF-8"?>
- <skycenter type="ADSBResult" source="ADSB" reality="T" rcvTime="2014-02-25 07:23:31">
- <head>
- <!--报文id 注:空节点-->
- <datagramId>127</datagramId>
- <!--priority 注:空节点-->
- <priority>18</priority>
- <!--机尾号-->
- <an>B-5662</an>
- <!--航班号-->
- <fi>HU7782</fi>
- <!--接收地址 注:空节点-->
- <rcvAddress>1</rcvAddress>
- <!--发送地址 注:空节点-->
- <sndAddress>1</sndAddress>
- <!--bepTime 注:空节点-->
- <bepTime>1</bepTime>
- <!--SMI 注:空节点-->
- <smi>1</smi>
- <!--DSP服务商 注:空节点-->
- <dsp>1</dsp>
- <!--地面站-->
- <rgs>PEK</rgs>
- <!--流水号 注:空节点-->
- <msn>1</msn>
- <!--报文类型,都是POS 注:空节点-->
- <datagramType>1</datagramType>
- <!--ICAO24位地址码-->
- <icao24>7808a3</icao24>
- <!--呼号-->
- <callcode>CHH7782</callcode>
- </head>
- <data>
- <!--纬度 看前面的字母“N”或“S”,格式“DDMMSS.SS”-->
- <unit name="LAT">N31414709</unit>
- <!--经度 看前面的字母“E”或“W”,格式“DDDMMSS.SS”-->
- <unit name="LON">E118463546</unit>
- <!--气压高度,单位是米-->
- <unit name="ALT">396.24</unit>
- <!--计算空速 单位海里每小时-->
- <unit name="CAS">127.00</unit>
- <!--航向 正北是0°,顺时针,0到360°-->
- <unit name="VEC">58.18</unit>
- <!--收到报文的UTC时间 hh24mmss-->
- <unit name="UTC">072331</unit>
- </data>
- <msg>11</msg>
- </skycenter>
- 127
- HU7782
- <?xml version="1.0"?>
- <skycenter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http
- ://www.w3.org/2001/XMLSchema" type="ADSBResult" source="ADSB" reality="T" rcvTim
- e="2014-02-25 07:23:31">
- <head>
- <datagramId>127</datagramId>
- <priority>18</priority>
- <an>B-5662</an>
- <fi>HU7782</fi>
- <rcvAddress>1</rcvAddress>
- <sndAddress>1</sndAddress>
- <bepTime>1</bepTime>
- <smi>1</smi>
- <dsp>1</dsp>
- <rgs>PEK</rgs>
- <msn>1</msn>
- <datagramType>1</datagramType>
- <icao24>7808a3</icao24>
- <callcode>CHH7782</callcode>
- </head>
- <data>
- <unit name="LAT">N31414709</unit>
- <unit name="LON">E118463546</unit>
- <unit name="ALT">396.24</unit>
- <unit name="CAS">127.00</unit>
- <unit name="VEC">58.18</unit>
- <unit name="UTC">072331</unit>
- </data>
- <msg>11</msg>
- </skycenter>
</pre><pre class="html" name="code"><?xml version="1.0" encoding="UTF-8"?>
<skycenter type="ADSBResult" source="ADSB" reality="T" rcvTime="2014-02-25 07:23:31">
<head>
<!--报文id 注:空节点-->
<datagramId>127</datagramId>
<!--priority 注:空节点-->
<priority>18</priority>
<!--机尾号-->
<an>B-5662</an>
<!--航班号-->
<fi>HU7782</fi>
<!--接收地址 注:空节点-->
<rcvAddress>1</rcvAddress>
<!--发送地址 注:空节点-->
<sndAddress>1</sndAddress>
<!--bepTime 注:空节点-->
<bepTime>1</bepTime>
<!--SMI 注:空节点-->
<smi>1</smi>
<!--DSP服务商 注:空节点-->
<dsp>1</dsp>
<!--地面站-->
<rgs>PEK</rgs>
<!--流水号 注:空节点-->
<msn>1</msn>
<!--报文类型,都是POS 注:空节点-->
<datagramType>1</datagramType>
<!--ICAO24位地址码-->
<icao24>7808a3</icao24>
<!--呼号-->
<callcode>CHH7782</callcode>
</head>
<data>
<!--纬度 看前面的字母“N”或“S”,格式“DDMMSS.SS”-->
<unit name="LAT">N31414709</unit>
<!--经度 看前面的字母“E”或“W”,格式“DDDMMSS.SS”-->
<unit name="LON">E118463546</unit>
<!--气压高度,单位是米-->
<unit name="ALT">396.24</unit>
<!--计算空速 单位海里每小时-->
<unit name="CAS">127.00</unit>
<!--航向 正北是0°,顺时针,0到360°-->
<unit name="VEC">58.18</unit>
<!--收到报文的UTC时间 hh24mmss-->
<unit name="UTC">072331</unit>
</data>
<msg>11</msg>
</skycenter> 127
HU7782
<?xml version="1.0"?>
<skycenter xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http
://www.w3.org/2001/XMLSchema" type="ADSBResult" source="ADSB" reality="T" rcvTim
e="2014-02-25 07:23:31">
<head>
<datagramId>127</datagramId>
<priority>18</priority>
<an>B-5662</an>
<fi>HU7782</fi>
<rcvAddress>1</rcvAddress>
<sndAddress>1</sndAddress>
<bepTime>1</bepTime>
<smi>1</smi>
<dsp>1</dsp>
<rgs>PEK</rgs>
<msn>1</msn>
<datagramType>1</datagramType>
<icao24>7808a3</icao24>
<callcode>CHH7782</callcode>
</head>
<data>
<unit name="LAT">N31414709</unit>
<unit name="LON">E118463546</unit>
<unit name="ALT">396.24</unit>
<unit name="CAS">127.00</unit>
<unit name="VEC">58.18</unit>
<unit name="UTC">072331</unit>
</data>
<msg>11</msg>
</skycenter>
出处:http://blog.csdn.net/philosophyatmath/article/details/28593153
C# XML反序列化与序列化举例:XmlSerializer的更多相关文章
- C# XML反序列化与序列化举例:XmlSerializer(转)
using System; using System.IO; using System.Xml.Serialization; namespace XStream { /// <summary&g ...
- <经验杂谈>C#/.Net中xml的Serialization序列化与DeSerializetion反序列化
1.先讲概念:.Net Framework提供了对应的System.Xml.Seriazliation.XmlSerializer负责把对象序列化到XML,和从XML中反序列化为对象.Serializ ...
- .NET(C#):觉察XML反序列化中的未知节点
原文 www.cnblogs.com/mgen/archive/2011/12/12/2284554.html 众所周知XML是可以扩展的,XML的元素可以靠名称识别而不是只按照未知识别.在 XML反 ...
- android-pull方式解析xml文件以及XML文件的序列化
android解析XML ---------------------------基础要像磐石 在android平台上可以使用SAX.DOM和自带的Pull解析器解析xml文件,本文主要介绍使用pull ...
- Xml反序列化记录
1.概述 公司项目遇到一个需要对接webservice的,webservice大部分用的都是xml来传输的,这里记录一下xml反序列化遇到的问题 2.xml工具类 xml序列化: public sta ...
- 让Visual Studio 2013为你自动生成XML反序列化的类
Visual Sutdio 2013增加了许多新功能,其中很多都直接提高了对代码编辑的便利性.如: 1. 在代码编辑界面的右侧滚动条上显示不同颜色的标签,让开发人员可以对所编辑文档的修改.查找.定位情 ...
- wp8.1 Study11:APP里文件读写和使用XML和Json序列化
一.文件读写 1.基本操作(使用FileIO API) 这个方法在上一个stduy已经学过,那么贴出来复习下,代码如下: private async void writeTextToLocalStor ...
- 自动生成XML反序列化的类
原文地址:http://www.cnblogs.com/jaxu/p/3632077.html Visual Sutdio 2013增加了许多新功能,其中很多都直接提高了对代码编辑的便利性.如: ...
- XML反序列化遇到数字型节点值为空导致反序列化异常
实体类: [XmlRoot("stream")] public class _30320DuisiFukuanQueryResponseModel : ResponseModelB ...
随机推荐
- iMX6 yocto平台QT交叉编译环境搭建
转:https://blog.csdn.net/morixinguan/article/details/79351909 . /opt/fsl-imx-fb/4.9.11-1.0.0/environm ...
- Linux挂载Windows共享目录
在windows中设置共享目录并添加权限用户 把Window系统的文件共享挂载到linux centos 目录下的方法步骤: 1.先在windows下面共享需要挂载的目录. 2.确保linux与win ...
- node做验证码
使用了ccap插件 1.安装: 通用方法:npm install ccap 2. cnst ccap= require('ccap')({ width: 128, height: 40, offset ...
- JS兼容各个浏览器的本地图片上传即时预览效果\、
在firefox\chrome\ie10等浏览器中可以使用HTML5中的内容实现图片即时预览效果,在IE10以下浏览器中使用滤镜来解决图片显示问题. HTML5中的FileReader对象主要是把文件 ...
- arguments解析
js中并没有函数重载的概念,但函数的arguments参数能帮助我们模拟重载. arguments并不是真正的数组,但拥有length(参数数目),且能通过数组下标的方式进行访问,例如argument ...
- 【转】linux驱动开发
转自:http://www.cnblogs.com/heat-man/articles/4174899.html 首先理一理驱动/内核/应用程序的一些概念,以前总没有具体的去关注过! 我们的pc直观来 ...
- Windows batch: call more than one command in a FOR loop?
https://stackoverflow.com/questions/2252979/windows-batch-call-more-than-one-command-in-a-for-loop U ...
- 美化tp5.1跳转提示
<html> <head> <meta http-equiv="Content-Type" content="text/html; char ...
- nova Flavors
$ nova help | grep flavor- flavor-access-add Add flavor access for the given tenant. flavor-access-l ...
- 智课雅思词汇---二十二、-al即是名词性后缀又是形容词后缀
智课雅思词汇---二十二.-al即是名词性后缀又是形容词后缀 一.总结 一句话总结: 后缀:-al ②[名词后缀] 1.构成抽象名词,表示行为.状况.事情 refusal 拒绝 proposal 提议 ...