Re: [basex-talk] How to serialize HTML as text
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
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
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'})