dom4j¶Ôxml±È½ÏÍêÕûµÄ²Ù×÷
×î½üдµÄ²å¼þÓõ½ÁËdom4j£¬À´¶Áд£¬ÐÞ¸ÄÎĵµ¡£Óõ½µÄ¹¦Äܶ¼Ð´³öÀ´ÁË
ÏÂÃæ°üº¬ÁËÁ½¸ö³ÌÐò WriteFriendsInfo£¬ºÍ ReadFriendsInfo¡£
1.WriteFriendsInfo °üº¬ÁËн¨xmlºÍÐ޸ģ¬É¾³ýxml½ÚµãµÄ·½·¨
һЩҪµã£º
WriteFriendsInfo ÖÐÐ޸Ľڵã²ÉÓõķ½Ê½ÊÇɾ³ý½Úµã£¬È»ºó°ÑеĽڵãд½øÈ¥¡£ÔÚ²»¶Ô¶ÁдҪÇóºÜ´óµÄÇé¿öÏ£¬ÕâÑù×ö±È½Ï¼òµ¥¡£
»¹ÓоÍÊÇÖÐÎĵĶÁдÎÊÌ⣺
дÈë´øÖÐÎÄµÄ Document µ½xmlÎı¾
OutputFormat format = OutputFormat.createPrettyPrint();
format.setEncoding("UTF-8");
output = new XMLWriter(new FileWriter(new File("/kb2.xml")),format);
¶Á´øÖÐÎĵÄxmlÎı¾£º
ÎÒÔÀ´ÊÇÕâôдµÄ£ºdocument = saxReader.read(new File("/kb2.xml"));
½á¹ûÒ»Óöµ½ÖÐÎľͱ¨´í£¬ÓÃFileReader¿ÉÒÔÃâÈ¥ºÜ¶à×Ö·ûÎÊÌ⣺
FileReader fr= new FileReader(new File("/kb2.xml"));
document = saxReader.read(fr);
2.ReadFriendsInfo µÄ×÷ÓÃÊǶÁxmlÊý¾Ý·ÅÈë×Ô¶¨ÒåµÄÊý¾Ý½á¹¹¡£
¶Á½ÚµãºÜ¼òµ¥³ä·ÖÌåÏÖÁË dom4jµÄÖÇÄÜ»¯
package com.soulnew.netbeansmessage;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.XMLWriter;
import java.io.*;
import java.util.Iterator;
import java.util.List;
import org.dom4j.io.OutputFormat;
public class WriteFriendsInfo{
String filename="/kb2.xml";
public void setFilename(String filename) {
&nbs
Ïà¹ØÎĵµ£º
Integration with the XML Data Type
With the introduction of the XML data type, we wanted to also give FOR XML the ability to generate an instance of XML directly (more precisely, it generates a single row, single column rowset where the cell contains the XML data type instance).
Because of the bac ......
package test;
import java.util.ArrayList;
import java.util.List;
import org.nuxeo.common.xmap.annotation.XNode;
import org.nuxeo.common.xmap.annotation.XNodeList;
import org.nuxeo.common.xmap.annotation.XObject;
/**
* Book ʵÌå¶ÔÏ󣬴˴¦ÓÃXMap×¢½â
* @author Administra ......
µ±Äã½âÎöXMLʱ£¬ÊÇ·ñ»áÒòΪÃüÃû¿Õ¼äµÄ´æÔÚ¶ø²»Äܵó¥ËùÔ¸ÄØ£¿
java·½Ã棬ºÃ¶àÈËÍÆ¼öÓÃdom4j´¦Àíxml£¬ÎÒÒ²¾Í˵˵ÔÚdom4jÉÏ´¦Àí´øÃüÃû¿Õ¼äµÄxml
xml´úÂëexample: ÔÙ˵ǰÈýÖÖ·½·¨£¬Ò²ÊÇ´ÓÍøÉÏ¿´À´µÄ¡£http://www.cnblogs.com/patrickchen/articles/1188920.html
D: eport.css
µÚÒ»¸ö·½°¸.ÉèÖÃÄãµÄxpathµÄÃüÃû¿Õ¼äsetNamesp ......
×Ý×ø±êºº×Ö˵Ã÷ yAxisName='̨' rotateYAxisName='0'
FusionCharts µÄ XML±êÇ©ÊôÐÔÓÐÒ»ÏÂËÄÖÖÊý¾ÝÀàÐÍ
* Boolean - ²¼¶ûÀàÐÍ£¬Ö»ÄÜΪ1»òÕß0¡£ÀýÈ磺<graph showNames=’1′ >
* Number - Êý×ÖÀàÐÍ£¬Ö»ÄÜΪÊý×Ö¡£ÀýÈ磺<graph yAxisMaxValue=’200′ >
* String - ×Ö·û´®ÀàÐÍ£¬Ö ......
Ò»¸öxmlÎļþµÄÀý×Ó¡¡¡¡ÏÖÔÚÎÒÃÇÔÝÇÒʹÓÓ¼Çʱ¾”À´´´½¨ÎÒÃǵÄxmlÎļþ°É¡£ÏÈ¿´Ò»¸öxmlÎļþ£º
¡¡¡¡Àý1
¡¡¡¡——————————————————————
¡¡¡¡¡´?xml version="1.0" encodin ......