Add Parent Element Functionality
Are you missing a feature? Request its implementation here.
-
- Posts: 16
- Joined: Mon Mar 18, 2013 6:29 pm
Add Parent Element Functionality
Hi,
I'm trying to implement ‘add parents’ functionality:
What java class I can used to search a list of parent elements (equivalent to xpath expression: //xs:element[descendant::xs:element/@ref='T0X']
example :
<T0X><p></T0X> after Add Parent action <T0Y> => <T0Y> <T0X><p></T0X> <T0Y>
Regards
Idak
I'm trying to implement ‘add parents’ functionality:
What java class I can used to search a list of parent elements (equivalent to xpath expression: //xs:element[descendant::xs:element/@ref='T0X']
example :
<T0X><p></T0X> after Add Parent action <T0Y> => <T0Y> <T0X><p></T0X> <T0Y>
Regards
Idak
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Add Parent Element Functionality
Hi Idak,
I do not quite understand what you want to do. Maybe you could elaborate.
For editing in the Author mode you have some API methods evailable like:
and:
When editing in the Text page there is an API method like:
Regards,
Radu
I do not quite understand what you want to do. Maybe you could elaborate.
For editing in the Author mode you have some API methods evailable like:
Code: Select all
ro.sync.ecss.extensions.api.AuthorDocumentController.evaluateXPath
Code: Select all
ro.sync.ecss.extensions.api.AuthorDocumentController.findNodesByXPath
Code: Select all
ro.sync.exml.workspace.api.editor.page.text.xml.WSXMLTextEditorPage.findElementsByXPath(String)
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 16
- Joined: Mon Mar 18, 2013 6:29 pm
Re: Add Parent Element Functionality
Hi,
To search the list ChildrenElements I use this java code :
WhatElementsCanGoHereContext elementsCanGoHereContext;
elementsCanGoHereContext = authorSchemaManager.createWhatElementsCanGoHereContext(selectedNode.getStartOffset());
List<CIElement> elements = authorSchemaManager.getChildrenElements(elementsCanGoHereContext);
I want to get the list of parent elements (in xsd schemas) something like getParentElements ...
Regards,
Idak
To search the list ChildrenElements I use this java code :
WhatElementsCanGoHereContext elementsCanGoHereContext;
elementsCanGoHereContext = authorSchemaManager.createWhatElementsCanGoHereContext(selectedNode.getStartOffset());
List<CIElement> elements = authorSchemaManager.getChildrenElements(elementsCanGoHereContext);
I want to get the list of parent elements (in xsd schemas) something like getParentElements ...
Regards,
Idak
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Add Parent Element Functionality
Hi Idak,
One remark, the code you are currently using:
will not return the possible children in the current selected node but the possible children from it's parent (because selectedNode.getStartOffset() represents a position which is in front of the selected node and not inside it).
I think that you actually want to know the answer to this question:
In what other parents could this current element be inserted?
We do not have an API for this.
Regards,
Radu
One remark, the code you are currently using:
Code: Select all
authorSchemaManager.createWhatElementsCanGoHereContext(selectedNode.getStartOffset());
I think that you actually want to know the answer to this question:
In what other parents could this current element be inserted?
We do not have an API for this.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 9472
- Joined: Fri Jul 09, 2004 5:18 pm
Re: Add Parent Element Functionality
Hi Idak,
You have API to create an XSLT transformer which could match the XPath in an XSLT stylesheet template:
But the XPath expression you want to use: //xs:element[descendant::xs:element/@ref='T0X'] might work in some cases but fail most in others. What if an element references a complex type which is defined in another place and that complex type references a child element? So it is not a general solution.
You could also probably uses the Xerces libraries already available in Oxygen's classpath to create an org.apache.xerces.xs.XSModel implementation which is a compiled version of a schema, with all references resolved.
Regards,
Radu
You have API to create an XSLT transformer which could match the XPath in an XSLT stylesheet template:
Code: Select all
ro.sync.exml.workspace.api.util.XMLUtilAccess.createXSLTTransformer(Source, URL[], int)
You could also probably uses the Xerces libraries already available in Oxygen's classpath to create an org.apache.xerces.xs.XSModel implementation which is a compiled version of a schema, with all references resolved.
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ Artificial Intelligence (AI Positron Assistant add-on)
- ↳ 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