Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- function validate_xml($source) {
- if ($source == '') return true;
- $document = new DOMDocument();
- $fragment = $document->createDocumentFragment();
- return @$fragment->appendXML($source);
- }
- $source = @$_POST['source'];
- $valid = (validate_xml($source) ? 'yes' : 'no');
- ?>
- <form action="" method="post" style="width: 60em">
- <textarea name="source" style="height: 40em; width: 100%;"><?php echo htmlentities($source); ?></textarea>
- <div>
- <button style="float: right;" type="submit">Validate</button>
- <span>Valid: <?php echo $valid; ?></span>
- </div>
- </form>
Add Comment
Please, Sign In to add comment