Forum Discussion

adtucs's avatar
adtucs
Helper
20 days ago

How to parse <li-answer> <li-table> custom li tags into raw html

I was playing around with XML data dump of messages, and found custom HTML tags (<li-{type}> in the message content. 

From Khoros API (LiQL), I'm getting transformed HTML content, without any custom lithium HTML tags 

Tags example - li-answer, li-code, li-emoji, li-code, li-video, li-image etc 

How to parse such tags, and get content HTML like it is provided in the API using LiQL ? 

 

 

1 Reply

  • LucyL's avatar
    LucyL
    Khoros Staff
    10 days ago

    The <li-*> tags (li-answer, li-code, li-emoji, li-video, li-image, li-table, li-spoiler, etc.) are Khoros internal placeholder tokens. The raw form in the XML dump is what's stored in the DB; the LiQL API returns a rendered version because the body goes through the platform's server-side rendering pipeline before being returned. There is no public parser/library for these tags — the resolution logic (image signing, video embed HTML, code highlighting, emoji → <img>, spoiler markup, etc.) lives inside the Khoros app.

    Practical options, easiest first:

    1. *Don't parse the dump - re-fetch via LiQL.* REST API v2 with LiQL (SELECT id, body FROM messages WHERE id IN (...)) or v1 /messages/id/<id>/body both return rendered HTML. If the dump is a one-time snapshot, iterating IDs is straightforward.2. *Request a dump with rendered bodies.* The Standard XML Export has a config (journaling.addLiTagsResolvedHtml = true) that adds a body-html field alongside body containing resolved HTML. Support can enable it.3. *Roll your own for a subset.* Only viable if you care about a couple of tag types. Not recommended — li-* isn't a stable public contract and changes across versions.

    Option 1 is the best but depends on the use case, whether archival, search indexing, migration etc.