changeset 20590:b3b34e4344ce

8025054: Update JAX-WS RI integration to 2.2.9-b130926.1035 Reviewed-by: chegar
author mkos
date Fri, 04 Oct 2013 16:21:34 +0100
parents b5d2bf482a3e
children 6e54991851d5
files jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/WscompileMessages.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/wscompile.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/Options.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/SchemaCache.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/ct/AbstractExtendedComplexTypeBuilder.java jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/parser/SchemaConstraintChecker.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.properties jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/OptimizedAccessorFactory.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Encoder.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64EncoderStream.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/ByteArrayOutputStreamEx.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/NamespaceContextEx.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/XMLStreamWriterEx.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/binary/SchemaBuilderImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DDataPattern.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DPattern.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DXMLPrinter.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DataPatternBuilderImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/GrammarBuilderImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/AnyNameClass.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/NameClassBuilderImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/SimpleNameClass.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/UCode_UCodeESC_CharStream.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/xml/SchemaParser.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/xml/sax/JAXPXMLReaderCreator.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/WsaTubeHelper.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundOperation.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundPortType.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLExtensible.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLFault.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLModel.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOperation.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOutput.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPort.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPortType.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLService.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundFault.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundOperation.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundPortType.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLFault.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLInput.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLMessage.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLModel.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLOperation.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLOutput.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPart.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPort.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPortType.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLService.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtension.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtensionContext.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/MonitorRootClient.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/PortInfo.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/Stub.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/JavaMethodImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/AbstractExtensibleImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundFaultImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundOperationImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundPortTypeImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLFaultImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLInputImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLMessageImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLModelImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLOperationImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLOutputImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPartImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPortImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPortTypeImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLProperties.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLServiceImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/jaxws/PolicyWSDLParserExtension.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/resources/WsservletMessages.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/resources/wsservlet.properties jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/server/EndpointFactory.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/server/WSEndpointImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/version.properties jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/ActionBasedOperationFinder.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/PayloadQNameBasedOperationFinder.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/DelegatingParserExtension.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/FoolProofParserExtension.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/MemberSubmissionAddressingWSDLParserExtension.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/RuntimeWSDLParser.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingMetadataWSDLParserExtension.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingWSDLParserExtension.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/WSDLParserExtensionContextImpl.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/WSDLParserExtensionFacade.java jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/writer/WSDLGenerator.java jaxws/src/share/jaxws_classes/javax/annotation/PostConstruct.java jaxws/src/share/jaxws_classes/javax/annotation/PreDestroy.java jaxws/src/share/jaxws_classes/javax/xml/bind/JAXBException.java jaxws/src/share/jaxws_classes/javax/xml/bind/Marshaller.java jaxws/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java jaxws/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/package.html jaxws/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java
diffstat 136 files changed, 5049 insertions(+), 3477 deletions(-) [+]
line wrap: on
line diff
--- a/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java	Fri Oct 04 16:21:34 2013 +0100
@@ -88,9 +88,9 @@
         return ID;
     }
 
-    public MetadataReader getMetadataReader(ClassLoader classLoader, boolean disableSecureXmlProcessing) {
+    public MetadataReader getMetadataReader(ClassLoader classLoader, boolean disableXmlSecurity) {
         if (reader != null && enabled) return reader;
-        return enabled ? new ExternalMetadataReader(files, resourceNames, classLoader, true, disableSecureXmlProcessing) : null;
+        return enabled ? new ExternalMetadataReader(files, resourceNames, classLoader, true, disableXmlSecurity) : null;
     }
 
     @Override
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -30,10 +30,10 @@
     Non-existent directory: {0}
 
 VERSION = \
-        schemagen 2.2.8-b20130806.1801
+        schemagen 2.2.8-b130911.1802
 
 FULLVERSION = \
-        schemagen full version "2.2.8-b20130806.1801"
+        schemagen full version "2.2.8-b130911.1802"
 
 USAGE = \
 Usage: schemagen [-options ...] <java files> \n\
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Nicht vorhandenes Verzeichnis: {0}
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.8-b20130806.1801"
+FULLVERSION = schemagen vollst\u00E4ndige Version "2.2.8-b130911.1802"
 
 USAGE = Verwendung: schemagen [-options ...] <java files> \nOptionen: \n\\ \\ \\ \\ -d <path>             : Gibt an, wo die von Prozessor und javac generierten Klassendateien gespeichert werden sollen\n\\ \\ \\ \\ -cp <path>            : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -classpath <path>     : Gibt an, wo die vom Benutzer angegebenen Dateien gespeichert sind\n\\ \\ \\ \\ -encoding <encoding>  : Gibt die Codierung f\u00FCr die Annotationsverarbeitung/den javac-Aufruf an \n\\ \\ \\ \\ -episode <file>       : Generiert Episodendatei f\u00FCr separate Kompilierung\n\\ \\ \\ \\ -version              : Zeigt Versionsinformation an\n\\ \\ \\ \\ -fullversion          : Zeigt vollst\u00E4ndige Versionsinformationen an\n\\ \\ \\ \\ -help                 : Zeigt diese Verwendungsmeldung an
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directorio no existente: {0}
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = versi\u00F3n completa de schemagen "2.2.8-b20130806.1801"
+FULLVERSION = versi\u00F3n completa de schemagen "2.2.8-b130911.1802"
 
 USAGE = Sintaxis: schemagen [-options ...] <archivos java> \nOpciones: \n\\ \\ \\ \\ -d <ruta de acceso>             : especifique d\u00F3nde se colocan los archivos de clase generados por javac y el procesador\n\\ \\ \\ \\ -cp <ruta de acceso>            : especifique d\u00F3nde se encuentran los archivos especificados por el usuario\n\\ \\ \\ \\ -encoding <codificaci\u00F3n>  : especifique la codificaci\u00F3n que se va a utilizar para el procesamiento de anotaciones/llamada de javac\n\\ \\ \\ \\ -episode <archivo>       : genera un archivo de episodio para una compilaci\u00F3n diferente\n\\ \\ \\ \\ -version              : muestra la informaci\u00F3n de la versi\u00F3n\n\\ \\ \\ \\ -fullversion          : muestra la informaci\u00F3n completa de la versi\u00F3n\n\\ \\ \\ \\ -help                 : muestra este mensaje de sintaxis
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = R\u00E9pertoire {0} inexistant
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = version compl\u00E8te de schemagen "2.2.8-b20130806.1801"
+FULLVERSION = version compl\u00E8te de schemagen "2.2.8-b130911.1802"
 
 USAGE = Syntaxe : schemagen [-options ...] <java files> \nOptions : \n\ \ \ \ -d <path> : indiquez o\u00F9 placer les fichiers de classe g\u00E9n\u00E9r\u00E9s par le processeur et le compilateur javac\n\ \ \ \ -cp <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -classpath <path> : indiquez o\u00F9 trouver les fichiers sp\u00E9cifi\u00E9s par l'utilisateur\n\ \ \ \ -encoding <encoding> : indiquez l'encodage \u00E0 utiliser pour l'appel de javac/traitement de l'annotation \n\ \ \ \ -episode <file> : g\u00E9n\u00E9rez un fichier d'\u00E9pisode pour la compilation s\u00E9par\u00E9e\n\ \ \ \ -version : affichez les informations de version\n\ \ \ \ -fullversion : affichez les informations compl\u00E8tes de version\n\ \ \ \ -help : affichez ce message de syntaxe
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Directory non esistente: {0}
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = versione completa schemagen "2.2.8-b20130806.1801"
+FULLVERSION = versione completa schemagen "2.2.8-b130911.1802"
 
 USAGE = Uso: schemagen [-options ...] <java files> \nOpzioni: \n\ \ \ \ -d <path>             : specifica dove posizionare il processore e i file della classe generata javac\n\ \ \ \ -cp <path>            : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -classpath <path>     : specifica dove trovare i file specificati dall'utente\n\ \ \ \ -encoding <encoding>  : specifica la codifica da usare per l'elaborazione dell'annotazione/richiamo javac \n\ \ \ \ -episode <file>       : genera il file di episodio per la compilazione separata\n\ \ \ \ -version              : visualizza le informazioni sulla versione\n\ \ \ \ -fullversion          : visualizza le informazioni sulla versione completa\n\ \ \ \ -help                 : visualizza questo messaggio sull'uso
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u304C\u5B58\u5728\u3057\u307E\u305B\u3093: {0}
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b20130806.1801"
+FULLVERSION = schemagen\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b130911.1802"
 
 USAGE = \u4F7F\u7528\u65B9\u6CD5: schemagen [-options ...] <java files> \n\u30AA\u30D7\u30B7\u30E7\u30F3: \n\ \ \ \ -d <path>             : \u30D7\u30ED\u30BB\u30C3\u30B5\u304A\u3088\u3073javac\u304C\u751F\u6210\u3057\u305F\u30AF\u30E9\u30B9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u7F6E\u304F\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -cp <path>            : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -classpath <path>     : \u30E6\u30FC\u30B6\u30FC\u304C\u6307\u5B9A\u3057\u305F\u30D5\u30A1\u30A4\u30EB\u3092\u691C\u7D22\u3059\u308B\u4F4D\u7F6E\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -encoding <encoding>  : \u6CE8\u91C8\u51E6\u7406/javac\u547C\u51FA\u3057\u306B\u4F7F\u7528\u3059\u308B\u30A8\u30F3\u30B3\u30FC\u30C7\u30A3\u30F3\u30B0\u3092\u6307\u5B9A\u3057\u307E\u3059\n\ \ \ \ -episode <file>       : \u30B3\u30F3\u30D1\u30A4\u30EB\u3054\u3068\u306B\u30A8\u30D4\u30BD\u30FC\u30C9\u30FB\u30D5\u30A1\u30A4\u30EB\u3092\u751F\u6210\u3057\u307E\u3059\n\ \ \ \ -version              : \u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -fullversion          : \u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3\u60C5\u5831\u3092\u8868\u793A\u3057\u307E\u3059\n\ \ \ \ -help                 : \u3053\u306E\u4F7F\u7528\u4F8B\u30E1\u30C3\u30BB\u30FC\u30B8\u3092\u8868\u793A\u3057\u307E\u3059
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \uC874\uC7AC\uD558\uC9C0 \uC54A\uB294 \uB514\uB809\uD1A0\uB9AC: {0}
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.8-b20130806.1801"
+FULLVERSION = schemagen \uC815\uC2DD \uBC84\uC804 "2.2.8-b130911.1802"
 
 USAGE = \uC0AC\uC6A9\uBC95: schemagen [-options ...] <java files> \n\uC635\uC158: \n\ \ \ \ -d <path>             : \uD504\uB85C\uC138\uC11C \uBC0F javac\uC5D0\uC11C \uC0DD\uC131\uD55C \uD074\uB798\uC2A4 \uD30C\uC77C\uC744 \uBC30\uCE58\uD560 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -cp <path>            : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -classpath <path>     : \uC0AC\uC6A9\uC790\uAC00 \uC9C0\uC815\uD55C \uD30C\uC77C\uC744 \uCC3E\uC744 \uC704\uCE58\uB97C \uC9C0\uC815\uD569\uB2C8\uB2E4.\n\ \ \ \ -encoding <encoding>  : \uC8FC\uC11D \uCC98\uB9AC/javac \uD638\uCD9C\uC5D0 \uC0AC\uC6A9\uD560 \uC778\uCF54\uB529\uC744 \uC9C0\uC815\uD569\uB2C8\uB2E4. \n\ \ \ \ -episode <file>       : \uBCC4\uB3C4 \uCEF4\uD30C\uC77C\uC744 \uC704\uD574 episode \uD30C\uC77C\uC744 \uC0DD\uC131\uD569\uB2C8\uB2E4.\n\ \ \ \ -version              : \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -fullversion          : \uC815\uC2DD \uBC84\uC804 \uC815\uBCF4\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.\n\ \ \ \ -help                 : \uC774 \uC0AC\uC6A9\uBC95 \uBA54\uC2DC\uC9C0\uB97C \uD45C\uC2DC\uD569\uB2C8\uB2E4.
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = Diret\u00F3rio n\u00E3o existente: {0}
 
-VERSION = gera\u00E7\u00E3o do esquema 2.2.8-b20130806.1801
+VERSION = gera\u00E7\u00E3o do esquema 2.2.8-b130911.1802
 
-FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.8-b20130806.1801"
+FULLVERSION = vers\u00E3o completa da gera\u00E7\u00E3o do esquema "2.2.8-b130911.1802"
 
 USAGE = Uso: gera\u00E7\u00E3o do esquema [-options ...] <java files> \nOp\u00E7\u00F5es: \n\\ \\ \\ \\ -d <path>             : especificar onde colocar o processador e os arquivos da classe gerados por javac\n\\ \\ \\ \\ -cp <path>            : especificar onde localizar arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -classpath <path>     : especificar onde localizar os arquivos especificados pelo usu\u00E1rio\n\\ \\ \\ \\ -encoding <encoding>  : especificar codifica\u00E7\u00E3o a ser usada para processamento de anota\u00E7\u00E3o/chamada javac \n\\ \\ \\ \\ -episode <file>       : gerar arquivo do epis\u00F3dio para compila\u00E7\u00E3o separada\n\\ \\ \\ \\ -version              : exibir informa\u00E7\u00F5es da vers\u00E3o\n\\ \\ \\ \\ -fullversion          : exibir informa\u00E7\u00F5es da vers\u00E3o completa\n\\ \\ \\ \\ -help                 : exibir esta mensagem de uso
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u5F55: {0}
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b20130806.1801"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9009\u9879: \n\ \ \ \ -d <path>             : \u6307\u5B9A\u653E\u7F6E\u5904\u7406\u7A0B\u5E8F\u548C javac \u751F\u6210\u7684\u7C7B\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -cp <path>            : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -classpath <path>     : \u6307\u5B9A\u67E5\u627E\u7528\u6237\u6307\u5B9A\u6587\u4EF6\u7684\u4F4D\u7F6E\n\ \ \ \ -encoding <encoding>  : \u6307\u5B9A\u7528\u4E8E\u6CE8\u91CA\u5904\u7406/javac \u8C03\u7528\u7684\u7F16\u7801\n\ \ \ \ -episode <file>       : \u751F\u6210\u7247\u6BB5\u6587\u4EF6\u4EE5\u4F9B\u5355\u72EC\u7F16\u8BD1\n\ \ \ \ -version              : \u663E\u793A\u7248\u672C\u4FE1\u606F\n\ \ \ \ -fullversion          : \u663E\u793A\u5B8C\u6574\u7684\u7248\u672C\u4FE1\u606F\n\ \ \ \ -help                 : \u663E\u793A\u6B64\u7528\u6CD5\u6D88\u606F
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -27,8 +27,8 @@
 
 BASEDIR_DOESNT_EXIST = \u4E0D\u5B58\u5728\u7684\u76EE\u9304: {0}
 
-VERSION = schemagen 2.2.8-b20130806.1801
+VERSION = schemagen 2.2.8-b130911.1802
 
-FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b20130806.1801"
+FULLVERSION = schemagen \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802"
 
 USAGE = \u7528\u6CD5: schemagen [-options ...] <java files> \n\u9078\u9805: \n\\ \\ \\ \\ -d <path>             : \u6307\u5B9A\u8655\u7406\u5668\u4EE5\u53CA javac \u7522\u751F\u7684\u985E\u5225\u6A94\u6848\u653E\u7F6E\u4F4D\u7F6E\n\\ \\ \\ \\ -cp <path>            : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -classpath <path>     : \u6307\u5B9A\u8981\u5C0B\u627E\u4F7F\u7528\u8005\u6307\u5B9A\u6A94\u6848\u7684\u4F4D\u7F6E\n\\ \\ \\ \\ -encoding <encoding>  : \u6307\u5B9A\u8981\u7528\u65BC\u8A3B\u89E3\u8655\u7406/javac \u547C\u53EB\u7684\u7DE8\u78BC \n\\ \\ \\ \\ -episode <file>       : \u7522\u751F\u7368\u7ACB\u7DE8\u8B6F\u7684\u4E8B\u4EF6 (episode) \u6A94\u6848\n\\ \\ \\ \\ -version              : \u986F\u793A\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -fullversion          : \u986F\u793A\u5B8C\u6574\u7248\u672C\u8CC7\u8A0A\n\\ \\ \\ \\ -help                 : \u986F\u793A\u6B64\u7528\u6CD5\u8A0A\u606F
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/WscompileMessages.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/WscompileMessages.java	Fri Oct 04 16:21:34 2013 +0100
@@ -269,6 +269,20 @@
         return localizer.localize(localizableWSIMPORT_USAGE(arg0));
     }
 
+    public static Localizable localizableWSGEN_USAGE_EXTENSIONS() {
+        return messageFactory.getMessage("wsgen.usage.extensions");
+    }
+
+    /**
+     *
+     * Extensions:
+     *   -Xnocompile                do not compile generated Java files
+     *
+     */
+    public static String WSGEN_USAGE_EXTENSIONS() {
+        return localizer.localize(localizableWSGEN_USAGE_EXTENSIONS());
+    }
+
     public static Localizable localizablePLEASE() {
         return messageFactory.getMessage("Please");
     }
@@ -283,6 +297,19 @@
         return localizer.localize(localizablePLEASE());
     }
 
+    public static Localizable localizableWSCOMPILE_EXISTING_OPTION(Object arg0) {
+        return messageFactory.getMessage("wscompile.existingOption", arg0);
+    }
+
+    /**
+     * Ignoring already defined option {0}
+     *
+     *
+     */
+    public static String WSCOMPILE_EXISTING_OPTION(Object arg0) {
+        return localizer.localize(localizableWSCOMPILE_EXISTING_OPTION(arg0));
+    }
+
     public static Localizable localizableWSIMPORT_PARSING_WSDL() {
         return messageFactory.getMessage("wsimport.ParsingWSDL");
     }
@@ -323,6 +350,8 @@
      *   -B<jaxbOption>            Pass this option to JAXB schema compiler
      *   -catalog <file>           specify catalog file to resolve external entity references
      *                             supports TR9401, XCatalog, and OASIS XML Catalog format.
+     *   -classpath <path>         specify where to find user class files and wsimport extensions
+     *   -cp <path>                specify where to find user class files and wsimport extensions
      *   -d <directory>            specify where to place generated output files
      *   -encoding <encoding>      specify character encoding used by source files
      *   -extension                allow vendor extensions - functionality not specified
@@ -332,6 +361,7 @@
      *   -help                     display help
      *   -httpproxy:<proxy>        set a HTTP proxy. Format is [user[:password]@]proxyHost:proxyPort
      *                             (port defaults to 8080)
+     *   -J<javacOption>           pass this option to javac
      *   -keep                     keep generated files
      *   -p <pkg>                  specifies the target package
      *   -quiet                    suppress wsimport output
@@ -343,7 +373,7 @@
      *   -version                  print version information
      *   -fullversion              print full version information
      *   -wsdllocation <location>  @WebServiceClient.wsdlLocation value
-     *   -clientjar <jarfile>      Creates the jar file of the generated artifacts along with the
+     *   -clientjar <jarfile>      creates the jar file of the generated artifacts along with the
      *                             WSDL metadata required for invoking the web service.
      *   -generateJWS              generate stubbed JWS implementation file
      *   -implDestDir <directory>  specify where to generate JWS implementation file
@@ -656,8 +686,8 @@
      * Usage: {0} [options] <SEI>
      *
      * where [options] include:
-     *   -classpath <path>          specify where to find input class files
-     *   -cp <path>                 same as -classpath <path>
+     *   -classpath <path>          specify where to find input class files and wsgen extensions
+     *   -cp <path>                 specify where to find input class files and wsgen extensions
      *   -d <directory>             specify where to place generated output files
      *   -encoding <encoding>       specify character encoding used by source files
      *   -extension                 allow vendor extensions - functionality not specified
@@ -665,6 +695,7 @@
      *                              result in applications that are not portable or
      *                              may not interoperate with other implementations
      *   -help                      display help
+     *   -J<javacOption>            pass this option to javac
      *   -keep                      keep generated files
      *   -r <directory>             resource destination directory, specify where to
      *                              place resouce files such as WSDLs
@@ -675,7 +706,7 @@
      *   -wsdl[:protocol]           generate a WSDL file. The protocol is optional.
      *                              Valid protocols are {1},
      *                              the default is soap1.1.
-     *                              The non stanadard protocols {2}
+     *                              The non standard protocols {2}
      *                              can only be used in conjunction with the
      *                              -extension option.
      *   -inlineSchemas             inline schemas in the generated wsdl. Must be
@@ -684,6 +715,7 @@
      *                              Used in conjunction with the -wsdl option.
      *   -portname <name>           specify the Port name to use in the generated WSDL
      *                              Used in conjunction with the -wsdl option.
+     *   -x <file>                  specify External Web Service Metadata xml descriptor
      *
      */
     public static String WSGEN_HELP(Object arg0, Object arg1, Object arg2) {
@@ -835,6 +867,18 @@
         return localizer.localize(localizableWSIMPORT_AUTH_INFO_LINENO(arg0, arg1));
     }
 
+    public static Localizable localizableWSGEN_SERVICENAME_MISSING_LOCALNAME(Object arg0) {
+        return messageFactory.getMessage("wsgen.servicename.missing.localname", arg0);
+    }
+
+    /**
+     * The service name "{0}" is missing a localname.
+     *
+     */
+    public static String WSGEN_SERVICENAME_MISSING_LOCALNAME(Object arg0) {
+        return localizer.localize(localizableWSGEN_SERVICENAME_MISSING_LOCALNAME(arg0));
+    }
+
     public static Localizable localizableWSGEN_USAGE(Object arg0) {
         return messageFactory.getMessage("wsgen.usage", arg0);
     }
@@ -849,18 +893,6 @@
         return localizer.localize(localizableWSGEN_USAGE(arg0));
     }
 
-    public static Localizable localizableWSGEN_SERVICENAME_MISSING_LOCALNAME(Object arg0) {
-        return messageFactory.getMessage("wsgen.servicename.missing.localname", arg0);
-    }
-
-    /**
-     * The service name "{0}" is missing a localname.
-     *
-     */
-    public static String WSGEN_SERVICENAME_MISSING_LOCALNAME(Object arg0) {
-        return localizer.localize(localizableWSGEN_SERVICENAME_MISSING_LOCALNAME(arg0));
-    }
-
     public static Localizable localizableWSGEN_SERVICENAME_MISSING_NAMESPACE(Object arg0) {
         return messageFactory.getMessage("wsgen.servicename.missing.namespace", arg0);
     }
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/wscompile.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/wscompile.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -33,6 +33,8 @@
 \  -B<jaxbOption>            Pass this option to JAXB schema compiler\n\
 \  -catalog <file>           specify catalog file to resolve external entity references\n\
 \                            supports TR9401, XCatalog, and OASIS XML Catalog format.\n\
+\  -classpath <path>         specify where to find user class files and wsimport extensions\n\
+\  -cp <path>                specify where to find user class files and wsimport extensions\n\
 \  -d <directory>            specify where to place generated output files\n\
 \  -encoding <encoding>      specify character encoding used by source files\n\
 \  -extension                allow vendor extensions - functionality not specified\n\
@@ -42,6 +44,7 @@
 \  -help                     display help\n\
 \  -httpproxy:<proxy>        set a HTTP proxy. Format is [user[:password]@]proxyHost:proxyPort\n\
 \                            (port defaults to 8080)\n\
+\  -J<javacOption>           pass this option to javac\n\
 \  -keep                     keep generated files\n\
 \  -p <pkg>                  specifies the target package\n\
 \  -quiet                    suppress wsimport output\n\
@@ -53,7 +56,7 @@
 \  -version                  print version information\n\
 \  -fullversion              print full version information\n\
 \  -wsdllocation <location>  @WebServiceClient.wsdlLocation value\n\
-\  -clientjar <jarfile>      Creates the jar file of the generated artifacts along with the\n\
+\  -clientjar <jarfile>      creates the jar file of the generated artifacts along with the\n\
 \                            WSDL metadata required for invoking the web service.\n\
 \  -generateJWS              generate stubbed JWS implementation file\n\
 \  -implDestDir <directory>  specify where to generate JWS implementation file\n\
@@ -91,8 +94,8 @@
 
 wsgen.help=\nUsage: {0} [options] <SEI>\n\n\
 \where [options] include:\n\
-\  -classpath <path>          specify where to find input class files\n\
-\  -cp <path>                 same as -classpath <path>\n\
+\  -classpath <path>          specify where to find input class files and wsgen extensions\n\
+\  -cp <path>                 specify where to find input class files and wsgen extensions\n\
 \  -d <directory>             specify where to place generated output files\n\
 \  -encoding <encoding>       specify character encoding used by source files\n\
 \  -extension                 allow vendor extensions - functionality not specified\n\
@@ -100,6 +103,7 @@
 \                             result in applications that are not portable or\n\
 \                             may not interoperate with other implementations\n\
 \  -help                      display help\n\
+\  -J<javacOption>            pass this option to javac\n\
 \  -keep                      keep generated files\n\
 \  -r <directory>             resource destination directory, specify where to\n\
 \                             place resouce files such as WSDLs\n\
@@ -110,7 +114,7 @@
 \  -wsdl[:protocol]           generate a WSDL file. The protocol is optional.\n\
 \                             Valid protocols are {1},\n\
 \                             the default is soap1.1.\n\
-\                             The non stanadard protocols {2}\n\
+\                             The non standard protocols {2}\n\
 \                             can only be used in conjunction with the\n\
 \                             -extension option.\n\
 \  -inlineSchemas             inline schemas in the generated wsdl. Must be\n\
@@ -118,8 +122,12 @@
 \  -servicename <name>        specify the Service name to use in the generated WSDL\n\
 \                             Used in conjunction with the -wsdl option.\n\
 \  -portname <name>           specify the Port name to use in the generated WSDL\n\
-\                             Used in conjunction with the -wsdl option.
+\                             Used in conjunction with the -wsdl option.\n\
+\  -x <file>                  specify External Web Service Metadata xml descriptor
 
+wsgen.usage.extensions=\n\
+\Extensions:\n\
+\  -Xnocompile                do not compile generated Java files
 
 wsgen.usage.examples=\n\
 \Examples:\n\
@@ -151,6 +159,7 @@
 # Generic Messages
 #
 wscompile.invalidOption=unrecognized parameter {0}
+wscompile.existingOption=Ignoring already defined option {0}\n
 wsimport.noSuchJaxbOption=no such JAXB option: {0}
 
 wscompile.error=error: {0}
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
 # questions.
 #
 
-build-id=2.2.9-b14140
-build-version=JAX-WS RI 2.2.9-b14140
+build-id=2.2.9-b130926.1035
+build-version=JAX-WS RI 2.2.9-b130926.1035
 major-version=2.2.9
-svn-revision=14140
+svn-revision=8c29a9a53251ff741fca1664a8221dc876b2eac8
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/Options.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/Options.java	Fri Oct 04 16:21:34 2013 +0100
@@ -87,6 +87,13 @@
 
     public String classpath = System.getProperty("java.class.path");
 
+    /**
+     * -javacOptions
+     *
+     * @since 2.2.9
+     */
+    public List<String> javacOptions;
+
 
     /**
      * -Xnocompile
@@ -94,10 +101,13 @@
     public boolean nocompile;
 
     /**
-     * Disable secure xml processing.
-     * -XdisableSecureXmlProcessing
+     * If true XML security features when parsing XML documents will be disabled.
+     * The default value is false.
+     *
+     * Boolean
+     * @since 2.2.9
      */
-    public boolean disableSecureXmlProcessing = false;
+    public boolean disableXmlSecurity;
 
     public enum Target {
         V2_0, V2_1, V2_2;
@@ -354,13 +364,24 @@
                 throw new BadCommandLineException(WscompileMessages.WSCOMPILE_UNSUPPORTED_ENCODING(encoding));
             }
             return 2;
-        } else if (args[i].equals("-XdisableSecureXmlProcessing")) {
-            disableSecureXmlProcessing= true;
+        } else if (args[i].equals("-disableXmlSecurity")) {
+            disableXmlSecurity();
+            return 1;
+        } else if (args[i].startsWith("-J")) {
+            if (javacOptions == null) {
+                javacOptions = new ArrayList<String>();
+            }
+            javacOptions.add(args[i].substring(2));
             return 1;
         }
         return 0;
     }
 
+    // protected method to allow overriding
+    protected void disableXmlSecurity() {
+        disableXmlSecurity= true;
+    }
+
     /**
      * Obtains an operand and reports an error if it's not there.
      */
@@ -372,7 +393,28 @@
         return args[i];
     }
 
-
+    List<String> getJavacOptions(List<String> existingOptions, WsimportListener listener) {
+        List<String> result = new ArrayList<String>();
+        for (String o: javacOptions) {
+            if (o.contains("=") && !o.startsWith("A")) {
+                int i = o.indexOf('=');
+                String key = o.substring(0, i);
+                if (existingOptions.contains(key)) {
+                    listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(key));
+                } else {
+                    result.add(key);
+                    result.add(o.substring(i + 1));
+                }
+            } else {
+                if (existingOptions.contains(o)) {
+                    listener.message(WscompileMessages.WSCOMPILE_EXISTING_OPTION(o));
+                } else {
+                    result.add(o);
+                }
+            }
+        }
+        return result;
+    }
 
     /**
      * Used to signal that we've finished processing.
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Fri Oct 04 16:21:34 2013 +0100
@@ -161,7 +161,7 @@
         final ErrorReceiverFilter errReceiver = new ErrorReceiverFilter(listener);
 
         boolean bootCP = useBootClasspath(EndpointReference.class) || useBootClasspath(XmlSeeAlso.class);
-        Collection<String> args = new ArrayList<String>(6 + (bootCP ? 1 : 0) + (options.nocompile ? 1 : 0)
+        List<String> args = new ArrayList<String>(6 + (bootCP ? 1 : 0) + (options.nocompile ? 1 : 0)
                 + (options.encoding != null ? 2 : 0));
         args.add("-d");
         args.add(options.destDir.getAbsolutePath());
@@ -183,6 +183,9 @@
                     .append(File.pathSeparator)
                     .append(JavaCompilerHelper.getJarFile(XmlSeeAlso.class)).toString());
         }
+        if (options.javacOptions != null) {
+            args.addAll(options.getJavacOptions(args, listener));
+        }
 
         JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();//        compiler = JavacTool.create();
         DiagnosticCollector<JavaFileObject> diagnostics = new DiagnosticCollector<JavaFileObject>();
@@ -205,9 +208,9 @@
             DatabindingConfig config = new DatabindingConfig();
 
             List<String> externalMetadataFileNames = options.externalMetadataFiles;
-            boolean disableSecureXmlProcessing = options.disableSecureXmlProcessing;
+            boolean disableXmlSecurity = options.disableXmlSecurity;
             if (externalMetadataFileNames != null && externalMetadataFileNames.size() > 0) {
-                config.setMetadataReader(new ExternalMetadataReader(getExternalFiles(externalMetadataFileNames), null, null, true, disableSecureXmlProcessing));
+                config.setMetadataReader(new ExternalMetadataReader(getExternalFiles(externalMetadataFileNames), null, null, true, disableXmlSecurity));
             }
 
             String tmpPath = options.destDir.getAbsolutePath() + File.pathSeparator + options.classpath;
@@ -243,7 +246,7 @@
             final Map<String, File> schemaFiles = new HashMap<String, File>();
 
             WSDLGenInfo wsdlGenInfo = new WSDLGenInfo();
-            wsdlGenInfo.setSecureXmlProcessingDisabled(disableSecureXmlProcessing);
+            wsdlGenInfo.setSecureXmlProcessingDisabled(disableXmlSecurity);
 
             wsdlGenInfo.setWsdlResolver(
                     new WSDLResolver() {
@@ -404,6 +407,7 @@
             System.out.println(WscompileMessages.WSGEN_HELP("WSGEN",
                     ((WsgenOptions)options).protocols,
                     ((WsgenOptions)options).nonstdProtocols.keySet()));
+            System.out.println(WscompileMessages.WSGEN_USAGE_EXTENSIONS());
             System.out.println(WscompileMessages.WSGEN_USAGE_EXAMPLES());
         }
     }
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java	Fri Oct 04 16:21:34 2013 +0100
@@ -774,4 +774,10 @@
                         is.setSystemId(systemId);
                 }
     }
+
+    @Override
+    protected void disableXmlSecurity() {
+        super.disableXmlSecurity();
+        schemaCompiler.getOptions().disableXmlSecurity = true;
+    }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java	Fri Oct 04 16:21:34 2013 +0100
@@ -524,29 +524,34 @@
             String classDir = options.destDir.getAbsolutePath();
             String classpathString = createClasspathString();
             boolean bootCP = useBootClasspath(EndpointContext.class) || useBootClasspath(JAXBPermission.class);
-            String[] args = new String[4 + (bootCP ? 1 : 0) + (options.debug ? 1 : 0)
-                    + (options.encoding != null ? 2 : 0) + sourceFiles.size()];
-            args[0] = "-d";
-            args[1] = classDir;
-            args[2] = "-classpath";
-            args[3] = classpathString;
-            int baseIndex = 4;
+            List<String> args = new ArrayList<String>();
+            args.add("-d");
+            args.add(classDir);
+            args.add("-classpath");
+            args.add(classpathString);
             //javac is not working in osgi as the url starts with a bundle
             if (bootCP) {
-                args[baseIndex++] = "-Xbootclasspath/p:"+JavaCompilerHelper.getJarFile(EndpointContext.class)+File.pathSeparator+JavaCompilerHelper.getJarFile(JAXBPermission.class);
+                args.add("-Xbootclasspath/p:"
+                        + JavaCompilerHelper.getJarFile(EndpointContext.class)
+                        + File.pathSeparator
+                        + JavaCompilerHelper.getJarFile(JAXBPermission.class));
             }
 
             if (options.debug) {
-                args[baseIndex++] = "-g";
+                args.add("-g");
             }
 
             if (options.encoding != null) {
-                args[baseIndex++] = "-encoding";
-                args[baseIndex++] = options.encoding;
+                args.add("-encoding");
+                args.add(options.encoding);
+            }
+
+            if (options.javacOptions != null) {
+                args.addAll(options.getJavacOptions(args, listener));
             }
 
             for (int i = 0; i < sourceFiles.size(); ++i) {
-                args[baseIndex + i] = sourceFiles.get(i);
+                args.add(sourceFiles.get(i));
             }
 
             listener.message(WscompileMessages.WSIMPORT_COMPILING_CODE());
@@ -558,7 +563,7 @@
                 listener.message("javac "+ argstr.toString());
             }
 
-            return JavaCompilerHelper.compile(args, out, receiver);
+            return JavaCompilerHelper.compile(args.toArray(new String[args.size()]), out, receiver);
         }
         //there are no files to compile, so return true?
         return true;
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java	Fri Oct 04 16:21:34 2013 +0100
@@ -114,7 +114,7 @@
         this.logic = logic;
         try {
             // secure xml processing can be switched off if input requires it
-            boolean secureProcessingEnabled = options == null || !options.disableSecureXmlProcessing;
+            boolean secureProcessingEnabled = options == null || !options.disableXmlSecurity;
             DocumentBuilderFactory dbf = XmlUtil.newDocumentBuilderFactory(secureProcessingEnabled);
             dbf.setNamespaceAware(true);
             this.documentBuilder = dbf.newDocumentBuilder();
@@ -365,7 +365,7 @@
         try {
             // create identity transformer
             // secure xml processing can be switched off if input requires it
-            boolean secureProcessingEnabled = options == null || !options.disableSecureXmlProcessing;
+            boolean secureProcessingEnabled = options == null || !options.disableXmlSecurity;
             TransformerFactory tf = XmlUtil.newTransformerFactory(secureProcessingEnabled);
             Transformer it = tf.newTransformer();
 
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -171,20 +171,20 @@
 Driver.FailedToGenerateCode = \
         Failed to produce code.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
 Driver.FilePrologComment = \
-        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b20130806.1801 \n\
+        This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 \n\
         See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\
         Any modifications to this file will be lost upon recompilation of the source schema. \n\
         Generated on: {0} \n
 
 Driver.Version = \
-        xjc 2.2.8-b20130806.1801
+        xjc 2.2.8-b130911.1802
 
 Driver.FullVersion = \
-        xjc full version "2.2.8-b20130806.1801"
+        xjc full version "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Code konnte nicht erzeugt werden.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b20130806.1801 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Diese Datei wurde mit der JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 generiert \nSiehe <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u00c4nderungen an dieser Datei gehen bei einer Neukompilierung des Quellschemas verloren. \nGeneriert: {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.8-b20130806.1801"
+Driver.FullVersion = xjc vollst\u00E4ndige Version "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Fallo al producir c\u00f3digo.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.8-b20130806.1801 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este archivo ha sido generado por la arquitectura JavaTM para la implantaci\u00f3n de la referencia de enlace (JAXB) XML v2.2.8-b130911.1802 \nVisite <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas las modificaciones realizadas en este archivo se perder\u00e1n si se vuelve a compilar el esquema de origen. \nGenerado el: {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = versi\u00F3n completa de xjc "2.2.8-b20130806.1801"
+Driver.FullVersion = versi\u00F3n completa de xjc "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Echec de la production du code.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b20130806.1801 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Ce fichier a \u00e9t\u00e9 g\u00e9n\u00e9r\u00e9 par l''impl\u00e9mentation de r\u00e9f\u00e9rence JavaTM Architecture for XML Binding (JAXB), v2.2.8-b130911.1802 \nVoir <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nToute modification apport\u00e9e \u00e0 ce fichier sera perdue lors de la recompilation du sch\u00e9ma source. \nG\u00e9n\u00e9r\u00e9 le : {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = version compl\u00E8te xjc "2.2.8-b20130806.1801"
+Driver.FullVersion = version compl\u00E8te xjc "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Produzione del codice non riuscita.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b20130806.1801 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Questo file \u00e8 stato generato dall''architettura JavaTM per XML Binding (JAXB) Reference Implementation, v2.2.8-b130911.1802 \nVedere <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nQualsiasi modifica a questo file andr\u00e0 persa durante la ricompilazione dello schema di origine. \nGenerato il: {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = versione completa xjc "2.2.8-b20130806.1801"
+Driver.FullVersion = versione completa xjc "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u30b3\u30fc\u30c9\u306e\u751f\u6210\u306b\u5931\u6557\u3057\u307e\u3057\u305f\u3002
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.8-b20130806.1801\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306f\u3001JavaTM Architecture for XML Binding(JAXB) Reference Implementation\u3001v2.2.8-b130911.1802\u306b\u3088\u3063\u3066\u751f\u6210\u3055\u308c\u307e\u3057\u305f \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\u3092\u53c2\u7167\u3057\u3066\u304f\u3060\u3055\u3044 \n\u30bd\u30fc\u30b9\u30fb\u30b9\u30ad\u30fc\u30de\u306e\u518d\u30b3\u30f3\u30d1\u30a4\u30eb\u6642\u306b\u3053\u306e\u30d5\u30a1\u30a4\u30eb\u306e\u5909\u66f4\u306f\u5931\u308f\u308c\u307e\u3059\u3002 \n\u751f\u6210\u65e5: {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b20130806.1801"
+Driver.FullVersion = xjc\u30D5\u30EB\u30FB\u30D0\u30FC\u30B8\u30E7\u30F3"2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \ucf54\ub4dc \uc0dd\uc131\uc744 \uc2e4\ud328\ud588\uc2b5\ub2c8\ub2e4.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.8-b20130806.1801 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \uc774 \ud30c\uc77c\uc740 JAXB(JavaTM Architecture for XML Binding) \ucc38\uc870 \uad6c\ud604 2.2.8-b130911.1802 \ubc84\uc804\uc744 \ud1b5\ud574 \uc0dd\uc131\ub418\uc5c8\uc2b5\ub2c8\ub2e4. \n<a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a>\ub97c \ucc38\uc870\ud558\uc2ed\uc2dc\uc624. \n\uc774 \ud30c\uc77c\uc744 \uc218\uc815\ud558\uba74 \uc18c\uc2a4 \uc2a4\ud0a4\ub9c8\ub97c \uc7ac\ucef4\ud30c\uc77c\ud560 \ub54c \uc218\uc815 \uc0ac\ud56d\uc774 \uc190\uc2e4\ub429\ub2c8\ub2e4. \n\uc0dd\uc131 \ub0a0\uc9dc: {0} \n
 
-Driver.Version = XJC 2.2.8-b20130806.1801
+Driver.Version = XJC 2.2.8-b130911.1802
 
-Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.8-b20130806.1801"
+Driver.FullVersion = XJC \uC815\uC2DD \uBC84\uC804 "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = Falha ao produzir o c\u00f3digo.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.8-b20130806.1801 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = Este arquivo foi gerado pela Arquitetura JavaTM para Implementa\u00e7\u00e3o de Refer\u00eancia (JAXB) de Bind XML, v2.2.8-b130911.1802 \nConsulte <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \nTodas as modifica\u00e7\u00f5es neste arquivo ser\u00e3o perdidas ap\u00f3s a recompila\u00e7\u00e3o do esquema de origem. \nGerado em: {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = vers\u00E3o completa de xjc "2.2.8-b20130806.1801"
+Driver.FullVersion = vers\u00E3o completa de xjc "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u65e0\u6cd5\u751f\u6210\u4ee3\u7801\u3002
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.8-b20130806.1801 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6587\u4ef6\u662f\u7531 JavaTM Architecture for XML Binding (JAXB) \u5f15\u7528\u5b9e\u73b0 v2.2.8-b130911.1802 \u751f\u6210\u7684\n\u8bf7\u8bbf\u95ee <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u5728\u91cd\u65b0\u7f16\u8bd1\u6e90\u6a21\u5f0f\u65f6, \u5bf9\u6b64\u6587\u4ef6\u7684\u6240\u6709\u4fee\u6539\u90fd\u5c06\u4e22\u5931\u3002\n\u751f\u6210\u65f6\u95f4: {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b20130806.1801"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -96,14 +96,14 @@
 
 Driver.FailedToGenerateCode = \u7121\u6cd5\u7522\u751f\u7a0b\u5f0f\u78bc.
 
-# DO NOT localize the 2.2.8-b20130806.1801 string - it is a token for an ant <replaceFilter>
-Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b20130806.1801 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
+# DO NOT localize the 2.2.8-b130911.1802 string - it is a token for an mvn <properties filter>
+Driver.FilePrologComment = \u6b64\u6a94\u6848\u662f\u7531 JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.8-b130911.1802 \u6240\u7522\u751f \n\u8acb\u53c3\u95b1 <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> \n\u4e00\u65e6\u91cd\u65b0\u7de8\u8b6f\u4f86\u6e90\u7db1\u8981, \u5c0d\u6b64\u6a94\u6848\u6240\u505a\u7684\u4efb\u4f55\u4fee\u6539\u90fd\u5c07\u6703\u907a\u5931. \n\u7522\u751f\u6642\u9593: {0} \n
 
-Driver.Version = xjc 2.2.8-b20130806.1801
+Driver.Version = xjc 2.2.8-b130911.1802
 
-Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b20130806.1801"
+Driver.FullVersion = xjc \u5B8C\u6574\u7248\u672C "2.2.8-b130911.1802"
 
-Driver.BuildID = 2.2.8-b20130806.1801
+Driver.BuildID = 2.2.8-b130911.1802
 
 # for JDK integration - include version in source zip
 jaxb.jdk.version=@@JAXB_JDK_VERSION@@
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/SchemaCache.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/SchemaCache.java	Fri Oct 04 16:21:34 2013 +0100
@@ -35,7 +35,7 @@
 import javax.xml.XMLConstants;
 import org.xml.sax.SAXException;
 
-import static com.sun.xml.internal.bind.v2.util.XmlFactory.allowFileAccess;
+import static com.sun.xml.internal.bind.v2.util.XmlFactory.allowExternalAccess;
 
 /**
  * Wraps a JAXP {@link Schema} object and lazily instantiate it.
@@ -61,7 +61,7 @@
                 try {
                     // do not disable secure processing - these are well-known schemas
                     SchemaFactory sf = XmlFactory.createSchemaFactory(XMLConstants.W3C_XML_SCHEMA_NS_URI, false);
-                    schema = allowFileAccess(sf, false).newSchema(source);
+                    schema = allowExternalAccess(sf, "file", false).newSchema(source);
                 } catch (SAXException e) {
                     // we make sure that the schema is correct before we ship.
                     throw new AssertionError(e);
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java	Fri Oct 04 16:21:34 2013 +0100
@@ -59,7 +59,7 @@
 import java.io.OutputStreamWriter;
 import java.util.*;
 
-import static com.sun.xml.internal.bind.v2.util.XmlFactory.allowFileAccess;
+import static com.sun.xml.internal.bind.v2.util.XmlFactory.allowExternalAccess;
 import static javax.xml.XMLConstants.W3C_XML_SCHEMA_NS_URI;
 
 
@@ -460,7 +460,7 @@
         }
 
         try {
-            allowFileAccess(sf, options.disableXmlSecurity).newSchema(sources.toArray(new SAXSource[0]));
+            allowExternalAccess(sf, "file,http", options.disableXmlSecurity).newSchema(sources.toArray(new SAXSource[0]));
         } catch (SAXException e) {
             // error should have been reported.
         } catch (RuntimeException re) {
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/ct/AbstractExtendedComplexTypeBuilder.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/ct/AbstractExtendedComplexTypeBuilder.java	Fri Oct 04 16:21:34 2013 +0100
@@ -41,6 +41,7 @@
 import com.sun.xml.internal.xsom.XSType;
 import com.sun.xml.internal.xsom.XSWildcard;
 import com.sun.xml.internal.xsom.visitor.XSTermFunction;
+import javax.xml.namespace.QName;
 
 import com.sun.xml.internal.rngom.nc.ChoiceNameClass;
 import com.sun.xml.internal.rngom.nc.NameClass;
@@ -65,14 +66,17 @@
      * Computes a name class that represents everything in a given content model.
      */
     protected final XSTermFunction<NameClass> contentModelNameClassBuilder = new XSTermFunction<NameClass>() {
+        @Override
         public NameClass wildcard(XSWildcard wc) {
             return WildcardNameClassBuilder.build(wc);
         }
 
+        @Override
         public NameClass modelGroupDecl(XSModelGroupDecl decl) {
             return modelGroup(decl.getModelGroup());
         }
 
+        @Override
         public NameClass modelGroup(XSModelGroup group) {
             NameClass nc = NameClass.NULL;
             for( int i=0; i<group.getSize(); i++ )
@@ -216,7 +220,7 @@
      * Gets a {@link SimpleNameClass} from the name of a {@link XSDeclaration}.
      */
     private NameClass getNameClass(XSDeclaration decl) {
-        return new SimpleNameClass(decl.getTargetNamespace(), decl.getName());
+        return new SimpleNameClass(new QName(decl.getTargetNamespace(), decl.getName()));
     }
 
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/parser/SchemaConstraintChecker.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/parser/SchemaConstraintChecker.java	Fri Oct 04 16:21:34 2013 +0100
@@ -69,6 +69,7 @@
         boolean hadErrors = false;
 
         SchemaFactory sf = XmlFactory.createSchemaFactory(W3C_XML_SCHEMA_NS_URI, disableXmlSecurity);
+        XmlFactory.allowExternalAccess(sf, "all", disableXmlSecurity);
         sf.setErrorHandler(errorFilter);
         if( entityResolver != null ) {
             sf.setResourceResolver(new LSResourceResolver() {
@@ -91,6 +92,7 @@
         }
 
         try {
+            XmlFactory.allowExternalDTDAccess(sf, "all", disableXmlSecurity);
             sf.newSchema(getSchemaSource(schemas, entityResolver));
         } catch (SAXException e) {
             // TODO: we haven't thrown exceptions from here before. should we just trap them and return false?
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.java	Fri Oct 04 16:21:34 2013 +0100
@@ -42,6 +42,8 @@
     INVALID_JAXP_IMPLEMENTATION, // 1 arg
     JAXP_SUPPORTED_PROPERTY, // 1 arg
     JAXP_UNSUPPORTED_PROPERTY, // 1 arg
+    JAXP_XML_SECURITY_DISABLED, // no arg
+    JAXP_EXTERNAL_ACCESS_CONFIGURED, // no arg
     ;
 
     private static final ResourceBundle rb = ResourceBundle.getBundle(Messages.class.getName());
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.properties	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.properties	Fri Oct 04 16:21:34 2013 +0100
@@ -56,3 +56,9 @@
 
 JAXP_UNSUPPORTED_PROPERTY =\
     Property "{0}" is not supported by used JAXP implementation.
+
+JAXP_XML_SECURITY_DISABLED=\
+    "Xml Security disabled, no JAXP xsd external access configuration necessary."
+
+JAXP_EXTERNAL_ACCESS_CONFIGURED=\
+    "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary."
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Fri Oct 04 16:21:34 2013 +0100
@@ -140,22 +140,23 @@
      */
     private final Loader itemsLoader = new Loader(false) {
 
-        private ThreadLocal<BeanT> target = new ThreadLocal<BeanT>();
-        private ThreadLocal<ValueT> map = new ThreadLocal<ValueT>();
-        private int depthCounter = 0; // needed to clean ThreadLocals
+        private ThreadLocal<Stack<BeanT>> target = new ThreadLocal<Stack<BeanT>>();
+        private ThreadLocal<Stack<ValueT>> map = new ThreadLocal<Stack<ValueT>>();
 
         @Override
         public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException {
             // create or obtain the Map object
             try {
-                target.set((BeanT)state.prev.target);
-                map.set(acc.get(target.get()));
-                depthCounter++;
-                if(map.get() == null) {
-                    map.set(ClassFactory.create(mapImplClass));
-                }
-                map.get().clear();
-                state.target = map.get();
+                BeanT target = (BeanT) state.prev.target;
+                ValueT mapValue = acc.get(target);
+                if(mapValue == null)
+                    mapValue = ClassFactory.create(mapImplClass);
+                else
+                    mapValue.clear();
+
+                Stack.push(this.target, target);
+                Stack.push(map, mapValue);
+                state.target = mapValue;
             } catch (AccessorException e) {
                 // recover from error by setting a dummy Map that receives and discards the values
                 handleGenericException(e,true);
@@ -167,11 +168,7 @@
         public void leaveElement(State state, TagName ea) throws SAXException {
             super.leaveElement(state, ea);
             try {
-                acc.set(target.get(), map.get());
-                if (--depthCounter == 0) {
-                    target.remove();
-                    map.remove();
-                }
+                acc.set(Stack.pop(target), Stack.pop(map));
             } catch (AccessorException ex) {
                 handleGenericException(ex,true);
             }
@@ -289,4 +286,36 @@
             return acc;
         return null;
     }
+
+    private static final class Stack<T> {
+        private Stack<T> parent;
+        private T value;
+
+        private Stack(Stack<T> parent, T value) {
+            this.parent = parent;
+            this.value = value;
+        }
+
+        private Stack(T value) {
+            this.value = value;
+        }
+
+        private static <T> void push(ThreadLocal<Stack<T>> holder, T value) {
+            Stack<T> parent = holder.get();
+            if (parent == null)
+                holder.set(new Stack<T>(value));
+            else
+                holder.set(new Stack<T>(parent, value));
+        }
+
+        private static <T> T pop(ThreadLocal<Stack<T>> holder) {
+            Stack<T> current = holder.get();
+            if (current.parent == null)
+                holder.remove();
+            else
+                holder.set(current.parent);
+            return current.value;
+        }
+
+    }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -63,19 +63,15 @@
             ClassLoader cl = SecureLoader.getClassClassLoader(beanClass);
             if(cl==null)    return null;    // how do I inject classes to this "null" class loader? for now, back off.
 
-            Class c = null;
-            synchronized (AccessorInjector.class) {
-                c = Injector.find(cl,newClassName);
-                if(c==null) {
-                    byte[] image = tailor(templateClassName,newClassName,replacements);
-    //                try {
-    //                    new FileOutputStream("debug.class").write(image);
-    //                } catch (IOException e) {
-    //                    e.printStackTrace();
-    //                }
-                    if(image==null)
-                        return null;
-                    c = Injector.inject(cl,newClassName,image);
+            Class c = Injector.find(cl,newClassName);
+            if (c==null) {
+                byte[] image = tailor(templateClassName,newClassName,replacements);
+                if (image==null) {
+                    return null;
+                }
+                c = Injector.inject(cl,newClassName,image);
+                if (c == null) {
+                    Injector.find(cl, newClassName);
                 }
             }
             return c;
@@ -112,4 +108,5 @@
     }
 
     private static final ClassLoader CLASS_LOADER = SecureLoader.getClassClassLoader(AccessorInjector.class);
+
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -156,6 +156,7 @@
         }
         AccessController.doPrivileged(new PrivilegedAction<Void>() {
 
+            @Override
             public Void run() {
                 // TODO: check security implication
                 // do these setAccessible allow anyone to call these methods freely?s
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/OptimizedAccessorFactory.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/OptimizedAccessorFactory.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -127,8 +127,11 @@
             return null;
 
         Accessor<B,V> acc = instanciate(opt);
-        if(acc!=null)
-            logger.log(Level.FINE,"Using optimized Accessor for "+getter+" and "+setter);
+        if (acc!=null) {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Using optimized Accessor for {0} and {1}", new Object[]{getter, setter});
+            }
+        }
         return acc;
     }
 
@@ -174,8 +177,11 @@
             return null;
 
         Accessor<B,V> acc = instanciate(opt);
-        if(acc!=null)
-            logger.log(Level.FINE,"Using optimized Accessor for "+field);
+        if (acc!=null) {
+            if (logger.isLoggable(Level.FINE)) {
+                logger.log(Level.FINE, "Using optimized Accessor for {0}", field);
+            }
+        }
         return acc;
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java	Fri Oct 04 16:21:34 2013 +0100
@@ -43,6 +43,8 @@
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
 
+import static com.sun.xml.internal.bind.Util.getSystemProperty;
+
 /**
  * Provides helper methods for creating properly configured XML parser
  * factory instances with namespace support turned on and configured for
@@ -53,6 +55,7 @@
 
     // not in older JDK, so must be duplicated here, otherwise javax.xml.XMLConstants should be used
     public static final String ACCESS_EXTERNAL_SCHEMA = "http://javax.xml.XMLConstants/property/accessExternalSchema";
+    public static final String ACCESS_EXTERNAL_DTD = "http://javax.xml.XMLConstants/property/accessExternalDTD";
 
     private static final Logger LOGGER = Logger.getLogger(XmlFactory.class.getName());
 
@@ -65,11 +68,10 @@
      */
     private static final String DISABLE_XML_SECURITY  = "com.sun.xml.internal.bind.disableXmlSecurity";
 
-    public static final boolean DISABLE_SECURE_PROCESSING =
-            Boolean.parseBoolean(Util.getSystemProperty(DISABLE_XML_SECURITY));
+    public static final boolean XML_SECURITY_DISABLED = Boolean.parseBoolean(getSystemProperty(DISABLE_XML_SECURITY));
 
-    private static boolean xmlFeatureValue(boolean runtimeSetting) {
-        return !(DISABLE_SECURE_PROCESSING || runtimeSetting);
+    private static boolean isXMLSecurityDisabled(boolean runtimeSetting) {
+        return XML_SECURITY_DISABLED || runtimeSetting;
     }
 
     /**
@@ -83,7 +85,7 @@
             if (LOGGER.isLoggable(Level.FINE)) {
                 LOGGER.log(Level.FINE, "SchemaFactory instance: {0}", factory);
             }
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, xmlFeatureValue(disableSecureProcessing));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing));
             return factory;
         } catch (SAXNotRecognizedException ex) {
             LOGGER.log(Level.SEVERE, null, ex);
@@ -109,7 +111,7 @@
                 LOGGER.log(Level.FINE, "SAXParserFactory instance: {0}", factory);
             }
             factory.setNamespaceAware(true);
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, xmlFeatureValue(disableSecureProcessing));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing));
             return factory;
         } catch (ParserConfigurationException ex) {
             LOGGER.log(Level.SEVERE, null, ex);
@@ -136,7 +138,7 @@
             if (LOGGER.isLoggable(Level.FINE)) {
                 LOGGER.log(Level.FINE, "XPathFactory instance: {0}", factory);
             }
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, xmlFeatureValue(disableSecureProcessing));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing));
             return factory;
         } catch (XPathFactoryConfigurationException ex) {
             LOGGER.log(Level.SEVERE, null, ex);
@@ -157,7 +159,7 @@
             if (LOGGER.isLoggable(Level.FINE)) {
                 LOGGER.log(Level.FINE, "TransformerFactory instance: {0}", factory);
             }
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, xmlFeatureValue(disableSecureProcessing));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing));
             return factory;
         } catch (TransformerConfigurationException ex) {
             LOGGER.log(Level.SEVERE, null, ex);
@@ -180,7 +182,7 @@
                 LOGGER.log(Level.FINE, "DocumentBuilderFactory instance: {0}", factory);
             }
             factory.setNamespaceAware(true);
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, xmlFeatureValue(disableSecureProcessing));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, !isXMLSecurityDisabled(disableSecureProcessing));
             return factory;
         } catch (ParserConfigurationException ex) {
             LOGGER.log(Level.SEVERE, null, ex);
@@ -191,20 +193,64 @@
         }
     }
 
-    public static SchemaFactory allowFileAccess(SchemaFactory sf, boolean disableSecureProcessing) {
+    public static SchemaFactory allowExternalAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) {
 
-        // if feature secure processing enabled, nothing to do, file is allowed,
-        // or user is able to control access by standard JAXP mechanisms
-        if (disableSecureProcessing) {
+        // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
+        if (isXMLSecurityDisabled(disableSecureProcessing)) {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format());
+            }
+            return sf;
+        }
+
+        if (System.getProperty("javax.xml.accessExternalSchema") != null) {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format());
+            }
             return sf;
         }
 
         try {
-            sf.setProperty(ACCESS_EXTERNAL_SCHEMA, "file");
-            LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA));
+            sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value);
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA));
+            }
         } catch (SAXException ignored) {
             // nothing to do; support depends on version JDK or SAX implementation
-            LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored);
+            if (LOGGER.isLoggable(Level.CONFIG)) {
+                LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_SCHEMA), ignored);
+            }
+        }
+        return sf;
+    }
+
+    public static SchemaFactory allowExternalDTDAccess(SchemaFactory sf, String value, boolean disableSecureProcessing) {
+
+        // if xml security (feature secure processing) disabled, nothing to do, no restrictions applied
+        if (isXMLSecurityDisabled(disableSecureProcessing)) {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, Messages.JAXP_XML_SECURITY_DISABLED.format());
+            }
+            return sf;
+        }
+
+        if (System.getProperty("javax.xml.accessExternalDTD") != null) {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, Messages.JAXP_EXTERNAL_ACCESS_CONFIGURED.format());
+            }
+            return sf;
+        }
+
+        try {
+            sf.setProperty(ACCESS_EXTERNAL_DTD, value);
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, Messages.JAXP_SUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD));
+            }
+        } catch (SAXException ignored) {
+            // nothing to do; support depends on version JDK or SAX implementation
+            if (LOGGER.isLoggable(Level.CONFIG)) {
+                LOGGER.log(Level.CONFIG, Messages.JAXP_UNSUPPORTED_PROPERTY.format(ACCESS_EXTERNAL_DTD), ignored);
+            }
         }
         return sf;
     }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java	Fri Oct 04 16:21:34 2013 +0100
@@ -287,10 +287,11 @@
      * @throws IOException if i/o error occurs
      */
     public InputStream getInputStream() throws IOException {
-        if(dataHandler!=null)
+        if(dataHandler!=null) {
             return dataHandler.getInputStream();
-        else
+        } else {
             return new ByteArrayInputStream(data,0,dataLen);
+        }
     }
 
     /**
@@ -342,8 +343,9 @@
     }
 
     public String getMimeType() {
-        if(mimeType==null)
+        if (mimeType==null) {
             return "application/octet-stream";
+        }
         return mimeType;
     }
 
@@ -376,31 +378,35 @@
         case 0:
             return Base64Encoder.encode(data[base]>>2);
         case 1:
-            if(base+1<dataLen)
+            if (base+1<dataLen) {
                 b1 = data[base+1];
-            else
+            } else {
                 b1 = 0;
+            }
             return Base64Encoder.encode(
                         ((data[base]&0x3)<<4) |
                         ((b1>>4)&0xF));
         case 2:
-            if(base+1<dataLen) {
+            if (base+1<dataLen) {
                 b1 = data[base+1];
-                if(base+2<dataLen)
+                if (base+2<dataLen) {
                     b2 = data[base+2];
-                else
+                } else {
                     b2 = 0;
+                }
 
                 return Base64Encoder.encode(
                             ((b1&0xF)<<2)|
                             ((b2>>6)&0x3));
-            } else
+            } else {
                 return '=';
+            }
         case 3:
-            if(base+2<dataLen)
+            if(base+2<dataLen) {
                 return Base64Encoder.encode(data[base+2]&0x3F);
-            else
+            } else {
                 return '=';
+            }
         }
 
         throw new IllegalStateException();
@@ -414,8 +420,9 @@
     public CharSequence subSequence(int start, int end) {
         StringBuilder buf = new StringBuilder();
         get();  // fill in the buffer if we haven't done so
-        for( int i=start; i<end; i++ )
+        for (int i=start; i<end; i++ ) {
             buf.append(charAt(i));
+        }
         return buf;
     }
 
@@ -473,7 +480,25 @@
 
     @Override
     public Base64Data clone() {
-        return new Base64Data(this);
+        try {
+            Base64Data clone = (Base64Data) super.clone();
+            clone.get();
+            if (clone.dataCloneByRef) {
+                this.data = clone.data;
+            } else {
+                this.data = new byte[clone.dataLen];
+                System.arraycopy(clone.data, 0, this.data, 0, clone.dataLen);
+            }
+
+            this.dataCloneByRef = true;
+            this.dataLen = clone.dataLen;
+            this.dataHandler = null;
+            this.mimeType = clone.mimeType;
+            return clone;
+        } catch (CloneNotSupportedException ex) {
+            Logger.getLogger(Base64Data.class.getName()).log(Level.SEVERE, null, ex);
+            return null;
+        }
     }
 
     static String getProperty(final String propName) {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Encoder.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Encoder.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64EncoderStream.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64EncoderStream.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/ByteArrayOutputStreamEx.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/ByteArrayOutputStreamEx.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/NamespaceContextEx.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/NamespaceContextEx.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/XMLStreamWriterEx.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/XMLStreamWriterEx.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/binary/SchemaBuilderImpl.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/binary/SchemaBuilderImpl.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -88,703 +88,705 @@
 import org.xml.sax.SAXParseException;
 
 public class SchemaBuilderImpl implements SchemaBuilder, ElementAnnotationBuilder, CommentList {
-  private final SchemaBuilderImpl parent;
-  private boolean hadError = false;
-  private final SchemaPatternBuilder pb;
-  private final DatatypeLibraryFactory datatypeLibraryFactory;
-  private final String inheritNs;
-  private final ErrorHandler eh;
-  private final OpenIncludes openIncludes;
-  private final NameClassBuilder ncb =new NameClassBuilderImpl();
-  static final Localizer localizer = new Localizer(SchemaBuilderImpl.class);
 
-  static class OpenIncludes {
-    final String uri;
-    final OpenIncludes parent;
+    private final SchemaBuilderImpl parent;
+    private boolean hadError = false;
+    private final SchemaPatternBuilder pb;
+    private final DatatypeLibraryFactory datatypeLibraryFactory;
+    private final String inheritNs;
+    private final ErrorHandler eh;
+    private final OpenIncludes openIncludes;
+    private final NameClassBuilder ncb = new NameClassBuilderImpl();
+    static final Localizer localizer = new Localizer(SchemaBuilderImpl.class);
 
-    OpenIncludes(String uri, OpenIncludes parent) {
-      this.uri = uri;
-      this.parent = parent;
+    static class OpenIncludes {
+
+        final String uri;
+        final OpenIncludes parent;
+
+        OpenIncludes(String uri, OpenIncludes parent) {
+            this.uri = uri;
+            this.parent = parent;
+        }
     }
-  }
 
-  public ParsedPattern expandPattern(ParsedPattern _pattern)
-        throws BuildException, IllegalSchemaException {
+    public ParsedPattern expandPattern(ParsedPattern _pattern)
+            throws BuildException, IllegalSchemaException {
         Pattern pattern = (Pattern) _pattern;
         if (!hadError) {
             try {
                 pattern.checkRecursion(0);
                 pattern = pattern.expand(pb);
                 pattern.checkRestrictions(Pattern.START_CONTEXT, null, null);
-                if (!hadError) return pattern;
+                if (!hadError) {
+                    return pattern;
+                }
             } catch (SAXParseException e) {
                 error(e);
             } catch (SAXException e) {
                 throw new BuildException(e);
             } catch (RestrictionViolationException e) {
-                if (e.getName() != null)
+                if (e.getName() != null) {
                     error(e.getMessageId(), e.getName().toString(), e
-                        .getLocator());
-                else
+                            .getLocator());
+                } else {
                     error(e.getMessageId(), e.getLocator());
+                }
             }
         }
         throw new IllegalSchemaException();
     }
 
-  /**
-   *
-   * @param eh
-   *        Error handler to receive errors while building the schema.
-   */
-  public SchemaBuilderImpl(ErrorHandler eh) {
-      this(eh,
-          new CascadingDatatypeLibraryFactory(new DatatypeLibraryLoader(),
-            new BuiltinDatatypeLibraryFactory(new DatatypeLibraryLoader())),
-          new SchemaPatternBuilder());
-  }
+    /**
+     *
+     * @param eh Error handler to receive errors while building the schema.
+     */
+    public SchemaBuilderImpl(ErrorHandler eh) {
+        this(eh,
+                new CascadingDatatypeLibraryFactory(new DatatypeLibraryLoader(),
+                new BuiltinDatatypeLibraryFactory(new DatatypeLibraryLoader())),
+                new SchemaPatternBuilder());
+    }
 
-  /**
-   *
-   * @param eh
-   *        Error handler to receive errors while building the schema.
-   * @param datatypeLibraryFactory
-   *        This is consulted to locate datatype libraries.
-   * @param pb
-   *        Used to build patterns.
-   */
-  public SchemaBuilderImpl(ErrorHandler eh,
-                            DatatypeLibraryFactory datatypeLibraryFactory,
-                            SchemaPatternBuilder pb) {
-    this.parent = null;
-    this.eh = eh;
-    this.datatypeLibraryFactory = datatypeLibraryFactory;
-    this.pb = pb;
-    this.inheritNs = "";
-    this.openIncludes = null;
-  }
+    /**
+     *
+     * @param eh Error handler to receive errors while building the schema.
+     * @param datatypeLibraryFactory This is consulted to locate datatype
+     * libraries.
+     * @param pb Used to build patterns.
+     */
+    public SchemaBuilderImpl(ErrorHandler eh,
+            DatatypeLibraryFactory datatypeLibraryFactory,
+            SchemaPatternBuilder pb) {
+        this.parent = null;
+        this.eh = eh;
+        this.datatypeLibraryFactory = datatypeLibraryFactory;
+        this.pb = pb;
+        this.inheritNs = "";
+        this.openIncludes = null;
+    }
 
-  private SchemaBuilderImpl(String inheritNs,
-                            String uri,
-                            SchemaBuilderImpl parent) {
-    this.parent = parent;
-    this.eh = parent.eh;
-    this.datatypeLibraryFactory = parent.datatypeLibraryFactory;
-    this.pb = parent.pb;
-    this.inheritNs = inheritNs;
-    this.openIncludes = new OpenIncludes(uri, parent.openIncludes);
-  }
+    private SchemaBuilderImpl(String inheritNs,
+            String uri,
+            SchemaBuilderImpl parent) {
+        this.parent = parent;
+        this.eh = parent.eh;
+        this.datatypeLibraryFactory = parent.datatypeLibraryFactory;
+        this.pb = parent.pb;
+        this.inheritNs = inheritNs;
+        this.openIncludes = new OpenIncludes(uri, parent.openIncludes);
+    }
 
-  public NameClassBuilder getNameClassBuilder() {
-      return ncb;
-  }
+    public NameClassBuilder getNameClassBuilder() {
+        return ncb;
+    }
 
-  public ParsedPattern makeChoice(List patterns, Location loc, Annotations anno)
-          throws BuildException {
-    if (patterns.isEmpty())
-      throw new IllegalArgumentException();
-    Pattern result = (Pattern)patterns.get(0);
-    for (int i = 1; i < patterns.size(); i++)
-      result = pb.makeChoice(result, (Pattern)patterns.get(i));
-    return result;
-  }
+    public ParsedPattern makeChoice(List patterns, Location loc, Annotations anno)
+            throws BuildException {
+        if (patterns.isEmpty()) {
+            throw new IllegalArgumentException();
+        }
+        Pattern result = (Pattern) patterns.get(0);
+        for (int i = 1; i < patterns.size(); i++) {
+            result = pb.makeChoice(result, (Pattern) patterns.get(i));
+        }
+        return result;
+    }
 
-  public ParsedPattern makeInterleave(List patterns, Location loc, Annotations anno)
-          throws BuildException {
-    if (patterns.isEmpty())
-      throw new IllegalArgumentException();
-    Pattern result = (Pattern)patterns.get(0);
-    for (int i = 1; i < patterns.size(); i++)
-      result = pb.makeInterleave(result, (Pattern)patterns.get(i));
-    return result;
-  }
+    public ParsedPattern makeInterleave(List patterns, Location loc, Annotations anno)
+            throws BuildException {
+        if (patterns.isEmpty()) {
+            throw new IllegalArgumentException();
+        }
+        Pattern result = (Pattern) patterns.get(0);
+        for (int i = 1; i < patterns.size(); i++) {
+            result = pb.makeInterleave(result, (Pattern) patterns.get(i));
+        }
+        return result;
+    }
 
-  public ParsedPattern makeGroup(List patterns, Location loc, Annotations anno)
-          throws BuildException {
-    if (patterns.isEmpty())
-      throw new IllegalArgumentException();
-    Pattern result = (Pattern)patterns.get(0);
-    for (int i = 1; i < patterns.size(); i++)
-      result = pb.makeGroup(result, (Pattern)patterns.get(i));
-    return result;
-  }
+    public ParsedPattern makeGroup(List patterns, Location loc, Annotations anno)
+            throws BuildException {
+        if (patterns.isEmpty()) {
+            throw new IllegalArgumentException();
+        }
+        Pattern result = (Pattern) patterns.get(0);
+        for (int i = 1; i < patterns.size(); i++) {
+            result = pb.makeGroup(result, (Pattern) patterns.get(i));
+        }
+        return result;
+    }
 
-  public ParsedPattern makeOneOrMore(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeOneOrMore((Pattern)p);
-  }
+    public ParsedPattern makeOneOrMore(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeOneOrMore((Pattern) p);
+    }
 
-  public ParsedPattern makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeZeroOrMore((Pattern)p);
-  }
+    public ParsedPattern makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeZeroOrMore((Pattern) p);
+    }
 
-  public ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeOptional((Pattern)p);
-  }
+    public ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeOptional((Pattern) p);
+    }
 
-  public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeList((Pattern)p, (Locator)loc);
-  }
+    public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeList((Pattern) p, (Locator) loc);
+    }
 
-  public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeMixed((Pattern)p);
-  }
+    public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeMixed((Pattern) p);
+    }
 
-  public ParsedPattern makeEmpty(Location loc, Annotations anno) {
-    return pb.makeEmpty();
-  }
+    public ParsedPattern makeEmpty(Location loc, Annotations anno) {
+        return pb.makeEmpty();
+    }
 
-  public ParsedPattern makeNotAllowed(Location loc, Annotations anno) {
-    return pb.makeUnexpandedNotAllowed();
-  }
+    public ParsedPattern makeNotAllowed(Location loc, Annotations anno) {
+        return pb.makeUnexpandedNotAllowed();
+    }
 
-  public ParsedPattern makeText(Location loc, Annotations anno) {
-    return pb.makeText();
-  }
+    public ParsedPattern makeText(Location loc, Annotations anno) {
+        return pb.makeText();
+    }
 
-  public ParsedPattern makeErrorPattern() {
-    return pb.makeError();
-  }
+    public ParsedPattern makeErrorPattern() {
+        return pb.makeError();
+    }
 
 //  public ParsedNameClass makeErrorNameClass() {
 //    return new ErrorNameClass();
 //  }
-
-  public ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeAttribute((NameClass)nc, (Pattern)p, (Locator)loc);
-  }
-
-  public ParsedPattern makeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeElement((NameClass)nc, (Pattern)p, (Locator)loc);
-  }
-
-  private class DummyDataPatternBuilder implements DataPatternBuilder {
-    public void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno)
+    public ParsedPattern makeAttribute(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)
             throws BuildException {
+        return pb.makeAttribute((NameClass) nc, (Pattern) p, (Locator) loc);
     }
 
-    public ParsedPattern makePattern(Location loc, Annotations anno)
+    public ParsedPattern makeElement(ParsedNameClass nc, ParsedPattern p, Location loc, Annotations anno)
             throws BuildException {
-      return pb.makeError();
+        return pb.makeElement((NameClass) nc, (Pattern) p, (Locator) loc);
     }
 
-    public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno)
-            throws BuildException {
-      return pb.makeError();
+    private class DummyDataPatternBuilder implements DataPatternBuilder {
+
+        public void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno)
+                throws BuildException {
+        }
+
+        public ParsedPattern makePattern(Location loc, Annotations anno)
+                throws BuildException {
+            return pb.makeError();
+        }
+
+        public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno)
+                throws BuildException {
+            return pb.makeError();
+        }
+
+        public void annotation(ParsedElementAnnotation ea) {
+        }
     }
 
-    public void annotation(ParsedElementAnnotation ea) {
-    }
-  }
+    private static class ValidationContextImpl implements ValidationContext {
 
-  private class ValidationContextImpl implements ValidationContext {
-    private ValidationContext vc;
-    private String ns;
+        private ValidationContext vc;
+        private String ns;
 
-    ValidationContextImpl(ValidationContext vc, String ns) {
-      this.vc = vc;
-      this.ns = ns.length() == 0 ? null : ns;
+        ValidationContextImpl(ValidationContext vc, String ns) {
+            this.vc = vc;
+            this.ns = ns.length() == 0 ? null : ns;
+        }
+
+        public String resolveNamespacePrefix(String prefix) {
+            return prefix.length() == 0 ? ns : vc.resolveNamespacePrefix(prefix);
+        }
+
+        public String getBaseUri() {
+            return vc.getBaseUri();
+        }
+
+        public boolean isUnparsedEntity(String entityName) {
+            return vc.isUnparsedEntity(entityName);
+        }
+
+        public boolean isNotation(String notationName) {
+            return vc.isNotation(notationName);
+        }
     }
 
-    public String resolveNamespacePrefix(String prefix) {
-      return prefix.length() == 0 ? ns : vc.resolveNamespacePrefix(prefix);
+    private class DataPatternBuilderImpl implements DataPatternBuilder {
+
+        private DatatypeBuilder dtb;
+
+        DataPatternBuilderImpl(DatatypeBuilder dtb) {
+            this.dtb = dtb;
+        }
+
+        public void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno)
+                throws BuildException {
+            try {
+                dtb.addParameter(name, value, new ValidationContextImpl(context, ns));
+            } catch (DatatypeException e) {
+                String detail = e.getMessage();
+                int pos = e.getIndex();
+                String displayedParam;
+                if (pos == DatatypeException.UNKNOWN) {
+                    displayedParam = null;
+                } else {
+                    displayedParam = displayParam(value, pos);
+                }
+                if (displayedParam != null) {
+                    if (detail != null) {
+                        error("invalid_param_detail_display", detail, displayedParam, (Locator) loc);
+                    } else {
+                        error("invalid_param_display", displayedParam, (Locator) loc);
+                    }
+                } else if (detail != null) {
+                    error("invalid_param_detail", detail, (Locator) loc);
+                } else {
+                    error("invalid_param", (Locator) loc);
+                }
+            }
+        }
+
+        String displayParam(String value, int pos) {
+            if (pos < 0) {
+                pos = 0;
+            } else if (pos > value.length()) {
+                pos = value.length();
+            }
+            return localizer.message("display_param", value.substring(0, pos), value.substring(pos));
+        }
+
+        public ParsedPattern makePattern(Location loc, Annotations anno)
+                throws BuildException {
+            try {
+                return pb.makeData(dtb.createDatatype());
+            } catch (DatatypeException e) {
+                String detail = e.getMessage();
+                if (detail != null) {
+                    error("invalid_params_detail", detail, (Locator) loc);
+                } else {
+                    error("invalid_params", (Locator) loc);
+                }
+                return pb.makeError();
+            }
+        }
+
+        public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno)
+                throws BuildException {
+            try {
+                return pb.makeDataExcept(dtb.createDatatype(), (Pattern) except, (Locator) loc);
+            } catch (DatatypeException e) {
+                String detail = e.getMessage();
+                if (detail != null) {
+                    error("invalid_params_detail", detail, (Locator) loc);
+                } else {
+                    error("invalid_params", (Locator) loc);
+                }
+                return pb.makeError();
+            }
+        }
+
+        public void annotation(ParsedElementAnnotation ea) {
+        }
     }
 
-    public String getBaseUri() {
-      return vc.getBaseUri();
+    public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc)
+            throws BuildException {
+        DatatypeLibrary dl = datatypeLibraryFactory.createDatatypeLibrary(datatypeLibrary);
+        if (dl == null) {
+            error("unrecognized_datatype_library", datatypeLibrary, (Locator) loc);
+        } else {
+            try {
+                return new DataPatternBuilderImpl(dl.createDatatypeBuilder(type));
+            } catch (DatatypeException e) {
+                String detail = e.getMessage();
+                if (detail != null) {
+                    error("unsupported_datatype_detail", datatypeLibrary, type, detail, (Locator) loc);
+                } else {
+                    error("unrecognized_datatype", datatypeLibrary, type, (Locator) loc);
+                }
+            }
+        }
+        return new DummyDataPatternBuilder();
     }
 
-    public boolean isUnparsedEntity(String entityName) {
-      return vc.isUnparsedEntity(entityName);
+    public ParsedPattern makeValue(String datatypeLibrary, String type, String value, Context context, String ns,
+            Location loc, Annotations anno) throws BuildException {
+        DatatypeLibrary dl = datatypeLibraryFactory.createDatatypeLibrary(datatypeLibrary);
+        if (dl == null) {
+            error("unrecognized_datatype_library", datatypeLibrary, (Locator) loc);
+        } else {
+            try {
+                DatatypeBuilder dtb = dl.createDatatypeBuilder(type);
+                try {
+                    Datatype dt = dtb.createDatatype();
+                    Object obj = dt.createValue(value, new ValidationContextImpl(context, ns));
+                    if (obj != null) {
+                        return pb.makeValue(dt, obj);
+                    }
+                    error("invalid_value", value, (Locator) loc);
+                } catch (DatatypeException e) {
+                    String detail = e.getMessage();
+                    if (detail != null) {
+                        error("datatype_requires_param_detail", detail, (Locator) loc);
+                    } else {
+                        error("datatype_requires_param", (Locator) loc);
+                    }
+                }
+            } catch (DatatypeException e) {
+                error("unrecognized_datatype", datatypeLibrary, type, (Locator) loc);
+            }
+        }
+        return pb.makeError();
     }
 
-    public boolean isNotation(String notationName) {
-      return vc.isNotation(notationName);
-    }
-  }
+    static class GrammarImpl implements Grammar, Div, IncludedGrammar {
 
-  private class DataPatternBuilderImpl implements DataPatternBuilder {
-    private DatatypeBuilder dtb;
-    DataPatternBuilderImpl(DatatypeBuilder dtb) {
-      this.dtb = dtb;
+        private final SchemaBuilderImpl sb;
+        private final Hashtable defines;
+        private final RefPattern startRef;
+        private final Scope parent;
+
+        private GrammarImpl(SchemaBuilderImpl sb, Scope parent) {
+            this.sb = sb;
+            this.parent = parent;
+            this.defines = new Hashtable();
+            this.startRef = new RefPattern(null);
+        }
+
+        protected GrammarImpl(SchemaBuilderImpl sb, GrammarImpl g) {
+            this.sb = sb;
+            parent = g.parent;
+            startRef = g.startRef;
+            defines = g.defines;
+        }
+
+        public ParsedPattern endGrammar(Location loc, Annotations anno) throws BuildException {
+            for (Enumeration e = defines.keys();
+                    e.hasMoreElements();) {
+                String name = (String) e.nextElement();
+                RefPattern rp = (RefPattern) defines.get(name);
+                if (rp.getPattern() == null) {
+                    sb.error("reference_to_undefined", name, rp.getRefLocator());
+                    rp.setPattern(sb.pb.makeError());
+                }
+            }
+            Pattern start = startRef.getPattern();
+            if (start == null) {
+                sb.error("missing_start_element", (Locator) loc);
+                start = sb.pb.makeError();
+            }
+            return start;
+        }
+
+        public void endDiv(Location loc, Annotations anno) throws BuildException {
+            // nothing to do
+        }
+
+        public ParsedPattern endIncludedGrammar(Location loc, Annotations anno) throws BuildException {
+            return null;
+        }
+
+        public void define(String name, GrammarSection.Combine combine, ParsedPattern pattern, Location loc, Annotations anno)
+                throws BuildException {
+            define(lookup(name), combine, pattern, loc);
+        }
+
+        private void define(RefPattern rp, GrammarSection.Combine combine, ParsedPattern pattern, Location loc)
+                throws BuildException {
+            switch (rp.getReplacementStatus()) {
+                case RefPattern.REPLACEMENT_KEEP:
+                    if (combine == null) {
+                        if (rp.isCombineImplicit()) {
+                            if (rp.getName() == null) {
+                                sb.error("duplicate_start", (Locator) loc);
+                            } else {
+                                sb.error("duplicate_define", rp.getName(), (Locator) loc);
+                            }
+                        } else {
+                            rp.setCombineImplicit();
+                        }
+                    } else {
+                        byte combineType = (combine == COMBINE_CHOICE ? RefPattern.COMBINE_CHOICE : RefPattern.COMBINE_INTERLEAVE);
+                        if (rp.getCombineType() != RefPattern.COMBINE_NONE
+                                && rp.getCombineType() != combineType) {
+                            if (rp.getName() == null) {
+                                sb.error("conflict_combine_start", (Locator) loc);
+                            } else {
+                                sb.error("conflict_combine_define", rp.getName(), (Locator) loc);
+                            }
+                        }
+                        rp.setCombineType(combineType);
+                    }
+                    Pattern p = (Pattern) pattern;
+                    if (rp.getPattern() == null) {
+                        rp.setPattern(p);
+                    } else if (rp.getCombineType() == RefPattern.COMBINE_INTERLEAVE) {
+                        rp.setPattern(sb.pb.makeInterleave(rp.getPattern(), p));
+                    } else {
+                        rp.setPattern(sb.pb.makeChoice(rp.getPattern(), p));
+                    }
+                    break;
+                case RefPattern.REPLACEMENT_REQUIRE:
+                    rp.setReplacementStatus(RefPattern.REPLACEMENT_IGNORE);
+                    break;
+                case RefPattern.REPLACEMENT_IGNORE:
+                    break;
+            }
+        }
+
+        public void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException {
+        }
+
+        public void topLevelComment(CommentList comments) throws BuildException {
+        }
+
+        private RefPattern lookup(String name) {
+            if (name == START) {
+                return startRef;
+            }
+            return lookup1(name);
+        }
+
+        private RefPattern lookup1(String name) {
+            RefPattern p = (RefPattern) defines.get(name);
+            if (p == null) {
+                p = new RefPattern(name);
+                defines.put(name, p);
+            }
+            return p;
+        }
+
+        public ParsedPattern makeRef(String name, Location loc, Annotations anno) throws BuildException {
+            RefPattern p = lookup1(name);
+            if (p.getRefLocator() == null && loc != null) {
+                p.setRefLocator((Locator) loc);
+            }
+            return p;
+        }
+
+        public ParsedPattern makeParentRef(String name, Location loc, Annotations anno) throws BuildException {
+            // TODO: do this check by the caller
+            if (parent == null) {
+                sb.error("parent_ref_outside_grammar", (Locator) loc);
+                return sb.makeErrorPattern();
+            }
+            return parent.makeRef(name, loc, anno);
+        }
+
+        public Div makeDiv() {
+            return this;
+        }
+
+        public Include makeInclude() {
+            return new IncludeImpl(sb, this);
+        }
     }
 
-    public void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno)
-            throws BuildException {
-      try {
-        dtb.addParameter(name, value, new ValidationContextImpl(context, ns));
-      }
-      catch (DatatypeException e) {
-        String detail = e.getMessage();
-        int pos = e.getIndex();
-        String displayedParam;
-        if (pos == DatatypeException.UNKNOWN)
-          displayedParam = null;
-        else
-          displayedParam = displayParam(value, pos);
-        if (displayedParam != null) {
-          if (detail != null)
-            error("invalid_param_detail_display", detail, displayedParam, (Locator)loc);
-          else
-            error("invalid_param_display", displayedParam, (Locator)loc);
+    static class Override {
+
+        Override(RefPattern prp, Override next) {
+            this.prp = prp;
+            this.next = next;
         }
-        else if (detail != null)
-          error("invalid_param_detail", detail, (Locator)loc);
-        else
-          error("invalid_param", (Locator)loc);
-      }
+        RefPattern prp;
+        Override next;
+        byte replacementStatus;
     }
 
-    String displayParam(String value, int pos) {
-      if (pos < 0)
-        pos = 0;
-      else if (pos > value.length())
-        pos = value.length();
-      return localizer.message("display_param", value.substring(0, pos), value.substring(pos));
+    private static class IncludeImpl implements Include, Div {
+
+        private SchemaBuilderImpl sb;
+        private Override overrides;
+        private GrammarImpl grammar;
+
+        private IncludeImpl(SchemaBuilderImpl sb, GrammarImpl grammar) {
+            this.sb = sb;
+            this.grammar = grammar;
+        }
+
+        public void define(String name, GrammarSection.Combine combine, ParsedPattern pattern, Location loc, Annotations anno)
+                throws BuildException {
+            RefPattern rp = grammar.lookup(name);
+            overrides = new Override(rp, overrides);
+            grammar.define(rp, combine, pattern, loc);
+        }
+
+        public void endDiv(Location loc, Annotations anno) throws BuildException {
+            // nothing to do
+        }
+
+        public void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException {
+            // nothing to do
+        }
+
+        public void topLevelComment(CommentList comments) throws BuildException {
+        }
+
+        public Div makeDiv() {
+            return this;
+        }
+
+        public void endInclude(Parseable current, String uri, String ns,
+                Location loc, Annotations anno) throws BuildException {
+            for (OpenIncludes inc = sb.openIncludes;
+                    inc != null;
+                    inc = inc.parent) {
+                if (inc.uri.equals(uri)) {
+                    sb.error("recursive_include", uri, (Locator) loc);
+                    return;
+                }
+            }
+
+            for (Override o = overrides; o != null; o = o.next) {
+                o.replacementStatus = o.prp.getReplacementStatus();
+                o.prp.setReplacementStatus(RefPattern.REPLACEMENT_REQUIRE);
+            }
+            try {
+                SchemaBuilderImpl isb = new SchemaBuilderImpl(ns, uri, sb);
+                current.parseInclude(uri, isb, new GrammarImpl(isb, grammar), ns);
+                for (Override o = overrides; o != null; o = o.next) {
+                    if (o.prp.getReplacementStatus() == RefPattern.REPLACEMENT_REQUIRE) {
+                        if (o.prp.getName() == null) {
+                            sb.error("missing_start_replacement", (Locator) loc);
+                        } else {
+                            sb.error("missing_define_replacement", o.prp.getName(), (Locator) loc);
+                        }
+                    }
+                }
+            } catch (IllegalSchemaException e) {
+                sb.noteError();
+            } finally {
+                for (Override o = overrides; o != null; o = o.next) {
+                    o.prp.setReplacementStatus(o.replacementStatus);
+                }
+            }
+        }
+
+        public Include makeInclude() {
+            return null;
+        }
     }
 
-    public ParsedPattern makePattern(Location loc, Annotations anno)
-            throws BuildException {
-      try {
-        return pb.makeData(dtb.createDatatype());
-      }
-      catch (DatatypeException e) {
-        String detail = e.getMessage();
-        if (detail != null)
-          error("invalid_params_detail", detail, (Locator)loc);
-        else
-          error("invalid_params", (Locator)loc);
-        return pb.makeError();
-      }
+    public Grammar makeGrammar(Scope parent) {
+        return new GrammarImpl(this, parent);
     }
 
-    public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno)
-            throws BuildException {
-      try {
-        return pb.makeDataExcept(dtb.createDatatype(), (Pattern)except, (Locator)loc);
-      }
-      catch (DatatypeException e) {
-        String detail = e.getMessage();
-        if (detail != null)
-          error("invalid_params_detail", detail, (Locator)loc);
-        else
-          error("invalid_params", (Locator)loc);
-        return pb.makeError();
-      }
+    public ParsedPattern annotate(ParsedPattern p, Annotations anno) throws BuildException {
+        return p;
     }
 
-    public void annotation(ParsedElementAnnotation ea) {
-    }
-  }
-
-  public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc)
-          throws BuildException {
-    DatatypeLibrary dl = datatypeLibraryFactory.createDatatypeLibrary(datatypeLibrary);
-    if (dl == null)
-      error("unrecognized_datatype_library", datatypeLibrary, (Locator)loc);
-    else {
-      try {
-        return new DataPatternBuilderImpl(dl.createDatatypeBuilder(type));
-      }
-      catch (DatatypeException e) {
-        String detail = e.getMessage();
-        if (detail != null)
-          error("unsupported_datatype_detail", datatypeLibrary, type, detail, (Locator)loc);
-        else
-          error("unrecognized_datatype", datatypeLibrary, type, (Locator)loc);
-      }
-    }
-    return new DummyDataPatternBuilder();
-  }
-
-  public ParsedPattern makeValue(String datatypeLibrary, String type, String value, Context context, String ns,
-                                 Location loc, Annotations anno) throws BuildException {
-    DatatypeLibrary dl = datatypeLibraryFactory.createDatatypeLibrary(datatypeLibrary);
-    if (dl == null)
-      error("unrecognized_datatype_library", datatypeLibrary, (Locator)loc);
-    else {
-      try {
-        DatatypeBuilder dtb = dl.createDatatypeBuilder(type);
-        try {
-          Datatype dt = dtb.createDatatype();
-          Object obj = dt.createValue(value, new ValidationContextImpl(context, ns));
-          if (obj != null)
-            return pb.makeValue(dt, obj);
-          error("invalid_value", value, (Locator)loc);
-        }
-        catch (DatatypeException e) {
-          String detail = e.getMessage();
-          if (detail != null)
-            error("datatype_requires_param_detail", detail, (Locator)loc);
-          else
-            error("datatype_requires_param", (Locator)loc);
-        }
-      }
-      catch (DatatypeException e) {
-        error("unrecognized_datatype", datatypeLibrary, type, (Locator)loc);
-      }
-    }
-    return pb.makeError();
-  }
-
-  static class GrammarImpl implements Grammar, Div, IncludedGrammar {
-    private final SchemaBuilderImpl sb;
-    private final Hashtable defines;
-    private final RefPattern startRef;
-    private final Scope parent;
-
-    private GrammarImpl(SchemaBuilderImpl sb, Scope parent) {
-      this.sb = sb;
-      this.parent = parent;
-      this.defines = new Hashtable();
-      this.startRef = new RefPattern(null);
+    public ParsedPattern annotateAfter(ParsedPattern p, ParsedElementAnnotation e) throws BuildException {
+        return p;
     }
 
-    protected GrammarImpl(SchemaBuilderImpl sb, GrammarImpl g) {
-      this.sb = sb;
-      parent = g.parent;
-      startRef = g.startRef;
-      defines = g.defines;
+    public ParsedPattern commentAfter(ParsedPattern p, CommentList comments) throws BuildException {
+        return p;
     }
 
-    public ParsedPattern endGrammar(Location loc, Annotations anno) throws BuildException {
-      for (Enumeration e = defines.keys();
-           e.hasMoreElements();) {
-        String name = (String)e.nextElement();
-        RefPattern rp = (RefPattern)defines.get(name);
-        if (rp.getPattern() == null) {
-          sb.error("reference_to_undefined", name, rp.getRefLocator());
-          rp.setPattern(sb.pb.makeError());
+    public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
+            Location loc, Annotations anno)
+            throws BuildException {
+        for (OpenIncludes inc = openIncludes;
+                inc != null;
+                inc = inc.parent) {
+            if (inc.uri.equals(uri)) {
+                error("recursive_include", uri, (Locator) loc);
+                return pb.makeError();
+            }
         }
-      }
-      Pattern start = startRef.getPattern();
-      if (start == null) {
-        sb.error("missing_start_element", (Locator)loc);
-        start = sb.pb.makeError();
-      }
-      return start;
+        try {
+            return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns);
+        } catch (IllegalSchemaException e) {
+            noteError();
+            return pb.makeError();
+        }
     }
 
-    public void endDiv(Location loc, Annotations anno) throws BuildException {
-      // nothing to do
+    public Location makeLocation(String systemId, int lineNumber, int columnNumber) {
+        return new LocatorImpl(systemId, lineNumber, columnNumber);
     }
 
-    public ParsedPattern endIncludedGrammar(Location loc, Annotations anno) throws BuildException {
+    public Annotations makeAnnotations(CommentList comments, Context context) {
+        return this;
+    }
+
+    public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix,
+            Location loc, CommentList comments, Context context) {
+        return this;
+    }
+
+    public CommentList makeCommentList() {
+        return this;
+    }
+
+    public void addComment(String value, Location loc) throws BuildException {
+    }
+
+    public void addAttribute(String ns, String localName, String prefix, String value, Location loc) {
+        // nothing needed
+    }
+
+    public void addElement(ParsedElementAnnotation ea) {
+        // nothing needed
+    }
+
+    public void addComment(CommentList comments) throws BuildException {
+        // nothing needed
+    }
+
+    public void addLeadingComment(CommentList comments) throws BuildException {
+        // nothing needed
+    }
+
+    public ParsedElementAnnotation makeElementAnnotation() {
         return null;
     }
 
-    public void define(String name, GrammarSection.Combine combine, ParsedPattern pattern, Location loc, Annotations anno)
-            throws BuildException {
-      define(lookup(name), combine, pattern, loc);
+    public void addText(String value, Location loc, CommentList comments) throws BuildException {
     }
 
-    private void define(RefPattern rp, GrammarSection.Combine combine, ParsedPattern pattern, Location loc)
-            throws BuildException {
-      switch (rp.getReplacementStatus()) {
-      case RefPattern.REPLACEMENT_KEEP:
-        if (combine == null) {
-          if (rp.isCombineImplicit()) {
-            if (rp.getName() == null)
-              sb.error("duplicate_start", (Locator)loc);
-            else
-              sb.error("duplicate_define", rp.getName(), (Locator)loc);
-          }
-          else
-            rp.setCombineImplicit();
-        }
-        else {
-          byte combineType = (combine == COMBINE_CHOICE ? RefPattern.COMBINE_CHOICE : RefPattern.COMBINE_INTERLEAVE);
-          if (rp.getCombineType() != RefPattern.COMBINE_NONE
-              && rp.getCombineType() != combineType) {
-            if (rp.getName() == null)
-              sb.error("conflict_combine_start", (Locator)loc);
-            else
-              sb.error("conflict_combine_define", rp.getName(), (Locator)loc);
-          }
-          rp.setCombineType(combineType);
-        }
-        Pattern p = (Pattern)pattern;
-        if (rp.getPattern() == null)
-          rp.setPattern(p);
-        else if (rp.getCombineType() == RefPattern.COMBINE_INTERLEAVE)
-          rp.setPattern(sb.pb.makeInterleave(rp.getPattern(), p));
-        else
-          rp.setPattern(sb.pb.makeChoice(rp.getPattern(), p));
-        break;
-      case RefPattern.REPLACEMENT_REQUIRE:
-        rp.setReplacementStatus(RefPattern.REPLACEMENT_IGNORE);
-        break;
-      case RefPattern.REPLACEMENT_IGNORE:
-        break;
-      }
+    public boolean usesComments() {
+        return false;
     }
 
-    public void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException {
+    private void error(SAXParseException message) throws BuildException {
+        noteError();
+        try {
+            if (eh != null) {
+                eh.error(message);
+            }
+        } catch (SAXException e) {
+            throw new BuildException(e);
+        }
     }
 
-    public void topLevelComment(CommentList comments) throws BuildException {
+    private void error(String key, Locator loc) throws BuildException {
+        error(new SAXParseException(localizer.message(key), loc));
     }
 
-    private RefPattern lookup(String name) {
-      if (name == START)
-        return startRef;
-      return lookup1(name);
+    private void error(String key, String arg, Locator loc) throws BuildException {
+        error(new SAXParseException(localizer.message(key, arg), loc));
     }
 
-    private RefPattern lookup1(String name) {
-      RefPattern p = (RefPattern)defines.get(name);
-      if (p == null) {
-        p = new RefPattern(name);
-        defines.put(name, p);
-      }
-      return p;
+    private void error(String key, String arg1, String arg2, Locator loc) throws BuildException {
+        error(new SAXParseException(localizer.message(key, arg1, arg2), loc));
     }
 
-    public ParsedPattern makeRef(String name, Location loc, Annotations anno) throws BuildException {
-      RefPattern p = lookup1(name);
-      if (p.getRefLocator() == null && loc != null)
-        p.setRefLocator((Locator)loc);
-      return p;
+    private void error(String key, String arg1, String arg2, String arg3, Locator loc) throws BuildException {
+        error(new SAXParseException(localizer.message(key, new Object[]{arg1, arg2, arg3}), loc));
     }
 
-    public ParsedPattern makeParentRef(String name, Location loc, Annotations anno) throws BuildException {
-        // TODO: do this check by the caller
-      if (parent == null) {
-        sb.error("parent_ref_outside_grammar", (Locator)loc);
-        return sb.makeErrorPattern();
-      }
-      return parent.makeRef(name, loc, anno);
+    private void noteError() {
+        if (!hadError && parent != null) {
+            parent.noteError();
+        }
+        hadError = true;
     }
-
-    public Div makeDiv() {
-      return this;
-    }
-
-    public Include makeInclude() {
-      return new IncludeImpl(sb, this);
-    }
-
-  }
-
-
-  static class Override {
-    Override(RefPattern prp, Override next) {
-      this.prp = prp;
-      this.next = next;
-    }
-
-    RefPattern prp;
-    Override next;
-    byte replacementStatus;
-  }
-
-
-  private static class IncludeImpl implements Include, Div {
-    private SchemaBuilderImpl sb;
-    private Override overrides;
-    private GrammarImpl grammar;
-
-    private IncludeImpl(SchemaBuilderImpl sb, GrammarImpl grammar) {
-      this.sb = sb;
-      this.grammar = grammar;
-    }
-
-    public void define(String name, GrammarSection.Combine combine, ParsedPattern pattern, Location loc, Annotations anno)
-            throws BuildException {
-      RefPattern rp = grammar.lookup(name);
-      overrides = new Override(rp, overrides);
-      grammar.define(rp, combine, pattern, loc);
-    }
-
-    public void endDiv(Location loc, Annotations anno) throws BuildException {
-      // nothing to do
-    }
-
-    public void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException {
-      // nothing to do
-    }
-
-    public void topLevelComment(CommentList comments) throws BuildException {
-    }
-
-    public Div makeDiv() {
-      return this;
-    }
-
-    public void endInclude(Parseable current,String uri, String ns,
-                           Location loc, Annotations anno) throws BuildException {
-      for (OpenIncludes inc = sb.openIncludes;
-           inc != null;
-           inc = inc.parent) {
-        if (inc.uri.equals(uri)) {
-          sb.error("recursive_include", uri, (Locator)loc);
-          return;
-        }
-      }
-
-      for (Override o = overrides; o != null; o = o.next) {
-        o.replacementStatus = o.prp.getReplacementStatus();
-        o.prp.setReplacementStatus(RefPattern.REPLACEMENT_REQUIRE);
-      }
-      try {
-        SchemaBuilderImpl isb = new SchemaBuilderImpl(ns, uri, sb);
-        current.parseInclude(uri, isb, new GrammarImpl(isb, grammar), ns);
-        for (Override o = overrides; o != null; o = o.next) {
-          if (o.prp.getReplacementStatus() == RefPattern.REPLACEMENT_REQUIRE) {
-            if (o.prp.getName() == null)
-              sb.error("missing_start_replacement", (Locator)loc);
-            else
-              sb.error("missing_define_replacement", o.prp.getName(), (Locator)loc);
-          }
-        }
-      }
-      catch (IllegalSchemaException e) {
-        sb.noteError();
-      }
-      finally {
-        for (Override o = overrides; o != null; o = o.next)
-          o.prp.setReplacementStatus(o.replacementStatus);
-      }
-    }
-
-    public Include makeInclude() {
-      return null;
-    }
-  }
-
-  public Grammar makeGrammar(Scope parent) {
-    return new GrammarImpl(this, parent);
-  }
-
-  public ParsedPattern annotate(ParsedPattern p, Annotations anno) throws BuildException {
-    return p;
-  }
-
-
-  public ParsedPattern annotateAfter(ParsedPattern p, ParsedElementAnnotation e) throws BuildException {
-    return p;
-  }
-
-  public ParsedPattern commentAfter(ParsedPattern p, CommentList comments) throws BuildException {
-    return p;
-  }
-
-
-  public ParsedPattern makeExternalRef(Parseable current, String uri, String ns, Scope scope,
-                                       Location loc, Annotations anno)
-          throws BuildException {
-    for (OpenIncludes inc = openIncludes;
-         inc != null;
-         inc = inc.parent) {
-      if (inc.uri.equals(uri)) {
-        error("recursive_include", uri, (Locator)loc);
-        return pb.makeError();
-      }
-    }
-    try {
-      return current.parseExternal(uri, new SchemaBuilderImpl(ns, uri, this), scope, ns );
-    }
-    catch (IllegalSchemaException e) {
-      noteError();
-      return pb.makeError();
-    }
-  }
-
-
-
-  public Location makeLocation(String systemId, int lineNumber, int columnNumber) {
-    return new LocatorImpl(systemId, lineNumber, columnNumber);
-  }
-
-  public Annotations makeAnnotations(CommentList comments, Context context) {
-    return this;
-  }
-
-  public ElementAnnotationBuilder makeElementAnnotationBuilder(String ns, String localName, String prefix,
-                                                               Location loc, CommentList comments, Context context) {
-    return this;
-  }
-
-  public CommentList makeCommentList() {
-    return this;
-  }
-
-  public void addComment(String value, Location loc) throws BuildException {
-  }
-
-  public void addAttribute(String ns, String localName, String prefix, String value, Location loc) {
-    // nothing needed
-  }
-
-  public void addElement(ParsedElementAnnotation ea) {
-    // nothing needed
-  }
-
-  public void addComment(CommentList comments) throws BuildException {
-    // nothing needed
-  }
-
-  public void addLeadingComment(CommentList comments) throws BuildException {
-    // nothing needed
-  }
-
-  public ParsedElementAnnotation makeElementAnnotation() {
-    return null;
-  }
-
-  public void addText(String value, Location loc, CommentList comments) throws BuildException {
-  }
-
-  public boolean usesComments() {
-    return false;
-  }
-
-  private void error(SAXParseException message) throws BuildException {
-    noteError();
-    try {
-      if (eh != null)
-        eh.error(message);
-    }
-    catch (SAXException e) {
-      throw new BuildException(e);
-    }
-  }
-
-  private void warning(SAXParseException message) throws BuildException {
-    try {
-      if (eh != null)
-        eh.warning(message);
-    }
-    catch (SAXException e) {
-      throw new BuildException(e);
-    }
-  }
-
-  private void error(String key, Locator loc) throws BuildException {
-    error(new SAXParseException(localizer.message(key), loc));
-  }
-
-  private void error(String key, String arg, Locator loc) throws BuildException {
-    error(new SAXParseException(localizer.message(key, arg), loc));
-  }
-
-  private void error(String key, String arg1, String arg2, Locator loc) throws BuildException {
-    error(new SAXParseException(localizer.message(key, arg1, arg2), loc));
-  }
-
-  private void error(String key, String arg1, String arg2, String arg3, Locator loc) throws BuildException {
-    error(new SAXParseException(localizer.message(key, new Object[]{arg1, arg2, arg3}), loc));
-  }
-  private void noteError() {
-    if (!hadError && parent != null)
-      parent.noteError();
-    hadError = true;
-  }
-
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DDataPattern.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DDataPattern.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DPattern.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DPattern.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -55,9 +55,9 @@
  * @author Kohsuke Kawaguchi (kk@kohsuke.org)
  */
 public abstract class DPattern implements ParsedPattern {
+
     Locator location;
     DAnnotation annotation;
-
     /**
      * Used to chain the child patterns in a doubly-linked list.
      */
@@ -74,12 +74,12 @@
     /**
      * Returns the annotation associated with it.
      *
-     * @return
-     *      may be empty, but never be null.
+     * @return may be empty, but never be null.
      */
     public DAnnotation getAnnotation() {
-        if(annotation==null)
+        if (annotation == null) {
             return DAnnotation.EMPTY;
+        }
         return annotation;
     }
 
@@ -90,7 +90,7 @@
      */
     public abstract boolean isNullable();
 
-    public abstract <V> V accept( DPatternVisitor<V> visitor );
+    public abstract <V> V accept(DPatternVisitor<V> visitor);
 
     /**
      * Creates a {@link Parseable} object that reparses this pattern.
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DXMLPrinter.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DXMLPrinter.java	Fri Oct 04 16:21:34 2013 +0100
@@ -110,7 +110,11 @@
             visitor.on(grammar);
             visitor.endDocument();
         } catch (XMLWriterException e) {
-            throw (XMLStreamException) e.getCause();
+            if (e.getCause() instanceof XMLStreamException) {
+                throw (XMLStreamException) e.getCause();
+            } else {
+                throw new XMLStreamException(e);
+            }
         }
     }
 
@@ -123,7 +127,11 @@
         try {
             pattern.accept(visitor);
         } catch (XMLWriterException e) {
-            throw (XMLStreamException) e.getCause();
+            if (e.getCause() instanceof XMLStreamException) {
+                throw (XMLStreamException) e.getCause();
+            } else {
+                throw new XMLStreamException(e);
+            }
         }
     }
 
@@ -136,7 +144,11 @@
         try {
             nc.accept(ncVisitor);
         } catch (XMLWriterException e) {
-            throw (XMLStreamException) e.getCause();
+            if (e.getCause() instanceof XMLStreamException) {
+                throw (XMLStreamException) e.getCause();
+            } else {
+                throw new XMLStreamException(e);
+            }
         }
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DataPatternBuilderImpl.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DataPatternBuilderImpl.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -82,8 +82,9 @@
 
     public ParsedPattern makePattern(ParsedPattern except, Location loc, Annotations anno) throws BuildException {
         p.except = (DPattern)except;
-        if(anno!=null)
+        if (anno!=null) {
             p.annotation = ((Annotation)anno).getResult();
+        }
         return p;
     }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/GrammarBuilderImpl.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/GrammarBuilderImpl.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -45,6 +45,9 @@
  */
 package com.sun.xml.internal.rngom.digested;
 
+import java.util.ArrayList;
+import java.util.List;
+
 import com.sun.xml.internal.rngom.ast.builder.Annotations;
 import com.sun.xml.internal.rngom.ast.builder.BuildException;
 import com.sun.xml.internal.rngom.ast.builder.CommentList;
@@ -58,9 +61,6 @@
 import com.sun.xml.internal.rngom.ast.util.LocatorImpl;
 import org.w3c.dom.Element;
 
-import java.util.ArrayList;
-import java.util.List;
-
 /**
  * @author Kohsuke Kawaguchi (kk@kohsuke.org)
  */
@@ -85,12 +85,11 @@
     }
 
     public ParsedPattern endGrammar(Location loc, Annotations anno) throws BuildException {
-        if(anno!=null)
-            grammar.annotation = ((Annotation)anno).getResult();
-        if(additionalElementAnnotations!=null) {
-            if(grammar.annotation==null)
-                grammar.annotation = new DAnnotation();
-            grammar.annotation.contents.addAll(additionalElementAnnotations);
+        // Harshit : Fixed possible NPE and issue in handling of annotations
+        if (anno != null) {
+            if (grammar.annotation != null) {
+                grammar.annotation.contents.addAll(((Annotation) anno).getResult().contents);
+            }
         }
         return grammar;
     }
@@ -99,21 +98,28 @@
     }
 
     public void define(String name, Combine combine, ParsedPattern pattern, Location loc, Annotations anno) throws BuildException {
-        if(name==START)
+        if(name==START) {
             grammar.start = (DPattern)pattern;
-        else {
+        } else {
             // TODO: handle combine
             DDefine d = grammar.getOrAdd(name);
             d.setPattern( (DPattern) pattern );
-            if(anno!=null)
+            if (anno!=null) {
                 d.annotation = ((Annotation)anno).getResult();
+            }
         }
     }
 
     public void topLevelAnnotation(ParsedElementAnnotation ea) throws BuildException {
-        if(additionalElementAnnotations==null)
+        // Harshit : Fixed issue in handling of annotations
+        if (additionalElementAnnotations==null) {
             additionalElementAnnotations = new ArrayList<Element>();
+        }
         additionalElementAnnotations.add(((ElementWrapper)ea).element);
+        if (grammar.annotation==null) {
+            grammar.annotation = new DAnnotation();
+        }
+        grammar.annotation.contents.addAll(additionalElementAnnotations);
     }
 
     public void topLevelComment(CommentList comments) throws BuildException {
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/AnyNameClass.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/AnyNameClass.java	Fri Oct 04 16:21:34 2013 +0100
@@ -77,7 +77,4 @@
         return true;
     }
 
-    private static Object readReplace() {
-        return NameClass.ANY;
-    }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/NameClassBuilderImpl.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/NameClassBuilderImpl.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -65,17 +65,25 @@
     A extends Annotations<E,L,CL>,
     CL extends CommentList<L>> implements NameClassBuilder<NameClass,E,L,A,CL> {
 
+    @Override
     public NameClass makeChoice(List<NameClass> nameClasses, L loc, A anno) {
-      NameClass result = nameClasses.get(0);
-      for (int i = 1; i < nameClasses.size(); i++)
-        result = new ChoiceNameClass(result, nameClasses.get(i));
-      return result;
+        NameClass result = nameClasses.get(0);
+        for (int i = 1; i < nameClasses.size(); i++) {
+            result = new ChoiceNameClass(result, nameClasses.get(i));
+        }
+        return result;
     }
 
+    @Override
     public NameClass makeName(String ns, String localName, String prefix, L loc, A anno) {
-      return new SimpleNameClass(ns, localName);
+        if (prefix == null) {
+            return new SimpleNameClass(ns, localName);
+        } else {
+            return new SimpleNameClass(ns, localName, prefix);
+        }
     }
 
+    @Override
     public NameClass makeNsName(String ns, L loc, A anno) {
       return new NsNameClass(ns);
     }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/SimpleNameClass.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/SimpleNameClass.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -55,14 +55,20 @@
         this.name = name;
     }
 
-    public SimpleNameClass( String nsUri, String localPart ) {
-        this( new QName(nsUri,localPart) );
+    public SimpleNameClass(String nsUri, String localPart) {
+        this(new QName(nsUri, localPart));
     }
 
+    public SimpleNameClass(String nsUri, String localPart, String prefix) {
+        this(new QName(nsUri, localPart, prefix));
+    }
+
+    @Override
     public boolean contains(QName name) {
         return this.name.equals(name);
     }
 
+    @Override
     public int containsSpecificity(QName name) {
         return contains(name) ? SPECIFICITY_NAME : SPECIFICITY_NONE;
     }
@@ -74,16 +80,19 @@
 
     @Override
     public boolean equals(Object obj) {
-        if (obj == null || !(obj instanceof SimpleNameClass))
+        if (obj == null || !(obj instanceof SimpleNameClass)) {
             return false;
+        }
         SimpleNameClass other = (SimpleNameClass) obj;
         return name.equals(other.name);
     }
 
+    @Override
     public <V> V accept(NameClassVisitor<V> visitor) {
         return visitor.visitName(name);
     }
 
+    @Override
     public boolean isOpen() {
         return false;
     }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/UCode_UCodeESC_CharStream.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/UCode_UCodeESC_CharStream.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -45,7 +45,7 @@
  */
 /* Generated By:JavaCC: Do not edit this line. UCode_UCodeESC_CharStream.java Version 0.7pre6 */
 /* The previous line keeps JavaCC quiet. In fact, the JavaCC generated file
-   has been edited to fix some bugs. */
+ has been edited to fix some bugs. */
 package com.sun.xml.internal.rngom.parse.compact;
 
 import com.sun.xml.internal.rngom.util.Utf16;
@@ -58,537 +58,537 @@
  * contain 16-bit unicode characters.
  */
 public final class UCode_UCodeESC_CharStream {
-  public static final boolean staticFlag = false;
 
-  static final int hexval(char c) {
-    switch (c) {
-    case '0':
-      return 0;
-    case '1':
-      return 1;
-    case '2':
-      return 2;
-    case '3':
-      return 3;
-    case '4':
-      return 4;
-    case '5':
-      return 5;
-    case '6':
-      return 6;
-    case '7':
-      return 7;
-    case '8':
-      return 8;
-    case '9':
-      return 9;
+    public static final boolean staticFlag = false;
 
-    case 'a':
-    case 'A':
-      return 10;
-    case 'b':
-    case 'B':
-      return 11;
-    case 'c':
-    case 'C':
-      return 12;
-    case 'd':
-    case 'D':
-      return 13;
-    case 'e':
-    case 'E':
-      return 14;
-    case 'f':
-    case 'F':
-      return 15;
+    static final int hexval(char c) {
+        switch (c) {
+            case '0':
+                return 0;
+            case '1':
+                return 1;
+            case '2':
+                return 2;
+            case '3':
+                return 3;
+            case '4':
+                return 4;
+            case '5':
+                return 5;
+            case '6':
+                return 6;
+            case '7':
+                return 7;
+            case '8':
+                return 8;
+            case '9':
+                return 9;
+
+            case 'a':
+            case 'A':
+                return 10;
+            case 'b':
+            case 'B':
+                return 11;
+            case 'c':
+            case 'C':
+                return 12;
+            case 'd':
+            case 'D':
+                return 13;
+            case 'e':
+            case 'E':
+                return 14;
+            case 'f':
+            case 'F':
+                return 15;
+        }
+        return -1;
     }
-    return -1;
-  }
+    public int bufpos = -1;
+    int bufsize;
+    int available;
+    int tokenBegin;
+    private int bufline[];
+    private int bufcolumn[];
+    private int column = 0;
+    private int line = 1;
+    private java.io.Reader inputStream;
+    private boolean closed = false;
+    private boolean prevCharIsLF = false;
+    private char[] nextCharBuf;
+    private char[] buffer;
+    private int maxNextCharInd = 0;
+    private int nextCharInd = -1;
+    private int inBuf = 0;
 
-  public int bufpos = -1;
-  int bufsize;
-  int available;
-  int tokenBegin;
-  private int bufline[];
-  private int bufcolumn[];
+    private final void ExpandBuff(boolean wrapAround) {
+        char[] newbuffer = new char[bufsize + 2048];
+        int newbufline[] = new int[bufsize + 2048];
+        int newbufcolumn[] = new int[bufsize + 2048];
 
-  private int column = 0;
-  private int line = 1;
+        if (wrapAround) {
+            System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+            System.arraycopy(buffer, 0, newbuffer,
+                    bufsize - tokenBegin, bufpos);
+            buffer = newbuffer;
 
-  private java.io.Reader inputStream;
-  private boolean closed = false;
+            System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+            System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+            bufline = newbufline;
 
-  private boolean prevCharIsLF = false;
+            System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+            System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
+            bufcolumn = newbufcolumn;
 
-  private char[] nextCharBuf;
-  private char[] buffer;
-  private int maxNextCharInd = 0;
-  private int nextCharInd = -1;
-  private int inBuf = 0;
+            bufpos += (bufsize - tokenBegin);
+        } else {
+            System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
+            buffer = newbuffer;
 
-  private final void ExpandBuff(boolean wrapAround) {
-    char[] newbuffer = new char[bufsize + 2048];
-    int newbufline[] = new int[bufsize + 2048];
-    int newbufcolumn[] = new int[bufsize + 2048];
+            System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+            bufline = newbufline;
 
-    if (wrapAround) {
-      System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-      System.arraycopy(buffer, 0, newbuffer,
-                       bufsize - tokenBegin, bufpos);
-      buffer = newbuffer;
+            System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+            bufcolumn = newbufcolumn;
 
-      System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
-      System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
-      bufline = newbufline;
+            bufpos -= tokenBegin;
+        }
 
-      System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
-      System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
-      bufcolumn = newbufcolumn;
-
-      bufpos += (bufsize - tokenBegin);
-    }
-    else {
-      System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-      buffer = newbuffer;
-
-      System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
-      bufline = newbufline;
-
-      System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
-      bufcolumn = newbufcolumn;
-
-      bufpos -= tokenBegin;
+        available = (bufsize += 2048);
+        tokenBegin = 0;
     }
 
-    available = (bufsize += 2048);
-    tokenBegin = 0;
-  }
+    private final void FillBuff() throws EOFException {
+        int i;
+        if (maxNextCharInd == 4096) {
+            maxNextCharInd = nextCharInd = 0;
+        }
 
-  private final void FillBuff() throws EOFException {
-    int i;
-    if (maxNextCharInd == 4096)
-      maxNextCharInd = nextCharInd = 0;
-
-    if (closed)
-      throw new EOFException();
-    try {
-      if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) {
-        closed = true;
-        inputStream.close();
-        throw new EOFException();
-      }
-      else
-        maxNextCharInd += i;
-    }
-    catch (IOException e) {
-      throw new BuildException(e);
-    }
-  }
-
-  private final char ReadChar() throws EOFException {
-    if (++nextCharInd >= maxNextCharInd)
-      FillBuff();
-
-    return nextCharBuf[nextCharInd];
-  }
-
-  private final char PeekChar() throws EOFException {
-    char c = ReadChar();
-    --nextCharInd;
-    return c;
-  }
-
-  public final char BeginToken() throws EOFException {
-    if (inBuf > 0) {
-      --inBuf;
-      return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0)
-              : ++bufpos];
+        if (closed) {
+            throw new EOFException();
+        }
+        try {
+            if ((i = inputStream.read(nextCharBuf, maxNextCharInd, 4096 - maxNextCharInd)) == -1) {
+                closed = true;
+                inputStream.close();
+                throw new EOFException();
+            } else {
+                maxNextCharInd += i;
+            }
+        } catch (IOException e) {
+            throw new BuildException(e);
+        }
     }
 
-    tokenBegin = 0;
-    bufpos = -1;
+    private final char ReadChar() throws EOFException {
+        if (++nextCharInd >= maxNextCharInd) {
+            FillBuff();
+        }
 
-    return readChar();
-  }
-
-  private final void AdjustBuffSize() {
-    if (available == bufsize) {
-      if (tokenBegin > 2048) {
-        bufpos = 0;
-        available = tokenBegin;
-      }
-      else
-        ExpandBuff(false);
-    }
-    else if (available > tokenBegin)
-      available = bufsize;
-    else if ((tokenBegin - available) < 2048)
-      ExpandBuff(true);
-    else
-      available = tokenBegin;
-  }
-
-  private final void UpdateLineColumn(char c) {
-    column++;
-
-    if (prevCharIsLF) {
-      prevCharIsLF = false;
-      line += (column = 1);
+        return nextCharBuf[nextCharInd];
     }
 
-    switch (c) {
-    case NEWLINE_MARKER:
-      prevCharIsLF = true;
-      break;
-    case '\t':
-      column--;
-      column += (8 - (column & 07));
-      break;
-    default :
-      break;
+    private final char PeekChar() throws EOFException {
+        char c = ReadChar();
+        --nextCharInd;
+        return c;
     }
 
-    bufline[bufpos] = line;
-    bufcolumn[bufpos] = column;
-  }
+    public final char BeginToken() throws EOFException {
+        if (inBuf > 0) {
+            --inBuf;
+            return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0)
+                    : ++bufpos];
+        }
 
-  private final char NEWLINE_MARKER = '\u0000';
+        tokenBegin = 0;
+        bufpos = -1;
 
-  public final char readChar() throws EOFException {
-    if (inBuf > 0) {
-      --inBuf;
-      return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
+        return readChar();
     }
 
-    char c;
-    try {
-      c = ReadChar();
-      switch (c) {
-      case '\r':
-        c = NEWLINE_MARKER;
-        try {
-          if (PeekChar() == '\n')
-            ReadChar();
+    private final void AdjustBuffSize() {
+        if (available == bufsize) {
+            if (tokenBegin > 2048) {
+                bufpos = 0;
+                available = tokenBegin;
+            } else {
+                ExpandBuff(false);
+            }
+        } else if (available > tokenBegin) {
+            available = bufsize;
+        } else if ((tokenBegin - available) < 2048) {
+            ExpandBuff(true);
+        } else {
+            available = tokenBegin;
         }
-        catch (EOFException e) {
+    }
+
+    private final void UpdateLineColumn(char c) {
+        column++;
+
+        if (prevCharIsLF) {
+            prevCharIsLF = false;
+            line += (column = 1);
         }
-        break;
-      case '\n':
-        c = NEWLINE_MARKER;
-        break;
-      case '\t':
-        break;
-      default:
-        if (c >= 0x20) {
-          if (Utf16.isSurrogate(c)) {
-            if (Utf16.isSurrogate2(c))
-              throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 1);
-            if (++bufpos == available)
-              AdjustBuffSize();
-            buffer[bufpos] = c;
-            // UpdateLineColumn(c);
-            try {
-              c = ReadChar();
-            }
-            catch (EOFException e) {
-              throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 1);
-            }
-            if (!Utf16.isSurrogate2(c))
-              throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 2);
-          }
-          break;
+
+        switch (c) {
+            case NEWLINE_MARKER:
+                prevCharIsLF = true;
+                break;
+            case '\t':
+                column--;
+                column += (8 - (column & 07));
+                break;
+            default:
+                break;
         }
-        // fall through
-      case '\uFFFE':
-      case '\uFFFF':
-        throw new EscapeSyntaxException("illegal_char_code", line, column + 1);
-      }
-    }
-    catch (EOFException e) {
-      if (bufpos == -1) {
-        if (++bufpos == available)
-          AdjustBuffSize();
+
         bufline[bufpos] = line;
         bufcolumn[bufpos] = column;
-      }
-      throw e;
     }
-    if (++bufpos == available)
-      AdjustBuffSize();
-    buffer[bufpos] = c;
-    UpdateLineColumn(c);
-    try {
-      if (c != '\\' || PeekChar() != 'x')
-        return c;
-    }
-    catch (EOFException e) {
-      return c;
+    private static final char NEWLINE_MARKER = '\u0000';
+
+    public final char readChar() throws EOFException {
+        if (inBuf > 0) {
+            --inBuf;
+            return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
+        }
+
+        char c;
+        try {
+            c = ReadChar();
+            switch (c) {
+                case '\r':
+                    c = NEWLINE_MARKER;
+                    try {
+                        if (PeekChar() == '\n') {
+                            ReadChar();
+                        }
+                    } catch (EOFException e) {
+                    }
+                    break;
+                case '\n':
+                    c = NEWLINE_MARKER;
+                    break;
+                case '\t':
+                    break;
+                default:
+                    if (c >= 0x20) {
+                        if (Utf16.isSurrogate(c)) {
+                            if (Utf16.isSurrogate2(c)) {
+                                throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 1);
+                            }
+                            if (++bufpos == available) {
+                                AdjustBuffSize();
+                            }
+                            buffer[bufpos] = c;
+                            // UpdateLineColumn(c);
+                            try {
+                                c = ReadChar();
+                            } catch (EOFException e) {
+                                throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 1);
+                            }
+                            if (!Utf16.isSurrogate2(c)) {
+                                throw new EscapeSyntaxException("illegal_surrogate_pair", line, column + 2);
+                            }
+                        }
+                        break;
+                    }
+                // fall through
+                case '\uFFFE':
+                case '\uFFFF':
+                    throw new EscapeSyntaxException("illegal_char_code", line, column + 1);
+            }
+        } catch (EOFException e) {
+            if (bufpos == -1) {
+                if (++bufpos == available) {
+                    AdjustBuffSize();
+                }
+                bufline[bufpos] = line;
+                bufcolumn[bufpos] = column;
+            }
+            throw e;
+        }
+        if (++bufpos == available) {
+            AdjustBuffSize();
+        }
+        buffer[bufpos] = c;
+        UpdateLineColumn(c);
+        try {
+            if (c != '\\' || PeekChar() != 'x') {
+                return c;
+            }
+        } catch (EOFException e) {
+            return c;
+        }
+
+        int xCnt = 1;
+        for (;;) {
+            ReadChar();
+            if (++bufpos == available) {
+                AdjustBuffSize();
+            }
+            buffer[bufpos] = 'x';
+            UpdateLineColumn('x');
+            try {
+                c = PeekChar();
+            } catch (EOFException e) {
+                backup(xCnt);
+                return '\\';
+            }
+            if (c == '{') {
+                ReadChar();
+                column++;
+                // backup past the 'x's
+                bufpos -= xCnt;
+                if (bufpos < 0) {
+                    bufpos += bufsize;
+                }
+                break;
+            }
+            if (c != 'x') {
+                backup(xCnt);
+                return '\\';
+            }
+            xCnt++;
+        }
+        try {
+            int scalarValue = hexval(ReadChar());
+            column++;
+            if (scalarValue < 0) {
+                throw new EscapeSyntaxException("illegal_hex_digit", line, column);
+            }
+            while ((c = ReadChar()) != '}') {
+                column++;
+                int n = hexval(c);
+                if (n < 0) {
+                    throw new EscapeSyntaxException("illegal_hex_digit", line, column);
+                }
+                scalarValue <<= 4;
+                scalarValue |= n;
+                if (scalarValue >= 0x110000) {
+                    throw new EscapeSyntaxException("char_code_too_big", line, column);
+                }
+            }
+            column++; // for the '}'
+            if (scalarValue <= 0xFFFF) {
+                c = (char) scalarValue;
+                switch (c) {
+                    case '\n':
+                    case '\r':
+                    case '\t':
+                        break;
+                    default:
+                        if (c >= 0x20 && !Utf16.isSurrogate(c)) {
+                            break;
+                        }
+                    // fall through
+                    case '\uFFFE':
+                    case '\uFFFF':
+                        throw new EscapeSyntaxException("illegal_char_code_ref", line, column);
+                }
+                buffer[bufpos] = c;
+                return c;
+            }
+            c = Utf16.surrogate1(scalarValue);
+            buffer[bufpos] = c;
+            int bufpos1 = bufpos;
+            if (++bufpos == bufsize) {
+                bufpos = 0;
+            }
+            buffer[bufpos] = Utf16.surrogate2(scalarValue);
+            bufline[bufpos] = bufline[bufpos1];
+            bufcolumn[bufpos] = bufcolumn[bufpos1];
+            backup(1);
+            return c;
+        } catch (EOFException e) {
+            throw new EscapeSyntaxException("incomplete_escape", line, column);
+        }
     }
 
-    int xCnt = 1;
-    for (;;) {
-      ReadChar();
-      if (++bufpos == available)
-        AdjustBuffSize();
-      buffer[bufpos] = 'x';
-      UpdateLineColumn('x');
-      try {
-        c = PeekChar();
-      }
-      catch (EOFException e) {
-        backup(xCnt);
-        return '\\';
-      }
-      if (c == '{') {
-        ReadChar();
-        column++;
-        // backup past the 'x's
-        bufpos -= xCnt;
-        if (bufpos < 0)
-          bufpos += bufsize;
-        break;
-      }
-      if (c != 'x') {
-        backup(xCnt);
-        return '\\';
-      }
-      xCnt++;
-    }
-    try {
-      int scalarValue = hexval(ReadChar());
-      column++;
-      if (scalarValue < 0)
-        throw new EscapeSyntaxException("illegal_hex_digit", line, column);
-      while ((c = ReadChar()) != '}') {
-        column++;
-        int n = hexval(c);
-        if (n < 0)
-          throw new EscapeSyntaxException("illegal_hex_digit", line, column);
-        scalarValue <<= 4;
-        scalarValue |= n;
-        if (scalarValue >= 0x110000)
-          throw new EscapeSyntaxException("char_code_too_big", line, column);
-      }
-      column++; // for the '}'
-      if (scalarValue <= 0xFFFF) {
-        c = (char)scalarValue;
-        switch (c) {
-        case '\n':
-        case '\r':
-        case '\t':
-          break;
-        default:
-          if (c >= 0x20 && !Utf16.isSurrogate(c))
-            break;
-          // fall through
-        case '\uFFFE':
-        case '\uFFFF':
-          throw new EscapeSyntaxException("illegal_char_code_ref", line, column);
-        }
-        buffer[bufpos] = c;
-        return c;
-      }
-      c = Utf16.surrogate1(scalarValue);
-      buffer[bufpos] = c;
-      int bufpos1 = bufpos;
-      if (++bufpos == bufsize)
-        bufpos = 0;
-      buffer[bufpos] = Utf16.surrogate2(scalarValue);
-      bufline[bufpos] = bufline[bufpos1];
-      bufcolumn[bufpos] = bufcolumn[bufpos1];
-      backup(1);
-      return c;
-    }
-    catch (EOFException e) {
-      throw new EscapeSyntaxException("incomplete_escape", line, column);
-    }
-  }
-
-  /**
-   * @deprecated
-   * @see #getEndColumn
-   */
-
-  public final int getColumn() {
-    return bufcolumn[bufpos];
-  }
-
-  /**
-   * @deprecated
-   * @see #getEndLine
-   */
-
-  public final int getLine() {
-    return bufline[bufpos];
-  }
-
-  public final int getEndColumn() {
-    return bufcolumn[bufpos];
-  }
-
-  public final int getEndLine() {
-    return bufline[bufpos];
-  }
-
-  public final int getBeginColumn() {
-    return bufcolumn[tokenBegin];
-  }
-
-  public final int getBeginLine() {
-    return bufline[tokenBegin];
-  }
-
-  public final void backup(int amount) {
-
-    inBuf += amount;
-    if ((bufpos -= amount) < 0)
-      bufpos += bufsize;
-  }
-
-  public UCode_UCodeESC_CharStream(java.io.Reader dstream,
-                                   int startline, int startcolumn, int buffersize) {
-    inputStream = dstream;
-    line = startline;
-    column = startcolumn - 1;
-
-    available = bufsize = buffersize;
-    buffer = new char[buffersize];
-    bufline = new int[buffersize];
-    bufcolumn = new int[buffersize];
-    nextCharBuf = new char[4096];
-    skipBOM();
-  }
-
-  public UCode_UCodeESC_CharStream(java.io.Reader dstream,
-                                   int startline, int startcolumn) {
-    this(dstream, startline, startcolumn, 4096);
-  }
-
-  public void ReInit(java.io.Reader dstream,
-                     int startline, int startcolumn, int buffersize) {
-    inputStream = dstream;
-    closed = false;
-    line = startline;
-    column = startcolumn - 1;
-
-    if (buffer == null || buffersize != buffer.length) {
-      available = bufsize = buffersize;
-      buffer = new char[buffersize];
-      bufline = new int[buffersize];
-      bufcolumn = new int[buffersize];
-      nextCharBuf = new char[4096];
-    }
-    prevCharIsLF = false;
-    tokenBegin = inBuf = maxNextCharInd = 0;
-    nextCharInd = bufpos = -1;
-    skipBOM();
-  }
-
-  public void ReInit(java.io.Reader dstream,
-                     int startline, int startcolumn) {
-    ReInit(dstream, startline, startcolumn, 4096);
-  }
-
-  public UCode_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
-                                   int startcolumn, int buffersize) {
-    this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
-  }
-
-  public UCode_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
-                                   int startcolumn) {
-    this(dstream, startline, startcolumn, 4096);
-  }
-
-  public void ReInit(java.io.InputStream dstream, int startline,
-                     int startcolumn, int buffersize) {
-    ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
-  }
-
-  public void ReInit(java.io.InputStream dstream, int startline,
-                     int startcolumn) {
-    ReInit(dstream, startline, startcolumn, 4096);
-  }
-
-  static private final char BOM = '\ufeff';
-
-  private void skipBOM() {
-    try {
-      if (PeekChar() == BOM)
-        ReadChar();
-    }
-    catch (EOFException e) {
-    }
-  }
-
-  public final String GetImage() {
-    if (bufpos >= tokenBegin)
-      return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
-    else
-      return new String(buffer, tokenBegin, bufsize - tokenBegin) +
-              new String(buffer, 0, bufpos + 1);
-  }
-
-  public final char[] GetSuffix(int len) {
-    char[] ret = new char[len];
-
-    if ((bufpos + 1) >= len)
-      System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
-    else {
-      System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
-                       len - bufpos - 1);
-      System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+    /**
+     * @deprecated @see #getEndColumn
+     */
+    public final int getColumn() {
+        return bufcolumn[bufpos];
     }
 
-    return ret;
-  }
-
-  public void Done() {
-    nextCharBuf = null;
-    buffer = null;
-    bufline = null;
-    bufcolumn = null;
-  }
-
-  /**
-   * Method to adjust line and column numbers for the start of a token.<BR>
-   */
-  public void adjustBeginLineColumn(int newLine, int newCol) {
-    int start = tokenBegin;
-    int len;
-
-    if (bufpos >= tokenBegin) {
-      len = bufpos - tokenBegin + inBuf + 1;
-    }
-    else {
-      len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+    /**
+     * @deprecated @see #getEndLine
+     */
+    public final int getLine() {
+        return bufline[bufpos];
     }
 
-    int i = 0, j = 0, k = 0;
-    int nextColDiff = 0, columnDiff = 0;
-
-    while (i < len &&
-            bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) {
-      bufline[j] = newLine;
-      nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
-      bufcolumn[j] = newCol + columnDiff;
-      columnDiff = nextColDiff;
-      i++;
+    public final int getEndColumn() {
+        return bufcolumn[bufpos];
     }
 
-    if (i < len) {
-      bufline[j] = newLine++;
-      bufcolumn[j] = newCol + columnDiff;
-
-      while (i++ < len) {
-        if (bufline[j = start % bufsize] != bufline[++start % bufsize])
-          bufline[j] = newLine++;
-        else
-          bufline[j] = newLine;
-      }
+    public final int getEndLine() {
+        return bufline[bufpos];
     }
 
-    line = bufline[j];
-    column = bufcolumn[j];
-  }
+    public final int getBeginColumn() {
+        return bufcolumn[tokenBegin];
+    }
 
+    public final int getBeginLine() {
+        return bufline[tokenBegin];
+    }
+
+    public final void backup(int amount) {
+
+        inBuf += amount;
+        if ((bufpos -= amount) < 0) {
+            bufpos += bufsize;
+        }
+    }
+
+    public UCode_UCodeESC_CharStream(java.io.Reader dstream,
+            int startline, int startcolumn, int buffersize) {
+        inputStream = dstream;
+        line = startline;
+        column = startcolumn - 1;
+
+        available = bufsize = buffersize;
+        buffer = new char[buffersize];
+        bufline = new int[buffersize];
+        bufcolumn = new int[buffersize];
+        nextCharBuf = new char[4096];
+        skipBOM();
+    }
+
+    public UCode_UCodeESC_CharStream(java.io.Reader dstream,
+            int startline, int startcolumn) {
+        this(dstream, startline, startcolumn, 4096);
+    }
+
+    public void ReInit(java.io.Reader dstream,
+            int startline, int startcolumn, int buffersize) {
+        inputStream = dstream;
+        closed = false;
+        line = startline;
+        column = startcolumn - 1;
+
+        if (buffer == null || buffersize != buffer.length) {
+            available = bufsize = buffersize;
+            buffer = new char[buffersize];
+            bufline = new int[buffersize];
+            bufcolumn = new int[buffersize];
+            nextCharBuf = new char[4096];
+        }
+        prevCharIsLF = false;
+        tokenBegin = inBuf = maxNextCharInd = 0;
+        nextCharInd = bufpos = -1;
+        skipBOM();
+    }
+
+    public void ReInit(java.io.Reader dstream,
+            int startline, int startcolumn) {
+        ReInit(dstream, startline, startcolumn, 4096);
+    }
+
+    public UCode_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+            int startcolumn, int buffersize) {
+        this(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+    }
+
+    public UCode_UCodeESC_CharStream(java.io.InputStream dstream, int startline,
+            int startcolumn) {
+        this(dstream, startline, startcolumn, 4096);
+    }
+
+    public void ReInit(java.io.InputStream dstream, int startline,
+            int startcolumn, int buffersize) {
+        ReInit(new java.io.InputStreamReader(dstream), startline, startcolumn, 4096);
+    }
+
+    public void ReInit(java.io.InputStream dstream, int startline,
+            int startcolumn) {
+        ReInit(dstream, startline, startcolumn, 4096);
+    }
+    static private final char BOM = '\ufeff';
+
+    private void skipBOM() {
+        try {
+            if (PeekChar() == BOM) {
+                ReadChar();
+            }
+        } catch (EOFException e) {
+        }
+    }
+
+    public final String GetImage() {
+        if (bufpos >= tokenBegin) {
+            return new String(buffer, tokenBegin, bufpos - tokenBegin + 1);
+        } else {
+            return new String(buffer, tokenBegin, bufsize - tokenBegin)
+                    + new String(buffer, 0, bufpos + 1);
+        }
+    }
+
+    public final char[] GetSuffix(int len) {
+        char[] ret = new char[len];
+
+        if ((bufpos + 1) >= len) {
+            System.arraycopy(buffer, bufpos - len + 1, ret, 0, len);
+        } else {
+            System.arraycopy(buffer, bufsize - (len - bufpos - 1), ret, 0,
+                    len - bufpos - 1);
+            System.arraycopy(buffer, 0, ret, len - bufpos - 1, bufpos + 1);
+        }
+
+        return ret;
+    }
+
+    public void Done() {
+        nextCharBuf = null;
+        buffer = null;
+        bufline = null;
+        bufcolumn = null;
+    }
+
+    /**
+     * Method to adjust line and column numbers for the start of a token.<BR>
+     */
+    public void adjustBeginLineColumn(int newLine, int newCol) {
+        int start = tokenBegin;
+        int len;
+
+        if (bufpos >= tokenBegin) {
+            len = bufpos - tokenBegin + inBuf + 1;
+        } else {
+            len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+        }
+
+        int i = 0, j = 0, k = 0;
+        int nextColDiff, columnDiff = 0;
+
+        while (i < len
+                && bufline[j = start % bufsize] == bufline[k = ++start % bufsize]) {
+            bufline[j] = newLine;
+            nextColDiff = columnDiff + bufcolumn[k] - bufcolumn[j];
+            bufcolumn[j] = newCol + columnDiff;
+            columnDiff = nextColDiff;
+            i++;
+        }
+
+        if (i < len) {
+            bufline[j] = newLine++;
+            bufcolumn[j] = newCol + columnDiff;
+
+            while (i++ < len) {
+                if (bufline[j = start % bufsize] != bufline[++start % bufsize]) {
+                    bufline[j] = newLine++;
+                } else {
+                    bufline[j] = newLine;
+                }
+            }
+        }
+
+        line = bufline[j];
+        column = bufcolumn[j];
+    }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/xml/SchemaParser.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/xml/SchemaParser.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -91,1594 +91,1783 @@
 
 class SchemaParser {
 
-  private static final String relaxngURIPrefix =
-          WellKnownNamespaces.RELAX_NG.substring(0, WellKnownNamespaces.RELAX_NG.lastIndexOf('/') + 1);
-  static final String relaxng10URI = WellKnownNamespaces.RELAX_NG;
-  private static final Localizer localizer = new Localizer(new Localizer(Parseable.class),SchemaParser.class);
+    private static final String relaxngURIPrefix =
+            WellKnownNamespaces.RELAX_NG.substring(0, WellKnownNamespaces.RELAX_NG.lastIndexOf('/') + 1);
+    static final String relaxng10URI = WellKnownNamespaces.RELAX_NG;
+    private static final Localizer localizer = new Localizer(new Localizer(Parseable.class), SchemaParser.class);
+    private String relaxngURI;
+    private final XMLReader xr;
+    private final ErrorHandler eh;
+    private final SchemaBuilder schemaBuilder;
+    /**
+     * The value of the {@link SchemaBuilder#getNameClassBuilder()} for the
+     * {@link #schemaBuilder} object.
+     */
+    private final NameClassBuilder nameClassBuilder;
+    private ParsedPattern startPattern;
+    private Locator locator;
+    private final XmlBaseHandler xmlBaseHandler = new XmlBaseHandler();
+    private final ContextImpl context = new ContextImpl();
+    private boolean hadError = false;
+    private Hashtable patternTable;
+    private Hashtable nameClassTable;
 
-  private String relaxngURI;
-  private final XMLReader xr;
-  private final ErrorHandler eh;
-  private final SchemaBuilder schemaBuilder;
-  /**
-   * The value of the {@link SchemaBuilder#getNameClassBuilder()}
-   * for the {@link #schemaBuilder} object.
-   */
-  private final NameClassBuilder nameClassBuilder;
-  private ParsedPattern startPattern;
-  private Locator locator;
-  private final XmlBaseHandler xmlBaseHandler = new XmlBaseHandler();
-  private final ContextImpl context = new ContextImpl();
+    static class PrefixMapping {
 
-  private boolean hadError = false;
+        final String prefix;
+        final String uri;
+        final PrefixMapping next;
 
-  private Hashtable patternTable;
-  private Hashtable nameClassTable;
-
-  static class PrefixMapping {
-    final String prefix;
-    final String uri;
-    final PrefixMapping next;
-
-    PrefixMapping(String prefix, String uri, PrefixMapping next) {
-      this.prefix = prefix;
-      this.uri = uri;
-      this.next = next;
-    }
-  }
-
-  static abstract class AbstractContext extends DtdContext implements Context {
-    PrefixMapping prefixMapping;
-
-    AbstractContext() {
-      prefixMapping = new PrefixMapping("xml", WellKnownNamespaces.XML, null);
+        PrefixMapping(String prefix, String uri, PrefixMapping next) {
+            this.prefix = prefix;
+            this.uri = uri;
+            this.next = next;
+        }
     }
 
-    AbstractContext(AbstractContext context) {
-      super(context);
-      prefixMapping = context.prefixMapping;
+    static abstract class AbstractContext extends DtdContext implements Context {
+
+        PrefixMapping prefixMapping;
+
+        AbstractContext() {
+            prefixMapping = new PrefixMapping("xml", WellKnownNamespaces.XML, null);
+        }
+
+        AbstractContext(AbstractContext context) {
+            super(context);
+            prefixMapping = context.prefixMapping;
+        }
+
+        public String resolveNamespacePrefix(String prefix) {
+            for (PrefixMapping p = prefixMapping; p != null; p = p.next) {
+                if (p.prefix.equals(prefix)) {
+                    return p.uri;
+                }
+            }
+            return null;
+        }
+
+        public Enumeration prefixes() {
+            Vector v = new Vector();
+            for (PrefixMapping p = prefixMapping; p != null; p = p.next) {
+                if (!v.contains(p.prefix)) {
+                    v.addElement(p.prefix);
+                }
+            }
+            return v.elements();
+        }
+
+        public Context copy() {
+            return new SavedContext(this);
+        }
     }
 
-    public String resolveNamespacePrefix(String prefix) {
-      for (PrefixMapping p = prefixMapping; p != null; p = p.next)
-        if (p.prefix.equals(prefix))
-          return p.uri;
-      return null;
+    static class SavedContext extends AbstractContext {
+
+        private final String baseUri;
+
+        SavedContext(AbstractContext context) {
+            super(context);
+            this.baseUri = context.getBaseUri();
+        }
+
+        public String getBaseUri() {
+            return baseUri;
+        }
     }
 
-    public Enumeration prefixes() {
-      Vector v = new Vector();
-      for (PrefixMapping p = prefixMapping; p != null; p = p.next) {
-        if (!v.contains(p.prefix))
-          v.addElement(p.prefix);
-      }
-      return v.elements();
+    class ContextImpl extends AbstractContext {
+
+        public String getBaseUri() {
+            return xmlBaseHandler.getBaseUri();
+        }
     }
 
-    public Context copy() {
-      return new SavedContext(this);
-    }
-  }
+    static interface CommentHandler {
 
-  static class SavedContext extends AbstractContext {
-    private final String baseUri;
-    SavedContext(AbstractContext context) {
-      super(context);
-      this.baseUri = context.getBaseUri();
+        void comment(String value);
     }
 
-    public String getBaseUri() {
-      return baseUri;
-    }
-  }
+    abstract class Handler implements ContentHandler, CommentHandler {
 
-  class ContextImpl extends AbstractContext {
-    public String getBaseUri() {
-      return xmlBaseHandler.getBaseUri();
-    }
-  }
+        CommentList comments;
 
-  static interface CommentHandler {
-    void comment(String value);
-  }
+        CommentList getComments() {
+            CommentList tem = comments;
+            comments = null;
+            return tem;
+        }
 
-  abstract class Handler implements ContentHandler, CommentHandler {
-    CommentList comments;
+        public void comment(String value) {
+            if (comments == null) {
+                comments = schemaBuilder.makeCommentList();
+            }
+            comments.addComment(value, makeLocation());
+        }
 
-    CommentList getComments() {
-      CommentList tem = comments;
-      comments = null;
-      return tem;
+        public void processingInstruction(String target, String date) {
+        }
+
+        public void skippedEntity(String name) {
+        }
+
+        public void ignorableWhitespace(char[] ch, int start, int len) {
+        }
+
+        public void startDocument() {
+        }
+
+        public void endDocument() {
+        }
+
+        public void startPrefixMapping(String prefix, String uri) {
+            context.prefixMapping = new PrefixMapping(prefix, uri, context.prefixMapping);
+        }
+
+        public void endPrefixMapping(String prefix) {
+            context.prefixMapping = context.prefixMapping.next;
+        }
+
+        public void setDocumentLocator(Locator loc) {
+            locator = loc;
+            xmlBaseHandler.setLocator(loc);
+        }
     }
 
-    public void comment(String value) {
-      if (comments == null)
-        comments = schemaBuilder.makeCommentList();
-      comments.addComment(value, makeLocation());
-    }
-    public void processingInstruction(String target, String date) { }
-    public void skippedEntity(String name) { }
-    public void ignorableWhitespace(char[] ch, int start, int len) { }
-    public void startDocument() { }
-    public void endDocument() { }
-    public void startPrefixMapping(String prefix, String uri) {
-      context.prefixMapping = new PrefixMapping(prefix, uri, context.prefixMapping);
+    abstract class State extends Handler {
+
+        State parent;
+        String nsInherit;
+        String ns;
+        String datatypeLibrary;
+        /**
+         * The current scope, or null if there's none.
+         */
+        Scope scope;
+        Location startLocation;
+        Annotations annotations;
+
+        void set() {
+            xr.setContentHandler(this);
+        }
+
+        abstract State create();
+
+        abstract State createChildState(String localName) throws SAXException;
+
+        void setParent(State parent) {
+            this.parent = parent;
+            this.nsInherit = parent.getNs();
+            this.datatypeLibrary = parent.datatypeLibrary;
+            this.scope = parent.scope;
+            this.startLocation = makeLocation();
+            if (parent.comments != null) {
+                annotations = schemaBuilder.makeAnnotations(parent.comments, getContext());
+                parent.comments = null;
+            } else if (parent instanceof RootState) {
+                annotations = schemaBuilder.makeAnnotations(null, getContext());
+            }
+        }
+
+        String getNs() {
+            return ns == null ? nsInherit : ns;
+        }
+
+        boolean isRelaxNGElement(String uri) throws SAXException {
+            return uri.equals(relaxngURI);
+        }
+
+        public void startElement(String namespaceURI,
+                String localName,
+                String qName,
+                Attributes atts) throws SAXException {
+            xmlBaseHandler.startElement();
+            if (isRelaxNGElement(namespaceURI)) {
+                State state = createChildState(localName);
+                if (state == null) {
+                    xr.setContentHandler(new Skipper(this));
+                    return;
+                }
+                state.setParent(this);
+                state.set();
+                state.attributes(atts);
+            } else {
+                checkForeignElement();
+                ForeignElementHandler feh = new ForeignElementHandler(this, getComments());
+                feh.startElement(namespaceURI, localName, qName, atts);
+                xr.setContentHandler(feh);
+            }
+        }
+
+        public void endElement(String namespaceURI,
+                String localName,
+                String qName) throws SAXException {
+            xmlBaseHandler.endElement();
+            parent.set();
+            end();
+        }
+
+        void setName(String name) throws SAXException {
+            error("illegal_name_attribute");
+        }
+
+        void setOtherAttribute(String name, String value) throws SAXException {
+            error("illegal_attribute_ignored", name);
+        }
+
+        void endAttributes() throws SAXException {
+        }
+
+        void checkForeignElement() throws SAXException {
+        }
+
+        void attributes(Attributes atts) throws SAXException {
+            int len = atts.getLength();
+            for (int i = 0; i < len; i++) {
+                String uri = atts.getURI(i);
+                if (uri.length() == 0) {
+                    String name = atts.getLocalName(i);
+                    if (name.equals("name")) {
+                        setName(atts.getValue(i).trim());
+                    } else if (name.equals("ns")) {
+                        ns = atts.getValue(i);
+                    } else if (name.equals("datatypeLibrary")) {
+                        datatypeLibrary = atts.getValue(i);
+                        checkUri(datatypeLibrary);
+                        if (!datatypeLibrary.equals("")
+                                && !Uri.isAbsolute(datatypeLibrary)) {
+                            error("relative_datatype_library");
+                        }
+                        if (Uri.hasFragmentId(datatypeLibrary)) {
+                            error("fragment_identifier_datatype_library");
+                        }
+                        datatypeLibrary = Uri.escapeDisallowedChars(datatypeLibrary);
+                    } else {
+                        setOtherAttribute(name, atts.getValue(i));
+                    }
+                } else if (uri.equals(relaxngURI)) {
+                    error("qualified_attribute", atts.getLocalName(i));
+                } else if (uri.equals(WellKnownNamespaces.XML)
+                        && atts.getLocalName(i).equals("base")) {
+                    xmlBaseHandler.xmlBaseAttribute(atts.getValue(i));
+                } else {
+                    if (annotations == null) {
+                        annotations = schemaBuilder.makeAnnotations(null, getContext());
+                    }
+                    annotations.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri),
+                            atts.getValue(i), startLocation);
+                }
+            }
+            endAttributes();
+        }
+
+        abstract void end() throws SAXException;
+
+        void endChild(ParsedPattern pattern) {
+            // XXX cannot happen; throw exception
+        }
+
+        void endChild(ParsedNameClass nc) {
+            // XXX cannot happen; throw exception
+        }
+
+        @Override
+        public void startDocument() {
+        }
+
+        @Override
+        public void endDocument() {
+            if (comments != null && startPattern != null) {
+                startPattern = schemaBuilder.commentAfter(startPattern, comments);
+                comments = null;
+            }
+        }
+
+        public void characters(char[] ch, int start, int len) throws SAXException {
+            for (int i = 0; i < len; i++) {
+                switch (ch[start + i]) {
+                    case ' ':
+                    case '\r':
+                    case '\n':
+                    case '\t':
+                        break;
+                    default:
+                        error("illegal_characters_ignored");
+                        break;
+                }
+            }
+        }
+
+        boolean isPatternNamespaceURI(String s) {
+            return s.equals(relaxngURI);
+        }
+
+        void endForeignChild(ParsedElementAnnotation ea) {
+            if (annotations == null) {
+                annotations = schemaBuilder.makeAnnotations(null, getContext());
+            }
+            annotations.addElement(ea);
+        }
+
+        void mergeLeadingComments() {
+            if (comments != null) {
+                if (annotations == null) {
+                    annotations = schemaBuilder.makeAnnotations(comments, getContext());
+                } else {
+                    annotations.addLeadingComment(comments);
+                }
+                comments = null;
+            }
+        }
     }
 
-    public void endPrefixMapping(String prefix) {
-      context.prefixMapping = context.prefixMapping.next;
+    class ForeignElementHandler extends Handler {
+
+        final State nextState;
+        ElementAnnotationBuilder builder;
+        final Stack builderStack = new Stack();
+        StringBuffer textBuf;
+        Location textLoc;
+
+        ForeignElementHandler(State nextState, CommentList comments) {
+            this.nextState = nextState;
+            this.comments = comments;
+        }
+
+        public void startElement(String namespaceURI, String localName,
+                String qName, Attributes atts) {
+            flushText();
+            if (builder != null) {
+                builderStack.push(builder);
+            }
+            Location loc = makeLocation();
+            builder = schemaBuilder.makeElementAnnotationBuilder(namespaceURI,
+                    localName,
+                    findPrefix(qName, namespaceURI),
+                    loc,
+                    getComments(),
+                    getContext());
+            int len = atts.getLength();
+            for (int i = 0; i < len; i++) {
+                String uri = atts.getURI(i);
+                builder.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri),
+                        atts.getValue(i), loc);
+            }
+        }
+
+        public void endElement(String namespaceURI, String localName,
+                String qName) {
+            flushText();
+            if (comments != null) {
+                builder.addComment(getComments());
+            }
+            ParsedElementAnnotation ea = builder.makeElementAnnotation();
+            if (builderStack.empty()) {
+                nextState.endForeignChild(ea);
+                nextState.set();
+            } else {
+                builder = (ElementAnnotationBuilder) builderStack.pop();
+                builder.addElement(ea);
+            }
+        }
+
+        public void characters(char ch[], int start, int length) {
+            if (textBuf == null) {
+                textBuf = new StringBuffer();
+            }
+            textBuf.append(ch, start, length);
+            if (textLoc == null) {
+                textLoc = makeLocation();
+            }
+        }
+
+        @Override
+        public void comment(String value) {
+            flushText();
+            super.comment(value);
+        }
+
+        void flushText() {
+            if (textBuf != null && textBuf.length() != 0) {
+                builder.addText(textBuf.toString(), textLoc, getComments());
+                textBuf.setLength(0);
+            }
+            textLoc = null;
+        }
     }
 
-    public void setDocumentLocator(Locator loc) {
-      locator = loc;
-      xmlBaseHandler.setLocator(loc);
-    }
-  }
+    static class Skipper extends DefaultHandler implements CommentHandler {
 
-  abstract class State extends Handler {
-    State parent;
-    String nsInherit;
-    String ns;
-    String datatypeLibrary;
-    /**
-     * The current scope, or null if there's none.
-     */
-    Scope scope;
-    Location startLocation;
-    Annotations annotations;
+        int level = 1;
+        final State nextState;
 
-    void set() {
-      xr.setContentHandler(this);
+        Skipper(State nextState) {
+            this.nextState = nextState;
+        }
+
+        @Override
+        public void startElement(String namespaceURI,
+                String localName,
+                String qName,
+                Attributes atts) throws SAXException {
+            ++level;
+        }
+
+        @Override
+        public void endElement(String namespaceURI,
+                String localName,
+                String qName) throws SAXException {
+            if (--level == 0) {
+                nextState.set();
+            }
+        }
+
+        public void comment(String value) {
+        }
     }
 
-    abstract State create();
-    abstract State createChildState(String localName) throws SAXException;
+    abstract class EmptyContentState extends State {
 
+        State createChildState(String localName) throws SAXException {
+            error("expected_empty", localName);
+            return null;
+        }
 
-    void setParent(State parent) {
-      this.parent = parent;
-      this.nsInherit = parent.getNs();
-      this.datatypeLibrary = parent.datatypeLibrary;
-      this.scope = parent.scope;
-      this.startLocation = makeLocation();
-      if (parent.comments != null) {
-        annotations = schemaBuilder.makeAnnotations(parent.comments, getContext());
-        parent.comments = null;
-      }
-      else if (parent instanceof RootState)
-        annotations = schemaBuilder.makeAnnotations(null, getContext());
+        abstract ParsedPattern makePattern() throws SAXException;
+
+        void end() throws SAXException {
+            if (comments != null) {
+                if (annotations == null) {
+                    annotations = schemaBuilder.makeAnnotations(null, getContext());
+                }
+                annotations.addComment(comments);
+                comments = null;
+            }
+            parent.endChild(makePattern());
+        }
+    }
+    static private final int INIT_CHILD_ALLOC = 5;
+
+    abstract class PatternContainerState extends State {
+
+        List<ParsedPattern> childPatterns;
+
+        State createChildState(String localName) throws SAXException {
+            State state = (State) patternTable.get(localName);
+            if (state == null) {
+                error("expected_pattern", localName);
+                return null;
+            }
+            return state.create();
+        }
+
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            if (patterns.size() == 1 && anno == null) {
+                return patterns.get(0);
+            }
+            return schemaBuilder.makeGroup(patterns, loc, anno);
+        }
+
+        @Override
+        void endChild(ParsedPattern pattern) {
+            if (childPatterns == null) {
+                childPatterns = new ArrayList<ParsedPattern>(INIT_CHILD_ALLOC);
+            }
+            childPatterns.add(pattern);
+        }
+
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            // Harshit : Annotation handling should always be taken care of, irrespective of childPatterns being null or not.
+            super.endForeignChild(ea);
+            if (childPatterns != null) {
+                int idx = childPatterns.size() - 1;
+                childPatterns.set(idx, schemaBuilder.annotateAfter(childPatterns.get(idx), ea));
+            }
+        }
+
+        void end() throws SAXException {
+            if (childPatterns == null) {
+                error("missing_children");
+                endChild(schemaBuilder.makeErrorPattern());
+            }
+            if (comments != null) {
+                int idx = childPatterns.size() - 1;
+                childPatterns.set(idx, schemaBuilder.commentAfter(childPatterns.get(idx), comments));
+                comments = null;
+            }
+            sendPatternToParent(buildPattern(childPatterns, startLocation, annotations));
+        }
+
+        void sendPatternToParent(ParsedPattern p) {
+            parent.endChild(p);
+        }
     }
 
-    String getNs() {
-      return ns == null ? nsInherit : ns;
+    class GroupState extends PatternContainerState {
+
+        State create() {
+            return new GroupState();
+        }
     }
 
-    boolean isRelaxNGElement(String uri) throws SAXException {
-      return uri.equals(relaxngURI);
+    class ZeroOrMoreState extends PatternContainerState {
+
+        State create() {
+            return new ZeroOrMoreState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeZeroOrMore(super.buildPattern(patterns, loc, null), loc, anno);
+        }
     }
 
-    public void startElement(String namespaceURI,
-                             String localName,
-                             String qName,
-                             Attributes atts) throws SAXException {
-      xmlBaseHandler.startElement();
-      if (isRelaxNGElement(namespaceURI)) {
-        State state = createChildState(localName);
-        if (state == null) {
-          xr.setContentHandler(new Skipper(this));
-          return;
+    class OneOrMoreState extends PatternContainerState {
+
+        State create() {
+            return new OneOrMoreState();
         }
-        state.setParent(this);
-        state.set();
-        state.attributes(atts);
-      }
-      else {
-        checkForeignElement();
-        ForeignElementHandler feh = new ForeignElementHandler(this, getComments());
-        feh.startElement(namespaceURI, localName, qName, atts);
-        xr.setContentHandler(feh);
-      }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeOneOrMore(super.buildPattern(patterns, loc, null), loc, anno);
+        }
     }
 
-    public void endElement(String namespaceURI,
-                           String localName,
-                           String qName) throws SAXException {
-      xmlBaseHandler.endElement();
-      parent.set();
-      end();
+    class OptionalState extends PatternContainerState {
+
+        State create() {
+            return new OptionalState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeOptional(super.buildPattern(patterns, loc, null), loc, anno);
+        }
     }
 
-    void setName(String name) throws SAXException {
-      error("illegal_name_attribute");
+    class ListState extends PatternContainerState {
+
+        State create() {
+            return new ListState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeList(super.buildPattern(patterns, loc, null), loc, anno);
+        }
     }
 
-    void setOtherAttribute(String name, String value) throws SAXException {
-      error("illegal_attribute_ignored", name);
+    class ChoiceState extends PatternContainerState {
+
+        State create() {
+            return new ChoiceState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeChoice(patterns, loc, anno);
+        }
     }
 
-    void endAttributes() throws SAXException {
+    class InterleaveState extends PatternContainerState {
+
+        State create() {
+            return new InterleaveState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) {
+            return schemaBuilder.makeInterleave(patterns, loc, anno);
+        }
     }
 
-    void checkForeignElement() throws SAXException {
+    class MixedState extends PatternContainerState {
+
+        State create() {
+            return new MixedState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeMixed(super.buildPattern(patterns, loc, null), loc, anno);
+        }
     }
 
-    void attributes(Attributes atts) throws SAXException {
-      int len = atts.getLength();
-      for (int i = 0; i < len; i++) {
-        String uri = atts.getURI(i);
-        if (uri.length() == 0) {
-          String name = atts.getLocalName(i);
-          if (name.equals("name"))
-            setName(atts.getValue(i).trim());
-          else if (name.equals("ns"))
-            ns = atts.getValue(i);
-          else if (name.equals("datatypeLibrary")) {
-            datatypeLibrary = atts.getValue(i);
-            checkUri(datatypeLibrary);
-            if (!datatypeLibrary.equals("")
-                && !Uri.isAbsolute(datatypeLibrary))
-              error("relative_datatype_library");
-            if (Uri.hasFragmentId(datatypeLibrary))
-              error("fragment_identifier_datatype_library");
-            datatypeLibrary = Uri.escapeDisallowedChars(datatypeLibrary);
-          }
-          else
-            setOtherAttribute(name, atts.getValue(i));
-        }
-        else if (uri.equals(relaxngURI))
-          error("qualified_attribute", atts.getLocalName(i));
-        else if (uri.equals(WellKnownNamespaces.XML)
-                 && atts.getLocalName(i).equals("base"))
-          xmlBaseHandler.xmlBaseAttribute(atts.getValue(i));
-        else {
-          if (annotations == null)
-            annotations = schemaBuilder.makeAnnotations(null, getContext());
-          annotations.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri),
-                                   atts.getValue(i), startLocation);
-        }
-      }
-      endAttributes();
+    static interface NameClassRef {
+
+        void setNameClass(ParsedNameClass nc);
     }
 
-    abstract void end() throws SAXException;
+    class ElementState extends PatternContainerState implements NameClassRef {
 
-    void endChild(ParsedPattern pattern) {
-      // XXX cannot happen; throw exception
+        ParsedNameClass nameClass;
+        boolean nameClassWasAttribute;
+        String name;
+
+        @Override
+        void setName(String name) {
+            this.name = name;
+        }
+
+        public void setNameClass(ParsedNameClass nc) {
+            nameClass = nc;
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (name != null) {
+                nameClass = expandName(name, getNs(), null);
+                nameClassWasAttribute = true;
+            } else {
+                new NameClassChildState(this, this).set();
+            }
+        }
+
+        State create() {
+            return new ElementState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeElement(nameClass, super.buildPattern(patterns, loc, null), loc, anno);
+        }
+
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            if (nameClassWasAttribute || childPatterns != null || nameClass == null) {
+                super.endForeignChild(ea);
+            } else {
+                nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
+            }
+        }
     }
 
-    void endChild(ParsedNameClass nc) {
-      // XXX cannot happen; throw exception
+    class RootState extends PatternContainerState {
+
+        IncludedGrammar grammar;
+
+        RootState() {
+        }
+
+        RootState(IncludedGrammar grammar, Scope scope, String ns) {
+            this.grammar = grammar;
+            this.scope = scope;
+            this.nsInherit = ns;
+            this.datatypeLibrary = "";
+        }
+
+        State create() {
+            return new RootState();
+        }
+
+        @Override
+        State createChildState(String localName) throws SAXException {
+            if (grammar == null) {
+                return super.createChildState(localName);
+            }
+            if (localName.equals("grammar")) {
+                return new MergeGrammarState(grammar);
+            }
+            error("expected_grammar", localName);
+            return null;
+        }
+
+        @Override
+        void checkForeignElement() throws SAXException {
+            error("root_bad_namespace_uri", WellKnownNamespaces.RELAX_NG);
+        }
+
+        @Override
+        void endChild(ParsedPattern pattern) {
+            startPattern = pattern;
+        }
+
+        @Override
+        boolean isRelaxNGElement(String uri) throws SAXException {
+            if (!uri.startsWith(relaxngURIPrefix)) {
+                return false;
+            }
+            if (!uri.equals(WellKnownNamespaces.RELAX_NG)) {
+                warning("wrong_uri_version",
+                        WellKnownNamespaces.RELAX_NG.substring(relaxngURIPrefix.length()),
+                        uri.substring(relaxngURIPrefix.length()));
+            }
+            relaxngURI = uri;
+            return true;
+        }
     }
 
-    public void startDocument() { }
-    public void endDocument() {
-      if (comments != null && startPattern != null) {
-        startPattern = schemaBuilder.commentAfter(startPattern, comments);
-        comments = null;
-      }
+    class NotAllowedState extends EmptyContentState {
+
+        State create() {
+            return new NotAllowedState();
+        }
+
+        ParsedPattern makePattern() {
+            return schemaBuilder.makeNotAllowed(startLocation, annotations);
+        }
     }
 
-    public void characters(char[] ch, int start, int len) throws SAXException {
-      for (int i = 0; i < len; i++) {
-        switch(ch[start + i]) {
-        case ' ':
-        case '\r':
-        case '\n':
-        case '\t':
-          break;
-        default:
-          error("illegal_characters_ignored");
-          break;
+    class EmptyState extends EmptyContentState {
+
+        State create() {
+            return new EmptyState();
         }
-      }
+
+        ParsedPattern makePattern() {
+            return schemaBuilder.makeEmpty(startLocation, annotations);
+        }
     }
 
-    boolean isPatternNamespaceURI(String s) {
-      return s.equals(relaxngURI);
+    class TextState extends EmptyContentState {
+
+        State create() {
+            return new TextState();
+        }
+
+        ParsedPattern makePattern() {
+            return schemaBuilder.makeText(startLocation, annotations);
+        }
     }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      if (annotations == null)
-        annotations = schemaBuilder.makeAnnotations(null, getContext());
-      annotations.addElement(ea);
+    class ValueState extends EmptyContentState {
+
+        final StringBuffer buf = new StringBuffer();
+        String type;
+
+        State create() {
+            return new ValueState();
+        }
+
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("type")) {
+                type = checkNCName(value.trim());
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
+
+        @Override
+        public void characters(char[] ch, int start, int len) {
+            buf.append(ch, start, len);
+        }
+
+        @Override
+        void checkForeignElement() throws SAXException {
+            error("value_contains_foreign_element");
+        }
+
+        ParsedPattern makePattern() throws SAXException {
+            if (type == null) {
+                return makePattern("", "token");
+            } else {
+                return makePattern(datatypeLibrary, type);
+            }
+        }
+
+        @Override
+        void end() throws SAXException {
+            mergeLeadingComments();
+            super.end();
+        }
+
+        ParsedPattern makePattern(String datatypeLibrary, String type) {
+            return schemaBuilder.makeValue(datatypeLibrary,
+                    type,
+                    buf.toString(),
+                    getContext(),
+                    getNs(),
+                    startLocation,
+                    annotations);
+        }
     }
 
-    void mergeLeadingComments() {
-      if (comments != null) {
-        if (annotations == null)
-          annotations = schemaBuilder.makeAnnotations(comments, getContext());
-        else
-          annotations.addLeadingComment(comments);
-        comments = null;
-      }
-    }
-  }
+    class DataState extends State {
 
-  class ForeignElementHandler extends Handler {
-    final State nextState;
-    ElementAnnotationBuilder builder;
-    final Stack builderStack = new Stack();
-    StringBuffer textBuf;
-    Location textLoc;
+        String type;
+        ParsedPattern except = null;
+        DataPatternBuilder dpb = null;
 
-    ForeignElementHandler(State nextState, CommentList comments) {
-      this.nextState = nextState;
-      this.comments = comments;
+        State create() {
+            return new DataState();
+        }
+
+        State createChildState(String localName) throws SAXException {
+            if (localName.equals("param")) {
+                if (except != null) {
+                    error("param_after_except");
+                }
+                return new ParamState(dpb);
+            }
+            if (localName.equals("except")) {
+                if (except != null) {
+                    error("multiple_except");
+                }
+                return new ChoiceState();
+            }
+            error("expected_param_except", localName);
+            return null;
+        }
+
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("type")) {
+                type = checkNCName(value.trim());
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (type == null) {
+                error("missing_type_attribute");
+            } else {
+                dpb = schemaBuilder.makeDataPatternBuilder(datatypeLibrary, type, startLocation);
+            }
+        }
+
+        void end() throws SAXException {
+            ParsedPattern p;
+            if (dpb != null) {
+                if (except != null) {
+                    p = dpb.makePattern(except, startLocation, annotations);
+                } else {
+                    p = dpb.makePattern(startLocation, annotations);
+                }
+            } else {
+                p = schemaBuilder.makeErrorPattern();
+            }
+            // XXX need to capture comments
+            parent.endChild(p);
+        }
+
+        @Override
+        void endChild(ParsedPattern pattern) {
+            except = pattern;
+        }
     }
 
-    public void startElement(String namespaceURI, String localName,
-                             String qName, Attributes atts) {
-      flushText();
-      if (builder != null)
-        builderStack.push(builder);
-      Location loc = makeLocation();
-      builder = schemaBuilder.makeElementAnnotationBuilder(namespaceURI,
-                                                           localName,
-                                                           findPrefix(qName, namespaceURI),
-                                                           loc,
-                                                           getComments(),
-                                                           getContext());
-      int len = atts.getLength();
-      for (int i = 0; i < len; i++) {
-        String uri = atts.getURI(i);
-        builder.addAttribute(uri, atts.getLocalName(i), findPrefix(atts.getQName(i), uri),
-                             atts.getValue(i), loc);
-      }
+    class ParamState extends State {
+
+        private final StringBuffer buf = new StringBuffer();
+        private final DataPatternBuilder dpb;
+        private String name;
+
+        ParamState(DataPatternBuilder dpb) {
+            this.dpb = dpb;
+        }
+
+        State create() {
+            return new ParamState(null);
+        }
+
+        @Override
+        void setName(String name) throws SAXException {
+            this.name = checkNCName(name);
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (name == null) {
+                error("missing_name_attribute");
+            }
+        }
+
+        State createChildState(String localName) throws SAXException {
+            error("expected_empty", localName);
+            return null;
+        }
+
+        @Override
+        public void characters(char[] ch, int start, int len) {
+            buf.append(ch, start, len);
+        }
+
+        @Override
+        void checkForeignElement() throws SAXException {
+            error("param_contains_foreign_element");
+        }
+
+        void end() throws SAXException {
+            if (name == null) {
+                return;
+            }
+            if (dpb == null) {
+                return;
+            }
+            mergeLeadingComments();
+            dpb.addParam(name, buf.toString(), getContext(), getNs(), startLocation, annotations);
+        }
     }
 
-    public void endElement(String namespaceURI, String localName,
-                           String qName) {
-      flushText();
-      if (comments != null)
-        builder.addComment(getComments());
-      ParsedElementAnnotation ea = builder.makeElementAnnotation();
-      if (builderStack.empty()) {
-        nextState.endForeignChild(ea);
-        nextState.set();
-      }
-      else {
-        builder = (ElementAnnotationBuilder)builderStack.pop();
-        builder.addElement(ea);
-      }
+    class AttributeState extends PatternContainerState implements NameClassRef {
+
+        ParsedNameClass nameClass;
+        boolean nameClassWasAttribute;
+        String name;
+
+        State create() {
+            return new AttributeState();
+        }
+
+        @Override
+        void setName(String name) {
+            this.name = name;
+        }
+
+        public void setNameClass(ParsedNameClass nc) {
+            nameClass = nc;
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (name != null) {
+                String nsUse;
+                if (ns != null) {
+                    nsUse = ns;
+                } else {
+                    nsUse = "";
+                }
+                nameClass = expandName(name, nsUse, null);
+                nameClassWasAttribute = true;
+            } else {
+                new NameClassChildState(this, this).set();
+            }
+        }
+
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            if (nameClassWasAttribute || childPatterns != null || nameClass == null) {
+                super.endForeignChild(ea);
+            } else {
+                nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
+            }
+        }
+
+        @Override
+        void end() throws SAXException {
+            if (childPatterns == null) {
+                endChild(schemaBuilder.makeText(startLocation, null));
+            }
+            super.end();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeAttribute(nameClass, super.buildPattern(patterns, loc, null), loc, anno);
+        }
+
+        @Override
+        State createChildState(String localName) throws SAXException {
+            State tem = super.createChildState(localName);
+            if (tem != null && childPatterns != null) {
+                error("attribute_multi_pattern");
+            }
+            return tem;
+        }
     }
 
-    public void characters(char ch[], int start, int length) {
-      if (textBuf == null)
-        textBuf = new StringBuffer();
-      textBuf.append(ch, start, length);
-      if (textLoc == null)
-        textLoc = makeLocation();
+    abstract class SinglePatternContainerState extends PatternContainerState {
+
+        @Override
+        State createChildState(String localName) throws SAXException {
+            if (childPatterns == null) {
+                return super.createChildState(localName);
+            }
+            error("too_many_children");
+            return null;
+        }
     }
 
-    public void comment(String value) {
-      flushText();
-      super.comment(value);
+    class GrammarSectionState extends State {
+
+        GrammarSection section;
+
+        GrammarSectionState() {
+        }
+
+        GrammarSectionState(GrammarSection section) {
+            this.section = section;
+        }
+
+        State create() {
+            return new GrammarSectionState(null);
+        }
+
+        State createChildState(String localName) throws SAXException {
+            if (localName.equals("define")) {
+                return new DefineState(section);
+            }
+            if (localName.equals("start")) {
+                return new StartState(section);
+            }
+            if (localName.equals("include")) {
+                Include include = section.makeInclude();
+                if (include != null) {
+                    return new IncludeState(include);
+                }
+            }
+            if (localName.equals("div")) {
+                return new DivState(section.makeDiv());
+            }
+            error("expected_define", localName);
+            // XXX better errors
+            return null;
+        }
+
+        void end() throws SAXException {
+            if (comments != null) {
+                section.topLevelComment(comments);
+                comments = null;
+            }
+        }
+
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            section.topLevelAnnotation(ea);
+        }
     }
 
-    void flushText() {
-      if (textBuf != null && textBuf.length() != 0) {
-        builder.addText(textBuf.toString(), textLoc, getComments());
-        textBuf.setLength(0);
-      }
-      textLoc = null;
-    }
-  }
+    class DivState extends GrammarSectionState {
 
-  class Skipper extends DefaultHandler implements CommentHandler {
-    int level = 1;
-    final State nextState;
+        final Div div;
 
-    Skipper(State nextState) {
-      this.nextState = nextState;
+        DivState(Div div) {
+            super(div);
+            this.div = div;
+        }
+
+        @Override
+        void end() throws SAXException {
+            super.end();
+            div.endDiv(startLocation, annotations);
+        }
     }
 
-    public void startElement(String namespaceURI,
-                             String localName,
-                             String qName,
-                             Attributes atts) throws SAXException {
-      ++level;
+    class IncludeState extends GrammarSectionState {
+
+        String href;
+        final Include include;
+
+        IncludeState(Include include) {
+            super(include);
+            this.include = include;
+        }
+
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("href")) {
+                href = value;
+                checkUri(href);
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (href == null) {
+                error("missing_href_attribute");
+            } else {
+                href = resolve(href);
+            }
+        }
+
+        @Override
+        void end() throws SAXException {
+            super.end();
+            if (href != null) {
+                try {
+                    include.endInclude(parseable, href, getNs(), startLocation, annotations);
+                } catch (IllegalSchemaException e) {
+                }
+            }
+        }
     }
 
-    public void endElement(String namespaceURI,
-                           String localName,
-                           String qName) throws SAXException {
-      if (--level == 0)
-        nextState.set();
+    class MergeGrammarState extends GrammarSectionState {
+
+        final IncludedGrammar grammar;
+
+        MergeGrammarState(IncludedGrammar grammar) {
+            super(grammar);
+            this.grammar = grammar;
+        }
+
+        @Override
+        void end() throws SAXException {
+            super.end();
+            parent.endChild(grammar.endIncludedGrammar(startLocation, annotations));
+        }
     }
 
-    public void comment(String value) {
-    }
-  }
+    class GrammarState extends GrammarSectionState {
 
-  abstract class EmptyContentState extends State {
+        Grammar grammar;
 
-    State createChildState(String localName) throws SAXException {
-      error("expected_empty", localName);
-      return null;
+        @Override
+        void setParent(State parent) {
+            super.setParent(parent);
+            grammar = schemaBuilder.makeGrammar(scope);
+            section = grammar;
+            scope = grammar;
+        }
+
+        @Override
+        State create() {
+            return new GrammarState();
+        }
+
+        @Override
+        void end() throws SAXException {
+            super.end();
+            parent.endChild(grammar.endGrammar(startLocation, annotations));
+        }
     }
 
-    abstract ParsedPattern makePattern() throws SAXException;
+    class RefState extends EmptyContentState {
 
-    void end() throws SAXException {
-      if (comments != null) {
-        if (annotations == null)
-          annotations = schemaBuilder.makeAnnotations(null, getContext());
-        annotations.addComment(comments);
-        comments = null;
-      }
-      parent.endChild(makePattern());
-    }
-  }
+        String name;
 
-  static private final int INIT_CHILD_ALLOC = 5;
+        State create() {
+            return new RefState();
+        }
 
-  abstract class PatternContainerState extends State {
-    List<ParsedPattern> childPatterns;
+        @Override
+        void endAttributes() throws SAXException {
+            if (name == null) {
+                error("missing_name_attribute");
+            }
+        }
 
-    State createChildState(String localName) throws SAXException {
-      State state = (State)patternTable.get(localName);
-      if (state == null) {
-        error("expected_pattern", localName);
-        return null;
-      }
-      return state.create();
+        @Override
+        void setName(String name) throws SAXException {
+            this.name = checkNCName(name);
+        }
+
+        ParsedPattern makePattern() throws SAXException {
+            if (name == null) {
+                return schemaBuilder.makeErrorPattern();
+            }
+            if (scope == null) {
+                error("ref_outside_grammar", name);
+                return schemaBuilder.makeErrorPattern();
+            } else {
+                return scope.makeRef(name, startLocation, annotations);
+            }
+        }
     }
 
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      if (patterns.size() == 1 && anno == null)
-        return patterns.get(0);
-      return schemaBuilder.makeGroup(patterns, loc, anno);
+    class ParentRefState extends RefState {
+
+        @Override
+        State create() {
+            return new ParentRefState();
+        }
+
+        @Override
+        ParsedPattern makePattern() throws SAXException {
+            if (name == null) {
+                return schemaBuilder.makeErrorPattern();
+            }
+            if (scope == null) {
+                error("parent_ref_outside_grammar", name);
+                return schemaBuilder.makeErrorPattern();
+            } else {
+                return scope.makeParentRef(name, startLocation, annotations);
+            }
+        }
     }
 
-    void endChild(ParsedPattern pattern) {
-      if (childPatterns == null)
-        childPatterns = new ArrayList<ParsedPattern>(INIT_CHILD_ALLOC);
-      childPatterns.add(pattern);
+    class ExternalRefState extends EmptyContentState {
+
+        String href;
+
+        State create() {
+            return new ExternalRefState();
+        }
+
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("href")) {
+                href = value;
+                checkUri(href);
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (href == null) {
+                error("missing_href_attribute");
+            } else {
+                href = resolve(href);
+            }
+        }
+
+        ParsedPattern makePattern() {
+            if (href != null) {
+                try {
+                    return schemaBuilder.makeExternalRef(parseable,
+                            href,
+                            getNs(),
+                            scope,
+                            startLocation,
+                            annotations);
+                } catch (IllegalSchemaException e) {
+                }
+            }
+            return schemaBuilder.makeErrorPattern();
+        }
     }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      if (childPatterns == null)
-        super.endForeignChild(ea);
-      else {
-        int idx = childPatterns.size()-1;
-        childPatterns.set(idx, schemaBuilder.annotateAfter(childPatterns.get(idx), ea));
-      }
+    abstract class DefinitionState extends PatternContainerState {
+
+        GrammarSection.Combine combine = null;
+        final GrammarSection section;
+
+        DefinitionState(GrammarSection section) {
+            this.section = section;
+        }
+
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("combine")) {
+                value = value.trim();
+                if (value.equals("choice")) {
+                    combine = GrammarSection.COMBINE_CHOICE;
+                } else if (value.equals("interleave")) {
+                    combine = GrammarSection.COMBINE_INTERLEAVE;
+                } else {
+                    error("combine_attribute_bad_value", value);
+                }
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return super.buildPattern(patterns, loc, null);
+        }
     }
 
-    void end() throws SAXException {
-      if (childPatterns == null) {
-        error("missing_children");
-        endChild(schemaBuilder.makeErrorPattern());
-      }
-      if (comments != null) {
-        int idx = childPatterns.size()-1;
-        childPatterns.set(idx,schemaBuilder.commentAfter(childPatterns.get(idx), comments));
-        comments = null;
-      }
-      sendPatternToParent(buildPattern(childPatterns, startLocation, annotations));
+    class DefineState extends DefinitionState {
+
+        String name;
+
+        DefineState(GrammarSection section) {
+            super(section);
+        }
+
+        State create() {
+            return new DefineState(null);
+        }
+
+        @Override
+        void setName(String name) throws SAXException {
+            this.name = checkNCName(name);
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (name == null) {
+                error("missing_name_attribute");
+            }
+        }
+
+        @Override
+        void sendPatternToParent(ParsedPattern p) {
+            if (name != null) {
+                section.define(name, combine, p, startLocation, annotations);
+            }
+        }
     }
 
-    void sendPatternToParent(ParsedPattern p) {
-      parent.endChild(p);
-    }
-  }
+    class StartState extends DefinitionState {
 
-  class GroupState extends PatternContainerState {
-    State create() {
-      return new GroupState();
-    }
-  }
+        StartState(GrammarSection section) {
+            super(section);
+        }
 
-  class ZeroOrMoreState extends PatternContainerState {
-    State create() {
-      return new ZeroOrMoreState();
+        State create() {
+            return new StartState(null);
+        }
+
+        @Override
+        void sendPatternToParent(ParsedPattern p) {
+            section.define(GrammarSection.START, combine, p, startLocation, annotations);
+        }
+
+        @Override
+        State createChildState(String localName) throws SAXException {
+            State tem = super.createChildState(localName);
+            if (tem != null && childPatterns != null) {
+                error("start_multi_pattern");
+            }
+            return tem;
+        }
     }
 
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeZeroOrMore(super.buildPattern(patterns, loc, null), loc, anno);
-    }
-  }
+    abstract class NameClassContainerState extends State {
 
-  class OneOrMoreState extends PatternContainerState {
-    State create() {
-      return new OneOrMoreState();
-    }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeOneOrMore(super.buildPattern(patterns, loc, null), loc, anno);
-    }
-  }
-
-  class OptionalState extends PatternContainerState {
-    State create() {
-      return new OptionalState();
-    }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeOptional(super.buildPattern(patterns, loc, null), loc, anno);
-    }
-  }
-
-  class ListState extends PatternContainerState {
-    State create() {
-      return new ListState();
-    }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeList(super.buildPattern(patterns, loc, null), loc, anno);
-    }
-  }
-
-  class ChoiceState extends PatternContainerState {
-    State create() {
-      return new ChoiceState();
-    }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeChoice(patterns, loc, anno);
-    }
-  }
-
-  class InterleaveState extends PatternContainerState {
-    State create() {
-      return new InterleaveState();
-    }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) {
-      return schemaBuilder.makeInterleave(patterns, loc, anno);
-    }
-  }
-
-  class MixedState extends PatternContainerState {
-    State create() {
-      return new MixedState();
-    }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeMixed(super.buildPattern(patterns, loc, null), loc, anno);
-    }
-  }
-
-  static interface NameClassRef {
-    void setNameClass(ParsedNameClass nc);
-  }
-
-  class ElementState extends PatternContainerState implements NameClassRef {
-    ParsedNameClass nameClass;
-    boolean nameClassWasAttribute;
-    String name;
-
-    void setName(String name) {
-      this.name = name;
+        State createChildState(String localName) throws SAXException {
+            State state = (State) nameClassTable.get(localName);
+            if (state == null) {
+                error("expected_name_class", localName);
+                return null;
+            }
+            return state.create();
+        }
     }
 
-    public void setNameClass(ParsedNameClass nc) {
-      nameClass = nc;
+    class NameClassChildState extends NameClassContainerState {
+
+        final State prevState;
+        final NameClassRef nameClassRef;
+
+        State create() {
+            return null;
+        }
+
+        NameClassChildState(State prevState, NameClassRef nameClassRef) {
+            this.prevState = prevState;
+            this.nameClassRef = nameClassRef;
+            setParent(prevState.parent);
+            this.ns = prevState.ns;
+        }
+
+        @Override
+        void endChild(ParsedNameClass nameClass) {
+            nameClassRef.setNameClass(nameClass);
+            prevState.set();
+        }
+
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            prevState.endForeignChild(ea);
+        }
+
+        void end() throws SAXException {
+            nameClassRef.setNameClass(nameClassBuilder.makeErrorNameClass());
+            error("missing_name_class");
+            prevState.set();
+            prevState.end();
+        }
     }
 
-    void endAttributes() throws SAXException {
-      if (name != null) {
-        nameClass = expandName(name, getNs(), null);
-        nameClassWasAttribute = true;
-      }
-      else
-        new NameClassChildState(this, this).set();
+    abstract class NameClassBaseState extends State {
+
+        abstract ParsedNameClass makeNameClass() throws SAXException;
+
+        void end() throws SAXException {
+            parent.endChild(makeNameClass());
+        }
     }
 
-    State create() {
-      return new ElementState();
+    class NameState extends NameClassBaseState {
+
+        final StringBuffer buf = new StringBuffer();
+
+        State createChildState(String localName) throws SAXException {
+            error("expected_name", localName);
+            return null;
+        }
+
+        State create() {
+            return new NameState();
+        }
+
+        @Override
+        public void characters(char[] ch, int start, int len) {
+            buf.append(ch, start, len);
+        }
+
+        @Override
+        void checkForeignElement() throws SAXException {
+            error("name_contains_foreign_element");
+        }
+
+        ParsedNameClass makeNameClass() throws SAXException {
+            mergeLeadingComments();
+            return expandName(buf.toString().trim(), getNs(), annotations);
+        }
+    }
+    private static final int PATTERN_CONTEXT = 0;
+    private static final int ANY_NAME_CONTEXT = 1;
+    private static final int NS_NAME_CONTEXT = 2;
+    private SAXParseable parseable;
+
+    class AnyNameState extends NameClassBaseState {
+
+        ParsedNameClass except = null;
+
+        State create() {
+            return new AnyNameState();
+        }
+
+        State createChildState(String localName) throws SAXException {
+            if (localName.equals("except")) {
+                if (except != null) {
+                    error("multiple_except");
+                }
+                return new NameClassChoiceState(getContext());
+            }
+            error("expected_except", localName);
+            return null;
+        }
+
+        int getContext() {
+            return ANY_NAME_CONTEXT;
+        }
+
+        ParsedNameClass makeNameClass() {
+            if (except == null) {
+                return makeNameClassNoExcept();
+            } else {
+                return makeNameClassExcept(except);
+            }
+        }
+
+        ParsedNameClass makeNameClassNoExcept() {
+            return nameClassBuilder.makeAnyName(startLocation, annotations);
+        }
+
+        ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
+            return nameClassBuilder.makeAnyName(except, startLocation, annotations);
+        }
+
+        @Override
+        void endChild(ParsedNameClass nameClass) {
+            except = nameClass;
+        }
     }
 
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeElement(nameClass, super.buildPattern(patterns, loc, null), loc, anno);
+    class NsNameState extends AnyNameState {
+
+        @Override
+        State create() {
+            return new NsNameState();
+        }
+
+        @Override
+        ParsedNameClass makeNameClassNoExcept() {
+            return nameClassBuilder.makeNsName(getNs(), null, null);
+        }
+
+        @Override
+        ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
+            return nameClassBuilder.makeNsName(getNs(), except, null, null);
+        }
+
+        @Override
+        int getContext() {
+            return NS_NAME_CONTEXT;
+        }
     }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      if (nameClassWasAttribute || childPatterns!=null || nameClass == null)
-        super.endForeignChild(ea);
-      else
-        nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
-    }
-  }
+    class NameClassChoiceState extends NameClassContainerState {
 
-  class RootState extends PatternContainerState {
-    IncludedGrammar grammar;
+        private ParsedNameClass[] nameClasses;
+        private int nNameClasses;
+        private int context;
 
-    RootState() {
+        NameClassChoiceState() {
+            this.context = PATTERN_CONTEXT;
+        }
+
+        NameClassChoiceState(int context) {
+            this.context = context;
+        }
+
+        @Override
+        void setParent(State parent) {
+            super.setParent(parent);
+            if (parent instanceof NameClassChoiceState) {
+                this.context = ((NameClassChoiceState) parent).context;
+            }
+        }
+
+        State create() {
+            return new NameClassChoiceState();
+        }
+
+        @Override
+        State createChildState(String localName) throws SAXException {
+            if (localName.equals("anyName")) {
+                if (context >= ANY_NAME_CONTEXT) {
+                    error(context == ANY_NAME_CONTEXT
+                            ? "any_name_except_contains_any_name"
+                            : "ns_name_except_contains_any_name");
+                    return null;
+                }
+            } else if (localName.equals("nsName")) {
+                if (context == NS_NAME_CONTEXT) {
+                    error("ns_name_except_contains_ns_name");
+                    return null;
+                }
+            }
+            return super.createChildState(localName);
+        }
+
+        @Override
+        void endChild(ParsedNameClass nc) {
+            if (nameClasses == null) {
+                nameClasses = new ParsedNameClass[INIT_CHILD_ALLOC];
+            } else if (nNameClasses >= nameClasses.length) {
+                ParsedNameClass[] newNameClasses = new ParsedNameClass[nameClasses.length * 2];
+                System.arraycopy(nameClasses, 0, newNameClasses, 0, nameClasses.length);
+                nameClasses = newNameClasses;
+            }
+            nameClasses[nNameClasses++] = nc;
+        }
+
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            if (nNameClasses == 0) {
+                super.endForeignChild(ea);
+            } else {
+                nameClasses[nNameClasses - 1] = nameClassBuilder.annotateAfter(nameClasses[nNameClasses - 1], ea);
+            }
+        }
+
+        void end() throws SAXException {
+            if (nNameClasses == 0) {
+                error("missing_name_class");
+                parent.endChild(nameClassBuilder.makeErrorNameClass());
+                return;
+            }
+            if (comments != null) {
+                nameClasses[nNameClasses - 1] = nameClassBuilder.commentAfter(nameClasses[nNameClasses - 1], comments);
+                comments = null;
+            }
+            parent.endChild(nameClassBuilder.makeChoice(Arrays.asList(nameClasses).subList(0, nNameClasses), startLocation, annotations));
+        }
     }
 
-    RootState(IncludedGrammar grammar, Scope scope, String ns) {
-      this.grammar = grammar;
-      this.scope = scope;
-      this.nsInherit = ns;
-      this.datatypeLibrary = "";
+    private void initPatternTable() {
+        patternTable = new Hashtable();
+        patternTable.put("zeroOrMore", new ZeroOrMoreState());
+        patternTable.put("oneOrMore", new OneOrMoreState());
+        patternTable.put("optional", new OptionalState());
+        patternTable.put("list", new ListState());
+        patternTable.put("choice", new ChoiceState());
+        patternTable.put("interleave", new InterleaveState());
+        patternTable.put("group", new GroupState());
+        patternTable.put("mixed", new MixedState());
+        patternTable.put("element", new ElementState());
+        patternTable.put("attribute", new AttributeState());
+        patternTable.put("empty", new EmptyState());
+        patternTable.put("text", new TextState());
+        patternTable.put("value", new ValueState());
+        patternTable.put("data", new DataState());
+        patternTable.put("notAllowed", new NotAllowedState());
+        patternTable.put("grammar", new GrammarState());
+        patternTable.put("ref", new RefState());
+        patternTable.put("parentRef", new ParentRefState());
+        patternTable.put("externalRef", new ExternalRefState());
     }
 
-    State create() {
-      return new RootState();
+    private void initNameClassTable() {
+        nameClassTable = new Hashtable();
+        nameClassTable.put("name", new NameState());
+        nameClassTable.put("anyName", new AnyNameState());
+        nameClassTable.put("nsName", new NsNameState());
+        nameClassTable.put("choice", new NameClassChoiceState());
     }
 
-    State createChildState(String localName) throws SAXException {
-      if (grammar == null)
-        return super.createChildState(localName);
-      if (localName.equals("grammar"))
-        return new MergeGrammarState(grammar);
-      error("expected_grammar", localName);
-      return null;
+    public ParsedPattern getParsedPattern() throws IllegalSchemaException {
+        if (hadError) {
+            throw new IllegalSchemaException();
+        }
+        return startPattern;
     }
 
-    void checkForeignElement() throws SAXException {
-      error("root_bad_namespace_uri", WellKnownNamespaces.RELAX_NG);
+    private void error(String key) throws SAXException {
+        error(key, locator);
     }
 
-    void endChild(ParsedPattern pattern) {
-      startPattern = pattern;
+    private void error(String key, String arg) throws SAXException {
+        error(key, arg, locator);
     }
 
-    boolean isRelaxNGElement(String uri) throws SAXException {
-      if (!uri.startsWith(relaxngURIPrefix))
-        return false;
-      if (!uri.equals(WellKnownNamespaces.RELAX_NG))
-        warning("wrong_uri_version",
-                WellKnownNamespaces.RELAX_NG.substring(relaxngURIPrefix.length()),
-                uri.substring(relaxngURIPrefix.length()));
-      relaxngURI = uri;
-      return true;
+    void error(String key, String arg1, String arg2) throws SAXException {
+        error(key, arg1, arg2, locator);
     }
 
-  }
-
-  class NotAllowedState extends EmptyContentState {
-    State create() {
-      return new NotAllowedState();
+    private void error(String key, Locator loc) throws SAXException {
+        error(new SAXParseException(localizer.message(key), loc));
     }
 
-    ParsedPattern makePattern() {
-      return schemaBuilder.makeNotAllowed(startLocation, annotations);
-    }
-  }
-
-  class EmptyState extends EmptyContentState {
-    State create() {
-      return new EmptyState();
+    private void error(String key, String arg, Locator loc) throws SAXException {
+        error(new SAXParseException(localizer.message(key, arg), loc));
     }
 
-    ParsedPattern makePattern() {
-      return schemaBuilder.makeEmpty(startLocation, annotations);
-    }
-  }
-
-  class TextState extends EmptyContentState {
-    State create() {
-      return new TextState();
+    private void error(String key, String arg1, String arg2, Locator loc)
+            throws SAXException {
+        error(new SAXParseException(localizer.message(key, arg1, arg2), loc));
     }
 
-    ParsedPattern makePattern() {
-      return schemaBuilder.makeText(startLocation, annotations);
-    }
-  }
-
-  class ValueState extends EmptyContentState {
-    final StringBuffer buf = new StringBuffer();
-    String type;
-
-    State create() {
-      return new ValueState();
+    private void error(SAXParseException e) throws SAXException {
+        hadError = true;
+        if (eh != null) {
+            eh.error(e);
+        }
     }
 
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("type"))
-        type = checkNCName(value.trim());
-      else
-        super.setOtherAttribute(name, value);
+    void warning(String key) throws SAXException {
+        warning(key, locator);
     }
 
-    public void characters(char[] ch, int start, int len) {
-      buf.append(ch, start, len);
+    private void warning(String key, String arg) throws SAXException {
+        warning(key, arg, locator);
     }
 
-    void checkForeignElement() throws SAXException {
-      error("value_contains_foreign_element");
+    private void warning(String key, String arg1, String arg2) throws SAXException {
+        warning(key, arg1, arg2, locator);
     }
 
-    ParsedPattern makePattern() throws SAXException {
-      if (type == null)
-        return makePattern("", "token");
-      else
-        return makePattern(datatypeLibrary, type);
+    private void warning(String key, Locator loc) throws SAXException {
+        warning(new SAXParseException(localizer.message(key), loc));
     }
 
-    void end() throws SAXException {
-      mergeLeadingComments();
-      super.end();
+    private void warning(String key, String arg, Locator loc) throws SAXException {
+        warning(new SAXParseException(localizer.message(key, arg), loc));
     }
 
-    ParsedPattern makePattern(String datatypeLibrary, String type) {
-      return schemaBuilder.makeValue(datatypeLibrary,
-                                     type,
-                                     buf.toString(),
-                                     getContext(),
-                                     getNs(),
-                                     startLocation,
-                                     annotations);
+    private void warning(String key, String arg1, String arg2, Locator loc)
+            throws SAXException {
+        warning(new SAXParseException(localizer.message(key, arg1, arg2), loc));
     }
 
-  }
-
-  class DataState extends State {
-    String type;
-    ParsedPattern except = null;
-    DataPatternBuilder dpb = null;
-
-    State create() {
-      return new DataState();
+    private void warning(SAXParseException e) throws SAXException {
+        if (eh != null) {
+            eh.warning(e);
+        }
     }
 
-    State createChildState(String localName) throws SAXException {
-      if (localName.equals("param")) {
-        if (except != null)
-          error("param_after_except");
-        return new ParamState(dpb);
-      }
-      if (localName.equals("except")) {
-        if (except != null)
-          error("multiple_except");
-        return new ChoiceState();
-      }
-      error("expected_param_except", localName);
-      return null;
+    SchemaParser(SAXParseable parseable,
+            XMLReader xr,
+            ErrorHandler eh,
+            SchemaBuilder schemaBuilder,
+            IncludedGrammar grammar,
+            Scope scope,
+            String inheritedNs) throws SAXException {
+        this.parseable = parseable;
+        this.xr = xr;
+        this.eh = eh;
+        this.schemaBuilder = schemaBuilder;
+        this.nameClassBuilder = schemaBuilder.getNameClassBuilder();
+        if (eh != null) {
+            xr.setErrorHandler(eh);
+        }
+        xr.setDTDHandler(context);
+        if (schemaBuilder.usesComments()) {
+            try {
+                xr.setProperty("http://xml.org/sax/properties/lexical-handler", new LexicalHandlerImpl());
+            } catch (SAXNotRecognizedException e) {
+                warning("no_comment_support", xr.getClass().getName());
+            } catch (SAXNotSupportedException e) {
+                warning("no_comment_support", xr.getClass().getName());
+            }
+        }
+        initPatternTable();
+        initNameClassTable();
+        new RootState(grammar, scope, inheritedNs).set();
     }
 
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("type"))
-        type = checkNCName(value.trim());
-      else
-        super.setOtherAttribute(name, value);
+    private Context getContext() {
+        return context;
     }
 
-    void endAttributes() throws SAXException {
-      if (type == null)
-        error("missing_type_attribute");
-      else
-        dpb = schemaBuilder.makeDataPatternBuilder(datatypeLibrary, type, startLocation);
+    class LexicalHandlerImpl extends AbstractLexicalHandler {
+
+        private boolean inDtd = false;
+
+        @Override
+        public void startDTD(String s, String s1, String s2) throws SAXException {
+            inDtd = true;
+        }
+
+        @Override
+        public void endDTD() throws SAXException {
+            inDtd = false;
+        }
+
+        @Override
+        public void comment(char[] chars, int start, int length) throws SAXException {
+            if (!inDtd) {
+                ((CommentHandler) xr.getContentHandler()).comment(new String(chars, start, length));
+            }
+        }
     }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      dpb.annotation(ea);
+    private ParsedNameClass expandName(String name, String ns, Annotations anno) throws SAXException {
+        int ic = name.indexOf(':');
+        if (ic == -1) {
+            return nameClassBuilder.makeName(ns, checkNCName(name), null, null, anno);
+        }
+        String prefix = checkNCName(name.substring(0, ic));
+        String localName = checkNCName(name.substring(ic + 1));
+        for (PrefixMapping tem = context.prefixMapping; tem != null; tem = tem.next) {
+            if (tem.prefix.equals(prefix)) {
+                return nameClassBuilder.makeName(tem.uri, localName, prefix, null, anno);
+            }
+        }
+        error("undefined_prefix", prefix);
+        return nameClassBuilder.makeName("", localName, null, null, anno);
     }
 
-    void end() throws SAXException {
-      ParsedPattern p;
-      if (dpb != null) {
-        if (except != null)
-          p = dpb.makePattern(except, startLocation, annotations);
-        else
-          p = dpb.makePattern(startLocation, annotations);
-      }
-      else
-        p = schemaBuilder.makeErrorPattern();
-      // XXX need to capture comments
-      parent.endChild(p);
+    private String findPrefix(String qName, String uri) {
+        String prefix = null;
+        if (qName == null || qName.equals("")) {
+            for (PrefixMapping p = context.prefixMapping; p != null; p = p.next) {
+                if (p.uri.equals(uri)) {
+                    prefix = p.prefix;
+                    break;
+                }
+            }
+        } else {
+            int off = qName.indexOf(':');
+            if (off > 0) {
+                prefix = qName.substring(0, off);
+            }
+        }
+        return prefix;
     }
 
-    void endChild(ParsedPattern pattern) {
-      except = pattern;
+    private String checkNCName(String str) throws SAXException {
+        if (!Naming.isNcname(str)) {
+            error("invalid_ncname", str);
+        }
+        return str;
     }
 
-  }
-
-  class ParamState extends State {
-    private final StringBuffer buf = new StringBuffer();
-    private final DataPatternBuilder dpb;
-    private String name;
-
-    ParamState(DataPatternBuilder dpb) {
-      this.dpb = dpb;
+    private String resolve(String systemId) throws SAXException {
+        if (Uri.hasFragmentId(systemId)) {
+            error("href_fragment_id");
+        }
+        systemId = Uri.escapeDisallowedChars(systemId);
+        return Uri.resolve(xmlBaseHandler.getBaseUri(), systemId);
     }
 
-    State create() {
-      return new ParamState(null);
+    private Location makeLocation() {
+        if (locator == null) {
+            return null;
+        }
+        return schemaBuilder.makeLocation(locator.getSystemId(),
+                locator.getLineNumber(),
+                locator.getColumnNumber());
     }
 
-    void setName(String name) throws SAXException {
-      this.name = checkNCName(name);
-    }
-
-    void endAttributes() throws SAXException {
-      if (name == null)
-        error("missing_name_attribute");
-    }
-
-    State createChildState(String localName) throws SAXException {
-      error("expected_empty", localName);
-      return null;
-    }
-
-    public void characters(char[] ch, int start, int len) {
-      buf.append(ch, start, len);
-    }
-
-    void checkForeignElement() throws SAXException {
-      error("param_contains_foreign_element");
-    }
-
-    void end() throws SAXException {
-      if (name == null)
-        return;
-      if (dpb == null)
-        return;
-      mergeLeadingComments();
-      dpb.addParam(name, buf.toString(), getContext(), getNs(), startLocation, annotations);
-    }
-  }
-
-  class AttributeState extends PatternContainerState implements NameClassRef {
-    ParsedNameClass nameClass;
-    boolean nameClassWasAttribute;
-    String name;
-
-    State create() {
-      return new AttributeState();
-    }
-
-    void setName(String name) {
-      this.name = name;
-    }
-
-    public void setNameClass(ParsedNameClass nc) {
-      nameClass = nc;
-    }
-
-    void endAttributes() throws SAXException {
-      if (name != null) {
-        String nsUse;
-        if (ns != null)
-          nsUse = ns;
-        else
-          nsUse = "";
-        nameClass = expandName(name, nsUse, null);
-        nameClassWasAttribute = true;
-      }
-      else
-        new NameClassChildState(this, this).set();
-    }
-
-    void endForeignChild(ParsedElementAnnotation ea) {
-      if (nameClassWasAttribute || childPatterns!=null || nameClass == null)
-        super.endForeignChild(ea);
-      else
-        nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
-    }
-
-    void end() throws SAXException {
-      if (childPatterns == null)
-        endChild(schemaBuilder.makeText(startLocation, null));
-      super.end();
-    }
-
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeAttribute(nameClass, super.buildPattern(patterns, loc, null), loc, anno);
-    }
-
-    State createChildState(String localName) throws SAXException {
-      State tem = super.createChildState(localName);
-      if (tem != null && childPatterns!=null)
-        error("attribute_multi_pattern");
-      return tem;
-    }
-
-  }
-
-  abstract class SinglePatternContainerState extends PatternContainerState {
-    State createChildState(String localName) throws SAXException {
-      if (childPatterns==null)
-        return super.createChildState(localName);
-      error("too_many_children");
-      return null;
-    }
-  }
-
-  class GrammarSectionState extends State {
-    GrammarSection section;
-
-    GrammarSectionState() { }
-
-    GrammarSectionState(GrammarSection section) {
-      this.section = section;
-    }
-
-    State create() {
-      return new GrammarSectionState(null);
-    }
-
-    State createChildState(String localName) throws SAXException {
-      if (localName.equals("define"))
-        return new DefineState(section);
-      if (localName.equals("start"))
-        return new StartState(section);
-      if (localName.equals("include")) {
-        Include include = section.makeInclude();
-        if (include != null)
-          return new IncludeState(include);
-      }
-      if (localName.equals("div"))
-        return new DivState(section.makeDiv());
-      error("expected_define", localName);
-      // XXX better errors
-      return null;
-    }
-
-    void end() throws SAXException {
-      if (comments != null) {
-        section.topLevelComment(comments);
-        comments = null;
-      }
-    }
-
-    void endForeignChild(ParsedElementAnnotation ea) {
-      section.topLevelAnnotation(ea);
-    }
-  }
-
-  class DivState extends GrammarSectionState {
-    final Div div;
-    DivState(Div div) {
-      super(div);
-      this.div = div;
-    }
-
-    void end() throws SAXException {
-      super.end();
-      div.endDiv(startLocation, annotations);
-    }
-  }
-
-  class IncludeState extends GrammarSectionState {
-    String href;
-    final Include include;
-
-    IncludeState(Include include) {
-      super(include);
-      this.include = include;
-    }
-
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("href")) {
-        href = value;
-        checkUri(href);
-      }
-      else
-        super.setOtherAttribute(name, value);
-    }
-
-    void endAttributes() throws SAXException {
-      if (href == null)
-        error("missing_href_attribute");
-      else
-        href = resolve(href);
-    }
-
-    void end() throws SAXException {
-      super.end();
-      if (href != null) {
-        try {
-          include.endInclude(parseable, href, getNs(), startLocation, annotations);
-        }
-        catch (IllegalSchemaException e) {
-        }
-      }
-    }
-  }
-
-  class MergeGrammarState extends GrammarSectionState {
-    final IncludedGrammar grammar;
-    MergeGrammarState(IncludedGrammar grammar) {
-      super(grammar);
-      this.grammar = grammar;
-    }
-
-    void end() throws SAXException {
-      super.end();
-      parent.endChild(grammar.endIncludedGrammar(startLocation, annotations));
-    }
-  }
-
-  class GrammarState extends GrammarSectionState {
-    Grammar grammar;
-
-    void setParent(State parent) {
-      super.setParent(parent);
-      grammar = schemaBuilder.makeGrammar(scope);
-      section = grammar;
-      scope = grammar;
-    }
-
-    State create() {
-      return new GrammarState();
-    }
-
-    void end() throws SAXException {
-      super.end();
-      parent.endChild(grammar.endGrammar(startLocation, annotations));
-    }
-  }
-
-  class RefState extends EmptyContentState {
-    String name;
-
-    State create() {
-      return new RefState();
-    }
-
-
-    void endAttributes() throws SAXException {
-      if (name == null)
-        error("missing_name_attribute");
-    }
-
-    void setName(String name) throws SAXException {
-      this.name = checkNCName(name);
-    }
-
-    ParsedPattern makePattern() throws SAXException {
-      if (name == null)
-        return schemaBuilder.makeErrorPattern();
-      if(scope==null) {
-          error("ref_outside_grammar",name);
-          return schemaBuilder.makeErrorPattern();
-      } else
-          return scope.makeRef(name, startLocation, annotations);
-    }
-  }
-
-  class ParentRefState extends RefState {
-    State create() {
-      return new ParentRefState();
-    }
-
-    ParsedPattern makePattern() throws SAXException {
-      if (name == null)
-        return schemaBuilder.makeErrorPattern();
-      if(scope==null) {
-        error("parent_ref_outside_grammar",name);
-        return schemaBuilder.makeErrorPattern();
-      } else
-        return scope.makeParentRef(name, startLocation, annotations);
-    }
-  }
-
-  class ExternalRefState extends EmptyContentState {
-    String href;
-    ParsedPattern includedPattern;
-
-    State create() {
-      return new ExternalRefState();
-    }
-
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("href")) {
-        href = value;
-        checkUri(href);
-      }
-      else
-        super.setOtherAttribute(name, value);
-    }
-
-    void endAttributes() throws SAXException {
-      if (href == null)
-        error("missing_href_attribute");
-      else
-        href = resolve(href);
-    }
-
-    ParsedPattern makePattern() {
-      if (href != null) {
-        try {
-          return schemaBuilder.makeExternalRef(parseable,
-                                               href,
-                                               getNs(),
-                                               scope,
-                                               startLocation,
-                                               annotations);
-        }
-        catch (IllegalSchemaException e) { }
-      }
-      return schemaBuilder.makeErrorPattern();
-    }
-  }
-
-  abstract class DefinitionState extends PatternContainerState {
-    GrammarSection.Combine combine = null;
-    final GrammarSection section;
-
-    DefinitionState(GrammarSection section) {
-      this.section = section;
-    }
-
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("combine")) {
-        value = value.trim();
-        if (value.equals("choice"))
-          combine = GrammarSection.COMBINE_CHOICE;
-        else if (value.equals("interleave"))
-          combine = GrammarSection.COMBINE_INTERLEAVE;
-        else
-          error("combine_attribute_bad_value", value);
-      }
-      else
-        super.setOtherAttribute(name, value);
-    }
-
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return super.buildPattern(patterns, loc, null);
-    }
-  }
-
-  class DefineState extends DefinitionState {
-    String name;
-
-    DefineState(GrammarSection section) {
-      super(section);
-    }
-
-    State create() {
-      return new DefineState(null);
-    }
-
-    void setName(String name) throws SAXException {
-      this.name = checkNCName(name);
-    }
-
-    void endAttributes() throws SAXException {
-      if (name == null)
-        error("missing_name_attribute");
-    }
-
-    void sendPatternToParent(ParsedPattern p) {
-      if (name != null)
-        section.define(name, combine, p, startLocation, annotations);
-    }
-
-  }
-
-  class StartState extends DefinitionState {
-
-    StartState(GrammarSection section) {
-      super(section);
-    }
-
-    State create() {
-      return new StartState(null);
-    }
-
-    void sendPatternToParent(ParsedPattern p) {
-      section.define(GrammarSection.START, combine, p, startLocation, annotations);
-    }
-
-    State createChildState(String localName) throws SAXException {
-      State tem = super.createChildState(localName);
-      if (tem != null && childPatterns!=null)
-        error("start_multi_pattern");
-      return tem;
-    }
-
-  }
-
-  abstract class NameClassContainerState extends State {
-    State createChildState(String localName) throws SAXException {
-      State state = (State)nameClassTable.get(localName);
-      if (state == null) {
-        error("expected_name_class", localName);
-        return null;
-      }
-      return state.create();
-    }
-  }
-
-  class NameClassChildState extends NameClassContainerState {
-    final State prevState;
-    final NameClassRef nameClassRef;
-
-    State create() {
-      return null;
-    }
-
-    NameClassChildState(State prevState, NameClassRef nameClassRef) {
-      this.prevState = prevState;
-      this.nameClassRef = nameClassRef;
-      setParent(prevState.parent);
-      this.ns = prevState.ns;
-    }
-
-    void endChild(ParsedNameClass nameClass) {
-      nameClassRef.setNameClass(nameClass);
-      prevState.set();
-    }
-
-    void endForeignChild(ParsedElementAnnotation ea) {
-      prevState.endForeignChild(ea);
-    }
-
-    void end() throws SAXException {
-      nameClassRef.setNameClass(nameClassBuilder.makeErrorNameClass());
-      error("missing_name_class");
-      prevState.set();
-      prevState.end();
-    }
-  }
-
-  abstract class NameClassBaseState extends State {
-
-    abstract ParsedNameClass makeNameClass() throws SAXException;
-
-    void end() throws SAXException {
-      parent.endChild(makeNameClass());
-    }
-  }
-
-  class NameState extends NameClassBaseState {
-    final StringBuffer buf = new StringBuffer();
-
-    State createChildState(String localName) throws SAXException {
-      error("expected_name", localName);
-      return null;
-    }
-
-    State create() {
-      return new NameState();
-    }
-
-    public void characters(char[] ch, int start, int len) {
-      buf.append(ch, start, len);
-    }
-
-    void checkForeignElement() throws SAXException {
-      error("name_contains_foreign_element");
-    }
-
-    ParsedNameClass makeNameClass() throws SAXException {
-      mergeLeadingComments();
-      return expandName(buf.toString().trim(), getNs(), annotations);
-    }
-
-  }
-
-  private static final int PATTERN_CONTEXT = 0;
-  private static final int ANY_NAME_CONTEXT = 1;
-  private static final int NS_NAME_CONTEXT = 2;
-private SAXParseable parseable;
-
-  class AnyNameState extends NameClassBaseState {
-    ParsedNameClass except = null;
-
-    State create() {
-      return new AnyNameState();
-    }
-
-    State createChildState(String localName) throws SAXException {
-      if (localName.equals("except")) {
-        if (except != null)
-          error("multiple_except");
-        return new NameClassChoiceState(getContext());
-      }
-      error("expected_except", localName);
-      return null;
-    }
-
-    int getContext() {
-      return ANY_NAME_CONTEXT;
-    }
-
-    ParsedNameClass makeNameClass() {
-      if (except == null)
-        return makeNameClassNoExcept();
-      else
-        return makeNameClassExcept(except);
-    }
-
-    ParsedNameClass makeNameClassNoExcept() {
-      return nameClassBuilder.makeAnyName(startLocation, annotations);
-    }
-
-    ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
-      return nameClassBuilder.makeAnyName(except, startLocation, annotations);
-    }
-
-    void endChild(ParsedNameClass nameClass) {
-      except = nameClass;
-    }
-
-  }
-
-  class NsNameState extends AnyNameState {
-    State create() {
-      return new NsNameState();
-    }
-
-    ParsedNameClass makeNameClassNoExcept() {
-      return nameClassBuilder.makeNsName(getNs(), null, null);
-    }
-
-    ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
-      return nameClassBuilder.makeNsName(getNs(), except, null, null);
-    }
-
-    int getContext() {
-      return NS_NAME_CONTEXT;
-    }
-
-  }
-
-  class NameClassChoiceState extends NameClassContainerState {
-    private ParsedNameClass[] nameClasses;
-    private int nNameClasses;
-    private int context;
-
-    NameClassChoiceState() {
-      this.context = PATTERN_CONTEXT;
-    }
-
-    NameClassChoiceState(int context) {
-      this.context = context;
-    }
-
-    void setParent(State parent) {
-      super.setParent(parent);
-      if (parent instanceof NameClassChoiceState)
-        this.context = ((NameClassChoiceState)parent).context;
-    }
-
-    State create() {
-      return new NameClassChoiceState();
-    }
-
-    State createChildState(String localName) throws SAXException {
-      if (localName.equals("anyName")) {
-        if (context >= ANY_NAME_CONTEXT) {
-          error(context == ANY_NAME_CONTEXT
-                ? "any_name_except_contains_any_name"
-                : "ns_name_except_contains_any_name");
-          return null;
-        }
-      }
-      else if (localName.equals("nsName")) {
-        if (context == NS_NAME_CONTEXT) {
-          error("ns_name_except_contains_ns_name");
-          return null;
-        }
-      }
-      return super.createChildState(localName);
-    }
-
-    void endChild(ParsedNameClass nc) {
-      if (nameClasses == null)
-        nameClasses = new ParsedNameClass[INIT_CHILD_ALLOC];
-      else if (nNameClasses >= nameClasses.length) {
-        ParsedNameClass[] newNameClasses = new ParsedNameClass[nameClasses.length * 2];
-        System.arraycopy(nameClasses, 0, newNameClasses, 0, nameClasses.length);
-        nameClasses = newNameClasses;
-      }
-      nameClasses[nNameClasses++] = nc;
-    }
-
-    void endForeignChild(ParsedElementAnnotation ea) {
-      if (nNameClasses == 0)
-        super.endForeignChild(ea);
-      else
-        nameClasses[nNameClasses - 1] = nameClassBuilder.annotateAfter(nameClasses[nNameClasses - 1], ea);
-    }
-
-    void end() throws SAXException {
-      if (nNameClasses == 0) {
-        error("missing_name_class");
-        parent.endChild(nameClassBuilder.makeErrorNameClass());
-        return;
-      }
-      if (comments != null) {
-        nameClasses[nNameClasses - 1] = nameClassBuilder.commentAfter(nameClasses[nNameClasses - 1], comments);
-        comments = null;
-      }
-      parent.endChild(nameClassBuilder.makeChoice(Arrays.asList(nameClasses).subList(0,nNameClasses), startLocation, annotations));
-    }
-  }
-
-  private void initPatternTable() {
-    patternTable = new Hashtable();
-    patternTable.put("zeroOrMore", new ZeroOrMoreState());
-    patternTable.put("oneOrMore", new OneOrMoreState());
-    patternTable.put("optional", new OptionalState());
-    patternTable.put("list", new ListState());
-    patternTable.put("choice", new ChoiceState());
-    patternTable.put("interleave", new InterleaveState());
-    patternTable.put("group", new GroupState());
-    patternTable.put("mixed", new MixedState());
-    patternTable.put("element", new ElementState());
-    patternTable.put("attribute", new AttributeState());
-    patternTable.put("empty", new EmptyState());
-    patternTable.put("text", new TextState());
-    patternTable.put("value", new ValueState());
-    patternTable.put("data", new DataState());
-    patternTable.put("notAllowed", new NotAllowedState());
-    patternTable.put("grammar", new GrammarState());
-    patternTable.put("ref", new RefState());
-    patternTable.put("parentRef", new ParentRefState());
-    patternTable.put("externalRef", new ExternalRefState());
-  }
-
-  private void initNameClassTable() {
-    nameClassTable = new Hashtable();
-    nameClassTable.put("name", new NameState());
-    nameClassTable.put("anyName", new AnyNameState());
-    nameClassTable.put("nsName", new NsNameState());
-    nameClassTable.put("choice", new NameClassChoiceState());
-  }
-
-  public ParsedPattern getParsedPattern() throws IllegalSchemaException {
-    if (hadError)
-      throw new IllegalSchemaException();
-    return startPattern;
-  }
-
-  private void error(String key) throws SAXException {
-    error(key, locator);
-  }
-
-  private void error(String key, String arg) throws SAXException {
-    error(key, arg, locator);
-  }
-
-  void error(String key, String arg1, String arg2) throws SAXException {
-    error(key, arg1, arg2, locator);
-  }
-
-  private void error(String key, Locator loc) throws SAXException {
-    error(new SAXParseException(localizer.message(key), loc));
-  }
-
-  private void error(String key, String arg, Locator loc) throws SAXException {
-    error(new SAXParseException(localizer.message(key, arg), loc));
-  }
-
-  private void error(String key, String arg1, String arg2, Locator loc)
-    throws SAXException {
-    error(new SAXParseException(localizer.message(key, arg1, arg2), loc));
-  }
-
-  private void error(SAXParseException e) throws SAXException {
-    hadError = true;
-    if (eh != null)
-      eh.error(e);
-  }
-
-  void warning(String key) throws SAXException {
-    warning(key, locator);
-  }
-
-  private void warning(String key, String arg) throws SAXException {
-    warning(key, arg, locator);
-  }
-
-  private void warning(String key, String arg1, String arg2) throws SAXException {
-    warning(key, arg1, arg2, locator);
-  }
-
-  private void warning(String key, Locator loc) throws SAXException {
-    warning(new SAXParseException(localizer.message(key), loc));
-  }
-
-  private void warning(String key, String arg, Locator loc) throws SAXException {
-    warning(new SAXParseException(localizer.message(key, arg), loc));
-  }
-
-  private void warning(String key, String arg1, String arg2, Locator loc)
-    throws SAXException {
-    warning(new SAXParseException(localizer.message(key, arg1, arg2), loc));
-  }
-
-  private void warning(SAXParseException e) throws SAXException {
-    if (eh != null)
-      eh.warning(e);
-  }
-
-  SchemaParser(SAXParseable parseable,
-               XMLReader xr,
-               ErrorHandler eh,
-               SchemaBuilder schemaBuilder,
-               IncludedGrammar grammar,
-               Scope scope,
-               String inheritedNs) throws SAXException {
-    this.parseable = parseable;
-    this.xr = xr;
-    this.eh = eh;
-    this.schemaBuilder = schemaBuilder;
-    this.nameClassBuilder = schemaBuilder.getNameClassBuilder();
-    if (eh != null)
-      xr.setErrorHandler(eh);
-    xr.setDTDHandler(context);
-    if (schemaBuilder.usesComments()) {
-      try {
-        xr.setProperty("http://xml.org/sax/properties/lexical-handler", new LexicalHandlerImpl());
-      }
-      catch (SAXNotRecognizedException e) {
-        warning("no_comment_support", xr.getClass().getName());
-      }
-      catch (SAXNotSupportedException e) {
-        warning("no_comment_support", xr.getClass().getName());
-      }
-    }
-    initPatternTable();
-    initNameClassTable();
-    new RootState(grammar, scope, inheritedNs).set();
-  }
-
-
-  private Context getContext() {
-    return context;
-  }
-
-  class LexicalHandlerImpl extends AbstractLexicalHandler {
-    private boolean inDtd = false;
-
-    public void startDTD(String s, String s1, String s2) throws SAXException {
-      inDtd = true;
-    }
-
-    public void endDTD() throws SAXException {
-      inDtd = false;
-    }
-
-    public void comment(char[] chars, int start, int length) throws SAXException {
-      if (!inDtd)
-        ((CommentHandler)xr.getContentHandler()).comment(new String(chars, start, length));
-    }
-  }
-
-  private ParsedNameClass expandName(String name, String ns, Annotations anno) throws SAXException {
-    int ic = name.indexOf(':');
-    if (ic == -1)
-      return nameClassBuilder.makeName(ns, checkNCName(name), null, null, anno);
-    String prefix = checkNCName(name.substring(0, ic));
-    String localName = checkNCName(name.substring(ic + 1));
-    for (PrefixMapping tem = context.prefixMapping; tem != null; tem = tem.next)
-      if (tem.prefix.equals(prefix))
-        return nameClassBuilder.makeName(tem.uri, localName, prefix, null, anno);
-    error("undefined_prefix", prefix);
-    return nameClassBuilder.makeName("", localName, null, null, anno);
-  }
-
-  private String findPrefix(String qName, String uri) {
-    String prefix = null;
-    if (qName == null || qName.equals("")) {
-      for (PrefixMapping p = context.prefixMapping; p != null; p = p.next)
-        if (p.uri.equals(uri)) {
-          prefix = p.prefix;
-          break;
+    private void checkUri(String s) throws SAXException {
+        if (!Uri.isValid(s)) {
+            error("invalid_uri", s);
         }
     }
-    else {
-      int off = qName.indexOf(':');
-      if (off > 0)
-        prefix = qName.substring(0, off);
-    }
-    return prefix;
-  }
-  private String checkNCName(String str) throws SAXException {
-    if (!Naming.isNcname(str))
-      error("invalid_ncname", str);
-    return str;
-  }
-
-  private String resolve(String systemId) throws SAXException {
-    if (Uri.hasFragmentId(systemId))
-      error("href_fragment_id");
-    systemId = Uri.escapeDisallowedChars(systemId);
-    return Uri.resolve(xmlBaseHandler.getBaseUri(), systemId);
-  }
-
-  private Location makeLocation() {
-    if (locator == null)
-      return null;
-    return schemaBuilder.makeLocation(locator.getSystemId(),
-                                      locator.getLineNumber(),
-                                      locator.getColumnNumber());
-  }
-
-  private void checkUri(String s) throws SAXException {
-    if (!Uri.isValid(s))
-      error("invalid_uri", s);
-  }
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/xml/sax/JAXPXMLReaderCreator.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/rngom/xml/sax/JAXPXMLReaderCreator.java	Fri Oct 04 16:21:34 2013 +0100
@@ -23,7 +23,7 @@
  * questions.
  */
 /*
- * Copyright (C) 2004-2011
+ * Copyright (C) 2004-2012
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -45,10 +45,15 @@
  */
 package com.sun.xml.internal.rngom.xml.sax;
 
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.xml.XMLConstants;
 import javax.xml.parsers.ParserConfigurationException;
 import javax.xml.parsers.SAXParserFactory;
 
 import org.xml.sax.SAXException;
+import org.xml.sax.SAXNotRecognizedException;
+import org.xml.sax.SAXNotSupportedException;
 import org.xml.sax.XMLReader;
 
 /**
@@ -72,7 +77,16 @@
      */
     public JAXPXMLReaderCreator() {
         spf = SAXParserFactory.newInstance();
-        spf.setNamespaceAware(true);
+        try {
+            spf.setNamespaceAware(true);
+            spf.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
+        } catch (ParserConfigurationException ex) {
+            Logger.getLogger(JAXPXMLReaderCreator.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (SAXNotRecognizedException ex) {
+            Logger.getLogger(JAXPXMLReaderCreator.class.getName()).log(Level.SEVERE, null, ex);
+        } catch (SAXNotSupportedException ex) {
+            Logger.getLogger(JAXPXMLReaderCreator.class.getName()).log(Level.SEVERE, null, ex);
+        }
     }
 
     /**
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/WsaTubeHelper.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/WsaTubeHelper.java	Fri Oct 04 16:21:34 2013 +0100
@@ -40,7 +40,6 @@
 import com.sun.xml.internal.ws.api.model.SEIModel;
 import com.sun.xml.internal.ws.api.model.JavaMethod;
 import com.sun.xml.internal.ws.api.model.WSDLOperationMapping;
-import com.sun.xml.internal.ws.model.wsdl.WSDLOperationImpl;
 import com.sun.xml.internal.ws.model.JavaMethodImpl;
 import com.sun.xml.internal.ws.model.CheckedExceptionImpl;
 import com.sun.istack.internal.Nullable;
@@ -236,7 +235,7 @@
         }
         WSDLBoundOperation wbo = wsdlOp.getWSDLBoundOperation();
         WSDLOperation op = wbo.getOperation();
-        return ((WSDLOperationImpl) op).getInput().isDefaultAction();
+        return op.getInput().isDefaultAction();
 
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundOperation.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundOperation.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -27,9 +27,11 @@
 
 import com.sun.istack.internal.NotNull;
 import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.model.ParameterBinding;
 
 import javax.jws.WebParam.Mode;
 import javax.xml.namespace.QName;
+
 import java.util.Map;
 
 /**
@@ -79,14 +81,62 @@
     @Nullable WSDLPart getPart(@NotNull String partName, @NotNull Mode mode);
 
     /**
+     * Gets {@link ParameterBinding} for a given wsdl part in wsdl:input
+     *
+     * @param part Name of wsdl:part, must be non-null
+     * @return null if the part is not found.
+     */
+    public ParameterBinding getInputBinding(String part);
+
+    /**
+     * Gets {@link ParameterBinding} for a given wsdl part in wsdl:output
+     *
+     * @param part Name of wsdl:part, must be non-null
+     * @return null if the part is not found.
+     */
+    public ParameterBinding getOutputBinding(String part);
+
+    /**
+     * Gets {@link ParameterBinding} for a given wsdl part in wsdl:fault
+     *
+     * @param part Name of wsdl:part, must be non-null
+     * @return null if the part is not found.
+     */
+    public ParameterBinding getFaultBinding(String part);
+
+    /**
+     * Gets the MIME type for a given wsdl part in wsdl:input
+     *
+     * @param part Name of wsdl:part, must be non-null
+     * @return null if the part is not found.
+     */
+    public String getMimeTypeForInputPart(String part);
+
+    /**
+     * Gets the MIME type for a given wsdl part in wsdl:output
+     *
+     * @param part Name of wsdl:part, must be non-null
+     * @return null if the part is not found.
+     */
+    public String getMimeTypeForOutputPart(String part);
+
+    /**
+     * Gets the MIME type for a given wsdl part in wsdl:fault
+     *
+     * @param part Name of wsdl:part, must be non-null
+     * @return null if the part is not found.
+     */
+    public String getMimeTypeForFaultPart(String part);
+
+    /**
      * Gets all inbound {@link WSDLPart} by its {@link WSDLPart#getName() name}.
      */
-    @NotNull Map<String,WSDLPart> getInParts();
+    @NotNull Map<String,? extends WSDLPart> getInParts();
 
     /**
      * Gets all outbound {@link WSDLPart} by its {@link WSDLPart#getName() name}.
      */
-    @NotNull Map<String,WSDLPart> getOutParts();
+    @NotNull Map<String,? extends WSDLPart> getOutParts();
 
     /**
      * Gets all the {@link WSDLFault} bound to this operation.
@@ -94,13 +144,34 @@
     @NotNull Iterable<? extends WSDLBoundFault> getFaults();
 
     /**
+     * Map of wsdl:input part name and the binding as {@link ParameterBinding}
+     *
+     * @return empty Map if there is no parts
+     */
+    public Map<String, ParameterBinding> getInputParts();
+
+    /**
+     * Map of wsdl:output part name and the binding as {@link ParameterBinding}
+     *
+     * @return empty Map if there is no parts
+     */
+    public Map<String, ParameterBinding> getOutputParts();
+
+    /**
+     * Map of wsdl:fault part name and the binding as {@link ParameterBinding}
+     *
+     * @return empty Map if there is no parts
+     */
+    public Map<String, ParameterBinding> getFaultParts();
+
+    /**
      * Gets the payload QName of the request message.
      *
      * <p>
      * It's possible for an operation to define no body part, in which case
      * this method returns null.
      */
-    @Nullable QName getReqPayloadName();
+    @Nullable QName getRequestPayloadName();
 
     /**
      * Gets the payload QName of the response message.
@@ -109,7 +180,7 @@
      * It's possible for an operation to define no body part, in which case
      * this method returns null.
      */
-    @Nullable QName getResPayloadName();
+    @Nullable QName getResponsePayloadName();
 
     /**
      * Gets the namespace of request payload.
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundPortType.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundPortType.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLExtensible.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLExtensible.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -25,6 +25,12 @@
 
 package com.sun.xml.internal.ws.api.model.wsdl;
 
+import java.util.List;
+
+import javax.xml.namespace.QName;
+
+import org.xml.sax.Locator;
+
 /**
  * Interface that represents WSDL concepts that
  * can have extensions.
@@ -82,4 +88,23 @@
      *      must not be null.
      */
     void addExtension(WSDLExtension extension);
+
+    /**
+     * True if all required WSDL extensions on Port and Binding are understood
+     * @return true if all wsdl required extensions on Port and Binding are understood
+     */
+    public boolean areRequiredExtensionsUnderstood();
+
+    /**
+     * Marks extension as not understood
+     * @param extnEl QName of extension
+     * @param locator Locator
+     */
+    public void addNotUnderstoodExtension(QName extnEl, Locator locator);
+
+    /**
+     * Lists extensions marked as not understood
+     * @return List of not understood extensions
+     */
+    public List<? extends WSDLExtension> getNotUnderstoodExtensions();
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLFault.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLFault.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -76,4 +76,10 @@
      * @return Action
      */
     String getAction();
+
+    /**
+     * True if this is the default action
+     * @return
+     */
+    public boolean isDefaultAction();
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLModel.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLModel.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -34,10 +34,12 @@
 import com.sun.xml.internal.ws.api.policy.PolicyResolverFactory;
 import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
 import com.sun.xml.internal.ws.policy.PolicyMap;
+
 import org.xml.sax.SAXException;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
+
 import java.io.IOException;
 import java.util.Map;
 
@@ -96,7 +98,7 @@
      *
      * @return an empty Map if the wsdl document has no wsdl:binding
      */
-    @NotNull Map<QName, WSDLBoundPortType> getBindings();
+    @NotNull Map<QName, ? extends WSDLBoundPortType> getBindings();
 
     /**
      * Gives a {@link Map} of wsdl:service qualified name and {@link com.sun.xml.internal.ws.api.model.wsdl.WSDLService}
@@ -106,6 +108,25 @@
     @NotNull Map<QName, ? extends WSDLService> getServices();
 
     /**
+     * Returns the first service QName from insertion order
+     */
+    public QName getFirstServiceName();
+
+    /**
+     * Returns the message with the given QName
+     * @param name Message name
+     * @return Message
+     */
+    public WSDLMessage getMessage(QName name);
+
+    /**
+     * Gives a {@link Map} of wsdl:message qualified name and {@link com.sun.xml.internal.ws.api.model.wsdl.WSDLMesage}
+     *
+     * @return an empty Map if the wsdl document has no wsdl:message
+     */
+    @NotNull Map<QName, ? extends WSDLMessage> getMessages();
+
+    /**
      * Gives the PolicyMap associated with the WSDLModel
      *
      * @return PolicyMap
@@ -115,7 +136,6 @@
      */
     public PolicyMap getPolicyMap();
 
-
     /**
      * Main purpose of this class is to  parsing of a WSDL and get the {@link WSDLModel} from it.
      */
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOperation.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOperation.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -56,8 +56,6 @@
      */
     @Nullable WSDLOutput getOutput();
 
-
-
     /**
      * Returns true if this operation is an one-way operation.
      */
@@ -112,4 +110,10 @@
      * Gives the enclosing wsdl:portType@name attribute value.
      */
     @NotNull QName getPortTypeName();
+
+    /**
+     * Returns parameter order
+     * @return Parameter order
+     */
+    public String getParameterOrder();
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOutput.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOutput.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -79,4 +79,11 @@
      */
     @NotNull
     QName getQName();
+
+    /**
+     * Checks if the Action value is implicitly derived using the rules defined in WS-Addressing.
+     *
+     * @return true if the Action value is implicitly derived using the rules defined in WS-Addressing.
+     */
+    public boolean isDefaultAction();
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPort.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPort.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,9 @@
 package com.sun.xml.internal.ws.api.model.wsdl;
 
 import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
 import com.sun.xml.internal.ws.api.EndpointAddress;
+import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
 
 import javax.xml.namespace.QName;
 
@@ -64,4 +66,10 @@
      */
     @NotNull
     WSDLService getOwner();
+
+    /**
+     * Returns endpoint reference
+     * @return Endpoint reference
+     */
+    public @Nullable WSEndpointReference getEPR();
 }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPortType.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPortType.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -50,7 +50,6 @@
      */
     public WSDLOperation get(String operationName);
 
-
     /**
      * Gets {@link Iterable}<{@link WSDLOperation}>
      */
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLService.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLService.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,6 +26,7 @@
 package com.sun.xml.internal.ws.api.model.wsdl;
 
 import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
 
 import javax.xml.namespace.QName;
 
@@ -62,6 +63,12 @@
     WSDLPort getFirstPort();
 
     /**
+    * Gets the first port in this service which matches the portType
+    */
+    @Nullable
+    WSDLPort getMatchingPort(QName portTypeName);
+
+    /**
      * Gives all the {@link WSDLPort} in a wsdl:service {@link WSDLService}
      */
     Iterable<? extends WSDLPort> getPorts();
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundFault.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundFault;
+
+public interface EditableWSDLBoundFault extends WSDLBoundFault {
+
+    @Override
+    @Nullable
+    EditableWSDLFault getFault();
+
+    @Override
+    @NotNull
+    EditableWSDLBoundOperation getBoundOperation();
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     *
+     * @param operation Operation
+     */
+    void freeze(EditableWSDLBoundOperation operation);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundOperation.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import java.util.Map;
+
+import javax.jws.WebParam.Mode;
+import javax.jws.soap.SOAPBinding.Style;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
+
+public interface EditableWSDLBoundOperation extends WSDLBoundOperation {
+
+        @Override
+    @NotNull EditableWSDLOperation getOperation();
+
+        @Override
+    @NotNull EditableWSDLBoundPortType getBoundPortType();
+
+        @Override
+    @Nullable EditableWSDLPart getPart(@NotNull String partName, @NotNull Mode mode);
+
+        @Override
+    @NotNull Map<String,? extends EditableWSDLPart> getInParts();
+
+        @Override
+    @NotNull Map<String,? extends EditableWSDLPart> getOutParts();
+
+        @Override
+    @NotNull Iterable<? extends EditableWSDLBoundFault> getFaults();
+
+        /**
+         * Add Part
+         * @param part Part
+         * @param mode Mode
+         */
+    public void addPart(EditableWSDLPart part, Mode mode);
+
+    /**
+     * Add Fault
+     * @param fault Fault
+     */
+    public void addFault(@NotNull EditableWSDLBoundFault fault);
+
+    /**
+     * Sets the soapbinding:binding/operation/wsaw:Anonymous.
+     *
+     * @param anonymous Anonymous value of the operation
+     */
+        public void setAnonymous(ANONYMOUS anonymous);
+
+        /**
+         * Sets input explicit body parts
+         * @param b True, if input body part is explicit
+         */
+        public void setInputExplicitBodyParts(boolean b);
+
+        /**
+         * Sets output explicit body parts
+         * @param b True, if output body part is explicit
+         */
+        public void setOutputExplicitBodyParts(boolean b);
+
+        /**
+         * Sets fault explicit body parts
+         * @param b True, if fault body part is explicit
+         */
+        public void setFaultExplicitBodyParts(boolean b);
+
+        /**
+         * Set request namespace
+         * @param ns Namespace
+         */
+        public void setRequestNamespace(String ns);
+
+        /**
+         * Set response namespace
+         * @param ns Namespace
+         */
+        public void setResponseNamespace(String ns);
+
+        /**
+         * Set SOAP action
+         * @param soapAction SOAP action
+         */
+        public void setSoapAction(String soapAction);
+
+        /**
+         * Set parameter style
+         * @param style Style
+         */
+        public void setStyle(Style style);
+
+        /**
+         * Freezes WSDL model to prevent further modification
+         * @param root WSDL Model
+         */
+        public void freeze(EditableWSDLModel root);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundPortType.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import javax.jws.soap.SOAPBinding.Style;
+import javax.xml.namespace.QName;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.BindingID;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundPortType;
+
+public interface EditableWSDLBoundPortType extends WSDLBoundPortType {
+
+        @Override
+    @NotNull EditableWSDLModel getOwner();
+
+        @Override
+    public EditableWSDLBoundOperation get(QName operationName);
+
+        @Override
+    EditableWSDLPortType getPortType();
+
+        @Override
+    Iterable<? extends EditableWSDLBoundOperation> getBindingOperations();
+
+        @Override
+    @Nullable EditableWSDLBoundOperation getOperation(String namespaceUri, String localName);
+
+    /**
+     * Populates the Map that holds operation name as key and {@link WSDLBoundOperation} as the value.
+     *
+     * @param opName Must be non-null
+     * @param ptOp   Must be non-null
+     * @throws NullPointerException if either opName or ptOp is null
+     */
+    public void put(QName opName, EditableWSDLBoundOperation ptOp);
+
+    /**
+     * Sets the binding ID
+     * @param bindingId Binding ID
+     */
+        public void setBindingId(BindingID bindingId);
+
+    /**
+     * sets whether the {@link WSDLBoundPortType} is rpc or lit
+     */
+        public void setStyle(Style style);
+
+        /**
+         * Freezes WSDL model to prevent further modification
+         */
+        public void freeze();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLFault.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLFault;
+
+public interface EditableWSDLFault extends WSDLFault {
+
+    @Override
+    EditableWSDLMessage getMessage();
+
+    @Override
+    @NotNull
+    EditableWSDLOperation getOperation();
+
+    /**
+     * Sets action
+     *
+     * @param action Action
+     */
+    public void setAction(String action);
+
+    /**
+     * Set to true if this is the default action
+     *
+     * @param defaultAction True, if default action
+     */
+    public void setDefaultAction(boolean defaultAction);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     *
+     * @param root WSDL Model
+     */
+    public void freeze(EditableWSDLModel root);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLInput.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLInput;
+
+public interface EditableWSDLInput extends WSDLInput {
+
+    @Override
+    EditableWSDLMessage getMessage();
+
+    @Override
+    @NotNull
+    EditableWSDLOperation getOperation();
+
+    /**
+     * Sets action
+     *
+     * @param action Action
+     */
+    public void setAction(String action);
+
+    /**
+     * Set to true if this is the default action
+     *
+     * @param defaultAction True, if default action
+     */
+    public void setDefaultAction(boolean defaultAction);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     *
+     * @param root WSDL Model
+     */
+    public void freeze(EditableWSDLModel root);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLMessage.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,42 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLMessage;
+
+public interface EditableWSDLMessage extends WSDLMessage {
+
+    @Override
+    Iterable<? extends EditableWSDLPart> parts();
+
+    /**
+     * Add part
+     *
+     * @param part Part
+     */
+    public void add(EditableWSDLPart part);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLModel.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,115 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import java.util.Map;
+
+import javax.xml.namespace.QName;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
+import com.sun.xml.internal.ws.policy.PolicyMap;
+
+public interface EditableWSDLModel extends WSDLModel {
+
+    @Override
+    EditableWSDLPortType getPortType(@NotNull QName name);
+
+    /**
+     * Add Binding
+     *
+     * @param portType Bound port type
+     */
+    void addBinding(EditableWSDLBoundPortType portType);
+
+    @Override
+    EditableWSDLBoundPortType getBinding(@NotNull QName name);
+
+    @Override
+    EditableWSDLBoundPortType getBinding(@NotNull QName serviceName, @NotNull QName portName);
+
+    @Override
+    EditableWSDLService getService(@NotNull QName name);
+
+    @Override
+    @NotNull
+    Map<QName, ? extends EditableWSDLMessage> getMessages();
+
+    /**
+     * Add message
+     *
+     * @param msg Message
+     */
+    public void addMessage(EditableWSDLMessage msg);
+
+    @Override
+    @NotNull
+    Map<QName, ? extends EditableWSDLPortType> getPortTypes();
+
+    /**
+     * Add port type
+     *
+     * @param pt Port type
+     */
+    public void addPortType(EditableWSDLPortType pt);
+
+    @Override
+    @NotNull
+    Map<QName, ? extends EditableWSDLBoundPortType> getBindings();
+
+    @Override
+    @NotNull
+    Map<QName, ? extends EditableWSDLService> getServices();
+
+    /**
+     * Add service
+     *
+     * @param svc Service
+     */
+    public void addService(EditableWSDLService svc);
+
+    @Override
+    public EditableWSDLMessage getMessage(QName name);
+
+    /**
+     * @param policyMap
+     * @deprecated
+     */
+    public void setPolicyMap(PolicyMap policyMap);
+
+    /**
+     * Finalize rpc-lit binding
+     *
+     * @param portType Binding
+     */
+    public void finalizeRpcLitBinding(EditableWSDLBoundPortType portType);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     */
+    public void freeze();
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLOperation.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import javax.xml.namespace.QName;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
+
+public interface EditableWSDLOperation extends WSDLOperation {
+
+    @Override
+    @NotNull
+    EditableWSDLInput getInput();
+
+    /**
+     * Set input
+     *
+     * @param input Input
+     */
+    public void setInput(EditableWSDLInput input);
+
+    @Override
+    @Nullable
+    EditableWSDLOutput getOutput();
+
+    /**
+     * Set output
+     *
+     * @param output Output
+     */
+    public void setOutput(EditableWSDLOutput output);
+
+    @Override
+    Iterable<? extends EditableWSDLFault> getFaults();
+
+    /**
+     * Add fault
+     *
+     * @param fault Fault
+     */
+    public void addFault(EditableWSDLFault fault);
+
+    @Override
+    @Nullable
+    EditableWSDLFault getFault(QName faultDetailName);
+
+    /**
+     * Set parameter order
+     *
+     * @param parameterOrder Parameter order
+     */
+    public void setParameterOrder(String parameterOrder);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     *
+     * @param root WSDL Model
+     */
+    public void freeze(EditableWSDLModel root);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLOutput.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;
+
+public interface EditableWSDLOutput extends WSDLOutput {
+
+    @Override
+    EditableWSDLMessage getMessage();
+
+    @Override
+    @NotNull
+    EditableWSDLOperation getOperation();
+
+    /**
+     * Sets action
+     *
+     * @param action Action
+     */
+    public void setAction(String action);
+
+    /**
+     * Set to true if this is the default action
+     *
+     * @param defaultAction True, if default action
+     */
+    public void setDefaultAction(boolean defaultAction);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     *
+     * @param root WSDL Model
+     */
+    public void freeze(EditableWSDLModel root);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPart.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.xml.internal.ws.api.model.ParameterBinding;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLPart;
+
+public interface EditableWSDLPart extends WSDLPart {
+
+    /**
+     * Sets binding
+     *
+     * @param binding Binding
+     */
+    public void setBinding(ParameterBinding binding);
+
+    /**
+     * Sets index
+     *
+     * @param index Index
+     */
+    public void setIndex(int index);
+
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPort.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.xml.internal.ws.api.EndpointAddress;
+import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
+
+public interface EditableWSDLPort extends WSDLPort {
+
+    @Override
+    @NotNull
+    EditableWSDLBoundPortType getBinding();
+
+    @Override
+    @NotNull
+    EditableWSDLService getOwner();
+
+    /**
+     * Sets endpoint address
+     *
+     * @param address Endpoint address
+     */
+    public void setAddress(EndpointAddress address);
+
+    /**
+     * Sets endpoint reference
+     *
+     * @param epr Endpoint reference
+     */
+    public void setEPR(@NotNull WSEndpointReference epr);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     *
+     * @param root WSDL Model
+     */
+    void freeze(EditableWSDLModel root);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPortType.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;
+
+public interface EditableWSDLPortType extends WSDLPortType {
+
+    @Override
+    public EditableWSDLOperation get(String operationName);
+
+    @Override
+    public Iterable<? extends EditableWSDLOperation> getOperations();
+
+    /**
+     * Associate WSDL operation with operation name
+     *
+     * @param opName Operation name
+     * @param ptOp   Operation
+     */
+    public void put(String opName, EditableWSDLOperation ptOp);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     */
+    public void freeze();
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLService.java	Fri Oct 04 16:21:34 2013 +0100
@@ -0,0 +1,67 @@
+/*
+ * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package com.sun.xml.internal.ws.api.model.wsdl.editable;
+
+import javax.xml.namespace.QName;
+
+import com.sun.istack.internal.NotNull;
+import com.sun.istack.internal.Nullable;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLService;
+
+public interface EditableWSDLService extends WSDLService {
+
+    @Override
+    @NotNull
+    EditableWSDLModel getParent();
+
+    @Override
+    EditableWSDLPort get(QName portName);
+
+    @Override
+    EditableWSDLPort getFirstPort();
+
+    @Override
+    @Nullable
+    EditableWSDLPort getMatchingPort(QName portTypeName);
+
+    @Override
+    Iterable<? extends EditableWSDLPort> getPorts();
+
+    /**
+     * Associate WSDL port with port QName
+     *
+     * @param portName Port QName
+     * @param port     Port
+     */
+    public void put(QName portName, EditableWSDLPort port);
+
+    /**
+     * Freezes WSDL model to prevent further modification
+     *
+     * @param root WSDL Model
+     */
+    void freeze(EditableWSDLModel root);
+}
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtension.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtension.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,17 @@
 package com.sun.xml.internal.ws.api.wsdl.parser;
 
 import com.sun.xml.internal.ws.api.WSService;
-import com.sun.xml.internal.ws.api.model.wsdl.*;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundFault;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundOperation;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLInput;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOutput;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService;
 import com.sun.xml.internal.ws.api.pipe.Tube;
 import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
 
@@ -138,34 +148,36 @@
  * @author Kohsuke Kawaguchi
  */
 public abstract class WSDLParserExtension {
+
     public void start(WSDLParserExtensionContext context){
         // noop
     }
-    public void serviceAttributes(WSDLService service, XMLStreamReader reader) {
+
+    public void serviceAttributes(EditableWSDLService service, XMLStreamReader reader) {
         // noop
     }
 
-    public boolean serviceElements(WSDLService service, XMLStreamReader reader) {
+    public boolean serviceElements(EditableWSDLService service, XMLStreamReader reader) {
         return false;
     }
 
-    public void portAttributes(WSDLPort port, XMLStreamReader reader) {
+    public void portAttributes(EditableWSDLPort port, XMLStreamReader reader) {
         // noop
     }
 
-    public boolean portElements(WSDLPort port, XMLStreamReader reader) {
+    public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
         return false;
     }
 
-    public boolean portTypeOperationInput(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationInput(EditableWSDLOperation op, XMLStreamReader reader) {
         return false;
     }
 
-    public boolean portTypeOperationOutput(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationOutput(EditableWSDLOperation op, XMLStreamReader reader) {
         return false;
     }
 
-    public boolean portTypeOperationFault(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationFault(EditableWSDLOperation op, XMLStreamReader reader) {
         return false;
     }
 
@@ -173,81 +185,81 @@
         return false;
     }
 
-    public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
         return false;
     }
 
-    public void bindingAttributes(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public void bindingAttributes(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
     }
 
-    public boolean portTypeElements(WSDLPortType portType, XMLStreamReader reader) {
+    public boolean portTypeElements(EditableWSDLPortType portType, XMLStreamReader reader) {
         return false;
     }
 
-    public void portTypeAttributes(WSDLPortType portType, XMLStreamReader reader) {
+    public void portTypeAttributes(EditableWSDLPortType portType, XMLStreamReader reader) {
     }
 
-    public boolean portTypeOperationElements(WSDLOperation operation, XMLStreamReader reader) {
+    public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader) {
         return false;
     }
 
-    public void portTypeOperationAttributes(WSDLOperation operation, XMLStreamReader reader) {
+    public void portTypeOperationAttributes(EditableWSDLOperation operation, XMLStreamReader reader) {
     }
 
-    public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return false;
     }
 
-    public void bindingOperationAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
     }
 
-    public boolean messageElements(WSDLMessage msg, XMLStreamReader reader) {
+    public boolean messageElements(EditableWSDLMessage msg, XMLStreamReader reader) {
         return false;
     }
 
-    public void messageAttributes(WSDLMessage msg, XMLStreamReader reader) {
+    public void messageAttributes(EditableWSDLMessage msg, XMLStreamReader reader) {
     }
 
-    public boolean portTypeOperationInputElements(WSDLInput input, XMLStreamReader reader) {
+    public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader) {
         return false;
     }
 
-    public void portTypeOperationInputAttributes(WSDLInput input, XMLStreamReader reader) {
+    public void portTypeOperationInputAttributes(EditableWSDLInput input, XMLStreamReader reader) {
     }
 
-    public boolean portTypeOperationOutputElements(WSDLOutput output, XMLStreamReader reader) {
+    public boolean portTypeOperationOutputElements(EditableWSDLOutput output, XMLStreamReader reader) {
         return false;
     }
 
-    public void portTypeOperationOutputAttributes(WSDLOutput output, XMLStreamReader reader) {
+    public void portTypeOperationOutputAttributes(EditableWSDLOutput output, XMLStreamReader reader) {
     }
 
-    public boolean portTypeOperationFaultElements(WSDLFault fault, XMLStreamReader reader) {
+    public boolean portTypeOperationFaultElements(EditableWSDLFault fault, XMLStreamReader reader) {
         return false;
     }
 
-    public void portTypeOperationFaultAttributes(WSDLFault fault, XMLStreamReader reader) {
+    public void portTypeOperationFaultAttributes(EditableWSDLFault fault, XMLStreamReader reader) {
     }
 
-    public boolean bindingOperationInputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationInputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return false;
     }
 
-    public void bindingOperationInputAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationInputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
     }
 
-    public boolean bindingOperationOutputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return false;
     }
 
-    public void bindingOperationOutputAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationOutputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
     }
 
-    public boolean bindingOperationFaultElements(WSDLBoundFault fault, XMLStreamReader reader) {
+    public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader) {
         return false;
     }
 
-    public void bindingOperationFaultAttributes(WSDLBoundFault fault, XMLStreamReader reader) {
+    public void bindingOperationFaultAttributes(EditableWSDLBoundFault fault, XMLStreamReader reader) {
     }
 
     // TODO: complete the rest of the callback
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtensionContext.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtensionContext.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,7 @@
 package com.sun.xml.internal.ws.api.wsdl.parser;
 
 import com.sun.istack.internal.NotNull;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
 import com.sun.xml.internal.ws.api.server.Container;
 import com.sun.xml.internal.ws.api.policy.PolicyResolver;
 
@@ -44,10 +44,10 @@
     boolean isClientSide();
 
     /**
-     * Gives the {@link WSDLModel}. The WSDLModel may not be complete until
+     * Gives the {@link EditableWSDLModel}. The WSDLModel may not be complete until
      * {@link WSDLParserExtension#finished(WSDLParserExtensionContext)} is called.
      */
-    WSDLModel getWSDLModel();
+    EditableWSDLModel getWSDLModel();
 
     /**
      * Provides the {@link Container} in which this service or client is running.
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java	Fri Oct 04 16:21:34 2013 +0100
@@ -38,7 +38,6 @@
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLFeaturedObject;
 import com.sun.xml.internal.ws.model.RuntimeModelerException;
-import com.sun.xml.internal.ws.model.wsdl.WSDLPortImpl;
 import com.sun.xml.internal.ws.resources.ModelerMessages;
 import com.sun.xml.internal.bind.util.Which;
 
@@ -440,9 +439,9 @@
     }
 
     /**
-     * Extracts features from {@link WSDLPortImpl#getFeatures()}. Extra features
+     * Extracts features from {@link WSDLPort#getFeatures()}. Extra features
      * that are not already set on binding. i.e, if a feature is set already on
-     * binding through someother API the coresponding wsdlFeature is not set.
+     * binding through some other API the corresponding wsdlFeature is not set.
      *
      * @param wsdlPort
      *            WSDLPort model
@@ -452,7 +451,7 @@
      *            true
      * @param reportConflicts
      *            If true, checks if the feature setting in WSDL (wsdl extension
-     *            or policy configuration) colflicts with feature setting in
+     *            or policy configuration) conflicts with feature setting in
      *            Deployed Service and logs warning if there are any conflicts.
      */
     public void mergeFeatures(@NotNull WSDLPort wsdlPort,
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/MonitorRootClient.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/MonitorRootClient.java	Fri Oct 04 16:21:34 2013 +0100
@@ -25,14 +25,18 @@
 
 package com.sun.xml.internal.ws.client;
 
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLService;
 import com.sun.xml.internal.ws.api.server.Container;
-import com.sun.xml.internal.ws.model.wsdl.WSDLServiceImpl;
+
 import java.util.Map;
+
 import javax.xml.namespace.QName;
+
 import com.sun.org.glassfish.gmbal.AMXMetadata;
 import com.sun.org.glassfish.gmbal.Description;
 import com.sun.org.glassfish.gmbal.ManagedAttribute;
 import com.sun.org.glassfish.gmbal.ManagedObject;
+
 import java.net.URL;
 
 /**
@@ -74,7 +78,7 @@
     private URL wsdlDocumentLocation() { return stub.owner.getWSDLDocumentLocation(); }
 
     @ManagedAttribute
-    private WSDLServiceImpl wsdlService() { return stub.owner.getWsdlService(); }
+    private WSDLService wsdlService() { return stub.owner.getWsdlService(); }
 
 
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/PortInfo.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/PortInfo.java	Fri Oct 04 16:21:34 2013 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
@@ -36,8 +36,6 @@
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
 import com.sun.xml.internal.ws.binding.BindingImpl;
 import com.sun.xml.internal.ws.binding.WebServiceFeatureList;
-import com.sun.xml.internal.ws.model.wsdl.WSDLPortImpl;
-import com.sun.xml.internal.ws.model.wsdl.WSDLModelImpl;
 import com.sun.xml.internal.ws.policy.PolicyMap;
 import com.sun.xml.internal.ws.policy.jaxws.PolicyUtil;
 
@@ -96,7 +94,7 @@
     public PolicyMap createPolicyMap() {
        PolicyMap map;
        if(portModel != null) {
-            map = ((WSDLModelImpl) portModel.getOwner().getParent()).getPolicyMap();
+            map = portModel.getOwner().getParent().getPolicyMap();
        } else {
            map = PolicyResolverFactory.create().resolve(new PolicyResolver.ClientContext(null,owner.getContainer()));
        }
@@ -154,8 +152,8 @@
     private WSDLPort getPortModel(WSServiceDelegate owner, QName portName) {
 
         if (owner.getWsdlService() != null){
-            Iterable<WSDLPortImpl> ports = owner.getWsdlService().getPorts();
-            for (WSDLPortImpl port : ports){
+            Iterable<? extends WSDLPort> ports = owner.getWsdlService().getPorts();
+            for (WSDLPort port : ports){
                 if (port.getName().equals(portName))
                     return port;
             }
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/Stub.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/Stub.java	Fri Oct 04 16:21:34 2013 +0100
@@ -62,7 +62,6 @@
 import com.sun.xml.internal.ws.developer.JAXWSProperties;
 import com.sun.xml.internal.ws.developer.WSBindingProvider;
 import com.sun.xml.internal.ws.model.wsdl.WSDLDirectProperties;
-import com.sun.xml.internal.ws.model.wsdl.WSDLPortImpl;
 import com.sun.xml.internal.ws.model.wsdl.WSDLPortProperties;
 import com.sun.xml.internal.ws.model.wsdl.WSDLProperties;
 import com.sun.xml.internal.ws.resources.ClientMessages;
@@ -354,7 +353,7 @@
      */
     private static void checkAllWSDLExtensionsUnderstood(WSPortInfo port, WSBinding binding) {
         if (port.getPort() != null && binding.isFeatureEnabled(RespectBindingFeature.class)) {
-            ((WSDLPortImpl) port.getPort()).areRequiredExtensionsUnderstood();
+            port.getPort().areRequiredExtensionsUnderstood();
         }
     }
 
@@ -649,7 +648,7 @@
 
             //gather EPRExtensions specified in WSDL.
             try {
-                WSEndpointReference wsdlEpr = ((WSDLPortImpl) wsdlPort).getEPR();
+                WSEndpointReference wsdlEpr = wsdlPort.getEPR();
                 if (wsdlEpr != null) {
                     for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                         wsdlEPRExtensions.add(new WSEPRExtension(
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Fri Oct 04 16:21:34 2013 +0100
@@ -41,7 +41,9 @@
 import com.sun.xml.internal.ws.api.databinding.DatabindingFactory;
 import com.sun.xml.internal.ws.api.databinding.MetadataReader;
 import com.sun.xml.internal.ws.api.model.SEIModel;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLService;
 import com.sun.xml.internal.ws.api.pipe.Stubs;
 import com.sun.xml.internal.ws.api.server.Container;
 import com.sun.xml.internal.ws.api.server.ContainerResolver;
@@ -51,15 +53,11 @@
 import com.sun.xml.internal.ws.client.HandlerConfigurator.AnnotationConfigurator;
 import com.sun.xml.internal.ws.client.HandlerConfigurator.HandlerResolverImpl;
 import com.sun.xml.internal.ws.client.sei.SEIStub;
-
 import com.sun.xml.internal.ws.developer.MemberSubmissionAddressingFeature;
 import com.sun.xml.internal.ws.developer.UsesJAXBContextFeature;
 import com.sun.xml.internal.ws.developer.WSBindingProvider;
 import com.sun.xml.internal.ws.model.RuntimeModeler;
 import com.sun.xml.internal.ws.model.SOAPSEIModel;
-import com.sun.xml.internal.ws.model.wsdl.WSDLModelImpl;
-import com.sun.xml.internal.ws.model.wsdl.WSDLPortImpl;
-import com.sun.xml.internal.ws.model.wsdl.WSDLServiceImpl;
 import com.sun.xml.internal.ws.resources.ClientMessages;
 import com.sun.xml.internal.ws.resources.DispatchMessages;
 import com.sun.xml.internal.ws.resources.ProviderApiMessages;
@@ -67,6 +65,7 @@
 import com.sun.xml.internal.ws.util.ServiceConfigurationError;
 import com.sun.xml.internal.ws.util.ServiceFinder;
 import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
+
 import org.xml.sax.EntityResolver;
 import org.xml.sax.SAXException;
 
@@ -86,6 +85,7 @@
 import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.handler.HandlerResolver;
 import javax.xml.ws.soap.AddressingFeature;
+
 import java.io.IOException;
 import java.lang.reflect.InvocationHandler;
 import java.lang.reflect.Proxy;
@@ -179,7 +179,7 @@
      * This fiels can be be null if the service is created without wsdl but later
      * the epr supplies a wsdl that can be parsed.
      */
-    private  @Nullable WSDLServiceImpl wsdlService;
+    private  @Nullable WSDLService wsdlService;
 
     private final Container container;
     /**
@@ -219,7 +219,7 @@
      * @param serviceClass
      *      Either {@link Service}.class or other generated service-derived classes.
      */
-    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLServiceImpl service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeature... features) {
+    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLService service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeature... features) {
         this(wsdl, service, serviceName, serviceClass, new WebServiceFeatureList(features));
     }
 
@@ -227,7 +227,7 @@
      * @param serviceClass
      *      Either {@link Service}.class or other generated service-derived classes.
      */
-    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLServiceImpl service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeatureList features) {
+    public WSServiceDelegate(@Nullable Source wsdl, @Nullable WSDLService service, @NotNull QName serviceName, @NotNull final Class<? extends Service> serviceClass, WebServiceFeatureList features) {
         //we cant create a Service without serviceName
         if (serviceName == null) {
             throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME_NULL(null));
@@ -303,7 +303,7 @@
                 if (wsdl != null) {
                     try {
                         URL url = wsdl.getSystemId()==null ? null : JAXWSUtils.getEncodedURL(wsdl.getSystemId());
-                        WSDLModelImpl model = parseWSDL(url, wsdl, serviceClass);
+                        WSDLModel model = parseWSDL(url, wsdl, serviceClass);
                         service = model.getService(this.serviceName);
                         if (service == null)
                             throw new WebServiceException(
@@ -316,6 +316,10 @@
                         throw new WebServiceException(ClientMessages.INVALID_WSDL_URL(wsdl.getSystemId()));
                     }
                 }
+        } else {
+            // fill in statically known ports
+            for (WSDLPort port : service.getPorts())
+                ports.put(port.getName(), new PortInfo(this, port));
         }
         this.wsdlService = service;
 
@@ -339,7 +343,7 @@
      *      Either this or <tt>wsdl</tt> parameter must be given.
      *      Null location means the system won't be able to resolve relative references in the WSDL,
      */
-    private WSDLModelImpl parseWSDL(URL wsdlDocumentLocation, Source wsdlSource, Class serviceClass) {
+    private WSDLModel parseWSDL(URL wsdlDocumentLocation, Source wsdlSource, Class serviceClass) {
         try {
             return RuntimeWSDLParser.parse(wsdlDocumentLocation, wsdlSource, createCatalogResolver(),
                 true, getContainer(), serviceClass, ServiceFinder.find(WSDLParserExtension.class).toArray());
@@ -385,7 +389,7 @@
     public <T> T getPort(QName portName, Class<T> portInterface, WebServiceFeature... features) {
         if (portName == null || portInterface == null)
             throw new IllegalArgumentException();
-        WSDLServiceImpl tWsdlService = this.wsdlService;
+        WSDLService tWsdlService = this.wsdlService;
         if (tWsdlService == null) {
             // assigning it to local variable and not setting it back to this.wsdlService intentionally
             // as we don't want to include the service instance with information gathered from sei
@@ -396,7 +400,7 @@
             }
 
         }
-        WSDLPortImpl portModel = getPortModel(tWsdlService, portName);
+        WSDLPort portModel = getPortModel(tWsdlService, portName);
         return getPort(portModel.getEPR(), portName, portInterface, new WebServiceFeatureList(features));
     }
 
@@ -436,7 +440,7 @@
     public <T> T getPort(Class<T> portInterface, WebServiceFeature... features) {
         //get the portType from SEI
         QName portTypeName = RuntimeModeler.getPortTypeName(portInterface, getMetadadaReader(new WebServiceFeatureList(features), portInterface.getClassLoader()));
-        WSDLServiceImpl tmpWsdlService = this.wsdlService;
+        WSDLService tmpWsdlService = this.wsdlService;
         if (tmpWsdlService == null) {
             // assigning it to local variable and not setting it back to this.wsdlService intentionally
             // as we don't want to include the service instance with information gathered from sei
@@ -447,7 +451,7 @@
             }
         }
         //get the first port corresponding to the SEI
-        WSDLPortImpl port = tmpWsdlService.getMatchingPort(portTypeName);
+        WSDLPort port = tmpWsdlService.getMatchingPort(portTypeName);
         if (port == null) {
             throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
         }
@@ -672,7 +676,7 @@
                 throw new WebServiceException(ProviderApiMessages.NULL_WSDL());
             }
             try {
-                WSDLModelImpl eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
+                WSDLModel eprWsdlMdl = parseWSDL(new URL(wsepr.getAddress()), eprWsdlSource, null);
                 wsdlService = eprWsdlMdl.getService(serviceName);
                 if (wsdlService == null)
                     throw new WebServiceException(ClientMessages.INVALID_SERVICE_NAME(serviceName,
@@ -685,7 +689,7 @@
 
         if (portName == null && portTypeName != null) {
             //get the first port corresponding to the SEI
-            WSDLPortImpl port = wsdlService.getMatchingPort(portTypeName);
+            WSDLPort port = wsdlService.getMatchingPort(portTypeName);
             if (port == null)
                 throw new WebServiceException(ClientMessages.UNDEFINED_PORT_TYPE(portTypeName));
             portName = port.getName();
@@ -732,7 +736,7 @@
         );
     }
 
-    private WSDLServiceImpl getWSDLModelfromSEI(final Class sei) {
+    private WSDLService getWSDLModelfromSEI(final Class sei) {
         WebService ws = AccessController.doPrivileged(new PrivilegedAction<WebService>() {
             public WebService run() {
                 return (WebService) sei.getAnnotation(WebService.class);
@@ -743,11 +747,11 @@
         String wsdlLocation = ws.wsdlLocation();
         wsdlLocation = JAXWSUtils.absolutize(JAXWSUtils.getFileOrURLName(wsdlLocation));
         Source wsdl = new StreamSource(wsdlLocation);
-        WSDLServiceImpl service = null;
+        WSDLService service = null;
 
         try {
             URL url = wsdl.getSystemId() == null ? null : new URL(wsdl.getSystemId());
-            WSDLModelImpl model = parseWSDL(url, wsdl, sei);
+            WSDLModel model = parseWSDL(url, wsdl, sei);
             service = model.getService(this.serviceName);
             if (service == null)
                 throw new WebServiceException(
@@ -815,7 +819,7 @@
      */
     private StringBuilder buildWsdlPortNames() {
         Set<QName> wsdlPortNames = new HashSet<QName>();
-        for (WSDLPortImpl port : wsdlService.getPorts()) {
+        for (WSDLPort port : wsdlService.getPorts()) {
             wsdlPortNames.add(port.getName());
         }
         return buildNameList(wsdlPortNames);
@@ -826,8 +830,8 @@
      *
      * @return guaranteed to be non-null.
      */
-    public @NotNull WSDLPortImpl getPortModel(WSDLServiceImpl wsdlService, QName portName) {
-        WSDLPortImpl port = wsdlService.get(portName);
+    public @NotNull WSDLPort getPortModel(WSDLService wsdlService, QName portName) {
+        WSDLPort port = wsdlService.get(portName);
         if (port == null)
             throw new WebServiceException(
                 ClientMessages.INVALID_PORT_NAME(portName,buildWsdlPortNames()));
@@ -884,7 +888,7 @@
     }
 
     private SEIPortInfo createSEIPortInfo(QName portName, Class portInterface, WebServiceFeatureList features) {
-        WSDLPortImpl wsdlPort = getPortModel(wsdlService, portName);
+        WSDLPort wsdlPort = getPortModel(wsdlService, portName);
         SEIModel model = buildRuntimeModel(serviceName, portName, portInterface, wsdlPort, features);
 
         return new SEIPortInfo(this, portInterface, (SOAPSEIModel) model, wsdlPort);
@@ -894,7 +898,7 @@
         return features.contains(UsesJAXBContextFeature.class);
     }
 
-    public WSDLServiceImpl getWsdlService() {
+    public WSDLService getWsdlService() {
         return wsdlService;
     }
 
--- a/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java	Wed Jul 05 19:14:19 2017 +0200
+++ b/jaxws/src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java	Fri Oct 04 16:21:34 2013 +0100
@@ -75,13 +75,13 @@
     private Map<String, JavaWsdlMappingType> readers = new HashMap<String, JavaWsdlMappingType>();
 
     public ExternalMetadataReader(Collection<File> files, Collection<String> resourcePaths, ClassLoader classLoader,
-                                  boolean xsdValidation, boolean disableSecureXmlProcessing) {
+                                  boolean xsdValidation, boolean disableXmlSecurity) {
 
         if (files != null) {
             for (File file : files) {
                 try {
-                    String namespace = Util.documentRootNamespace(newSource(file), disableSecureXmlProcessing);
-                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(file), namespace, disableSecureXmlProcessing);
+                    String namespace = Util.documentRootNamespace(newSource(file), disableXmlSecurity);
+                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(file), namespace, disableXmlSecurity);
                     readers.put(externalMapping.getJavaTypeName(), externalMapping);
                 } catch (Exception e) {
                     throw new RuntimeModelerException("runtime.modeler.external.metadata.unable.to.read", file.getAbsolutePath());
@@ -92,8 +92,8 @@
         if (resourcePaths != null) {
             for (String resourcePath : resourcePaths) {
                 try {
-                    String namespace = Util.documentRootNamespace(newSource(resourcePath, classLoader), disableSecureXmlProcessing);
-                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(resourcePath, classLoader), namespace, disableSecureXmlProcessing);
+                    String namespace = Util.documentRootNamespace(newSource(resourcePath, classLoader), disableXmlSecurity);
+                    JavaWsdlMappingType externalMapping = parseMetadata(xsdValidation, newSource(resourcePath, classLoader), namespace, disableXmlSecurity);
                     readers.put(externalMapping.getJavaTypeName(), externalMapping);
                 } catch (Exception e) {
                     throw new RuntimeModelerException("runtime.modeler.external.metadata.unable.to.read", resourcePath);
@@ -107,11 +107,11 @@
         return new StreamSource(is);
     }
 
-    private JavaWsdlMappingType parseMetadata(boolean xsdValidation, StreamSource source, String namespace, boolean disableSecureXmlProcessing) throws JAXBException, IOException, TransformerException {
+    private JavaWsdlMappingType parseMetadata(boolean xsdValidation, StreamSource source, String namespace, boolean disableXmlSecurity) throws JAXBException, IOException, TransformerException {
         if (NAMESPACE_WEBLOGIC_WSEE_DATABINDING.equals(namespace)) {
-            return Util.transformAndRead(source, disableSecureXmlProcessing);
+            return Util.transformAndRead(source, disableXmlSecurity);
         } if (NAMESPACE_JAXWS_RI_EXTERNAL_METADATA.equals(namespace)) {
-            return Util.read(source, xsdValidation, disableSecureXmlProcessing);
+            return Util.read(source, xsdValidation, disableXmlSecurity);
         } else {
             throw new RuntimeModelerException("runtime.modeler.external.metadata.unsupported.schema", namespace, Arrays.asList(NAMESPACE_WEBLOGIC_WSEE_DATABINDING, NAMESPACE_JAXWS_RI_EXTERNAL_METADATA).toString());
         }
@@ -425,8 +425,8 @@
         }
 
         @SuppressWarnings("unchecked")
-        public static JavaWsdlMappingType read(Source src, boolean xsdValidation, boolean disableSecureXmlProcessing) throws IOException, JAXBException {
-            JAXBContext ctx = jaxbContext(disableSecureXmlProcessing);
+        public static JavaWsdlMappingType read(Source src, boolean xsdValidation, boolean disableXmlSecurity) throws IOException, JAXBException {
+            JAXBContext ctx = jaxbContext(disableXmlSecurity);
             try {
                 Unmarshaller um = ctx.createUnmarshaller();
                 if (xsdValidation) {
@@ -455,16 +455,16 @@
             }
         }
 
-        private static JAXBContext jaxbContext(boolean disableSecureXmlProcessing) {
+        private static JAXBContext jaxbContext(boolean disableXmlSecurity) {
             // as it is supposed to have security enabled in most cases, we create and don't cache
             // "insecure" JAXBContext - these should be corner cases
-            return disableSecureXmlProcessing ? createJaxbContext(true) : jaxbContext;
+            return disableXmlSecurity ? createJaxbContext(true) : jaxbContext;
         }
 
-        public static JavaWsdlMappingType transformAndRead(Source src, boolean disableSecureXmlProcessing) throws TransformerException, JAXBException {
+        public static JavaWsdlMappingType transformAndRead(Source src, boolean disableXmlSecurity) throws Trans