<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>


    主站蜘蛛池模板: 国产成人午夜精品免费视频| 国产va在线观看免费| 国产大片线上免费观看| 图图资源网亚洲综合网站| 最近免费字幕中文大全| 久久国产亚洲精品麻豆| 成人无码WWW免费视频| 亚洲αv久久久噜噜噜噜噜| 99精品在线免费观看| 亚洲欧洲国产视频| 91在线品视觉盛宴免费| 亚洲AV无码专区在线电影成人| 久久精品无码一区二区三区免费 | 亚洲AV无码成人精品区狼人影院 | 久久久免费精品re6| 久久亚洲AV无码精品色午夜| 成年人网站免费视频| 一本色道久久88亚洲精品综合 | 亚洲AV无码成人网站久久精品大| 最近中文字幕大全免费版在线| 久久精品国产亚洲AV网站| 日韩免费无码一区二区三区| 亚洲一欧洲中文字幕在线| 免费高清资源黄网站在线观看| 老司机午夜精品视频在线观看免费| 亚洲AⅤ无码一区二区三区在线| 国产免费一区二区三区免费视频| 久久精品国产精品亚洲蜜月| 亚洲高清中文字幕免费| 精品特级一级毛片免费观看| 亚洲综合精品香蕉久久网| 精品国产免费人成电影在线观看| 亚洲第一成年免费网站| 丁香五月亚洲综合深深爱| **真实毛片免费观看| 美女啪啪网站又黄又免费| 亚洲精品无码不卡| 在线观着免费观看国产黄| 暖暖免费在线中文日本| 中文字幕 亚洲 有码 在线| 久久久久国产成人精品亚洲午夜|