mil.dod.th.ose.jaxb.proto.converter/src/mil/dod/th/ose/jaxbprotoconverter/xsd/XsdParser.java
private int traverseNodes(final NodeList nodeList, final Element parentElement, final XsdNamespace xsdNamespace, 
            final Class<?> jaxbClass, final XsdType type, final File xsdFile, final int index) 
                    throws ClassNotFoundException, JaxbProtoConvertException
    {
        int indexInt = index;
        for (int i = 0; i < nodeList.getLength(); i++)
        {
            final Node node = nodeList.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE)
            {
                final Element element = (Element)node;
                final String nodeName = element.getNodeName();
                final String elementName = 
                        element.getAttribute("name"); //NOCHECKSTYLE Duplicate string is more readable
                
                if ("xs:complexType".equals(nodeName))
                {
                    handleComplexType(element, parentElement, xsdNamespace, type, xsdFile);
                }
                else if (nodeName.equals(XS_SIMPLE_TPYE) && containsEnumElements(node.getChildNodes()))
                {
                    handleSimpleType(element, parentElement, xsdNamespace, xsdFile);
                }
                else 
                {
                    if ((nodeName.equals("xs:attribute") || nodeName.equals("xs:element")) && type != null)
                    {
                        indexInt = handleFieldType(type, element, elementName, indexInt);
                    }
                    else if ("xs:extension".equals(nodeName))
                    {
                        indexInt = handleExtensionType(element, type, indexInt);
                    }
                    else if ("xs:restriction".equals(nodeName))
                    {
                        handleRestrictionType(element, parentElement, type);
                    }
                    indexInt = traverseNodes(element.getChildNodes(), element, xsdNamespace, jaxbClass, type, xsdFile, 
                            indexInt);
                }
            }
        }
        return indexInt;
    }
/**
     * Method that traverses all nodes within the specified node list and adds any complex types and fields to the 
     * appropriate models.
     * 
     * @param nodeList
     *      List of nodes to iterate over.
     * @param parentElement
     *      Parent element of the nodes being iterated over.
     * @param xsdNamespace
     *      XSD namespace that new types should be added to.
     * @param jaxbClass
     *      JAXB class of the complex type the nodes are nested within. May be null if nodes are not nested within a
     *      complex type. 
     * @param type
     *      The model that represents the complex type the nodes are nested within. May be null nodes are not nested
     *      within a complex type.
     * @param xsdFile
     *      The XSD file where the nodes are located.
     * @param index
     *      Index value that should be used for a field.
     * @return
     *      Index value after parsing all nodes. Will be incremented for all fields that were found and added to the
     *      model of a complex type. 
     * @throws ClassNotFoundException
     *      Thrown if the JAXB class associated with a complex type cannot be found.
     * @throws JaxbProtoConvertException
     *      Thrown if a duplicate overridden ID is encountered.
     */
Method that traverses all nodes within the specified node list and adds any complex types and fields to the
appropriate models.

@param nodeList
List of nodes to iterate over.
@param parentElement
Parent element of the nodes being iterated over.
@param xsdNamespace
XSD namespace that new types should be added to.
@param jaxbClass
JAXB class of the complex type the nodes are nested within. May be null if nodes are not nested within a
complex type.
@param type
The model that represents the complex type the nodes are nested within. May be null nodes are not nested
within a complex type.
@param xsdFile
The XSD file where the nodes are located.
@param index
Index value that should be used for a field.
@return
Index value after parsing all nodes. Will be incremented for all fields that were found and added to the
model of a complex type.
@throws ClassNotFoundException
Thrown if the JAXB class associated with a complex type cannot be found.
@throws JaxbProtoConvertException
Thrown if a duplicate overridden ID is encountered.
Method that traverses all nodes within the specified node list and adds any complex types and fields to the appropriate models . @param nodeList List of nodes to iterate over . @param parentElement Parent element of the nodes being iterated over . @param xsdNamespace XSD namespace that new types should be added to . @param jaxbClass JAXB class of the complex type the nodes are nested within . May be null if nodes are not nested within a complex type . @param type The model that represents the complex type the nodes are nested within . May be null nodes are not nested within a complex type . @param xsdFile The XSD file where the nodes are located . @param index Index value that should be used for a field . @return Index value after parsing all nodes . Will be incremented for all fields that were found and added to the model of a complex type . @throws ClassNotFoundException Thrown if the JAXB class associated with a complex type cannot be found . @throws JaxbProtoConvertException Thrown if a duplicate overridden ID is encountered .
private int traverseNodes(final NodeList nodeList, final Element parentElement, final XsdNamespace xsdNamespace, 
            final Class<?> jaxbClass, final XsdType type, final File xsdFile, final int index) 
                    throws ClassNotFoundException, JaxbProtoConvertException
    {
        int indexInt = index;
        for (int i = 0; i < nodeList.getLength(); i++)
        {
            final Node node = nodeList.item(i);
            if (node.getNodeType() == Node.ELEMENT_NODE)
            {
                final Element element = (Element)node;
                final String nodeName = element.getNodeName();
                final String elementName = 
                        element.getAttribute("name"); 
                if ("xs:complexType".equals(nodeName))
                {
                    handleComplexType(element, parentElement, xsdNamespace, type, xsdFile);
                }
                else if (nodeName.equals(XS_SIMPLE_TPYE) && containsEnumElements(node.getChildNodes()))
                {
                    handleSimpleType(element, parentElement, xsdNamespace, xsdFile);
                }
                else 
                {
                    if ((nodeName.equals("xs:attribute") || nodeName.equals("xs:element")) && type != null)
                    {
                        indexInt = handleFieldType(type, element, elementName, indexInt);
                    }
                    else if ("xs:extension".equals(nodeName))
                    {
                        indexInt = handleExtensionType(element, type, indexInt);
                    }
                    else if ("xs:restriction".equals(nodeName))
                    {
                        handleRestrictionType(element, parentElement, type);
                    }
                    indexInt = traverseNodes(element.getChildNodes(), element, xsdNamespace, jaxbClass, type, xsdFile, 
                            indexInt);
                }
            }
        }
        return indexInt;
    }
private int traverseNodes ( final NodeList nodeList , final Element parentElement , final XsdNamespace xsdNamespace , final Class < ? > jaxbClass , final XsdType type , final File xsdFile , final int index ) throws ClassNotFoundException , JaxbProtoConvertException { int indexInt = index ; for ( int i = 0 ; i < nodeList . getLength ( ) ; i ++ ) { final Node node = nodeList . item ( i ) ; if ( node . getNodeType ( ) == Node . ELEMENT_NODE ) { final Element element = ( Element ) node ; final String nodeName = element . getNodeName ( ) ; final String elementName = element . getAttribute ( "name" ) ; if ( "xs:complexType" . equals ( nodeName ) ) { handleComplexType ( element , parentElement , xsdNamespace , type , xsdFile ) ; } else if ( nodeName . equals ( XS_SIMPLE_TPYE ) && containsEnumElements ( node . getChildNodes ( ) ) ) { handleSimpleType ( element , parentElement , xsdNamespace , xsdFile ) ; } else { if ( ( nodeName . equals ( "xs:attribute" ) || nodeName . equals ( "xs:element" ) ) && type != null ) { indexInt = handleFieldType ( type , element , elementName , indexInt ) ; } else if ( "xs:extension" . equals ( nodeName ) ) { indexInt = handleExtensionType ( element , type , indexInt ) ; } else if ( "xs:restriction" . equals ( nodeName ) ) { handleRestrictionType ( element , parentElement , type ) ; } indexInt = traverseNodes ( element . getChildNodes ( ) , element , xsdNamespace , jaxbClass , type , xsdFile , indexInt ) ; } } } return indexInt ; }
Method that traverses all nodes within the specified node list and adds any complex types and fields to the
 appropriate models.
Method that traverses all nodes within the specified node list and adds any complex types and fields to the appropriate models .
//NOCHECKSTYLE Duplicate string is more readable