ÔõÑù¸ù¾ÝxsdÎļþÉú³Éxml£¿
Ïë¸ù¾ÝxsdÉú³ÉxmlÎļþ£¬¿´ÁËÏÂÃæÕâÆªÎÄÕ»¹ÊDz»¶®£º
http://www.wzsky.net/html/Program/net/74859.html
ÆäÖеÄAddElementÓ¦¸ÃÊÇÉú³ÉxmlµÄº¯Êý£¬µ«ÊÇÄǼ¸¸ö²ÎÊýÊÇÔõô¸³ÖµµÄ°¡£¿
XmlSchemaChoice£¬XmlSchemaSequence£¬XmlSchemaElementÒ²²»ÖªµÀÔõôÓá£
ÎÒ°ÑÒ»¸öxsdÎļþ¶ÁÈëµ½xmlschemad¶ÔÏóÖУ¬ÓÃgettypeº¯Êý£¬È´µÃ²»³öÉÏÃæÕâ3¸öÀà
Ï´μǵÃÖ±½ÓÉÏ´úÂ룡
ºÃ°É£¬ÏÂÃæÊÇ´úÂ룺
C# code:
public static void AddElement(XmlSchemaObject sourceXsd, Hashtable titles, XmlDocument sourceXml, XmlNode sourceNd, string[] values)
{
if (sourceXsd.GetType() == typeof(XmlSchemaChoice))
{
XmlSchemaChoice choice = sourceXsd as XmlSchemaChoice;
decimal min = choice.MinOccurs;
foreach (XmlSchemaObject item in choice.Items)
{
if (item.GetType() == typeof(XmlSchemaElement))
{
string name = ((XmlSchemaElement)item).Name;
if (titles.ContainsKey(name))
{
XmlElement element = sourceXml.CreateElement(name);
// element.InnerText = ((Excel.Range)st.Cells[rowIndex, (int)titles[name]]).Value2.ToString();
element.InnerText = values[(int)titles[name]];
sourceNd.AppendChild(element);
}
Ïà¹ØÎÊ´ð£º
txt ºÍXML ¸ñʽÏàÓ¦
²»½èÖúDataSet
µ¼Èë¶ÁÈ¡TXTÎļþ
È»ºóÖ±½ÓдÈëXML(ͬһÎļþ,²»Í¬Êý¾Ý,µÝÔöÔÊý¾ÝûÓб»¸²¸ÇÇé¿öÏÂÔö¼ÓÊý¾Ý.)
½Ì¸öÒªµã»ò×îºÃÊÇÓиö´úÂëÌáʾµÄ
¹ý·ºÃºº °ï¸öæÈö^^
²»»á£¬°ïÂ¥Ö÷ ......
<?xml version="1.0" encoding="UTF-8" ?>
<root>
<video>
<device deviceid="\\?\usb#vid_0c45&pid_613b#5&2d0620de& ......
ΪʲôÎҵijÌÐòµ÷ÓÃXMLÅäÖÃÎļþÖеİ¢À²®ÎÄÏÔʾ²»³öÀ´£¿ÆäËûµÄÓïÖÖ¶¼¿ÉÒÔ£¬ÈçÖÐÎÄ£¬Ó¢ÎÄ£¬µÂÎͼ¿É¡£
ÎÒ½«XMLµÄ±àÂë¸ÄΪutf-8ºÍunicodeµÄµ½µÃ½á¹û¶¼Ò»Ñù.
°¢À²®ÎĵÄ×Ö¿âÄãÓÐô£¿
ÓÐ,ÎÒµÄEXEÊÇ·ÅÔÚpc»úÉÏÖ´Ðе ......