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

ͨ¹ýDOM4J½âÎöXMLÎļþС½á

´´½¨XMLÎļþ£º
public boolean createXML(){
  try{
   Document doc = DocumentHelper.createDocument();
   Element root = doc.addElement("root");
   Element personNode = root.addElement("person");
   Element sonNode = personNode.addElement("fristson");
   sonNode.setText("lk1");
   Element sonNode2 = personNode.addElement("secandtson");
   sonNode2.setText("lk2");
   
   OutputFormat opf = OutputFormat.createPrettyPrint();
   opf.setEncoding("GB2312");
   
   XMLWriter xmlw = new XMLWriter(new FileWriter("d:\\myXML.xml"),opf);
   xmlw.write(doc);
   
   xmlw.close();
   return true;
  }catch(Exception e){
   System.out.println("error: In create XML");
   return false;
  }
 }
ÒÔÉÏÖ»ÊǸö¼òµ¥µÄ´´½¨ÁËÒ»¸öXMLÎļþÔÚDÅÌÏ£¬Ï±ßÖ÷ÒªÊÇ·ÖÎöXMLÎļþ£¬ÌáÈ¡Ãû×ÖºÍÄÚÈÝ£ºÒÔJAVAÏîÄ¿ÖУ¬¾­µäµÄWEB.XMLΪÀý
public boolean updateXML(){
  Document doc = null;
  try{
   SAXReader sr = new SAXReader();
   doc = sr.read(new File("d:\\web.xml"));
   Element personRoot = doc.getRootElement();
   Iterator personNode = personRoot.elementIterator();
   while(personNode.hasNext()){
    Element sonNode = (Element)personNode.next();
    List sonNodes = sonNode.elements();
    System.out.println(sonNode.getName());
     for(int i = 0 ;i<sonNodes.size() ; i++){
      System.out.println(i+":"+((Element)sonNodes.get(i)).getName());
      System.out.println(i+":"+((Element)sonNodes.get(i)).getText());
     }


Ïà¹ØÎĵµ£º

[¼¼Êõѧϰ]C++ XML¿â£¨×ªÔØ£©

ÔÚC++ÖУ¬¿âµÄµØÎ»ÊǷdz£¸ßµÄ¡£C++Ö®¸¸ Bjarne StroustrupÏÈÉú¶à´Î±íʾÁËÉè¼Æ¿âÀ´À©³ä¹¦ÄÜÒªºÃ¹ýÉè¼Æ¸ü¶àµÄÓï·¨µÄÑÔÂÛ¡£ÏÖʵÖУ¬C++µÄ¿âÃÅÀà·±¶à£¬½â¾öµÄÎÊÌâÒ²ÊǼ«Æä¹ã·º£¬¿â´ÓÇáÁ¿¼¶µ½ÖØÁ¿¼¶µÄ¶¼ÓС£²»ÉÙ¶¼ÊÇÈÃÈËÑÛ½ç´ó¿ª£¬Òà»òÊÇÍû¶øÉú̾µÄ˼ά½Ü×÷¡£ÓÉÓÚ¿âµÄÊýÁ¿·Ç³£ÅӴ󣬶øÇÒÏÞÓÚ±ÊÕßˮƽ£¬ÆäÖкܶಢ²»Á˽⡣ËùÒÔÎÄÖ ......

xmlѡȡµ¥¸ö½ÚµãÄÚÈݽâ¾ö°ì·¨

XPath Óï·¨
2007-06-05 17:24
XPath Óï·¨
×÷Õß:w3pop.com ·­Òë/ÕûÀí:w3pop.com ·¢²¼:2007-04-29 ä¯ÀÀ:674 :: ::
XPath Nodes(½Úµã) XPath Axes
XPath uses path expressions to select nodes or node-sets in an XML document. The node is selected by following a path or steps.
XPath ͨ¹ý·¾¶±í´ïʽ´ÓXM ......

XMLÊý¾Ýµº¼¼ÊõµÄ×ܽá

  ×î½ü×öµÄÒ»¸öÏîÄ¿ÖÐÔËÓà xml Êý¾Ýµº¼¼Êõ£¬ËùÒÔ°ÑÊý¾Ýµº·½ÃæµÄ֪ʶ×ܽáһϡ£
  XML Êý¾Ýµº £¨ data islands £©¾ÍÊDZ» html Ò³ÃæÒýÓûòÕß°üº¬µÄ xml Êý¾Ý£¬ÊÇ´Ó IE5 ¿ªÊ¼ÒýÈëµÄÒ»Ïî¼¼Êõ¡£¿ÉÒÔͨ¹ý xml ±êÇ©ºÜÇáËɽ«Êý¾Ýµº²åÈëµ½ html ÎĵµÖС£ÄÇôÔõô·ÃÎÊ xml Êý¾ÝµºµÄÊý¾ÝÄØ£¬ºÜ¼òµ¥£¬Í¨¹ý xml µÄ id ¡£ÔÚÒ³ ......

C#¶ÔxmlµÄ²Ù×÷ʵÀýÔ´Âë

À©Õ¹±ê¼ÇÓïÑÔXML£¨eXtensible Markup Language£©£¬ÊÇÓÉW3C×éÖ¯ÖÆ¶¨µÄ¡£×öΪÓÃÓÚÌæ´úHTMLÓïÑÔµÄÒ»ÖÖÐÂÐ͵ıê¼ÇÓïÑÔ£¬XMLÄÚ²¿ÓÐןܶà»ù±¾±ê×¼£¬XML¾ÍÊÇͨ¹ýÓëÕâЩÏà¹Ø±ê×¼µØ½áºÏ£¬Ó¦ÓÃÓÚ¿ÆÑ§¼ÆËã¡¢µç×Ó³ö°æ¡¢¶àýÌåÖÆ×÷ºÍµç×ÓÉÌÎñµÄ¡£C££×÷ΪһÖÖÐÂÐ͵ijÌÐòÓïÑÔ£¬ÊÇ.Net¿ò¼ÜµÄÒ»¸öÖØÒª×é³É²¿·Ö£¬ËûºÍXMLµÄ¹ØÏµÆÄÉî¡£±¾ÎÄ¾Í´Ó ......

[Perl]ÀûÓÃXML::DOMÉú³ÉXMLÎĵµ

PerlµÄXML::DOM¹¦ÄܺÜÇ¿´ó£¬ÀûÓÃËü¿ÉÒÔÇáÒ׵طÖÎöXMLÎĵµ£¬Ò²¿ÉÒÔ½¨Á¢XMLÎĵµ¡£
³£ÓõÄÀà°üÀ¨£º
XML::DOM::Node£ºËùÓÐÀàµÄ»ùÀ࣬±íʾһ¸öXML½Úµã¡£
XML::DOM::Parser£ºXML½âÎöÆ÷£¬½«XML×Ö·û´®½âÎö³ÉXML::DOM::Document¶ÔÏó¡£
XML::DOM::Document£ºÖ¸ÏòXMLÎĵµµÄ¸ù½Úµã¡£
XML::DOM::Element£ºÖ¸ÏòÒ»¸öÔªËØ£¬Í¨³£ÓÉXML:: ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ