JavaÉú³ÉXMLµÄËõ½øºÍ»»ÐÐ
Ò» DOM ÒÔÏ´úÂëÓÃDOMÊÇÉú³ÉÒ»¸öXMLÎĵµ
package xml;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Transformer;
import javax.xml.transform.TransformerConfigurationException;
import javax.xml.transform.TransformerException;
import javax.xml.transform.TransformerFactory;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
public class XMLHandler {
public void createXML() throws FileNotFoundException {
Document doc = null;
DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
try {
DocumentBuilder docBuilder = dbf.newDocumentBuilder();
doc = docBuilder.newDocument();
Element root = doc.createElement("root");
doc.appendChild(root);
Element country = doc.createElement("contry");
country.appendChild(doc.createTextNode("China"));
root.appendChild(country);
Element city = doc.createElement("city");
city.appendChild(doc.createTextNode("Beijing"));
country.appendChild(city);
city = doc.createElement("city");
city.appendChild(doc.createTextNode("Shanghai"));
country.appendChild(city);
TransformerFactory tf = TransformerFactory.newInstance();
Transformer transformer = tf.newTransformer();
File file = new File("E://cities.xml");
FileOutputStream out = new FileOutputStream(file);
StreamResult xmlResult = new StreamResult(out);
transformer.transform(new DOMSource(doc), xmlResult);
} catch (ParserConfigurationException e) {
e.printStackTrace();
} catch (TransformerConfigurationException e) {
e.printStackTrace();
} catch (TransformerException e) {
e.printStackTrace();
} catch (FileNotFoundException e) {
e.printStackTrace();
th
Ïà¹ØÎĵµ£º
import java.io.*;
public class TestMusic{
private AudioFormat format;
private byte[] samples;
public static void main(String args[])throws Exception{
TestMusic sound =new TestMusic("1.wav");
InputStream stream =new ByteArrayInputStre ......
×¢Ò⣬Çë²»Òª±»ÎÒÎóµ¼£¬ÎÒûÓп´ÆäËû×ÊÁÏ£¬ÕâÊÇÎÒ×Ô¼º·ÖÎöµÄ£¬ÓÐЩ¿ÉÄÜÊDz»¶ÔµÄ
"DestroyJavaVM" prio=6 tid=0x00316800 nid=0x448 waiting on condition [0x00000000
..0x00a0fd4c]
java.lang.Thread.State: RUNNABLE
"Thread-1" prio=6 tid=0x02f85000 nid=0xd18 waiting for m ......
“Éϵ۸³ÓèÈËÀà˵»°µÄÄÜÁ¦£¬¶øÑÔÓïÓÖ´´ÔìÁË˼Ï룬˼ÏëÊÇÈËÀà¶ÔÓîÖæµÄÁ¿¶È¡£”
¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡——Õª×Ô¡¶Prometheus Unbound¡·£¬Shelley
? ÈËÀà……¼«ÆäÊÜÄÇЩÒѾ³ÉΪÉç»á±í´ï¹¤¾ßµÄÌض¨ÓïÑÔµÄÖ§Åä¡£ÏëÏñһϣ¬Èç¹ûÒ»¸öÈË¿ÉÒÔ²»Ê¹ÓÃÓïÑÔ¾ÍÄܹ»´Ó±¾ÖÊÉÏÊÊÓ¦ÏÖÊµÊ ......
Design Patterns in Java
-----------------------------------------
Steven John Metsker
William C.Wake
-----------------------------------------
¹¨²¨µÈÒë
££££££££Ò»¡¢¶þÕ¶ÁÊé¼Ç¼££££££
ģʽÊǼ¯ÌåÖǻ۵Ľᾧ¡£Ëü¸ø³öÁËÏà¹ØÐÐÒµÖоÑé·á¸»µÄ´ÓÒµÕßËùÓ¦ÓõÄËùÓеĸÅÄîºÍ·½ ......