opendap/src/main/java/opendap/dap/DDS.java
public void printXML(PrintWriter pw, String pad, boolean constrained)
    {

        pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

        pw.print("<Dataset");
        if(getEncodedName() != null)
            pw.print(" name=\"" + DDSXMLParser.normalizeToXML(getEncodedName()) + "\"");
        pw.println();
        pw.println("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
        pw.println("xmlns=\"" + opendapNameSpace + "\"");
        pw.print("xsi:schemaLocation=\"");
        pw.print(opendapNameSpace + "  ");
        pw.print(schemaLocation);
        pw.println("\" >");
        pw.println("");

        Enumeration e = getAttributeNames();
        while (e.hasMoreElements()) {
            String aName = (String) e.nextElement();


            Attribute a = getAttribute(aName);
            if (a != null)
                a.printXML(pw, pad + "\t", constrained);

        }

        pw.println("");

        Enumeration ve = getVariables();
        while (ve.hasMoreElements()) {
            BaseType bt = (BaseType) ve.nextElement();
            bt.printXML(pw, pad + "\t", constrained);
        }

        pw.println("");
        if (_dataBlobID != null) {
            pw.println(pad + "\t" + "<dataBLOB href=\"" +
                    DDSXMLParser.normalizeToXML(_dataBlobID) + "\"/>");
        }
        pw.println(pad + "</Dataset>");

    }
public void printXML(PrintWriter pw, String pad, boolean constrained)
    {

        pw.println("<?xml version=\"1.0\" encoding=\"UTF-8\"?>");

        pw.print("<Dataset");
        if(getEncodedName() != null)
            pw.print(" name=\"" + DDSXMLParser.normalizeToXML(getEncodedName()) + "\"");
        pw.println();
        pw.println("xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"");
        pw.println("xmlns=\"" + opendapNameSpace + "\"");
        pw.print("xsi:schemaLocation=\"");
        pw.print(opendapNameSpace + "  ");
        pw.print(schemaLocation);
        pw.println("\" >");
        pw.println("");

        Enumeration e = getAttributeNames();
        while (e.hasMoreElements()) {
            String aName = (String) e.nextElement();


            Attribute a = getAttribute(aName);
            if (a != null)
                a.printXML(pw, pad + "\t", constrained);

        }

        pw.println("");

        Enumeration ve = getVariables();
        while (ve.hasMoreElements()) {
            BaseType bt = (BaseType) ve.nextElement();
            bt.printXML(pw, pad + "\t", constrained);
        }

        pw.println("");
        if (_dataBlobID != null) {
            pw.println(pad + "\t" + "<dataBLOB href=\"" +
                    DDSXMLParser.normalizeToXML(_dataBlobID) + "\"/>");
        }
        pw.println(pad + "</Dataset>");

    }
Prints the peristent representation of the <code>DDS</code> as an XML document.
This XML document is know as a <b>DDX</b>. The DDX can be parsed using the
<code>DDSXMLParser</code>

@param pw          The <code>PrintWriter</code> to print to.
@param pad         A <code>String</code> to print at the begining of each line.
typically this is some white space.
@param constrained A <code>boolean</code> that indcates if the this call should
print the constrained version of the DDS. A value of <i>true</i> will cause the
only the projected variables of the DDX to be printed .
@opendap.ddx.experimental