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

Dom4j²Ù×÷XMLÎļþ дÎļþ

package com.beckham.dom;
import java.io.File;
import java.io.FileWriter;
import org.dom4j.Document;
import org.dom4j.DocumentHelper;
import org.dom4j.Element;
import org.dom4j.io.OutputFormat;
import org.dom4j.io.XMLWriter;
/**
* @author ×÷Õß<Beckham>
* Email:gaowm0207@gmail.com
* Jan 28, 2010 10:03:12 AM
* DOM4jдXMLÎļþ
*/
public class CreateXMLFile {
public static void main(String[] args)throws Exception {
createFile("src/com/beckham/dom/application.xml") ;
}

public static void createFile(String fileName) throws Exception{

Document document = DocumentHelper.createDocument() ;
//¸ù½Úµã
Element root = document.addElement("beans") ;
//¸ù½Úµã×¢ÊÍ
root.addComment("ÕâÊǸù½Úµã") ;

//µÚÒ»¸ö×Ó½Úµã
Element elementBean1 = root.addElement("bean") ;
elementBean1.addAttribute("id", "boy") ;
elementBean1.addAttribute("class", "com.beckham.spring.Boy") ;
Element elementProp = elementBean1.addElement("property") ;
elementProp.addAttribute("name", "user") ;
elementProp.addAttribute("ref", "com.beckham.User") ;

//µÚ¶þ¸ö×Ó½Úµã
Element elementBean2 = root.addElement("bean") ;
elementBean2.addAttribute("id", "girl") ;
elementBean2.addAttribute("class", "com.beckham.spring.Girl") ;
Element elementProp2 = elementBean2.addElement("property") ;
elementProp2.addAttribute("name", "user") ;
elementProp2.addAttribute("ref", "com.beckham.User") ;

//Ç°Ò»¸ö²ÎÊý±íʾËõ½ø4¸ö¿Õ¸ñ
OutputFormat format = new OutputFormat(" ",true) ;

format.setEncoding("GBK") ;
XMLWriter w = new XMLWriter(new FileWriter(new File(fileName)),format ) ;


w.write(document) ;
w.close() ;
}


<?xml version="1.0&qu


Ïà¹ØÎĵµ£º

XML CDATA

 
ÔÚXMLÎĵµÖеÄËùÓÐÎı¾¶¼»á±»½âÎöÆ÷½âÎö¡£
Ö»ÓÐÔÚCDATA²¿¼þÖ®ÄÚµÄÎı¾»á±»½âÎöÆ÷ºöÂÔ¡£
½âÎöÊý¾Ý
XML ½âÎöÆ÷ͨ³£Çé¿öÏ»ᴦÀíXMLÎĵµÖеÄËùÓÐÎı¾¡£
µ±XMLÔªËر»½âÎöµÄʱºò£¬XMLÔªËØÄÚ²¿µÄÎı¾Ò²»á±»½âÎö:
<message>This text is also parsed</message>
XML½âÎöÆ÷ÕâÑù×öµÄÔ­ÒòÊÇXMLÔªËØÄÚ²¿¿ÉÄÜ» ......

XML WebServiceÍêȫʵÀýÏêϸ½âÎö

Ê×ÏÈ,ÎÒÃDZØÐëÁ˽âʲôÊÇwebservice.¾Í¸ÅÄîÉÏÀ´Ëµ,¿ÉÄܱȽϸ´ÔÓ,²»¹ýÎÒÃÇ¿ÉÒÔÓиöºê¹ÛµÄÁ˽â:webservice¾ÍÊǸö¶ÔÍâµÄ½Ó¿Ú,ÀïÃæÓÐ º¯Êý¿É¹©Íⲿ¿Í»§µ÷ÓÃ(×¢Òâ:ÀïÃæͬÑùÓпͻ§²»¿Éµ÷Óõĺ¯Êý).¼ÙÈôÎÒÃÇÊÇ·þÎñ¶Ë,ÎÒÃÇдºÃÁ˸öwebservice,È»ºó°ÑËü¸øÁË¿Í»§(ͬʱÎÒÃǸøÁËËû Ãǵ÷ÓùæÔò),¿Í»§¾Í¿ÉÒÔÔÚ´Ó·þÎñ¶Ë»ñÈ¡ÐÅϢʱ´¦ÓÚÒ»¸öÏ ......

C++Öд¦ÀíXMLÎļþ

дUnmanaged CodeÔÚ.NETʱ´ú³ÉΪһÖֺܱ¯²ÒµÄÊ£¬µ±ÄãÐèÒª´¦ÀíXMLÎļþʱ£¬ÕâÖָоõ»á±äµÃÓÈÆäÇ¿ÁÒ¡£FCLÖеÄSystem.XML¶à¼òµ¥°¡£¬Á¬Steve Ballmer¶¼ÖªµÀÔõôÓá£
ÊÂÇé²»»á×ÜÊÇÄÇôÀíÏëµÄ£¬¼ÙÈçÄãÒªÔÚC/C++³ÌÐòÀï´¦ÀíXMLÔõô°ìÄØ£¿
Ñ¡ÔñÒ»£ºÊÐÃæÉϵÄXML lib»¹ÊÇÓм¸¸öµÄ£¬×îÓÐÃûµÄµ±È»ÊÇlibXML¡£ÎÒÒ»ÄêÇ°Óùý£¬ºÜ²»´í£¬ÎÒ»¹ ......

xml½âÎö



 
ʹÓÃSAX½âÎöºÍDOM½âÎöµÄʵÀý
ÊÕ²Ø



document.body.oncopy = function() {
if (window.clipboardData) {
s ......

java½âÎöxmlµÄ¾ßÌåÁ÷³Ì

java ´úÂë
import javax.xml.parsers.DocumentBuilder;   
import javax.xml.parsers.DocumentBuilderFactory;   
  
import org.w3c.dom.Document;   
import org.w3c.dom.Element;   
import org.w3c.dom.NodeList;    ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØͼ | ¸ÓICP±¸09004571ºÅ