java SAX½âÎöXMLÎļþ
import java.io.File;
import java.io.FileNotFoundException;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
public class ResolveXmlFile {
public void resolverXml() throws DocumentException, FileNotFoundException{
//¶ÁÈ¡xmlÎļþ À´µÃµ½document
SAXReader reader = new SAXReader();
Document document = reader.read(new File("F:\\Workspaces\\DomXmlProject\\src\\T_AR_OtherBillentry.xml"));
Element root = document.getRootElement();
//Ñ»·¸ù½Úµã
for(java.util.Iterator it =root.elementIterator("columns");it.hasNext();){
Element elm=(Element)it.next();
//Ñ»·×Ó½Úµã
for(java.util.Iterator it1 = elm.elementIterator("column");it1.hasNext();){
Element elm1 =(Element)it1.next();
Element name=elm1.element("name"); //È¡µÃ½Úµã
Element type=elm1.element("sqlType"); //È¡µÃ½Úµã
System.out.println(name.getData().toString()+type.getData().toString());
}
}
}
public static void main(String[] args) throws DocumentException, FileNotFoundException{
ResolveXmlFile rx = new ResolveXmlFile();
rx.resolverXml();
}
}
Ïà¹ØÎĵµ£º
1. ¸ÅÄ ÐòÁл¯¾ÍÊǰѶÔÏó±ä³É¶ÔÏóÁ÷£¨È·ÇÐ˵ÊǰѶÔÏóµÄÊôÐÔдÈëÁ÷£©£¬Èç¹ûÐèÒª½ø¶ø¿ÉÒ԰ѶÔÏóÁ÷´æ³É¶þ½øÖÆÎļþ£»
2. Ä¿µÄ£º ÐòÁл¯µÄÄ¿µÄÊÇΪÁË·½±ãÓÀ¾Ã´æ´¢»òÕßÍøÂç´«Ê䣻
3. ÈçºÎʵÏÖ£º ½«ÀàʵÏÖSerializable½Ó¿Ú¼´¿É£¬ÎÞ±ØÐëʵÏֵķ½·¨£¬ÊµÏָýӿÚÖ»ÊÇΪÁ˱êʶ¸ÃÀà¿É±»ÐòÁл¯£»
4. £¨×ª£©ÆäËûÐèÒªÖªµÀµÄ£º
  ......
¸Õ¸Õ¿´µ½Ò»ÆªÎÄÕÂÌá³öc++¶à̬Óëjava¶à̬²»Í¬µÄµØ·½£¬»ù±¾Òâ˼ÈçÏ£º
Çë¿´C++´úÂ룺
class Base
{
public:
Base()
{
init();
}
virtual ~Base() {}
protected:
int value;
virtual void init()
{
value = 100; &nb ......
1.¾²Ì¬µ¼È룺
¾²Ì¬µ¼ÈëÊÇJDK1.5ºóмӵŦÄÜ£¬Ò»°ã²»Ôõô³£Ó㬺ܼòµ¥¸øÄã¾Ù¸öÀý×ÓÄã¾ÍÄÜÃ÷°×ÁË£¬¿´Õâ¶Î´úÂ룺
import static java.lang.System.out;//µ¼Èëjava.lang°üϵÄSystemÀàµÄ¾²Ì¬·½·¨out;
public class HelloWorld{
public static void main(String[] args){
out.print("Hello World!");//¼ÈÊÇÔÚÕ ......
×î½ü×öÒ»¸öÏîÄ¿£¬ÒªÓõ½·ÖÒ³¹¦ÄÜ£¬²Î¿¼Á˺ܶ෽·¨£¬ÓеIJ»ºÏÊÊ£¬ÓеIJ»Ï²»¶£¬ÓÚÊÇ×Ô¼ºÔÚËûÃǵĻù´¡ÉÏÕûÁËÒ»¸ö£»Ë¼Â·ÊÇÕâÑùµÄ£ºÏÈ°ÑÐèÒª·ÖÒ³µÄÊý¾Ý»òÊǼǼ¶¼²éѯ³öÀ´ ´æÈëÒ»¸ö¼¯ºÏÀàÀïÈçList»òÊÇVector£¬È»ºóÀûÓÃÆäsublist(int findex,int eindex)·½·¨£¬»ñÈ¡ÐèÒª·ÖÒ³µÄÊý¾Ý»ò¼Ç¼,¹ØÓ ......
¡¡ÔÚJavaÓïÑÔÖУ¬ abstract class ºÍinterface ÊÇÖ§³Ö³éÏóÀඨÒåµÄÁ½ÖÖ»úÖÆ¡£ÕýÊÇÓÉÓÚÕâÁ½ÖÖ»úÖƵĴæÔÚ£¬²Å¸³ÓèÁËJavaÇ¿´óµÄ ÃæÏò¶ÔÏóÄÜÁ¦¡£abstract classºÍinterfaceÖ®¼äÔÚ¶ÔÓÚ³éÏóÀඨÒåµÄÖ§³Ö·½Ãæ¾ßÓкܴóµÄÏàËÆÐÔ£¬ÉõÖÁ¿ÉÒÔÏ໥Ìæ»»£¬Òò´ËºÜ¶à¿ª·¢ÕßÔÚ½ø ÐгéÏóÀඨÒåʱ¶ÔÓÚabstract classºÍinterfaceµÄÑ¡ÔñÏԵñȽÏËæ ......