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

Ò»¸öC# xml ÐòÁл¯´íÎó

Ò»¸öC# xml ÐòÁл¯´íÎó
 
Ê·¢ÏÖ³¡£º
xmlÐòÁл¯µÄÊý¾ÝÖд洢µÄ½ÚµãÊý¾ÝÊÇ
   <Module>536870912</Module>  £¨xmlÎļþÖУ©
¶ÔÓ¦µÄÀàÊôÐÔÊÇ
    public short Module { get; set; }  £¨C#ÀàÖУ©
 
ÐòÁл¯µÄ´úÂ룺
public static FMDSTimeSeriesDefinitionList Deserialize(string xml)
{
XmlSerializer serializer = new XmlSerializer(typeof(FMDSTimeSeriesDefinitionList));
/* If the XML document has been altered with unknown
nodes or attributes, handle them with the
UnknownNode and UnknownAttribute events.*/
serializer.UnknownNode += new
XmlNodeEventHandler(serializer_UnknownNode);
serializer.UnknownAttribute += new
XmlAttributeEventHandler(serializer_UnknownAttribute);
FMDSTimeSeriesDefinitionList tsList = null;
using (StringReader sr = new StringReader(xml))
{
try
{
tsList = (FMDSTimeSeriesDefinitionList)serializer.Deserialize(sr);
}
catch (Exception ex)
{
throw ex;
}
}
return tsList;
}
 
 
µ÷ÊÔʱ»áµ¯³öÒì³£ÐÅÏ¢£º
An unhandled exception of type 'System.InvalidOperationException' occurred in FMTimeSeriesDefinition.exe
Additional information: There is an error in XML document (293, 8).
ÕÒµ½xmlÎļþµÄ293ÐеÚ8ÁУº
292£º      <Module>536870912</Module>
293£º      <DurationPeriodsFlag>1</DurationPeriodsFlag>
294£º      <DecimalFlag>0</DecimalFlag>
 
ÊÇÒ»¸ö"<"±ê¼Ç·û£¬¿´²»³öÎÊÌ⣬ÔÙ¿´Ç°Ò»¸ö½Úµã£¬Í»È»·¢ÏÖ536870912 ´æÈëshortÖУ¬Êý¾ÝÒç³ö¡£
½«short¸ÄΪint£¬ÎÊÌâ½â¾ö¡£


Ïà¹ØÎĵµ£º

C# XML×¢ÊÍ

×÷Õß: J. Andrew Schafer
ÕâÆªÎÄÕ¼ÙÉèÄã¶Ô XML, XSLT, ºÍ C# ÊìϤ
ÏÂÔØÕâÆªÎÄÕµÄÔ´´úÂë: XMLC.exe (76KB)
ÒëÕß˵Ã÷£ºÕâÆªÎÄÕÂÊǺÜÔçÒÔǰ¾Í·¢±íÁË£¬ËüÌṩµÄÔ´´úÂëÊÇ»ùÓÚ VS.net ²âÊ԰棨RTM ºÍ Beta 2£©µÄ¡£
ÕªÒª
    C# ÔÊÐí¿ª·¢ÈËÔ±ÔÚÔ´´úÂëÖвåÈëXML×¢ÊÍ£¬ÕâÔÚ¶àÈËЭ×÷¿ª·¢µÄʱºòÏÔµÃÌØ±ðÓÐÓᣠ......

¶ÁдXMLÎļþ

Ô­ÎÄ:ʹÓà MSXML ·ÖÎöÆ÷´¦Àí XML Îĵµ
#include <atlbase.h>
#include <iostream>
using namespace std;
//<?xml version="1.0"?>
//<xmldata>
    //<xmlnode />
    //<xmltext>Hello, World!</xmltext>
//</xmldata>
void main ......

ÈçºÎÔÚ XML ÎļþÖÐÈ¡µÃÖ¸¶¨ÊôÐÔµÄÏà¹ØÖµ£¿

Á½ÖÖ·½·¨£º
ÆäÒ»£¬Ê¹Óà SelectNodes µÄ·½·¨£»ÒÔÏÂÀý×ÓΪʹÓô˷½·¨µÄ´¦Àí¡£
Æä¶þ£¬Ê¹Óà XQuery µÄ·½·¨¡£
    ''' <summary>
    ''' ´Ó XML ÎļþÖÐÈ¡µÃ¶ÔÓ¦ID µÄÓïÑÔÖµ
    ''' </summary>
    ''' <param name="textID">ÊäÈëµÄID< ......

xml dom

XML DOM
¡¡¡¡XML DOM ¶¨ÒåÁË·ÃÎʺʹ¦Àí XML ÎĵµµÄ±ê×¼·½·¨¡£
¡¡¡¡XML DOM ÊÇ XML Document Object Model µÄËõд£¬¼´ XML Îĵµ¶ÔÏóÄ£ÐÍ¡£
¡¡¡¡Ò»¡¢DOM ¼ò½é
¡¡¡¡Ê²Ã´ÊÇ DOM£¿
¡¡¡¡DOM ÊÇ W3C£¨ÍòÎ¬ÍøÁªÃË£© µÄÍÆ¼ö±ê×¼¡£
¡¡¡¡DOM ¶¨ÒåÁË·ÃÎÊÖîÈç XML ºÍ XHTML ÎĵµµÄ±ê×¼¡£
¡¡¡¡“W3C Îĵµ¶ÔÏóÄ£ÐÍ£¨DOM£©ÊÇÒ»¸ ......

C#¶ÁдxmlÎļþ

ÒÑÖªÓÐÒ»¸öXMLÎļþ£¨bookstore.xml£©ÈçÏ£º
<?xml version="1.0" encoding="gb2312"?>
<bookstore>
  <book genre="fantasy" ISBN="2-3631-4">
    <title>Oberon's Legacy</title>
    <author>Corets, Eva</author>
  &nb ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ