docs: public Document getSchema() {
  
          Document result;
  
          if (m_schemaDocument == null) {
              result = DocumentHelper.createDocument();
              Element root = result.addElement(XSD_NODE_SCHEMA);
              root.addAttribute(XSD_ATTRIBUTE_ELEMENT_FORM_DEFAULT, XSD_ATTRIBUTE_VALUE_QUALIFIED);
  
              Element include = root.addElement(XSD_NODE_INCLUDE);
              include.addAttribute(XSD_ATTRIBUTE_SCHEMA_LOCATION, XSD_INCLUDE_OPENCMS);
  
              if (m_includes.size() > 0) {
                  Iterator<CmsXmlContentDefinition> i = m_includes.iterator();
                  while (i.hasNext()) {
                      CmsXmlContentDefinition definition = i.next();
                      root.addElement(XSD_NODE_INCLUDE).addAttribute(
                          XSD_ATTRIBUTE_SCHEMA_LOCATION,
                          definition.m_schemaLocation);
                  }
              }
  
              String outerTypeName = createTypeName(getOuterName());
              String innerTypeName = createTypeName(getInnerName());
  
              Element content = root.addElement(XSD_NODE_ELEMENT);
              content.addAttribute(XSD_ATTRIBUTE_NAME, getOuterName());
              content.addAttribute(XSD_ATTRIBUTE_TYPE, outerTypeName);
  
              Element list = root.addElement(XSD_NODE_COMPLEXTYPE);
              list.addAttribute(XSD_ATTRIBUTE_NAME, outerTypeName);
  
              Element listSequence = list.addElement(XSD_NODE_SEQUENCE);
              Element listElement = listSequence.addElement(XSD_NODE_ELEMENT);
              listElement.addAttribute(XSD_ATTRIBUTE_NAME, getInnerName());
              listElement.addAttribute(XSD_ATTRIBUTE_TYPE, innerTypeName);
              listElement.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO);
              listElement.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_UNBOUNDED);
  
              Element main = root.addElement(XSD_NODE_COMPLEXTYPE);
              main.addAttribute(XSD_ATTRIBUTE_NAME, innerTypeName);
  
              Element mainSequence;
              if (m_sequenceType == SequenceType.SEQUENCE) {
                  mainSequence = main.addElement(XSD_NODE_SEQUENCE);
              } else {
                  mainSequence = main.addElement(XSD_NODE_CHOICE);
                  if (getChoiceMaxOccurs() > 1) {
                      mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, String.valueOf(getChoiceMaxOccurs()));
                  } else {
                      mainSequence.addAttribute(XSD_ATTRIBUTE_MIN_OCCURS, XSD_ATTRIBUTE_VALUE_ZERO);
                      mainSequence.addAttribute(XSD_ATTRIBUTE_MAX_OCCURS, XSD_ATTRIBUTE_VALUE_ONE);
                  }
              }
  
              Iterator<I_CmsXmlSchemaType> i = m_typeSequence.iterator();
              while (i.hasNext()) {
                  I_CmsXmlSchemaType schemaType = i.next();
                  schemaType.appendXmlSchema(mainSequence);
              }
  
              Element language = main.addElement(XSD_NODE_ATTRIBUTE);
              language.addAttribute(XSD_ATTRIBUTE_NAME, XSD_ATTRIBUTE_VALUE_LANGUAGE);
              language.addAttribute(XSD_ATTRIBUTE_TYPE, CmsXmlLocaleValue.TYPE_NAME);
              language.addAttribute(XSD_ATTRIBUTE_USE, XSD_ATTRIBUTE_VALUE_OPTIONAL);
          } else {
              result = (Document)m_schemaDocument.clone();
          }
          return result;
      }