JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó
JAVA²Ù×÷XMLµÄÍêÕûÀý×Ó——W3C DOM
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);
&n
Ïà¹ØÎĵµ£º
ǰÑÔ
XMLÔ½À´Ô½ÈÈ£¬¹ØÓÚXMLµÄ»ù´¡½Ì³ÌÍøÂçÉ ......
package cn.com.xml.vo;
public class RosterVo {
private String id; //ѧºÅ
private String name; //ѧÉúÐÕÃû
private String age; //ÄêÁä
private String skill; //¿ÆÄ¿ ......
1.ÕýÔò±í´ïʽ½á¹¹¼ò½é£º
С֪ʶ£º{}¡¡¶¨ÒåÁËÒ»¸ö·¶Î§¡¡ [] ¶¨ÒåÁËÒ»¸ö×Ö·ûÀà¡¡() ¶¨ÒåÁËÒ»¸ö×é
*Ç°Ãæ³öÏÖ0´ÎÒÔÉÏ +¡¡Ç°ÃæÆ¥ÅäÒ»´ÎÒÔÉÏ¡¡?Ç°Ãæ³öÏÖ0´Î»òÒ»´Î
1).×Ö·û£º
x------×Ö·ûx
\\-----·´Ð±¸Ü
\0n----Ê®½øÖÆÊý (0 <= n <= 7)
\0nn---Ê®½øÖÆÊý0nn (0 <= n <= 7)
\0mnn--Ê®½øÖÆÊý ......
1. ¸ÅÊö
±¾ÎÄÖ÷Òª°üÀ¨ÒÔϼ¸¸ö·½Ã棺±àÂë»ù±¾ÖªÊ¶£¬java£¬ÏµÍ³Èí¼þ£¬url£¬¹¤¾ßÈí¼þµÈ¡£
ÔÚÏÂÃæµÄÃèÊöÖУ¬½«ÒÔ"ÖÐÎÄ"Á½¸ö×ÖΪÀý£¬¾²é±í¿ÉÒÔÖªµÀÆäGB2312±àÂëÊÇ"d6d0 cec4"£¬Unicode±àÂëΪ"4e2d 6587"£¬UTF±àÂë¾ÍÊÇ"e4b8ad e69687"¡£×¢Ò⣬ÕâÁ½¸ö×ÖûÓÐiso8859-1±àÂ룬µ«¿ÉÒÔÓÃiso8859-1±àÂëÀ´"±íʾ"¡£
2. ±àÂë»ù±¾ÖªÊ ......
Here is a simple library to query Google Maps with the following features:
geocode addresses to their geographic coordinates
retrieve static images with given custom size, format and zoom
To see a live sample of this API, you can check here: Java ME Google Maps API sample MIDlet
Contents
[h ......