<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亚洲视频| 在线美女免费观看网站h| 日韩一级视频免费观看| 亚洲最大中文字幕无码网站| 国产一卡2卡3卡4卡2021免费观看| 亚洲视频一区调教| 最近中文字幕高清免费中文字幕mv| 亚洲成a人片在线观看无码 | 亚洲视频在线播放| 亚洲成人免费在线观看| 亚洲无限乱码一二三四区| 久久午夜免费视频| 亚洲日韩一区精品射精| 永久中文字幕免费视频网站| 亚洲av成本人无码网站| 亚洲中文字幕视频国产| 免费91最新地址永久入口 | 久久免费视频99| 亚洲国产情侣一区二区三区| 免费av欧美国产在钱| 日本亚洲中午字幕乱码| 亚洲国产一成久久精品国产成人综合 | 精品国产免费一区二区三区| 亚洲精品乱码久久久久久自慰| 午夜免费啪视频在线观看| 亚洲人成在线播放| 精品免费国产一区二区| 人妖系列免费网站观看| 亚洲综合综合在线| 国产猛烈高潮尖叫视频免费| 一区免费在线观看| 99亚洲精品高清一二区| 日韩免费一级毛片| 3344在线看片免费| 亚洲综合偷自成人网第页色| 免费成人黄色大片| 99re热精品视频国产免费| 亚洲AV成人一区二区三区观看| 亚洲乱亚洲乱妇无码麻豆| 成人无码区免费A片视频WWW| 一级毛片成人免费看a|