public void writeEndElement() throws XMLStreamException
770622
@Override
    public void writeDefaultNamespace(String nsURI)
        throws XMLStreamException
    {
        if (!mStartElementOpen) {
            throwOutputError(ERR_NSDECL_WRONG_STATE);
        }
        // 27-Mar-2007, TSa: Apparently TCK expects a binding to be added
        setDefaultNamespace(nsURI);
        doWriteDefaultNs(nsURI);
    }
129224
public void write(EntityType type) throws ODataRenderException {

        LOG.debug("Writing type {} of type {}", type.getName(), type.getMetaType());
        try {
            xmlWriter.writeStartElement(ENTITY_TYPE);
            if (!isNullOrEmpty(type.getBaseTypeName())) {
                xmlWriter.writeAttribute(BASE_TYPE, type.getBaseTypeName());
            }
            if (type.isOpen()) {
                xmlWriter.writeAttribute(OPEN_TYPE, Boolean.toString(type.isOpen()));
            }
            if (type.hasStream()) {
                xmlWriter.writeAttribute(HAS_STREAM, Boolean.toString(type.hasStream()));
            }
            xmlWriter.writeAttribute(NAME, type.getName());
            if (type.isAbstract()) {
                xmlWriter.writeAttribute(ABSTRACT, "true");
            }
            xmlWriter.writeStartElement(ENTITY_TYPE_KEY);
            for (PropertyRef propertyRef : type.getKey().getPropertyRefs()) {
                xmlWriter.writeStartElement(PROPERTY_REF);
                xmlWriter.writeAttribute(NAME, propertyRef.getPath());
                xmlWriter.writeEndElement();
            }
            xmlWriter.writeEndElement();

            visitProperties(entityDataModel, type, property -> {
                try {
                    propertyWriter.write(property);
                } catch (XMLStreamException e) {
                    throw new ODataRenderException("Error while writing property: " + property.getName(), e);
                }
            });
            xmlWriter.writeEndElement();
        } catch (XMLStreamException e) {
            throw new ODataRenderException("Error while writing entity type: " + type.getName(), e);
        }

    }
830912
public void writeElement( String name,
                              int type ) {
        StringBuilder nsdecl = new StringBuilder();

        if (isRootElement) {
            for (Iterator<String> iter = namespaces.keySet().iterator(); iter.hasNext();) {
                String fullName = iter.next();
                String abbrev = namespaces.get(fullName);
                nsdecl.append(" xmlns:").append(abbrev).append("=\"").append(fullName).append("\"");
            }
            isRootElement = false;
        }

        int pos = name.lastIndexOf(':');
        if (pos >= 0) {
            // lookup prefix for namespace
            String fullns = name.substring(0, pos);
            String prefix = namespaces.get(fullns);
            // check if instead of a full URI, the prefix is used
            if (prefix == null && namespaces.containsValue(fullns)) {
                prefix = fullns;
            }
            if (prefix == null) {
                // there is no prefix for this namespace
                name = name.substring(pos + 1);
                nsdecl.append(" xmlns=\"").append(fullns).append("\"");
            } else {
                // there is a prefix
                name = prefix + ":" + name.substring(pos + 1);
            }
        }

        switch (type) {
            case OPENING:
                buffer.append("<" + name + nsdecl + ">");
                break;
            case CLOSING:
                buffer.append("</" + name + ">\n");
                break;
            case NO_CONTENT:
            default:
                buffer.append("<" + name + nsdecl + "/>");
                break;
        }
    }
252154
protected void write(JsonWriter out, T value, TypeAdapter<JsonElement> elementAdapter, TypeAdapter<T> delegate) throws IOException {
        JsonElement tree = delegate.toJsonTree(value);
        beforeWrite(value, tree);
        elementAdapter.write(out, tree);
    }
1127682
@Override
	public void endElement(String uri, String localName, String qName) throws SAXException {
		if(localName.equals(TAG_LOG_ENTRY)) {
			if (currentTags.revision == 0) {
				throw new IllegalStateException(
						"Expected to have tag 'revision' for svn-logentry in the XML, but did not find it in: " + currentTags);
			}

			if(runnable != null) {
				runnable.run(currentTags);
			} else {
				configs.put(currentTags.revision, currentTags);
			}
			currentTags = null;
		} else {
			String value = characters.toString().trim();
			switch (localName) {
				case TAG_AUTHOR:
					currentTags.author = value.toLowerCase();
					break;
				case TAG_DATE:
					currentTags.date = value;
					break;
				case TAG_MSG:
					currentTags.msg = value;
					break;
				case TAG_PATH:
					// remove the initial branchname to reduce screen and memory size of the paths
					for (String branch : branches) {
						value = StringUtils.removeStart(value, branch);
					}

					// only store a few paths to not go OOM with too many paths stored
					int size = currentTags.paths == null ? 0 : currentTags.paths.size();
					if (size == pathLimit) {
						currentTags.addPath(LogEntry.MORE, "");
					} else if (size < pathLimit) {
						currentTags.addPath(value, lastAction);
					}
					lastAction = "";
					break;
			}
			characters.setLength(0);
		}
	}
60328
public void save(XMLWriter w) throws KNXMLException
	{
		w.writeElement(TAG_DATAPOINTS, Collections.EMPTY_LIST, null);
		synchronized (points) {
			for (final Iterator i = points.values().iterator(); i.hasNext();)
				((Datapoint) i.next()).save(w);
		}
		w.endElement();
	}
629054
private void writeXML(String xml) {
        String resourceName = System.getProperty(CONFIG_FILENAME_KEY);
        if (resourceName == null) {
            return;
        } else {
            URL rUrl = ClassLoader.getSystemResource(resourceName);
            if (rUrl != null) {
                File file = new File(rUrl.getFile());
                if (file != null && file.canWrite()) {
                    FileWriter fw = null;
                    try {
                        fw = new FileWriter(file);
                        fw.write(xml);
                        fw.close();
                    } catch (IOException ioe) {
                        //@TODO log it?
                    } finally {
                        try {
                            fw.close();
                        } catch (IOException ioee) {
                            ; //Nothing to do.
                        }
                        fw = null;
                        file = null;
                    }
                }
            }
        }
    }
527232
public void endElement(String uri, String localName, String qName) 
    throws SAXException
    {
        if (logger.isLoggable(Level.FINER)) logger.entering(className, "endElement(String,String,String)");

        if (!previousObjects.isEmpty())
        {
            this.current = (JSONObject)this.previousObjects.pop();
        }
        else
        {
            this.current = null;
        }

        if (logger.isLoggable(Level.FINER)) logger.exiting(className, "endElement(String,String,String)");
    }
458647
private void writeStatus(Result.Status status) throws XMLStreamException {
        xmlStreamWriter.writeStartElement("status");
        xmlStreamWriter.writeCharacters(status.name().toLowerCase());
        xmlStreamWriter.writeEndElement();
    }
274972
public void writeElement(String name, Object text)
  {
    startElement(name);
    writeText(text);
    endElement(name);
  }
104772
@Override
  public void write(OutputStream out) throws IOException {
    try {
      valueSerializer = null;

      XMLStreamWriter serializer = factory.createXMLStreamWriter(out,
        "UTF-8");
      serializer.setPrefix(RequestConstants.RESTAPI_PREFIX,
        RequestConstants.RESTAPI_NS);
      serializer.setPrefix(RequestConstants.SEARCH_PREFIX,
        RequestConstants.SEARCH_NS);
      serializer.setPrefix("xsi",
        XMLConstants.W3C_XML_SCHEMA_INSTANCE_NS_URI);
      serializer.setPrefix("xs", XMLConstants.W3C_XML_SCHEMA_NS_URI);

      serializer.writeStartDocument("utf-8", "1.0");

      serializer.writeStartElement(RequestConstants.RESTAPI_PREFIX,
        "rule", RequestConstants.RESTAPI_NS);

      serializer.writeStartElement(RequestConstants.RESTAPI_PREFIX,
        "name", RequestConstants.RESTAPI_NS);
      serializer.writeCharacters(getName());
      serializer.writeEndElement();

      serializer.writeStartElement(RequestConstants.RESTAPI_PREFIX,
        "description", RequestConstants.RESTAPI_NS);
      String description = getDescription();
      if ( description != null ) serializer.writeCharacters(description);
      serializer.writeEndElement();
      serializer.flush();

      // logger.debug("Send: " + new String(queryPayload));
      XMLEventWriter eventWriter = factory.createXMLEventWriter(out);
      for (XMLEvent event : this.queryPayload) {
        eventWriter.add(event);
      }
      eventWriter.flush();
      out.flush();

      writeMetadataElement(serializer);

      serializer.writeEndElement();
      serializer.writeEndDocument();
    } catch (XMLStreamException e) {
      throw new MarkLogicIOException("Failed to serialize rule", e);
    } catch (TransformerFactoryConfigurationError e) {
      throw new MarkLogicIOException("Failed to serialize rule", e);
    } catch (TransformerException e) {
      throw new MarkLogicIOException("Failed to serialize rule", e);
    } finally {
      valueSerializer = null;
    }

  }
109676
private void writeElements(String currentIndent, String tagName, StringBuilder attrs, SerIterator itemIterator) throws IOException {
        if (itemIterator.metaTypeRequired()) {
            appendAttribute(attrs, METATYPE, itemIterator.metaTypeName());
        }
        if (itemIterator.category() == SerCategory.GRID) {
            appendAttribute(attrs, ROWS, Integer.toString(itemIterator.dimensionSize(0)));
            appendAttribute(attrs, COLS, Integer.toString(itemIterator.dimensionSize(1)));
        }
        if (itemIterator.size() == 0) {
            output.append(currentIndent).append('<').append(tagName).append(attrs).append('/').append('>').append(settings.getNewLine());
        } else {
            output.append(currentIndent).append('<').append(tagName).append(attrs).append('>').append(settings.getNewLine());
            writeElements(currentIndent + settings.getIndent(), itemIterator);
            output.append(currentIndent).append('<').append('/').append(tagName).append('>').append(settings.getNewLine());
        }
    }
7824
@Override
    public void endElement(String uri, String localName, String name) throws SAXException {
        if ("name".equals(name)) {
            final String itemName = this.chars.toString().trim();

            if (this.currentTable == null) {
                this.currentTable = itemName;
            } else if (this.currentColumn == null) {
                this.currentColumn = itemName;
            }
        } else if ("value".equals(name)) {
            this.currentValue = this.chars.toString().trim();
        } else if ("column".equals(name)) {
            this.rowData.put(this.currentColumn, this.currentValue);
            this.currentColumn = null;
            this.currentValue = null;
        } else if ("row".equals(name)) {
            this.doInsert();
            this.rowData = null;
        } else if ("table".equals(name)) {
            this.currentTable = null;
        }

        this.chars = null;
    }
1136332
@Override
    public void endElement(String uri, String localName, String qName) throws SAXException {
        if (null != qName) {
            switch (qName) {
                case COMPANY_NAME:
                    data.setCompanyName(currentText.toString());
                    break;
                case PRODUCT_NAME:
                    data.setProductName(currentText.toString());
                    break;
                case PRODUCT_VERSION:
                    data.setProductVersion(currentText.toString());
                    break;
                case COMMENTS:
                    data.setComments(currentText.toString());
                    break;
                case FILE_DESCRIPTION:
                    data.setFileDescription(currentText.toString());
                    break;
                case FILE_NAME:
                    data.setFileName(currentText.toString());
                    break;
                case FILE_VERSION:
                    data.setFileVersion(currentText.toString());
                    break;
                case INTERNAL_NAME:
                    data.setInternalName(currentText.toString());
                    break;
                case ORIGINAL_FILE_NAME:
                    data.setOriginalFilename(currentText.toString());
                    break;
                case FULLNAME:
                    data.setFullName(currentText.toString());
                    break;
                case NAMESPACE:
                    data.addNamespace(currentText.toString());
                    break;
                case ERROR:
                    data.setError(currentText.toString());
                    break;
                case WARNING:
                    data.setWarning(currentText.toString());
                    break;
                default:
                    break;
            }
        }
    }
1034076
public static void write(JsonElement element, JsonWriter writer) throws IOException {
    TypeAdapters.JSON_ELEMENT.write(writer, element);
  }
1195654
public void endDTD() throws org.xml.sax.SAXException
    {
        try
        {
            if (m_needToOutputDocTypeDecl)
            {
                outputDocTypeDecl(m_elemContext.m_elementName, false);
                m_needToOutputDocTypeDecl = false;
            }
            final java.io.Writer writer = m_writer;
            if (!m_inDoctype)
                writer.write("]>");
            else
            {
                writer.write('>');
            }

            writer.write(m_lineSep, 0, m_lineSepLen);
        }
        catch (IOException e)
        {
            throw new SAXException(e);
        }

    }
585283
public void writeEndPage() throws IOException {
		writer.openElement("document");
		writer.textElement("id", Integer.toString(_page.Id));
		writer.textElement("group", "0");
		writer.textElement("timestamp", formatTimestamp(_rev.Timestamp));
		writer.textElement("title", _page.Title.toString());
		writer.textElement("body", _rev.Text);
		writer.closeElement();
		_rev = null;
		_page = null;
	}