opendap/src/main/java/opendap/dap/DDS.java
private void checkForAttributeNameConflict(DConstructor dc) throws BadSemanticsException
    {

	if(_Debug) {
		DAPNode.log.debug("Checking "+dc.getTypeName()+" "+dc.getClearName()+" for name conflicts.");
	    }

        Enumeration bte = dc.getVariables();
        while (bte.hasMoreElements()) {
            BaseType bt = (BaseType) bte.nextElement();

//LogStream.out.println("     member: "+bt.getTypeName()+" "+bt.getName());
            Enumeration ate = dc.getAttributeNames();
            while (ate.hasMoreElements()) {

                String aName = (String) ate.nextElement();

//LogStream.out.println("         attribute: "+aName);
                if (aName.equals(bt.getEncodedName())) {
                    throw new BadSemanticsException("The variable '" + dc.getLongName() +
                            "' has an Attribute with the same name ('" + aName + "') as one of it's " +
                            "member variables (" + bt.getTypeName() + " " + bt.getEncodedName() + ")\n" +
                            "This is NOT allowed.");
                }
            }

            if (bt instanceof DConstructor) {
                // LogStream.out.println("     member '"+bt.getName()+"' is a container. Better Check it!");
                // Recursive call!!
                checkForAttributeNameConflict((DConstructor) bt);
            }

        }


    }
private void checkForAttributeNameConflict(DConstructor dc) throws BadSemanticsException
    {

	if(_Debug) {
		DAPNode.log.debug("Checking "+dc.getTypeName()+" "+dc.getClearName()+" for name conflicts.");
	    }

        Enumeration bte = dc.getVariables();
        while (bte.hasMoreElements()) {
            BaseType bt = (BaseType) bte.nextElement();

//LogStream.out.println("     member: "+bt.getTypeName()+" "+bt.getName());
            Enumeration ate = dc.getAttributeNames();
            while (ate.hasMoreElements()) {

                String aName = (String) ate.nextElement();

//LogStream.out.println("         attribute: "+aName);
                if (aName.equals(bt.getEncodedName())) {
                    throw new BadSemanticsException("The variable '" + dc.getLongName() +
                            "' has an Attribute with the same name ('" + aName + "') as one of it's " +
                            "member variables (" + bt.getTypeName() + " " + bt.getEncodedName() + ")\n" +
                            "This is NOT allowed.");
                }
            }

            if (bt instanceof DConstructor) {
                // LogStream.out.println("     member '"+bt.getName()+"' is a container. Better Check it!");
                // Recursive call!!
                checkForAttributeNameConflict((DConstructor) bt);
            }

        }


    }
Check for name conflicts. In the XML representation
of the DDS it is syntactically possible for a
variable container (Dconstructor) to possess an
Attribute that has the same name as one of the container
variable's member variables. That's a NO-NO!.
Check for it here and throw a nice fat exception if we find it.

@param dc The <code>DConstructor</code> to search for name conflicts.