Derek
Derek

Reputation:

XML editor with proper copy and paste?

I'm looking for an XML editor that lets me type and copy and paste arbitrary text into an XML element or attribute without requiring me to go back through and escape any characters that must use reserved XML entities (ampersands, angle brackets, or quote marks). XMLSpy came up short.

Upvotes: 0

Views: 3141

Answers (5)

Bjorn
Bjorn

Reputation: 733

Know this is probably five years to late, but xmetal does this.

Upvotes: 0

Ben Bryant
Ben Bryant

Reputation: 3143

Firstobject's free XML editor for Windows editable tree view lets you copy paste and edit the element and attribute values without worrying about those special characters (you'll simultaneously see the escaped values in the text view on the right).

Upvotes: 0

Derek
Derek

Reputation:

I just realized I have Visual Studio 2005 and it has the behavior I'm looking for.

Upvotes: 1

ykaganovich
ykaganovich

Reputation: 14964

Do you really expect the editor to know that when you paste a<b it should escape the < , but when you paste a<b/> it shouldn't? Seems like a tall order...

Having thought about this for a bit, I think that what you want can be achieved, either through a separate "Special Paste" command, or a special editor mode.

A Google search reveals that ExchangerXML seems to offer the desired paste behavior.

Another option might be a programmable text or XML editor which can let you define a "macro" for "Paste text and post-process it with the following string substitutions" (or, alternatively, "perform substitutions on the text in clipboard, then paste"). I'll bet emacs can do it, but I'm not an emacs user.

Alternatively, you might consider using CDATA sections and pasting your text unescaped inside those instead. This will work in any editor:

<![CDATA[a<b]]>

Upvotes: 2

Rob Prouse
Rob Prouse

Reputation: 22647

You could use Notepad++ and the TextFX plugin for it.

Notepad++ is a decent free programmer's editor that does XML. Add the TextFX plugin and you will get a menu item TextFX | Encode HTML.

Upvotes: 0

Related Questions