Ò»¸ö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£¬ÎÊÌâ½â¾ö¡£
Ïà¹ØÎĵµ£º
ÔÎÄ:ʹÓà MSXML ·ÖÎöÆ÷´¦Àí XML Îĵµ
#include <atlbase.h>
#include <iostream>
using namespace std;
//<?xml version="1.0"?>
//<xmldata>
//<xmlnode />
//<xmltext>Hello, World!</xmltext>
//</xmldata>
void main ......
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. ......
ת×Ô: http://www.cnblogs.com/rentj1/archive/2009/02/23/1396187.html
1 н¨Àà¿âMyTestDLL
2 ÓÒ»÷ÏîÄ¿“MyTestDLL”-¡·ÊôÐÔ-¡·Éú³É-¡·¹´Ñ¡“ΪCOM»¥²Ù×÷×¢²á”
3 ´ò¿ª AssemblyInfo.cs Îļþ ÐÞ¸Ä [assembly: ComVisible(true)]
4 ´ò¿ªVisual Sutdio 2008 µÄÃüÁîÌáʾÐй¤¾ßÊäÈëguidgen.exe Ñ¡ÔñD ......
C#Á¬½ÓSQL ServerµÄSqlConnectionµÄ×Ö·û´®£¬Ðí¶à¶¼ÊDz»ÄÜÁ¬½ÓµÄ¡£ÏÖÔÚ¸øÒ»¸öÄÜÁ¬½ÓµÄ£º
using System.Data.SqlClient;
public class sqlServerConnection {
//
public static void Main() {
//ÏÂÃæ¾ÍÊDZê×¼µÄÁ¬½Ó£¬×¢ÒâSERVERÊÇÎҵļÆËã»úÃû¡£SQLEXPRESSÊÇÊý¾Ý¿âʵÀý¡£SSPI±íʾʹÓÃWindowsµÇ½µÄÕÊ»§¡£masterÊÇÒªÁ¬½Óµ ......