Insert cascade dependencies
Post here questions and problems related to oXygen frameworks/document types.
Insert cascade dependencies
Hi,
I'm trying to insert various element levels, for example, if I enter the element <glossentry> it automatically should be fill like this:
I'm using SchemaManagerFilter for doing this, I can insert the <glossterm> and <glossdef> sucessfuly, but due glossdef its auto inserted, the <p> element is not been added.
Here is my code:
How can I do to insert also the <p> automatically when added the <glossdef> ?
I'm trying to insert various element levels, for example, if I enter the element <glossentry> it automatically should be fill like this:
Code: Select all
<glossentry>
<glossterm></glossterm>
<glossdef>
<p></p>
</glossdef>
</glossentry>
Here is my code:
Code: Select all
private static final List<String> ELEMENTS_WITH_MANDATORY_P_CHILD =
Arrays.asList(new String[] {"section", "note", "li", "context", "info", "stepresult", "entry", "stentry", "choice", "result", "glossdef"});
@Override
public List<CIElement> filterElements(final List<CIElement> elements,
final WhatElementsCanGoHereContext context) {
final List<CIElement> filteredElements = super.filterElements(elements, context);
if ((context != null) && (filteredElements != null)) {
for (final CIElement element : filteredElements) {
final String elementName = element.getQName();
//is the current element a glossentry?
if(elementName.equals("glossentry")) {
addGlossentryChilds(element);
}
// is the current element included in the list of elements with mandatory child p?
if (ELEMENTS_WITH_MANDATORY_P_CHILD.contains(elementName)) {
addChildPElement(element);
}
//here is where the glossdef subelement should be add the child <p>
final List<CIElement> childElements = element.getGuessElements();
// Verify in the child Elements if there are more elements that
// will be "auto" completed.
getSubElements(childElements);
}
}
return filteredElements;
}
void addGlossentryChilds(final CIElement parent) {
final CIElement glosstermElement = new GlosstermElement();
final CIElement glossdefElement = new GlossdefElement();
parent.addGuessElement(glosstermElement);
parent.addGuessElement(glossdefElement);
}
-
- Posts: 1008
- Joined: Wed Nov 16, 2005 11:11 am
Re: Insert cascade dependencies
Post by alex_jitianu »
Hello,
In our SDK sample project, inside the oxygen-sample-framework module, thre is an implementation of an ro.sync.contentcompletion.xml.CIElement named simple.documentation.framework.SDFElement. After you copy this impllementation into your own project all you have to do is build the hierarchy:
As an alternative, you can configure content completion through a configuration file. You can obtain the same result by adding these lines inside such a configuration file:
Best regards,
Alex
In our SDK sample project, inside the oxygen-sample-framework module, thre is an implementation of an ro.sync.contentcompletion.xml.CIElement named simple.documentation.framework.SDFElement. After you copy this impllementation into your own project all you have to do is build the hierarchy:
Code: Select all
glossterm.setName("glossterm");
glossentry.addGuessElement(glossterm);
CIElement glossdef = new SDFElement();
glossdef.setName("glossdef");
glossentry.addGuessElement(glossdef);
CIElement p = new SDFElement();
p.setName("p");
glossdef.addGuessElement(p);
Code: Select all
<elementProposals path="glossentry" insertElements="glossterm glossdef"/>
<elementProposals path="glossdef" insertElements="p"/>
<elementProposals path="p" insertElements="b"/>
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