简体   繁体   中英

How to remove special characters from a XML Document?

Input:

<author>John & Fleck</author>

<date>Jun<e> 2002</date>

<keyword>example <keyword</keyword>

Output:

<author>John  Fleck</author>

<date>June 2002</date>

<keyword>example keyword</keyword>

I want to keep the xml doc intact and remove the special characters as you can see in the above example

You're not trying to remove special characters from an XML Document.

You're trying to convert a non-XML document to XML.

To do that you need to parse the non-XML document, and to do that you need to know (a) the grammar to which it conforms and (b) the rules for how this grammar maps to the grammar of XML.

You haven't told us anything about this grammar; you've just given one example of a non-XML document, and that's not enough to infer the general rules.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM