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();
  }