Using jsoup as an alternative to the TagSoup
Saturday, 5 September 2026 · 4 messages · last reply 6 Sep 2026
OS
Oleksandr Shpak5 Sep 2026 10:26 #
Hi team,
TagSoup is an old library that doesn't support the modern HTML5 features. It would be good to configure which library BaseX should be used to parse and serialize HTML.
What do you think?
Best regards,
Oleksandr.
IL
Imsieke, Gerrit, le-tex5 Sep 2026 11:03 #
Hi Oleksandr,
starting with BaseX 12, validator.nu is available. Maybe Tagsoup will be preferred though if both are on the classpath. You can request explicitly that validator.nu’s parser be used like so:
html:parse('<html/>', {'method':'nu'}) → <html xmlns="http://www.w3.org/1999/xhtml"><head/><body/></html>Without setting the method to 'nu', the output is <html/>, the same as with {'method':'tagsoup'}.
According to [1], for
fn:parse-html() validator.nu will be used by default:
parse-html('<html/>') → <html xmlns="http://www.w3.org/1999/xhtml"><head/><body/></html>
Gerrit
[1] https://docs.basex.org/main/Standard_Functions#fn:parse-htmlQuoted text · Oleksandr Shpak · 9 lines
On 05.09.2026 10:26, Oleksandr Shpak via BaseX-Talk wrote: > Hi team, > > TagSoup is an old library that doesn't support the modern HTML5 features. It would be good to configure which library BaseX should be used to parse and serialize HTML. > > What do you think? > > Best regards, > Oleksandr.
OS
Oleksandr Shpak6 Sep 2026 23:24 #
Wow, I've missed it. Perfect news, thanks!
Quoted text · le-tex · 37 lines
On Sat, Sep 5, 2026 at 12:04 PM Imsieke, Gerrit, le-tex via BaseX-Talk < basex-talk at mailman.uni-konstanz.de> wrote: > Hi Oleksandr, > > starting with BaseX 12, validator.nu is available. Maybe Tagsoup will be > preferred though if both are on the classpath. You can request explicitly > that validator.nu’s parser be used like so: > > html:parse('<html/>', {'method':'nu'}) → <html xmlns=" > http://www.w3.org/1999/xhtml"><head/><body/></html> > > Without setting the method to 'nu', the output is <html/>, the same as > with {'method':'tagsoup'}. > > According to [1], for fn:parse-html() validator.nu will be used by > default: > > parse-html('<html/>') → <html xmlns="http://www.w3.org/1999/xhtml > "><head/><body/></html> > > Gerrit > > [1] https://docs.basex.org/main/Standard_Functions#fn:parse-html > > On 05.09.2026 10:26, Oleksandr Shpak via BaseX-Talk wrote: > > Hi team, > > > > TagSoup is an old library that doesn't support the modern HTML5 > features. It would be good to configure which library BaseX should be used > to parse and serialize HTML. > > > > What do you think? > > > > Best regards, > > Oleksandr. > >
--
s0rr0w
GS
Graydon Saunders6 Sep 2026 23:56 #
For anyone like me who is easily confused, when it ships with BaseX 12 "validator.nu" is called "htmlparser-*.*.*.jar".
So in BaseX 12.4 it's htmlparser-1.4.16.jar if you're checking the contents of `lib/` to reassure yourself it's really in there.
-- Graydon
Quoted text · Oleksandr Shpak · 33 lines
On Sun, Sep 6, 2026, at 17:24, Oleksandr Shpak via BaseX-Talk wrote: > Wow, I've missed it. Perfect news, thanks! > > On Sat, Sep 5, 2026 at 12:04 PM Imsieke, Gerrit, le-tex via BaseX-Talk <basex-talk at mailman.uni-konstanz.de> wrote: >> Hi Oleksandr, >> >> starting with BaseX 12, validator.nu is available. Maybe Tagsoup will be preferred though if both are on the classpath. You can request explicitly that validator.nu’s parser be used like so: >> >> html:parse('<html/>', {'method':'nu'}) → <html xmlns="http://www.w3.org/1999/xhtml"><head/><body/></html> >> >> Without setting the method to 'nu', the output is <html/>, the same as with {'method':'tagsoup'}. >> >> According to [1], for fn:parse-html() validator.nu will be used by default: >> >> parse-html('<html/>') → <html xmlns="http://www.w3.org/1999/xhtml"><head/><body/></html> >> >> Gerrit >> >> [1] https://docs.basex.org/main/Standard_Functions#fn:parse-html >> >> On 05.09.2026 10:26, Oleksandr Shpak via BaseX-Talk wrote: >> > Hi team, >> > >> > TagSoup is an old library that doesn't support the modern HTML5 features. It would be good to configure which library BaseX should be used to parse and serialize HTML. >> > >> > What do you think? >> > >> > Best regards, >> > Oleksandr. > > > -- > s0rr0w
Written for BaseX 12.4. BaseX may have changed since: please check the current documentation.
⚡Generated with XQuery