[author mode][content completion] insert element with attribute value from controlled list
Oxygen general issues.
-
- Posts: 2
- Joined: Tue Feb 28, 2017 8:57 pm
[author mode][content completion] insert element with attribute value from controlled list
Hello folks,
I'm having my first go at customizing the content completion, so apologies up front for probably missing out on the obvious. I have read the content completion part of the online help, created a cc_config.xml file, and added its folder to the classpath. Messages in the info log show that the file is loaded ("start scanning file ... No problems found" on startup).
I'm working with a DTD which defines an integer element, and which has an attribute named base. @base can take a value from a controlled list (coincidentally "2", "8", "10", and "16"), or be absent (defaults to "10"). What I'd like to achieve minimally is that the content completion in author mode offers me to insert an integer element with @base set to one of the four controlled values, but without going to the attributes editor or pop-up. I.e. when pressing enter in author mode, I want to be presented with four options for inserting an integer element. Ideally, content completion would offer me four integer options: no attribute, @base=2, @base=8, and @base=16.
Is either the minimal or the ideal solution possible at all with the content completion system?
Also, there may be another disconnect relating to namespaces? As I'm working with a DTD, I would assume that everything happens in no namespace. As an experiment, I put the following in my cc_config.xml as the only content:
My hope was that whenever I insert an integer element, it would have @base=2. But nothing happens, i.e. an integer element with no attributes gets inserted by content completion.
Any hints appreciated.
I'm having my first go at customizing the content completion, so apologies up front for probably missing out on the obvious. I have read the content completion part of the online help, created a cc_config.xml file, and added its folder to the classpath. Messages in the info log show that the file is loaded ("start scanning file ... No problems found" on startup).
I'm working with a DTD which defines an integer element, and which has an attribute named base. @base can take a value from a controlled list (coincidentally "2", "8", "10", and "16"), or be absent (defaults to "10"). What I'd like to achieve minimally is that the content completion in author mode offers me to insert an integer element with @base set to one of the four controlled values, but without going to the attributes editor or pop-up. I.e. when pressing enter in author mode, I want to be presented with four options for inserting an integer element. Ideally, content completion would offer me four integer options: no attribute, @base=2, @base=8, and @base=16.
Is either the minimal or the ideal solution possible at all with the content completion system?
Also, there may be another disconnect relating to namespaces? As I'm working with a DTD, I would assume that everything happens in no namespace. As an experiment, I put the following in my cc_config.xml as the only content:
Code: Select all
<elementProposals insertElements="integer">
<insertAttribute name="base" value="2"/>
</elementProposals>
Any hints appreciated.
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: [author mode][content completion] insert element with attribute value from controlled list
Post by alex_jitianu »
Hello,
Content completion can be configured to specify the possible values, like this:
And you can control what fragment gets inserted whenever an "integer" element is inserted like this:
Best regards,
Alex
Content completion can be configured to specify the possible values, like this:
Code: Select all
<match elementName="integer" attributeName="base">
<items>
<item value=""></item>
<item value="2"></item>
<item value="4"></item>
<item value="6"></item>
</items>
</match>
Code: Select all
<elementProposals path="integer" >
<insertAttribute name="base" value="4"/>
</elementProposals>
But from what I understand, a scenario like the one described above can't be solved through content completion configuration alone. You need to configure 4 author actions, each one using the InsertFragmentOperation to insert a specific fragment, each fragment having a different @base value:I want to be presented with four options for inserting an integer element. Ideally, content completion would offer me four integer options: no attribute, @base=2, @base=8, and @base=16.
Code: Select all
<integer/>
Code: Select all
<integer base="2"/>
Code: Select all
<integer base="8"/>
Code: Select all
<integer base="16"/>
As you can see above, the fragment required "elementProposals" you need to insert is a bit different than what you've tried. Also, after you make changes in the configuration file, you need to reload the target XML file to make sure the new configuration is loaded.My hope was that whenever I insert an integer element, it would have @base=2. But nothing happens, i.e. an integer element with no attributes gets inserted by content completion.
Best regards,
Alex
-
- Posts: 2
- Joined: Tue Feb 28, 2017 8:57 pm
Re: [author mode][content completion] insert element with attribute value from controlled list
Hello alex_jitianu, and thanks for your prompt reply!
The DTD already defines a controlled list of values, so when I open the attributes editor it offers me a drop-down for @base with these values.alex_jitianu wrote: ↑Wed Dec 11, 2019 4:51 pm Hello,
Content completion can be configured to specify the possible values, like this:
Code: Select all
<match elementName="integer" attributeName="base"> <items> <item value=""></item> <item value="2"></item> <item value="4"></item> <item value="6"></item> </items> </match>
I tried this in cc_config.xml, both with and without your match rule, reloaded the target XML, restarted the app, but somehow it is not triggered. I only get offered the completion for an integer element without @base (which I presume is generated from the DTD). Somehow the stuff in cc_config.xml doesn't seem to get triggered? Is there a way to get logging/debug info about the content completion process?alex_jitianu wrote: ↑Wed Dec 11, 2019 4:51 pm And you can control what fragment gets inserted whenever an "integer" element is inserted like this:
Code: Select all
<elementProposals path="integer" > <insertAttribute name="base" value="4"/> </elementProposals>
I couldn't get that to work either. Here is what I configured (inspired by how the action for the b element(bold) is done):alex_jitianu wrote: ↑Wed Dec 11, 2019 4:51 pmBut from what I understand, a scenario like the one described above can't be solved through content completion configuration alone. You need to configure 4 author actions, each one using the InsertFragmentOperation to insert a specific fragment, each fragment having a different @base value:I want to be presented with four options for inserting an integer element. Ideally, content completion would offer me four integer options: no attribute, @base=2, @base=8, and @base=16.
[...]
Screenshot 2019-12-11 at 16.32.52 .png
It seems that what is inferred from the DTD hides/overrides whatever I configure in the framework?You do not have the required permissions to view the files attached to this post.
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: [author mode][content completion] insert element with attribute value from controlled list
Post by alex_jitianu »
Hi,
1. On the toolbar
2. In the content completion
Please write me an email at support@oxygenxml.com and I will give you the required configuration file for generating log. Also, please send me the cc_config.xml file so I can test it myself with a small DTD.I tried this in cc_config.xml, both with and without your match rule, reloaded the target XML, restarted the app, but somehow it is not triggered. I only get offered the completion for an integer element without @base (which I presume is generated from the DTD). Somehow the stuff in cc_config.xml doesn't seem to get triggered? Is there a way to get logging/debug info about the content completion process?
After you create these actions you need to put them somewhere where the user can find them, like:It seems that what is inferred from the DTD hides/overrides whatever I configure in the framework?
1. On the toolbar
2. In the content completion
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