C#ÖжÔXML½Úµã½øÐÐÔöɾ¸Ä²é
ºÅ³ÆxmlhelperµÄÒ»¸öÀà
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml;
namespace WebApplication2
{
/// <summary>
/// XMLHelper XMLÎĵµ²Ù×÷¹ÜÀíÆ÷
/// </summary>
public class XMLHelper
{
public XMLHelper()
{
//
// TODO: ÔÚ´Ë´¦Ìí¼Ó¹¹Ô캯ÊýÂß¼
//
}
#region XMLÎĵµ½Úµã²éѯºÍ¶ÁÈ¡
/// <summary>
/// Ñ¡ÔñÆ¥ÅäXPath±í´ïʽµÄµÚÒ»¸ö½ÚµãXmlNode.
/// </summary>
/// <param name="xmlFileName">XMLÎĵµÍêÈ«ÎļþÃû(°üº¬ÎïÀí·¾¶)</param>
/// <param name="xpath">ҪƥÅäµÄXPath±í´ïʽ(ÀýÈç:"//½ÚµãÃû//×Ó½ÚµãÃû")</param>
/// <returns>·µ»ØXmlNode</returns>
public static XmlNode GetXmlNodeByXpath(string xmlFileName, string xpath)
{
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(xmlFileName); //¼ÓÔØXMLÎĵµ
XmlNode xmlNode = xmlDoc.SelectSingleNode(xpath);
return xmlNode;
}
catch (Exception ex)
{
return null;
//throw ex; //ÕâÀï¿ÉÒÔ¶¨ÒåÄã×Ô¼ºµÄÒì³£´¦Àí
}
}
/// <summary>
/// Ñ¡ÔñÆ¥ÅäXPath±í´ïʽµÄ½ÚµãÁбíXmlNodeList.
/// </summary>
/// <param name="xmlFileName">XMLÎĵµÍêÈ«ÎļþÃû(°üº¬ÎïÀí·¾¶)</param>
/// <param name="xpath">ҪƥÅäµÄXPath±í´ïʽ(ÀýÈç:"//½ÚµãÃû//×Ó½ÚµãÃû")</param>
/// <returns>·µ»ØXmlNodeList</returns>
public static XmlNodeList GetXmlNodeListByXpath(string xmlFileName, string xpath)
{
XmlDocument xmlDoc = new XmlDocument();
try
{
xmlDoc.Load(xmlFileName); //¼ÓÔØXMLÎĵµ
XmlNodeList xmlNodeList = xmlDoc.SelectNodes(xpath
Ïà¹ØÎĵµ£º
XML ÃüÃû¿Õ¼äÌṩÁËÒ»ÖÖ±ÜÃâÔªËØÃüÃû³åÍ»µÄ·½·¨¡£
ÃüÃû¿Õ¼äÊôÐÔÒ»°ã·ÅÖÃÔÚÔªËØµÄ¿ªÊ¼±ê¼Ç´¦£¬ÆäʹÓÃÓï·¨ÈçÏÂËùʾ:
xmlns:namespace-prefix="namespace"£¬
ÀýÈ磺xmlns:f="http://www.w3schools.com/furniture"
W3C ÃüÃû¹æ·¶ÉùÃ÷ÃüÃû¿Õ¼ä±¾Éí¾ÍÊÇÒ»¸öͳһ×ÊÔ´±êʾ·û£¬Uniform Resource Identifier (URI)¡£
asp.net¶ÁÈ¡X ......
³£³£ÔÚÍøÉÏ¿´µ½Ò»Ð©ºÜµÄFLASHЧ¹û¿ÉÊÇÏÂÏÂÀ´ºó²Å·¢ÏÖÖÐÎIJ»Ö§³Ö»ò¶¼ÖÐÎÄÎÞ·¨ÏÔʾµÄÎÊÌ⣬ËùÒÔÔÚÍøÉÏÕÒÁ˺ܶà×ÊÁÏÖÕÓÚÕÒµ½ÁËÒ»¸ö¼òµ¥µÄ·½·¨À´½â¾öÕâ¸öÎÊÌ⣬ÔÚÕâÀïÓë´ó¼Ò·ÖÏíһϡ£
µãÄÏǶÈë°´Å¥£¬°´ÏÂctrlÑ¡Öдóд,Сд,Êý×Ö,±êµã·ûºÅ,ÖÐÎÄ(È«²¿)ºó,È·¶¨!!
ÕâÑù¾ÍOKÁË¡£ ......
ǰһ¶Îʱ¼äÊÔ×ÅÓÃÕâÈýÖÖÓïÑÔ¼òµ¥µÄдÁ˹ØÓÚÎļþ¿½±´µÄ³ÌÐò£¬·¢ÏÖc#ºÍpythonµÄapi¾ªÈ˵ÄÏàËÆ£¬¶ÔÓÚÎļþµÄ²Ù×÷ÕâÁ½ÖÖÓïÑԷdz£µÄ·½±ã¡£¶¼Ã»ÓмÓÒì³£µÄ´¦Àí
C#Ô´´úÂ룺
public static void CopyFile(string source, string destination)
& ......
Óà PHP ¶ÁÈ¡ºÍ±àд XML DOM
ʹÓà DOM ¿â¡¢SAX ½âÎöÆ÷ºÍÕýÔò±í´ïʽ
ÎĵµÑ¡Ïî
´òÓ¡±¾Ò³
½«´ËÒ³×÷Ϊµç×ÓÓʼþ·¢ËÍ
¼¶±ð£º Öм¶
Jack Herrington (jack_d_herrington@codegeneration.net), ¸ß¼¶Èí¼þ¹¤³Ìʦ, "Code Generation Network"
2006 Äê 2 ÔÂ 06 ÈÕ
ÓÐÐí¶à¼¼Êõ¿ÉÓÃÓÚÓà PHP ¶ÁÈ¡ºÍ±àд XML¡£±¾ÎÄÌṩÁËÈýÖÖ ......
½øÈëMyEclipse6.XÏÂ
Ð޸ģºeclipse.ini Îļþ
-Duser.language=en
¸Ä³É
-Duser.language=zh
µ¯³öÌáʾ£ºCtrl+"/"
dtd ÃüÃû¿Õ¼äµÄÌáʾÐÅÏ¢
window-->Preference-->xml-->XML Catalog-->add
Location :sql-map-2.dtd
key type :pubic ID
key:-//ibatis.apache.org//DTD SQL Map 2.0//EN (XMLÎļþÃüÃû¿Õ¼ ......