KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > validate > rng > SAXSchemaReceiverFactory


1 package com.thaiopensource.validate.rng;
2
3 import com.thaiopensource.util.PropertyMap;
4 import com.thaiopensource.validate.auto.SchemaReceiver;
5 import com.thaiopensource.validate.auto.SchemaReceiverFactory;
6 import com.thaiopensource.relaxng.impl.SchemaReceiverImpl;
7 import com.thaiopensource.relaxng.parse.sax.SAXParseReceiver;
8 import com.thaiopensource.validate.ValidateProperty;
9 import com.thaiopensource.validate.Option;
10 import com.thaiopensource.xml.sax.XMLReaderCreator;
11 import com.thaiopensource.xml.util.WellKnownNamespaces;
12 import org.xml.sax.ErrorHandler JavaDoc;
13
14 public class SAXSchemaReceiverFactory implements SchemaReceiverFactory {
15   public SchemaReceiver createSchemaReceiver(String JavaDoc namespaceUri,
16                                              PropertyMap properties) {
17     // XXX allow namespaces with incorrect version
18
if (!WellKnownNamespaces.RELAX_NG.equals(namespaceUri))
19       return null;
20     XMLReaderCreator xrc = ValidateProperty.XML_READER_CREATOR.get(properties);
21     ErrorHandler JavaDoc eh = ValidateProperty.ERROR_HANDLER.get(properties);
22     return new SchemaReceiverImpl(new SAXParseReceiver(xrc, eh), properties);
23   }
24
25   public Option getOption(String JavaDoc uri) {
26     return RngProperty.getOption(uri);
27   }
28 }
29
Popular Tags