有一个文件book.xml:
<books> <book> <name>The Call Of Wild</name> <author>Jack London</author> <price>32.5$</price> <date>2015-7-6</date> </book> <book> <name>Wuthering Heights</name> <author>Emily Bronte</author> <price>40$</price> <date>2015-7-5</date> </book> </books>
[root@localhost xuzhina]#se_cdb books Creating a database (this can take a few minutes)... The database 'books' has been created successfully
[root@localhost xuzhina]#se_sm books Starting database recovery or hot-backup restoration... Database is in consistent state. Starting... SM has been started in the background mode
[root@localhost xuzhina]#se_term -query "CREATE COLLECTION 'novel'" books UPDATE is executed successfully
[root@localhost xuzhina]#se_term -query "LOAD 'book.xml' 'book' 'novel'" books Bulk load succeeded
[root@localhost xuzhina]#se_term -query "for $p in collection('novel')/books return $p" book s <books> <book> <name>The Call Of Wild</name> <author>Jack London</author> <price>32.5$</price> <date>2015-7-6</date> </book> <book> <name>Wuthering Heights</name> <author>Emily Bronte</author> <price>40$</price> <date>2015-7-5</date> </book> </books>
[root@localhost xuzhina]#se_term -query "for $p in collection('novel')/books/book return $p" books <book> <name>The Call Of Wild</name> <author>Jack London</author> <price>32.5$</price> <date>2015-7-6</date> </book> <book> <name>Wuthering Heights</name> <author>Emily Bronte</author> <price>40$</price> <date>2015-7-5</date> </book>
[root@localhost xuzhina]#se_term -query "for $p in collection('novel')/books/book[name='The Call Of Wild'] return $p" books <book> <name>The Call Of Wild</name> <author>Jack London</author> <price>32.5$</price> <date>2015-7-6</date> </book>
[root@localhost xuzhina]#se_term -query "for $p in collection('novel')/books/book[2] return $p" books <book> <name>Wuthering Heights</name> <author>Emily Bronte</author> <price>40$</price> <date>2015-7-5</date> </book>
[root@localhost xuzhina]#se_term -query "for $p in collection('novel')/books/book[contains(n ame, 'Call')] return $p" books <book> <name>The Call Of Wild</name> <author>Jack London</author> <price>32.5$</price> <date>2015-7-6</date> </book>
版权声明:本文为博主原创文章,未经博主允许不得转载。
原文地址:http://blog.csdn.net/xuzhina/article/details/46775319