易截截图软件、单文件、免安装、纯绿色、仅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解析



 
使用SAX解析和DOM解析的实例
收藏



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

XML增\删、改、查简单操作

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

xml解析多重节点

xml为:
<friendShares>
<totalCount>352</totalCount>
<friendShare>
<code>XXXXXXX</code>
<date>2010-01-15T00:00:00+08:00</date>
<friendId>499</friendId>
<movie>
<code>XXXXXX</code>
<contentId>89718</content ......

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号