Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C#ÐòÁл¯xmlµÄÍêÕûÀý×Ó

C#ÐòÁл¯xml
¹Ø¼ü²½Ö裺
XmlSerializer xSerializer = new XmlSerializer(typeof(MyObj));
StringWriter sWriter = new StringWriter(CultureInfo.InvariantCulture);
XmlTextWriter xTextWriter = new XmlTextWriter(sWriter);
XmlDocument xmlDoc = new XmlDocument();
xSerializer.Serialize(xTextWriter, myObj);
xmlDoc.LoadXml(sWriter.ToString()); 
ÐèҪ˵Ã÷µÄÊÇ£¬Èç¹ûÒªÐòÁл¯µÄobjectËùÔÚµÄÀàÀïÓдø²ÎÊýµÄ¹¹Ô캯Êý£¬»¹±ØÐëÌí¼ÓÒ»¸öÎÞ²ÎÊýµÄ¹¹Ô캯Êý£¬·ñÔò£¬»á±¨object cannot be serialized because it does not have a parameterless constructorµÄ´íÎó¡£ÏÂÃæÊÇÒ»¸öÍêÕûµÄʵÀý£¬½ö¹©²Î¿¼¡£
using System;
using System.Xml;
using System.Xml.Serialization;
using System.IO;
/* The XmlRootAttribute allows you to set an alternate name
(PurchaseOrder) of the XML element, the element namespace; by
default, the XmlSerializer uses the class name. The attribute
also allows you to set the XML namespace for the element. Lastly,
the attribute sets the IsNullable property, which specifies whether
the xsi:null attribute appears if the class instance is set to
a null reference. */
[XmlRootAttribute("PurchaseOrder", Namespace="http://www.cpandl.com",
IsNullable = false)]
public class PurchaseOrder
{
public Address ShipTo;
public string OrderDate;
/* The XmlArrayAttribute changes the XML element name
from the default of "OrderedItems" to "Items". */
[XmlArrayAttribute("Items")]
public OrderedItem[] OrderedItems;
public decimal SubTotal;
public decimal ShipCost;
public decimal TotalCost;
}
public class Address
{
/* The XmlAttribute instructs the XmlSerializer to serialize the Name
field as an XML attribute instead of an XML element (the default
behavior). */
[XmlAttribute]
public string Name;
public string Line1;
/* Setting the IsNull


Ïà¹ØÎĵµ£º

XML Schema£¨Ó¦ÓÃÉè¼Æ£©

     XML SchemaÖ÷ÒªÓÃÀ´Éè¼ÆXMLÎĵµµÄ½á¹¹£¬×¢Òâ²»ÊǸñʽ¡£ÓÐÈËÎÊÔõô²»ÊǸñʽ£¿¸ñʽ¸ú½á¹¹Ê²Ã´Çø±ð£¿ÎÒÏë¸ã¿ª·¢µÄÈ˶¼¶Ô´úÂë½øÐиñʽ»¯¹ý£¬Ò²¾ÍÊÇËõ½ø¡¢×ÖÌåµÈµÈ£»¶øÎÒÃÇдµÄ³ÌÐòʵ¼ÊÉÏÒ²ÊǶ¨ÒåÒ»Öֽṹ£¬Ëü²»»áÒòΪÄãÊÇ·ñËõ½ø¡¢²ÉÓò»Í¬µÄ×ÖÌå¾ÍÓÐËù¸Ä±ä°É£¿ºÜ¶àÈËÄÄÁ˲»·ÖÐеÄxmlÎĵµËµÓÃVSµÄ¹¤¾ß¸ ......

MD5¼ÓÃܵÄÒ»°ã·½·¨(ASP.NET / C#2005)

  /// <summary>
/// ·½·¨Ò»:ͨ¹ýʹÓà new ÔËËã·û´´½¨¶ÔÏó
/// </summary>
/// <param name="strSource">ÐèÒª¼ÓÃܵÄÃ÷ÎÄ</param>
/// <returns>·µ»Ø16λ¼ÓÃܽá¹û£¬¸Ã½á¹ûÈ¡32λ¼ÓÃܽá¹ûµÄµÚ9λµ½25λ</returns>
public string Get_MD5_Method1(strin ......

XML XQuery

--XQuery »ùÓÚÏÖÓÐµÄ XPath ²éѯÓïÑÔ£¬²¢Ö§³Ö¸üºÃµÄµü´ú¡¢¸üºÃµÄÅÅÐò½á¹ûÒÔ¼°¹¹Ôì±ØÐèµÄ XML µÄ¹¦ÄÜ¡£
--1.ÉùÃ÷Ò»¸ö xml ÀàÐ͵ıäÁ¿£¬È»ºóʹÓà xml Êý¾ÝÀàÐ굀 query() ·½·¨À´²éѯ´Ë±äÁ¿
DECLARE @x xml
SET @x = '<ROOT><a>111</a></ROOT>'
SELECT @x.query('/ROOT/a')
--²éÕÒÊôÐÔaid=20µÄa½ ......

ÒÔXMLÎļþ´æ´¢ÅäÖÃÊý¾ÝµÄ¼¼ÊõʵÏÖ£¬c++

Ò»°ãÐÂÊÖͨ³£Ö»ÊÇʹÓÃÀàËƵÄXerces,
TinyXMLÖ®ÀàµÄXML½âÎöxml£¬ÕâÖÖ·½Ê½Êµ¼ÊÉϺÜÀË·Ñʱ¼ä£¬×Ô¼º±àдºÜ¶à´úÂëÒ²ÈÝÒ׳ö´í¡£ÒòΪ£¬ËûÃǾ­³£ÒªÐ´Ò»¸öXML¶ÔÏóEntityµÄÀ࣬²¢¸½×ÅÒ»¶Ñ¶ÔÏó½âÎöµÄcode¡£¹¤×÷Á¿±È½Ï´ó¡£Ê¹ÓÃXML
Schema¹¤¾ß£¬XSDÉè¼Æ¹¤¾ß£¬È»ºóͨ¹ý¹¤¾ßÉú³ÉEntityClassºÍPaser
class¡£ÎÒ²»ÖªµÀÕâÖÖ¼¼ÊõÈ·ÇеÄÆðÔ ......

C#.NET·ÀÖ¹SQL×¢Èëʽ¹¥»÷

1  ·ÀÖ¹sql×¢Èëʽ¹¥»÷(¿ÉÓÃÓÚUI²ã¿ØÖÆ£© #region  ·ÀÖ¹sql×¢Èëʽ¹¥»÷(¿ÉÓÃÓÚUI²ã¿ØÖÆ£©
  2 
  3   /**/ /// 
  4  ///  ÅжÏ×Ö·û´®ÖÐÊÇ·ñÓÐSQL¹¥»÷´úÂë
  5  /// 
  6  ///  ´«ÈëÓû§Ìá½»Êý¾Ý
  7  ///  ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ