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

grails½âÎöxmlÎļþ

xmlÎļþ£º
<?xml version="1.0" encoding="iso-8859-1"?>
<Products>
    <product>
        <name>lovechoosesun</name>
        <buyNowURL>http://merch.danecook.com/ProductDetails.asp?ProductCode=DC101</buyNowURL>
        <imageUrl>http://merch.danecook.com/v/vspfiles/photos/DC101-1.jpg</imageUrl>
        <status>ACTIVE</status>
        <description>desc1</description>
        <price>12.0</price>
        <dateCreated>2009-12-30 14:07:46</dateCreated>
        <lastUpdated>2009-12-30 14:07:46</lastUpdated>
    </product>
    <product>
        <name>zhaoweisun</name>
        <buyNowURL>http://merch.danecook.com/ProductDetails.asp?ProductCode=DC101</buyNowURL>
        <imageUrl>http://merch.danecook.com/v/vspfiles/photos/DC101-1.jpg</imageUrl>
        <status>ACTIVE</status>
        <description>desc2</description>
        <price>13.5</price>
        <dateCreated>2009-12-30 14:07:46</dateCreated>
        <lastUpdated>2009-12-30 14:07:46</lastUpdated>
    </product>
</Products>
action£º
  def saveRealGifts = {
    def products = new XmlParser().parse("Products.xml"


Ïà¹ØÎĵµ£º

xml¾«Ñ¡

XML(eXtensible Markup Language)ÊÇÍòÎ¬ÍøÁªÃË(World Wide Web Consortium W3C)¶¨ÒåµÄÒ»ÖÖ¿ÉÀ©Õ¹±êÖ¾ÓïÑÔ¡£
    ¿ÉÀ©Õ¹ÐÔÖ¸ÔÊÐíÓû§°´ÕÕXML¹æÔò×Ô¶¨Òå±ê¼Ç(tags ±êÇ©)¡£
Ç¿ÏÇáËɱí´ï¶à²ã½á¹¹µÄÊý¾Ý£»¿ÉÀ©Õ¹¡£
Óŵ㣺ƽ̨Î޹أ¬ÓïÑÔÎ޹ء£Éè¼ÆÄ¿±êÊÇÃèÊöÊý¾Ý²¢¼¯ÖÐÓÚÊý¾ÝµÄÄÚÈÝ£¬ÓëÏÔʾ·ÖÀë¡£
ÌáÐÑ£º² ......

XMLÔö\ɾ¡¢¸Ä¡¢²é¼òµ¥²Ù×÷

  protected void Page_Load(object sender, EventArgs e)
    {
        lblValue.Text = string.Format("{0:N}", 2500000);
        lblValue.Text = string.Format("{0:C3}", 2);
       ......

ʹÓÃTinyXml½âÎöXmlʾÀý

// TestXml.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <iostream>
#include <windows.h>
#include "tinyxml.h"
#include "lang.h"
#include <string>
using namespace std;
using namespace std;
#pragma comment(lib, "tinyxmld.lib")
B ......

Spring XMLÅäÖõÄ12¸ö¼¼ÇÉ

SpringÊÇÒ»¸öÇ¿ÓÐÁ¦µÄjava³ÌÐò¿ò¼Ü£¬Æä±»¹ã·ºÓ¦ÓÃÓÚjavaµÄ³ÌÐòÖС£ËüÓÃPOJOÌṩÁËÆóÒµ¼¶·þÎñ¡£SpringÀûÓÃÒÀÀµ×¢Èë¿ÉÒÔ»ñµÃ¼òµ¥¶øÓÐЧµÄ²âÊÔÄÜÁ¦¡£Spring beans£¬ÒÀÀµ¹ØÏµ£¬ÒÔ¼°·þÎñËùÐèÒªµÄbean¶¼½«ÔÚÅäÖÃÎļþÖÐÓèÒÔÃèÊö£¬ÅäÖÃÎļþÒ»°ã²ÉÓÃXML¸ñʽ¡£È»¶øXMLÅäÖÃÎļþÈß³¤¶ø²»Ò×ʹÓã¬ÔÚÄã½øÐÐÒ»¸öʹÓÃÁË´óÁ¿beanµÄ´óÏîÄ¿ÖÐËü ......

XStream xml json ת»»

1¡¢Ê×ÏÈÏÂÔØ xstream.jarºÍjettison.jar£¨×ª»»ÎªjsonʱÓõ½£©£¬²¢ÒýÈë¸Ã°ü¡£
2¡¢¿´ÈçÏ´úÂë°É£º
import java.io.File;
import java.io.IOException;
import org.apache.commons.io.FileUtils;
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.json.JettisonMappedXmlDriver;
import c ......
© 2009 ej38.com All Rights Reserved. ¹ØÓÚE½¡ÍøÁªÏµÎÒÃÇ | Õ¾µãµØÍ¼ | ¸ÓICP±¸09004571ºÅ