ʹÓÃ.NETÖеÄXML×¢ÊÍ(Ò») XML×¢ÊͱêÇ©½²½â
Ò».ÕªÒª
.NetÔÊÐí¿ª·¢ÈËÔ±ÔÚÔ´´úÂëÖвåÈëXML×¢ÊÍ£¬ÕâÔÚ¶àÈËÐ×÷¿ª·¢µÄʱºòÏÔµÃÌرðÓÐÓᣠC#½âÎöÆ÷¿ÉÒÔ°Ñ´úÂëÎļþÖеÄÕâЩXML±ê¼ÇÌáÈ¡³öÀ´£¬²¢×÷½øÒ»²½µÄ´¦ÀíΪÍⲿÎĵµ¡£ ÕâƪÎÄÕ½«Õ¹Ê¾ÈçºÎʹÓÃÕâЩXML×¢ÊÍ¡£ ÔÚÏîÄ¿¿ª·¢ÖУ¬ºÜ¶àÈ˲¢²»ÀÖÒâд·±ÔÓµÄÎĵµ¡£µ«ÊÇ£¬¿ª·¢×鳤ϣÍû´úÂë×¢Ê;¡¿ÉÄÜÏêϸ£»ÏîÄ¿¹æ»®ÈËԱϣÍû´úÂëÉè¼ÆÎĵµ¾¡¿ÉÄÜÏ꾡£»²âÊÔ¡¢¼ì²éÈËԱϣÍû¹¦ÄÜ˵Ã÷Ê龡¿ÉÄÜÏêϸµÈµÈ¡£Èç¹ûÕâЩÎĵµ¶¼±»ÒªÇóдµÄ»°£¬±£³ÖËüÃÇͬ²½±È½øÐÐÒ»¸öÕ½ÒÛ»¹Í´¿à¡£
ΪºÎ²»°ÑÕâЩÐÅÏ¢±£´æÔÚÒ»¸öµØ·½ÄØ£¿£¿×îÃ÷ÏÔÏëµ½µÄµØ·½¾ÍÊÇ´úÂëµÄ×¢ÊÍÖУ»µ«ÊÇÄãºÜÄÑͨÀÀ³ÌÐò£¬²¢ÇÒÓÐЩÐèÒªÕâЩÎĵµµÄÈ˲¢²»¶®±àÂë¡£×îºÃµÄ°ì·¨ÊÇͨ¹ýʹÓÃXML×¢ÊÍÀ´½â¾öÕâЩÎÊÌâ¡£´úÂë×¢ÊÍ¡¢Óû§Êֲᡢ¿ª·¢ÈËÔ±Êֲᡢ²âÊԼƻ®µÈºÜ¶àÎĵµ¿ÉÒԺܷ½±ãµÄ´ÓXML×¢ÊÍÖлñµÃ¡£±¾ÎĽ²½â.NetÖо³£Ê¹ÓõÄXML×¢ÊÍ.Ö÷ҪʹÓÃC#ÓïÑÔj,.Netƽ̨֧³ÖµÄÆäËûÓïÑÔʹÓõÄXML×¢Ê͸ñʽ»ù±¾Ïàͬ.²¢ÇÒÔÚ±¾ÏµÁÐÎÄÕµÄÏÂÒ»½²Öн²½âÈçºÎʹÓù¤¾ß½«XML×¢ÊÍÄÚÈÝת»¯Îª°ïÖúÎĵµ.
¶þ.XML×¢Ê͸ÅÊö
ËùÓеÄXML×¢ÊͶ¼ÔÚÈý¸öÏòÇ°µÄбÏßÖ®ºó(///)¡£Á½ÌõбÏß±íʾÊÇÒ»¸ö×¢ÊÍ£¬±àÒëÆ÷½«ºöÂÔºóÃæµÄÄÚÈÝ¡£ÈýÌõбÏ߸æËß±àÒëÆ÷£¬ºóÃæÊÇXML×¢ÊÍ£¬ÐèÒªÊʵ±µØ´¦Àí¡£
µ±¿ª·¢ÈËÔ±ÊäÈëÈý¸öÏòÇ°µÄбÏߺó£¬Microsoft Visual Studio .NET IDE ×Ô¶¯¼ì²éËüÊÇ·ñÔÚÀà»òÕßÀà³ÉÔ±µÄ¶¨ÒåµÄÇ°Ãæ¡£Èç¹ûÊǵĻ°£¬Visual Studio .NET IDE ½«×Ô¶¯²åÈë×¢Êͱê¼Ç£¬¿ª·¢ÈËÔ±Ö»ÐèÒªÔö¼ÓЩ¶îÍâµÄ±ê¼ÇºÍÖµ¡£ÏÂÃæ¾ÍÊÇÔÚ³ÉÔ±º¯ÊýÇ°Ôö¼ÓÈý¸öбÏߣ¬×Ô¶¯Ôö¼ÓµÄ×¢ÊͱÈÈç:
/// <summary>
/// µÃµ½Ö¸¶¨¾ÆµêµÄ¾ÆµêÐÅÏ¢
/// </summary>
/// <param name="hotelId">¾ÆµêId</param>
/// <param name="languageCode">ÓïÑÔÂë.ÖÐÎÄΪzh-cn</param>
/// <returns>¾ÆµêÐÅÏ¢¶ÔÏó</returns>
[OperationContract]
OutHotelInfo GetHotelInfoByHotelId(string loginName, string loginPassword, string hotelId, string languageCode);
ÕâÀïǶÈëµÄsummary,param,returns±ê¼Ç½ö½öÊÇVisual StudioÄܹ»Ê¶±ðµÄÒ»²¿·Ö±ê¼Ç£¬È»¶øÔÚÖÇÄܸÐÖªIntelliSenseÖУ¬²¢Ã»ÓаÑc#¹æ·¶ÖÐËùÓеıê¼ÇÁгöÀ´£¬ÒÅʧµÄ²¿·ÖÖ»ÄÜÓÃÊÖ¹¤²åÈë¡£ ÕâЩÊÖ¹¤±ê¼ÇÊǷdz£ÓÐÓõģ¬Èç¹ûÇ¡µ±µØÉèÖÃËûÃÇ£¬¶Ôµ¼³ö³ÉÍⲿ˵Ã÷Îļþ½«·Ç³£ÓаïÖú¡£
Èý.½«×¢ÊÍÉú³ÉXMLÎļþ
ÔÚ´úÂëÖ
Ïà¹ØÎĵµ£º
½üÀ´×Ô¼ºÔÚ×öxmlµÄ½âÎöÆ÷¡£ÀûÓõ½ÁËcmarkupÀ࣬¾Íµ±×ö´æ´¢°É£¡ÓÐÐèÒªµÄÅóÓÑ¿ÉÒÔÃ鼸ÑÛ¡£
HTREEITEM itemTemp1,itemTemp2;
CString str1,str2;
char strtemp[100];
static bool result = true;
strtemp[0] = 0;
if (result)
{
xml.FindElem();
}
&nbs ......
ÂòÁËÕ½Õù»úÆ÷2£¬Ð´Íê½Ì³Ì×¼±¸É±µ½Ë¯¾õ£¬ÏÖÔÚÏÈ×öµÚÒ»²½£¬Ð´½Ì³Ì¡£AIRµÄÎļþ²Ù×÷²»ÄÑ£¬¿´Íê½Ì³ÌÓ¦¸Ã¿ÉÒÔÂú×ãÄã¶ÔÎļþµÄËùÓлù±¾²Ù×÷¡£Õâƪ½Ì³ÌÖ÷ÒªÒÔʵ¼Ê²Ù×÷ÖÐÓöµ½µÄÇé¿öÀ´½²½â
ÎÒÃÇÏëÏëÎļþ²Ù×÷¶¼»áÓÐʲôÄÚÈÝ£¬ÎÞ·ÇÊÇ´´½¨£¬Ð޸ģ¬É¾³ý£¬Òƶ¯£¬¿½±´¡£ÔÚÕâ¸ö¹ý³ÌÖÐÎÒÃÇ»áÉæ¼°µ½Ò»Ð©ÖܱߵIJÙ×÷£¬±ÈÈçÎļþ¼Ð£¬ÎļþÑ¡ÔñÆ÷£¬ÎÄ ......
C# code
// Load the style sheet.
XslCompiledTransform xslt = new XslCompiledTransform();
xslt.Load("output.xsl");
// Execute the transform and output the results to a file.
xslt.Transform("books.xml", "books.html");
......
×÷Õߣºwuhua
¿Õ¼ä£ºhtt://wuhua.3geye.net
תÔØÇë±£ÁôÉÏÃæµÄÐÅÏ¢£¨Çë×ðÖØ֪ʶ²úÆ·£©Ð»Ð»
ÏàÐÅ´ó¼Ò¶¼ÓùýKxmlµÄ¶«Î÷ÁË£¬²»¹ý¸öÈ˸оõkxml»¹ÊÇ´óÁËЩ¡£ÏÖÔÚ½éÉÜÒ»¸ö±Èkxml¸ú¼ò½éµÄxmlµÄÀà¡£¶ÔÓÚһЩСÏîÄ¿£¬»òÕ߶Ôxml½âÊÍÒªÇó²»ÊǺܸߵÄÏîÄ¿À´ËµÈ´ÊǸö²»´íµÄÑ¡Ôñ¡£
ÏÂÃæ¿´¿´ÄÇ´úÂëÓëDemo°É¡£
Java´úÂë
package o ......
ÎÒÊÇʹÓõÄCMarkupÀà¶ÔXML½øÐвÙ×÷¡£
CMarkupºÃÏó¶¼ÊÇÏÈ´ÓÒ»¸öxmlÎļþÀïÃæ°ÑÄÚÈݶÁ³öÀ´£¬ÔÙ½øÐнâÎö£¬¸ãµÃÎÒºÞ²»µÃÒª°ÑÎÒµÄCStringдµ½xmlÎļþÀïÃæÔÙÈ¡³öÀ´ÁË¡£
  ......