get line number using offset position thorough API

Oxygen general issues.
guna@ebscohost.com
Posts: 27
Joined: Tue Nov 17, 2009 10:16 pm

get line number using offset position thorough API

Post by guna@ebscohost.com »

Hi,
Is there a way to get the line number of caret offset in oxygen author mode.
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: get line number using offset position thorough API

Post by Radu »

Hi Guna,

The text is presented in the Author page with all text normalized and with many of the line breaks removed. Only on serialization (on Save) the text is formatted and line breaks are added to it.
So while working in the Author mode there is no way to map the current offset to the original line in the XML document.
What exactly are you trying to accomplish? Maybe we can give you a workaround.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
guna@ebscohost.com
Posts: 27
Joined: Tue Nov 17, 2009 10:16 pm

Re: get line number using offset position thorough API

Post by guna@ebscohost.com »

hi,
we have external links(like links to yahoo,google,etc..) inside the xml document, we have provided an icon to validate all the links inside the xml document(the validate opration, would go an check where the url is active and correct).

while doing so, if there is an error url. we want to direct the user to fix the issue by showing them the line number, saying that link is borken.
Radu
Posts: 9055
Joined: Fri Jul 09, 2004 5:18 pm

Re: get line number using offset position thorough API

Post by Radu »

Hi,

Maybe you can present in a not modal dialog's list all the problems to the users.
For each problem you will keep the AuthorNode for which the problem had occurred.
Then the user can click the problem in the list and you will select the node in the Author page like:

Code: Select all


authorAccess.getEditorAccess().select(problemNode.getStartOffset(), problemNode.getEndOffset());
In this way the user has instant feedback for each problem.

Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
Post Reply