Adding a new attribute to an element: search and replace
Questions about XML that are not covered by the other forums should go here.
-
- Posts: 18
- Joined: Fri Feb 18, 2011 2:29 pm
Adding a new attribute to an element: search and replace
I'm trying to work how to achieve the following using Oxygens "find and replace in files" feature.
Find these elements:
//thead/row/entry
Add an attribute role="col" to each entry element that you find.
//thead/row/entry[@role="col"]
I'm not sure which XML find options to enable.
I used Restrict to XPath: //thead/row/entry
after that I was stumped.
Find these elements:
//thead/row/entry
Add an attribute role="col" to each entry element that you find.
//thead/row/entry[@role="col"]
I'm not sure which XML find options to enable.
I used Restrict to XPath: //thead/row/entry
after that I was stumped.
-
- Posts: 2879
- Joined: Tue May 17, 2005 4:01 pm
Re: Adding a new attribute to an element: search and replace
Hello,
Oxygen's find/replace features are string/regular expression driven, with some XML filtering.
Restrict to XPath: //thead/row/entry is a good start, this will limit the search domain to entry elements. Note that this only restricts the domain, you still have to search for an actual string(or regular expression).
Text to find: <entry
Replace with: <entry role="col"
Whole word only enabled to avoid partial matches
Press Replace All to perform the replacement.
Regards,
Adrian
Oxygen's find/replace features are string/regular expression driven, with some XML filtering.
Restrict to XPath: //thead/row/entry is a good start, this will limit the search domain to entry elements. Note that this only restricts the domain, you still have to search for an actual string(or regular expression).
Text to find: <entry
Replace with: <entry role="col"
Whole word only enabled to avoid partial matches
Press Replace All to perform the replacement.
Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Return to “General XML Questions”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service