# HG changeset patch # User joehw # Date 1509474915 25200 # Node ID 8ee949103fb858cb067652c4ea3f93051886eaa7 # Parent 56923ee4f07e30a164dd8c41951b38e81c22f289 8190227: Forward port 8188880 to JDK10CPU Reviewed-by: dfuchs, lancea, rriggs diff -r 56923ee4f07e -r 8ee949103fb8 src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/SchemaContentHandler.java --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/SchemaContentHandler.java Mon Apr 23 18:14:35 2018 +0200 +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/SchemaContentHandler.java Tue Oct 31 11:35:15 2017 -0700 @@ -26,6 +26,7 @@ import com.sun.org.apache.xerces.internal.util.SAXLocatorWrapper; import com.sun.org.apache.xerces.internal.util.SymbolTable; import com.sun.org.apache.xerces.internal.util.XMLAttributesImpl; +import com.sun.org.apache.xerces.internal.util.XMLStringBuffer; import com.sun.org.apache.xerces.internal.util.XMLSymbols; import com.sun.org.apache.xerces.internal.xni.NamespaceContext; import com.sun.org.apache.xerces.internal.xni.QName; @@ -78,6 +79,7 @@ private final QName fAttributeQName = new QName(); private final XMLAttributesImpl fAttributes = new XMLAttributesImpl(); private final XMLString fTempString = new XMLString(); + private final XMLStringBuffer fStringBuffer = new XMLStringBuffer(); /** *

Constructs an SchemaContentHandler.

@@ -103,6 +105,7 @@ */ public void startDocument() throws SAXException { fNeedPushNSContext = true; + fNamespaceContext.reset(); try { fSchemaDOMParser.startDocument(fSAXLocatorWrapper, null, fNamespaceContext, null); } @@ -326,7 +329,11 @@ if (nsPrefix.length() > 0) { prefix = XMLSymbols.PREFIX_XMLNS; localpart = nsPrefix; - rawname = fSymbolTable.addSymbol(prefix + ":" + localpart); + fStringBuffer.clear(); + fStringBuffer.append(prefix); + fStringBuffer.append(':'); + fStringBuffer.append(localpart); + rawname = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length); } else { prefix = XMLSymbols.EMPTY_STRING; @@ -334,7 +341,8 @@ rawname = XMLSymbols.PREFIX_XMLNS; } fAttributeQName.setValues(prefix, localpart, rawname, NamespaceContext.XMLNS_URI); - fAttributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, nsURI); + fAttributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, + (nsURI != null) ? nsURI : XMLSymbols.EMPTY_STRING); } } diff -r 56923ee4f07e -r 8ee949103fb8 src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java --- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Mon Apr 23 18:14:35 2018 +0200 +++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java Tue Oct 31 11:35:15 2017 -0700 @@ -2266,6 +2266,8 @@ fSecurityManager.isSecureProcessing()); try { + parser.setFeature(NAMESPACE_PREFIXES, true); + namespacePrefixes = true; // If this is a Xerces SAX parser set the security manager if there is one if (parser instanceof SAXParser) { if (fSecurityManager != null) {