[jira] [Updated] (TEXT-229) Add XmlEncoderStringLookup/XmlDecoderStringLookup

2023-08-15 Thread Michael Osipov (Jira)


 [ 
https://issues.apache.org/jira/browse/TEXT-229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Osipov updated TEXT-229:

Assignee: Michael Osipov

> Add XmlEncoderStringLookup/XmlDecoderStringLookup
> -
>
> Key: TEXT-229
> URL: https://issues.apache.org/jira/browse/TEXT-229
> Project: Commons Text
>  Issue Type: New Feature
>Affects Versions: 1.10.0
>Reporter: Michael Osipov
>Assignee: Michael Osipov
>Priority: Major
>
> While we have URL encoder and decoder it'd be helpful to have builtin 
> {{XmlEncoderStringLookup}} and {{XmlDecoderStringLookup}}.
> A quick hack works for me:
> {code:java}
>   public static void main(String[] args) {
>   Map lookups = new HashMap<>();
>   lookups.put("xmlEncoder", XmlEncoderStringLookup.INSTANCE);
>   Map vars = new HashMap<>();
>   vars.put("foo", "bar");
>   vars.put("baz", "");
>   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: bar='sdfsf' />} ${xmlEncoder:${baz}}"));
>   }
> {code}
> {noformat}
> bar, foo bar=sdfsf / password
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)


[jira] [Updated] (TEXT-229) Add XmlEncoderStringLookup/XmlDecoderStringLookup

2023-08-15 Thread Michael Osipov (Jira)


 [ 
https://issues.apache.org/jira/browse/TEXT-229?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Michael Osipov updated TEXT-229:

Fix Version/s: 1.11.0

> Add XmlEncoderStringLookup/XmlDecoderStringLookup
> -
>
> Key: TEXT-229
> URL: https://issues.apache.org/jira/browse/TEXT-229
> Project: Commons Text
>  Issue Type: New Feature
>Affects Versions: 1.10.0
>Reporter: Michael Osipov
>Assignee: Michael Osipov
>Priority: Major
> Fix For: 1.11.0
>
>
> While we have URL encoder and decoder it'd be helpful to have builtin 
> {{XmlEncoderStringLookup}} and {{XmlDecoderStringLookup}}.
> A quick hack works for me:
> {code:java}
>   public static void main(String[] args) {
>   Map lookups = new HashMap<>();
>   lookups.put("xmlEncoder", XmlEncoderStringLookup.INSTANCE);
>   Map vars = new HashMap<>();
>   vars.put("foo", "bar");
>   vars.put("baz", "");
>   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: bar='sdfsf' />} ${xmlEncoder:${baz}}"));
>   }
> {code}
> {noformat}
> bar, foo bar=sdfsf / password
> {noformat}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)