| 1 |
package com.thaiopensource.validate.rng.impl; |
| 2 |
|
| 3 |
import com.thaiopensource.relaxng.pattern.Pattern; |
| 4 |
import com.thaiopensource.relaxng.pattern.SchemaPatternBuilder; |
| 5 |
import com.thaiopensource.relaxng.pattern.ValidatorPatternBuilder; |
| 6 |
import com.thaiopensource.util.PropertyMap; |
| 7 |
import com.thaiopensource.validate.AbstractSchema; |
| 8 |
import com.thaiopensource.validate.ValidateProperty; |
| 9 |
import com.thaiopensource.validate.Validator; |
| 10 |
import org.xml.sax.ErrorHandler; |
| 11 |
|
| 12 |
public class PatternSchema extends AbstractSchema { |
| 13 |
private final SchemaPatternBuilder spb; |
| 14 |
private final Pattern start; |
| 15 |
|
| 16 |
public PatternSchema(SchemaPatternBuilder spb, Pattern start, PropertyMap properties) { |
| 17 |
super(properties); |
| 18 |
this.spb = spb; |
| 19 |
this.start = start; |
| 20 |
} |
| 21 |
|
| 22 |
public Validator createValidator(PropertyMap properties) { |
| 23 |
ErrorHandler eh = properties.get(ValidateProperty.ERROR_HANDLER); |
| 24 |
return new RngValidator(start, new ValidatorPatternBuilder(spb), eh); |
| 25 |
} |
| 26 |
} |