【问题标题】:how to add a flat text file to BaseX?如何将纯文本文件添加到 BaseX?
【发布时间】:2020-02-15 09:40:24
【问题描述】:

“prolog 中不允许内容”是什么意思?也许需要先设置输入法?我正在尝试将数据添加到Basex 中的空数据库中,dummy 数据如下:

thufir@dur:~/flwor/people$ 
thufir@dur:~/flwor/people$ basex
BaseX 9.0.1 [Standalone]
Try 'help' to get more information.
> open people
Database 'people' was opened in 199.0 ms.
> 
> add to people /home/thufir/flwor/people/people.txt
"/home/thufir/flwor/people/people.txt" (Line 2): Content is not allowed in prolog.
> 
> exit
Have a nice day.
thufir@dur:~/flwor/people$ 
thufir@dur:~/flwor/people$ cat people.txt 

a
1
2
3
b
4
5
6
c
7
8
9

thufir@dur:~/flwor/people$ 

我可以设为CSV 或其他,但只想使用纯文本。

当然可以通过 GUI 将其添加为:

选择文件:

【问题讨论】:

    标签: xml database nosql command-line-interface basex


    【解决方案1】:

    好吧,这可能是个愚蠢的问题:

    > 
    > list
    Name                 Resources  Size    Input Path                               
    -------------------------------------------------------------------------------
    com.w3schools.books  1          6290    https://www.w3schools.com/xml/books.xml  
    dummy                1          21119                                            
    foo                  1          167152  /home/thufir/basex/foo/foo.fodt          
    people               1          4610                                             
    text                 1          55302   /home/thufir/Desktop/text.txt            
    twitter              45         366800                                           
    w3school_data        1          5209    https://www.w3schools.com/xml/note.xml   
    
    7 database(s).
    > drop database people
    Database 'people' was dropped.
    > 
    > create database people
    Database 'people' created in 79.03 ms.
    > 
    > open people
    Database 'people' was opened in 0.05 ms.
    > 
    > set parser text
    PARSER: text
    > 
    > add to people /home/thufir/flwor/people/people.txt
    Resource(s) added in 9.18 ms.
    > 
    > list
    Name                 Resources  Size    Input Path                               
    -------------------------------------------------------------------------------
    com.w3schools.books  1          6290    https://www.w3schools.com/xml/books.xml  
    dummy                1          21119                                            
    foo                  1          167152  /home/thufir/basex/foo/foo.fodt          
    people               1          4610                                             
    text                 1          55302   /home/thufir/Desktop/text.txt            
    twitter              45         366800                                           
    w3school_data        1          5209    https://www.w3schools.com/xml/note.xml   
    
    7 database(s).
    > 
    > exit
    Have fun.
    thufir@dur:~/flwor/people$ 
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-08-08
      • 1970-01-01
      • 1970-01-01
      • 2022-01-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多