Updating Cross Reference Text Between Files [Oxygen XML Web Author]

<oXygen/> general issues.
john_m
Posts: 32

Updating Cross Reference Text Between Files [Oxygen XML Web Author]

Fri Jun 02, 2017 8:18 pm

Hello,

I am having an issue writing code that keeps the cross reference text updated between files.

For example, I have two xml documents: docOne.xml and docTwo.xml. If docTwo.xml has a reference to a title in docOne.xml - and the title in docOne.xml is updated, I would like that change to be reflected in docTwo.xml (when it refreshes - does not have to be in real time).

Specifically, I'd like to retrieve the TextContent() value from <title> nodes found across several .xml files (which are stored in the same directory). I would like to use the retrieved value to update the Link Text Value in several anchor tags with a currently viewed document.

I am extending the LinkTextResolver class in which I am overriding the resolveReference method. Within the resolveReference method I am using :

Code: Select all

Object[] nodes =  authorAccess.getDocumentController().evaluateXPath("collection('"+searchDirectory+"?select=*.xml')//title[@id='" + idValue + "']", authorNode,false,false,false,false);

To scan all .xml files within the defined directory, ‘searchDirectory’ in search of the <title> element with the matching ‘idValue’ . This works fine in the Oxygen XML Editor v19.0 desktop application when ‘searchDirectory’ points to a location on a local drive.

However when I deploy to the Oxygen WebAuthor v19.0 environment where the source .xml files are accessed via WebDav the function fails. Here in lies the issue and my question. I have modified ‘searchDirectory’ to point to the correct http:// location however I receive a “500 Internal Server Error” due to the permissions on WebDav.

Is the a way for me to obtain a WebDavUrlConnection using the current user's credentials from within LinkTextResolver ? I can’t seem to find any method or approach for doing so.

Is this approach completely insane? Is there an easier way to achieve what I am attempting? I just need to keep the reference text content current in any document while it is being viewed.

Any thoughts or suggestions would be greatly appreciated!

Thank you!
cristi_talau
Posts: 161

Re: Updating Cross Reference Text Between Files [Oxygen XML Web Author]

Tue Jun 06, 2017 9:45 am

Hello,

For example, I have two xml documents: docOne.xml and docTwo.xml. If docTwo.xml has a reference to a title in docOne.xml - and the title in docOne.xml is updated, I would like that change to be reflected in docTwo.xml (when it refreshes - does not have to be in real time).


I tested with DITA files stored on WebDAV. The link text of a cross-reference is updated when the file refreshes.

[quote]Specifically, I'd like to retrieve the TextContent() value from <title> nodes found across several .xml files (which are stored in the same directory)[quote]

The server-side code of Web Author needs to access content stored on the WebDAV server on behalf of multiple users. To track who is the user on behalf of which a WebDAV request is made, Web Author stores a token in the authority section of the base URL of each document opened in an editor.

In order to access the resources using the credentials of the user that opened the edited document, you should try to resolve the path that you are requesting against the base URL of the document.

Example: Let's assume that the user is editing the document http://my-dav-server.com/path/to/file.xml. Your plugin needs to open a file located at http://my-dav-server.com/resources/resource.xml. The natural approach would be to write

Code: Select all

new URL("http://my-dav-server.com/resources/resource.xml").openConnection();


However, in order to use the correct credentials, it is recommended to use

Code: Select all

new URL(document.getSystemID(), "/resources/resource.xml").openConnection();


Best,
Cristian
john_m
Posts: 32

Re: Updating Cross Reference Text Between Files [Oxygen XML Web Author]

Mon Jun 12, 2017 5:13 pm

Hi Christian,

Using document.getSystemID() to get the authority token did the trick. I was able to access the documents as needed using the token!

As always, thanks so much for all of your help!

Return to “Other Issues”

Who is online

Users browsing this forum: No registered users and 2 guests