public void endDocument() throws SAXException {

    outputFirstElementIfNeeded();

    // Output global properties
    if (properties.size() > 0) {
      final AttributesImpl newAttributes = new AttributesImpl();
      for (final Map.Entry<String, String> currentEntry : properties.entrySet()) {
        final String propertyName = currentEntry.getKey();
        newAttributes.addAttribute(
            XFormsConstants.XXFORMS_NAMESPACE_URI,
            propertyName,
            "xxforms:" + propertyName,
            ContentHandlerHelper.CDATA,
            currentEntry.getValue());
      }

      super.startPrefixMapping("xxforms", XFormsConstants.XXFORMS_NAMESPACE_URI);
      super.startElement("", "properties", "properties", newAttributes);
      super.endElement("", "properties", "properties");
      super.endPrefixMapping("xxforms");
    }

    super.endElement("", "static-state", "static-state");
    super.endDocument();
  }
 public void endPrefixMapping(String s) throws SAXException {
   if (inXFormsOrExtension) super.endPrefixMapping(s);
 }
 private void sendEndPrefixMappings() throws SAXException {
   for (Enumeration e = namespaceSupport.getPrefixes(); e.hasMoreElements(); ) {
     final String namespacePrefix = (String) e.nextElement();
     if (!namespacePrefix.startsWith("xml")) super.endPrefixMapping(namespacePrefix);
   }
 }