Resolve conkeyref
Post here questions and problems related to oXygen frameworks/document types.
Resolve conkeyref
Hi team.
I'm new working with the Oxygen's API and currently I'm trying to resolve some <ph> tags with a conkeyref attribute, for example:
The main idea is to get the text from the <ph> reference and return the entire string (for example: "How Oxygen Works with XMLs Files").
Someone has any idea how to do it?
Thanks a lot.
I'm new working with the Oxygen's API and currently I'm trying to resolve some <ph> tags with a conkeyref attribute, for example:
Code: Select all
<title id="GUID-XXXX-XXXX-XXXX">
How Oxygen Works with <ph conkeyref="GUID-YYYY-YYYY-YYYY/AA-0000-BB-2222"/>
</title>
Someone has any idea how to do it?
Thanks a lot.
Re: Resolve conkeyref
Hi,
I'm not sure I understand, could you elaborate?
Oxygen should already resolved conrefs and conkeyrefs in the Author visual editing mode so that the referenced content becomes visible.
Are you working with the API for the Oxygen desktop or Oxygen in-browser WebAuthor?
Are you building a plugin or a framework configuration?
Why isn't Oxygen's default behavior of resolving content references enough for you?
Regards,
Radu
I'm not sure I understand, could you elaborate?
Oxygen should already resolved conrefs and conkeyrefs in the Author visual editing mode so that the referenced content becomes visible.
Are you working with the API for the Oxygen desktop or Oxygen in-browser WebAuthor?
Are you building a plugin or a framework configuration?
Why isn't Oxygen's default behavior of resolving content references enough for you?
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Resolve conkeyref
Hi Radu, my bad.
I'm developing a plugin for Oxygen Desktop version 24.1.
I was trying to access to the <title> tag through the XML Document Class, but I hadn't noticed that I can use the AuthorDocumentController Class to bring the AuthorNode for the selected tag, which returns the tag with the resolved references.
Right now, my problem is solved. I apologize for any inconvenience.
Thanks.
I'm developing a plugin for Oxygen Desktop version 24.1.
I was trying to access to the <title> tag through the XML Document Class, but I hadn't noticed that I can use the AuthorDocumentController Class to bring the AuthorNode for the selected tag, which returns the tag with the resolved references.
Right now, my problem is solved. I apologize for any inconvenience.
Thanks.
Radu wrote: ↑Fri Aug 02, 2024 6:56 am Hi,
I'm not sure I understand, could you elaborate?
Oxygen should already resolved conrefs and conkeyrefs in the Author visual editing mode so that the referenced content becomes visible.
Are you working with the API for the Oxygen desktop or Oxygen in-browser WebAuthor?
Are you building a plugin or a framework configuration?
Why isn't Oxygen's default behavior of resolving content references enough for you?
Regards,
Radu
Re: Resolve conkeyref
Hi,
Right, once a conref/conkeyref is expanded in the Author visual editing mode, the "AuthorNode's" for that expanded content should be in the structure of nodes of the current document and can be accessed.
Regards,
Radu
Right, once a conref/conkeyref is expanded in the Author visual editing mode, the "AuthorNode's" for that expanded content should be in the structure of nodes of the current document and can be accessed.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Resolve conkeyref
Thanks, Radu.
Just another question, there's a way to check if the conref/conkeyref is resolved correctly?
I mean, we have some cases where the reference can't be resolved, in those cases Oxygen display the conref/conkeyref value directly, and when I get the text for that node through the AuthorNode.getTextContent() method, it retrieves the reference and the text, for example:
If Oxygen can't find the reference, the returned text is: "How Oxygen Works with GUID-YYYY-YYYY-YYYY/AA-0000-BB-2222". In this case we're expecting to replace that reference value by a whitespace or any other string.
You have any idea how I can check it? Again, I'm developing a plugin for Oxygen Desktop in its version 24.1.
Thanks a lot!
Just another question, there's a way to check if the conref/conkeyref is resolved correctly?
I mean, we have some cases where the reference can't be resolved, in those cases Oxygen display the conref/conkeyref value directly, and when I get the text for that node through the AuthorNode.getTextContent() method, it retrieves the reference and the text, for example:
Code: Select all
<title id="GUID-XXXX-XXXX-XXXX">
How Oxygen Works with <ph conkeyref="GUID-YYYY-YYYY-YYYY/AA-0000-BB-2222"/>
</title>
You have any idea how I can check it? Again, I'm developing a plugin for Oxygen Desktop in its version 24.1.
Thanks a lot!
Re: Resolve conkeyref
Hi,
So let's say you have this particular conkeyref in the DITA XML topic:
The internal structure of nodes when a conref is properly resolved looks like this:
so the Java code to look if the <ph> has a proper resolved conref/conkeyref would look like this:
Regards,
Radu
So let's say you have this particular conkeyref in the DITA XML topic:
Code: Select all
<ph conkeyref="GUID-YYYY-YYYY-YYYY/AA-0000-BB-2222"/>
Code: Select all
<ph (conref/conkeyref)>
<referenceNode>
<ph (the target reused element)>
Code: Select all
AuthorNode[] nodes = authorAccess.getDocumentController().findNodesByXPath("//ph[@conkeyref='GUID-YYYY-YYYY-YYYY/AA-0000-BB-2222']", false, false, false);
AuthorElement ph = (AuthorElement) nodes[0];
List<AuthorNode> contentNodes = ph.getContentNodes();
if(!contentNodes.isEmpty()) {
//The first child node of the ph should be a reference node.
AuthorNode node = contentNodes.get(0);
if(node.getType() == AuthorNode.NODE_TYPE_REFERENCE) {
AuthorReferenceNode refNode = (AuthorReferenceNode) node;
//And the first child of the reference node
//should be the target referenced <ph> from the target document.
List<AuthorNode> refContentNodes = refNode.getContentNodes();
if(! refContentNodes.isEmpty()) {
AuthorNode targetPh = refContentNodes.get(0);
if("ph".equals(targetPh.getName())) {
//The reference is properly resolved.
AuthorElement targetPhElement = (AuthorElement) targetPh;
String text = targetPhElement.getTextContent();
}
}
}
}
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Re: Resolve conkeyref
Hello,
In order to provide you with the most suitable solution for your situation, can you please elaborate in detail on your use case?
Best.
Cosmin
Thank you for contacting us.I'm working with the in-browser WebAuthor. Any tips for better conref
handling in this environment?
In order to provide you with the most suitable solution for your situation, can you please elaborate in detail on your use case?
Best.
Cosmin
Cosmin Eftenie
www.oxygenxml.com
www.oxygenxml.com
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service