sk.baka.xml.schematic.msv
Class SchemaFactoryImpl

java.lang.Object
  extended by sk.baka.xml.schematic.msv.SchemaFactoryImpl
All Implemented Interfaces:
ISchemaFactory

public final class SchemaFactoryImpl
extends Object
implements ISchemaFactory

Implementation of Schema factory. Is not intended to be used by clients.

Author:
Martin Vysny

Nested Class Summary
static class SchemaFactoryImpl.SchemaMetadataBean
          Contains metadata about a schema.
 
Constructor Summary
SchemaFactoryImpl()
           
 
Method Summary
 ISchema getSchema(String namespaceURI, SchemaPool pool)
          Produces a schema object from file represented by url.
 Set<String> getSupported()
          Returns set of supported namespaces.
protected  boolean isDTD(String fileName)
          Returns true if the schema specified is DTD.
 void registerSchema(String namespace, SchemaFactoryImpl.SchemaMetadataBean bean)
          Registers schema for given namespace.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SchemaFactoryImpl

public SchemaFactoryImpl()
Method Detail

isDTD

protected final boolean isDTD(String fileName)
Returns true if the schema specified is DTD. Currently, schema is DTD if its fileName ends with ".DTD".

Parameters:
fileName - schema file to query.
Returns:
true if the schema is DTD.

registerSchema

public void registerSchema(String namespace,
                           SchemaFactoryImpl.SchemaMetadataBean bean)
Registers schema for given namespace. The schema file must process given namespace.

Parameters:
namespace - the namespace to register schema.
bean - metadata about a schema file.

getSupported

public Set<String> getSupported()
Description copied from interface: ISchemaFactory
Returns set of supported namespaces. The set won't get modified.

Specified by:
getSupported in interface ISchemaFactory
Returns:
set of all namespaces that this factory understands.

getSchema

public ISchema getSchema(String namespaceURI,
                         SchemaPool pool)
                  throws SchemaException,
                         IOException
Description copied from interface: ISchemaFactory
Produces a schema object from file represented by url. This schema should accept elements from this namespace.

Specified by:
getSchema in interface ISchemaFactory
Parameters:
namespaceURI - the namespace URI the schema will validate.
pool - the validation context. The schema must take the context into account.
Returns:
Schema object, it must never be null.
Throws:
SchemaException - when error in loading of schema occurs.
IOException - if i/o error occurs during schema loading.


Copyright © 2006 Martin Vysny - baka. All Rights Reserved.