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


Ïà¹ØÎĵµ£º

C#Á¬½ÓmysqlÊý¾Ý¿â

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using MySql ......

ÏîÄ¿¹¤×÷×ܽá XML Schema£¨±ê×¼½â¶Á£©

        ×î½üÔÚ×öNetConfÏà¹Ø¿ª·¢¹¤×÷£¬ÆäÖкÜÖØÒªµÄÒ»¿éÊÇXML½âÎö£¬ÏîĿҲÐèÒªÖ§³ÖSchema£¬Òò´Ëǰ¶Îʱ¼äÕûÀíÁËSchemaµÄÁ½²¿·Ö±ê×¼£¬Ö»²»¹ýÕûÀíÎĵµÊÇÎÞ·¨´ø³öÀ´µÄ£¬ËùÒÔ¾ÍÔڴ˰ÑSchemaÏà¹ØµÄÄÚÈݼòµ¥½éÉÜÆä±ê×¼Ö®ºó£¬ÒÔÈçºÎÓ¦Óõķ½Ê½¼Ç¼ÏÂÀ´£¬ÒÔ¹©ÒÔºóʹÓÃʱ²Î¿¼¡£ÔÚºóÐøµÄ²¿·Ö£¬ÎÒ» ......

´Óxml¶ÁÈ¡ÓÎÏ·ÅäÖÃÐÅÏ¢»ò±£´æ

 /*
* Ö÷Òª×÷ÓÃ;
* ´Óxml¶ÁÈ¡ÓÎÏ·ÅäÖÃÐÅÏ¢»ò±£´æ
*/
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Reflection;
namespace Game
{
class Config
{
Ke ......

SQL XML DELETE

--A. ´Ó´æ´¢ÔÚ·ÇÀàÐÍ»¯µÄ xml ±äÁ¿ÖеÄÎĵµÖÐɾ³ý½Úµã
DECLARE @myDoc xml
SET @myDoc = '<?Instructions for=TheWC.exe ?>
<Root>
 <!-- instructions for the 1st work center -->
<Location LocationID="10" LaborHours="1.1" MachineHours=".2" >
 Some text 1
 <st ......

×÷µÄÒ»¸ö¼òµ¥µÄXML¹¦ÄÜ(1)

//ÅжϸÃxmlÎĵµÊÇ·ñ´æÔÚ£¬²»´æÔÚÔò´´½¨
  if (!File.Exists(Constants.SYS_CONFIGURE_URL + @"\SaveAccount.xml"))
                              &nbs ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ