src/java.xml/share/classes/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java
equal
deleted
inserted
replaced
626 if (localName == null) { |
626 if (localName == null) { |
627 throw new XMLStreamException("Local name cannot be null"); |
627 throw new XMLStreamException("Local name cannot be null"); |
628 } |
628 } |
629 |
629 |
630 if (!fIsRepairingNamespace) { |
630 if (!fIsRepairingNamespace) { |
631 if (prefix == null || prefix.equals("")){ |
631 if (prefix == null || prefix.isEmpty()){ |
632 if (!namespaceURI.equals("")) { |
632 if (!namespaceURI.isEmpty()) { |
633 throw new XMLStreamException("prefix cannot be null or empty"); |
633 throw new XMLStreamException("prefix cannot be null or empty"); |
634 } else { |
634 } else { |
635 writeAttributeWithPrefix(null, localName, value); |
635 writeAttributeWithPrefix(null, localName, value); |
636 return; |
636 return; |
637 } |
637 } |
906 if (elem.isEmpty) { |
906 if (elem.isEmpty) { |
907 //fWriter.write(CLOSE_EMPTY_ELEMENT); |
907 //fWriter.write(CLOSE_EMPTY_ELEMENT); |
908 } else { |
908 } else { |
909 fWriter.write(OPEN_END_TAG); |
909 fWriter.write(OPEN_END_TAG); |
910 |
910 |
911 if ((elem.prefix != null) && !(elem.prefix).equals("")) { |
911 if ((elem.prefix != null) && !(elem.prefix).isEmpty()) { |
912 fWriter.write(elem.prefix); |
912 fWriter.write(elem.prefix); |
913 fWriter.write(":"); |
913 fWriter.write(":"); |
914 } |
914 } |
915 |
915 |
916 fWriter.write(elem.localpart); |
916 fWriter.write(elem.localpart); |
943 } |
943 } |
944 |
944 |
945 fWriter.write(OPEN_END_TAG); |
945 fWriter.write(OPEN_END_TAG); |
946 |
946 |
947 if ((currentElement.prefix != null) && |
947 if ((currentElement.prefix != null) && |
948 !(currentElement.prefix).equals("")) { |
948 !(currentElement.prefix).isEmpty()) { |
949 fWriter.write(currentElement.prefix); |
949 fWriter.write(currentElement.prefix); |
950 fWriter.write(":"); |
950 fWriter.write(":"); |
951 } |
951 } |
952 |
952 |
953 fWriter.write(currentElement.localpart); |
953 fWriter.write(currentElement.localpart); |
1178 fWriter.write(DEFAULT_XMLDECL); |
1178 fWriter.write(DEFAULT_XMLDECL); |
1179 return; |
1179 return; |
1180 } |
1180 } |
1181 |
1181 |
1182 // Verify the encoding before writing anything |
1182 // Verify the encoding before writing anything |
1183 if (encoding != null && !encoding.equals("")) { |
1183 if (encoding != null && !encoding.isEmpty()) { |
1184 verifyEncoding(encoding); |
1184 verifyEncoding(encoding); |
1185 } |
1185 } |
1186 |
1186 |
1187 fWriter.write("<?xml version=\""); |
1187 fWriter.write("<?xml version=\""); |
1188 |
1188 |
1189 if ((version == null) || version.equals("")) { |
1189 if ((version == null) || version.isEmpty()) { |
1190 fWriter.write(DEFAULT_XML_VERSION); |
1190 fWriter.write(DEFAULT_XML_VERSION); |
1191 } else { |
1191 } else { |
1192 fWriter.write(version); |
1192 fWriter.write(version); |
1193 } |
1193 } |
1194 |
1194 |
1195 if (encoding != null && !encoding.equals("")) { |
1195 if (encoding != null && !encoding.isEmpty()) { |
1196 fWriter.write("\" encoding=\""); |
1196 fWriter.write("\" encoding=\""); |
1197 fWriter.write(encoding); |
1197 fWriter.write(encoding); |
1198 } |
1198 } |
1199 |
1199 |
1200 if (standaloneSet) { |
1200 if (standaloneSet) { |
1582 |
1582 |
1583 for (int j = 0; j < fAttributeCache.size(); j++) { |
1583 for (int j = 0; j < fAttributeCache.size(); j++) { |
1584 attr = fAttributeCache.get(j); |
1584 attr = fAttributeCache.get(j); |
1585 |
1585 |
1586 if ((attr.prefix != null) && (attr.uri != null)) { |
1586 if ((attr.prefix != null) && (attr.uri != null)) { |
1587 if (!attr.prefix.equals("") && !attr.uri.equals("") ) { |
1587 if (!attr.prefix.isEmpty() && !attr.uri.isEmpty() ) { |
1588 String tmp = fInternalNamespaceContext.getPrefix(attr.uri); |
1588 String tmp = fInternalNamespaceContext.getPrefix(attr.uri); |
1589 |
1589 |
1590 if ((tmp == null) || (!tmp.equals(attr.prefix))) { |
1590 if ((tmp == null) || (!tmp.equals(attr.prefix))) { |
1591 tmp = getAttrPrefix(attr.uri); |
1591 tmp = getAttrPrefix(attr.uri); |
1592 if (tmp == null) { |
1592 if (tmp == null) { |
1763 ElementState currentElement = fElementStack.peek(); |
1763 ElementState currentElement = fElementStack.peek(); |
1764 removeDuplicateDecls(); |
1764 removeDuplicateDecls(); |
1765 |
1765 |
1766 for(int i=0 ; i< fAttributeCache.size();i++){ |
1766 for(int i=0 ; i< fAttributeCache.size();i++){ |
1767 attr = fAttributeCache.get(i); |
1767 attr = fAttributeCache.get(i); |
1768 if((attr.prefix != null && !attr.prefix.equals("")) || (attr.uri != null && !attr.uri.equals(""))) { |
1768 if((attr.prefix != null && !attr.prefix.isEmpty()) || (attr.uri != null && !attr.uri.isEmpty())) { |
1769 correctPrefix(currentElement,attr); |
1769 correctPrefix(currentElement,attr); |
1770 } |
1770 } |
1771 } |
1771 } |
1772 |
1772 |
1773 if (!isDeclared(currentElement)) { |
1773 if (!isDeclared(currentElement)) { |
1774 if ((currentElement.prefix != null) && |
1774 if ((currentElement.prefix != null) && |
1775 (currentElement.uri != null)) { |
1775 (currentElement.uri != null)) { |
1776 if ((!currentElement.prefix.equals("")) && (!currentElement.uri.equals(""))) { |
1776 if ((!currentElement.prefix.isEmpty()) && (!currentElement.uri.isEmpty())) { |
1777 fNamespaceDecls.add(currentElement); |
1777 fNamespaceDecls.add(currentElement); |
1778 } |
1778 } |
1779 } |
1779 } |
1780 } |
1780 } |
1781 |
1781 |
1796 for (i = 0; i < fAttributeCache.size(); i++) { |
1796 for (i = 0; i < fAttributeCache.size(); i++) { |
1797 attr = fAttributeCache.get(i); |
1797 attr = fAttributeCache.get(i); |
1798 /* If 'attr' is an attribute and it is in no namespace(which means that prefix="", uri=""), attr's |
1798 /* If 'attr' is an attribute and it is in no namespace(which means that prefix="", uri=""), attr's |
1799 namespace should not be redinded. See [http://www.w3.org/TR/REC-xml-names/#defaulting]. |
1799 namespace should not be redinded. See [http://www.w3.org/TR/REC-xml-names/#defaulting]. |
1800 */ |
1800 */ |
1801 if (attr.prefix != null && attr.prefix.equals("") && attr.uri != null && attr.uri.equals("")){ |
1801 if (attr.prefix != null && attr.prefix.isEmpty() && attr.uri != null && attr.uri.isEmpty()){ |
1802 repairNamespaceDecl(attr); |
1802 repairNamespaceDecl(attr); |
1803 } |
1803 } |
1804 } |
1804 } |
1805 |
1805 |
1806 QName qname = null; |
1806 QName qname = null; |