KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > thaiopensource > relaxng > impl > BuiltinDatatypeLibrary


1 package com.thaiopensource.relaxng.impl;
2
3 import org.relaxng.datatype.Datatype;
4 import org.relaxng.datatype.DatatypeBuilder;
5 import org.relaxng.datatype.DatatypeException;
6 import org.relaxng.datatype.DatatypeLibrary;
7
8 public class BuiltinDatatypeLibrary implements DatatypeLibrary {
9   private final DatatypeBuilder tokenDatatypeBuilder
10     = new BuiltinDatatypeBuilder(new TokenDatatype());
11   private final DatatypeBuilder stringDatatypeBuilder
12     = new BuiltinDatatypeBuilder(new StringDatatype());
13   public DatatypeBuilder createDatatypeBuilder(String JavaDoc type)
14     throws DatatypeException {
15     if (type.equals("token"))
16       return tokenDatatypeBuilder;
17     else if (type.equals("string"))
18       return stringDatatypeBuilder;
19     throw new DatatypeException();
20   }
21   public Datatype createDatatype(String JavaDoc type) throws DatatypeException {
22     return createDatatypeBuilder(type).createDatatype();
23   }
24 }
25
Popular Tags