Interface WSXMLTextEditorPage
- All Superinterfaces:
WSEditorPage,WSTextBasedEditorPage,WSTextEditorPage
Contains methods specific to XML editors.
- Since:
- 14
-
Method Summary
Modifier and TypeMethodDescriptionObject[]evaluateXPath(String xpathExpression) Evaluates an XPath expression.findElementsByXPath(String xpathExpression) Finds the nodes selected by the given XPath expression.Get a controller which has utility methods to manipulate XML content in the Text editing mode.Get the schema manager used to ask useful information about allowed elements and the context of the current offset.getXPath(int offset, boolean includeIndexInParent) Get the XPath corresponding to the XML element containing the given offset.Methods inherited from interface ro.sync.exml.workspace.api.editor.page.WSEditorPage
getParentEditor, hasFocus, isEditable, requestFocus, setEditable, setReadOnly, setReadOnlyMethods inherited from interface ro.sync.exml.workspace.api.editor.page.WSTextBasedEditorPage
copy, createAnchor, deleteSelection, getCaretOffset, getLocationOnScreenAsPoint, getLocationRelativeToEditorFromScreen, getOffsetForAnchor, getSelectedText, getSelectionEnd, getSelectionStart, getStartEndOffsets, getWordAtCaret, hasSelection, modelToViewRectangle, scrollCaretToVisible, select, selectWord, setCaretPosition, viewToModelOffsetMethods inherited from interface ro.sync.exml.workspace.api.editor.page.text.WSTextEditorPage
addExternalContentCompletionProvider, addPopUpMenuCustomizer, addQuickAssistProcessor, beginCompoundUndoableEdit, endCompoundUndoableEdit, getActionsProvider, getColumnOfOffset, getDocument, getLineOfOffset, getOffsetOfLineEnd, getOffsetOfLineStart, getTextComponent, removeExternalContentCompletionProvider, removePopUpMenuCustomizer, removeQuickAssistProcessor
-
Method Details
-
findElementsByXPath
Finds the nodes selected by the given XPath expression. The result of this function is an array ofWSXMLTextNodeRangeselected by the given XPath expression.
For example executing the expression:
will return an array with all the node ranges in the document.//node()
But the result of calling the function with the expression:
will return an empty array.count(//node())- Parameters:
xpathExpression- The XPath expression. If the XPath expression is relative, it will be computed in the context of the current caret position.- Returns:
- The node ranges selected by the XPath expression.
It does not return a
nullarray of nodes. If the evaluation of the XPath expression fails it will return an empty array. - Throws:
XPathException- If the XPath expression failed to be evaluated.
-
evaluateXPath
Evaluates an XPath expression. This function returns the result of the given XPath expression as an array ofObject.
For example, executing the expression:
will return an array with all the DOM Nodes created over the XML structure.//node()
while evaluating the expression:
will return an array having a single component representing the number of nodes in the document.count(//node())
Evaluating the expression:
will return an array containing all DOM Nodes and having as last component the total number of nodes.//node(), count(//node())- Parameters:
xpathExpression- The XPath expression. If the XPath expression is relative, it will be computed in the context of the current caret position.- Returns:
- An array of objects representing the XPath result.
It does not return a
nullarray. If the XPath evaluation fails it will return an empty array. - Throws:
XPathException- If the XPath expression failed to be evaluated.
-
getXMLSchemaManager
WSTextXMLSchemaManager getXMLSchemaManager()Get the schema manager used to ask useful information about allowed elements and the context of the current offset.- Specified by:
getXMLSchemaManagerin interfaceWSTextEditorPage- Returns:
- the XML Schema Manager used to ask useful information about allowed elements and the context of the current offset.
-
getDocumentController
TextDocumentController getDocumentController()Get a controller which has utility methods to manipulate XML content in the Text editing mode.- Returns:
- The text document controller.
- Since:
- 16.1
-
getXPath
Get the XPath corresponding to the XML element containing the given offset.- Parameters:
offset- The current offset.includeIndexInParent- Iftruethe child index in parent is included. Example (without index): /personnel/person/name/family Example (with index): /personnel/person[2]/name[1]/family[1]- Returns:
- The XPath or
nullif cannot be computed. - Since:
- 27
-