Content creation/generation with the AuthorSchemaManager
Posted: Mon Aug 04, 2014 7:01 pm
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