get key value from keyref

Post here questions and problems related to editing and publishing DITA content.
xavier_declercq
Posts: 2
Joined: Thu Mar 19, 2015 5:37 pm

get key value from keyref

Post by xavier_declercq »

Hello,

We are building our own DITA Map extensions bundle to customize oXygen.

I am struggling trying to retrieve the value of the keyword refered by a keyref when the user saves the document. The keyword is located in an external subject scheme
I am capturing the save action inside the WSEditorListener#editorAboutToBeSavedVeto method. This is apparently working.
I can even list the key URL with the DITAAccess.resolveKeyRef method but I don't know how to get the value it refers.

Can you please help ?

Thanks in advance.

Xavier
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: get key value from keyref

Post by alex_jitianu »

Hello Xavier,

I believe you can get what you want like this:

Code: Select all


LinkedHashMap<String, KeyInfo> keys = DITAAccess.getKeys(originatorURL);
MetaContentProvider metaContentProvider = keys.get("myKey").getMetaContentProvider();
if (metaContentProvider != null) {
String content = metaContentProvider.getContent(" topic/keyword ");
}
Best regards,
Alex
xavier_declercq
Posts: 2
Joined: Thu Mar 19, 2015 5:37 pm

Re: get key value from keyref

Post by xavier_declercq »

Hello Alex,

Thanks for the reply.

I tried your described solution but the problem is that the MetaContentProvider retrieved is null. And I don't understand why...
alex_jitianu
Posts: 1016
Joined: Wed Nov 16, 2005 11:11 am

Re: get key value from keyref

Post by alex_jitianu »

Hello Xavier,

Can you send me some small DITA samples on support@oxygenxml.com so I can test it myself and draw a conclusion?

Best regards,
Alex
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: get key value from keyref

Post by Radu »

Hi Xavier,

Thanks for the samples.
You seem to define keyword metadata directly on subjectdefs like:

Code: Select all

<subjectdef keys="Technicalengineer"><topicmeta><keywords><keyword>Technical engineer</keyword></keywords></topicmeta></subjectdef>
and right now Oxygen does not gather the metadata from subjectdef keys.
We will try to rectify this.

Could you tell me more about why you want to get the keyref value in the first place?

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Radu
Posts: 9446
Joined: Fri Jul 09, 2004 5:18 pm

Re: get key value from keyref

Post by Radu »

Hi Xavier,

Just to update the thread, the issue should be fixed in Oxygen 17.0.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply