Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

C++µÄXML±à³Ì¾­Ñé¨D¨DLIBXML2¿âʹÓÃÖ¸ÄÏ

дÕâƪÎÄÕµÄÔ­ÒòÓÐÈçϼ¸µã£º1)C++±ê×¼¿âÖÐûÓвÙ×÷XMLµÄ·½·¨£¬ÓÃC++²Ù×÷XMLÎļþ±ØÐëÊìϤһÖÖº¯Êý¿â£¬LIBXML2ÊÇÆäÖÐÒ»ÖÖºÜÓÅÐãµÄXML¿â£¬¶øÇÒËüͬʱ֧³Ö¶àÖÖ±à³ÌÓïÑÔ£»2)LIBXML2¿âµÄTutorialдµÃ²»Ì«ºÃ£¬ÓÈÆäÊDZàÂëת»»µÄ²¿·Ö£¬²»ÊÊÓÃÓÚÖÐÎıàÂëµÄת»»£»3)ÍøÉϵĴó¶àÊý¹ØÓÚLibxml2µÄ½éÉܽö½öÊÇ·­ÒëÁË×Ô´øµÄ×ÊÁÏ£¬Ã»ÓÐÏêϸ½éÉÜÈçºÎÔÚwindowsƽ̨ϽøÐбà³Ì£¬¸üºÜÉÙÌáµ½ÈçºÎ½â¾öÖÐÎÄÎÊÌâ¡£
»ùÓÚÒÔÉϼ¸µãÔ­Òò£¬¾ö¶¨Ð´Ò»¸öÔÚWindowsƽ̨Ï£¬Ê¹ÓÃC/C++ÓïÑÔ£¬Ó¦ÓÃLibXml2¿âÀ´½øÐÐxmlÎĵµ²Ù×÷£¬Í¬Ê±Ê¹ÓÃICONV¿â½øÐÐÖÐÎıàÂëת»»µÄÎĵµ¡£ÆäÖл¹Éæ¼°ÁËMakefile¡¢XPATHµÈÏà¹ØÄÚÈÝ¡£±¾ÎÄÖÐËùÓеÄÔ´´úÂëÔÚhttp://www.blogjava.net/Files/wxb_nudt/xml_src.rar¡£
1.       ÏÂÔØÓë°²×°LIBXML2ºÍICONV
Libxml2ÊÇÒ»¸öCÓïÑÔµÄXML³ÌÐò¿â£¬¿ÉÒÔ¼òµ¥·½±ãµÄÌṩ¶ÔXMLÎĵµµÄ¸÷ÖÖ²Ù×÷£¬²¢ÇÒÖ§³ÖXPATH²éѯ£¬ÒÔ¼°²¿·ÖµÄÖ§³ÖXSLTת»»µÈ¹¦ÄÜ¡£Libxml2µÄÏÂÔصØÖ·ÊÇhttp://xmlsoft.org/£¬ÍêÈ«°æµÄ¿âÊÇ¿ªÔ´µÄ£¬²¢ÇÒ´øÓÐÀý×Ó³ÌÐòºÍ˵Ã÷Îĵµ¡£×îºÃ½«Õâ¸ö¿âÏÈÏÂÔØÏÂÀ´£¬ÒòΪÕâÑù¿ÉÒԲ鿴ÆäÖеÄÎĵµºÍÀý×Ó¡£
windows°æ±¾µÄµÄÏÂÔصØÖ·ÊÇhttp://www.zlatkovic.com/libxml.en.html£»Õâ¸ö°æ±¾Ö»ÌṩÁËÍ·Îļþ¡¢¿âÎļþºÍdll£¬²»°üº¬Ô´´úÂë¡¢Àý×Ó³ÌÐòºÍÎĵµ¡£ÔÚÎı¾ÖУ¬Ö»ÐèÒªÏÂÔØlibxml2¿â¡¢iconv¿âºÍzlib¿â¾ÍÐÐÁË£¨×¢Ò⣬libxml2¿âÒÀÀµiconvºÍzlib¿â£¬±¾ÎÄÖÐÖصã¹Ø×¢libxml2ºÍiconv£¬zlib²»½éÉÜ£©£¬ÎÒʹÓõİ汾ÊÇlibxml2-2.6.30.win32.zip¡¢zlib-1.2.3.win32.zipºÍiconv-1.9.2.win32.zip¡£
ÔÚ±à³ÌµÄʱºò£¬ÎÒÃÇʹÓÃwindows°æ±¾µÄlibxml2¡¢zlibºÍiconv£¬½«Æä½âѹËõµ½Ö¸¶¨Îļþ¼Ð£¬ÀýÈçD:"libxml2-2.6.30.win32£¬D:"zlib-1.2.3.win32ÒÔ¼°D:"iconv-1.9.2.win32¡£ÊÂʵÉÏ£¬ÎÒÃÇÖªµÀÔÚwindowsÏÂÃæʹÓÃÍ·Îļþ¡¢¿âÎļþºÍdllÊDz»ÐèÒª°²×°µÄ£¬ËüÓÖûÓÐʹÓÃÈκÎÐèҪע²áµÄ×é¼þ»òÕßÊý¾Ý¿â£¬Ö»ÐèÒª¸æËß±àÒëÆ÷ºÍÁ´½ÓÆ÷ÕâЩ×ÊÔ´µÄλÖþͿÉÒÔÁË¡£
×¢Ò⣺ҪÔÚpath±äÁ¿ÖмÓÉÏD:"iconv-1.9.2.win32"bin;D:"zlib-1.2.3.win32"bin;D:"libxml2-2.6.30.win32"binÕâÈý¸öµØÖ·£¬·ñÔòÔÚÖ´ÐеÄʱºò¾ÍÕÒ²»µ½¡£»òÕßʹÓøü¼òµ¥µÄ·½·¨£¬°ÑÆäÖеÄÈý¸ödllµ½¿½±´µ½system32Ŀ¼ÖС£
ÓÐÁ½ÖÖ·½·¨À´±àÒëÁ´½Ó»ùÓÚlibxml2µÄ³ÌÐò£¬µÚÒ»ÖÖÊÇÔÚVC»·¾³ÖÐÉèÖÃlibºÍinclude·¾¶£¬²¢ÔÚlinkÉèÖÃÖÐÌí¼Ólibxml2.libºÍiconv.lib£»µÚ¶þÖÖÊÇÓñàÒëÆ÷Ñ¡Ïî¸æËß±àÒëÆ÷cl.exeÍ·ÎļþµÄλÖ㬲¢ÓÃÁ´½ÓÆ÷Ñ¡Ïî¸æËßÁ´½ÓÆ÷


Ïà¹ØÎĵµ£º

XML ,query ºÍ valueÊÇÇø·Ö´óСд µÄ

DECLARE @x xml
SET @x='
<root>
  <ShopAccount>
    <ActivityType>IA - PM Standing WO (for LPI report)</ActivityType>
    <ProjectNo>R</ProjectNo>
  </ShopAccount>
  <ShopAccount>
    ......

ͨ¹ýJOXÇáËÉʵÏÖJavaBeansÓëXMLµÄÏ໥ת»»

 
 
 
ͨ¹ýJOXÇáËÉʵÏÖJavaBeansÓëXMLµÄÏ໥ת»»
 
 
 
JOXʹµÃÔÚXMLÎĵµÓëJava BeansÖ®¼ä½øÐÐÊý¾Ýת»»±äµÃÈÝÒ×.Äã¿ÉÒÔÀûÓÃJOXÀ´½«¶ÔÏóÐòÁл¯µ½XML.
¿ª·¢ÓïÑÔ£º Java
²Ù×÷ϵͳ£º
Èí¼þÖ÷Ò³£º http://www.wutka.com/jox.html
ÎĵµµØÖ·£º http://www.wutka.com/joxdoc.html
ÏÂÔص ......

XMLµÄʹÓÃ


дXML£º
    protected void btnSave_Click(object sender, EventArgs e)
    {
        //ȨÏÞÅжÏ
        XmlTextWriter xmlw = new XmlTextWriter(Server.MapPath("~\\") + "FriendLink.xml", Encoding.Ge ......

jdomʵÏÖschemaÑéÖ¤xmlÎļþÊÇ·ñºÏ·¨

µ¼Èëjdom1.1°æ
http://www.jdom.org/dist/binary/
import java.io.FileReader;
import org.jdom.Document;
import org.jdom.input.SAXBuilder;
public class XMLValidate {
public void validate(String xml, String schema) {
try {
SAXBuilder builder = new SAXBuilder(true);
//Ö¸¶¨Ô¼Êø·½ ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ