コード例 #1
0
  /** Start the DTD parsing (called by GenBeans class) */
  public void process() throws java.io.IOException, Schema2BeansException {
    if (this.filename == null && this.schemaIn == null)
      throw new IllegalArgumentException(Common.getMessage("FilenameNotSpecified_msg", errHeader));

    if (this.handler == null)
      throw new IllegalArgumentException(Common.getMessage("HandlerNotSpecified_msg", errHeader));

    if (config.isTraceParse()) {
      config.messageOut.println(
          "Parsing file "
              + this.filename.toString()
              + // NOI18N
              " with handler "
              + this.handler.getClass()); // NOI18N
    }

    try {
      startupReader();
      this.handler.startDocument(config.getDocRoot());
      this.parse();
      shutdownReader();
      this.handler.endDocument();
    } catch (FileNotFoundException e) {
      config.messageOut.println("Error: file " + this.filename.toString() + " not found"); // NOI18N
      throw e;
      /*
          } catch (IllegalStateException e) {
          throw e;
      } catch (RuntimeException e) {
              TraceLogger.error(e);
          throw e;
           */
    }
  }
コード例 #2
0
  protected void initFromNode(org.w3c.dom.Node doc, int options) throws Schema2BeansException {
    if (doc == null) {
      doc = GraphManager.createRootElementNode("deployment-plan"); // NOI18N
      if (doc == null)
        throw new Schema2BeansException(
            Common.getMessage("CantCreateDOMRoot_msg", "deployment-plan"));
    }
    Node n = GraphManager.getElementNode("deployment-plan", doc); // NOI18N
    if (n == null)
      throw new Schema2BeansException(
          Common.getMessage(
              "DocRootNotInDOMGraph_msg", "deployment-plan", doc.getFirstChild().getNodeName()));

    this.graphManager.setXmlDocument(doc);

    // Entry point of the createBeans() recursive calls
    this.createBean(n, this.graphManager());
    this.initialize(options);
  }