Page 1 of 1

Plugin development - XPath on current document.

Posted: Thu Oct 30, 2008 8:31 pm
by calvados
Hi there,

I was wondering how it would be possible to programatically perform an XPath query on the currently open document that has not yet been saved.

Thanks,

Cal.

Re: Plugin development - XPath on current document.

Posted: Fri Oct 31, 2008 12:33 pm
by sorin_ristache
Hello,

In the current version (Author version 10.0) running an XPath query in a custom extension is not possible. It would be possible if the nodes of the Author document were exposed in the Author API but that is an enhancement for a future version.


Regards,
Sorin

Re: Plugin development - XPath on current document.

Posted: Fri Dec 19, 2008 10:18 pm
by calvados
Hi Guys,

As my development of Author Extensions continues, I'm repeatedly being limited in what I can do due to the lack of xPath functionality in the api.

- Do you guys have a planned release version in which I might expect xPath functionality on the current document from my java author extensions?
- Do you have any further suggestions about how I may achieve the same functionality within the current scope of the 10.0 api?

I'm currently using an overly complex system of start and end node offsets and temporary <marker/> tags to navigate around the document.

Any help, or an estimated release version and date would be greatly appreciated.

Thanks for your continuing help and attention with this matter.

Cal.

Re: Plugin development - XPath on current document.

Posted: Mon Dec 22, 2008 1:36 pm
by iulian_velea
As Sorin noted in his post, currently there is no API available for executing an XPath query from your extension.
You probably are familiar with the current API for navigating in the AuthorDocument and the other functionality we are providing for executing various operations on the document.
The main classes that should be looked at in my opinion are:

Code: Select all

ro.sync.ecss.extensions.api.AuthorAccess
and

Code: Select all

ro.sync.ecss.extensions.api.AuthorDocumentController
It would be helpful if you could describe what you need to do more exactly.

Best wishes,
Iulian

Re: Plugin development - XPath on current document.

Posted: Tue Dec 30, 2008 2:30 am
by calvados
Hey Iulian,

What I'm trying to do is grab the children of a node as a "snippet" of XML text. For example, to get the "snippet" children of "clause" given the source:

Code: Select all


<clause>
<num/>
<text id='123'>three <item id='456'>nuts</item></text>
</clause>
I would want a string that reads

Code: Select all

"<num/><text id='123'>three <item id='456'>nuts</item></text>"
I have scoured both the AuthorAccess and AuthorDocumentController API's to no avail. A query like this would be very simple to execute with xPath.

Is this functionality scheduled to be released in an future version of oXygen?...and if so, is there an anticipated release date?

I have many more scenario's in which xPath functionality would be required to perform the tasks I need to complete, and I'm desperate to find a solution to this problem.

Thanks for your help.

Cal.

Re: Plugin development - XPath on current document.

Posted: Mon Jan 05, 2009 8:31 pm
by calvados
Anybody?

Re: Plugin development - XPath on current document.

Posted: Tue Jan 06, 2009 12:58 pm
by sorin_ristache
Hello,
calvados wrote:Is this functionality scheduled to be released in an future version of oXygen?...and if so, is there an anticipated release date?
This functionality is scheduled for version 10.1 which will be released probably in February 2009.
calvados wrote:I have many more scenario's in which xPath functionality would be required to perform the tasks I need to complete, and I'm desperate to find a solution to this problem.
If you cannot wait until Oxygen version 10.1 you can execute an XPath expression on a DOM tree that you can build by wrapping each node of the Author document in a DOM node. The nodes of the Author document can be obtained with methods of classes ro.sync.ecss.extensions.api.AuthorAccess and ro.sync.ecss.extensions.api.AuthorDocumentController. For example you can find the root of the Author document with the methods AuthorAccess.getDocumentController(), AuthorDocumentController.getNodeAtOffset(), AuthorNode.getParent() (you can call getParent() recursively) and AuthorElement.getContentNodes(). The AuthorNode objects from the Author document that represent XML elements of your document (for example <num/>, <text id='123'>three <item id='456'>nuts</item></text>, etc) are also AuthorElement objects so you can call AuthorElement.getContentNodes() to find the child nodes and wrap them in DOM nodes.


Regards,
Sorin

Re: Plugin development - XPath on current document.

Posted: Tue Jan 06, 2009 5:04 pm
by Dan
Hello Cal,
We have this functionality under development as we speak. Write to support to obtain the download link to a beta version of oXygen 10.1.

Best regards,
Dan