ΪUrlRewriteµÄ¶à¸öXMLÅäÖÃÎļþµÄ¼ÓÔØÌṩģºýÆ¥Åä
ΪUrlRewriteµÄ¶à¸öXMLÅäÖÃÎļþµÄ¼ÓÔØÌṩģºýÆ¥Åä
@for&ever 2009-11-27
֮ǰдÁËһƪÎÄÕ£¬¡¶ÐÞ¸ÄUrlRewriterʹÆäÓɵ¥ÅäÖÃÎļþµ½Ö§³Ö¶àÅäÖÃÎļþ¡·£¬ÍøÖ·http://blog.csdn.net/forandever/archive/2009/08/07/4423808.aspx £¬¶Ô UrlRewriteµÄ´úÂë½øÐÐÁ˼òµ¥Ð޸ģ¬
ÎÄÕÂÖеÄÄܹ»Ö§³Ö¶à¸öÅäÖÃÎļþµÄÇé¿ö¡£
×î½ü£¬ÔÚÏîÄ¿ÖÐʹÓþõµÃ»¹ÊDz»Ì«·½±ã£¬Ã¿´ÎÔö¼ÓÒ»¸öÅäÖÃÎļþ£¬¶¼ÐèÒªÐÞ¸Äweb.xml £¬ÓÚÊÇ£¬ÔÚÉÏ´ÎÐ޸ĵĻù´¡ÉÏ£¬¼ÌÐøÐ޸ĴúÂ룬Ôö¼ÓÄ£ºýÆ¥Åäij¸öĿ¼ÏµÄÒ»¶¨¹æÔòµÄÎļþµÄ¹¦ÄÜ¡£
Ò»¡¢ÐèÇó£º
Äܹ»ÊµÏÖÔÚ web.xml ÖÐͨ¹ý * µÄ·½Ê½ÅäÖã¬Ò»´Î¼´¿ÉÅäÖúÃһϵÁеÄÅäÖÃÎļþ¡£ÀýÈ磺
ÔÚweb.xmlÖÐÈçÏÂÅäÖãº
<filter>
<filter-name>UrlRewriteFilter</filter-name>
<filter-class>org.tuckey.web.filters.urlrewrite.UrlRewriteFilter</filter-class>
<init-param>
<param-name>confPath</param-name>
<param-value>/WEB-INF/urlrewrite.xml /WEB-INF/conf/urlrewrite/abc*.xml</param-value>
</init-param>
</filter>
ÒªÄܹ»ÊµÏÖ¼ÓÔØÎļþ/WEB-INF/urlrewrite.xmlºÍ/WEB-INF/conf/urlrewrite/Ŀ¼ÏÂËùÓÐÎļþÃûÆ¥Åäabc*.xml¸ñʽµÄÎļþµÄ¹¦ÄÜ¡£
¶þ¡¢ÊµÏÖ£º
Ïà¹ØÎĵµ£º
Definition comparer class,
class ItemComparer : IEqualityComparer<XElement>
{
public bool Equals(XElement x, XElement y)
{
return x.Attribute("Name").Value == x.Attribute("Name").Value;
}
public int GetHashCode(XElement obj)
......
Ò»¸öXMLÎļþͨ³£°üº¬ÎļþÍ·ºÍÎļþÌåÁ½´ó²¿·Ö
1. ÎļþÍ·
XMLÎļþÍ·ÓÉXMLÉùÃ÷ÓëDTDÎļþÀàÐÍÉùÃ÷×é³É¡£ÆäÖÐDTDÎļþÀàÐÍÉùÃ÷ÊÇ¿ÉÒÔȱÉٵģ¬¹ØÓÚDTDÉùÃ÷½«ÔÚºóÐøµÄÄÚÈÝÖнéÉÜ£¬¶øXMLÉùÃ÷ÊDZØÐëÒªÓеģ¬ÒÔʹÎļþ·ûºÏXMLµÄ±ê×¼¹æ¸ñ¡£
ÔÚÇ°ÃæµÄFlowers.xmlÎļþÖеĵÚÒ»ÐдúÂ뼴ΪXMLÉùÃ÷£º
<?xml °æ ......
ʹÓÃjavascript´´½¨Microsoft XML DOM,¾Í¿ÉÒÔÍê³ÉÕâÒ»¹¤×÷.
// ×°ÈëÊý¾Ý.
var source = new ActiveXObject("Microsoft.XMLDOM");
source.async = false
source.load("history.xml");
// ×°ÈëÑùʽ±í.
var stylesheet = new ActiveXObject("Microsoft.XMLDOM");
stylesheet.async = false
stylesheet.load( ......
Ê×ÏÈ£¬¼ÓÔØTXTʵÀý£º
´úÂ룺
ËäÈ»ÊǺܾɵÄÒ»Ì׽̳̣¬¿ÉÊǺÜʵÓã¬ËùÒÔÎÒ°ÑËü·ÅÔÚÕâ¡£
£¨×¢Ò⣺¿´´úÂëµÄʱºòÁôÒâһϽڵãµÄÓ÷¨£ºmyXML.childNodes[0].childNodes[0].childNodes[0]....xml½ÚµãµÄµØ·½¡££©
Ò»¡¢½¨Á¢XML¶ÔÏó£º
var myXML = new XML();
¶þ¡¢ÒýÓÃXMLÎļþ£º
myXML.load("data.xml");
Èý¡¢ºöÂÔ¿Õ¸ñ£º
my ......
ÏÖÔÚÎÒÃÇÔÝÇÒʹÓÓ¼Çʱ¾”À´´´½¨ÎÒÃǵÄXMLÎļþ°É¡£ÏÈ¿´Ò»¸öXMLÎļþ£º
¡¡¡¡Àý1
¡¡¡¡¡´?xml version="1.0" encoding="gb2312" ?¡µ
¡¡¡¡¡´²Î¿¼×ÊÁÏ¡µ
¡¡¡¡ ¡´Êé¼®¡µ
¡¡¡¡ ¡´Ãû³Æ¡µXMLÈëÞ«½â¡´/Ãû³Æ¡µ
¡¡¡¡ ¡´×÷Õß¡µÕÅÈý¡´/×÷Õß¡ ......