Saturday, April 03, 2010

XMLValidator - simple way to check if String is formated as valid XML

There are probably more solutions out there for this, but i want to share with you how i check if the String is formatted as valid XML. I made a simple class with one static method to achieve this. You can download it from here and you can use it easily by calling isValid method:

import com.candymandesign.flash.validators.XMLValidator;
XMLValidator.isValid(yourStringGoesHere);

Example above will return true or false as result.

3 comments:

  1. I've make same validation, but problem is, that this validator also validate plain string, which I dont want to validate :) String is string and not XML :)

    ReplyDelete
  2. The download link is broken.

    ReplyDelete
  3. Anonymous11:48 PM

    Can you post the source code here please.

    ReplyDelete