--- 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();
/**
* <p>Constructs an SchemaContentHandler.</p>
@@ -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);
}
}
--- 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) {