¸ü¿ìµÄд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 = "";
Ïà¹ØÎĵµ£º
Ò»£ºSpringÖеļ¸ÖÖÈÝÆ÷¶¼Ö§³ÖʹÓÃxml×°Åäbean£¬°üÀ¨£º
XmlBeanFactory £¬
ClassPathXmlApplicationContext £¬
FileSystemXmlApplicationContext £¬
XmlWebApplicationContext
¼ÓÔØÕâЩÈÝÆ÷µÄÅäÖÃÎļþµÄxmlÓÐһϼ¸ÖÖ³£¼ûµ ......
JavaScript½âÎö¶ÁÈ¡XMLÎļþ£¬Ö÷Òª¾ÍÊǼÓÔØ²¢½âÎöXMLÎļþ£¬È»ºó¾Í¿ÉÒÔ²âÊÔ½âÎöµÄXMLÎļþµÄÄÚÈÝ£¬´òÓ¡Êä³öÀ´¡£
±àдÁËÒ»¸öJavaScriptµÄÀàÀ´ÊµÏÖ¶Áȡһ¸öXMLÎļþÖеÄÊý¾Ý£¬ÊµÏÖ´úÂëÈçÏÂËùʾ£º
<mce:script type="text/javascript"><!--
/**
* @author Shirdrn
*/
function XMLDoc(){}; // ¶¨ÒåÒ»¸öXM ......
ÒÑÖªÓÐÒ»¸ö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 ......
1.¶ÁÈ¡XMLÎļþµÄÀࣺ
public class XMLUtils {
private final String DB_XML_FILE = "/XMLSetting.xml";
public Properties getPropertiesfromXML() {
URL url = XMLUtils.class.getResource(dBXMLFILE);
URI uri;
try {
uri = url.toURI();
InputSource xmlfile = new InputSource(uri.g ......