<rt id="bn8ez"></rt>
<label id="bn8ez"></label>

  • <span id="bn8ez"></span>

    <label id="bn8ez"><meter id="bn8ez"></meter></label>

    夢幻之旅

    DEBUG - 天道酬勤

       :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理 ::
      671 隨筆 :: 6 文章 :: 256 評論 :: 0 Trackbacks
    package test;

    import java.io.File;
    import java.io.FileOutputStream;
    import java.io.StringReader;
    import java.io.StringWriter;

    import javax.xml.bind.JAXBContext;
    import javax.xml.bind.Marshaller;
    import javax.xml.bind.Unmarshaller;
    import javax.xml.bind.annotation.XmlRootElement;

    @XmlRootElement
    public class HelloWorld {

      
    private String hello;
      
    private Integer world;

      
    public String getHello() {
        
    return hello;
      }


      
    public void setHello(String hello) {
        
    this.hello = hello;
      }


      
    public Integer getWorld() {
        
    return world;
      }


      
    public void setWorld(Integer world) {
        
    this.world = world;
      }


      
    public String toString() {
        
    return hello + "-" + world;
      }


      
    public static void main(String[] args) throws Exception {

        
    // Set up file and JAXB context
        final File file = new File("hello.xml");
        
        JAXBContext context 
    = JAXBContext.newInstance(HelloWorld.class);

        
    // Creates a HelloWorld object
        HelloWorld hw = new HelloWorld();
        hw.setHello(
    "Hello !!!");
        hw.setWorld(
    1234);

        
    // From a HelloWorld object creates a hello.xml file
        Marshaller m = context.createMarshaller();
        StringWriter sw 
    = new StringWriter();
        m.marshal(hw, sw);
        System.out.println(sw.toString());
        m.marshal(hw, 
    new FileOutputStream(file));

        
    // From the hello.xml file creates a HelloWorld object
        Unmarshaller um = context.createUnmarshaller();
        StringReader sr 
    = new StringReader(sw.toString());
        HelloWorld hw2 
    = (HelloWorld) um.unmarshal(sr);
        System.out.println(hw2);

      }

    }


    posted on 2010-09-25 18:25 HUIKK 閱讀(201) 評論(0)  編輯  收藏 所屬分類: Java
    主站蜘蛛池模板: 伊人久久大香线蕉免费视频| 日韩一级片免费观看| 国产好大好硬好爽免费不卡| 亚洲中文字幕丝袜制服一区| 精品成人一区二区三区免费视频| 美女被免费视频网站a国产| 亚洲av无码一区二区三区在线播放 | 黄色网站软件app在线观看免费| 亚洲精品无码99在线观看| 国产日韩久久免费影院| 亚洲成亚洲乱码一二三四区软件| 久久精品成人免费看| 亚洲六月丁香六月婷婷蜜芽| 免费一本色道久久一区| 亚洲AV性色在线观看| 亚洲女人被黑人巨大进入| 两个人日本免费完整版在线观看1 两个人的视频www免费 | 亚洲国产av一区二区三区| 岛国岛国免费V片在线观看| 亚洲精品美女久久久久99| 麻豆成人久久精品二区三区免费 | 国产精品无码一区二区三区免费 | 久久久久亚洲AV无码专区体验| 97在线视频免费播放| 亚洲码欧美码一区二区三区| 亚洲&#228;v永久无码精品天堂久久| yellow视频免费看| 2022年亚洲午夜一区二区福利| 成人免费无码大片a毛片| 一级毛片a免费播放王色电影| 亚洲A∨无码无在线观看| 免费看国产成年无码AV片| 日日摸夜夜添夜夜免费视频| 亚洲福利视频一区| 日产乱码一卡二卡三免费| 国产一级婬片A视频免费观看| 亚洲乱码卡三乱码新区| 久久久久亚洲AV成人网人人网站| 99久久人妻精品免费二区| 国产亚洲欧美在线观看| 亚洲av日韩av高潮潮喷无码|