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

import java.io.StringWriter;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
import org.apache.xerces.dom.DocumentImpl;
import org.apache.xerces.dom.DOMImplementationImpl;
import org.apache.xml.serialize.OutputFormat;
import org.apache.xml.serialize.Serializer;
import org.apache.xml. ......

xml dom

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

XML over TCP

Èç¹ûÒªÍêÕûµÄÖ§³ÖXML over TCP£¬Ö»ÓÐÁ½ÖÖ°ì·¨£º
1£¬¼ÓÒ»¸öheaderÈ¥±êÃ÷Êý¾ÝµÄ³¤¶È
2£¬¼ÓÒ»¸ödelimiterÈ¥±êÃ÷Êý¾ÝµÄ½áÊø
ÕâÁ½ÖÖ·½·¨¶¼²»¹»ÓÅÑÅ¡£ÎÒÃDz»ÐèÒªÒ»¸öͨÓõķ½·¨£¬ÎÒÃÇÖ»ÒªÒ»¸ö×îÊʺÏÎÒÃǵķ½·¨¡£
ͨ³££¬ÎÒÃÇÄܹ»×Ô¶¨ÒåÊý¾ÝµÄ¸ñʽ£¬¶øÇÒÎÒÃÇͨ³£Ò»ÌõÏûÏ¢Ö»ÓÐÒ»¸öroot node£¬ÄÇôÎÒÃÇ¿ÉÒÔÊÔÊÔÏÂÃæµÄº¯Êý£º
//re ......

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ºÅ