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


    主站蜘蛛池模板: 日韩国产精品亚洲а∨天堂免| 免费中文字幕在线观看| 亚洲国产精品尤物YW在线观看| 内射无码专区久久亚洲| 亚洲fuli在线观看| 日本免费高清视频| 亚洲色婷婷六月亚洲婷婷6月| 激情小说亚洲色图| 永久久久免费浮力影院| 亚洲综合一区二区| 久久精品视频免费| 国产美女精品久久久久久久免费| 亚洲偷自精品三十六区| 久久福利资源网站免费看| 亚洲AV无码欧洲AV无码网站| 99久久免费国产精品热| 亚洲最大AV网站在线观看| 亚洲视频在线免费| 亚洲精品无码永久在线观看| 黄色a三级免费看| 免费a级毛片18以上观看精品| 亚洲av无码专区青青草原| 妞干网在线免费视频| 久久久久久亚洲精品影院| 99在线视频免费观看视频 | 美女尿口扒开图片免费| 又粗又硬又黄又爽的免费视频| 亚洲欧洲AV无码专区| 日韩中文字幕在线免费观看| 亚洲乱色伦图片区小说| 国产精品美女自在线观看免费| 国产精品无码亚洲一区二区三区| 国产v片免费播放| 一区二区三区免费电影| 亚洲国产天堂在线观看| 好男人视频在线观看免费看片 | a级毛片在线免费看| 亚洲成人网在线播放| 亚洲av无码天堂一区二区三区 | 国内自产少妇自拍区免费| 国产精品99爱免费视频|