예제 #1
0
  public void startDocument() throws SAXException {
    // System.out.println(getClass().getName()+".startDocument enter" );
    stack = new Stack<StackContext>();
    stack.push(new StackContext(null, null));
    level = 0;

    super.startDocument();
  }
예제 #2
0
파일: XMLWriter.java 프로젝트: dom4j/dom4j
 public void startDocument() throws SAXException {
   try {
     writeDeclaration();
     super.startDocument();
   } catch (IOException e) {
     handleException(e);
   }
 }
예제 #3
0
    /**
     * <i>[SAX ContentHandler interface support]</i> Processes a start of document event.
     *
     * <p>This implementation creates a new JDOM document builder and marks the current result as
     * "under construction".
     *
     * @throws SAXException if any error occurred while creating the document builder.
     */
    public void startDocument() throws SAXException {
      this.startDocumentReceived = true;

      // Reset any previously set result.
      setResult(null);

      // Create the actual JDOM document builder and register it as
      // ContentHandler on the superclass (XMLFilterImpl): this
      // implementation will take care of propagating the LexicalHandler
      // events.
      this.saxHandler = new FragmentHandler(getFactory());
      super.setContentHandler(this.saxHandler);

      // And propagate event.
      super.startDocument();
    }
예제 #4
0
  /**
   * Write the XML declaration at the beginning of the document.
   *
   * <p>Pass the event on down the filter chain for further processing.
   *
   * @exception org.xml.sax.SAXException If there is an error writing the XML declaration, or if a
   *     handler further down the filter chain raises an exception.
   * @see org.xml.sax.ContentHandler#startDocument()
   */
  public void startDocument() throws SAXException {
    try {
      reset();

      if (writeXmlDecl) {
        String e = "";
        if (encoding != null) e = " encoding=\"" + encoding + '\"';

        writeXmlDecl("<?xml version=\"1.0\"" + e + " standalone=\"yes\"?>");
      }

      if (header != null) write(header);

      super.startDocument();
    } catch (IOException e) {
      throw new SAXException(e);
    }
  }