public void parse(Document ddx, DDS targetDDS, BaseTypeFactory fac, boolean validation) throws DAP2Exception {

        dds = targetDDS;
        factory = fac;

        // Build up the OPeNDAP data objects rpresented by the XML document.
        // Additional validation will take place  during this process.

        Element root = ddx.getRootElement();
        lastDoc = ddx;

        // This is just a little tracker to help with debugging.
        parseLevel = 0;

        // Make sure the root element is in fact a Dataset.
        // Trying to enforce this in the schema would create a
        // contrived and difficult to interpret schema design.
        String type = root.getName();
        if (!(type.equals("Dataset"))) {
            throw new NoSuchTypeException("Root Element MUST be <Dataset>. Found: " + type);
        }

        String name = root.getAttribute("name").getValue();
        //System.out.println("DDS should be named: "+name);
        dds.setClearName(name);
        parentDC = dds;
        currentBT = dds;

        // Parse any Attributes (or AttributeTables/containers) at the
        // top level in the Dataset.
        parseAttributes(root, "-- ");

        // Parse any Aliases at the
        // top level in the Dataset.
        parseAliases(root, "++ ");

        // Parse all of the child elements (which would be OPeNDAP
        // BaseType variables) in the Dataset.
        Iterator ci = root.getChildren().iterator();
        while (ci.hasNext()) {
            Element child = (Element) ci.next();
            parseBase(child, "    ");

        }

//	catch(Exception e) {
//	    throw new DAP2Exception("PARSER ERROR! \n"+
//	                            e.getClass().getName()+ ": "+e.getMessage());
//	}

    }
public void parse ( Document ddx , DDS targetDDS , BaseTypeFactory fac , boolean validation ) throws DAP2Exception { dds = targetDDS ; factory = fac ; Element root = ddx . getRootElement ( ) ; lastDoc = ddx ; parseLevel = 0 ; String type = root . getName ( ) ; if ( ! ( type . equals ( "Dataset" ) ) ) { throw new NoSuchTypeException ( "Root Element MUST be <Dataset>. Found: " + type ) ; } String name = root . getAttribute ( "name" ) . getValue ( ) ; dds . setClearName ( name ) ; parentDC = dds ; currentBT = dds ; parseAttributes ( root , "-- " ) ; parseAliases ( root , "++ " ) ; Iterator ci = root . getChildren ( ) . iterator ( ) ; while ( ci . hasNext ( ) ) { Element child = ( Element ) ci . next ( ) ; parseBase ( child , "    " ) ; } }
Parse the DDX waiting in the <code>InputStream</code> and instantiate all of
the member <code>BaseType</code> variables and their associated <code>Attributes
</code> into a <code>DDS</code> using the passed <code>BaseTypeFactory</code>

@param ddx        A JDOM <code>Document</code> containing the DDX to parse.
@param targetDDS  The <code>DDS</code> in which to place all of the <code>BaseType
</code> variables and their associated <code>Attributes</code>.
@param fac        The <code>BaseTypeFactory</code> to use when creating new
<code>BaseType</code> variables.
@param validation Is a boolean indicating whether or not the parser should
validate the XML document using the Schema (typically referenced in the
document itself). In general server side applications should always vaidate,
while clients shouldn't bother (since they are ostensibly receiving the
document from a server that has already done so.)
@see DDS
@see BaseTypeFactory