Search and replace the XML content of a map

You can search and replace XML text strings within the topics of a map.

Prerequisites:

Documents must be locked for the replace operation to succeed. You can lock the documents before beginning or allow the CCMS to lock them for you during the process.

CAUTION:
This feature is capable of altering the XML code in your documents and could make your documents invalid.

To replace a particular text string across all topics of a map:

  1. Open the DITA perspective.
  2. Open a map in the DITA Map view.
    Note: Maps and topics being targeted must have an editable status (that is, they can be locked). For most document teams, this means any state within the Authoring cycle. Maps or topics that are not in a lockable state, that are not in the Authoring cycle for example, are skipped.
  3. (Optional) To search only certain topics in the map, select the target topics.
  4. Click the DITA Map view’s Menu button Down arrow.
  5. Select Search and Replace.
    The Search and Replace dialog box appears:

    Figure: Search and Replace



  6. Under Containing text, enter the search string.
    To search using recently used text or expressions, click the list under Containing text and make a selection.
    Note: Your search string can include wildcards, but it cannot include operators.
  7. Optional: If desired, select one or more Options:
    • Case Sensitive to find only text that matches the case in your search string.
    • Whole Word to find only whole words that match the search string. (If this is selected, a search for "cat" would ignore the word "caterpillar".)
    • Regular expression if your search uses a codified pattern to represent multiple characters. If this option is not selected, the [ ] characters, if used, will be interpreted as wildcards.
  8. If you are targeting selected documents (Step 3), under Applies to, click Selection.
    By default, the All option is selected under Applies to.
  9. Click Replace.
    Note: If any of the target documents are unlocked, the Unlocked Documents confirmation window appears. Click Yes to continue with the replace operation.

    Figure: Found Unlocked Documents



    The Replace Text Matches dialog appears:

    Figure: Replace Text



  10. Enter your replacement text in the With field or select it from the drop-down list.
    The Regular expression checkbox will be selected if you chose this option for your search.
  11. Optional: To review the changes you're about to make, click Preview.
    Note: You can also apply changes globally without previewing them by clicking OK. However, this option is not recommended unless you are absolutely certain that the changes will not negatively affect your XML tags and/or change text you don't want changed.
    The Replace Text Matches dialog box appears:

    Figure: Previewing text changes



  12. Under Changes to be performed, select the first change in the list.
    The search string is highlighted under Original Source, and the replacement string is highlighted under Refactored Source.
  13. Do one of the following:
    • If the change is acceptable, do nothing and repeat from Step 12 for the next document in the list.
    • If the change is not what you wanted, under Changes to be performed, clear the checkbox for that particular replacement.
  14. Click OK when you are finished.
    The replacement action is carried out in the selected documents.