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

        parseLevel++;

        String subIndent = indent + "    ";
        if (_Debug) System.out.println(indent + "Parsing Attributes: ");

        if (_Debug)
            System.out.println(subIndent + "currentBT: " + currentBT.getTypeName() + " " + currentBT.getClearName());

        // Get all of the Attribute elements (tagged <Attribute>)
      for (Element attrElement : e.getChildren("Attribute", opendapNameSpace)) {

        String name = null;
        Attribute nameAttr = attrElement.getAttribute("name");
        // no need to check that the getAttribute call worked because the Schema enforces
        // the presence of the "name" attribute for the <Attribute> tag in the OPeNDAP namespace
        name = nameAttr.getValue();

        String typeName = null;
        Attribute typeAttr = attrElement.getAttribute("type");
        // no need to check that the getAttribute call worked because the Schema enforces
        // the presence of the "type" attribute for the <Attribute> tag in the OPeNDAP namespace
        typeName = typeAttr.getValue();

        // Is this Attribute a container??
        if (typeName.equals("Container")) {

          // Make sure that the document is valid for Attribute Containers and Values
          Iterator valueChildren = attrElement.getChildren("value", opendapNameSpace).iterator();
          if (valueChildren.hasNext())
            throw new AttributeBadValueException(
                    "Container Attributes may " +
                            "contain only other Attributes.\n" +
                            "Container Attributes may NOT " +
                            "contain values.");

          // Cache the currentAT (AttributeTable), this might be a null
          // in which case the the container should be added to the currentBT.
          AttributeTable cacheAttributeTable = currentAT;

          if (_Debug)
            System.out.println(indent + "currentBT: " + currentBT.getTypeName() + " " + currentBT.getClearName());
          if (_Debug) System.out.println(indent + "Attribute '" + name + "' is type " + typeName);

          // Add the Attribute container to the appropriate object.
          // If the currentAT is null, this indicates that we are working
          // on the top level attributes for the currentBT, if it's not
          // then we are working on the Attributes for some AttributeTable
          // contained within the top level Attributes in the currentBT.
          // Set the currentAT to the newly built (and returned) AttributeTable
          if (currentAT == null)
            currentAT = currentBT.appendAttributeContainer(name);
          else
            currentAT = currentAT.appendContainer(name);

          // Go parse the child Attributes of this Attribute table.
          // Note that this is a recursive call.
          parseAttributes(attrElement, indent + "    ");

          // Now parse all of the Aliases that exist in this Attribute table.
          parseAliases(attrElement, "+++ ");

          // restore the currentAT from the cached one, thus regaining the
          // the state that we entered this method with.
          currentAT = cacheAttributeTable;

        } else {

          // Make sure that the document is valid for Attribute Containers and Values
          Iterator attrChildren = attrElement.getChildren("Attribute", opendapNameSpace).iterator();
          if (attrChildren.hasNext())
            throw new AttributeBadValueException(
                    "Attributes must be of type Container " +
                            "in order to contain other Attributes.\n" +
                            "Attributes of types other than Container " +
                            "must contain values.");

          // Walk through the <value> elements
          for (Element valueChild : attrElement.getChildren("value", opendapNameSpace)) {
            // Get the content of the value.
            // There are several methods for getting this content in the
            // org.jdom2.Element object. The method getText() makes no effort
            // to "normalize" the white space content. IE tabs, spaces,
            // carriage return, newlines are all preserved. This might not
            // be the right thing to do, but only time will tell.
            String value = valueChild.getText();

            if (_Debug) {
              System.out.println(subIndent + "Attribute '" + name + "' of " + currentBT.getClearName() +
                      " is type " + typeName + " and has value: " + value);
            }

            // get the Attribute value type code.
            int typeVal = opendap.dap.Attribute.getTypeVal(typeName);

            // Add the attribute and it's value to the appropriat
            // container. Note that the interface for appending
            // values to opendap.dap.Attributes is built such that
            // the Attribute must be named each time. If the Attribte
            // name already exists, then the value is added to the list
            // of values for the Attribute. If the Attribute name does not
            // already exist, a new Attribute is made to hold the value.
            if (currentAT == null)
              currentBT.appendAttribute(name, typeVal, value, true);
            else
              currentAT.appendAttribute(name, typeVal, value, true);

          }

        }

      }


        parseLevel--;

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

        parseLevel++;

        String subIndent = indent + "    ";
        if (_Debug) System.out.println(indent + "Parsing Attributes: ");

        if (_Debug)
            System.out.println(subIndent + "currentBT: " + currentBT.getTypeName() + " " + currentBT.getClearName());

        // Get all of the Attribute elements (tagged <Attribute>)
      for (Element attrElement : e.getChildren("Attribute", opendapNameSpace)) {

        String name = null;
        Attribute nameAttr = attrElement.getAttribute("name");
        // no need to check that the getAttribute call worked because the Schema enforces
        // the presence of the "name" attribute for the <Attribute> tag in the OPeNDAP namespace
        name = nameAttr.getValue();

        String typeName = null;
        Attribute typeAttr = attrElement.getAttribute("type");
        // no need to check that the getAttribute call worked because the Schema enforces
        // the presence of the "type" attribute for the <Attribute> tag in the OPeNDAP namespace
        typeName = typeAttr.getValue();

        // Is this Attribute a container??
        if (typeName.equals("Container")) {

          // Make sure that the document is valid for Attribute Containers and Values
          Iterator valueChildren = attrElement.getChildren("value", opendapNameSpace).iterator();
          if (valueChildren.hasNext())
            throw new AttributeBadValueException(
                    "Container Attributes may " +
                            "contain only other Attributes.\n" +
                            "Container Attributes may NOT " +
                            "contain values.");

          // Cache the currentAT (AttributeTable), this might be a null
          // in which case the the container should be added to the currentBT.
          AttributeTable cacheAttributeTable = currentAT;

          if (_Debug)
            System.out.println(indent + "currentBT: " + currentBT.getTypeName() + " " + currentBT.getClearName());
          if (_Debug) System.out.println(indent + "Attribute '" + name + "' is type " + typeName);

          // Add the Attribute container to the appropriate object.
          // If the currentAT is null, this indicates that we are working
          // on the top level attributes for the currentBT, if it's not
          // then we are working on the Attributes for some AttributeTable
          // contained within the top level Attributes in the currentBT.
          // Set the currentAT to the newly built (and returned) AttributeTable
          if (currentAT == null)
            currentAT = currentBT.appendAttributeContainer(name);
          else
            currentAT = currentAT.appendContainer(name);

          // Go parse the child Attributes of this Attribute table.
          // Note that this is a recursive call.
          parseAttributes(attrElement, indent + "    ");

          // Now parse all of the Aliases that exist in this Attribute table.
          parseAliases(attrElement, "+++ ");

          // restore the currentAT from the cached one, thus regaining the
          // the state that we entered this method with.
          currentAT = cacheAttributeTable;

        } else {

          // Make sure that the document is valid for Attribute Containers and Values
          Iterator attrChildren = attrElement.getChildren("Attribute", opendapNameSpace).iterator();
          if (attrChildren.hasNext())
            throw new AttributeBadValueException(
                    "Attributes must be of type Container " +
                            "in order to contain other Attributes.\n" +
                            "Attributes of types other than Container " +
                            "must contain values.");

          // Walk through the <value> elements
          for (Element valueChild : attrElement.getChildren("value", opendapNameSpace)) {
            // Get the content of the value.
            // There are several methods for getting this content in the
            // org.jdom2.Element object. The method getText() makes no effort
            // to "normalize" the white space content. IE tabs, spaces,
            // carriage return, newlines are all preserved. This might not
            // be the right thing to do, but only time will tell.
            String value = valueChild.getText();

            if (_Debug) {
              System.out.println(subIndent + "Attribute '" + name + "' of " + currentBT.getClearName() +
                      " is type " + typeName + " and has value: " + value);
            }

            // get the Attribute value type code.
            int typeVal = opendap.dap.Attribute.getTypeVal(typeName);

            // Add the attribute and it's value to the appropriat
            // container. Note that the interface for appending
            // values to opendap.dap.Attributes is built such that
            // the Attribute must be named each time. If the Attribte
            // name already exists, then the value is added to the list
            // of values for the Attribute. If the Attribute name does not
            // already exist, a new Attribute is made to hold the value.
            if (currentAT == null)
              currentBT.appendAttribute(name, typeVal, value, true);
            else
              currentAT.appendAttribute(name, typeVal, value, true);

          }

        }

      }


        parseLevel--;

    }
private void parseAttributes ( Element e , String indent ) throws DASException , NoSuchTypeException { parseLevel ++ ; String subIndent = indent + "    " ; if ( _Debug ) System . out . println ( indent + "Parsing Attributes: " ) ; if ( _Debug ) System . out . println ( subIndent + "currentBT: " + currentBT . getTypeName ( ) + " " + currentBT . getClearName ( ) ) ; // Get all of the Attribute elements (tagged <Attribute>)
 for ( Element attrElement : e . getChildren ( "Attribute" , opendapNameSpace ) ) { String name = null ; Attribute nameAttr = attrElement . getAttribute ( "name" ) ; // no need to check that the getAttribute call worked because the Schema enforces
 // the presence of the "name" attribute for the <Attribute> tag in the OPeNDAP namespace
 name = nameAttr . getValue ( ) ; String typeName = null ; Attribute typeAttr = attrElement . getAttribute ( "type" ) ; // no need to check that the getAttribute call worked because the Schema enforces
 // the presence of the "type" attribute for the <Attribute> tag in the OPeNDAP namespace
 typeName = typeAttr . getValue ( ) ; // Is this Attribute a container??
 if ( typeName . equals ( "Container" ) ) { // Make sure that the document is valid for Attribute Containers and Values
 Iterator valueChildren = attrElement . getChildren ( "value" , opendapNameSpace ) . iterator ( ) ; if ( valueChildren . hasNext ( ) ) throw new AttributeBadValueException ( "Container Attributes may " + "contain only other Attributes.\n" + "Container Attributes may NOT " + "contain values." ) ; // Cache the currentAT (AttributeTable), this might be a null
 // in which case the the container should be added to the currentBT.
 AttributeTable cacheAttributeTable = currentAT ; if ( _Debug ) System . out . println ( indent + "currentBT: " + currentBT . getTypeName ( ) + " " + currentBT . getClearName ( ) ) ; if ( _Debug ) System . out . println ( indent + "Attribute '" + name + "' is type " + typeName ) ; // Add the Attribute container to the appropriate object.
 // If the currentAT is null, this indicates that we are working
 // on the top level attributes for the currentBT, if it's not
 // then we are working on the Attributes for some AttributeTable
 // contained within the top level Attributes in the currentBT.
 // Set the currentAT to the newly built (and returned) AttributeTable
 if ( currentAT == null ) currentAT = currentBT . appendAttributeContainer ( name ) ; else currentAT = currentAT . appendContainer ( name ) ; // Go parse the child Attributes of this Attribute table.
 // Note that this is a recursive call.
 parseAttributes ( attrElement , indent + "    " ) ; // Now parse all of the Aliases that exist in this Attribute table.
 parseAliases ( attrElement , "+++ " ) ; // restore the currentAT from the cached one, thus regaining the
 // the state that we entered this method with.
 currentAT = cacheAttributeTable ; } else { // Make sure that the document is valid for Attribute Containers and Values
 Iterator attrChildren = attrElement . getChildren ( "Attribute" , opendapNameSpace ) . iterator ( ) ; if ( attrChildren . hasNext ( ) ) throw new AttributeBadValueException ( "Attributes must be of type Container " + "in order to contain other Attributes.\n" + "Attributes of types other than Container " + "must contain values." ) ; // Walk through the <value> elements
 for ( Element valueChild : attrElement . getChildren ( "value" , opendapNameSpace ) ) { // Get the content of the value.
 // There are several methods for getting this content in the
 // org.jdom2.Element object. The method getText() makes no effort
 // to "normalize" the white space content. IE tabs, spaces,
 // carriage return, newlines are all preserved. This might not
 // be the right thing to do, but only time will tell.
 String value = valueChild . getText ( ) ; if ( _Debug ) { System . out . println ( subIndent + "Attribute '" + name + "' of " + currentBT . getClearName ( ) + " is type " + typeName + " and has value: " + value ) ; } // get the Attribute value type code.
 int typeVal = opendap . dap . Attribute . getTypeVal ( typeName ) ; // Add the attribute and it's value to the appropriat
 // container. Note that the interface for appending
 // values to opendap.dap.Attributes is built such that
 // the Attribute must be named each time. If the Attribte
 // name already exists, then the value is added to the list
 // of values for the Attribute. If the Attribute name does not
 // already exist, a new Attribute is made to hold the value.
 if ( currentAT == null ) currentBT . appendAttribute ( name , typeVal , value , true ) ; else currentAT . appendAttribute ( name , typeVal , value , true ) ; } } } parseLevel -- ; }
Parse the Attribute tags for a given variable element in the XML document.
Build the appropriate Attributes and AttributeTables and add them to the
the current variable's (currentBT's) AttributeTable.
Parse the Attribute tags for a given variable element in the XML document . Build the appropriate Attributes and AttributeTables and add them to the the current variable s ( currentBT s ) AttributeTable .