microsoft / microsoft/XmlNotepad

Replace empty elements with new text

Open
#53 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
C#
Stars
1.2k
Forks
240
PR merge metrics
No merged PRs in 30d

Description

Dear All!

Thanks for this great XML editor, especially the validation (dropdowns!) for XSD restrictions is extremely helpful!

I have one question, whether this is possible right now (or in a future update):
If I search for element nodes with existing text in it, I can replace this text by using a /valid/xpath/to/soughtelement/text() xpath search. This replaces the text contained in soughtelement with the new text.

If the text in soughtelement is empty however, I can't make this work, as /valid/xpath/to/soughtelement[not(text())] replaces the whole soughtelement with the new text and /valid/xpath/to/soughtelement[not(text())]/text() doesn't find anything.

Any "hacking" the XML directly is forbidden as the search/replace dialog doesn't allow reserved XML characters.

I'd really appreciate any help on this one!

-regards,
Roland

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with XmlNotepad’s search/replace dialog and its XPath handling, focusing on the difference between replacing an element and replacing its text node. Done means an XPath targeting an empty element can insert replacement text without replacing the element, while still respecting the dialog’s XML-character restrictions.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, xml
Domain
desktop
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.