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

xml±à³Ì2


.dtdÎļþÖÐÈç¹ûÓÐÖÐÎÄ,±ØÐëÁí´æΪUTF-8±àÂë
ÎÊÌâ:
TransformerFactoryΪ³éÏóÀà,²»ÄÜnewʵÀý,µ«ÌṩÁË·½·¨À´»ñµÃ
TransformerFactory factory = TransformerFacory.newInstance();
factory.newDocumentBuilder();
ÕâÀïnewDocumentBuilder()Ϊ³éÏó·½·¨,ΪʲôÄܵ÷ÓÃÄØ?
×¢Òâ:ÕâÀïfactory±äÁ¿Ö¸ÏòµÄÊÇÒ»¸öʵÀý,´ËʵÀýÊÇΪ³éÏóÀàTransformerFactoryµÄʵÏÖÀà
ÎÒÃÇƽ³£newʵÀýʱ¾­³£°Ñ×ÓÀ൱¸¸ÀàÀ´ÓÃ,¼´Óø¸ÀàÀàÐ͵ıäÁ¿Ö¸Ïò×ÓÀàʵÀý,ÓÐʱºò²¢²»
Åųý¸¸ÀàΪ½Ó¿Ú»ò³éÏóÀà
br.readLine();
µ±³ÌÐòÔËÐе½ÕâÀïµÄʱºò,½ø³Ì»á×èÈû,Ö»Óе±ÎÒÃÇÊäÈëÄÚÈݵÄÊÇ
³ÌÐò²Å»á¼ÌÐøÍùÏÂ×ß
dom4jÖÐ,»ñµÃdocument¶ÔÏóµÄÈýÖÖ·½Ê½:
1.¶ÁÈ¡XMLÎļþ,»ñµÃdocument¶ÔÏó
SAXReader reader = new SAXReader();
Document   document = reader.read(new File("input.xml"));
2.½âÎöXMLÐÎʽµÄÎı¾,µÃµ½document¶ÔÏó.
String text = "<members></members>";       
Document document = DocumentHelper.parseText(text);

3.Ö÷¶¯´´½¨document¶ÔÏó.             
Document document = DocumentHelper.createDocument();
ÓÃdom4j¼¼Êõ±à³ÌÈçºÎµÃµ½±êÇ©,ÊôÐÔµÈ
1.¸újaxpÓÐËùÇø±ð,ÔÚjaxpÖÐÎÒÃÇ¿ÉÒÔͨ¹ý±êÇ©µÄ×Ö¶ÎÀ´µÃµ½Ò»ÏµÁÐÏàͬ±êÇ©
¶øÔÚdom4jÖÐÒ»ÇвÙ×÷Ö»ÄÜͨ¹ý¸ù½ÚµãÀ´Íê³É
2.ÀûÓÃxpath¿ÉÒÔ¿ìËÙ»ñµÃÏëµÃµ½µÄ±êÇ©
Õâ¸öÓеãÀàËÆregex,¼´Í¨¹ý±ÈÅäµÄ×Ö·û´®À´Ñ°ÕÒ
String xpath = "//name";     Ñ°ÕÒname±êÇ©
String xpath = "/name/sex";  Ñ°ÕÒname±êǩϵÄsex×Ó±êÇ©
schema ---> ÖصãÀí½âÃû×Ö¿Õ¼ä
ÓÃjaxp¼¼Êõ²ÉÓÃsax½âÎö
Óëdom½âÎöÏàͬµÄÊǶ¼ÐèÒª´´½¨¹¤³§À´»ñµÃ½âÎöÆ÷¶ÔÏó
²»Í¬µÄÊÇsax½âÎö»¹ÐèÒª»ñµÃÒ»¸öÎĵµ¶ÁÈ¡Æ÷,È»ºóÉèÖÃÎĵµ¶ÁÈ¡Æ÷µÄʼþ´¦ÀíÆ÷,×îºóÔÚ½âÎöxmlÎļþ
ÎÒÃǶ¼ÖªµÀdom½âÎöºÍsax½âÎöµÄ²»Í¬
dom½âÎöÊǽ«Õû¸öxmlÎļþÈ«²¿¶ÁÈ¡µ½ÄÚ´æÖÐ,Äܹ»curd,µ«Èç¹ûxml¹ý´óÔò»áÓ°ÏìϵͳÐÔÄÜ
sax½âÎöÊÇÎÒÐèÒªÎĵµÖеÄÄIJ¿·ÖÊý¾Ý,¾Í¶ÁÈ¡ÄÇÒ»²¿·Öµ½ÄÚ´æÖÐ,µ«²»ÄÜcurd
2Õß×î´óµÄÇø±ð¾ÍÊǶÁÈ¡ÎĵµµÄÍêÕûÐÔÒÔ¼°ÐÞ¸ÄÎĵµÁË
¼ÈÈ»sax½âÎö±Èdom½âÎö¶àÁËÒ»¸öÎĵµ¶ÁÈ¡Æ÷ºÍʼþ´¦ÀíÆ÷,ÄÇô¾ÍÊÇÕâÀïµ¼Ö²îÒìÁË
sax½âÎöÖÐרÃÅÓÃÒ»¸öÎĵµ¶ÁÈ¡Æ÷À´½âÎöxmlÎļþ,µ±ÎÒÃÇÓöÁÈ¡Æ÷½âÎöʱ,ÐèÒªÉèÖÃÒ»¸öʼþ´¦ÀíÆ÷
Õâ¸öʼþ´¦ÀíÆ÷¾ÍÊÇÀ´´¦ÀíÎÒÃÇÐèÒª¶ÁÈ¡Ö¸¶¨µÄxmlÎļþµÄÄÚÈÝ
±ÈÈ


Ïà¹ØÎĵµ£º

VC++ÖвÙ×÷XML£¨MFC¡¢SDK£©

VC++ÖвÙ×÷XML£¨MFC¡¢SDK£©
2009Äê01ÔÂ07ÈÕ ÐÇÆÚÈý 22:33
XMLÔÚWin32³ÌÐò·½ÃæÓ¦¸ÃûÓÐÔÚWeb·½ÃæÓ¦Óõö࣬ºÜ¶à
Win32³ÌÐòÒ²Ö»ÊÇÓÃXMLÀ´´æ´æÅäÖÃÐÅÏ¢¶øÒÑ£¬¶øÇÒûÓÐ×ã¹»
µÄºÃ´¦µÄ»°»¹²»ÈçÓà ini¡£VC++Àï²Ù×÷XMLÓÐÁ½¸ö¿â¿ÉÒÔÓãº
MSXMLºÍXmlLite¡£MSXMLÓÖϸ·ÖÁËÁ½ÖÖ½Ó¿Ú£ºDOMºÍSAX2¡£XPû×Ô´øÓÐ XmlLite£¬Ö»×Ô´øÓÐ2.x¡¢3 ......

SQL Server2005µÄXMLÊý¾ÝÀàÐÍÖ®»ù´¡Æª1

Ò»¡¢ÒýÑÔ
Èç½ñ£¬ÔÚSQL Server 2005ÖУ¬XML³ÉΪµÚÒ»Á÷µÄÊý¾ÝÀàÐÍ¡£½èÖúÓÚ»ùÓÚXMLģʽµÄÇ¿ÀàÐÍ»¯Ö§³ÖºÍ»ùÓÚ·þÎñÆ÷¶ËµÄXMLÊý¾ÝУÑ鹦ÄÜ£¬ÏÖÔÚ
£¬¿ª·¢Õß¿ÉÒÔ¶Ô´æ´¢µÄXMLÎĵµ½øÐÐÇáËɵØÔ¶³ÌÐ޸ġ£×÷ΪÊý¾Ý¿â¿ª·¢Õߣ¬Ðí¶àÈ˶¼±ØÐë´óÁ¿µØÉæ¼°XML¡£
Èç½ñ£¬ÔÚSQL Server 2005ÖУ¬ÄãÄÜÒÔÒ»ÖÖеÄÊý¾ÝÀàÐ͵ÄÐÎʽ°ÑXML´æ´¢ÔÚÊý¾Ý¿âÖÐ ......

C#ÖÐÓÃXmlTextReader¶ÔÏó²Ù×÷XMLÎļþ

sd.xmlÎļþ:
<?xml version="1.0" encoding="gb2312"?>
<!--ÕâÊÇÒ»¸öxmlÎļþ-->
<xml1>
  <item name="1">µÚÒ»¸öitem</item>
  <item name="2">
      <item name="1">Õâ¸ö½áµã(1) ......

XML ÈëÃűضÁ

1£®Ê²Ã´ÊÇXML£¿
XML ¿ª·¢ÕßÃÇ»á¸æËßÄ㣬ÊÂʵÉÏXML²¢²»ÊÇÒ»ÖÖÓïÑÔ£¬¶øÊÇÒ»ÖÖÓÃÀ´¶¨ÒåÆäËüÓïÑÔµÄϵͳ¡£¿ÉÄÜÄãÒѾ­Ìý¹ý£¬»òÐíÉõÖÁ×Ô¼º³¢ÊÔ¹ýһЩÕâÑùµÄÓïÑÔ??±ÈÈç΢ÈíΪÍÆ£¨push£©¼¼ÊõËùÍƳöµÄƵµÀ¶¨Òå¸ñʽ£¨Channel Definition Format£©¡£
W3CÊÇ»¥Á¬ÍøÉÏһЩ¹«Óñê×¼µÄ¿ª·¢Õߣ¬ËûÍƳöÁËһϵÁкÍXMLÏà¹ØµÄ±ê× ......

ÔÚXMLÀïдSQLÓï¾ä£¨°ÑSQLÓï¾äд½øXMLÀ

ÄãÖªµÀXMLÎļþ°É£¿£¨²»ÖªµÀµÄGOOGLEÈ¥£¡£©ÄÇÄãÌý˵¹ýÔÚXMLÀïÊéдSQLÓï¾äÂ𣿻»¾ä»°Ëµ£¬°ÑÄãµÄÏîÄ¿ÀïËùÓÐSQLÓï¾ä´æ´¢ÔÚXMLÎļþÀÄãÌý˵¹ýÂð£¿Äã×ö¹ýÂð£¿
ÎÒÍ·´ÎÌý˵ÊÇС°¬¸æËßÎҵģ¬ÎҸҿ϶¨ËûÊǸöÕâ·½ÃæµÄ¸ßÊÖ£¬ºÇºÇ£¨ÔÞÒ»¸ö£¬µ½´ËΪֹ£¡£©
ÄǸøÄãչʾһÏ£¬ÔÚXMLÀïÊéдSQLÓï¾ä°É
<commands>
  <comman ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ