tweezy23 / anyedittools

Automatically exported from code.google.com/p/anyedittools
2 stars 0 forks source link

Add option to convert only XML entities #68

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
Similar to what you've already implemented for HTML entities, I'd like to be 
able to convert only to/from XML entities, while leaving other characters 
untouched:

- <
- >
- "
- '
- &

This could prove quite useful when editing XML

Original issue reported on code.google.com by lukas.eder@gmail.com on 17 Apr 2012 at 1:27

GoogleCodeExporter commented 9 years ago
Do you mean this:
http://www.w3.org/TR/xml-entity-names/
http://www.w3.org/TR/xml-entity-names/bycodes.html
http://www.w3.org/TR/xml-entity-names/byalpha.html
?

Looks like a LOT of work.
I'm sorry to say, that I'm personally have no free time to implement this.
If you or anyone would contribute a patch, I offer code review and integration.

Regards,
Andrey

Original comment by iloveeclipse on 17 Apr 2012 at 8:49

GoogleCodeExporter commented 9 years ago
Thanks for the feedback. I don't mean the huge lot of extended entity names. 
Usually, XML is encoded in UTF-8, so most special characters can be simply 
written as such. But the five main XML Entity names as I mentioned, are quite 
useful to encode and decode, when dealing with XML/XSL, etc, as they tend to 
cause syntax problems with XML itself.

A possible use-case is when I write JavaScript code inside an XSL file. In that 
case, I will use a lot of "&&", "<", ">" for JavaScript boolean expressions. 
They need to be escaped, when put in an XSL file.

If you think that's too much work, feel free to keep this issue as a low-prio 
feature request on the roadmap...

Original comment by lukas.eder@gmail.com on 17 Apr 2012 at 9:25

GoogleCodeExporter commented 9 years ago
... scratching the head ...
But those entities are already available for converting force and back via 
"Convert from/to HTML entities"? Or I'm missing something obvious? Might be an 
example would help?

Original comment by iloveeclipse on 17 Apr 2012 at 9:33

GoogleCodeExporter commented 9 years ago
Yes, but I don't want to convert umlauts...

if (x == "äöü" && y == 3) {
}

should be transformed into

if (x == "äöü" && y == 3) {
}

instead of

if (x == "äöü" && y == 3) {
}

because the ä ö ü HTML entities aren't valid XML entities... It's a minor 
thing, but it might be useful to some users - such as in my use case, when 
transforming XML to JavaScript with XSL...

Original comment by lukas.eder@gmail.com on 17 Apr 2012 at 9:38