¸ü¿ìµÄдXMLµÄ·½·¨
ÎÒдµÄµÚÒ»¸ö³ÌÐòÖÐдXMLµÄ´úÂëÖ´ÐÐËÙ¶ÈÓÐЩÎÊÌ⣬¸ÄÁËһϣ¬ÏÖÔÚÓÐËù¸ÄÉÆ¡£
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics;
using System.Linq;
using System.ServiceProcess;
using System.Text;
using System.Data.SqlClient;
using System.Xml;
using System.IO;
using System.Collections;
using System.Threading;
namespace StockUpService
{
public partial class StockUpService : ServiceBase
{
public StockUpService()
{
InitializeComponent();
if (!System.Diagnostics.EventLog.SourceExists("MySource"))
{
System.Diagnostics.EventLog.CreateEventSource(
"MySource", "MyNewLog");
}
eventLog1.Source = "MySource";
eventLog1.Log = "MyNewLog";
}
protected override void OnStart(string[] args)
{
System.Timers.Timer t = new System.Timers.Timer(20000); //ʵÀý»¯TimerÀ࣬ÉèÖüä¸ôʱ¼äΪ20000ºÁÃë|20ÃëÖ´ÐÐÒ»´Î£»
t.Elapsed += new System.Timers.ElapsedEventHandler(runservice); //µ½´ïʱ¼äµÄʱºòÖ´ÐÐʼþ£»
t.AutoReset = true; //ÉèÖÃÊÇÖ´ÐÐÒ»´Î£¨false£©»¹ÊÇÒ»Ö±Ö´ÐÐ(true)£»
t.Enabled = true; //ÊÇ·ñÖ´ÐÐSystem.Timers.Timer.Elapsedʼþ£»
}
public void runservice(object source, System.Timers.ElapsedEventArgs e)
{
string t;
t = System.DateTime.Now.Hour.ToString()+System.DateTime.Now.Minute.ToString();
if (t == "933")
{
readXml();
}
}
public static void readXml()
{
string classId="";
string filialeId;
string startTime;
string endTime;
string companyType;
string xmlChildNodes = "";
Ïà¹ØÎĵµ£º
using System;
using System.Data;
using System.Drawing;
using System.Globalization;
using System.IO;
using System.Windows.Forms;
using Excel = Microsoft.Office.Interop.Excel;
// Ìí¼ÓÒýÓÃ -> .NET -> Microsoft.Office.Interop.Excel(2003->11.0, 2007->12.0)
namespace WinFormTable
{
& ......
Ò»£ºSpringÖеļ¸ÖÖÈÝÆ÷¶¼Ö§³ÖʹÓÃxml×°Åäbean£¬°üÀ¨£º
XmlBeanFactory £¬
ClassPathXmlApplicationContext £¬
FileSystemXmlApplicationContext £¬
XmlWebApplicationContext
¼ÓÔØÕâЩÈÝÆ÷µÄÅäÖÃÎļþµÄxmlÓÐһϼ¸ÖÖ³£¼ûµ ......
Á½ÖÖ·½·¨£º
ÆäÒ»£¬Ê¹Óà SelectNodes µÄ·½·¨£»ÒÔÏÂÀý×ÓΪʹÓô˷½·¨µÄ´¦Àí¡£
Æä¶þ£¬Ê¹Óà XQuery µÄ·½·¨¡£
''' <summary>
''' ´Ó XML ÎļþÖÐÈ¡µÃ¶ÔÓ¦ID µÄÓïÑÔÖµ
''' </summary>
''' <param name="textID">ÊäÈëµÄID< ......
XMLÊÇÒ»ÏîÈÈÃŵļ¼Êõ¡£ËüÖ®ËùÒÔÄܹ»ÒýÆðÈËÃǵÄÐËȤ£¬Ò»¸öÖ÷ÒªµÄÔÒòÔÚÓÚËüÊ®·ÖµÄ¼òµ¥£¬ÈËÃÇ¿ÉÒÔºÜÈÝÒ×µØÀí½âºÍʹÓÃËü¡£Ã¿Ò»¸ö³ÌÐòÔ±¶¼ÄÜÇáÒ׵ؿ´¶®Ò»¸öXMLÎļþ£¬Àí½âËü°üº¬µÄÄÚÈÝ¡£
.NETÖаüº¬Á˺ܶàÖ§³ÖXMLµÄÀ࣬ÕâЩÀàʹµÃ³ÌÐòԱʹÓÃXML±à³Ì¾ÍÈçͬÀí½â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 ......