IINM we just need to know whether the String value is xml or json. Cant we
just count the <, > , </ and /> characters to figure that out. Will
something like {numberOf("</") + numberOf("/>") == numberOf("<")} do the
job? Just an idea.
On Wed, Jun 19, 2013 at 2:41 PM, Srinath Perera <[email protected]> wrote:
> Following is expensive. We generally do not throw exceptions on legal
> execution flow.
>
>
> /2.1.1-wso2v6/modules/core/src/main/java/org/apache/synapse/mediators/transform/PayloadFactoryMediator.java
>
> private boolean isXML(String value) {
> try {
> AXIOMUtil.stringToOM(value);
> } catch (XMLStreamException ignore) {
> // means not a xml
> return false;
> } catch (OMException ignore) {
> // means not a xml
> return false;
> }
> return true;
> }
>
> --
> ============================
> Srinath Perera, Ph.D.
> Director, Research, WSO2 Inc.
> Visiting Faculty, University of Moratuwa
> Member, Apache Software Foundation
> Research Scientist, Lanka Software Foundation
> Blog: http://srinathsview.blogspot.com/
> Photos: http://www.flickr.com/photos/hemapani/
> Phone: 0772360902
>
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
--
Jeewantha Dharmaparakrama
Software Engineer; WSO2, Inc.; http://wso2.com/
Phone : (+94) 774726790
Skype : prasad.jeewantha
LinkedIn : http://www.linkedin.com/in/jeewanthad
Twitter: https://twitter.com/jeewamp
Blog: http://jeewanthad.blogspot.com/
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev