| 1 |
function validate( xml,schemaFile ) |
| 2 |
%UNTITLED Summary of this function goes here |
| 3 |
% Detailed explanation goes here |
| 4 |
import java.io.*; |
| 5 |
import javax.xml.transform.Source; |
| 6 |
import javax.xml.transform.stream.StreamSource; |
| 7 |
import javax.xml.validation.*; |
| 8 |
|
| 9 |
factory = SchemaFactory.newInstance('http://www.w3.org/2001/XMLSchema'); |
| 10 |
schemaLocation = File(schemaFile); |
| 11 |
schema = factory.newSchema(schemaLocation); |
| 12 |
validator = schema.newValidator(); |
| 13 |
sr = StringReader(xml); |
| 14 |
source = StreamSource(sr); |
| 15 |
validator.validate(source); |
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
end |
| 20 |
|