string xml="<?xml version="1.0" encoding="ISO-8859-1"?>"
xml+= "<AddressBean>"
..FileWriter fw=new FileWriter("yourxmlfile.xml");
fw.write(xml);
fw.flush();

解决方案 »

  1.   

    推荐一本书<java 与 xml>第二版 oreilly出版。在java中操作xml文档有许多种方法.可以用最基本的api,如sax ,dom等等,也可以用诸如jdo这种封装好的方法。
      

  2.   

    try jdom from www.jdom.org,easy way to control xml.
      

  3.   

    写xml主要2种方法DOM 以及 JDOM(jdom比较简单)
    读xml除了以上2中方法 还可以用SAX
    楼上推荐的java&xml2nd 不错 网上有下载
      

  4.   

    另外我问一下,我可以把soap消息打印出来后发现,它是以String形式打印的?结果如下:
    run-test-client:
         [echo] Running the com.sun.cb.TestPriceListRequest program:
         [echo]
         [java] <soap-env:Envelope xmlns:soap-env="http://schemas.xmlsoap.org/soap/e
    nvelope/"><soap-env:Header></soap-env:Header><soap-env:Body><PriceList:price-lis
    t xmlns:PriceList="http://sonata.coffeebreak.com"><coffee><coffee-name>Arabica</
    coffee-name><price>4.50</price><coffee-name>Espresso</coffee-name><price>5.00</p
    rice><coffee-name>Dorada</coffee-name><price>6.00</price><coffee-name>House Blen
    d</coffee-name><price>5.00</price></coffee></PriceList:price-list></soap-env:Bod
    y></soap-env:Envelope>
    现在我想是显示打印Soap里面Body的信息,然后生成一个.xml文件,应该用什么做阿?