Page 1 of 1

How to get display name of AuthorElement

Posted: Tue Mar 23, 2021 12:39 am
by manojdcoder
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.

Re: How to get display name of AuthorElement

Posted: Wed Mar 24, 2021 9:55 am
by cristi_talau
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