< prev index next >

src/java.xml/share/classes/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java

Print this page
rev 52881 : 8214971: Replace use of string.equals("") with isEmpty()


 180 /*      final int nattrs = attrs.getLength();
 181         for (int i = 0; i < nattrs; i++) {
 182             if (attrs.getLocalName(i) == null) {
 183                 tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
 184             }
 185             else {
 186                 tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i),
 187                     attrs.getValue(i));
 188             }
 189         } */
 190 
 191 
 192         // Add attributes to element
 193         final int nattrs = attrs.getLength();
 194         for (int i = 0; i < nattrs; i++) {
 195             // checking if Namespace processing is being done
 196             String attQName = attrs.getQName(i);
 197             String attURI = attrs.getURI(i);
 198             String type = (attrs.getType(i) == null) ?
 199                     XMLSymbols.fCDATASymbol : attrs.getType(i);
 200             if (attrs.getLocalName(i).equals("")) {
 201                 tmp.setAttribute(attQName, attrs.getValue(i));
 202                 if (type.equals("ID")) {
 203                     tmp.setIdAttribute(attQName, true);
 204                 }
 205             } else {
 206                 tmp.setAttributeNS(attURI, attQName, attrs.getValue(i));
 207                 if (type.equals("ID")) {
 208                     tmp.setIdAttributeNS(attURI, attrs.getLocalName(i), true);
 209                 }
 210             }
 211         }
 212 
 213 
 214         // Append this new node onto current stack node
 215         Node last = _nodeStk.peek();
 216 
 217         // If the SAX2DOM is created with a non-null next sibling node,
 218         // insert the result nodes before the next sibling under the root.
 219         if (last == _root && _nextSibling != null)
 220             last.insertBefore(tmp, _nextSibling);




 180 /*      final int nattrs = attrs.getLength();
 181         for (int i = 0; i < nattrs; i++) {
 182             if (attrs.getLocalName(i) == null) {
 183                 tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
 184             }
 185             else {
 186                 tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i),
 187                     attrs.getValue(i));
 188             }
 189         } */
 190 
 191 
 192         // Add attributes to element
 193         final int nattrs = attrs.getLength();
 194         for (int i = 0; i < nattrs; i++) {
 195             // checking if Namespace processing is being done
 196             String attQName = attrs.getQName(i);
 197             String attURI = attrs.getURI(i);
 198             String type = (attrs.getType(i) == null) ?
 199                     XMLSymbols.fCDATASymbol : attrs.getType(i);
 200             if (attrs.getLocalName(i).isEmpty()) {
 201                 tmp.setAttribute(attQName, attrs.getValue(i));
 202                 if (type.equals("ID")) {
 203                     tmp.setIdAttribute(attQName, true);
 204                 }
 205             } else {
 206                 tmp.setAttributeNS(attURI, attQName, attrs.getValue(i));
 207                 if (type.equals("ID")) {
 208                     tmp.setIdAttributeNS(attURI, attrs.getLocalName(i), true);
 209                 }
 210             }
 211         }
 212 
 213 
 214         // Append this new node onto current stack node
 215         Node last = _nodeStk.peek();
 216 
 217         // If the SAX2DOM is created with a non-null next sibling node,
 218         // insert the result nodes before the next sibling under the root.
 219         if (last == _root && _nextSibling != null)
 220             last.insertBefore(tmp, _nextSibling);


< prev index next >