Can we use regular expressions to identify xml tags?

On 19 June 2013 15:55, Miyuru Wanninayaka <[email protected]> wrote:

> Hi Srinath,
>
> This is a dumb code written by me :) sometime back because I didn't found
> any other reliable way to find whether string is really a xml or not. Is
> there any?
>
>
> 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
>>
>>
>
>
> --
> Miyuru Wanninayaka
> Technical Lead
> WSO2 Inc. : http://wso2.com
>
> Mobile : +94 77 209 9788
> Blog : http://miyurudw.blogspot.com
> Flickr : http://www.flickr.com/photos/miyuru_daminda
> _______________________________________________
> Dev mailing list
> [email protected]
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>


-- 
-Ratha
mobile: (+94)755906608
_______________________________________________
Dev mailing list
[email protected]
http://wso2.org/cgi-bin/mailman/listinfo/dev

Reply via email to