code: private void visit(XmlSchema xmlSchema, final XmlSchemaElement xsdElement,
              final int level, final ArrayNode avroFields)
              throws Xsd2AvroTranslatorException {
  
          /*
           * If this element is referencing another, it might not be useful to
           * process it.
           */
          if (xsdElement.getRef().getTarget() != null) {
              return;
          }
          log.debug("process started for element = " + xsdElement.getName());
  
          if (xsdElement.getSchemaType() instanceof XmlSchemaComplexType) {
              XmlSchemaComplexType xsdType = (XmlSchemaComplexType) xsdElement
                      .getSchemaType();
  
              int nextLevel = level + 1;
              final ArrayNode avroChildrenFields = MAPPER.createArrayNode();
              visit(xmlSchema, xsdType, nextLevel, avroChildrenFields);
              ContainerNode avroRecordType = buildAvroCompositeType(
                      getAvroTypeName(xsdType), avroChildrenFields,
                      xsdElement.getMaxOccurs() > 1,
                      xsdElement.getMinOccurs() == 0
                              && xsdElement.getMaxOccurs() == 1);
              ObjectNode avroRecordElement = MAPPER.createObjectNode();
              avroRecordElement.put("type", avroRecordType);
              avroRecordElement.put("name", getAvroFieldName(xsdElement));
              avroFields.add(avroRecordElement);
  
          } else if (xsdElement.getSchemaType() instanceof XmlSchemaSimpleType) {
              visit((XmlSchemaSimpleType) xsdElement.getSchemaType(), level,
                      getAvroFieldName(xsdElement), xsdElement.getMinOccurs(),
                      xsdElement.getMaxOccurs(), avroFields);
          }
  
          log.debug("process ended for element = " + xsdElement.getName());
      }
docs: Process a regular XML schema element.
  
  @param xmlSchema the input XML schema
  @param xsdElement the XML Schema element to process
  @param level the current level in the elements hierarchy.
  @param avroFields array of fields being populated
  @throws Xsd2AvroTranslatorException if processing fails