how to adding tags (semi)automatically?

Questions about XML that are not covered by the other forums should go here.
xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

how to adding tags (semi)automatically?

Post by xinelo »

Hello,

I've started using Oxygen and so far I've found it very useful for editing dtd and xml documents.

However there's a feature I woud need and don't find and would like to ask if it exists.

I've got a document with my own xml tags and a dtd with the corresponding elements and attributes defined. Everything works so far (my document is well-formed and valid).

The problem is that I have to tag my texts manually and I've got a huge number of texts to tag. It would be ideal if there was a button or a pull-down menu where I can click to add my own tag to a pre-selected part of the text.

I'm thinking of something similar to the auto-completion option which appears when you write the dtd (eg. you type <! and you just have to press Enter to have ELEMENT or ATTLIST or whatever).

I would be very grateful if you could explain how to use this feature in the editor (if it exists at all). If it doens't exist, I'll send a feature request.

Thanks a lot! Cheers, xinelo
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

Hello,

If you have the text content, you have to surround regions of text in some tags and the DTD declares the needed element names then you just have to use the Surround with ... group of actions available on the Refactoring submenu of the popup menu of the editor panel. To find their description in the manual available from Help -> Help just search for surround in the Search tab of the Help dialog.


Regards,
Sorin
xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

permanently within sight?

Post by xinelo »

Thanks a lot Sorin,

I found the surround with option. I can apply the initial and ending tags selecting the region of text and right clicking on it or clicking Ctrl E, then I select the tag name and click ok. It's also good to see that it already restricts the range of entity names that I can apply (according to my definition in the schema, I suppose).

Thank you so much for your help!

Have a good day, xinelo
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

After a Surround with action you can repeat it quickly for the same tag name without getting through the dialog by pressing CTRL + / (Surround with <latest-tag-used-in-Surround-with>). This action is also available on the Refactoring submenu and the shortcut can be changed in Options -> Preferences -> Menu Shortcut Keys.


Regards,
Sorin
xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

attributes?

Post by xinelo »

Hi Sorin,

The Menu Shortcut Keys will come in useful as I can't use the shortcut Ctrl + / in my Spanish keyboard (maybe because I need to press shift to get the / ). That's sorted, I assigned another key combination and it works perfectly.

The thing is that, as I said the 'Surround with tag' functionality is very useful for me and other colleagues, but we've just realised we would also find very useful not only being able to add the entity name (the initial and ending tags) but also the attributes of the entity.

I was about to as whether that can be done in a similar manner as the surround tag thing (that is, with a shortcut) and at the same time but I did a bit of playing around and found that Perspective > Show view > Attributes shows a menu that lets me apply the legal attributes and, even, choose a legal value (if declared in a schema) or enter a value (if with dtd).

We're very happy with this editor!

Thanks a lot for the help!

xinelo
sorin_ristache
Posts: 4141
Joined: Fri Mar 28, 2003 2:12 pm

Post by sorin_ristache »

You mean the Attributes view which displays the attributes of the element at cursor position. It is a floating and dockable view so you can move it to any location on screen if you do not like the default location. You can move it by a drag and drop action on the title bar of the view.


Regards,
Sorin
xinelo
Posts: 33
Joined: Wed Oct 04, 2006 6:25 pm

Post by xinelo »

Thanks Sorin,

I'll bear it in mind, although the default position is okay.

Kind regards, xinelo
Post Reply