g¹ØÓÚDOM4JµÃµ½xmlÎĵµÖеĸú½ÚµãÏÂÀ´Ò»¸ö×Ó½Úµã....
Java code:
import org.dom4j.*;
import java.io.*;
import org.dom4j.io.*;
public class CreateXML {
public static void main(String[] args) {
//´´½¨¿ÕÎĵµ
Document document = DocumentHelper.createDocument();
//Ìí¼Ó¸ùÔªËØ
Element eleCakes = DocumentHelper.createElement("cakes");
document.setRootElement(eleCakes);
//Ìí¼Ó×ÓÔªËØ
Element eleCake1 = eleCakes.addElement("cake");
Element eleName1 = eleCake1.addElement("name");
Element elePrice1 = eleCake1.addElement("price");
//Ìí¼ÓÔªËØÄÚÈÝ
eleName1.addText( "ÇÉ¿ËÁ¦µ°¸â" );
elePrice1.addText("45.0");
//Ìí¼ÓÊôÐÔ
eleCake1.addAttribute("code", "B01");
//Ìí¼Ó×ÓÔªËØ
Element eleCake2 = eleCakes.addElement("cake");
Element eleName2 = eleCake2.addElement("name");
Element elePrice2 = eleCake2.addElement("price");
//Ìí¼ÓÔªËØÄÚÈÝ
eleName2.addText("±ùä¿Áܵ°¸â");
elePrice2.addText("50.0");
//Ìí¼ÓÊôÐÔ
eleCake2.addAttribute("code", "B02");
/*±£´æÎĵµ*/
OutputFormat format = OutputFormat.c
Ïà¹ØÎÊ´ð£º
ÔÚ¿´Ò»¶ÎAS´úÂëʱÓöµ½¼¸¸öÒÉÎÊ¡£
ÔÚFlashÖеÄXML¶ÔÏóÃ²ËÆÓÐÒ»¸öchildÊôÐÔ
ÇëÎÊ
1.childÊôÐÔºÍchildNodesÓÐÊ²Ã´Çø±ð£¿
2.ASÖÐÓÐintÊý¾ÝÀàÐÍÂð£¿AS3.0ÖÐÓÐÂð£¿
´úÂëÖÐÓõ½ÁË´ËÀàÐÍ¡£
3._name¡¢_pare ......
DataSetµ¼³öxml Åú´¦Àí(Ñ»·)µÃÔõô´¦Àí
XMLÎļþ
<A>
<B>
<C>
</C>
&nb ......
ÒÔÏ´úÂëÔÚIEÏÂÊÇ¿ÉÒÔÕý³££¬µ«ÊÇÓÃNETBOX·â×°¾Í²»ÐÐÁË£¬ÔËÐе½ºìÉ«µÄµØ·½¾Í³ö´íÁË£¬ËµÈ±ÉÙ¶ÔÏñ£¬ÇëÎÊÔõôÑùÐ޸ġ£
JScript code:
//////////////////// AJAXÀà////////////////
function getxml ......
RT
ÓÐûÓÐÔ´ÂëʵÀý£¡
лл£¡
²»ÊÇÓÐdom4jÕâÑùµÄ½âÎöxmlÎļþµÄ°üô ¸ÉÂï·ÇÒªÓÃÕýÔò£¿
Êܲ»ÁË£¡
Ã²ËÆ²»ÐаÉ
ÓУ¬ºÃ¼¸¸öÄØ£¬DOM,jdom£¬dom4j¡£¡£
¹þ¹þ£¡
ÓÉÓÚÎÒµÄxml±àÂë¸ñʽÓеãÎÊÌ⣬² ......