コード例 #1
0
  /**
   * Creates an XML Schema using the given InputSource. The InputSource must be for an XML instance
   * document. The XML Schema created will be based on the specific XML instance document.
   *
   * @param source the InputSource for the XML document
   */
  public Schema createSchema(InputSource source) throws IOException {
    XMLInstance2SchemaHandler handler = new XMLInstance2SchemaHandler();
    handler.setDefaultGroupOrder(_defaultGroup);

    try {
      Parser parser = _internalContext.getParser();
      if (parser == null) {
        throw new IOException("fatal error: unable to create SAX parser.");
      }
      parser.setDocumentHandler(handler);
      parser.setErrorHandler(handler);
      parser.parse(source);
    } catch (org.xml.sax.SAXException sx) {
      throw new NestedIOException(sx);
    }
    return handler.getSchema();
  }
コード例 #2
0
 /**
  * To set the {@link JavaNaming} instance to be used.
  *
  * @param javaNaming the JavaNaming to be used TODO: joachim remove me if possible!
  */
 private void setJavaNaming(final JavaNaming javaNaming) {
   _internalContext.setJavaNaming(javaNaming);
 }
コード例 #3
0
 /**
  * To get the {@link JavaNaming} instance to be used.
  *
  * @return the JavaNaming to be used
  */
 public JavaNaming getJavaNaming() {
   return _internalContext.getJavaNaming();
 }