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

SAX½âÎöXML(Ô´´úÂ룩

package book.xml;
import java.io.File;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
public class SaxXML {
 public static List readXML(String fileName)throws Exception{
  SAXParserFactory spf=SAXParserFactory.newInstance();//´´½¨SAX½âÎöÆ÷¹¤³§¶ÔÏó
  SAXParser saxParser=spf.newSAXParser();//ʹÓýâÎöÆ÷¹¤³§´´½¨½âÎöÆ÷ʵÀý
 
  //´´½¨SAX½âÎöÆ÷ҪʹÓõÄʼþ¼àÌýÆ÷¶ÔÏó
  StudentSAXHandler handler=new StudentSAXHandler();
  saxParser.parse(new File(fileName),handler);//¿ªÊ¼½âÎöÎļþ
  return handler.getResult();//»ñÈ¡½á¹û
 }
 public static void main(String[] args) {
  String filename="student.xml";
  List studentBeans=null;
  try{
   studentBeans=SaxXML.readXML(filename);
  }catch(Exception e){
   System.err.println(e.getMessage());
  }
  if(studentBeans!=null){
   System.out.println("½âÎöstudent.xmlÎĵµµÃµ½µÄѧÉúÐÅÏ¢£º");
   for(int i=0;i<studentBeans.size();i++){
    System.out.println(studentBeans.get(i).toString());
   }
  }
 }
 /**
  * SAXµÄʼþ¼àÌýÆ÷£¬µ±´¦ÀíÌض¨µÄXMLÎļþµÄʱºò£¬¾ÍÐèҪΪ
  * Æä´´½¨Ò»¸ö¼Ì³ÐDefaultHandlerµÄÀàÀ´´¦ÀíÌض¨µÄʼþ
  * ¿ÉÒÔ˵£¬Õâʵ¼ÊÉϾÍÊÇSAX´¦ÀíXMLÎļþµÄºËÐÄ
  * @author wuhailin
  *
  */
 static class StudentSAXHandler extends DefaultHandler{
  //±£´æÒѾ­¶Áµ½¹ýµ«»¹Ã»ÓйرյıêÇ©
  Stack tagsStack=new Stack();
  List studentBeans=new ArrayList();
  StudentBean bean=null;
  /**µ±Óöµ½ÎĵµµÄ¿ªÍ·µÄʱºò£¬µ÷ÓÃÕâ¸ö·½·¨£¬¿ÉÒÔÔÚÆäÖÐ×öһЩԤ´¦ÀíµÄ¹¤×÷*/
  public void startDocument()throws SAXException{
   System.out.println("--------Parse begin---------");
  }


Ïà¹ØÎĵµ£º

C#СTip£ºXml²Ù×÷¼òÃ÷ÊÖ²á 3

3£©¶ÁÈ¡¡¢²éÕÒ
µ±ÄãÊÖÍ·ÓÐÒ»¸öxmlÎļþºó£¬¿ÉÒÔʹÓÃXmlDocument.Load()·½·¨½«Æä¼ÓÔؽøÀ´ÒԱ㴦Àí£¬ËùÒÔ“¶ÁÈ¡”ûÓÐʲô¿É˵µÄ¡£¶ø“²éÕÒ”²Ù×÷ÍùÍùÉæ¼°XPath£¬ÕâÀïÖ»ÊÇÎÒÈÏΪµÄ±È½Ï³£Óõ½µÄ²éÕÒ²Ù×÷£¬XPathÕâÍæÒâʵÔÚÊǺÜÇ¿´óºÜ±©Á¦¡£
 
»ØÍ·¿´Ê¾ÀýÎĵµxmlsample.xml£¬ÎÒÃÇ¿ÉÄÜÓöµ½ÕâÑùµÄÐèÇó£ ......

c# Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary

/// <summary>
/// Ö§³ÖXMLÐòÁл¯µÄ·ºÐÍ Dictionary
/// </summary>
/// <typeparam name="TKey"></typeparam>
/// <typeparam name="TValue"></typeparam>
[XmlRoot("SerializableDictionary")]
public class SerializableDictionary<TKey, TValue& ......

Jdbc,Jdo,XML·½Ãæ


1¡¢Class.forNameµÄ×÷ÓÃ?ΪʲôҪÓÃ?
´ð£ºµ÷Óø÷ÃÎÊ·µ»ØÒ»¸öÒÔ×Ö·û´®Ö¸¶¨ÀàÃûµÄÀàµÄ¶ÔÏó¡£
2¡¢JdoÊÇʲô?
´ð£ºJDOÊÇJava¶ÔÏó³Ö¾Ã»¯µÄеĹ淶£¬Îªjava data objectµÄ¼ò³Æ,Ò²ÊÇÒ»¸öÓÃÓÚ´æȡijÖÖÊý¾Ý²Ö¿âÖеĶÔÏóµÄ±ê×¼»¯API¡£JDOÌṩÁË͸Ã÷µÄ¶ÔÏó´æ´¢£¬Òò´Ë¶Ô¿ª·¢ÈËÔ±À´Ëµ£¬´æ´¢Êý¾Ý¶ÔÏóÍêÈ«²»ÐèÒª¶îÍâµÄ´úÂ루ÈçJDBC ......

´ÓÒ»¸ö·¶Àý¿´XMLµÄÓ¦ÓÃ

ÒýÑÔ
Èç¹ûÄãÒѾ­¿´ÁËAsp.Net AjaxµÄÁ½ÖÖ»ù±¾¿ª·¢Ä£Ê½ ÕâƪÎÄÕ£¬Äã¿ÉÄܺܿì»á·¢ÏÖÕâÑùÒ»¸öÎÊÌ⣺ÔÚÄÇƪÎÄÕµķ½Ê½2ÖУ¬¿Í»§¶Ë½ö½öÊÇ·¢ËÍÁËÒ³ÃæÉÏÒ»¸öÎı¾¿òµÄÄÚÈݵ½·þÎñ¶Ë£¬¶ø·þÎñ¶ËµÄWeb·þÎñ·½·¨Ò²Ö»½ÓÊÕÒ»¸öÀ´×Ô¿Í»§¶ËµÄ×Ö·û´®ÀàÐ͵ÄÊýÖµ¡£¶øºÜ¶àʱºò£¬·þÎñ¶ËµÄ·½·¨ÆÚÍû½ÓÊÕµÄÊÇÒ»¸ö×Ô¶¨ÒåÀàÐÍ£¬»òÕßÊǶà¸ö²»Í¬ÀàÐ͵IJÎÊ ......

JAVA¶ÁXML£ºsax,dom,jdom,dom4jµÄ±È½ÏÒÔ¼°Ñ¡Ôñ(ת)

JAVA¶ÁXML£ºsax,dom,jdom,dom4jµÄ±È½ÏÒÔ¼°Ñ¡Ôñ(ת)
Ô­ÎÄ£ºwww.hicourt.gov.cn/homepage/show9_content.asp
SAX£º                                 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ