Overview
Introduction
Renaming one tag across a whole XML document by hand means finding and fixing both the opening and closing tag, every time it appears.
This tool does it in one pass.
What Is XML Key Replacer?
A tag-renaming tool that walks the parsed document and renames every element with an exact tag-name match, at any depth.
It then re-serializes the result.
How XML Key Replacer Works
The document is parsed into a tree, then walked recursively, renaming the `tag` field of any element that exactly matches the search name.
The result is re-serialized with the same pretty-printer the Prettifier uses.
When To Use XML Key Replacer
Use it when migrating a document to a renamed schema.
It's also useful for standardizing an inconsistently-named tag across a large file.
Often used alongside XML Value Replacer, XML Key Extractor and XML Key Finder.
Features
Advantages
- Renames both opening and closing tags consistently by construction.
- Leaves attributes and content untouched.
- Runs entirely client-side.
Limitations
- Matching is exact and case-sensitive, no partial or fuzzy renaming, run it multiple times for multiple different tag names.
- There's no undo beyond re-pasting your original input, keep a copy before renaming if you're not sure.
Examples
Best Practices & Notes
Best Practices
- Double-check the exact tag name (including case) before renaming, matches are case-sensitive by design.
- Run XML Key Finder first to confirm exactly how many elements will be affected.
- Rename one tag at a time and re-check the output before chaining multiple renames.
Developer Notes
Renaming rebuilds the tree via a recursive `map`, so it's a pure transformation, no mutation of the parsed input.
XML Key Replacer Use Cases
- Migrating a document to a renamed schema
- Standardizing an inconsistently-named tag across a file
- Fixing a tag name typo that was baked into a generated document
Common Mistakes
- Assuming case-insensitive matching, tag names must match exactly.
- Trying to rename multiple different tags in a single pass, run the tool once per tag name.
Tips
- Use XML Key Finder first to confirm the exact tag name and how many times it appears before renaming.
- Check the FAQ above if the output doesn't look like what you expected.