Map framework based on topics
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 98
- Joined: Tue Mar 06, 2018 2:07 pm
- Contact:
Map framework based on topics
Hello,
I would like to create a custom framework that extend "DITA map".
I would like that this framework runs when a specific topic (e.g. with "myCustomTopic" root name) is present in the map hierarchy.
I tried to use DITAMapResolvedReferencesCustomRuleMatcher java class like this but it doesn't work:
Thanks for your help.
Regards,
Nicolas
I would like to create a custom framework that extend "DITA map".
I would like that this framework runs when a specific topic (e.g. with "myCustomTopic" root name) is present in the map hierarchy.
I tried to use DITAMapResolvedReferencesCustomRuleMatcher java class like this but it doesn't work:
image.png
Picture1.png
Is the behavior I'm trying to set up possible?Thanks for your help.
Regards,
Nicolas
You do not have the required permissions to view the files attached to this post.
Nicolas Delobel
AmeXio
nicolas.delobel at amexiogroup.com
AmeXio
nicolas.delobel at amexiogroup.com
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Map framework based on topics
Hi Nicolas,
So when a "test.ditamap" is opened in Oxygen, if it has a topic reference to "test.dita", you want it to be matched by Oxygen with a certain framework configuration, correct? And if it does not have a topic reference to "test.dita", you want it to be matched with the default DITA Map framework.
You probably need to create your own Java extension for the "ro.sync.ecss.extensions.api.DocumentTypeAdvancedCustomRuleMatcher" API:
https://www.oxygenxml.com/InstData/Edit ... tcher.html
The most flexible "matches" callback receives a "contentReader" which would allow you to read through the entire content of the DITA Map to see if it should be matched with the framework or not.
And then in the framework configuration add in the "Classpath" tab a reference to your custom JAR library and in the association rules use your custom rule matcher implementation in an association rule.
Regards,
Radu
So when a "test.ditamap" is opened in Oxygen, if it has a topic reference to "test.dita", you want it to be matched by Oxygen with a certain framework configuration, correct? And if it does not have a topic reference to "test.dita", you want it to be matched with the default DITA Map framework.
You probably need to create your own Java extension for the "ro.sync.ecss.extensions.api.DocumentTypeAdvancedCustomRuleMatcher" API:
https://www.oxygenxml.com/InstData/Edit ... tcher.html
The most flexible "matches" callback receives a "contentReader" which would allow you to read through the entire content of the DITA Map to see if it should be matched with the framework or not.
And then in the framework configuration add in the "Classpath" tab a reference to your custom JAR library and in the association rules use your custom rule matcher implementation in an association rule.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 98
- Joined: Tue Mar 06, 2018 2:07 pm
- Contact:
Re: Map framework based on topics
Hi Radu,
Thanks for your help.
I tried quickly this solution:
But unfortunately, I have a Null Pointer Exception because it seems that contentReader is null.
Do you know why? Thanks.
Thanks for your help.
I tried quickly this solution:
Code: Select all
public class DITAMapResolvedReferencesCustomRuleMatcherMyTest extends DocumentTypeAdvancedCustomRuleMatcher
{
public boolean matches(final String systemID, final String rootNamespace, final String rootLocalName, final String doctypePublicID, final String doctypeSystemID, final Attributes rootAttributes, final Map<String, String> queryParameters, final Reader contentReader) throws IOException {
boolean valuesMatch = false;
int bufferSize = 1024;
char[] buffer = new char[bufferSize];
StringBuilder out = new StringBuilder();
for (int numRead; (numRead = contentReader.read(buffer, 0, buffer.length)) > 0; ) {
out.append(buffer, 0, numRead);
}
if (out.indexOf("<myElement") > -1) {
valuesMatch = true;
}
return valuesMatch;
}
}
Do you know why? Thanks.
Nicolas Delobel
AmeXio
nicolas.delobel at amexiogroup.com
AmeXio
nicolas.delobel at amexiogroup.com
-
- Posts: 9431
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Map framework based on topics
Hi Nicolas,
Hmm, it seems sometimes the "contentReader" may be null. Can you guard against this situation in your code? Return false if it's null and see if this works further for you.
Regards,
Radu
Hmm, it seems sometimes the "contentReader" may be null. Can you guard against this situation in your code? Return false if it's null and see if this works further for you.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://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