JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOMƪ
ÕâÊÇÒ»¸öÓÃJAVA W3C DOM ½øÐÐXML²Ù×÷µÄÀý×Ó£¬°üº¬Á˲éѯ¡¢Ôö¼Ó¡¢Ð޸ġ¢É¾³ý¡¢±£´æµÄ»ù±¾²Ù×÷¡£½ÏÍêÕûµÄÃèÊöÁËÒ»¸öXMLµÄÕû¸ö²Ù×÷Á÷³Ì¡£ÊʺϸÕÈëÃÅJAVA XML²Ù×÷µÄÅóÓѲο¼ºÍѧϰ¡£
¼ÙÉèÓÐXMLÎļþ£ºtest1.xml
<?xml version="1.0" encoding="UTF-8"?>
<books>
<book>
<name>¹þÀﲨÌØ</name>
<price>10</price>
<memo>ÕâÊÇÒ»±¾ºÜºÃ¿´µÄÊé¡£</memo>
</book>
<book id="B02">
<name>Èý¹úÑÝÒå</name>
<price>10</price>
<memo>ËÄ´óÃûÖøÖ®Ò»¡£</memo>
</book>
<book id="B03">
<name>Ë®ä°</name>
<price>6</price>
<memo>ËÄ´óÃûÖøÖ®Ò»¡£</memo>
</book>
<book id="B04">
<name>ºìÂ¥</name>
<price>5</price>
<memo>ËÄ´óÃûÖøÖ®Ò»¡£</memo>
</book>
</books>
ÏÂÃæÊÇΪTest.java
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import org.w3c.dom.*;
import org.xml.sax.SAXException;
import javax.xml.parsers.*;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.*;
import javax.xml.xpath.*;
public class Test ...{
public static void main(String[] args) ...{
DocumentBuilderFactory factory=DocumentBuilderFactory.newInstance();
Element theBook=null, theElem=null, root=null;
try ...{
factory.setIgnoringElementContentWhitespace(true);
DocumentBuilder db=factory.newDocumentBuilder();
Ïà¹ØÎĵµ£º
1.±äÁ¿£º
¶ÔÓÚ»ù±¾ÀàÐ͵ÄÈ«¾Ö±äÁ¿£¬ÈôûÓгõʼ»¯£¬ÏµÍ³»á×Ô¶¯³õʼ»¯Îª¸ÃÀàÐ͵ijõʼֵ£»¶ø¶ÔÓÚ¾Ö²¿±äÁ¿£¬Ôò±ØÐëÏÔʾµÄ½øÐгõʼ»¯¡£
2.³£Á¿£º
final int M_Max=111;
final±íʾֻÄܸø±äÁ¿M_MAX¸³ÖµÒ»´Î£¬¸³ÖµÖ®ºó£¬M_MAXµÄÖµ¾Í²»¿ÉÒÔÖØи³Öµ¡£Ëù¸³µÄÖµ¿ÉÒÔÊÇÒ»¸ö±í´ïʽ£¬Ò²¿ÉÒÔÊÇÒ»¸ö¾ßÌåµÄÖµ¡£
3.Àà³£Á¿£º
static fina ......
Àà¼ÓÔØÆ÷ÊÇ Java ÓïÑÔµÄÒ»¸ö´´Ð£¬Ò²ÊÇ Java ÓïÑÔÁ÷ÐеÄÖØÒªÔÒòÖ®Ò»¡£ËüʹµÃ Java Àà¿ÉÒÔ±»¶¯Ì¬¼ÓÔص½ Java ÐéÄâ»úÖв¢Ö´ÐС£Àà¼ÓÔØÆ÷´Ó JDK 1.0 ¾Í³öÏÖÁË£¬×î³õÊÇΪÁËÂú×ã Java Applet µÄÐèÒª¶ø¿ª·¢³öÀ´µÄ¡£Java Applet ÐèÒª´ÓÔ¶³ÌÏÂÔØ Java ÀàÎļþµ½ä¯ÀÀÆ÷Öв¢Ö´ÐС£ÏÖÔÚÀà¼ÓÔØÆ÷ÔÚ Web ÈÝÆ÷ºÍ OSGi Öеõ½Á˹㷺µÄʹÓá ......
Ò».´úÂëÓÅ»¯
¡¡¡¡ÄÚ´æ»áÒç³ö¿Ï¶¨ºÍ´úÂëÌÓ²»Á˹Øϵ,99.99%ѧjavaµÄÈ˶¼ÖªµÀÀ¬»ø»ØÊÕÆ÷ÊÇ javaµÄÒ»´óÓŵ㲢¾Ý´ËÀ´³°Ð¦C++¡£ÏÔÈ»Õâ¸öÌØÐÔΪ´úÂë±àдÕßÊ¡Á˲»ÉÙÊ£¬µ«Õâ¸öÌØÐÔÈ´´øÀ´Á˲»ÉÙÒþ»¼¡£¾Ù¸öÀý×ÓÔÚÓÎÏ·µ±Öо³£Óв»Í¬³¡¾°µÄÇл»£¬Èç´ÓÓÎÏ·Âß¼Í˵½Ö÷²Ëµ¥Âß¼,¶ÔÓÎÏ·Âß¼¶ÔÏóµÄ̬¶ ......
ÔÌûÒ»£ºhttp://blog.csdn.net/dotphoenix/archive/2009/05/20/4203075.aspx
ÔÌù¶þ£ºhttp://www.cocoachina.com/bbs/read.php?tid-8008.html
@property (²ÎÊý) ÀàÐÍ Ãû×Ö;
ÕâÀïµÄ²ÎÊýÖ÷Òª·ÖΪÈýÀࣺ¶ÁдÊôÐÔ£¨readwrite/readonly£©£¬setterÓïÒ⣨assign/retain/copy£©ÒÔ¼°atomicity£¨nonatomic£©¡£
assign/retain/copy ......
Java¿ÉÒÔÖ±½Óµ÷ÓÃLinuxÃüÁÐÎʽÈçÏ£º
Runtime.getRuntime().exec(command)
¾ÙÀý£ºÔËÐÐls,topÃüÁî¿ÉÒÔÕâÑù£º
Runtime.getRuntime().exec("ls");
µ«ÊÇÕâÑùÖ´ÐÐʱûÓÐÈκÎÊä³ö£¬ÔÒò£º
µ÷ÓÃRuntime.exec·½·¨½«²úÉúÒ»¸ö±¾µØµÄ½ø³Ì,²¢·µ»ØÒ»¸öProcess×ÓÀàµÄʵÀý£¬
£¨×¢Ò⣺Runtim ......