Ò׽ؽØÍ¼Èí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö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


Ïà¹ØÎĵµ£º

ÈçºÎÔÚVC»·¾³Ï±àд³ÌÐò¶ÁÈ¡XMLÎļþ

ÈçºÎÔÚVC»·¾³Ï±àд³ÌÐò¶ÁÈ¡XMLÎļþ?ÇåÌṩԴ´úÂë.лл.
#import <msxml3.dll> named_guids  //µ¼È붯̬¿â£¬×°ÁËIE5¾ÍÓÐ
using namespace MSXML2;     //ÒýÓÃÃüÃû¿Õ¼ä£¬Ò»°ã¿ÉÒÔ°ÑÃüÃû¿Õ¼äÀí½â³ÉÀàºÍ½Ó¿ÚµÄ¼¯ºÏ£¬ºÇºÇ£¬¶Ô²»¶ÔÎÒÒ²²»ÖªµÀÁË
#include <vector>
using na ......

asp /asp.net c#Á´½ÓOrcale Êý¾Ý¿âµÄ·½°¸

1£¬ÔÚweb·þÎñÆ÷Éϰ²×°OracleÊý¾Ý¿â¿Í»§¶Ë£¬ÕâÊÇÁ¬½ÓOracleÊý¾Ý¿âµÄ»ù´¡£¨µ«£¬²»Ò»¶¨ÊDZØÐëµÄ£©¡£
2£¬ÔÚ¿Í»§¶ËµÄNet Manager ÖнøÐÐÅäÖ÷þÎñµÄÃû³Æ£¬ÅäÖÃÈçͼ£¨ÕâÒ»µã·Ç³£µÄÖØÒªÒÔºóµÄÁ´½ÓÈ«¶¼ÔÚÕâ¸ö·þÎñÃû³ÆµÄ»ù´¡ÉϽøÐеģ©
3£¬ASPÁ´½Ó·þÎñµÄÁ´½Ó×Ö·û´®ºÍ·½·¨ÈçÏ£º
<%
connstr= "Provider=MSDAORA.1;Password=***; ......

½«Í¼Æ¬µÈÎļþ±£´æµ½sqliteÖУ¨c#£©

 SqLite.netµÄdllΪSystem.Data.SQLite.dll£¬ÕâÖÖdll·ÖΪ32λ¡¢64λºÍÊÊÓÃÓÚcompactframeworkÈýÖÖ£¬ÔÚÒýÓÃʱҪעÒ⣬ѡÔñÕýÈ·µÄdll¡£
½«Òª±£´æÍ¼Æ¬µÄ×Ö¶ÎÀàÐÍÉèΪblob¡£´úÂëÈçÏ£º
private void savePicture£¨£©
{
using (SQLiteConnection cnn = new SQLiteConnection(dbPath))
......

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¡£ÎÒ²»ÖªµÀÕâÖÖ¼¼ÊõÈ·ÇÐµÄÆðÔ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ