1 /*
2 * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
61 * optionally indented if an indent step is provided (by default, there
62 * is no indentation). If an element contains other elements, the end
63 * tag will also appear on a new line with leading indentation. Consider,
64 * for example, the following code:</p>
65 *
66 * <pre>
67 * DataWriter w = new DataWriter();
68 *
69 * w.setIndentStep(2);
70 * w.startDocument();
71 * w.startElement("Person");
72 * w.dataElement("name", "Jane Smith");
73 * w.dataElement("date-of-birth", "1965-05-23");
74 * w.dataElement("citizenship", "US");
75 * w.endElement("Person");
76 * w.endDocument();
77 * </pre>
78 *
79 * <p>This code will produce the following document:</p>
80 *
81 * <pre>
82 * <?xml version="1.0" standalone="yes"?>
83 *
84 * <Person>
85 * <name>Jane Smith</name>
86 * <date-of-birth>1965-05-23</date-of-birth>
87 * <citizenship>US</citizenship>
88 * </Person>
89 * </pre>
90 *
91 * <p>This class inherits from {@link XMLWriter},
92 * and provides all of the same support for Namespaces.</p>
93 *
94 * @since 1.0
95 * @author David Megginson, david@megginson.com
96 * @version 0.2
97 * @see XMLWriter
98 */
99 public class DataWriter extends XMLWriter
100 {
101
102
103
104 ////////////////////////////////////////////////////////////////////
105 // Constructors.
106 ////////////////////////////////////////////////////////////////////
107
108
109 /**
|
1 /*
2 * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
61 * optionally indented if an indent step is provided (by default, there
62 * is no indentation). If an element contains other elements, the end
63 * tag will also appear on a new line with leading indentation. Consider,
64 * for example, the following code:</p>
65 *
66 * <pre>
67 * DataWriter w = new DataWriter();
68 *
69 * w.setIndentStep(2);
70 * w.startDocument();
71 * w.startElement("Person");
72 * w.dataElement("name", "Jane Smith");
73 * w.dataElement("date-of-birth", "1965-05-23");
74 * w.dataElement("citizenship", "US");
75 * w.endElement("Person");
76 * w.endDocument();
77 * </pre>
78 *
79 * <p>This code will produce the following document:</p>
80 *
81 * <pre>{@code
82 * <?xml version="1.0" standalone="yes"?>
83 *
84 * <Person>
85 * <name>Jane Smith</name>
86 * <date-of-birth>1965-05-23</date-of-birth>
87 * <citizenship>US</citizenship>
88 * </Person>
89 * }</pre>
90 *
91 * <p>This class inherits from {@link XMLWriter},
92 * and provides all of the same support for Namespaces.</p>
93 *
94 * @since 1.0
95 * @author David Megginson, david@megginson.com
96 * @version 0.2
97 * @see XMLWriter
98 */
99 public class DataWriter extends XMLWriter
100 {
101
102
103
104 ////////////////////////////////////////////////////////////////////
105 // Constructors.
106 ////////////////////////////////////////////////////////////////////
107
108
109 /**
|