Details
-
New Feature
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
1.10.0
-
None
Description
While we have URL encoder and decoder it'd be helpful to have builtin XmlEncoderStringLookup and XmlDecoderStringLookup.
A quick hack works for me:
public static void main(String[] args) { Map<String, StringLookup> lookups = new HashMap<>(); lookups.put("xmlEncoder", XmlEncoderStringLookup.INSTANCE); Map<String, String> vars = new HashMap<>(); vars.put("foo", "bar"); vars.put("baz", "<password>"); StringLookupFactory factory = StringLookupFactory.INSTANCE; StringLookup interpolatorStringLookup = factory.interpolatorStringLookup(lookups, factory.mapStringLookup(vars), false); StringSubstitutor sub = new StringSubstitutor(interpolatorStringLookup); sub.setEnableSubstitutionInVariables(true); System.out.println(sub.replace("${foo}, ${xmlEncoder:<foo bar='sdfsf' />} ${xmlEncoder:${baz}}")); }
bar, <foo bar='sdfsf' /> <password>
Attachments
Issue Links
- links to