<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
		<id>http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FXML%2FXML_Writer</id>
		<title>Java Tutorial/XML/XML Writer - История изменений</title>
		<link rel="self" type="application/atom+xml" href="http://jexp.ru/index.php?action=history&amp;feed=atom&amp;title=Java_Tutorial%2FXML%2FXML_Writer"/>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/XML/XML_Writer&amp;action=history"/>
		<updated>2026-04-11T13:16:42Z</updated>
		<subtitle>История изменений этой страницы в вики</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/XML/XML_Writer&amp;diff=5108&amp;oldid=prev</id>
		<title>Admin: 1 версия</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/XML/XML_Writer&amp;diff=5108&amp;oldid=prev"/>
				<updated>2010-06-01T05:17:48Z</updated>
		
		<summary type="html">&lt;p&gt;1 версия&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Предыдущая&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Версия 05:17, 1 июня 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Admin</name></author>	</entry>

	<entry>
		<id>http://jexp.ru/index.php?title=Java_Tutorial/XML/XML_Writer&amp;diff=5107&amp;oldid=prev</id>
		<title> в 17:44, 31 мая 2010</title>
		<link rel="alternate" type="text/html" href="http://jexp.ru/index.php?title=Java_Tutorial/XML/XML_Writer&amp;diff=5107&amp;oldid=prev"/>
				<updated>2010-05-31T17:44:27Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;==  Write DOM out ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/*&lt;br /&gt;
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.&lt;br /&gt;
 *&lt;br /&gt;
 * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * The contents of this file are subject to the terms of either the GNU&lt;br /&gt;
 * General Public License Version 2 only (&amp;quot;GPL&amp;quot;) or the Common&lt;br /&gt;
 * Development and Distribution License(&amp;quot;CDDL&amp;quot;) (collectively, the&lt;br /&gt;
 * &amp;quot;License&amp;quot;). You may not use this file except in compliance with the&lt;br /&gt;
 * License. You can obtain a copy of the License at&lt;br /&gt;
 * http://www.netbeans.org/cddl-gplv2.html&lt;br /&gt;
 * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the&lt;br /&gt;
 * specific language governing permissions and limitations under the&lt;br /&gt;
 * License.  When distributing the software, include this License Header&lt;br /&gt;
 * Notice in each file and include the License file at&lt;br /&gt;
 * nbbuild/licenses/CDDL-GPL-2-CP.  Sun designates this&lt;br /&gt;
 * particular file as subject to the &amp;quot;Classpath&amp;quot; exception as provided&lt;br /&gt;
 * by Sun in the GPL Version 2 section of the License file that&lt;br /&gt;
 * accompanied this code. If applicable, add the following below the&lt;br /&gt;
 * License Header, with the fields enclosed by brackets [] replaced by&lt;br /&gt;
 * your own identifying information:&lt;br /&gt;
 * &amp;quot;Portions Copyrighted [year] [name of copyright owner]&amp;quot;&lt;br /&gt;
 *&lt;br /&gt;
 * Contributor(s):&lt;br /&gt;
 *&lt;br /&gt;
 * The Original Software is NetBeans. The Initial Developer of the Original&lt;br /&gt;
 * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun&lt;br /&gt;
 * Microsystems, Inc. All Rights Reserved.&lt;br /&gt;
 *&lt;br /&gt;
 * If you wish your version of this file to be governed by only the CDDL&lt;br /&gt;
 * or only the GPL Version 2, indicate your decision by adding&lt;br /&gt;
 * &amp;quot;[Contributor] elects to include this software in this distribution&lt;br /&gt;
 * under the [CDDL or GPL Version 2] license.&amp;quot; If you do not indicate a&lt;br /&gt;
 * single choice of license, a recipient has the option to distribute&lt;br /&gt;
 * your version of this file under either the CDDL, the GPL Version 2 or&lt;br /&gt;
 * to extend the choice of license to its licensees as provided above.&lt;br /&gt;
 * However, if you add GPL Version 2 code and therefore, elected the GPL&lt;br /&gt;
 * Version 2 license, then the option applies only if the new code is&lt;br /&gt;
 * made subject to such option by the copyright holder.&lt;br /&gt;
 */&lt;br /&gt;
import java.io.IOException;&lt;br /&gt;
import java.io.OutputStream;&lt;br /&gt;
import javax.xml.transform.OutputKeys;&lt;br /&gt;
import javax.xml.transform.Result;&lt;br /&gt;
import javax.xml.transform.Source;&lt;br /&gt;
import javax.xml.transform.Transformer;&lt;br /&gt;
import javax.xml.transform.TransformerFactory;&lt;br /&gt;
import javax.xml.transform.TransformerFactoryConfigurationError;&lt;br /&gt;
import javax.xml.transform.dom.DOMSource;&lt;br /&gt;
import javax.xml.transform.stream.StreamResult;&lt;br /&gt;
import org.w3c.dom.Document;&lt;br /&gt;
import org.w3c.dom.DocumentType;&lt;br /&gt;
/**&lt;br /&gt;
 * Utility class collecting library methods related to XML processing. Stolen&lt;br /&gt;
 * from nbbuild/antsrc and openide/.../xml.&lt;br /&gt;
 * &lt;br /&gt;
 * @author Petr Kuzel, Jesse Glick&lt;br /&gt;
 */&lt;br /&gt;
public final class XMLUtil {&lt;br /&gt;
  public static void write(Document doc, OutputStream out) throws IOException {&lt;br /&gt;
    // XXX note that this may fail to write out namespaces correctly if the&lt;br /&gt;
    // document&lt;br /&gt;
    // is created with namespaces and no explicit prefixes; however no code in&lt;br /&gt;
    // this package is likely to be doing so&lt;br /&gt;
    try {&lt;br /&gt;
      Transformer t = TransformerFactory.newInstance().newTransformer();&lt;br /&gt;
      DocumentType dt = doc.getDoctype();&lt;br /&gt;
      if (dt != null) {&lt;br /&gt;
        String pub = dt.getPublicId();&lt;br /&gt;
        if (pub != null) {&lt;br /&gt;
          t.setOutputProperty(OutputKeys.DOCTYPE_PUBLIC, pub);&lt;br /&gt;
        }&lt;br /&gt;
        t.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, dt.getSystemId());&lt;br /&gt;
      }&lt;br /&gt;
      t.setOutputProperty(OutputKeys.ENCODING, &amp;quot;UTF-8&amp;quot;); // NOI18N&lt;br /&gt;
      t.setOutputProperty(OutputKeys.INDENT, &amp;quot;yes&amp;quot;); // NOI18N&lt;br /&gt;
      t.setOutputProperty(&amp;quot;{http://xml.apache.org/xslt}indent-amount&amp;quot;, &amp;quot;4&amp;quot;); // NOI18N&lt;br /&gt;
      Source source = new DOMSource(doc);&lt;br /&gt;
      Result result = new StreamResult(out);&lt;br /&gt;
      t.transform(source, result);&lt;br /&gt;
    } catch (Exception e) {&lt;br /&gt;
      throw (IOException) new IOException(e.toString()).initCause(e);&lt;br /&gt;
    } catch (TransformerFactoryConfigurationError e) {&lt;br /&gt;
      throw (IOException) new IOException(e.toString()).initCause(e);&lt;br /&gt;
    }&lt;br /&gt;
  }&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==  Write Xml (Node n, OutputStream os) ==&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- start source code --&amp;gt;&lt;br /&gt;
   &lt;br /&gt;
    &amp;lt;source lang=&amp;quot;java&amp;quot;&amp;gt;&lt;br /&gt;
/**&lt;br /&gt;
 * Licensed to the Apache Software Foundation (ASF) under one&lt;br /&gt;
 * or more contributor license agreements. See the NOTICE file&lt;br /&gt;
 * distributed with this work for additional information&lt;br /&gt;
 * regarding copyright ownership. The ASF licenses this file&lt;br /&gt;
 * to you under the Apache License, Version 2.0 (the&lt;br /&gt;
 * &amp;quot;License&amp;quot;); you may not use this file except in compliance&lt;br /&gt;
 * with the License. You may obtain a copy of the License at&lt;br /&gt;
 *&lt;br /&gt;
 * http://www.apache.org/licenses/LICENSE-2.0&lt;br /&gt;
 *&lt;br /&gt;
 * Unless required by applicable law or agreed to in writing,&lt;br /&gt;
 * software distributed under the License is distributed on an&lt;br /&gt;
 * &amp;quot;AS IS&amp;quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY&lt;br /&gt;
 * KIND, either express or implied. See the License for the&lt;br /&gt;
 * specific language governing permissions and limitations&lt;br /&gt;
 * under the License.&lt;br /&gt;
 */&lt;br /&gt;
import java.io.OutputStream;&lt;br /&gt;
import javax.xml.transform.OutputKeys;&lt;br /&gt;
import javax.xml.transform.Transformer;&lt;br /&gt;
import javax.xml.transform.TransformerException;&lt;br /&gt;
import javax.xml.transform.TransformerFactory;&lt;br /&gt;
import javax.xml.transform.dom.DOMSource;&lt;br /&gt;
import javax.xml.transform.stream.StreamResult;&lt;br /&gt;
import org.w3c.dom.Node;&lt;br /&gt;
/**&lt;br /&gt;
 * Few simple utils to read DOM. This is originally from the Jakarta Commons&lt;br /&gt;
 * Modeler.&lt;br /&gt;
 * &lt;br /&gt;
 * @author Costin Manolache&lt;br /&gt;
 */&lt;br /&gt;
public class Utils {&lt;br /&gt;
  public static void writeXml(Node n, OutputStream os) throws TransformerException {&lt;br /&gt;
    TransformerFactory tf = TransformerFactory.newInstance();&lt;br /&gt;
    // identity&lt;br /&gt;
    Transformer t = tf.newTransformer();&lt;br /&gt;
    t.setOutputProperty(OutputKeys.INDENT, &amp;quot;yes&amp;quot;);&lt;br /&gt;
    t.transform(new DOMSource(n), new StreamResult(os));&lt;br /&gt;
}&lt;br /&gt;
}&amp;lt;/source&amp;gt;&lt;br /&gt;
    &lt;br /&gt;
   &lt;br /&gt;
  &amp;lt;!-- end source code --&amp;gt;&lt;/div&gt;</summary>
			</entry>

	</feed>