src/java.xml/share/classes/com/sun/org/apache/xml/internal/serialize/XMLSerializer.java
changeset 47359 e1a6c0168741
parent 47216 71c04702a3d5
child 48409 5ab69533994b
equal deleted inserted replaced
47358:d07d5f7cab35 47359:e1a6c0168741
     1 /*
     1 /*
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2017, Oracle and/or its affiliates. All rights reserved.
       
     3  * @LastModified: Oct 2017
     3  */
     4  */
     4 /*
     5 /*
     5  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * Licensed to the Apache Software Foundation (ASF) under one or more
     6  * contributor license agreements.  See the NOTICE file distributed with
     7  * contributor license agreements.  See the NOTICE file distributed with
     7  * this work for additional information regarding copyright ownership.
     8  * this work for additional information regarding copyright ownership.
    31 // Aug 21, 2000:
    32 // Aug 21, 2000:
    32 //  Added ability to omit DOCTYPE declaration.
    33 //  Added ability to omit DOCTYPE declaration.
    33 
    34 
    34 package com.sun.org.apache.xml.internal.serialize;
    35 package com.sun.org.apache.xml.internal.serialize;
    35 
    36 
    36 import java.io.IOException;
       
    37 import java.io.OutputStream;
       
    38 import java.io.Writer;
       
    39 import java.util.Iterator;
       
    40 import java.util.Map;
       
    41 
       
    42 import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
    37 import com.sun.org.apache.xerces.internal.dom.DOMMessageFormatter;
    43 import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
    38 import com.sun.org.apache.xerces.internal.util.NamespaceSupport;
    44 import com.sun.org.apache.xerces.internal.util.SymbolTable;
    39 import com.sun.org.apache.xerces.internal.util.SymbolTable;
    45 import com.sun.org.apache.xerces.internal.util.XMLChar;
    40 import com.sun.org.apache.xerces.internal.util.XMLChar;
    46 import com.sun.org.apache.xerces.internal.util.XMLSymbols;
    41 import com.sun.org.apache.xerces.internal.util.XMLSymbols;
    47 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
    42 import com.sun.org.apache.xerces.internal.xni.NamespaceContext;
       
    43 import java.io.IOException;
       
    44 import java.io.OutputStream;
       
    45 import java.io.Writer;
       
    46 import java.util.Map;
    48 import org.w3c.dom.Attr;
    47 import org.w3c.dom.Attr;
    49 import org.w3c.dom.DOMError;
    48 import org.w3c.dom.DOMError;
    50 import org.w3c.dom.Document;
    49 import org.w3c.dom.Document;
    51 import org.w3c.dom.Element;
    50 import org.w3c.dom.Element;
    52 import org.w3c.dom.NamedNodeMap;
    51 import org.w3c.dom.NamedNodeMap;
   339                     }
   338                     }
   340                 }
   339                 }
   341             }
   340             }
   342 
   341 
   343             if (_prefixes != null) {
   342             if (_prefixes != null) {
   344                 Iterator entries = _prefixes.entrySet().iterator();
   343                 for (Map.Entry<String, String> entry : _prefixes.entrySet()) {
   345                 while (entries.hasNext()) {
       
   346                     _printer.printSpace();
   344                     _printer.printSpace();
   347                     Map.Entry entry = (Map.Entry) entries.next();
   345                     value = entry.getKey();
   348                     value = (String) entry.getKey();
   346                     name = entry.getValue();
   349                     name = (String) entry.getValue();
       
   350                     if (name.length() == 0) {
   347                     if (name.length() == 0) {
   351                         _printer.printText( "xmlns=\"" );
   348                         _printer.printText( "xmlns=\"" );
   352                         printEscaped( value );
   349                         printEscaped( value );
   353                         _printer.printText( '"' );
   350                         _printer.printText( '"' );
   354                     }
   351                     }