private java.util.ArrayList<Element> getAttributes(Node attributeGroup){
        java.util.ArrayList<Element> elements = new java.util.ArrayList<Element>();
        String name = DOM.getAttributeValue(attributeGroup, "name");
        String ref = DOM.getAttributeValue(attributeGroup, "ref");
        if (name.length()>0){

            NodeList attributes = attributeGroup.getChildNodes();
            for (Node attribute : DOM.getNodes(attributes)){

                String attributeNodeName = stripNameSpace(attribute.getNodeName());
                if (attributeNodeName.equalsIgnoreCase("attribute")){
                    Element element = new Element(attribute);
                    elements.add(element);
                    if (element.IsComplex){
                        decomposeComplexType(stripNameSpace(element.Type), element);
                    }                    
                }
                else if (attributeNodeName.equalsIgnoreCase("attributeGroup")){
                    java.util.Iterator<Element> it = getAttributes(attribute).iterator();
                    while (it.hasNext()){
                        elements.add(it.next());
                    }
                }
            }
        }
        else if (ref.length()>0){

            Element temp = new Element("", name);
            decomposeComplexType(stripNameSpace(ref), temp);
            java.util.Iterator<Object> it = temp.children.iterator();
            while (it.hasNext()){
                Object obj = it.next();
                if (obj instanceof Element){
                    elements.add((Element)obj);
                }
            }
        }

        return elements;
    }