Re: [basex-talk] How to serialize HTML as text

2020-06-27 Thread Emmanuel Chateau
Wonderful, and so simple indeed !
Thanks a lot.
Emmanuel

> Le 27 juin 2020 à 12:39, Martin Honnen  a écrit :
> 
> Am 27.06.2020 um 18:32 schrieb Emmanuel Chateau:
> 
>> I need to output a JSON object with HTML content without a parent element. 
>> Weird idea I grant you, but required by the people I work with.
>> 
>> Working from a map, in the map value, the content should not appear in a 
>> parent element. Instead of :
>> 
>> ```
>> map {
>> ‘key' : ‘value’,
>> ‘content’ : this is some content etc
>> }
>> ```
>> 
>> I would like to output something like
>> 
>> ```
>> map {
>> ‘key' : ‘value’,
>> ‘content’ : 'this is some content etc'
>> }
>> ```
>> 
>> Is there a way to output some HTML content without the parent element in 
>> XQuery ?
>> 
> 
> Assuming you have the span element node, simply call the serialize
> function on its child nodes e.g.
> 
> serialize(this is some content etc/node(), map {
> 'method' : 'html'})
> 
> 



[basex-talk] How to serialize HTML as text

2020-06-27 Thread Emmanuel Chateau
Hi,

I’ve got an XQuery question more than a BaseX question.

I need to output a JSON object with HTML content without a parent element. 
Weird idea I grant you, but required by the people I work with.

Working from a map, in the map value, the content should not appear in a parent 
element. Instead of :

```
map { 
‘key' : ‘value’,
‘content’ : this is some content etc
}
```

I would like to output something like

```
map { 
‘key' : ‘value’,
‘content’ : 'this is some content etc'
}
```

Is there a way to output some HTML content without the parent element in XQuery 
?


Thanks a lot for your help,
Best regards,

Emmanuel

Re: [basex-talk] How to serialize HTML as text

2020-06-27 Thread Martin Honnen

Am 27.06.2020 um 18:32 schrieb Emmanuel Chateau:


I need to output a JSON object with HTML content without a parent element. 
Weird idea I grant you, but required by the people I work with.

Working from a map, in the map value, the content should not appear in a parent 
element. Instead of :

```
map {
 ‘key' : ‘value’,
 ‘content’ : this is some content etc
}
```

I would like to output something like

```
map {
 ‘key' : ‘value’,
 ‘content’ : 'this is some content etc'
}
```

Is there a way to output some HTML content without the parent element in XQuery 
?



Assuming you have the span element node, simply call the serialize
function on its child nodes e.g.

serialize(this is some content etc/node(), map {
'method' : 'html'})




Re: [basex-talk] Autocomplete with RESTXQ

2020-06-27 Thread Imsieke, Gerrit, le-tex

Thanks Michael!

This looks quite simple but you probably saved me two to four hours of 
figuring out which lib to use, how to invoke the completion and how to 
shape the server response. Will try to use it in my app tomorrow.


And since there has been a question on this list recently which sites 
are built on BaseX, I will add to the list the site that I’m currently 
working on (Hogrefe Publishing’s Clinical Handbook of Psychotropic 
Drugs) probably in September, when it will have been relaunched. 
Accessing the site requires a subscription though, but maybe the 
publisher will decide that at least the search be free, enticing more 
mental health practitioners into subscribing when they want to access 
the search results…


Gerrit

On 26.06.2020 16:34, Michael Seiferle wrote:

Hi Gerrit,

I came up with the following example — 
https://git.basex.io/basex-public/mailinglist-autocomplete

Hope this helps — feel free to ask for more. I simply chose the first autocomplete 
library that showed up when asking google for  "autocomplete lightweight“ ;-)

Probably the most relevant changes compared to the default BaseX Config files 
are here:

Changed the Servlet mapping, so RESTXQ is output at `/api` (and not /)

https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L83


And static-files are output at: `/` instead of the default `/static`

https://git.basex.io/basex-public/mailinglist-autocomplete/-/blob/main/webapp/WEB-INF/web.xml#L140



If you simply clone my repo, the relevant parts should be „correct“ — according 
to my personal taste ;-)

Feel free to ask for more help.

Michael


Am 25.06.2020 um 18:31 schrieb Imsieke, Gerrit, le-tex 
:

Hi List,

Can anyone recommend a lightweight vanilla Javascript autocomplete library that 
can easily be used together with BaseX RESTXQ? Maybe even a readily 
cloneable/modifiable example?
I don’t have a preference for a server response format. The RESTXQ service may 
be configured to return XML, JSON, or HTML
No CORS restrictions need to be considered, the query host is the same that 
delivers the HTML pages.

Gerrit




--
Gerrit Imsieke
Geschäftsführer / Managing Director
le-tex publishing services GmbH
Weissenfelser Str. 84, 04229 Leipzig, Germany
Phone +49 341 355356 110, Fax +49 341 355356 510
gerrit.imsi...@le-tex.de, http://www.le-tex.de

Registergericht / Commercial Register: Amtsgericht Leipzig
Registernummer / Registration Number: HRB 24930

Geschäftsführer / Managing Directors:
Gerrit Imsieke, Svea Jelonek, Thomas Schmidt