private void visit(XmlSchema xmlSchema, XmlSchemaObjectBase element,
            final int level, final ArrayNode avroFields) {
        if (element instanceof XmlSchemaElement) {
            visit(xmlSchema, (XmlSchemaElement) element, level, avroFields);
        } else if (element instanceof XmlSchemaGroupRef) {
            XmlSchemaGroupRef groupRef = (XmlSchemaGroupRef) element;
            XmlSchemaGroup group = xmlSchema.getGroups().get(
                    groupRef.getRefName());
            visit(xmlSchema, group.getParticle(), level, avroFields);
        } else if (element instanceof XmlSchemaChoice) {
            visit(xmlSchema, (XmlSchemaChoice) element, level, avroFields);
        }
    }
private void visit ( XmlSchema xmlSchema , XmlSchemaObjectBase element , final int level , final ArrayNode avroFields ) { if ( element instanceof XmlSchemaElement ) { visit ( xmlSchema , ( XmlSchemaElement ) element , level , avroFields ) ; } else if ( element instanceof XmlSchemaGroupRef ) { XmlSchemaGroupRef groupRef = ( XmlSchemaGroupRef ) element ; XmlSchemaGroup group = xmlSchema . getGroups ( ) . get ( groupRef . getRefName ( ) ) ; visit ( xmlSchema , group . getParticle ( ) , level , avroFields ) ; } else if ( element instanceof XmlSchemaChoice ) { visit ( xmlSchema , ( XmlSchemaChoice ) element , level , avroFields ) ; } }
Visit a base XSD element.
<p/>
Could be any of:
<ul>
<li>A regular element</li>
<li>A reference to a group</li>
<li>A choice</li>
</ul>

@param xmlSchema the input XML schema
@param element the base element
@param level the current level in the hierarchy
@param avroFields an array of avro fields being populated