Ò׽ؽØͼÈí¼þ¡¢µ¥Îļþ¡¢Ãâ°²×°¡¢´¿ÂÌÉ«¡¢½ö160KB

¡¾×ª¡¿+¡¾¸Ä¡¿DOM4J´¦ÀíXML´øÓÐÃüÃû¿Õ¼äµÄËÄÖÖ·½·¨

µ±Äã½âÎöXMLʱ£¬ÊÇ·ñ»áÒòΪÃüÃû¿Õ¼äµÄ´æÔÚ¶ø²»Äܵó¥ËùÔ¸ÄØ£¿
java·½Ã棬ºÃ¶àÈËÍƼöÓÃdom4j´¦Àíxml£¬ÎÒÒ²¾Í˵˵ÔÚdom4jÉÏ´¦Àí´øÃüÃû¿Õ¼äµÄxml
xml´úÂëexample: ÔÙ˵ǰÈýÖÖ·½·¨£¬Ò²ÊÇ´ÓÍøÉÏ¿´À´µÄ¡£http://www.cnblogs.com/patrickchen/articles/1188920.html
D: eport.css
µÚÒ»¸ö·½°¸.ÉèÖÃÄãµÄxpathµÄÃüÃû¿Õ¼äsetNamespaceURIs
1: public class TransferXML { 2: public static void main(String[] args) throws Exception{ 3: Map map = new HashMap(); 4: map.put("design","http://www.eclipse.org/birt/2005/design"); 5: SAXReader saxReader = new SAXReader(); 6: File file = new File("D:\test.xml"); 7: Document document = saxReader.read(file); 8: XPath x = document.createXPath("//design:list-property"); 9: x.setNamespaceURIs(map); 10: List nodelist = x.selectNodes(document); 11: System.out.println(nodelist.size()); 12: } 13: }
µÚ¶þ¸ö½â¾ö·½°¸:ÉèÖÃÄãµÄDocumentFactory()µÄÃüÃû¿Õ¼ä setXPathNamespaceURIs
1: public class TransferXML { 2: public static void main(String[] args) throws Exception{ 3: Map map = new HashMap(); 4: map.put("design","http://www.eclipse.org/birt/2005/design"); 5: SAXReader saxReader = new SAXReader(); 6: File file = new File("D:\test.xml"); 7: saxReader.getDocumentFactory().setXPathNamespaceURIs(map); 8: Document document = saxReader.read(file); 9: List tmp = document.selectNodes("//design:list-property"); 10: System.out.println(tmp.size()); 11: } 12: }
µÚÈýÖÖ·½·¨£º±¾ÈËÓõģ¬×ҲÊÇ×îͨÓõķ½·¨£¬¾ÍÊDz»Ê¹Óÿª·¢»·¾³¸øÄãÌṩµÄһϵÁжÔÏ󣬶øÊÇÓÃXPathÓï·¨ÖÐ×Ô´øµÄlocal-name() ºÍ namespace-uri() Ö¸¶¨ÄãҪʹÓõĽڵãÃûºÍÃüÃû¿Õ¼ä¡£
µ±ÄãÓöµ½Ê¹ÓÃxsltÀ´Ñùʽ»¯xmlʱ£¬¾ÍÖªµÀÕâ¸ö±¿·½·¨µÄºÃ´¦ÁË£º
1: public class TransferXML { 2: public static void main(String[] args) throws Exception 3: SAXReader saxReader = new SAXReader(); 4: File file = new File("D:\test.xml")


Ïà¹ØÎĵµ£º

¹ØÓÚXMLÖÐ×Ö½ÚдÈëÁ÷×Ö¶ÎʱµÄ˵Ã÷

·½·¨Ò»£º
      ²ÉȡͨÓõÄbase64±àÂ뷽ʽ£¬È¡Ê±½âÂë´æʱ¼ÓÂë¡£
ëÀÏʦÌṩÁËÍêÕûµÄ±àÂë´úÂ룬ÇÒЧÂʺܸߡ£
unit Base64;

interface

uses SysUtils, Classes;

type
{$IFDEF UNICODE}
Base64String = AnsiString;
{$ELSE}
Base64String = strin ......

Jdom ¶ÁÈ¡ xmlÎļþÀý×Ó


Jdom
¶ÁÈ¡
xml
ÎļþÀý×Ó
1.         
ÓÃ
JDOM
¶ÁÈ¡
XML
ÎļþÐèÏÈÓÃ
org.jdom.input.SAXBuilder
¶ÔÏóµÄ
build()
·½·¨´´½¨
Document
¶ÔÏó
,
È»ºóÓÃ
Document
Àà¡¢
Element
ÀàµÈµÄ·½·¨¶ÁÈ¡
1.
Sample1.java
import
java.util.*;
import
org.j ......

XMLÈëÞ«½âÖ®DTD Îļþ¸ñʽ¶¨Òå(XML DTD)

¡¡¡¡DTDʵ¼ÊÉÏ¿ÉÒÔ¿´×÷Ò»¸ö»ò¶à¸öXMLÎļþµÄÄ£°å£¬ÕâЩXMLÎļþÖеÄÔªËØ¡¢ÔªËصÄÊôÐÔ¡¢ÔªËصÄÅÅÁз½Ê½/˳Ðò¡¢ÔªËØÄܹ»°üº¬µÄÄÚÈݵȣ¬¶¼±ØÐë·ûºÏDTDÖеĶ¨Òå¡£XMLÎļþÖеÄÔªËØ£¬¼´ÎÒÃÇËù´´½¨µÄ±ê¼Ç£¬ÊǸù¾ÝÎÒÃÇÓ¦ÓõÄʵ¼ÊÇé¿öÀ´´´½¨µÄ¡£ÏëÒª´´½¨Ò»·ÝÍêÕûÐԸߡ¢ÊÊÓ¦ÐÔ¹ãµÄDTDÊǷdz£À§Äѵģ¬ÒòΪ¸÷Ðи÷Òµ¶¼ÓÐËûÃÇ×Ô¼ºµÄÐÐÒµÌص㣠......

DataSet¡¢Excel¡¢XMLÖ®¼äµÄµ¼Èëµ¼³ö

class ImportExportToExcel
{
public class ImportExportToExcel
{
private string strConn;
private System.Windows.Forms.OpenFileDialog openFileDlg = new System.Windows.Forms.OpenFileDialog();
private System.Windows.Forms.SaveFileDialog saveFi ......

xmlºÍjava BeanµÄÖ±½Óת»»£¬Xmap

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 ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ