docs: 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;
          }
      }