-
Notifications
You must be signed in to change notification settings - Fork 0
Home
Annotations following the scheme $$IMPORT( some-xpath )$$
where some-xpath
denotes an XPath expression relative to the result(s) of requestedElementLocation
may be used in various params of the following custom AuthorOperations.
This software package consists of the following six operations that allow you to import parts of an external XML resource. Please note that you will need to use the file URI scheme if the resource is a local file. Please find notes on how to create your own custom action(s) from one of these Java operations in the official documentation of the Actions Subtab.
org.adwmainz.da.extensions.importmore.operations.DisplayImportChartOperation
additional requirements: jcommon-1.0.16.jar, jfreechart-1.5.0.jar
This custom operation creates a dialog containing a pie chart that you can use to visualize how many elements from an external resource are also in the document currently opened in the Author Mode. It has the following arguments:
Argument | Description |
---|---|
resourceLocation | The URL of the external resource containing the original elements. (You may use AskMoreAnnotations here.) |
requestedElementLocation | An XPath expression identifying elements in the external resource that should be compared to the ones in the Document currently opened in the Author Mode. |
namespacePrefixes | The namespace prefixes used in requestedElementLocation , separated by new lines. (This list must contain as many values as the following one!) |
namespaceURIs | The namespace URIs used in requestedElementLocation , separated by new lines. (This list must contain as many values as the preceding one!) |
localElementLocation | An XPath expression identifying elements in the Document currently opened in the Author Mode that should be compared to the ones from the external resource. |
displayPercentages | Specifies whether percentages should be displayed on the chart or not. |
presicion | The number of fraction digits that should be displayed if displayPercentages is set to true . |
dialogTitle | The title of the generated dialog. (defaults to Import stats) |
A dialog generated by this operation looks like this:
Such a visualization works especially pretty well with an ImportElementsOperation or InsertOrReplaceImportedElementOperation from this extension to provide editors a simple visualization within oXygen showing how many elements they have already imported.
Please note that this is the only operation within this ImportMoreXtension that has additional requirements! So please make sure that jcommon-1.0.16.jar and jfreechart-1.5.0.jar are also included in the class path for this operation to work.
org.adwmainz.da.extensions.importmore.operations.ImportAnnotatedFragmentOperation
Extends the InsertOrReplaceAnnotatedFragmentOperation from AskMore by adding the possibility to fetch parts of the fragment from an external resource and adds the following arguments:
Argument | Description |
---|---|
resourceLocation | The URL of the external resource containing the original elements. (You may use AskMoreAnnotations here.) |
requestedElementLocation | An XPath expression identifying elements in the external resource that should be compared to the ones in the Document currently opened in the Author Mode. |
namespacePrefixes | The namespace prefixes used in requestedElementLocation , fragment and/or selectableNameExpression , separated by new lines. (This list must contain as many values as the following one!) |
namespaceURIs | The namespace URIs used in requestedElementLocation , fragment and/or selectableNameExpression , separated by new lines. (This list must contain as many values as the preceding one!) |
dialogTitle | The title of the generated dialog. (defaults to Import elements) |
selectableNameExpression | An XPath expression relative to the result(s) of requestedElementLocation that should be used to create selectable options in the generated dialog. |
selectionLabel | The text that should displayed next to the selection. (defaults to Choose element) |
Please note that you may import one or more parts of the argument fragment
by using ImportAnnotations.
As an example of how to use this operation consider a situation in which you want to add one of the Digital Humanities centers and institutions listed in this Wikipedia entry as an orgName
node into the current document. You could then use the following argument values ...
Argument | Value |
---|---|
resourceLocation | https://en.wikipedia.org/w/index.php?title=Digital_humanities&oldid=910043528 |
requestedElementLocation | //span[@id="Centers_and_institutes"]/parent::h3/following-sibling::ul[following-sibling::h3]/li |
fragment | <orgName>$$IMPORT( . )$$</orgName> |
dialogTitle | DH Institutions |
selectionLabel | Choose one |
... to build this import dialog:
org.adwmainz.da.extensions.importmore.operations.ImportAttributeOperation (added in 1.1.0)
Extends the built-in ChangeAttributeOperation by adding the possibility to fetch parts of the attribute value from an external resource and adds the following arguments (while removing the arguments removeIfEmpty
and value
):
Argument | Description |
---|---|
resourceLocation | The URL of the external resource containing the original elements. (You may use AskMoreAnnotations here.) |
requestedElementLocation | An XPath expression identifying elements in the external resource that should be compared to the ones in the Document currently opened in the Author Mode. |
namespacePrefixes | The namespace prefixes used in requestedElementLocation , fragment and/or selectableNameExpression , separated by new lines. (This list must contain as many values as the following one!) |
namespaceURIs | The namespace URIs used in requestedElementLocation , fragment and/or selectableNameExpression , separated by new lines. (This list must contain as many values as the preceding one!) |
dialogTitle | The title of the generated dialog. (defaults to Import elements) |
selectableNameExpression | An XPath expression relative to the result(s) of requestedElementLocation that should be used to create selectable options in the generated dialog. |
selectionLabel | The text that should displayed next to the selection. (defaults to Choose element) |
valueExpression | An XPath expression relative to the result(s) of requestedElementLocation that should be used to create the new value of the attribute to be edited from the selected option. |
org.adwmainz.da.extensions.importmore.operations.ImportElementsOperation
Extends the built-in InsertFragmentOperation by adding the possibility to insert one or more elements from an external resource that are chosen by a user with a custom dialog. It adds the following arguments (while removing the argument fragment
):
Argument | Description |
---|---|
resourceLocation | The URL of the external resource containing the original elements. (You may use AskMoreAnnotations here.) |
requestedElementLocation | An XPath expression identifying elements in the external resource that should be compared to the ones in the Document currently opened in the Author Mode. |
namespacePrefixes | The namespace prefixes used in requestedElementLocation , equalElementExpression and/or selectableNameExpression , separated by new lines. (This list must contain as many values as the following one!) |
namespaceURIs | The namespace URIs used in requestedElementLocation , equalElementExpression and/or selectableNameExpression , separated by new lines. (This list must contain as many values as the preceding one!) |
dialogTitle | The title of the generated dialog. (defaults to Import elements) |
selectableNameExpression | An XPath expression relative to the result(s) of requestedElementLocation that should be used to create selectable options in the generated dialog. |
localElementLocation | An XPath expression identifying elements in the Document currently opened in the Author Mode that should be compared to the ones from the external resource. |
equalElementExpression | An XPath expression relative to the result(s) of requestedElementLocation that should be used to declare an external element as equal to a local one. |
Since this operation is similar to the previous one, let's stay with the same example and consider a situation in which you want to add one or more of the Digital Humanities centers and institutions listed in this Wikipedia entry as they are (i.e. li
nodes) into the current document. You could then use the following argument values ...
Argument | Value |
---|---|
resourceLocation | https://en.wikipedia.org/w/index.php?title=Digital_humanities&oldid=910043528 |
requestedElementLocation | //span[@id="Centers_and_institutes"]/parent::h3/following-sibling::ul[following-sibling::h3]/li |
localElementLocation | //li |
dialogTitle | DH Institutions |
... to build this import dialog:
Please note that the argument localElementLocation prevents elements from being imported twice. If you do not want to use this feature, you can use an XPath that does not identify already imported nodes.
org.adwmainz.da.extensions.importmore.operations.ImportToResultsViewOperation
Extends the DisplayInResultsViewOperation from AskMore by adding the possibility to fetch parts of the ResultsView entry from an external resource and adds the following arguments (while removing the argument elementLocation
):
Argument | Description |
---|---|
resourceLocation | The URL of the external resource containing the original elements. (You may use AskMoreAnnotations here.) |
requestedElementLocation | An XPath expression identifying elements in the external resource that should be compared to the ones in the Document currently opened in the Author Mode. |
namespacePrefixes | The namespace prefixes used in requestedElementLocation , message and/or systemId , separated by new lines. (This list must contain as many values as the following one!) |
namespaceURIs | The namespace URIs used in requestedElementLocation , message and/or systemId , separated by new lines. (This list must contain as many values as the preceding one!) |
Please note that you may import one or more parts of the arguments message
and/or systemId
by using ImportAnnotations.
org.adwmainz.da.extensions.importmore.operations.InsertOrReplaceImportedElementOperation
Extends the InsertOrReplaceAnnotatedFragmentOperation from AskMore by adding the possibility to fetch a node from an external resource (instead of inserting a custom fragment) and adds the following arguments (while removing the argument fragment
):
Argument | Description |
---|---|
resourceLocation | The URL of the external resource containing the original elements. (You may use AskMoreAnnotations here.) |
requestedElementLocation | An XPath expression identifying elements in the external resource that should be compared to the ones in the Document currently opened in the Author Mode. |
namespacePrefixes | The namespace prefixes used in requestedElementLocation , separated by new lines. (This list must contain as many values as the following one!) |
namespaceURIs | The namespace URIs used in requestedElementLocation , separated by new lines. (This list must contain as many values as the preceding one!) |
org.adwmainz.da.extensions.importmore.operations.IsInListCheckOperation
This custom operation is similar to the ImportToResultsViewOperation explained above in that it affects only the ResultsView of the Oxygen XML Editor. However, it displays only elements from an external resource if they are not found in the Document currently opened in the Author Mode and has the following arguments:
Argument | Description |
---|---|
resourceLocation | The URL of the external resource containing the original elements. (You may use AskMoreAnnotations here.) |
requestedElementLocation | An XPath expression identifying elements in the external resource that should be compared to the ones in the Document currently opened in the Author Mode. |
namespacePrefixes | The namespace prefixes used in requestedElementLocation , separated by new lines. (This list must contain as many values as the following one!) |
namespaceURIs | The namespace URIs used in requestedElementLocation , separated by new lines. (This list must contain as many values as the preceding one!) |
localElementLocation | An XPath expression identifying elements in the Document currently opened in the Author Mode that should be compared to the ones from the external resource. |
resultsTabName | The name of the tab in the Results View that should be used. (defaults to Found differences) |
message | The message that should be displayed in the Results View next to each identified element (defaults to Found difference ) |
noResultMessage | The message that should be displayed if no elements are identified by requestedElementLocation (defaults to The action returned no results ) |