Opening included file from including content

<oXygen/> general issues.
dcramer
Posts: 159
Joined: Sat Aug 28, 2010 1:23 am

Opening included file from including content

Post by dcramer » Sun Nov 21, 2010 9:39 am

Hi there,
Say you have book.xml which xincludes a lengthy chapter_01.xml and several other chapter files. Say you have book.xml opened. You have scrolled down to a specific sentence in chapter_01.xml and realize you want to edit it.

To do this, as far as I can tell, you must currently,:

1. Scroll up to the top of chapter_01.xml (e.g. by clicking the file name in the node path list at the top of the window) and then,

2. Click on the icon to open the chapter_01.xml.

3. Scroll down to the sentence you wanted to edit again, however you can't glance back to book.xml to remember which sentence you wanted to change because you had to lose that place in order scroll up and open chapter_01.xml.

So my question is: Is it possible to open an xincluded from an including file without scrolling up to the top of the included file in the including file? I was hoping to find a contextual menu item "Open current included file" when I right click inside included content from within the including file.

That was challenging to explain, so let me know if you need clarification on the problem I'm trying to describe.

Thanks,
David

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Opening included file from including content

Post by Radu » Mon Nov 22, 2010 11:41 am

Hi David,

In the Author contextual menu there is an action called Open file at caret which should open the referenced file if the caret is located inside its expanded content.
It can also be triggered with the Ctrl-ENTER shortcut.
Does this action do what you requested?

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

dcramer
Posts: 159
Joined: Sat Aug 28, 2010 1:23 am

Re: Opening included file from including content

Post by dcramer » Mon Nov 29, 2010 9:44 pm

Indeed it does. I thought that was just for opening a file name from the text editor and didn't realize it would open an xincluded file too.

Thanks!
David

ra0543
Posts: 80
Joined: Wed Jan 14, 2009 12:50 pm

Re: Opening included file from including content

Post by ra0543 » Wed May 18, 2011 6:42 pm

Is it possible to configure the default action of the 'open file at caret mark' as not just opening that file but also then moving to the relevant place in that file?

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Opening included file from including content

Post by Radu » Thu May 19, 2011 2:51 pm

Hi Richard,

So you have in an XML file a reference to another XML file (or to some other part of the XML file) and you want the Ctrl-Enter to take you to the referenced XML element:

You first need to have an anchor defined on the reference link like:
href="sample.xml#anchorName"

If you have links like this then when opening the target file Oxygen will try to find and select the XML element which "matches" the "anchorName" attribute value.
By default Oxygen looks at ID-type attributes (either xml:id or attributes defined in the associated schema as having ID type).
But we also have some special implementations depending on the type of XML document (DITA, XHTML, etc). For example on XHTML we look for <a name="anchorName"> in the target file.

You can also add your own handling for a certain type of XML by adding a document type association in the Document Type Association Preferences page. In the Extensions tab you can add a Link Target Element Finder Java implementation of a certain API interface which will let you decide when the target element is found.
Our API and documentation for creating document type customizations can be found here:
http://www.oxygenxml.com/developer.html ... horing_SDK

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

ra0543
Posts: 80
Joined: Wed Jan 14, 2009 12:50 pm

Re: Opening included file from including content

Post by ra0543 » Thu May 19, 2011 4:31 pm

No that's not what I meant. I often have file such as the following, i.e. just a shell with lots of xincludes:

Code: Select all


<base xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xi="http://www.w3.org/2001/XInclude"
xsi:noNamespaceSchemaLocation="../Schema/myschema.xsd">
<xi:include href="../Data/r192.xml" xpointer="r192"/>
<xi:include href="../Data/r193.xml" xpointer="r193"/>
<xi:include href="../Data/r194.xml" xpointer="r194"/>
<xi:include href="../Data/r195.xml" xpointer="r195"/>
<xi:include href="../Data/r196.xml" xpointer="r196"/>
<xi:include href="../Data/r197.xml" xpointer="r197"/>
<xi:include href="../Data/r198.xml" xpointer="r198"/>
<xi:include href="../Data/r199.xml" xpointer="r199"/>
<xi:include href="../Data/r200.xml" xpointer="r200"/>
<xi:include href="../Data/r201.xml" xpointer="r201"/>
<xi:include href="../Data/s201.xml" xpointer="s201"/>
<xi:include href="../Data/s202.xml" xpointer="s202"/>
<xi:include href="../Data/s203.xml" xpointer="s203"/>
<xi:include href="../Data/s204.xml" xpointer="s204"/>
</base>
If I open this file in author mode and then, say, do a search for 'text' in it, I get taken to the relevant places where that string is found. Or I might just scroll through that file checking the content.

The point is that, as I look through that file in author mode, if I see at one some place something I want to change, (because I can't edit the xincluded content directly) I use the 'Open file at caret' to open the xincluded file so that I can edit that. If I do that, I of course get the relevant xincluded file opened. But I then have to search again through that newly opened file until I get to the equivalent place I was at in the xincluding file, whereas it would nice if the cursor position etc. could optionally be positioned straightaway at the right place in the newly opened file, i.e. corresponding to where the cursor was in the xincluding file, rather than just at the start of it.

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Opening included file from including content

Post by Radu » Thu May 19, 2011 5:32 pm

Hi Richard,

Tough one but I understand the use case.
We'll discuss this for a future version. Who knows, maybe in the future we will manage to remove the limitation of not being able to edit in xi:included content.

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

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Opening included file from including content

Post by Radu » Mon Jul 18, 2011 4:22 pm

Hi Richard,

When Oxygen 13 will be released (in September this year) when right clicking in a read-only xi:include area you will have a contextual menu action called Edit Reference which will try to open the target file and position the caret exactly in the content which was at caret position in the Author page of the main document.

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

dcramer
Posts: 159
Joined: Sat Aug 28, 2010 1:23 am

Re: Opening included file from including content

Post by dcramer » Wed Jul 20, 2011 7:17 pm

That will be a nice improvement! I'm looking forward to it.

One addition to it: I notice that spell checking underlines misspelled words in xincluded content. That makes sense. However, when you right-click on an underlined word in xincluded content it gives no indication that correcting it is impossible. Instead you get a list of suggestions. If you pick an item in that list, it quietly ignores you. A naive user might not even notice that the word wasn't really corrected.

When a misspelled word is in xincluded content, you might instead replace the normal list of suggestions with the option to open the file so that the user can correct the term. Or some other behavior to improve the usability in this situation.

Thanks,
David

Radu
Posts: 7032
Joined: Fri Jul 09, 2004 5:18 pm

Re: Opening included file from including content

Post by Radu » Thu Jul 21, 2011 8:40 am

Hi David,

You're right about this one, I added an improvement request to correct this behavior.

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

Post Reply