Receive notification of the beginning of the document.

@throws SAXException Any SAX exception, possibly
wrapping another exception.
@see org.xml.sax.ContentHandler#startDocument
978416
public void startDocument() throws SAXException
  {

    int doc = addNode(DTM.DOCUMENT_NODE,
                      DTM.DOCUMENT_NODE,
                      DTM.NULL, DTM.NULL, 0, true);

    m_parents.push(doc);
    m_previous = DTM.NULL;

    m_contextIndexes.push(m_prefixMappings.size());  // for the next element.
  }
673435
public void startElement(String namespaceURI, String localName,
                             String qName, Attributes atts) throws SAXException {
        trace("startElement:" + localName + "~" + qName);
        Element newElement = createElement(namespaceURI, qName, atts);
        appendNode(newElement);
        currentElement = newElement;
    }
666709
@Override
    public void startElement(String namespaceURI, String localName,
            String qName, Attributes atts) throws SAXException {
        try {
            if (XHTML_NS.equals(namespaceURI)) {

                if ("meta".equals(localName)
                        && ((atts.getIndex("", "http-equiv") != -1) || (atts.getIndex(
                                "", "httpequiv") != -1))) {
                    return;
                }

                // start and element name
                this.writer.write('<');
                this.writer.write(localName);

                // attributes
                int length = atts.getLength();
                boolean langPrinted = false;
                for (int i = 0; i < length; i++) {
                    String ns = atts.getURI(i);
                    String name = null;
                    if ("".equals(ns)) {
                        name = atts.getLocalName(i);
                    } else if ("http://www.w3.org/XML/1998/namespace".equals(ns)
                            && "lang".equals(atts.getLocalName(i))) {
                        name = "lang";
                    }
                    if (name != null && !(langPrinted && "lang".equals(name))) {
                        this.writer.write(' ');
                        this.writer.write(name);
                        if ("lang".equals(name)) {
                            langPrinted = true;
                        }
                        if (Arrays.binarySearch(booleanAttributes, name) < 0) {
                            // write value, escape certain characters
                            this.writer.write("=\"");
                            String value = atts.getValue(i);
                            for (int j = 0; j < value.length(); j++) {
                                char c = value.charAt(j);
                                switch (c) {
                                    case '<':
                                        this.writer.write("&lt;");
                                        break;
                                    case '>':
                                        this.writer.write("&gt;");
                                        break;
                                    case '&':
                                        this.writer.write("&amp;");
                                        break;
                                    case '"':
                                        this.writer.write("&quot;");
                                        break;
                                    default:
                                        this.writer.write(c);
                                }
                            }

                            this.writer.write('"');
                        }
                    }
                }

                // close
                this.writer.write('>');
                if (emitMeta && "head".equals(localName)) {
                    this.writer.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=");
                    this.writer.write(encoding);
                    this.writer.write("\">");
                }
            }
        } catch (IOException ioe) {
            throw (SAXException)new SAXException(ioe).initCause(ioe);
        }
    }
1059139
@Override
    public void startElement(final String uri, final String localName, final String name, final Attributes atts)
            throws SAXException {
        AttributesImpl resAtts = null;
        final String conkeyref = atts.getValue(ATTRIBUTE_NAME_CONKEYREF);
        conkeyref: if (conkeyref != null) {
            final int keyIndex = conkeyref.indexOf(SLASH);
            final String key = keyIndex != -1 ? conkeyref.substring(0, keyIndex) : conkeyref;
            final KeyDef keyDef = keys.get(key);
            if (keyDef != null) {
                final String id = keyIndex != -1 ? conkeyref.substring(keyIndex + 1) : null;
                if (delayConrefUtils != null) {
                    final List<Boolean> list = delayConrefUtils.checkExport(stripFragment(keyDef.href).toString(), id, key, job.tempDir);
                    final boolean idExported = list.get(0);
                    final boolean keyrefExported = list.get(1);
                    //both id and key are exported and transtype is eclipsehelp
                    if (idExported && keyrefExported) {
                        break conkeyref;
                    }
                }
                resAtts = new AttributesImpl(atts);
                XMLUtils.removeAttribute(resAtts, ATTRIBUTE_NAME_CONKEYREF);
                final KeyDef k = keys.get(key);
                if (k.href != null && (k.scope.equals(ATTR_SCOPE_VALUE_LOCAL))) {
                    URI target = getRelativePath(k.href);
                    final String keyFragment = k.href.getFragment();
                    if (id != null && keyFragment != null) {
                        target = setFragment(target, keyFragment + SLASH + id);
                    } else if (id != null) {
                        target = setFragment(target, id);
                    } else if (keyFragment != null) {
                        target = setFragment(target, keyFragment);
                    }
                    XMLUtils.addOrSetAttribute(resAtts, ATTRIBUTE_NAME_CONREF, target.toString());
                } else {
                    logger.warn(MessageUtils.getMessage("DOTJ060W", key, conkeyref).toString());
                }
            } else {
                logger.error(MessageUtils.getMessage("DOTJ046E", conkeyref).toString());
            }
        }
        getContentHandler().startElement(uri, localName, name, resAtts != null ? resAtts : atts);
    }
443137
@Override
    public void startDocument() throws SAXException {
        try {
            switch (doctype) {
                case NO_DOCTYPE:
                    return;
                case DOCTYPE_HTML5:
                    writer.write("<!DOCTYPE html>\n");
                    return;
                case DOCTYPE_HTML401_STRICT:
                    writer.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n");
                    return;
                case DOCTYPE_HTML401_TRANSITIONAL:
                    writer.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">\n");
                    return;
            }
        } catch (IOException ioe) {
            throw (SAXException)new SAXException(ioe).initCause(ioe);
        }
    }
595427
@SuppressWarnings({"ThrowableInstanceNeverThrown"})
    public void warning(String msg, Exception ex) throws SAXException{
        xml.warning(new SAXParseException(msg, null, ex));
    }
809847
private StartElement advanceToStartElement() throws Exception {
        while (reader.hasNext()) {
            XMLEvent event = nextEvent("advnc ");
            if (event.isStartElement()) {
                return event.asStartElement();
            }
        }
        throw new IllegalArgumentException("Unexpected end of document");
    }
766651
public void startDocument() throws ODataRenderException {

        outputStream = new ByteArrayOutputStream();
        try {
            xmlWriter = xmlOutputFactory.createXMLStreamWriter(outputStream, UTF_8.name());
            xmlWriter.writeStartDocument(UTF_8.name(), XML_VERSION);
            xmlWriter.setPrefix(METADATA, ODATA_METADATA_NS);
        } catch (XMLStreamException e) {
            LOG.error("Not possible to start stream XML");
            throw new ODataRenderException("Not possible to start stream XML: ", e);
        }
    }
1297141
@Override
    public void beginDocument(MetaData metadata)
    {
        for (Listener listener : this.listeners) {
            listener.beginDocument(metadata);
        }
    }
432270
protected void engineStarted() throws XDocletException
    {
        System.out.println(Translator.getString(XDocletMessages.class, XDocletMessages.GENERATING_SOMETHING, new String[]{getDestinationFile().toString()}));
    }
490401
public void endDocument() throws org.xml.sax.SAXException
  {

    try
    {
      if (null != getStylesheetRoot())
      {
        if (0 == m_stylesheetLevel)
          getStylesheetRoot().recompose();        
      }
      else
        throw new TransformerException(XSLMessages.createMessage(XSLTErrorResources.ER_NO_STYLESHEETROOT, null)); //"Did not find the stylesheet root!");

      XSLTElementProcessor elemProcessor = getCurrentProcessor();

      if (null != elemProcessor)
        elemProcessor.startNonText(this);

      m_stylesheetLevel--;			
      
      popSpaceHandling();

      // WARNING: This test works only as long as stylesheets are parsed
      // more or less recursively. If we switch to an iterative "work-list"
      // model, this will become true prematurely. In that case,
      // isStylesheetParsingComplete() will have to be adjusted to be aware
      // of the worklist.
      m_parsingComplete = (m_stylesheetLevel < 0);
    }
    catch (TransformerException te)
    {
      throw new org.xml.sax.SAXException(te);
    }
  }
1231599
@Override
    public void startElement(final String uri, final String localName, final String name,
            final Attributes atts) throws SAXException {
        if (ignoreDepth > 0) {
            ignoreDepth++;
            return;
        }

        if (PR_D_CODEREF.matches(atts)) {
            ignoreDepth++;
            try {
                final URI hrefValue = toURI(atts.getValue(ATTRIBUTE_NAME_HREF));
                if (hrefValue != null) {
                    final File codeFile = getFile(hrefValue);
                    if (codeFile != null && codeFile.exists()) {
                        logger.debug("Resolve coderef " + codeFile);
                        final Charset charset = getCharset(atts.getValue(ATTRIBUTE_NAME_FORMAT));
                        final Range range = getRange(hrefValue);
                        try (BufferedReader codeReader = new BufferedReader(
                                new InputStreamReader(new FileInputStream(codeFile), charset))) {
                            range.copyLines(codeReader);
                        } catch (final Exception e) {
                            logger.error("Failed to process code reference " + codeFile, e);
                        }
                    } else {
                        logger.warn(MessageUtils.getMessage("DOTJ051E", hrefValue.toString()).setLocation(atts).toString());
                    }
                } else {
                    //logger.logDebug("Code reference target not defined");
                }
            } catch (final Exception e) {
                logger.error(e.getMessage(), e) ;
            }
        } else {
            super.startElement(uri, localName, name, atts);
        }
    }
868148
public void startElement(final String uri,
                             final String localName,
                             final String qname,
                             final Attributes attrs) throws SAXException {
        this.attrs = attrs;

        if ( direction == 1 ) {
            // going down again, so clear 
            this.peer = null;
        } else {
            direction = 1;
        }

        final Handler handler = getHandler( uri,
                                            localName );

        if ( handler == null ) {
            startElementBuilder( localName,
                                 attrs );
            return;
        }

        validate( uri,
                  localName,
                  handler );

        Object node = handler.start( uri,
                                     localName,
                                     attrs,
                                     this );
        
        this.parents.add( node );
    }
484025
public void startCDATA() throws org.xml.sax.SAXException
  {
    m_inCData = true;
    append(m_doc.createCDATASection(""));
  }
586003
public void startDocument() throws IOException {
        ResponseWriter writer = getWrapped();
        String encoding = writer.getCharacterEncoding( );
        if( encoding == null ) {
            encoding = "utf-8";
        }
        writer.writePreamble("<?xml version='1.0' encoding='" + encoding + "'?>\n");
        writer.startElement("partial-response", null);
        FacesContext ctx = FacesContext.getCurrentInstance();
        if (null != ctx && null != ctx.getViewRoot()) {
            String id = ctx.getViewRoot().getContainerClientId(ctx);
            writer.writeAttribute("id", id, "id");
        }
    }
1081912
@Override
    public void startElement(final String uri, final String localName, final String qName, final Attributes attributes)
            throws SAXException {

        LOG.trace("startElement uri={} localName={} qName={} attributes={}", uri, localName, qName, attributes);

        if (this.isNotInkstandNamespace(uri)) {
            return;
        }
        switch (localName) {
            case "rootNode":
                this.startElementRootNode(attributes);
                break;
            case "node":
                this.startElementNode(attributes);
                break;
            case "mixin":
                this.startElementMixin(attributes);
                break;
            case "property":
                this.startElementProperty(attributes);
                break;
            default:
                break;
        }
    }
293987
public void go(DocListener document, InputSource is) {
        try {
            parser.parse(is, new SAXiTextHandler(document));
        }
        catch(SAXException se) {
            throw new ExceptionConverter(se);
        }
        catch(IOException ioe) {
            throw new ExceptionConverter(ioe);
        }
    }