Content creation/generation with the AuthorSchemaManager
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 206
- Joined: Thu Dec 01, 2011 4:22 pm
- Location: Hamburg, Germany
Content creation/generation with the AuthorSchemaManager
Hello,
we are using the Eclipse Oxygen Author in Version 15.2.
You have certain preferences, which can be set for "Content Completion" like "Add first Choice particle" and "Insert the fixed attributes".
When I insert XML content programmatically I´d also like to set a boolean flag for those preferences I just mentioned.
In my code I do want to insert a certain XML Element schema aware:
I hope this piece of code demonstrates what my intention is.
Actually I´d like to have something like that :
Is there a way how I can achieve that with existing API?
I hope so, because you already do it somehow with the preferences for content completion.
As an aside, I only want to do this in order to generate the content nodes of an element, which contains a conref attribute. So actually the generated content will not be shown anyway, because it will be replaced by the conref, but it is of cause still required due to the schema contraints.
Best regards,
Simon
we are using the Eclipse Oxygen Author in Version 15.2.
You have certain preferences, which can be set for "Content Completion" like "Add first Choice particle" and "Insert the fixed attributes".
When I insert XML content programmatically I´d also like to set a boolean flag for those preferences I just mentioned.
In my code I do want to insert a certain XML Element schema aware:
Code: Select all
AuthorSchemaManager schemaManager = authorAccess
.getDocumentController().getAuthorSchemaManager();
// method which finds the desired node in the global elements
CIElement ciElementByElementName = getCIElementByElementName(
schemaManager.getGlobalElements(), {elementName});
// this fragment should contain also the first choice particle and all the required attributes
AuthorDocumentFragment documentFragment = schemaManager
.createAuthorDocumentFragment(ciElementByElementName);
authorAccess.getDocumentController().insertFragmentSchemaAware(offset,
documentFragment);
Actually I´d like to have something like that :
Code: Select all
schemaManager.createAuthorDocumentFragment(ciElementByElementName, {boolean for "first choice particle"}, {boolean for "inserting required attributes"});
I hope so, because you already do it somehow with the preferences for content completion.
As an aside, I only want to do this in order to generate the content nodes of an element, which contains a conref attribute. So actually the generated content will not be shown anyway, because it will be replaced by the conref, but it is of cause still required due to the schema contraints.
Best regards,
Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Content creation/generation with the AuthorSchemaManager
Post by alex_jitianu »
Hello,
You can make sure the options are set to the required value before executing the code:
Unfortunately you can't get the current value for the options so that you can restore it at the end of the operation. But chances are you already know the default values for these options in your editing environment so you can explicitly set them to those values after inserting the element.
Best regards,
Alex
You can make sure the options are set to the required value before executing the code:
Code: Select all
PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("code.insight.add.first.choice", true); PluginWorkspaceProvider.getPluginWorkspace().setGlobalObjectProperty("code.insight.insert.required.attributes", true);
Best regards,
Alex
-
- Posts: 206
- Joined: Thu Dec 01, 2011 4:22 pm
- Location: Hamburg, Germany
Re: Content creation/generation with the AuthorSchemaManager
Hello Alex,
as you can imagine this solution is not really satisfying.
Could you please consider to offer also a method, where such operationmodes can be added without modifying these global options?
Maybe something like:
A second thing that sounds weird to me is the fact that I am able to modify certain preferences, but cannot read those preferences in order to reset them.
Do you offer a class or an interface, where those global properties keys like "code.insight.add.first.choice" are defined?
Best regards,
Simon
as you can imagine this solution is not really satisfying.
Could you please consider to offer also a method, where such operationmodes can be added without modifying these global options?
Maybe something like:
Code: Select all
OperationModes opermationModes = new OperationModes();
opermationModes.add(IOperationModeConstants.ADD_FIRST_CHOICE);
opermationModes.add(IOperationModeConstants.INSERT_REQUIRED_ATTRIBUTES);
AuthorDocumentFragment documentFragment = schemaManager
.createAuthorDocumentFragment(ciElementByElementName, opermationModes);
Do you offer a class or an interface, where those global properties keys like "code.insight.add.first.choice" are defined?
Best regards,
Simon
Simon Scholz
vogella GmbH
http://www.vogella.com
vogella GmbH
http://www.vogella.com
-
- Posts: 1016
- Joined: Wed Nov 16, 2005 11:11 am
Re: Content creation/generation with the AuthorSchemaManager
Post by alex_jitianu »
Hello Simon,
I agree that the solution is by far the most elegant one... but unfortunately it's all you can do with the current API... I've added an issue regarding a dedicated API as you suggested.
We don't have an API for getting the existing value of an option because of security reasons (the values might contain sensitive information). We also don't have an API class with all option keys. If you need to find out the key of an option you can either ask us or export the options with and without the option being set, and compare the two versions.
Best regards,
Alex
I agree that the solution is by far the most elegant one... but unfortunately it's all you can do with the current API... I've added an issue regarding a dedicated API as you suggested.
We don't have an API for getting the existing value of an option because of security reasons (the values might contain sensitive information). We also don't have an API class with all option keys. If you need to find out the key of an option you can either ask us or export the options with and without the option being set, and compare the two versions.
Best regards,
Alex
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