VideosActions for Changing Highlighted Content


In this video demonstration, you will learn how to easily modify, delete, or wrap (with an element) content highlighted through an XPath expression or a Find operation.


00:00:08Working with XML documents implies frequent changes to structure and content.
00:00:13Often, a developer is faced with a situation where a slight change needs to be done in
00:00:19hundreds of places in the same document.
00:00:22oXygen introduced a new feature designed to help you achieve that.
00:00:25Here are a couple of common structure and content changes that may occur when developing
00:00:31an XML document:
00:00:33-wrap an element with other element -delete an attribute
00:00:37-rename an attribute -modify all occurrences of a mispelled word.
00:00:42In our example, the XML Schema file has been modified,
00:00:45altering the XML structure.
00:00:48This means that the XML file that uses this schema will no longer be valid.
00:00:59First we'll fix the validation error that affects the url element.
00:01:04This error occured because the schema has been modified by inserting the "additionalInfo"
00:01:11as the ancestor of the "url" element.
00:01:15To quickly fix this error...
00:01:17We identify all "url" elements by applying an appropriate XPath expression.
00:01:23All matches of the applied XPath expression are highlited in the document.
00:01:28We trigger the contextual menu and from the "Manage Highlighted Content" menu,
00:01:34we choose the "Surround All..." action.
00:01:37Since this action is driven by the associated XML Schema,
00:01:41the input dialog suggests a valid element.
00:01:44Just press "OK" to execute this action.
00:01:48Note that all "url" elements are now surrounded by the "additionalInfo" element.
00:02:00Another change made in the XML Schema that echoed in our XML file
00:02:04is the removal of the "visibleInfo" attribute.
00:02:08Again... we'll apply an XPath expression to identify
00:02:11all occurences of the attribute in question.
00:02:18All occurences of the attribute are now highlighted.
00:02:22We invoke the "Remove all" action from the "Manage Highlighted Content" contextual menu.
00:02:28Note that the "visibleInfo" attributes have been removed.
00:02:37The last validation error is linked to an attribute name change in the XML Schema.
00:02:43To quickly change all occurences of the photo the attribute name and
00:02:50invoke the Find/Replace... action from the toolbar, then hit the "Find all.." button.
00:02:58Note that this matched all attribute's occurences, but also the value of the "note" attribute.
00:03:05We don't want to rename this one, so we'll remove the highlight, thus it will not be
00:03:11renamed by the Modify operation.
00:03:15We invoke the Modify All action from the "Manage Highlighted Content" contextual menu.
00:03:22A warning dialog prompts us that different letter cases were detected and we have to
00:03:28decide which of them will be affected by our modification.
00:03:32We decide to modify only matches with the same lettercase.
00:03:36Note that all matches that will be affected by the future change are now marked with a
00:03:43This allows us to see in real time how the change is being applied.
00:03:48Press Enter to exit the editing mode and apply the change.
00:03:51Now the document is valid.
00:03:59We spotted a mispelled word that propagated in the entire document.
00:04:04The fastest way to fix the problem is the mispelled word and invoke the "Modify
00:04:09all matches" action from the contextual menu.
00:04:12Again, all occurences of this word are marked with a dark grey rectangle
00:04:17and we can immediately start correcting the problem.
00:04:21Press Enter to exit the editing mode and apply the change.
00:04:25As we've seen, this is a powerful feature designed to assist you in quickly solving
00:04:30time consuming repetitive tasks
00:04:33like fixing XML structure errors, renaming multiple occurencies of an attribute or even
00:04:39correcting mispelled words.
00:04:41All these actions are available for highlighted content which can be the result of an XPath
00:04:46or search operation performed in the current document.
00:04:51And this concludes our demonstration.
00:04:53Thanks for watching.