How to get display name of AuthorElement

Having trouble installing <oXygen/>? Got a bug to report? Post it all here.
manojdcoder
Posts: 63
Joined: Thu Oct 29, 2020 12:01 am

How to get display name of AuthorElement

Post by manojdcoder » Tue Mar 23, 2021 12:39 am

I would like to find all possible attributes of selected element along with its display name.

I was able to use createWhatAttributesCanGoHereContext to find all possible attributes, but not sure how to get the display name. It always returns the xml name.

i.e if a topicref is selected I would like to get the editor displayed name Topic Reference.

cristi_talau
Posts: 341
Joined: Thu Sep 04, 2014 4:22 pm

Re: How to get display name of AuthorElement

Post by cristi_talau » Wed Mar 24, 2021 9:55 am

Hello,

As of Web Author version 23.1, there are two methods to retrieve the display name of an author element none of which is public API:
  • In JS code you can use sync.view.NodeRenderer.getRenderedText(node.getHtmlNode()), where node is a Node of the XML document.
  • In Java code you can use the following:

Code: Select all

String frameworkId =  authorDocumentModel.getDocumentTypeId();
CCConfigurationCache.getInstance()
        .getConfiguration(frameworkId).getAllRenderingInformation().get("topicref");
If you want to avoid depending on non-documented APIs, you can parse the i18n/translation-cc.xml file in the built-in DITA framework to get the display names of elements according to the user language.

Best,
Cristian

Post Reply