.NETÐÞ¸ÄxmlÎļþ
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using i_salesDAL;
using i_salesModels;
using i_salesBLL;
using MySql.Data.MySqlClient;
using System.Xml;
public partial class kf_total : System.Web.UI.Page
{
private XmlDocument xmlDoc;
public int gold
{
get { return V_companyManager.GetGoldNum(); }
}
public int silver
{
get { return V_companyManager.GetSilverNum(); }
}
public int AA
{
get { return V_companyManager.GetAANum(); }
}
public int B
{
get { return V_companyManager.GetBNum(); }
}
public int C
{
get { return V_companyManager.GetCNum(); }
}
public int D
{
get { return V_companyManager.GetDNum(); }
}
protected void Page_Load(object sender, EventArgs e)
{
UpdateElement();
lblcount.Text = "¹²ÓÐÊý¾Ý:"+(gold+silver).ToString()+"Ìõ";
}
//load xml fileÁ¬½Óxml
private void LoadXml()
{
xmlDoc = new XmlDocument();
xmlDoc.Load(Server.MapPath("pie.xml"));
}
//ÐÞ¸Äxml½ÚµãÀïÊôÐÔÖµ
private void UpdateElement()
{
LoadXml();
XmlNodeList nodeList = xmlDoc.SelectSingleNode("pieData").ChildNodes;//»ñÈ¡pieData½ÚµãµÄËùÓÐ×Ó½Úµã
foreach (XmlNode xn in nodeList)//±éÀúËùÓÐ×Ó½Úµã
{
XmlElement xe = (XmlElement)xn;//½«×Ó½ÚµãÀàÐÍת»»ÎªXmlElementÀàÐÍ
//gold
if (xe.GetAttribute("color") == "FFFF00")//Èç¹ûcolorÊôÐÔֵΪ“gold”
{
//xe.SetAttribute("color", "");
//Èç¹ûÏÂÃæÓÐ×Ó½ÚµãÔÚÏÂ×ß
XmlNodeList nls = xe.ChildNo
Ïà¹ØÎĵµ£º
ʹÓÃXMLList¶ÁÈ¡XMLÊý¾Ý
¡¡¡¡XML¶ÔÏóÌṩÁËÒ»¸ö·µ»ØXMLListÀàÐ͵ķ½·¨elements()£¬¼È·µ»ØËùÓÐXML¶ÔÏóµÄ×ÓÔªËؽڵ㣬ËæºóÎÒÃÇ¿ÉÒÔͨ¹ýfor eachÓï¾äÑ»·Ôò¿É·ÃÎʵ½Õû¸öXMLÊý¾ÝÄÚÈÝ¡£ÒÔÉÏÃæ´´½¨ÄÚ²¿XMLÎĵµµÄXMLÊý¾ÝΪÀý£¬Ïêϸ¼ûÈçÏ´úÂë¿é£º
varlist:XMLList=pXml.elements();
foreach(varelement:XMLinlist)
{
¡¡¡¡// ......
<?xml version="1.0" encoding="UTF-8" ?> <!DOCTYPE hibernate-configuration (View Source for full doctype...)>
- <!-- Generated by MyEclipse Hibernate Tools.
--> - <!-- ÒÔÉϼ¸ÐÐËùÓеÄhibernate.cfg.xml¶¼Ïàͬ
--> [url=file:///C:/Documents%20and%20Settings/ ......
Ò».Éú³Édocument¶ÔÏó¡£
import org.jdom.*;
import org.jdom.input.SAXBuilder;
public class ReportDocUtil {
public ReportDocUtil() {
}
/**
* <p>Description:covert xml file to Document</p>
* @param url ¸ñʽxmlÎļþµÄ´æ·ÅµÄÏà¶Ô·¾¶
& ......
XMLÎļþµÄ½âÎö££libxml¿âº¯Êý½âÊÍ
ÕªÒª
LibxmlÊÇÒ»¸öÓÐÃâ·ÑÐí¿ÉµÄÓÃÓÚ´¦ÀíXML¡¢¿ÉÒÔÇáËÉ¿çÔ½¶à¸öƽ̨µÄCÓïÑÔ¿â¡£Õâ¸öÖ¸ÄÏÌṩËüµÄ»ù±¾º¯ÊýµÄÀý×Ó¡£
Ð÷ÂÛ
Libxml ÊÇÒ»¸öʵÏÖ¶Á¡¢´´½¨¼°²Ù×ÝXMLÊý¾Ý¹¦ÄܵÄCÓïÑÔ¿â¡£Õâ¸öÖ¸ÄÏÌṩÀý×Ó´úÂë²¢¸ø³öËü»ù±¾¹¦ÄܵĽâÊÍ¡£ÔÚÕâ¸öÏîÄ¿µÄÖ÷Ò³ÉÏÓÐLibxml¼°¸ü¶à¹ØÓÚËü¿ÉÓõÄ×ÊÁÏ¡ ......
ÂòÁËÕ½Õù»úÆ÷2£¬Ð´Íê½Ì³Ì×¼±¸É±µ½Ë¯¾õ£¬ÏÖÔÚÏÈ×öµÚÒ»²½£¬Ð´½Ì³Ì¡£AIRµÄÎļþ²Ù×÷²»ÄÑ£¬¿´Íê½Ì³ÌÓ¦¸Ã¿ÉÒÔÂú×ãÄã¶ÔÎļþµÄËùÓлù±¾²Ù×÷¡£Õâƪ½Ì³ÌÖ÷ÒªÒÔʵ¼Ê²Ù×÷ÖÐÓöµ½µÄÇé¿öÀ´½²½â
ÎÒÃÇÏëÏëÎļþ²Ù×÷¶¼»áÓÐʲôÄÚÈÝ£¬ÎÞ·ÇÊÇ´´½¨£¬Ð޸ģ¬É¾³ý£¬Òƶ¯£¬¿½±´¡£ÔÚÕâ¸ö¹ý³ÌÖÐÎÒÃÇ»áÉæ¼°µ½Ò»Ð©ÖܱߵIJÙ×÷£¬±ÈÈçÎļþ¼Ð£¬ÎļþÑ¡ÔñÆ÷£¬ÎÄ ......