opendap/src/main/java/opendap/dap/parsers/DDSXMLParser.java
private void parseBase(Element e, String indent)
            throws DASException, NoSuchTypeException, BadSemanticsException {


        parseLevel++;

        String type = e.getName();

        if (type.equals("Attribute")) {
            // Do nothing here, the Attributes get parsed when the BaseType's
            // get built. This conditional basically serves as a "trap" to
            // ignore the <Attribute> tag.
        } else if (type.equals("Alias")) {
            // Do nothing here, the Aliases get parsed when the BaseType's
            // get built. This conditional basically serves as a "trap" to
            // ignore the <Alias> tag.

        } else if (type.equals("dataBLOB")) {

            // dataBLOB?
            // The schema says that the href attribute is
            // required for the dataBLOB element.
            org.jdom2.Attribute hrefAttr = e.getAttribute("href");

            // Since it's required we know that the getAttribute()
            // method is not going to return null.
            String contentID = hrefAttr.getValue();

            if (_Debug) System.out.println("Found dataBLOB element. contentID=\"" + contentID + "\"");

            dds.setBlobContentID(contentID);

        } else {

            // What's left must be a OPeNDAP BaseType

            if (_Debug) System.out.println("Parsing new BaseType element. Parse level: " + parseLevel);
            if (_Debug) showXMLElement(e, indent);

            // Go get a new BaseType formed from this element
            BaseType bt = newBaseType(e);

            // Set it's parent.
            // bt.setParent(parentDC);

            // Add it to it's parent (container)
            parentDC.addVariable(bt);

            // Now we need to make sure this particular BaseType
            // derived element isn't some special type that needs
            // additional parsing:

            // Is it a container?
            if (bt instanceof DConstructor) {
                // Up date the parsers state, (cache my parent)
                DConstructor myParentDC = parentDC;
                parentDC = (DConstructor) bt;
                try {
                // Grids are special containers, handle them
                if (bt instanceof DGrid) {
                    parseGrid(e, indent);
                } else {
                    // Otherwise, recurse on the children
                  for (Element child : e.getChildren()) {
                    parseBase(child, indent + "    ");
                  }
                }
                } finally {
                // restore my parent
                parentDC = myParentDC;
                }
            } else if (bt instanceof DArray) {
                // Array's are special, better build it if it is one

                if (_Debug) System.out.println("Parsing Array instance.  Array name: '" + bt.getClearName() + "'");

                parseArray(e, (DArray) bt, indent);

            }


        }

        parseLevel--;

    }
private void parseBase(Element e, String indent)
            throws DASException, NoSuchTypeException, BadSemanticsException {


        parseLevel++;

        String type = e.getName();

        if (type.equals("Attribute")) {
            // Do nothing here, the Attributes get parsed when the BaseType's
            // get built. This conditional basically serves as a "trap" to
            // ignore the <Attribute> tag.
        } else if (type.equals("Alias")) {
            // Do nothing here, the Aliases get parsed when the BaseType's
            // get built. This conditional basically serves as a "trap" to
            // ignore the <Alias> tag.

        } else if (type.equals("dataBLOB")) {

            // dataBLOB?
            // The schema says that the href attribute is
            // required for the dataBLOB element.
            org.jdom2.Attribute hrefAttr = e.getAttribute("href");

            // Since it's required we know that the getAttribute()
            // method is not going to return null.
            String contentID = hrefAttr.getValue();

            if (_Debug) System.out.println("Found dataBLOB element. contentID=\"" + contentID + "\"");

            dds.setBlobContentID(contentID);

        } else {

            // What's left must be a OPeNDAP BaseType

            if (_Debug) System.out.println("Parsing new BaseType element. Parse level: " + parseLevel);
            if (_Debug) showXMLElement(e, indent);

            // Go get a new BaseType formed from this element
            BaseType bt = newBaseType(e);

            // Set it's parent.
            // bt.setParent(parentDC);

            // Add it to it's parent (container)
            parentDC.addVariable(bt);

            // Now we need to make sure this particular BaseType
            // derived element isn't some special type that needs
            // additional parsing:

            // Is it a container?
            if (bt instanceof DConstructor) {
                // Up date the parsers state, (cache my parent)
                DConstructor myParentDC = parentDC;
                parentDC = (DConstructor) bt;
                try {
                // Grids are special containers, handle them
                if (bt instanceof DGrid) {
                    parseGrid(e, indent);
                } else {
                    // Otherwise, recurse on the children
                  for (Element child : e.getChildren()) {
                    parseBase(child, indent + "    ");
                  }
                }
                } finally {
                // restore my parent
                parentDC = myParentDC;
                }
            } else if (bt instanceof DArray) {
                // Array's are special, better build it if it is one

                if (_Debug) System.out.println("Parsing Array instance.  Array name: '" + bt.getClearName() + "'");

                parseArray(e, (DArray) bt, indent);

            }


        }

        parseLevel--;

    }
This method recursively travels through the DOM tree, locating
BaseType derived nodes and placing them in the DDS. The structure
of the BaseType derived elements in the XML instance document
is captured in the DOM object that is being parsed. This structure
again reflected in the resulting DDS.