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

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

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

    posts - 165, comments - 198, trackbacks - 0, articles - 1
      BlogJava :: 首頁 :: 新隨筆 :: 聯系 :: 聚合  :: 管理

    java xml basex 數據庫

    Posted on 2008-06-04 16:04 G_G 閱讀(1760) 評論(0)  編輯  收藏 所屬分類: xml RelatedjavaGeneral
    官方:
    BaseX Logo
    eg:xquery使用
    import?org.basex.core.Commands;
    import?org.basex.core.proc.Proc;
    import?org.basex.data.Result;
    import?org.basex.io.ConsoleOutput;
    import?org.basex.query.QueryException;
    import?org.basex.query.QueryProcessor;
    import?org.basex.query.xquery.XQueryProcessor;

    /**
    ?*?This?class?serves?an?example?for?executing?XQuery?requests.
    ?
    */
    public?final?class?XQueryExample?{
    ??
    /**?Sample?query.?*/
    ??
    private?static?final?String?XMLFILE?=?XPathExample.class.getClassLoader().getSystemResource(
    ??????????????
    "xx.xml"
    ?????????).getPath();
    ??
    ??
    ??
    private?static?final?String?QUERY?=?"?for?$x?in?doc('"+XMLFILE+"')//property?"?+
    ??????????????????????????????????????????????
    "?return?<child>{data($x/@name)}</child>";

    ??
    /**?Private?constructor.?*/
    ??
    private?XQueryExample()?{?}
    ??
    /**
    ???*?Main?method?of?the?example?class.
    ???*?
    @param?args?(ignored)?command-line?arguments
    ???*?
    @throws?Exception?exception
    ???
    */
    ??
    public?static?void?main(final?String[]?args)?throws?Exception?{

    ????
    //?FIRST?EXAMPLE:
    ????System.out.println("First?example:");

    ????
    //?create?standard?output?stream
    ????final?ConsoleOutput?out?=?new?ConsoleOutput(System.out);

    ????
    //?Create?a?BaseX?process
    ????final?Proc?proc?=?Proc.get(Commands.XQUERY,?QUERY);
    ????
    //?launch?process
    ????if(proc.execute())?{
    ??????
    //?successful?execution:?print?result
    ??????proc.output(out);
    ????}?
    else?{
    ??????
    //?execution?failed:?print?result
    ??????proc.info(out);
    ????}
    ????out.flush();
    ????System.out.println();
    ????
    ????
    //?SECOND?EXAMPLE?(ALTERNATIVE):
    ????System.out.println("Second?example:");

    ????
    //?Execute?XQuery?request
    ????try?{
    ??????
    //?create?query?instance
    ??????final?QueryProcessor?xquery?=?new?XQueryProcessor(QUERY);
    ??????
    //?execute?query;?no?initial?context?set?is?specified?(null)
    ??????final?Result?result?=?xquery.query(null);
    ??????
    //?print?output
    ??????result.serialize(out,?false);
    ??????out.println();
    ????}?
    catch(final?QueryException?e)?{
    ??????
    //?dump?stack?trace
    ??????e.printStackTrace();
    ????}

    ????
    //?close?output?stream
    ????out.close();
    ??}
    }


    結果:
    First?example:
    <child>connection.datasource</child>
    <child>dialect</child>
    <child>show_sql</child>
    <child>hibernate.cache.provider_class</child>
    <child>cache.use_query_cache</child>

    Second?example:
    <child>connection.datasource</child>
    <child>dialect</child>
    <child>show_sql</child>
    <child>hibernate.cache.provider_class</child>
    <child>cache.use_query_cache</child>


    數據來源:
    xx.xml
    <?xml?version='1.0'?encoding='utf-8'?>

    <hibernate-configuration>

    ????
    <session-factory>

    ????????
    <property?name="connection.datasource">java:comp/env/jdbc/USERPORTAL1</property>
    ????????
    <property?name="dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
    ?????????
    <property?name="show_sql">true</property>
    ?????????
    <property?name="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</property>
    ?????????
    <property?name="cache.use_query_cache">true</property>
    ????
    <!--?JDBC?connection?pool?(use?the?built-in)?-->

    ????
    </session-factory>

    </hibernate-configuration>


    主站蜘蛛池模板: 免费在线观看自拍性爱视频| 久久精品国产99国产精品亚洲| 男人扒开添女人下部免费视频| 大陆一级毛片免费视频观看| 亚洲欧美日韩综合久久久久| 国产精品69白浆在线观看免费| 亚洲三级在线免费观看| 97性无码区免费| 亚洲国产成人久久综合| 免费在线观看的黄色网址| 乱淫片免费影院观看| 亚洲精品午夜无码专区| 一级毛片成人免费看免费不卡| 亚洲视频一区二区三区| 四虎国产精品免费久久| 男性gay黄免费网站| 中文字幕不卡亚洲 | 三级网站免费观看| 亚洲成人在线网站| 无码永久免费AV网站| 视频一区二区三区免费观看| 伊伊人成亚洲综合人网7777| 嫩草成人永久免费观看| 久久精品国产99国产精品亚洲| xvideos亚洲永久网址| 国产成年无码久久久免费| 亚洲精品中文字幕无乱码| 免费观看男人免费桶女人视频| 一级成人毛片免费观看| 亚洲精品高清视频| 色视频色露露永久免费观看| WWW免费视频在线观看播放| 亚洲视频日韩视频| 无码不卡亚洲成?人片| 久久大香香蕉国产免费网站| 亚洲熟女乱色一区二区三区| 亚洲人成在线播放网站| 成人a免费α片在线视频网站| 丰满人妻一区二区三区免费视频| 亚洲成人福利在线| 国产亚洲日韩一区二区三区|