changeset 409:1d6c13d3b8de

Merge
author lana
date Tue, 08 Oct 2013 14:55:33 -0700
parents 32edc7a2c866 (current diff) e56be3a2287a (diff)
children 7c0a7937f6ef
files
diffstat 136 files changed, 4978 insertions(+), 3406 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/oracle/webservices/internal/api/databinding/ExternalMetadataFeature.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_de.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_es.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_fr.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_it.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ja.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_ko.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_pt_BR.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_CN.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/jxc/MessageBundle_zh_TW.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/WscompileMessages.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/WscompileMessages.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/wscompile.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/resources/wscompile.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/version.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/Options.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/Options.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsgenTool.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportOptions.java	Tue Oct 08 14:55:33 2013 -0700
@@ -774,4 +774,10 @@
                         is.setSystemId(systemId);
                 }
     }
+
+    @Override
+    protected void disableXmlSecurity() {
+        super.disableXmlSecurity();
+        schemaCompiler.getOptions().disableXmlSecurity = true;
+    }
 }
--- a/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/wscompile/WsimportTool.java	Tue Oct 08 14:55:33 2013 -0700
@@ -332,7 +332,7 @@
                 if(options.verbose) {
                     listener.message(WscompileMessages.WSIMPORT_ARCHIVE_ARTIFACT(f, options.clientjar));
                 }
-                String entry = f.getCanonicalPath().substring(base.length()+1);
+                String entry = f.getCanonicalPath().substring(base.length()+1).replace(File.separatorChar, '/');
                 fi = new FileInputStream(f);
                 bis = new BufferedInputStream(fi);
                 JarEntry jarEntry = new JarEntry(entry);
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/ws/wsdl/parser/DOMForest.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_de.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_es.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_fr.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_it.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ja.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_ko.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_pt_BR.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_CN.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/MessageBundle_zh_TW.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/SchemaCache.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/SchemaCache.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/internalizer/DOMForest.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/ct/AbstractExtendedComplexTypeBuilder.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/ct/AbstractExtendedComplexTypeBuilder.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/parser/SchemaConstraintChecker.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/tools/internal/xjc/reader/xmlschema/parser/SchemaConstraintChecker.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/Messages.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/property/SingleMapNodeProperty.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/AccessorInjector.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/Injector.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/OptimizedAccessorFactory.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/runtime/reflect/opt/OptimizedAccessorFactory.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/bind/v2/util/XmlFactory.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Data.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Encoder.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64Encoder.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64EncoderStream.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/Base64EncoderStream.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/ByteArrayOutputStreamEx.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/ByteArrayOutputStreamEx.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/NamespaceContextEx.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/NamespaceContextEx.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/StreamingDataHandler.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/XMLStreamWriterEx.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/org/jvnet/staxex/XMLStreamWriterEx.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/binary/SchemaBuilderImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/binary/SchemaBuilderImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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);
+
+    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;
+    static class OpenIncludes {
+
+        final String uri;
+        final OpenIncludes parent;
 
-    OpenIncludes(String uri, OpenIncludes parent) {
-      this.uri = uri;
-      this.parent = 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 makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeZeroOrMore((Pattern)p);
-  }
+    public ParsedPattern makeOneOrMore(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeOneOrMore((Pattern) p);
+    }
 
-  public ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeOptional((Pattern)p);
-  }
+    public ParsedPattern makeZeroOrMore(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeZeroOrMore((Pattern) p);
+    }
 
-  public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeList((Pattern)p, (Locator)loc);
-  }
+    public ParsedPattern makeOptional(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeOptional((Pattern) p);
+    }
 
-  public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno)
-          throws BuildException {
-    return pb.makeMixed((Pattern)p);
-  }
+    public ParsedPattern makeList(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeList((Pattern) p, (Locator) loc);
+    }
 
-  public ParsedPattern makeEmpty(Location loc, Annotations anno) {
-    return pb.makeEmpty();
-  }
+    public ParsedPattern makeMixed(ParsedPattern p, Location loc, Annotations anno)
+            throws BuildException {
+        return pb.makeMixed((Pattern) p);
+    }
 
-  public ParsedPattern makeNotAllowed(Location loc, Annotations anno) {
-    return pb.makeUnexpandedNotAllowed();
-  }
+    public ParsedPattern makeEmpty(Location loc, Annotations anno) {
+        return pb.makeEmpty();
+    }
 
-  public ParsedPattern makeText(Location loc, Annotations anno) {
-    return pb.makeText();
-  }
+    public ParsedPattern makeNotAllowed(Location loc, Annotations anno) {
+        return pb.makeUnexpandedNotAllowed();
+    }
 
-  public ParsedPattern makeErrorPattern() {
-    return pb.makeError();
-  }
+    public ParsedPattern makeText(Location loc, Annotations anno) {
+        return pb.makeText();
+    }
+
+    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 ValidationContext vc;
+        private String ns;
 
-  private class ValidationContextImpl implements ValidationContext {
-    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 String resolveNamespacePrefix(String prefix) {
-      return prefix.length() == 0 ? ns : vc.resolveNamespacePrefix(prefix);
-    }
+        public boolean isUnparsedEntity(String entityName) {
+            return vc.isUnparsedEntity(entityName);
+        }
 
-    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 boolean isNotation(String notationName) {
-      return vc.isNotation(notationName);
-    }
-  }
+    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);
+                }
+            }
+        }
 
-  private class DataPatternBuilderImpl implements DataPatternBuilder {
-    private DatatypeBuilder dtb;
-    DataPatternBuilderImpl(DatatypeBuilder dtb) {
-      this.dtb = dtb;
+        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 void addParam(String name, String value, Context context, String ns, Location loc, Annotations anno)
+    public DataPatternBuilder makeDataPatternBuilder(String datatypeLibrary, String type, Location loc)
             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);
+        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);
+                }
+            }
         }
-        else if (detail != null)
-          error("invalid_param_detail", detail, (Locator)loc);
-        else
-          error("invalid_param", (Locator)loc);
-      }
+        return new DummyDataPatternBuilder();
     }
 
-    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);
+    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 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();
-      }
+    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);
+        }
+
+        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 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();
-  }
+    static class Override {
 
-  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);
+        Override(RefPattern prp, Override next) {
+            this.prp = prp;
+            this.next = next;
         }
-        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);
+        RefPattern prp;
+        Override next;
+        byte replacementStatus;
     }
 
-    protected GrammarImpl(SchemaBuilderImpl sb, GrammarImpl g) {
-      this.sb = sb;
-      parent = g.parent;
-      startRef = g.startRef;
-      defines = g.defines;
+    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 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 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();
+            }
         }
-      }
-      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 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 ParsedPattern endIncludedGrammar(Location loc, Annotations anno) throws BuildException {
+    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 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 boolean usesComments() {
+        return false;
     }
 
-    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);
-    }
-
-  }
-
-
-  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;
+    private void error(SAXParseException message) throws BuildException {
+        noteError();
+        try {
+            if (eh != null) {
+                eh.error(message);
+            }
+        } catch (SAXException e) {
+            throw new BuildException(e);
+        }
     }
 
-    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;
-        }
-      }
+    private void error(String key, Locator loc) throws BuildException {
+        error(new SAXParseException(localizer.message(key), loc));
+    }
 
-      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);
-      }
+    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));
     }
 
-    public Include makeInclude() {
-      return null;
+    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 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);
+    private void noteError() {
+        if (!hadError && parent != null) {
+            parent.noteError();
+        }
+        hadError = true;
     }
-    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/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DDataPattern.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DDataPattern.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DPattern.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DPattern.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DXMLPrinter.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DXMLPrinter.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DataPatternBuilderImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/DataPatternBuilderImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/GrammarBuilderImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/digested/GrammarBuilderImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/AnyNameClass.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/AnyNameClass.java	Tue Oct 08 14:55:33 2013 -0700
@@ -77,7 +77,4 @@
         return true;
     }
 
-    private static Object readReplace() {
-        return NameClass.ANY;
-    }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/NameClassBuilderImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/NameClassBuilderImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/SimpleNameClass.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/nc/SimpleNameClass.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/UCode_UCodeESC_CharStream.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/compact/UCode_UCodeESC_CharStream.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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;
+
+    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;
-
-    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;
-  }
+    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 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;
-
-  private final void ExpandBuff(boolean wrapAround) {
-    char[] newbuffer = new char[bufsize + 2048];
-    int newbufline[] = new int[bufsize + 2048];
-    int newbufcolumn[] = new int[bufsize + 2048];
+            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;
+    }
+    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;
 
-    if (wrapAround) {
-      System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-      System.arraycopy(buffer, 0, newbuffer,
-                       bufsize - tokenBegin, bufpos);
-      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);
-      System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
-      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);
-      System.arraycopy(bufcolumn, 0, newbufcolumn, bufsize - tokenBegin, bufpos);
-      bufcolumn = newbufcolumn;
+            System.arraycopy(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+            System.arraycopy(bufline, 0, newbufline, bufsize - tokenBegin, bufpos);
+            bufline = newbufline;
 
-      bufpos += (bufsize - tokenBegin);
-    }
-    else {
-      System.arraycopy(buffer, tokenBegin, newbuffer, 0, bufsize - tokenBegin);
-      buffer = newbuffer;
+            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(bufline, tokenBegin, newbufline, 0, bufsize - tokenBegin);
+            bufline = newbufline;
+
+            System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
+            bufcolumn = newbufcolumn;
 
-      System.arraycopy(bufcolumn, tokenBegin, newbufcolumn, 0, bufsize - tokenBegin);
-      bufcolumn = newbufcolumn;
+            bufpos -= tokenBegin;
+        }
 
-      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;
-
-    return readChar();
-  }
+    private final char ReadChar() throws EOFException {
+        if (++nextCharInd >= maxNextCharInd) {
+            FillBuff();
+        }
 
-  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;
-    }
-
-    bufline[bufpos] = line;
-    bufcolumn[bufpos] = column;
-  }
-
-  private final char NEWLINE_MARKER = '\u0000';
-
-  public final char readChar() throws EOFException {
-    if (inBuf > 0) {
-      --inBuf;
-      return buffer[(bufpos == bufsize - 1) ? (bufpos = 0) : ++bufpos];
+    private final char PeekChar() throws EOFException {
+        char c = ReadChar();
+        --nextCharInd;
+        return c;
     }
 
-    char c;
-    try {
-      c = ReadChar();
-      switch (c) {
-      case '\r':
-        c = NEWLINE_MARKER;
-        try {
-          if (PeekChar() == '\n')
-            ReadChar();
-        }
-        catch (EOFException e) {
+    public final char BeginToken() throws EOFException {
+        if (inBuf > 0) {
+            --inBuf;
+            return buffer[tokenBegin = (bufpos == bufsize - 1) ? (bufpos = 0)
+                    : ++bufpos];
         }
-        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();
+
+        tokenBegin = 0;
+        bufpos = -1;
+
+        return readChar();
+    }
+
+    private final void AdjustBuffSize() {
+        if (available == bufsize) {
+            if (tokenBegin > 2048) {
+                bufpos = 0;
+                available = tokenBegin;
+            } else {
+                ExpandBuff(false);
             }
-            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;
+        } else if (available > tokenBegin) {
+            available = bufsize;
+        } else if ((tokenBegin - available) < 2048) {
+            ExpandBuff(true);
+        } else {
+            available = tokenBegin;
         }
-        // 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();
+    private final void UpdateLineColumn(char c) {
         column++;
-        // backup past the 'x's
-        bufpos -= xCnt;
-        if (bufpos < 0)
-          bufpos += bufsize;
-        break;
-      }
-      if (c != 'x') {
-        backup(xCnt);
-        return '\\';
-      }
-      xCnt++;
+
+        if (prevCharIsLF) {
+            prevCharIsLF = false;
+            line += (column = 1);
+        }
+
+        switch (c) {
+            case NEWLINE_MARKER:
+                prevCharIsLF = true;
+                break;
+            case '\t':
+                column--;
+                column += (8 - (column & 07));
+                break;
+            default:
+                break;
+        }
+
+        bufline[bufpos] = line;
+        bufcolumn[bufpos] = column;
     }
-    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);
+    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;
-        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();
-  }
+        UpdateLineColumn(c);
+        try {
+            if (c != '\\' || PeekChar() != 'x') {
+                return c;
+            }
+        } catch (EOFException e) {
+            return c;
+        }
 
-  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];
+        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);
+        }
     }
-    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);
-  }
+    /**
+     * @deprecated @see #getEndColumn
+     */
+    public final int getColumn() {
+        return bufcolumn[bufpos];
+    }
 
-  public void ReInit(java.io.InputStream dstream, int startline,
-                     int startcolumn) {
-    ReInit(dstream, startline, startcolumn, 4096);
-  }
+    /**
+     * @deprecated @see #getEndLine
+     */
+    public final int getLine() {
+        return bufline[bufpos];
+    }
 
-  static private final char BOM = '\ufeff';
-
-  private void skipBOM() {
-    try {
-      if (PeekChar() == BOM)
-        ReadChar();
+    public final int getEndColumn() {
+        return bufcolumn[bufpos];
     }
-    catch (EOFException e) {
+
+    public final int getEndLine() {
+        return bufline[bufpos];
     }
-  }
+
+    public final int getBeginColumn() {
+        return bufcolumn[tokenBegin];
+    }
 
-  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 int getBeginLine() {
+        return bufline[tokenBegin];
+    }
 
-  public final char[] GetSuffix(int len) {
-    char[] ret = new char[len];
+    public final void backup(int amount) {
 
-    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);
+        inBuf += amount;
+        if ((bufpos -= amount) < 0) {
+            bufpos += bufsize;
+        }
     }
 
-    return ret;
-  }
+    public UCode_UCodeESC_CharStream(java.io.Reader dstream,
+            int startline, int startcolumn, int buffersize) {
+        inputStream = dstream;
+        line = startline;
+        column = startcolumn - 1;
 
-  public void Done() {
-    nextCharBuf = null;
-    buffer = null;
-    bufline = null;
-    bufcolumn = null;
-  }
+        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;
 
-  /**
-   * 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 (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();
+    }
 
-    if (bufpos >= tokenBegin) {
-      len = bufpos - tokenBegin + inBuf + 1;
+    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);
     }
-    else {
-      len = bufsize - tokenBegin + bufpos + 1 + inBuf;
+
+    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);
     }
 
-    int i = 0, j = 0, k = 0;
-    int nextColDiff = 0, columnDiff = 0;
+    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) {
+        }
+    }
 
-    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 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;
     }
 
-    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 void Done() {
+        nextCharBuf = null;
+        buffer = null;
+        bufline = null;
+        bufcolumn = null;
     }
 
-    line = bufline[j];
-    column = bufcolumn[j];
-  }
+    /**
+     * 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/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/xml/SchemaParser.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/parse/xml/SchemaParser.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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 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 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 Hashtable patternTable;
-  private Hashtable nameClassTable;
+    static class PrefixMapping {
 
-  static class PrefixMapping {
-    final String prefix;
-    final String uri;
-    final PrefixMapping next;
+        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;
 
-    public String resolveNamespacePrefix(String prefix) {
-      for (PrefixMapping p = prefixMapping; p != null; p = p.next)
-        if (p.prefix.equals(prefix))
-          return p.uri;
-      return null;
-    }
+        AbstractContext() {
+            prefixMapping = new PrefixMapping("xml", WellKnownNamespaces.XML, null);
+        }
+
+        AbstractContext(AbstractContext context) {
+            super(context);
+            prefixMapping = context.prefixMapping;
+        }
 
-    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 String resolveNamespacePrefix(String prefix) {
+            for (PrefixMapping p = prefixMapping; p != null; p = p.next) {
+                if (p.prefix.equals(prefix)) {
+                    return p.uri;
+                }
+            }
+            return null;
+        }
 
-    public Context copy() {
-      return new SavedContext(this);
-    }
-  }
+        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();
+        }
 
-  static class SavedContext extends AbstractContext {
-    private final String baseUri;
-    SavedContext(AbstractContext context) {
-      super(context);
-      this.baseUri = context.getBaseUri();
+        public Context copy() {
+            return new SavedContext(this);
+        }
     }
 
-    public String getBaseUri() {
-      return baseUri;
-    }
-  }
+    static class SavedContext extends AbstractContext {
 
-  class ContextImpl extends AbstractContext {
-    public String getBaseUri() {
-      return xmlBaseHandler.getBaseUri();
-    }
-  }
+        private final String baseUri;
 
-  static interface CommentHandler {
-    void comment(String value);
-  }
+        SavedContext(AbstractContext context) {
+            super(context);
+            this.baseUri = context.getBaseUri();
+        }
 
-  abstract class Handler implements ContentHandler, CommentHandler {
-    CommentList comments;
-
-    CommentList getComments() {
-      CommentList tem = comments;
-      comments = null;
-      return tem;
+        public String getBaseUri() {
+            return baseUri;
+        }
     }
 
-    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);
+    class ContextImpl extends AbstractContext {
+
+        public String getBaseUri() {
+            return xmlBaseHandler.getBaseUri();
+        }
     }
 
-    public void endPrefixMapping(String prefix) {
-      context.prefixMapping = context.prefixMapping.next;
+    static interface CommentHandler {
+
+        void comment(String value);
     }
 
-    public void setDocumentLocator(Locator loc) {
-      locator = loc;
-      xmlBaseHandler.setLocator(loc);
-    }
-  }
+    abstract class Handler implements ContentHandler, CommentHandler {
+
+        CommentList comments;
+
+        CommentList getComments() {
+            CommentList tem = comments;
+            comments = null;
+            return tem;
+        }
 
-  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;
+        public void comment(String value) {
+            if (comments == null) {
+                comments = schemaBuilder.makeCommentList();
+            }
+            comments.addComment(value, makeLocation());
+        }
 
-    void set() {
-      xr.setContentHandler(this);
-    }
-
-    abstract State create();
-    abstract State createChildState(String localName) throws SAXException;
-
+        public void processingInstruction(String target, String date) {
+        }
 
-    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());
-    }
+        public void skippedEntity(String name) {
+        }
+
+        public void ignorableWhitespace(char[] ch, int start, int len) {
+        }
 
-    String getNs() {
-      return ns == null ? nsInherit : ns;
-    }
+        public void startDocument() {
+        }
 
-    boolean isRelaxNGElement(String uri) throws SAXException {
-      return uri.equals(relaxngURI);
-    }
+        public void endDocument() {
+        }
 
-    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;
+        public void startPrefixMapping(String prefix, String uri) {
+            context.prefixMapping = new PrefixMapping(prefix, uri, context.prefixMapping);
         }
-        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 endPrefixMapping(String prefix) {
+            context.prefixMapping = context.prefixMapping.next;
+        }
 
-    public void endElement(String namespaceURI,
-                           String localName,
-                           String qName) throws SAXException {
-      xmlBaseHandler.endElement();
-      parent.set();
-      end();
+        public void setDocumentLocator(Locator loc) {
+            locator = loc;
+            xmlBaseHandler.setLocator(loc);
+        }
     }
 
-    void setName(String name) throws SAXException {
-      error("illegal_name_attribute");
-    }
+    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 setOtherAttribute(String name, String value) throws SAXException {
-      error("illegal_attribute_ignored", name);
-    }
+        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());
+            }
+        }
 
-    void endAttributes() throws SAXException {
-    }
+        String getNs() {
+            return ns == null ? nsInherit : ns;
+        }
 
-    void checkForeignElement() throws SAXException {
-    }
+        boolean isRelaxNGElement(String uri) throws SAXException {
+            return uri.equals(relaxngURI);
+        }
 
-    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));
+        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 {
         }
-        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);
+
+        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();
         }
-      }
-      endAttributes();
-    }
 
-    abstract void end() throws SAXException;
+        abstract void end() throws SAXException;
 
-    void endChild(ParsedPattern pattern) {
-      // XXX cannot happen; throw exception
-    }
-
-    void endChild(ParsedNameClass nc) {
-      // XXX cannot happen; throw exception
-    }
+        void endChild(ParsedPattern pattern) {
+            // XXX cannot happen; throw exception
+        }
 
-    public void startDocument() { }
-    public void endDocument() {
-      if (comments != null && startPattern != null) {
-        startPattern = schemaBuilder.commentAfter(startPattern, comments);
-        comments = null;
-      }
-    }
+        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;
+        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);
+        }
 
-    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;
+            }
+        }
     }
 
-    void mergeLeadingComments() {
-      if (comments != null) {
-        if (annotations == null)
-          annotations = schemaBuilder.makeAnnotations(comments, getContext());
-        else
-          annotations.addLeadingComment(comments);
-        comments = null;
-      }
-    }
-  }
+    class ForeignElementHandler extends Handler {
 
-  class ForeignElementHandler extends Handler {
-    final State nextState;
-    ElementAnnotationBuilder builder;
-    final Stack builderStack = new Stack();
-    StringBuffer textBuf;
-    Location textLoc;
+        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;
+        }
 
-    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 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();
-    }
-
-    public void comment(String value) {
-      flushText();
-      super.comment(value);
-    }
+        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);
+            }
+        }
 
-    void flushText() {
-      if (textBuf != null && textBuf.length() != 0) {
-        builder.addText(textBuf.toString(), textLoc, getComments());
-        textBuf.setLength(0);
-      }
-      textLoc = null;
-    }
-  }
-
-  class Skipper extends DefaultHandler implements CommentHandler {
-    int level = 1;
-    final State nextState;
+        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();
+            }
+        }
 
-    Skipper(State nextState) {
-      this.nextState = nextState;
-    }
+        @Override
+        public void comment(String value) {
+            flushText();
+            super.comment(value);
+        }
 
-    public void startElement(String namespaceURI,
-                             String localName,
-                             String qName,
-                             Attributes atts) throws SAXException {
-      ++level;
-    }
-
-    public void endElement(String namespaceURI,
-                           String localName,
-                           String qName) throws SAXException {
-      if (--level == 0)
-        nextState.set();
+        void flushText() {
+            if (textBuf != null && textBuf.length() != 0) {
+                builder.addText(textBuf.toString(), textLoc, getComments());
+                textBuf.setLength(0);
+            }
+            textLoc = null;
+        }
     }
 
-    public void comment(String value) {
-    }
-  }
-
-  abstract class EmptyContentState extends State {
-
-    State createChildState(String localName) throws SAXException {
-      error("expected_empty", localName);
-      return null;
-    }
-
-    abstract ParsedPattern makePattern() throws SAXException;
+    static class Skipper extends DefaultHandler implements CommentHandler {
 
-    void end() throws SAXException {
-      if (comments != null) {
-        if (annotations == null)
-          annotations = schemaBuilder.makeAnnotations(null, getContext());
-        annotations.addComment(comments);
-        comments = null;
-      }
-      parent.endChild(makePattern());
-    }
-  }
+        int level = 1;
+        final State nextState;
 
-  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();
-    }
+        Skipper(State nextState) {
+            this.nextState = nextState;
+        }
 
-    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);
-    }
-
-    void endChild(ParsedPattern pattern) {
-      if (childPatterns == null)
-        childPatterns = new ArrayList<ParsedPattern>(INIT_CHILD_ALLOC);
-      childPatterns.add(pattern);
-    }
-
-    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));
-      }
-    }
+        @Override
+        public void startElement(String namespaceURI,
+                String localName,
+                String qName,
+                Attributes atts) throws SAXException {
+            ++level;
+        }
 
-    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));
-    }
+        @Override
+        public void endElement(String namespaceURI,
+                String localName,
+                String qName) throws SAXException {
+            if (--level == 0) {
+                nextState.set();
+            }
+        }
 
-    void sendPatternToParent(ParsedPattern p) {
-      parent.endChild(p);
-    }
-  }
-
-  class GroupState extends PatternContainerState {
-    State create() {
-      return new GroupState();
-    }
-  }
-
-  class ZeroOrMoreState extends PatternContainerState {
-    State create() {
-      return new ZeroOrMoreState();
+        public void comment(String value) {
+        }
     }
 
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeZeroOrMore(super.buildPattern(patterns, loc, null), loc, anno);
-    }
-  }
+    abstract class EmptyContentState 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);
-    }
-  }
+        State createChildState(String localName) throws SAXException {
+            error("expected_empty", localName);
+            return null;
+        }
+
+        abstract ParsedPattern makePattern() throws SAXException;
 
-  class OptionalState extends PatternContainerState {
-    State create() {
-      return new OptionalState();
+        void end() throws SAXException {
+            if (comments != null) {
+                if (annotations == null) {
+                    annotations = schemaBuilder.makeAnnotations(null, getContext());
+                }
+                annotations.addComment(comments);
+                comments = null;
+            }
+            parent.endChild(makePattern());
+        }
     }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeOptional(super.buildPattern(patterns, loc, null), loc, anno);
-    }
-  }
+    static private final int INIT_CHILD_ALLOC = 5;
+
+    abstract class PatternContainerState extends State {
 
-  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);
-    }
-  }
+        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);
+        }
 
-  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);
-    }
-  }
+        @Override
+        void endChild(ParsedPattern pattern) {
+            if (childPatterns == null) {
+                childPatterns = new ArrayList<ParsedPattern>(INIT_CHILD_ALLOC);
+            }
+            childPatterns.add(pattern);
+        }
 
-  class InterleaveState extends PatternContainerState {
-    State create() {
-      return new InterleaveState();
-    }
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) {
-      return schemaBuilder.makeInterleave(patterns, loc, anno);
-    }
-  }
+        @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));
+            }
+        }
 
-  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);
-    }
-  }
+        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));
+        }
 
-  static interface NameClassRef {
-    void setNameClass(ParsedNameClass nc);
-  }
+        void sendPatternToParent(ParsedPattern p) {
+            parent.endChild(p);
+        }
+    }
 
-  class ElementState extends PatternContainerState implements NameClassRef {
-    ParsedNameClass nameClass;
-    boolean nameClassWasAttribute;
-    String name;
+    class GroupState extends PatternContainerState {
 
-    void setName(String name) {
-      this.name = name;
+        State create() {
+            return new GroupState();
+        }
     }
 
-    public void setNameClass(ParsedNameClass nc) {
-      nameClass = nc;
+    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);
+        }
     }
 
-    void endAttributes() throws SAXException {
-      if (name != null) {
-        nameClass = expandName(name, getNs(), null);
-        nameClassWasAttribute = true;
-      }
-      else
-        new NameClassChildState(this, this).set();
+    class OneOrMoreState extends PatternContainerState {
+
+        State create() {
+            return new OneOrMoreState();
+        }
+
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeOneOrMore(super.buildPattern(patterns, loc, null), loc, anno);
+        }
     }
 
-    State create() {
-      return new ElementState();
+    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);
+        }
     }
 
-    ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
-      return schemaBuilder.makeElement(nameClass, super.buildPattern(patterns, loc, null), loc, anno);
+    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);
+        }
+    }
+
+    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 endForeignChild(ParsedElementAnnotation ea) {
-      if (nameClassWasAttribute || childPatterns!=null || nameClass == null)
-        super.endForeignChild(ea);
-      else
-        nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
+    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);
+        }
     }
-  }
+
+    class MixedState extends PatternContainerState {
+
+        State create() {
+            return new MixedState();
+        }
 
-  class RootState extends PatternContainerState {
-    IncludedGrammar grammar;
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeMixed(super.buildPattern(patterns, loc, null), loc, anno);
+        }
+    }
 
-    RootState() {
+    static interface NameClassRef {
+
+        void setNameClass(ParsedNameClass nc);
     }
 
-    RootState(IncludedGrammar grammar, Scope scope, String ns) {
-      this.grammar = grammar;
-      this.scope = scope;
-      this.nsInherit = ns;
-      this.datatypeLibrary = "";
-    }
+    class ElementState extends PatternContainerState implements NameClassRef {
+
+        ParsedNameClass nameClass;
+        boolean nameClassWasAttribute;
+        String name;
 
-    State create() {
-      return new RootState();
-    }
+        @Override
+        void setName(String name) {
+            this.name = name;
+        }
 
-    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 void setNameClass(ParsedNameClass nc) {
+            nameClass = nc;
+        }
 
-    void checkForeignElement() throws SAXException {
-      error("root_bad_namespace_uri", WellKnownNamespaces.RELAX_NG);
-    }
+        @Override
+        void endAttributes() throws SAXException {
+            if (name != null) {
+                nameClass = expandName(name, getNs(), null);
+                nameClassWasAttribute = true;
+            } else {
+                new NameClassChildState(this, this).set();
+            }
+        }
 
-    void endChild(ParsedPattern pattern) {
-      startPattern = pattern;
-    }
+        State create() {
+            return new ElementState();
+        }
 
-    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;
-    }
+        @Override
+        ParsedPattern buildPattern(List<ParsedPattern> patterns, Location loc, Annotations anno) throws SAXException {
+            return schemaBuilder.makeElement(nameClass, super.buildPattern(patterns, loc, null), loc, anno);
+        }
 
-  }
-
-  class NotAllowedState extends EmptyContentState {
-    State create() {
-      return new NotAllowedState();
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            if (nameClassWasAttribute || childPatterns != null || nameClass == null) {
+                super.endForeignChild(ea);
+            } else {
+                nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
+            }
+        }
     }
 
-    ParsedPattern makePattern() {
-      return schemaBuilder.makeNotAllowed(startLocation, annotations);
-    }
-  }
+    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();
+        }
 
-  class EmptyState extends EmptyContentState {
-    State create() {
-      return new EmptyState();
-    }
+        @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);
+        }
 
-    ParsedPattern makePattern() {
-      return schemaBuilder.makeEmpty(startLocation, annotations);
-    }
-  }
+        @Override
+        void endChild(ParsedPattern pattern) {
+            startPattern = pattern;
+        }
 
-  class TextState extends EmptyContentState {
-    State create() {
-      return new TextState();
+        @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;
+        }
     }
 
-    ParsedPattern makePattern() {
-      return schemaBuilder.makeText(startLocation, annotations);
-    }
-  }
+    class NotAllowedState extends EmptyContentState {
 
-  class ValueState extends EmptyContentState {
-    final StringBuffer buf = new StringBuffer();
-    String type;
+        State create() {
+            return new NotAllowedState();
+        }
 
-    State create() {
-      return new ValueState();
+        ParsedPattern makePattern() {
+            return schemaBuilder.makeNotAllowed(startLocation, annotations);
+        }
     }
 
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("type"))
-        type = checkNCName(value.trim());
-      else
-        super.setOtherAttribute(name, value);
-    }
+    class EmptyState extends EmptyContentState {
 
-    public void characters(char[] ch, int start, int len) {
-      buf.append(ch, start, len);
-    }
+        State create() {
+            return new EmptyState();
+        }
 
-    void checkForeignElement() throws SAXException {
-      error("value_contains_foreign_element");
+        ParsedPattern makePattern() {
+            return schemaBuilder.makeEmpty(startLocation, annotations);
+        }
     }
 
-    ParsedPattern makePattern() throws SAXException {
-      if (type == null)
-        return makePattern("", "token");
-      else
-        return makePattern(datatypeLibrary, type);
-    }
+    class TextState extends EmptyContentState {
 
-    void end() throws SAXException {
-      mergeLeadingComments();
-      super.end();
-    }
+        State create() {
+            return new TextState();
+        }
 
-    ParsedPattern makePattern(String datatypeLibrary, String type) {
-      return schemaBuilder.makeValue(datatypeLibrary,
-                                     type,
-                                     buf.toString(),
-                                     getContext(),
-                                     getNs(),
-                                     startLocation,
-                                     annotations);
+        ParsedPattern makePattern() {
+            return schemaBuilder.makeText(startLocation, annotations);
+        }
     }
 
-  }
+    class ValueState extends EmptyContentState {
+
+        final StringBuffer buf = new StringBuffer();
+        String type;
+
+        State create() {
+            return new ValueState();
+        }
 
-  class DataState extends State {
-    String type;
-    ParsedPattern except = null;
-    DataPatternBuilder dpb = null;
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("type")) {
+                type = checkNCName(value.trim());
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
 
-    State create() {
-      return new DataState();
-    }
+        @Override
+        public void characters(char[] ch, int start, int len) {
+            buf.append(ch, start, len);
+        }
 
-    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 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 setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("type"))
-        type = checkNCName(value.trim());
-      else
-        super.setOtherAttribute(name, value);
-    }
+    class DataState extends State {
+
+        String type;
+        ParsedPattern except = null;
+        DataPatternBuilder dpb = null;
+
+        State create() {
+            return new DataState();
+        }
 
-    void endAttributes() throws SAXException {
-      if (type == null)
-        error("missing_type_attribute");
-      else
-        dpb = schemaBuilder.makeDataPatternBuilder(datatypeLibrary, type, startLocation);
-    }
-
-    void endForeignChild(ParsedElementAnnotation ea) {
-      dpb.annotation(ea);
-    }
+        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;
+        }
 
-    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 setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("type")) {
+                type = checkNCName(value.trim());
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
 
-    void endChild(ParsedPattern pattern) {
-      except = pattern;
-    }
-
-  }
+        @Override
+        void endAttributes() throws SAXException {
+            if (type == null) {
+                error("missing_type_attribute");
+            } else {
+                dpb = schemaBuilder.makeDataPatternBuilder(datatypeLibrary, type, startLocation);
+            }
+        }
 
-  class ParamState extends State {
-    private final StringBuffer buf = new StringBuffer();
-    private final DataPatternBuilder dpb;
-    private String name;
-
-    ParamState(DataPatternBuilder dpb) {
-      this.dpb = dpb;
-    }
+        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);
+        }
 
-    State create() {
-      return new ParamState(null);
-    }
-
-    void setName(String name) throws SAXException {
-      this.name = checkNCName(name);
-    }
-
-    void endAttributes() throws SAXException {
-      if (name == null)
-        error("missing_name_attribute");
+        @Override
+        void endChild(ParsedPattern pattern) {
+            except = pattern;
+        }
     }
 
-    State createChildState(String localName) throws SAXException {
-      error("expected_empty", localName);
-      return null;
-    }
+    class ParamState extends State {
 
-    public void characters(char[] ch, int start, int len) {
-      buf.append(ch, start, len);
-    }
+        private final StringBuffer buf = new StringBuffer();
+        private final DataPatternBuilder dpb;
+        private String name;
 
-    void checkForeignElement() throws SAXException {
-      error("param_contains_foreign_element");
-    }
+        ParamState(DataPatternBuilder dpb) {
+            this.dpb = dpb;
+        }
 
-    void end() throws SAXException {
-      if (name == null)
-        return;
-      if (dpb == null)
-        return;
-      mergeLeadingComments();
-      dpb.addParam(name, buf.toString(), getContext(), getNs(), startLocation, annotations);
-    }
-  }
+        State create() {
+            return new ParamState(null);
+        }
 
-  class AttributeState extends PatternContainerState implements NameClassRef {
-    ParsedNameClass nameClass;
-    boolean nameClassWasAttribute;
-    String name;
+        @Override
+        void setName(String name) throws SAXException {
+            this.name = checkNCName(name);
+        }
 
-    State create() {
-      return new AttributeState();
-    }
-
-    void setName(String name) {
-      this.name = name;
-    }
+        @Override
+        void endAttributes() throws SAXException {
+            if (name == null) {
+                error("missing_name_attribute");
+            }
+        }
 
-    public void setNameClass(ParsedNameClass nc) {
-      nameClass = nc;
-    }
+        State createChildState(String localName) throws SAXException {
+            error("expected_empty", localName);
+            return null;
+        }
 
-    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
+        public void characters(char[] ch, int start, int len) {
+            buf.append(ch, start, len);
+        }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      if (nameClassWasAttribute || childPatterns!=null || nameClass == null)
-        super.endForeignChild(ea);
-      else
-        nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
-    }
+        @Override
+        void checkForeignElement() throws SAXException {
+            error("param_contains_foreign_element");
+        }
 
-    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;
+        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;
 
-  abstract class SinglePatternContainerState extends PatternContainerState {
-    State createChildState(String localName) throws SAXException {
-      if (childPatterns==null)
-        return super.createChildState(localName);
-      error("too_many_children");
-      return null;
-    }
-  }
+        State create() {
+            return new AttributeState();
+        }
 
-  class GrammarSectionState extends State {
-    GrammarSection section;
+        @Override
+        void setName(String name) {
+            this.name = name;
+        }
 
-    GrammarSectionState() { }
-
-    GrammarSectionState(GrammarSection section) {
-      this.section = section;
-    }
+        public void setNameClass(ParsedNameClass nc) {
+            nameClass = nc;
+        }
 
-    State create() {
-      return new GrammarSectionState(null);
-    }
+        @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();
+            }
+        }
 
-    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;
-    }
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            if (nameClassWasAttribute || childPatterns != null || nameClass == null) {
+                super.endForeignChild(ea);
+            } else {
+                nameClass = nameClassBuilder.annotateAfter(nameClass, ea);
+            }
+        }
 
-    void end() throws SAXException {
-      if (comments != null) {
-        section.topLevelComment(comments);
-        comments = null;
-      }
+        @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;
+        }
     }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      section.topLevelAnnotation(ea);
-    }
-  }
-
-  class DivState extends GrammarSectionState {
-    final Div div;
-    DivState(Div div) {
-      super(div);
-      this.div = div;
-    }
+    abstract class SinglePatternContainerState extends PatternContainerState {
 
-    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;
+        @Override
+        State createChildState(String localName) throws SAXException {
+            if (childPatterns == null) {
+                return super.createChildState(localName);
+            }
+            error("too_many_children");
+            return null;
+        }
     }
 
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("href")) {
-        href = value;
-        checkUri(href);
-      }
-      else
-        super.setOtherAttribute(name, value);
-    }
+    class GrammarSectionState extends State {
+
+        GrammarSection section;
+
+        GrammarSectionState() {
+        }
+
+        GrammarSectionState(GrammarSection section) {
+            this.section = section;
+        }
+
+        State create() {
+            return new GrammarSectionState(null);
+        }
 
-    void endAttributes() throws SAXException {
-      if (href == null)
-        error("missing_href_attribute");
-      else
-        href = resolve(href);
+        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 end() throws SAXException {
-      super.end();
-      if (href != null) {
-        try {
-          include.endInclude(parseable, href, getNs(), startLocation, annotations);
-        }
-        catch (IllegalSchemaException e) {
+    class DivState extends GrammarSectionState {
+
+        final Div div;
+
+        DivState(Div div) {
+            super(div);
+            this.div = div;
         }
-      }
-    }
-  }
 
-  class MergeGrammarState extends GrammarSectionState {
-    final IncludedGrammar grammar;
-    MergeGrammarState(IncludedGrammar grammar) {
-      super(grammar);
-      this.grammar = grammar;
+        @Override
+        void end() throws SAXException {
+            super.end();
+            div.endDiv(startLocation, annotations);
+        }
     }
 
-    void end() throws SAXException {
-      super.end();
-      parent.endChild(grammar.endIncludedGrammar(startLocation, annotations));
-    }
-  }
+    class IncludeState extends GrammarSectionState {
+
+        String href;
+        final Include include;
 
-  class GrammarState extends GrammarSectionState {
-    Grammar grammar;
+        IncludeState(Include include) {
+            super(include);
+            this.include = include;
+        }
 
-    void setParent(State parent) {
-      super.setParent(parent);
-      grammar = schemaBuilder.makeGrammar(scope);
-      section = grammar;
-      scope = grammar;
-    }
-
-    State create() {
-      return new GrammarState();
-    }
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("href")) {
+                href = value;
+                checkUri(href);
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
 
-    void end() throws SAXException {
-      super.end();
-      parent.endChild(grammar.endGrammar(startLocation, annotations));
-    }
-  }
-
-  class RefState extends EmptyContentState {
-    String name;
+        @Override
+        void endAttributes() throws SAXException {
+            if (href == null) {
+                error("missing_href_attribute");
+            } else {
+                href = resolve(href);
+            }
+        }
 
-    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);
+        @Override
+        void end() throws SAXException {
+            super.end();
+            if (href != null) {
+                try {
+                    include.endInclude(parseable, href, getNs(), startLocation, annotations);
+                } catch (IllegalSchemaException e) {
+                }
+            }
+        }
     }
 
-    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 MergeGrammarState extends GrammarSectionState {
+
+        final IncludedGrammar grammar;
 
-  class ParentRefState extends RefState {
-    State create() {
-      return new ParentRefState();
+        MergeGrammarState(IncludedGrammar grammar) {
+            super(grammar);
+            this.grammar = grammar;
+        }
+
+        @Override
+        void end() throws SAXException {
+            super.end();
+            parent.endChild(grammar.endIncludedGrammar(startLocation, annotations));
+        }
     }
 
-    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 GrammarState extends GrammarSectionState {
+
+        Grammar grammar;
 
-  class ExternalRefState extends EmptyContentState {
-    String href;
-    ParsedPattern includedPattern;
+        @Override
+        void setParent(State parent) {
+            super.setParent(parent);
+            grammar = schemaBuilder.makeGrammar(scope);
+            section = grammar;
+            scope = grammar;
+        }
 
-    State create() {
-      return new ExternalRefState();
+        @Override
+        State create() {
+            return new GrammarState();
+        }
+
+        @Override
+        void end() throws SAXException {
+            super.end();
+            parent.endChild(grammar.endGrammar(startLocation, annotations));
+        }
     }
 
-    void setOtherAttribute(String name, String value) throws SAXException {
-      if (name.equals("href")) {
-        href = value;
-        checkUri(href);
-      }
-      else
-        super.setOtherAttribute(name, value);
-    }
+    class RefState extends EmptyContentState {
+
+        String name;
+
+        State create() {
+            return new RefState();
+        }
+
+        @Override
+        void endAttributes() throws SAXException {
+            if (name == null) {
+                error("missing_name_attribute");
+            }
+        }
 
-    void endAttributes() throws SAXException {
-      if (href == null)
-        error("missing_href_attribute");
-      else
-        href = resolve(href);
+        @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 makePattern() {
-      if (href != null) {
-        try {
-          return schemaBuilder.makeExternalRef(parseable,
-                                               href,
-                                               getNs(),
-                                               scope,
-                                               startLocation,
-                                               annotations);
+    class ParentRefState extends RefState {
+
+        @Override
+        State create() {
+            return new ParentRefState();
         }
-        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);
+        @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 setName(String name) throws SAXException {
-      this.name = checkNCName(name);
-    }
+    class ExternalRefState extends EmptyContentState {
+
+        String href;
+
+        State create() {
+            return new ExternalRefState();
+        }
 
-    void endAttributes() throws SAXException {
-      if (name == null)
-        error("missing_name_attribute");
-    }
+        @Override
+        void setOtherAttribute(String name, String value) throws SAXException {
+            if (name.equals("href")) {
+                href = value;
+                checkUri(href);
+            } else {
+                super.setOtherAttribute(name, value);
+            }
+        }
 
-    void sendPatternToParent(ParsedPattern p) {
-      if (name != null)
-        section.define(name, combine, p, startLocation, annotations);
-    }
-
-  }
+        @Override
+        void endAttributes() throws SAXException {
+            if (href == null) {
+                error("missing_href_attribute");
+            } else {
+                href = resolve(href);
+            }
+        }
 
-  class StartState extends DefinitionState {
-
-    StartState(GrammarSection section) {
-      super(section);
-    }
-
-    State create() {
-      return new StartState(null);
+        ParsedPattern makePattern() {
+            if (href != null) {
+                try {
+                    return schemaBuilder.makeExternalRef(parseable,
+                            href,
+                            getNs(),
+                            scope,
+                            startLocation,
+                            annotations);
+                } catch (IllegalSchemaException e) {
+                }
+            }
+            return schemaBuilder.makeErrorPattern();
+        }
     }
 
-    void sendPatternToParent(ParsedPattern p) {
-      section.define(GrammarSection.START, combine, p, startLocation, annotations);
-    }
+    abstract class DefinitionState extends PatternContainerState {
+
+        GrammarSection.Combine combine = null;
+        final GrammarSection section;
+
+        DefinitionState(GrammarSection section) {
+            this.section = section;
+        }
 
-    State createChildState(String localName) throws SAXException {
-      State tem = super.createChildState(localName);
-      if (tem != null && childPatterns!=null)
-        error("start_multi_pattern");
-      return tem;
+        @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);
+        }
     }
 
-  }
+    class DefineState extends DefinitionState {
+
+        String name;
+
+        DefineState(GrammarSection section) {
+            super(section);
+        }
+
+        State create() {
+            return new DefineState(null);
+        }
 
-  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();
-    }
-  }
+        @Override
+        void setName(String name) throws SAXException {
+            this.name = checkNCName(name);
+        }
 
-  class NameClassChildState extends NameClassContainerState {
-    final State prevState;
-    final NameClassRef nameClassRef;
+        @Override
+        void endAttributes() throws SAXException {
+            if (name == null) {
+                error("missing_name_attribute");
+            }
+        }
 
-    State create() {
-      return null;
+        @Override
+        void sendPatternToParent(ParsedPattern p) {
+            if (name != null) {
+                section.define(name, combine, p, startLocation, annotations);
+            }
+        }
     }
 
-    NameClassChildState(State prevState, NameClassRef nameClassRef) {
-      this.prevState = prevState;
-      this.nameClassRef = nameClassRef;
-      setParent(prevState.parent);
-      this.ns = prevState.ns;
-    }
+    class StartState extends DefinitionState {
+
+        StartState(GrammarSection section) {
+            super(section);
+        }
+
+        State create() {
+            return new StartState(null);
+        }
 
-    void endChild(ParsedNameClass nameClass) {
-      nameClassRef.setNameClass(nameClass);
-      prevState.set();
-    }
+        @Override
+        void sendPatternToParent(ParsedPattern p) {
+            section.define(GrammarSection.START, combine, p, startLocation, annotations);
+        }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      prevState.endForeignChild(ea);
+        @Override
+        State createChildState(String localName) throws SAXException {
+            State tem = super.createChildState(localName);
+            if (tem != null && childPatterns != null) {
+                error("start_multi_pattern");
+            }
+            return tem;
+        }
     }
 
-    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;
+    abstract class NameClassContainerState extends State {
 
-    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 createChildState(String localName) throws SAXException {
+            State state = (State) nameClassTable.get(localName);
+            if (state == null) {
+                error("expected_name_class", localName);
+                return null;
+            }
+            return state.create();
+        }
     }
 
-    State create() {
-      return new NameState();
-    }
+    class NameClassChildState extends NameClassContainerState {
+
+        final State prevState;
+        final NameClassRef nameClassRef;
 
-    public void characters(char[] ch, int start, int len) {
-      buf.append(ch, start, len);
-    }
+        State create() {
+            return null;
+        }
+
+        NameClassChildState(State prevState, NameClassRef nameClassRef) {
+            this.prevState = prevState;
+            this.nameClassRef = nameClassRef;
+            setParent(prevState.parent);
+            this.ns = prevState.ns;
+        }
 
-    void checkForeignElement() throws SAXException {
-      error("name_contains_foreign_element");
-    }
+        @Override
+        void endChild(ParsedNameClass nameClass) {
+            nameClassRef.setNameClass(nameClass);
+            prevState.set();
+        }
 
-    ParsedNameClass makeNameClass() throws SAXException {
-      mergeLeadingComments();
-      return expandName(buf.toString().trim(), getNs(), annotations);
+        @Override
+        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 {
 
-  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;
+        abstract ParsedNameClass makeNameClass() throws SAXException;
 
-    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;
+        void end() throws SAXException {
+            parent.endChild(makeNameClass());
+        }
     }
 
-    ParsedNameClass makeNameClass() {
-      if (except == null)
-        return makeNameClassNoExcept();
-      else
-        return makeNameClassExcept(except);
-    }
+    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();
+        }
 
-    ParsedNameClass makeNameClassNoExcept() {
-      return nameClassBuilder.makeAnyName(startLocation, annotations);
+        @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);
+        }
     }
-
-    ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
-      return nameClassBuilder.makeAnyName(except, startLocation, 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;
 
-    void endChild(ParsedNameClass nameClass) {
-      except = nameClass;
-    }
+    class AnyNameState extends NameClassBaseState {
 
-  }
+        ParsedNameClass except = null;
 
-  class NsNameState extends AnyNameState {
-    State create() {
-      return new NsNameState();
-    }
+        State create() {
+            return new AnyNameState();
+        }
 
-    ParsedNameClass makeNameClassNoExcept() {
-      return nameClassBuilder.makeNsName(getNs(), null, null);
-    }
+        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;
+        }
 
-    ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
-      return nameClassBuilder.makeNsName(getNs(), except, null, null);
-    }
+        int getContext() {
+            return ANY_NAME_CONTEXT;
+        }
 
-    int getContext() {
-      return NS_NAME_CONTEXT;
-    }
-
-  }
+        ParsedNameClass makeNameClass() {
+            if (except == null) {
+                return makeNameClassNoExcept();
+            } else {
+                return makeNameClassExcept(except);
+            }
+        }
 
-  class NameClassChoiceState extends NameClassContainerState {
-    private ParsedNameClass[] nameClasses;
-    private int nNameClasses;
-    private int context;
+        ParsedNameClass makeNameClassNoExcept() {
+            return nameClassBuilder.makeAnyName(startLocation, annotations);
+        }
 
-    NameClassChoiceState() {
-      this.context = PATTERN_CONTEXT;
+        ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
+            return nameClassBuilder.makeAnyName(except, startLocation, annotations);
+        }
+
+        @Override
+        void endChild(ParsedNameClass nameClass) {
+            except = nameClass;
+        }
     }
 
-    NameClassChoiceState(int context) {
-      this.context = context;
-    }
-
-    void setParent(State parent) {
-      super.setParent(parent);
-      if (parent instanceof NameClassChoiceState)
-        this.context = ((NameClassChoiceState)parent).context;
-    }
+    class NsNameState extends AnyNameState {
 
-    State create() {
-      return new NameClassChoiceState();
-    }
+        @Override
+        State create() {
+            return new NsNameState();
+        }
 
-    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;
+        @Override
+        ParsedNameClass makeNameClassNoExcept() {
+            return nameClassBuilder.makeNsName(getNs(), null, 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;
-    }
+        @Override
+        ParsedNameClass makeNameClassExcept(ParsedNameClass except) {
+            return nameClassBuilder.makeNsName(getNs(), except, null, null);
+        }
 
-    void endForeignChild(ParsedElementAnnotation ea) {
-      if (nNameClasses == 0)
-        super.endForeignChild(ea);
-      else
-        nameClasses[nNameClasses - 1] = nameClassBuilder.annotateAfter(nameClasses[nNameClasses - 1], ea);
+        @Override
+        int getContext() {
+            return NS_NAME_CONTEXT;
+        }
     }
 
-    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));
-    }
-  }
+    class NameClassChoiceState extends NameClassContainerState {
+
+        private ParsedNameClass[] nameClasses;
+        private int nNameClasses;
+        private int context;
+
+        NameClassChoiceState() {
+            this.context = PATTERN_CONTEXT;
+        }
 
-  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());
-  }
+        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();
+        }
 
-  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);
-  }
+        @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);
+        }
 
-  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);
-  }
+        @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;
+        }
 
-  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));
-  }
+        @Override
+        void endForeignChild(ParsedElementAnnotation ea) {
+            if (nNameClasses == 0) {
+                super.endForeignChild(ea);
+            } else {
+                nameClasses[nNameClasses - 1] = nameClassBuilder.annotateAfter(nameClasses[nNameClasses - 1], ea);
+            }
+        }
 
-  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);
-  }
+        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 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);
-  }
+    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());
+    }
 
-  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());
-      }
+    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);
     }
-    initPatternTable();
-    initNameClassTable();
-    new RootState(grammar, scope, inheritedNs).set();
-  }
 
+    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 Context getContext() {
-    return context;
-  }
+    private void error(String key, String arg, Locator loc) throws SAXException {
+        error(new SAXParseException(localizer.message(key, arg), loc));
+    }
 
-  class LexicalHandlerImpl extends AbstractLexicalHandler {
-    private boolean inDtd = false;
+    private void error(String key, String arg1, String arg2, Locator loc)
+            throws SAXException {
+        error(new SAXParseException(localizer.message(key, arg1, arg2), loc));
+    }
 
-    public void startDTD(String s, String s1, String s2) throws SAXException {
-      inDtd = true;
+    private void error(SAXParseException e) throws SAXException {
+        hadError = true;
+        if (eh != null) {
+            eh.error(e);
+        }
     }
 
-    public void endDTD() throws SAXException {
-      inDtd = false;
+    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);
     }
 
-    public void comment(char[] chars, int start, int length) throws SAXException {
-      if (!inDtd)
-        ((CommentHandler)xr.getContentHandler()).comment(new String(chars, start, length));
+    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 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 void warning(String key, String arg1, String arg2, Locator loc)
+            throws SAXException {
+        warning(new SAXParseException(localizer.message(key, arg1, arg2), loc));
+    }
 
-  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 warning(SAXParseException e) throws SAXException {
+        if (eh != null) {
+            eh.warning(e);
         }
     }
-    else {
-      int off = qName.indexOf(':');
-      if (off > 0)
-        prefix = qName.substring(0, off);
+
+    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();
     }
-    return prefix;
-  }
-  private String checkNCName(String str) throws SAXException {
-    if (!Naming.isNcname(str))
-      error("invalid_ncname", str);
-    return str;
-  }
+
+    private Context getContext() {
+        return context;
+    }
+
+    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));
+            }
+        }
+    }
 
-  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 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 Location makeLocation() {
-    if (locator == null)
-      return null;
-    return schemaBuilder.makeLocation(locator.getSystemId(),
-                                      locator.getLineNumber(),
-                                      locator.getColumnNumber());
-  }
+    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;
+    }
 
-  private void checkUri(String s) throws SAXException {
-    if (!Uri.isValid(s))
-      error("invalid_uri", s);
-  }
+    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/src/share/jaxws_classes/com/sun/xml/internal/rngom/xml/sax/JAXPXMLReaderCreator.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/rngom/xml/sax/JAXPXMLReaderCreator.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/WsaTubeHelper.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/addressing/WsaTubeHelper.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundOperation.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundOperation.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundPortType.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLBoundPortType.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLExtensible.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLExtensible.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLFault.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLFault.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLModel.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLModel.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOperation.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOperation.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOutput.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLOutput.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPort.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPort.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPortType.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLPortType.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLService.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/WSDLService.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundFault.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundOperation.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLBoundPortType.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLFault.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLInput.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLMessage.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLModel.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLOperation.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLOutput.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPart.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPort.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLPortType.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/model/wsdl/editable/EditableWSDLService.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtension.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtension.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtensionContext.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/api/wsdl/parser/WSDLParserExtensionContext.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/binding/WebServiceFeatureList.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/client/MonitorRootClient.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/client/MonitorRootClient.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/client/PortInfo.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/client/PortInfo.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/client/Stub.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/client/Stub.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/client/WSServiceDelegate.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/ExternalMetadataReader.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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 TransformerException, JAXBException {
             Source xsl = new StreamSource(Util.class.getResourceAsStream(TRANSLATE_NAMESPACES_XSL));
-            JAXBResult result = new JAXBResult(jaxbContext(disableSecureXmlProcessing));
-            TransformerFactory tf = XmlUtil.newTransformerFactory(!disableSecureXmlProcessing);
+            JAXBResult result = new JAXBResult(jaxbContext(disableXmlSecurity));
+            TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
             Transformer transformer = tf.newTemplates(xsl).newTransformer();
             transformer.transform(src, result);
             return getJavaWsdlMapping(result.getResult());
@@ -534,9 +534,9 @@
             return elems.toArray(new Element[elems.size()]);
         }
 
-        static String documentRootNamespace(Source src, boolean disableSecureXmlProcessing) throws XMLStreamException {
+        static String documentRootNamespace(Source src, boolean disableXmlSecurity) throws XMLStreamException {
             XMLInputFactory factory;
-            factory = XmlUtil.newXMLInputFactory(!disableSecureXmlProcessing);
+            factory = XmlUtil.newXMLInputFactory(!disableXmlSecurity);
             XMLStreamReader streamReader = factory.createXMLStreamReader(src);
             XMLStreamReaderUtil.nextElementContent(streamReader);
             String namespaceURI = streamReader.getName().getNamespaceURI();
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/JavaMethodImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/JavaMethodImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -25,7 +25,6 @@
 
 package com.sun.xml.internal.ws.model;
 
-import com.sun.istack.internal.NotNull;
 import com.sun.xml.internal.bind.api.TypeReference;
 import com.sun.xml.internal.ws.api.databinding.MetadataReader;
 import com.sun.xml.internal.ws.api.model.JavaMethod;
@@ -216,14 +215,14 @@
      * @return soap:Body's first child name for request message.
      */
     public @Nullable QName getRequestPayloadName() {
-        return (wsdlOperation != null)? wsdlOperation.getReqPayloadName(): requestPayloadName;
+        return (wsdlOperation != null)? wsdlOperation.getRequestPayloadName(): requestPayloadName;
     }
 
     /**
      * @return soap:Body's first child name for response message.
      */
     public @Nullable QName getResponsePayloadName() {
-        return (mep == MEP.ONE_WAY) ? null : wsdlOperation.getResPayloadName();
+        return (mep == MEP.ONE_WAY) ? null : wsdlOperation.getResponsePayloadName();
     }
 
     /**
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/AbstractExtensibleImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/AbstractExtensibleImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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
@@ -29,11 +29,9 @@
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLExtension;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLObject;
 import com.sun.xml.internal.ws.resources.UtilMessages;
-import com.sun.xml.internal.ws.wsdl.parser.WSDLConstants;
 import com.sun.istack.internal.NotNull;
 
 import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.Location;
 import javax.xml.namespace.QName;
 import javax.xml.ws.WebServiceException;
 import java.util.ArrayList;
@@ -42,7 +40,6 @@
 import java.util.Set;
 
 import org.xml.sax.Locator;
-import org.xml.sax.helpers.LocatorImpl;
 
 /**
  * All the WSDL 1.1 elements that are extensible should subclass from this abstract implementation of
@@ -95,6 +92,10 @@
         extensions.add(ex);
     }
 
+    public List<? extends UnknownWSDLExtension> getNotUnderstoodExtensions() {
+        return notUnderstoodExtensions;
+    }
+
     /**
      * This can be used if a WSDL extension element that has wsdl:required=true
      * is not understood
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundFaultImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundFaultImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,10 +26,10 @@
 package com.sun.xml.internal.ws.model.wsdl;
 
 import com.sun.istack.internal.NotNull;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundFault;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLFault;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
+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.EditableWSDLFault;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
 
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.namespace.QName;
@@ -37,12 +37,12 @@
 /**
  * @author Vivek Pandey
  */
-public class WSDLBoundFaultImpl extends AbstractExtensibleImpl implements WSDLBoundFault {
+public class WSDLBoundFaultImpl extends AbstractExtensibleImpl implements EditableWSDLBoundFault {
     private final String name;
-    private WSDLFault fault;
-    private WSDLBoundOperationImpl owner;
+    private EditableWSDLFault fault;
+    private EditableWSDLBoundOperation owner;
 
-    public WSDLBoundFaultImpl(XMLStreamReader xsr, String name, WSDLBoundOperationImpl owner) {
+    public WSDLBoundFaultImpl(XMLStreamReader xsr, String name, EditableWSDLBoundOperation owner) {
         super(xsr);
         this.name = name;
         this.owner = owner;
@@ -61,20 +61,20 @@
         return null;
     }
 
-    public WSDLFault getFault() {
+    public EditableWSDLFault getFault() {
         return fault;
     }
 
     @NotNull
-    public WSDLBoundOperation getBoundOperation() {
+    public EditableWSDLBoundOperation getBoundOperation() {
         return owner;
     }
 
-    void freeze(WSDLBoundOperationImpl root) {
+    public void freeze(EditableWSDLBoundOperation root) {
         assert root != null;
-        WSDLOperation op = root.getOperation();
+        EditableWSDLOperation op = root.getOperation();
         if (op != null) {
-            for (WSDLFault f : op.getFaults()) {
+            for (EditableWSDLFault f : op.getFaults()) {
                 if (f.getName().equals(name)) {
                     this.fault = f;
                     break;
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundOperationImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundOperationImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -29,12 +29,20 @@
 import com.sun.istack.internal.NotNull;
 import com.sun.xml.internal.ws.api.model.ParameterBinding;
 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.EditableWSDLMessage;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
 import com.sun.xml.internal.ws.model.RuntimeModeler;
 
 import javax.jws.WebParam.Mode;
 import javax.jws.soap.SOAPBinding.Style;
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+
 import java.util.*;
 
 /**
@@ -42,7 +50,7 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLBoundOperationImpl extends AbstractExtensibleImpl implements WSDLBoundOperation {
+public final class WSDLBoundOperationImpl extends AbstractExtensibleImpl implements EditableWSDLBoundOperation {
     private final QName name;
 
     // map of wsdl:part to the binding
@@ -61,20 +69,20 @@
     private Boolean emptyOutputBody;
     private Boolean emptyFaultBody;
 
-    private final Map<String, WSDLPartImpl> inParts;
-    private final Map<String, WSDLPartImpl> outParts;
-    private final List<WSDLBoundFaultImpl> wsdlBoundFaults;
-    private WSDLOperationImpl operation;
+    private final Map<String, EditableWSDLPart> inParts;
+    private final Map<String, EditableWSDLPart> outParts;
+    private final List<EditableWSDLBoundFault> wsdlBoundFaults;
+    private EditableWSDLOperation operation;
     private String soapAction;
     private ANONYMOUS anonymous;
 
-    private final WSDLBoundPortTypeImpl owner;
+    private final EditableWSDLBoundPortType owner;
 
     /**
      *
      * @param name wsdl:operation name qualified value
      */
-    public WSDLBoundOperationImpl(XMLStreamReader xsr, WSDLBoundPortTypeImpl owner, QName name) {
+    public WSDLBoundOperationImpl(XMLStreamReader xsr, EditableWSDLBoundPortType owner, QName name) {
         super(xsr);
         this.name = name;
         inputParts = new HashMap<String, ParameterBinding>();
@@ -83,9 +91,9 @@
         inputMimeTypes = new HashMap<String, String>();
         outputMimeTypes = new HashMap<String, String>();
         faultMimeTypes = new HashMap<String, String>();
-        inParts = new HashMap<String, WSDLPartImpl>();
-        outParts = new HashMap<String, WSDLPartImpl>();
-        wsdlBoundFaults = new ArrayList<WSDLBoundFaultImpl>();
+        inParts = new HashMap<String, EditableWSDLPart>();
+        outParts = new HashMap<String, EditableWSDLPart>();
+        wsdlBoundFaults = new ArrayList<EditableWSDLBoundFault>();
         this.owner = owner;
     }
 
@@ -104,7 +112,7 @@
     }
 
     @Override
-    public WSDLPartImpl getPart(String partName, Mode mode) {
+    public EditableWSDLPart getPart(String partName, Mode mode) {
         if(mode==Mode.IN){
             return inParts.get(partName);
         }else if(mode==Mode.OUT){
@@ -113,7 +121,7 @@
         return null;
     }
 
-    public void addPart(WSDLPartImpl part, Mode mode){
+    public void addPart(EditableWSDLPart part, Mode mode){
         if(mode==Mode.IN)
             inParts.put(part.getName(), part);
         else if(mode==Mode.OUT)
@@ -149,54 +157,27 @@
 
     // TODO: what's the difference between this and inputParts/outputParts?
     @Override
-    public Map<String,WSDLPart> getInParts() {
-        return Collections.<String,WSDLPart>unmodifiableMap(inParts);
+    public Map<String, ? extends EditableWSDLPart> getInParts() {
+        return Collections.<String, EditableWSDLPart>unmodifiableMap(inParts);
     }
 
     @Override
-    public Map<String,WSDLPart> getOutParts() {
-        return Collections.<String,WSDLPart>unmodifiableMap(outParts);
+    public Map<String, ? extends EditableWSDLPart> getOutParts() {
+        return Collections.<String, EditableWSDLPart>unmodifiableMap(outParts);
     }
 
     @NotNull
     @Override
-    public List<WSDLBoundFaultImpl> getFaults() {
+    public List<? extends EditableWSDLBoundFault> getFaults() {
         return wsdlBoundFaults;
     }
 
-    public void addFault(@NotNull WSDLBoundFaultImpl fault){
+    public void addFault(@NotNull EditableWSDLBoundFault fault){
         wsdlBoundFaults.add(fault);
     }
 
 
     /**
-     * Map of mime:content@part and the mime type from mime:content@type for wsdl:output
-     *
-     * @return empty Map if there is no parts
-     */
-    public Map<String, String> getInputMimeTypes() {
-        return inputMimeTypes;
-    }
-
-    /**
-     * Map of mime:content@part and the mime type from mime:content@type for wsdl:output
-     *
-     * @return empty Map if there is no parts
-     */
-    public Map<String, String> getOutputMimeTypes() {
-        return outputMimeTypes;
-    }
-
-    /**
-     * Map of mime:content@part and the mime type from mime:content@type for wsdl:fault
-     *
-     * @return empty Map if there is no parts
-     */
-    public Map<String, String> getFaultMimeTypes() {
-        return faultMimeTypes;
-    }
-
-    /**
      * Gets {@link ParameterBinding} for a given wsdl part in wsdl:input
      *
      * @param part Name of wsdl:part, must be non-null
@@ -296,13 +277,13 @@
     }
 
     @Override
-    public WSDLOperationImpl getOperation() {
+    public EditableWSDLOperation getOperation() {
         return operation;
     }
 
 
     @Override
-    public WSDLBoundPortType getBoundPortType() {
+    public EditableWSDLBoundPortType getBoundPortType() {
         return owner;
     }
 
@@ -324,7 +305,7 @@
     }
 
     @Override
-    public @Nullable QName getReqPayloadName() {
+    public @Nullable QName getRequestPayloadName() {
         if (emptyRequestPayload)
             return null;
 
@@ -337,8 +318,8 @@
             return requestPayloadName;
         }else{
             QName inMsgName = operation.getInput().getMessage().getName();
-            WSDLMessageImpl message = messages.get(inMsgName);
-            for(WSDLPartImpl part:message.parts()){
+            EditableWSDLMessage message = messages.get(inMsgName);
+            for(EditableWSDLPart part:message.parts()){
                 ParameterBinding binding = getInputBinding(part.getName());
                 if(binding.isBody()){
                     requestPayloadName = part.getDescriptor().name();
@@ -354,7 +335,7 @@
     }
 
     @Override
-    public @Nullable QName getResPayloadName() {
+    public @Nullable QName getResponsePayloadName() {
         if (emptyResponsePayload)
             return null;
 
@@ -367,8 +348,8 @@
             return responsePayloadName;
         }else{
             QName outMsgName = operation.getOutput().getMessage().getName();
-            WSDLMessageImpl message = messages.get(outMsgName);
-            for(WSDLPartImpl part:message.parts()){
+            EditableWSDLMessage message = messages.get(outMsgName);
+            for(EditableWSDLPart part:message.parts()){
                 ParameterBinding binding = getOutputBinding(part.getName());
                 if(binding.isBody()){
                     responsePayloadName = part.getDescriptor().name();
@@ -402,7 +383,6 @@
         reqNamespace = ns;
     }
 
-
     /**
      * For rpclit gives namespace value on soapbinding:body@namespace
      *
@@ -418,7 +398,7 @@
         respNamespace = ns;
     }
 
-    WSDLBoundPortTypeImpl getOwner(){
+    EditableWSDLBoundPortType getOwner(){
         return owner;
     }
 
@@ -426,12 +406,12 @@
     private QName responsePayloadName;
     private boolean emptyRequestPayload;
     private boolean emptyResponsePayload;
-    private Map<QName, WSDLMessageImpl> messages;
+    private Map<QName, ? extends EditableWSDLMessage> messages;
 
-    void freeze(WSDLModelImpl parent) {
+    public void freeze(EditableWSDLModel parent) {
         messages = parent.getMessages();
         operation = owner.getPortType().get(name.getLocalPart());
-        for(WSDLBoundFaultImpl bf : wsdlBoundFaults){
+        for(EditableWSDLBoundFault bf : wsdlBoundFaults){
             bf.freeze(this);
         }
     }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundPortTypeImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLBoundPortTypeImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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
@@ -31,6 +31,10 @@
 import com.sun.xml.internal.ws.api.model.ParameterBinding;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundPortType;
+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.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
 import com.sun.xml.internal.ws.resources.ClientMessages;
 import com.sun.xml.internal.ws.util.QNameMap;
 import com.sun.xml.internal.ws.util.exception.LocatableWebServiceException;
@@ -47,26 +51,26 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLBoundPortTypeImpl extends AbstractFeaturedObjectImpl implements WSDLBoundPortType {
+public final class WSDLBoundPortTypeImpl extends AbstractFeaturedObjectImpl implements EditableWSDLBoundPortType {
     private final QName name;
     private final QName portTypeName;
-    private WSDLPortTypeImpl portType;
+    private EditableWSDLPortType portType;
     private BindingID bindingId;
-    private final @NotNull WSDLModelImpl owner;
-    private final QNameMap<WSDLBoundOperationImpl> bindingOperations = new QNameMap<WSDLBoundOperationImpl>();
+    private final @NotNull EditableWSDLModel owner;
+    private final QNameMap<EditableWSDLBoundOperation> bindingOperations = new QNameMap<EditableWSDLBoundOperation>();
 
     /**
      * Operations keyed by the payload tag name.
      */
-    private QNameMap<WSDLBoundOperationImpl> payloadMap;
+    private QNameMap<EditableWSDLBoundOperation> payloadMap;
     /**
      * {@link #payloadMap} doesn't allow null key, so we store the value for it here.
      */
-    private WSDLBoundOperationImpl emptyPayloadOperation;
+    private EditableWSDLBoundOperation emptyPayloadOperation;
 
 
 
-    public WSDLBoundPortTypeImpl(XMLStreamReader xsr,@NotNull WSDLModelImpl owner, QName name, QName portTypeName) {
+    public WSDLBoundPortTypeImpl(XMLStreamReader xsr,@NotNull EditableWSDLModel owner, QName name, QName portTypeName) {
         super(xsr);
         this.owner = owner;
         this.name = name;
@@ -78,11 +82,11 @@
         return name;
     }
 
-    public @NotNull WSDLModelImpl getOwner() {
+    public @NotNull EditableWSDLModel getOwner() {
         return owner;
     }
 
-    public WSDLBoundOperationImpl get(QName operationName) {
+    public EditableWSDLBoundOperation get(QName operationName) {
         return bindingOperations.get(operationName);
     }
 
@@ -93,7 +97,7 @@
      * @param ptOp   Must be non-null
      * @throws NullPointerException if either opName or ptOp is null
      */
-    public void put(QName opName, WSDLBoundOperationImpl ptOp) {
+    public void put(QName opName, EditableWSDLBoundOperation ptOp) {
         bindingOperations.put(opName,ptOp);
     }
 
@@ -101,11 +105,11 @@
         return portTypeName;
     }
 
-    public WSDLPortTypeImpl getPortType() {
+    public EditableWSDLPortType getPortType() {
         return portType;
     }
 
-    public Iterable<WSDLBoundOperationImpl> getBindingOperations() {
+    public Iterable<EditableWSDLBoundOperation> getBindingOperations() {
         return bindingOperations.values();
     }
 
@@ -149,7 +153,7 @@
      * @return null if the binding could not be resolved for the part.
      */
     public ParameterBinding getBinding(QName operation, String part, Mode mode) {
-        WSDLBoundOperationImpl op = get(operation);
+        EditableWSDLBoundOperation op = get(operation);
         if (op == null) {
             //TODO throw exception
             return null;
@@ -160,23 +164,7 @@
             return op.getOutputBinding(part);
     }
 
-    /**
-     * Gets mime:content@part value which is the MIME type for a given operation, part and {@link Mode}.
-     *
-     * @param operation wsdl:operation@name value. Must be non-null.
-     * @param part      wsdl:part@name such as value of soap:header@part. Must be non-null.
-     * @param mode      {@link Mode#IN} or {@link Mode#OUT}. Must be non-null.
-     * @return null if the binding could not be resolved for the part.
-     */
-    public String getMimeType(QName operation, String part, Mode mode) {
-        WSDLBoundOperationImpl op = get(operation);
-        if (Mode.IN == mode)
-            return op.getMimeTypeForInputPart(part);
-        else
-            return op.getMimeTypeForOutputPart(part);
-    }
-
-    public WSDLBoundOperationImpl getOperation(String namespaceUri, String localName) {
+    public EditableWSDLBoundOperation getOperation(String namespaceUri, String localName) {
         if(namespaceUri==null && localName == null)
             return emptyPayloadOperation;
         else{
@@ -184,19 +172,7 @@
         }
     }
 
-    public void enableMTOM() {
-        features.add(new MTOMFeature());
-    }
-
-    public boolean isMTOMEnabled() {
-        return features.isEnabled(MTOMFeature.class);
-    }
-
-    public SOAPVersion getSOAPVersion(){
-        return getBindingId().getSOAPVersion();
-    }
-
-    void freeze() {
+    public void freeze() {
         portType = owner.getPortType(portTypeName);
         if(portType == null){
             throw new LocatableWebServiceException(
@@ -204,7 +180,7 @@
         }
         portType.freeze();
 
-        for (WSDLBoundOperationImpl op : bindingOperations.values()) {
+        for (EditableWSDLBoundOperation op : bindingOperations.values()) {
             op.freeze(owner);
         }
 
@@ -214,15 +190,15 @@
 
     private void freezePayloadMap() {
         if(style== Style.RPC) {
-            payloadMap = new QNameMap<WSDLBoundOperationImpl>();
-            for(WSDLBoundOperationImpl op : bindingOperations.values()){
-                payloadMap.put(op.getReqPayloadName(), op);
+            payloadMap = new QNameMap<EditableWSDLBoundOperation>();
+            for(EditableWSDLBoundOperation op : bindingOperations.values()){
+                payloadMap.put(op.getRequestPayloadName(), op);
             }
         } else {
-            payloadMap = new QNameMap<WSDLBoundOperationImpl>();
+            payloadMap = new QNameMap<EditableWSDLBoundOperation>();
             // For doclit The tag will be the operation that has the same input part descriptor value
-            for(WSDLBoundOperationImpl op : bindingOperations.values()){
-                QName name = op.getReqPayloadName();
+            for(EditableWSDLBoundOperation op : bindingOperations.values()){
+                QName name = op.getRequestPayloadName();
                 if(name == null){
                     //empty payload
                     emptyPayloadOperation = op;
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLFaultImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLFaultImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,8 +25,10 @@
 
 package com.sun.xml.internal.ws.model.wsdl;
 
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLFault;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLFault;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
 import com.sun.istack.internal.NotNull;
 
 import javax.xml.namespace.QName;
@@ -35,15 +37,15 @@
 /**
  * @author Vivek Pandey
  */
-public final class WSDLFaultImpl extends AbstractExtensibleImpl implements WSDLFault {
+public final class WSDLFaultImpl extends AbstractExtensibleImpl implements EditableWSDLFault {
     private final String name;
     private final QName messageName;
-    private WSDLMessageImpl message;
-    private WSDLOperationImpl operation;
+    private EditableWSDLMessage message;
+    private EditableWSDLOperation operation;
     private String action = "";
     private boolean defaultAction = true;
 
-    public WSDLFaultImpl(XMLStreamReader xsr, String name, QName messageName, WSDLOperationImpl operation) {
+    public WSDLFaultImpl(XMLStreamReader xsr, String name, QName messageName, EditableWSDLOperation operation) {
         super(xsr);
         this.name = name;
         this.messageName = messageName;
@@ -54,12 +56,12 @@
         return name;
     }
 
-    public WSDLMessageImpl getMessage() {
+    public EditableWSDLMessage getMessage() {
         return message;
     }
 
     @NotNull
-    public WSDLOperation getOperation() {
+    public EditableWSDLOperation getOperation() {
         return operation;
     }
 
@@ -72,6 +74,7 @@
     public String getAction() {
         return action;
     }
+
     public void setAction(String action) {
         this.action = action;
     }
@@ -84,7 +87,7 @@
         this.defaultAction = defaultAction;
     }
 
-    void freeze(WSDLModelImpl root){
+    public void freeze(EditableWSDLModel root){
         message = root.getMessage(messageName);
     }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLInputImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLInputImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,11 +25,11 @@
 
 package com.sun.xml.internal.ws.model.wsdl;
 
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLInput;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLMessage;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
+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.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
 import com.sun.istack.internal.NotNull;
-import com.sun.istack.internal.Nullable;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
@@ -37,15 +37,15 @@
 /**
  * @author Vivek Pandey
  */
-public final class WSDLInputImpl extends AbstractExtensibleImpl implements WSDLInput {
+public final class WSDLInputImpl extends AbstractExtensibleImpl implements EditableWSDLInput {
     private String name;
     private QName messageName;
-    private WSDLOperationImpl operation;
-    private WSDLMessageImpl message;
+    private EditableWSDLOperation operation;
+    private EditableWSDLMessage message;
     private String action;
     private boolean defaultAction = true;
 
-    public WSDLInputImpl(XMLStreamReader xsr,String name, QName messageName, WSDLOperationImpl operation) {
+    public WSDLInputImpl(XMLStreamReader xsr,String name, QName messageName, EditableWSDLOperation operation) {
         super(xsr);
         this.name = name;
         this.messageName = messageName;
@@ -59,7 +59,7 @@
         return (operation.isOneWay())?operation.getName().getLocalPart():operation.getName().getLocalPart()+"Request";
     }
 
-    public WSDLMessage getMessage() {
+    public EditableWSDLMessage getMessage() {
         return message;
     }
 
@@ -68,7 +68,7 @@
     }
 
     @NotNull
-    public WSDLOperation getOperation() {
+    public EditableWSDLOperation getOperation() {
         return operation;
     }
 
@@ -88,7 +88,7 @@
         this.defaultAction = defaultAction;
     }
 
-    void freeze(WSDLModelImpl parent) {
+    public void freeze(EditableWSDLModel parent) {
         message = parent.getMessage(messageName);
     }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLMessageImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLMessageImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,19 +25,21 @@
 
 package com.sun.xml.internal.ws.model.wsdl;
 
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLMessage;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+
 import java.util.ArrayList;
 
 /**
  * Provides abstraction for wsdl:message
  * @author Vivek Pandey
  */
-public final class WSDLMessageImpl extends AbstractExtensibleImpl implements WSDLMessage {
+public final class WSDLMessageImpl extends AbstractExtensibleImpl implements EditableWSDLMessage {
     private final QName name;
-    private final ArrayList<WSDLPartImpl> parts;
+    private final ArrayList<EditableWSDLPart> parts;
 
     /**
      * @param name wsdl:message name attribute value
@@ -45,18 +47,18 @@
     public WSDLMessageImpl(XMLStreamReader xsr,QName name) {
         super(xsr);
         this.name = name;
-        this.parts = new ArrayList<WSDLPartImpl>();
+        this.parts = new ArrayList<EditableWSDLPart>();
     }
 
     public QName getName() {
         return name;
     }
 
-    public void add(WSDLPartImpl part){
+    public void add(EditableWSDLPart part){
         parts.add(part);
     }
 
-    public Iterable<WSDLPartImpl> parts(){
+    public Iterable<EditableWSDLPart> parts(){
         return parts;
     }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLModelImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLModelImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,21 +27,25 @@
 
 import com.sun.istack.internal.NotNull;
 import com.sun.xml.internal.ws.api.model.ParameterBinding;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundPortType;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLMessage;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLService;
+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.EditableWSDLMessage;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
+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.policy.PolicyMap;
 
 import javax.jws.WebParam.Mode;
 import javax.xml.namespace.QName;
-import java.net.URL;
+
 import java.util.Collections;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -50,15 +54,15 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLModelImpl extends AbstractExtensibleImpl implements WSDLModel {
-    private final Map<QName, WSDLMessageImpl> messages = new HashMap<QName, WSDLMessageImpl>();
-    private final Map<QName, WSDLPortTypeImpl> portTypes = new HashMap<QName, WSDLPortTypeImpl>();
-    private final Map<QName, WSDLBoundPortTypeImpl> bindings = new HashMap<QName, WSDLBoundPortTypeImpl>();
-    private final Map<QName, WSDLServiceImpl> services = new LinkedHashMap<QName, WSDLServiceImpl>();
+public final class WSDLModelImpl extends AbstractExtensibleImpl implements EditableWSDLModel {
+    private final Map<QName, EditableWSDLMessage> messages = new HashMap<QName, EditableWSDLMessage>();
+    private final Map<QName, EditableWSDLPortType> portTypes = new HashMap<QName, EditableWSDLPortType>();
+    private final Map<QName, EditableWSDLBoundPortType> bindings = new HashMap<QName, EditableWSDLBoundPortType>();
+    private final Map<QName, EditableWSDLService> services = new LinkedHashMap<QName, EditableWSDLService>();
 
     private PolicyMap policyMap;
-    private final Map<QName,WSDLBoundPortType> unmBindings
-        = Collections.<QName,WSDLBoundPortType>unmodifiableMap(bindings);
+    private final Map<QName, EditableWSDLBoundPortType> unmBindings
+        = Collections.<QName, EditableWSDLBoundPortType>unmodifiableMap(bindings);
 
 
     public WSDLModelImpl(@NotNull String systemId) {
@@ -72,52 +76,52 @@
         super(null,-1);
     }
 
-    public void addMessage(WSDLMessageImpl msg){
+    public void addMessage(EditableWSDLMessage msg){
         messages.put(msg.getName(), msg);
     }
 
-    public WSDLMessageImpl getMessage(QName name){
+    public EditableWSDLMessage getMessage(QName name){
         return messages.get(name);
     }
 
-    public void addPortType(WSDLPortTypeImpl pt){
+    public void addPortType(EditableWSDLPortType pt){
         portTypes.put(pt.getName(), pt);
     }
 
-    public WSDLPortTypeImpl getPortType(QName name){
+    public EditableWSDLPortType getPortType(QName name){
         return portTypes.get(name);
     }
 
-    public void addBinding(WSDLBoundPortTypeImpl boundPortType){
+    public void addBinding(EditableWSDLBoundPortType boundPortType){
         assert !bindings.containsValue(boundPortType);
         bindings.put(boundPortType.getName(), boundPortType);
     }
 
-    public WSDLBoundPortTypeImpl getBinding(QName name){
+    public EditableWSDLBoundPortType getBinding(QName name){
         return bindings.get(name);
     }
 
-    public void addService(WSDLServiceImpl svc){
+    public void addService(EditableWSDLService svc){
         services.put(svc.getName(), svc);
     }
 
-    public WSDLServiceImpl getService(QName name){
+    public EditableWSDLService getService(QName name){
         return services.get(name);
     }
 
-    public Map<QName, WSDLMessageImpl> getMessages() {
+    public Map<QName, EditableWSDLMessage> getMessages() {
         return messages;
     }
 
-    public @NotNull Map<QName, WSDLPortTypeImpl> getPortTypes() {
+    public @NotNull Map<QName, EditableWSDLPortType> getPortTypes() {
         return portTypes;
     }
 
-    public @NotNull Map<QName, WSDLBoundPortType> getBindings() {
+    public @NotNull Map<QName, ? extends EditableWSDLBoundPortType> getBindings() {
         return unmBindings;
     }
 
-    public @NotNull Map<QName, WSDLServiceImpl> getServices(){
+    public @NotNull Map<QName, EditableWSDLService> getServices(){
         return services;
     }
 
@@ -131,50 +135,23 @@
     }
 
     /**
-     * Returns first port QName from first service as per the insertion order
-     */
-    public QName getFirstPortName(){
-        WSDLPort fp = getFirstPort();
-        if(fp==null)
-            return null;
-        else
-            return fp.getName();
-    }
-
-    private WSDLPort getFirstPort(){
-        if(services.isEmpty())
-            return null;
-        WSDLService service = services.values().iterator().next();
-        Iterator<? extends WSDLPort> iter = service.getPorts().iterator();
-        WSDLPort port = iter.hasNext()?iter.next():null;
-        return port;
-    }
-
-    /**
-    * gets the first port in the wsdl which matches the serviceName and portType
-    */
-    public WSDLPortImpl getMatchingPort(QName serviceName, QName portType){
-        return getService(serviceName).getMatchingPort(portType);
-    }
-
-    /**
      *
      * @param serviceName non-null service QName
      * @param portName    non-null port QName
      * @return
      *          WSDLBoundOperation on success otherwise null. throws NPE if any of the parameters null
      */
-    public WSDLBoundPortTypeImpl getBinding(QName serviceName, QName portName){
-        WSDLServiceImpl service = services.get(serviceName);
+    public EditableWSDLBoundPortType getBinding(QName serviceName, QName portName){
+        EditableWSDLService service = services.get(serviceName);
         if(service != null){
-            WSDLPortImpl port = service.get(portName);
+            EditableWSDLPort port = service.get(portName);
             if(port != null)
                 return port.getBinding();
         }
         return null;
     }
 
-    void finalizeRpcLitBinding(WSDLBoundPortTypeImpl boundPortType){
+    public void finalizeRpcLitBinding(EditableWSDLBoundPortType boundPortType){
         assert(boundPortType != null);
         QName portTypeName = boundPortType.getPortTypeName();
         if(portTypeName == null)
@@ -182,15 +159,15 @@
         WSDLPortType pt = portTypes.get(portTypeName);
         if(pt == null)
             return;
-        for (WSDLBoundOperationImpl bop : boundPortType.getBindingOperations()) {
+        for (EditableWSDLBoundOperation bop : boundPortType.getBindingOperations()) {
             WSDLOperation pto = pt.get(bop.getName().getLocalPart());
             WSDLMessage inMsgName = pto.getInput().getMessage();
             if(inMsgName == null)
                 continue;
-            WSDLMessageImpl inMsg = messages.get(inMsgName.getName());
+            EditableWSDLMessage inMsg = messages.get(inMsgName.getName());
             int bodyindex = 0;
             if(inMsg != null){
-                for(WSDLPartImpl part:inMsg.parts()){
+                for(EditableWSDLPart part:inMsg.parts()){
                     String name = part.getName();
                     ParameterBinding pb = bop.getInputBinding(name);
                     if(pb.isBody()){
@@ -206,9 +183,9 @@
             WSDLMessage outMsgName = pto.getOutput().getMessage();
             if(outMsgName == null)
                 continue;
-            WSDLMessageImpl outMsg = messages.get(outMsgName.getName());
+            EditableWSDLMessage outMsg = messages.get(outMsgName.getName());
             if(outMsg!= null){
-                for(WSDLPartImpl part:outMsg.parts()){
+                for(EditableWSDLPart part:outMsg.parts()){
                     String name = part.getName();
                     ParameterBinding pb = bop.getOutputBinding(name);
                     if(pb.isBody()){
@@ -242,14 +219,14 @@
      * Invoked at the end of the model construction to fix up references, etc.
      */
     public void freeze() {
-        for (WSDLServiceImpl service : services.values()) {
+        for (EditableWSDLService service : services.values()) {
             service.freeze(this);
         }
-        for (WSDLBoundPortTypeImpl bp : bindings.values()) {
+        for (EditableWSDLBoundPortType bp : bindings.values()) {
             bp.freeze();
         }
         // Enforce freeze all the portTypes referenced by this endpoints, see Bug8966673 for detail
-        for (WSDLPortTypeImpl pt : portTypes.values()) {
+        for (EditableWSDLPortType pt : portTypes.values()) {
             pt.freeze();
         }
     }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLOperationImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLOperationImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -26,13 +26,20 @@
 package com.sun.xml.internal.ws.model.wsdl;
 
 import com.sun.istack.internal.NotNull;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLFault;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;
+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.EditableWSDLModel;
+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.EditableWSDLPart;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
 import com.sun.xml.internal.ws.util.QNameMap;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -41,21 +48,21 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLOperationImpl extends AbstractExtensibleImpl implements WSDLOperation {
+public final class WSDLOperationImpl extends AbstractExtensibleImpl implements EditableWSDLOperation {
     private final QName name;
     private String parameterOrder;
-    private WSDLInputImpl input;
-    private WSDLOutputImpl output;
-    private final List<WSDLFaultImpl> faults;
-    private final QNameMap<WSDLFaultImpl> faultMap;
-    protected Iterable<WSDLMessageImpl> messages;
-    private final WSDLPortType owner;
+    private EditableWSDLInput input;
+    private EditableWSDLOutput output;
+    private final List<EditableWSDLFault> faults;
+    private final QNameMap<EditableWSDLFault> faultMap;
+    protected Iterable<EditableWSDLMessage> messages;
+    private final EditableWSDLPortType owner;
 
-    public WSDLOperationImpl(XMLStreamReader xsr,WSDLPortTypeImpl owner, QName name) {
+    public WSDLOperationImpl(XMLStreamReader xsr, EditableWSDLPortType owner, QName name) {
         super(xsr);
         this.name = name;
-        this.faults = new ArrayList<WSDLFaultImpl>();
-        this.faultMap = new QNameMap<WSDLFaultImpl>();
+        this.faults = new ArrayList<EditableWSDLFault>();
+        this.faultMap = new QNameMap<EditableWSDLFault>();
         this.owner = owner;
     }
 
@@ -71,15 +78,15 @@
         this.parameterOrder = parameterOrder;
     }
 
-    public WSDLInputImpl getInput() {
+    public EditableWSDLInput getInput() {
         return input;
     }
 
-    public void setInput(WSDLInputImpl input) {
+    public void setInput(EditableWSDLInput input) {
         this.input = input;
     }
 
-    public WSDLOutputImpl getOutput() {
+    public EditableWSDLOutput getOutput() {
         return output;
     }
 
@@ -87,22 +94,22 @@
         return output == null;
     }
 
-    public void setOutput(WSDLOutputImpl output) {
+    public void setOutput(EditableWSDLOutput output) {
         this.output = output;
     }
 
-    public Iterable<WSDLFaultImpl> getFaults() {
+    public Iterable<EditableWSDLFault> getFaults() {
         return faults;
     }
 
-    public WSDLFault getFault(QName faultDetailName) {
-        WSDLFaultImpl fault = faultMap.get(faultDetailName);
+    public EditableWSDLFault getFault(QName faultDetailName) {
+        EditableWSDLFault fault = faultMap.get(faultDetailName);
         if(fault != null)
             return fault;
 
-        for(WSDLFaultImpl fi:faults){
+        for(EditableWSDLFault fi : faults){
             assert fi.getMessage().parts().iterator().hasNext();
-            WSDLPartImpl part = fi.getMessage().parts().iterator().next();
+            EditableWSDLPart part = fi.getMessage().parts().iterator().next();
             if(part.getDescriptor().name().equals(faultDetailName)){
                 faultMap.put(faultDetailName, fi);
                 return fi;
@@ -111,25 +118,21 @@
         return null;
     }
 
-    WSDLPortType getOwner() {
-        return owner;
-    }
-
     @NotNull
     public QName getPortTypeName() {
         return owner.getName();
     }
 
-    public void addFault(WSDLFaultImpl fault) {
+    public void addFault(EditableWSDLFault fault) {
         faults.add(fault);
     }
 
-    public void freez(WSDLModelImpl root) {
+    public void freeze(EditableWSDLModel root) {
         assert input != null;
         input.freeze(root);
         if(output != null)
             output.freeze(root);
-        for(WSDLFaultImpl fault : faults){
+        for(EditableWSDLFault fault : faults){
             fault.freeze(root);
         }
     }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLOutputImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLOutputImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,9 +25,10 @@
 
 package com.sun.xml.internal.ws.model.wsdl;
 
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLMessage;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLOutput;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLMessage;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
+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.istack.internal.NotNull;
 
 import javax.xml.namespace.QName;
@@ -36,14 +37,15 @@
 /**
  * @author Vivek Pandey
  */
-public final class WSDLOutputImpl extends AbstractExtensibleImpl implements WSDLOutput {
+public final class WSDLOutputImpl extends AbstractExtensibleImpl implements EditableWSDLOutput {
     private String name;
     private QName messageName;
-    private WSDLOperationImpl operation;
-    private WSDLMessageImpl message;
+    private EditableWSDLOperation operation;
+    private EditableWSDLMessage message;
     private String action;
     private boolean defaultAction = true;
-    public WSDLOutputImpl(XMLStreamReader xsr,String name, QName messageName, WSDLOperationImpl operation) {
+
+    public WSDLOutputImpl(XMLStreamReader xsr,String name, QName messageName, EditableWSDLOperation operation) {
         super(xsr);
         this.name = name;
         this.messageName = messageName;
@@ -54,7 +56,7 @@
         return (name == null)?operation.getName().getLocalPart()+"Response":name;
     }
 
-    public WSDLMessage getMessage() {
+    public EditableWSDLMessage getMessage() {
         return message;
     }
 
@@ -71,7 +73,7 @@
     }
 
     @NotNull
-    public WSDLOperation getOperation() {
+    public EditableWSDLOperation getOperation() {
         return operation;
     }
 
@@ -84,7 +86,7 @@
         this.action = action;
     }
 
-    void freeze(WSDLModelImpl root) {
+    public void freeze(EditableWSDLModel root) {
         message = root.getMessage(messageName);
     }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPartImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPartImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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
@@ -28,6 +28,7 @@
 import com.sun.xml.internal.ws.api.model.ParameterBinding;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPart;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPartDescriptor;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPart;
 
 import javax.xml.stream.XMLStreamReader;
 
@@ -36,7 +37,7 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLPartImpl extends AbstractObjectImpl implements WSDLPart {
+public final class WSDLPartImpl extends AbstractObjectImpl implements EditableWSDLPart {
     private final String name;
     private ParameterBinding binding;
     private int index;
@@ -72,10 +73,6 @@
         this.index = index;
     }
 
-    boolean isBody(){
-        return binding.isBody();
-    }
-
     public WSDLPartDescriptor getDescriptor() {
         return descriptor;
     }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPortImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPortImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,10 +25,16 @@
 
 package com.sun.xml.internal.ws.model.wsdl;
 
+import java.util.List;
+
 import com.sun.xml.internal.ws.api.EndpointAddress;
 import com.sun.xml.internal.ws.api.SOAPVersion;
 import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLBoundPortType;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService;
 import com.sun.xml.internal.ws.resources.ClientMessages;
 import com.sun.xml.internal.ws.util.exception.LocatableWebServiceException;
 import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
@@ -44,19 +50,19 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLPortImpl extends AbstractFeaturedObjectImpl implements WSDLPort {
+public final class WSDLPortImpl extends AbstractFeaturedObjectImpl implements EditableWSDLPort {
     private final QName name;
     private EndpointAddress address;
     private final QName bindingName;
-    private final WSDLServiceImpl owner;
+    private final EditableWSDLService owner;
     private WSEndpointReference epr;
 
     /**
      * To be set after the WSDL parsing is complete.
      */
-    private WSDLBoundPortTypeImpl boundPortType;
+    private EditableWSDLBoundPortType boundPortType;
 
-    public WSDLPortImpl(XMLStreamReader xsr,WSDLServiceImpl owner, QName name, QName binding) {
+    public WSDLPortImpl(XMLStreamReader xsr, EditableWSDLService owner, QName name, QName binding) {
         super(xsr);
         this.owner = owner;
         this.name = name;
@@ -75,7 +81,7 @@
         return address;
     }
 
-    public WSDLServiceImpl getOwner() {
+    public EditableWSDLService getOwner() {
         return owner;
     }
 
@@ -99,15 +105,13 @@
     public @Nullable WSEndpointReference getEPR() {
         return epr;
     }
-    public WSDLBoundPortTypeImpl getBinding() {
+
+    public EditableWSDLBoundPortType getBinding() {
         return boundPortType;
     }
 
-    public SOAPVersion getSOAPVersion(){
-        return boundPortType.getSOAPVersion();
-    }
-
-    void freeze(WSDLModelImpl root) {
+    @SuppressWarnings("unchecked")
+    public void freeze(EditableWSDLModel root) {
         boundPortType = root.getBinding(bindingName);
         if(boundPortType==null) {
             throw new LocatableWebServiceException(
@@ -116,6 +120,6 @@
         if(features == null)
             features =  new WebServiceFeatureList();
         features.setParentFeaturedObject(boundPortType);
-        notUnderstoodExtensions.addAll(boundPortType.notUnderstoodExtensions);
+        notUnderstoodExtensions.addAll((List<UnknownWSDLExtension>)boundPortType.getNotUnderstoodExtensions());
     }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPortTypeImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLPortTypeImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,13 @@
 
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPortType;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLOperation;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPortType;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+
 import java.util.Hashtable;
 import java.util.Map;
 
@@ -38,27 +42,27 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLPortTypeImpl  extends AbstractExtensibleImpl implements WSDLPortType {
+public final class WSDLPortTypeImpl  extends AbstractExtensibleImpl implements EditableWSDLPortType {
     private QName name;
-    private final Map<String, WSDLOperationImpl> portTypeOperations;
-    private WSDLModelImpl owner;
+    private final Map<String, EditableWSDLOperation> portTypeOperations;
+    private EditableWSDLModel owner;
 
-    public WSDLPortTypeImpl(XMLStreamReader xsr,WSDLModelImpl owner, QName name) {
+    public WSDLPortTypeImpl(XMLStreamReader xsr, EditableWSDLModel owner, QName name) {
         super(xsr);
         this.name = name;
         this.owner = owner;
-        portTypeOperations = new Hashtable<String, WSDLOperationImpl>();
+        portTypeOperations = new Hashtable<String, EditableWSDLOperation>();
     }
 
     public QName getName() {
         return name;
     }
 
-    public WSDLOperationImpl get(String operationName) {
+    public EditableWSDLOperation get(String operationName) {
         return portTypeOperations.get(operationName);
     }
 
-    public Iterable<WSDLOperationImpl> getOperations() {
+    public Iterable<EditableWSDLOperation> getOperations() {
         return portTypeOperations.values();
     }
 
@@ -68,17 +72,17 @@
      * @param ptOp  Must be non-null
      * @throws NullPointerException if either opName or ptOp is null
      */
-    public void put(String opName, WSDLOperationImpl ptOp){
+    public void put(String opName, EditableWSDLOperation ptOp){
         portTypeOperations.put(opName, ptOp);
     }
 
-    WSDLModelImpl getOwner(){
+    EditableWSDLModel getOwner(){
         return owner;
     }
 
-    void freeze() {
-        for(WSDLOperationImpl op : portTypeOperations.values()){
-            op.freez(owner);
+    public void freeze() {
+        for(EditableWSDLOperation op : portTypeOperations.values()){
+            op.freeze(owner);
         }
     }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLProperties.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLProperties.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,6 @@
 package com.sun.xml.internal.ws.model.wsdl;
 
 import com.oracle.webservices.internal.api.message.BasePropertySet;
-import com.oracle.webservices.internal.api.message.PropertySet;
 import com.sun.istack.internal.Nullable;
 import com.sun.xml.internal.ws.api.model.SEIModel;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLServiceImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/model/wsdl/WSDLServiceImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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
@@ -29,9 +29,13 @@
 import com.sun.istack.internal.Nullable;
 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.model.wsdl.editable.EditableWSDLModel;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLPort;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.EditableWSDLService;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamReader;
+
 import java.util.LinkedHashMap;
 import java.util.Map;
 
@@ -40,20 +44,20 @@
  *
  * @author Vivek Pandey
  */
-public final class WSDLServiceImpl extends AbstractExtensibleImpl implements WSDLService {
+public final class WSDLServiceImpl extends AbstractExtensibleImpl implements EditableWSDLService {
     private final QName name;
-    private final Map<QName, WSDLPortImpl> ports;
-    private final WSDLModelImpl parent;
+    private final Map<QName, EditableWSDLPort> ports;
+    private final EditableWSDLModel parent;
 
-    public WSDLServiceImpl(XMLStreamReader xsr,WSDLModelImpl parent, QName name) {
+    public WSDLServiceImpl(XMLStreamReader xsr, EditableWSDLModel parent, QName name) {
         super(xsr);
         this.parent = parent;
         this.name = name;
-        ports = new LinkedHashMap<QName,WSDLPortImpl>();
+        ports = new LinkedHashMap<QName, EditableWSDLPort>();
     }
 
     public @NotNull
-    WSDLModelImpl getParent() {
+    EditableWSDLModel getParent() {
         return parent;
     }
 
@@ -61,18 +65,18 @@
         return name;
     }
 
-    public WSDLPortImpl get(QName portName) {
+    public EditableWSDLPort get(QName portName) {
         return ports.get(portName);
     }
 
-    public WSDLPort getFirstPort() {
+    public EditableWSDLPort getFirstPort() {
         if(ports.isEmpty())
             return null;
         else
             return ports.values().iterator().next();
     }
 
-    public Iterable<WSDLPortImpl> getPorts(){
+    public Iterable<EditableWSDLPort> getPorts(){
         return ports.values();
     }
 
@@ -80,8 +84,8 @@
     * gets the first port in this service which matches the portType
     */
     public @Nullable
-    WSDLPortImpl getMatchingPort(QName portTypeName){
-        for(WSDLPortImpl port : getPorts()){
+    EditableWSDLPort getMatchingPort(QName portTypeName){
+        for(EditableWSDLPort port : getPorts()){
             QName ptName = port.getBinding().getPortTypeName();
             assert (ptName != null);
             if(ptName.equals(portTypeName))
@@ -97,14 +101,14 @@
      * @param port     Must be non-null
      * @throws NullPointerException if either opName or ptOp is null
      */
-    public void put(QName portName, WSDLPortImpl port) {
+    public void put(QName portName, EditableWSDLPort port) {
         if (portName == null || port == null)
             throw new NullPointerException();
         ports.put(portName, port);
     }
 
-    void freeze(WSDLModelImpl root) {
-        for (WSDLPortImpl port : ports.values()) {
+    public void freeze(EditableWSDLModel root) {
+        for (EditableWSDLPort port : ports.values()) {
             port.freeze(root);
         }
     }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/jaxws/PolicyWSDLParserExtension.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/policy/jaxws/PolicyWSDLParserExtension.java	Tue Oct 08 14:55:33 2013 -0700
@@ -25,7 +25,8 @@
 
 package com.sun.xml.internal.ws.policy.jaxws;
 
-import com.sun.xml.internal.ws.api.model.wsdl.*;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLObject;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.*;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtensionContext;
 import com.sun.xml.internal.ws.api.policy.PolicyResolver;
@@ -37,7 +38,6 @@
 import com.sun.xml.internal.ws.policy.sourcemodel.PolicySourceModelContext;
 import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.NamespaceVersion;
 import com.sun.xml.internal.ws.policy.sourcemodel.wspolicy.XmlToken;
-import com.sun.xml.internal.ws.model.wsdl.WSDLModelImpl;
 import com.sun.xml.internal.ws.policy.PolicyException;
 import com.sun.xml.internal.ws.policy.PolicyMap;
 import com.sun.xml.internal.ws.util.xml.XmlUtil;
@@ -54,12 +54,11 @@
 import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
+
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
-import javax.xml.stream.XMLInputFactory;
 import javax.xml.ws.WebServiceException;
-import javax.xml.xpath.XPathFactoryConfigurationException;
 
 /**
  * This class parses the Policy Attachments in the WSDL and creates a PolicyMap thaty captures the policies configured on
@@ -376,7 +375,7 @@
     }
 
     @Override
-    public boolean portElements(final WSDLPort port, final XMLStreamReader reader) {
+    public boolean portElements(final EditableWSDLPort port, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(port, reader, getHandlers4PortMap());
         LOGGER.exiting();
@@ -384,14 +383,14 @@
     }
 
     @Override
-    public void portAttributes(final WSDLPort port, final XMLStreamReader reader) {
+    public void portAttributes(final EditableWSDLPort port, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(port, reader, getHandlers4PortMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean serviceElements(final WSDLService service, final XMLStreamReader reader) {
+    public boolean serviceElements(final EditableWSDLService service, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(service, reader, getHandlers4ServiceMap());
         LOGGER.exiting();
@@ -399,7 +398,7 @@
     }
 
     @Override
-    public void serviceAttributes(final WSDLService service, final XMLStreamReader reader) {
+    public void serviceAttributes(final EditableWSDLService service, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(service, reader, getHandlers4ServiceMap());
         LOGGER.exiting();
@@ -424,7 +423,7 @@
     }
 
     @Override
-    public boolean bindingElements(final WSDLBoundPortType binding, final XMLStreamReader reader) {
+    public boolean bindingElements(final EditableWSDLBoundPortType binding, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(binding, reader, getHandlers4BindingMap());
         LOGGER.exiting();
@@ -432,14 +431,14 @@
     }
 
     @Override
-    public void bindingAttributes(final WSDLBoundPortType binding, final XMLStreamReader reader) {
+    public void bindingAttributes(final EditableWSDLBoundPortType binding, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(binding, reader, getHandlers4BindingMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean portTypeElements(final WSDLPortType portType, final XMLStreamReader reader) {
+    public boolean portTypeElements(final EditableWSDLPortType portType, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(portType, reader, getHandlers4PortTypeMap());
         LOGGER.exiting();
@@ -447,14 +446,14 @@
     }
 
     @Override
-    public void portTypeAttributes(final WSDLPortType portType, final XMLStreamReader reader) {
+    public void portTypeAttributes(final EditableWSDLPortType portType, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(portType, reader, getHandlers4PortTypeMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean portTypeOperationElements(final WSDLOperation operation, final XMLStreamReader reader) {
+    public boolean portTypeOperationElements(final EditableWSDLOperation operation, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(operation, reader, getHandlers4OperationMap());
         LOGGER.exiting();
@@ -462,14 +461,14 @@
     }
 
     @Override
-    public void portTypeOperationAttributes(final WSDLOperation operation, final XMLStreamReader reader) {
+    public void portTypeOperationAttributes(final EditableWSDLOperation operation, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(operation, reader, getHandlers4OperationMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean bindingOperationElements(final WSDLBoundOperation boundOperation, final XMLStreamReader reader) {
+    public boolean bindingOperationElements(final EditableWSDLBoundOperation boundOperation, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(boundOperation, reader, getHandlers4BoundOperationMap());
         LOGGER.exiting();
@@ -477,14 +476,14 @@
     }
 
     @Override
-    public void bindingOperationAttributes(final WSDLBoundOperation boundOperation, final XMLStreamReader reader) {
+    public void bindingOperationAttributes(final EditableWSDLBoundOperation boundOperation, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(boundOperation, reader, getHandlers4BoundOperationMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean messageElements(final WSDLMessage msg, final XMLStreamReader reader) {
+    public boolean messageElements(final EditableWSDLMessage msg, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(msg, reader, getHandlers4MessageMap());
         LOGGER.exiting();
@@ -492,14 +491,14 @@
     }
 
     @Override
-    public void messageAttributes(final WSDLMessage msg, final XMLStreamReader reader) {
+    public void messageAttributes(final EditableWSDLMessage msg, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(msg, reader, getHandlers4MessageMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean portTypeOperationInputElements(final WSDLInput input, final XMLStreamReader reader) {
+    public boolean portTypeOperationInputElements(final EditableWSDLInput input, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(input, reader, getHandlers4InputMap());
         LOGGER.exiting();
@@ -507,7 +506,7 @@
     }
 
     @Override
-    public void portTypeOperationInputAttributes(final WSDLInput input, final XMLStreamReader reader) {
+    public void portTypeOperationInputAttributes(final EditableWSDLInput input, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(input, reader, getHandlers4InputMap());
         LOGGER.exiting();
@@ -515,7 +514,7 @@
 
 
     @Override
-    public boolean portTypeOperationOutputElements(final WSDLOutput output, final XMLStreamReader reader) {
+    public boolean portTypeOperationOutputElements(final EditableWSDLOutput output, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(output, reader, getHandlers4OutputMap());
         LOGGER.exiting();
@@ -523,7 +522,7 @@
     }
 
     @Override
-    public void portTypeOperationOutputAttributes(final WSDLOutput output, final XMLStreamReader reader) {
+    public void portTypeOperationOutputAttributes(final EditableWSDLOutput output, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(output, reader, getHandlers4OutputMap());
         LOGGER.exiting();
@@ -531,7 +530,7 @@
 
 
     @Override
-    public boolean portTypeOperationFaultElements(final WSDLFault fault, final XMLStreamReader reader) {
+    public boolean portTypeOperationFaultElements(final EditableWSDLFault fault, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(fault, reader, getHandlers4FaultMap());
         LOGGER.exiting();
@@ -539,14 +538,14 @@
     }
 
     @Override
-    public void portTypeOperationFaultAttributes(final WSDLFault fault, final XMLStreamReader reader) {
+    public void portTypeOperationFaultAttributes(final EditableWSDLFault fault, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(fault, reader, getHandlers4FaultMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean bindingOperationInputElements(final WSDLBoundOperation operation, final XMLStreamReader reader) {
+    public boolean bindingOperationInputElements(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(operation, reader, getHandlers4BindingInputOpMap());
         LOGGER.exiting();
@@ -554,7 +553,7 @@
     }
 
     @Override
-    public void bindingOperationInputAttributes(final WSDLBoundOperation operation, final XMLStreamReader reader) {
+    public void bindingOperationInputAttributes(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(operation, reader, getHandlers4BindingInputOpMap());
         LOGGER.exiting();
@@ -562,7 +561,7 @@
 
 
     @Override
-    public boolean bindingOperationOutputElements(final WSDLBoundOperation operation, final XMLStreamReader reader) {
+    public boolean bindingOperationOutputElements(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(operation, reader, getHandlers4BindingOutputOpMap());
         LOGGER.exiting();
@@ -570,14 +569,14 @@
     }
 
     @Override
-    public void bindingOperationOutputAttributes(final WSDLBoundOperation operation, final XMLStreamReader reader) {
+    public void bindingOperationOutputAttributes(final EditableWSDLBoundOperation operation, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(operation, reader, getHandlers4BindingOutputOpMap());
         LOGGER.exiting();
     }
 
     @Override
-    public boolean bindingOperationFaultElements(final WSDLBoundFault fault, final XMLStreamReader reader) {
+    public boolean bindingOperationFaultElements(final EditableWSDLBoundFault fault, final XMLStreamReader reader) {
         LOGGER.entering();
         final boolean result = processSubelement(fault, reader, getHandlers4BindingFaultOpMap());
         LOGGER.exiting(result);
@@ -585,7 +584,7 @@
     }
 
     @Override
-    public void bindingOperationFaultAttributes(final WSDLBoundFault fault, final XMLStreamReader reader) {
+    public void bindingOperationFaultAttributes(final EditableWSDLBoundFault fault, final XMLStreamReader reader) {
         LOGGER.entering();
         processAttributes(fault, reader, getHandlers4BindingFaultOpMap());
         LOGGER.exiting();
@@ -701,7 +700,7 @@
             // may otherwise be multiple entries for policies that are contained
             // by fault messages.
             HashSet<BuilderHandlerMessageScope> messageSet = new HashSet<BuilderHandlerMessageScope>();
-            for (WSDLService service : context.getWSDLModel().getServices().values()) {
+            for (EditableWSDLService service : context.getWSDLModel().getServices().values()) {
                 if (getHandlers4ServiceMap().containsKey(service)) {
                     getPolicyMapBuilder().registerHandler(new BuilderHandlerServiceScope(
                             getPolicyURIs(getHandlers4ServiceMap().get(service),modelContext)
@@ -711,7 +710,7 @@
                 }
                 // end service scope
 
-                for (WSDLPort port : service.getPorts()) {
+                for (EditableWSDLPort port : service.getPorts()) {
                     if (getHandlers4PortMap().containsKey(port)) {
                         getPolicyMapBuilder().registerHandler(
                                 new BuilderHandlerEndpointScope(
@@ -747,9 +746,9 @@
                         } // endif handler for port type
                         // end endpoint scope
 
-                        for (WSDLBoundOperation boundOperation : port.getBinding().getBindingOperations()) {
+                        for (EditableWSDLBoundOperation boundOperation : port.getBinding().getBindingOperations()) {
 
-                            final WSDLOperation operation = boundOperation.getOperation();
+                            final EditableWSDLOperation operation = boundOperation.getOperation();
                             final QName operationName = new QName(boundOperation.getBoundPortType().getName().getNamespaceURI(), boundOperation.getName().getLocalPart());
                             // We store the message and portType/operation under the same namespace as the binding/operation so that we can match them up later
                             if ( // handler for operation scope -- by boundOperation
@@ -778,9 +777,9 @@
                             } // endif for portType:operation scope
                             // end operation scope
 
-                            final WSDLInput input = operation.getInput();
+                            final EditableWSDLInput input = operation.getInput();
                             if (null!=input) {
-                                WSDLMessage inputMsg = input.getMessage();
+                                EditableWSDLMessage inputMsg = input.getMessage();
                                 if (inputMsg != null && getHandlers4MessageMap().containsKey(inputMsg)) {
                                     messageSet.add(new BuilderHandlerMessageScope(
                                         getPolicyURIs(
@@ -825,9 +824,9 @@
                             } // endif portType op input msg
                             // end input message scope
 
-                            final WSDLOutput output = operation.getOutput();
+                            final EditableWSDLOutput output = operation.getOutput();
                             if (null!=output) {
-                                WSDLMessage outputMsg = output.getMessage();
+                                EditableWSDLMessage outputMsg = output.getMessage();
                                 if (outputMsg != null && getHandlers4MessageMap().containsKey(outputMsg)) {
                                     messageSet.add(new BuilderHandlerMessageScope(
                                         getPolicyURIs(
@@ -872,8 +871,8 @@
                             } // endif portType op output msg
                             // end output message scope
 
-                            for (WSDLBoundFault boundFault : boundOperation.getFaults()) {
-                                final WSDLFault fault = boundFault.getFault();
+                            for (EditableWSDLBoundFault boundFault : boundOperation.getFaults()) {
+                                final EditableWSDLFault fault = boundFault.getFault();
 
                                 // this shouldn't happen ususally,
                                 // but since this scenario tested in lagacy tests, dont' fail here
@@ -882,7 +881,7 @@
                                     continue;
                                 }
 
-                                final WSDLMessage faultMessage = fault.getMessage();
+                                final EditableWSDLMessage faultMessage = fault.getMessage();
                                 final QName faultName = new QName(boundOperation.getBoundPortType().getName().getNamespaceURI(), boundFault.getName());
                                 // We store the message and portType/fault under the same namespace as the binding/fault so that we can match them up later
                                 if (faultMessage != null && getHandlers4MessageMap().containsKey(faultMessage)) {
@@ -948,14 +947,14 @@
     @Override
     public void postFinished(final WSDLParserExtensionContext context) {
         // finally register the PolicyMap on the WSDLModel
-        WSDLModel wsdlModel = context.getWSDLModel();
+        EditableWSDLModel wsdlModel = context.getWSDLModel();
         PolicyMap effectiveMap;
         try {
             if(context.isClientSide())
                 effectiveMap = context.getPolicyResolver().resolve(new PolicyResolver.ClientContext(policyBuilder.getPolicyMap(),context.getContainer()));
             else
                 effectiveMap = context.getPolicyResolver().resolve(new PolicyResolver.ServerContext(policyBuilder.getPolicyMap(), context.getContainer(),null));
-            ((WSDLModelImpl) wsdlModel).setPolicyMap(effectiveMap);
+            wsdlModel.setPolicyMap(effectiveMap);
         } catch (PolicyException e) {
             LOGGER.logSevereException(e);
             throw LOGGER.logSevereException(new WebServiceException(PolicyMessages.WSP_1007_POLICY_EXCEPTION_WHILE_FINISHING_PARSING_WSDL(), e));
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/resources/WsservletMessages.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/resources/WsservletMessages.java	Tue Oct 08 14:55:33 2013 -0700
@@ -507,6 +507,20 @@
         return localizer.localize(localizableSERVLET_ERROR_NO_RESPONSE_MESSAGE());
     }
 
+    public static Localizable localizableMESSAGE_TOO_LONG(Object arg0) {
+        return messageFactory.getMessage("message.too.long", arg0);
+    }
+
+    /**
+     *
+     * Message has been truncated
+     * use {0} property to increase the amount of printed part of the message
+     *
+     */
+    public static String MESSAGE_TOO_LONG(Object arg0) {
+        return localizer.localize(localizableMESSAGE_TOO_LONG(arg0));
+    }
+
     public static Localizable localizableLISTENER_INFO_INITIALIZE() {
         return messageFactory.getMessage("listener.info.initialize");
     }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/resources/wsservlet.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/resources/wsservlet.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -1,5 +1,5 @@
 #
-# Copyright (c) 2005, 2012, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2005, 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
@@ -243,3 +243,6 @@
 # Concatenated with html.rootPage.body3a
 #html.rootPage.body3b='>here.</a></p>
 html.rootPage.body4=<p>This endpoint is incorrectly configured. Please check the location and contents of the configuration file.</p>
+
+message.too.long=\nMessage has been truncated\n\
+use {0} property to increase the amount of printed part of the message
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/server/EndpointFactory.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/server/EndpointFactory.java	Tue Oct 08 14:55:33 2013 -0700
@@ -36,7 +36,9 @@
 import com.sun.xml.internal.ws.api.databinding.MetadataReader;
 import com.sun.xml.internal.ws.api.databinding.WSDLGenInfo;
 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.policy.PolicyResolver;
 import com.sun.xml.internal.ws.api.policy.PolicyResolverFactory;
 import com.sun.xml.internal.ws.api.server.AsyncProvider;
@@ -59,9 +61,6 @@
 import com.sun.xml.internal.ws.model.ReflectAnnotationReader;
 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.policy.PolicyMap;
 import com.sun.xml.internal.ws.policy.jaxws.PolicyUtil;
 import com.sun.xml.internal.ws.resources.ServerMessages;
@@ -73,6 +72,7 @@
 import com.sun.xml.internal.ws.util.ServiceFinder;
 import com.sun.xml.internal.ws.util.xml.XmlUtil;
 import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
+
 import org.xml.sax.EntityResolver;
 import org.xml.sax.InputSource;
 import org.xml.sax.SAXException;
@@ -86,6 +86,7 @@
 import javax.xml.ws.WebServiceFeature;
 import javax.xml.ws.WebServiceProvider;
 import javax.xml.ws.soap.SOAPBinding;
+
 import java.io.IOException;
 import java.net.URL;
 import java.util.ArrayList;
@@ -232,7 +233,7 @@
         SDDocumentImpl primaryDoc = primaryWsdl != null ? SDDocumentImpl.create(primaryWsdl,serviceName,portTypeName) : findPrimary(docList);
 
         EndpointAwareTube terminal;
-        WSDLPortImpl wsdlPort = null;
+        WSDLPort wsdlPort = null;
         AbstractSEIModelImpl seiModel = null;
         // create WSDL model
         if (primaryDoc != null) {
@@ -709,23 +710,23 @@
      * @param container container in which this service is running
      * @return non-null wsdl port object
      */
-    private static @NotNull WSDLPortImpl getWSDLPort(SDDocumentSource primaryWsdl, List<? extends SDDocumentSource> metadata,
+    private static @NotNull WSDLPort getWSDLPort(SDDocumentSource primaryWsdl, List<? extends SDDocumentSource> metadata,
                                                      @NotNull QName serviceName, @NotNull QName portName, Container container,
                                                      EntityResolver resolver) {
         URL wsdlUrl = primaryWsdl.getSystemId();
         try {
             // TODO: delegate to another entity resolver
-            WSDLModelImpl wsdlDoc = RuntimeWSDLParser.parse(
+            WSDLModel wsdlDoc = RuntimeWSDLParser.parse(
                 new Parser(primaryWsdl), new EntityResolverImpl(metadata, resolver),
                     false, container, ServiceFinder.find(WSDLParserExtension.class).toArray());
             if(wsdlDoc.getServices().size() == 0) {
                 throw new ServerRtException(ServerMessages.localizableRUNTIME_PARSER_WSDL_NOSERVICE_IN_WSDLMODEL(wsdlUrl));
             }
-            WSDLServiceImpl wsdlService = wsdlDoc.getService(serviceName);
+            WSDLService wsdlService = wsdlDoc.getService(serviceName);
             if (wsdlService == null) {
                 throw new ServerRtException(ServerMessages.localizableRUNTIME_PARSER_WSDL_INCORRECTSERVICE(serviceName,wsdlUrl));
             }
-            WSDLPortImpl wsdlPort = wsdlService.get(portName);
+            WSDLPort wsdlPort = wsdlService.get(portName);
             if (wsdlPort == null) {
                 throw new ServerRtException(ServerMessages.localizableRUNTIME_PARSER_WSDL_INCORRECTSERVICEPORT(serviceName, portName, wsdlUrl));
             }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/server/WSEndpointImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/server/WSEndpointImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -46,7 +46,6 @@
 import com.sun.xml.internal.ws.binding.BindingImpl;
 import com.sun.xml.internal.ws.fault.SOAPFaultBuilder;
 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.policy.PolicyMap;
@@ -195,7 +194,7 @@
         try {
             if (port != null) {
                 //gather EPR extrensions from WSDL Model
-                WSEndpointReference wsdlEpr = ((WSDLPortImpl) port).getEPR();
+                WSEndpointReference wsdlEpr = port.getEPR();
                 if (wsdlEpr != null) {
                     for (WSEndpointReference.EPRExtension extnEl : wsdlEpr.getEPRExtensions()) {
                         eprExtensions.put(extnEl.getQName(), extnEl);
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/spi/ProviderImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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
@@ -31,6 +31,7 @@
 import com.sun.xml.internal.ws.api.ServiceSharedFeatureMarker;
 import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
 import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
+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.server.BoundEndpoint;
@@ -41,12 +42,12 @@
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension;
 import com.sun.xml.internal.ws.client.WSServiceDelegate;
 import com.sun.xml.internal.ws.developer.MemberSubmissionEndpointReference;
-import com.sun.xml.internal.ws.model.wsdl.WSDLModelImpl;
 import com.sun.xml.internal.ws.resources.ProviderApiMessages;
 import com.sun.xml.internal.ws.transport.http.server.EndpointImpl;
 import com.sun.xml.internal.ws.util.ServiceFinder;
 import com.sun.xml.internal.ws.util.xml.XmlUtil;
 import com.sun.xml.internal.ws.wsdl.parser.RuntimeWSDLParser;
+
 import org.w3c.dom.Element;
 import org.xml.sax.EntityResolver;
 
@@ -65,6 +66,7 @@
 import javax.xml.ws.spi.ServiceDelegate;
 import javax.xml.ws.spi.Invoker;
 import javax.xml.ws.wsaddressing.W3CEndpointReference;
+
 import java.net.URL;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
@@ -217,7 +219,7 @@
                 EntityResolver er = XmlUtil.createDefaultCatalogResolver();
 
                 URL wsdlLoc = new URL(wsdlDocumentLocation);
-                WSDLModelImpl wsdlDoc = RuntimeWSDLParser.parse(wsdlLoc, new StreamSource(wsdlLoc.toExternalForm()), er,
+                WSDLModel wsdlDoc = RuntimeWSDLParser.parse(wsdlLoc, new StreamSource(wsdlLoc.toExternalForm()), er,
                         true, container, ServiceFinder.find(WSDLParserExtension.class).toArray());
                 if (serviceName != null) {
                     WSDLService wsdlService = wsdlDoc.getService(serviceName);
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/HttpAdapter.java	Tue Oct 08 14:55:33 2013 -0700
@@ -89,6 +89,8 @@
  */
 public class HttpAdapter extends Adapter<HttpAdapter.HttpToolkit> {
 
+    private static final Logger LOGGER = Logger.getLogger(HttpAdapter.class.getName());
+
     /**
      * {@link com.sun.xml.internal.ws.api.server.SDDocument}s keyed by the query string like "?abc".
      * Used for serving documents via HTTP GET.
@@ -852,7 +854,14 @@
                 }
             }
         }
-        buf.writeTo(baos);
+        if (buf.size() > dump_threshold) {
+            byte[] b = buf.getRawData();
+            baos.write(b, 0, dump_threshold);
+            pw.println();
+            pw.println(WsservletMessages.MESSAGE_TOO_LONG(HttpAdapter.class.getName() + ".dumpTreshold"));
+        } else {
+            buf.writeTo(baos);
+        }
         pw.println("--------------------");
 
         String msg = baos.toString();
@@ -946,6 +955,8 @@
      */
     public static volatile boolean dump = false;
 
+    public static volatile int dump_threshold = 4096;
+
     public static volatile boolean publishStatusPage = true;
 
     public static synchronized void setPublishStatus(boolean publish) {
@@ -954,19 +965,32 @@
 
     static {
         try {
-            dump = Boolean.getBoolean(HttpAdapter.class.getName()+".dump");
-        } catch( Throwable t ) {
-            // OK to ignore this
+            dump = Boolean.getBoolean(HttpAdapter.class.getName() + ".dump");
+        } catch (SecurityException se) {
+            if (LOGGER.isLoggable(Level.CONFIG)) {
+                LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.",
+                        new Object[] {HttpAdapter.class.getName() + ".dump"});
+            }
         }
         try {
-            setPublishStatus(System.getProperty(HttpAdapter.class.getName()+".publishStatusPage").equals("true"));
-        } catch( Throwable t ) {
-            // OK to ignore this
+            dump_threshold = Integer.getInteger(HttpAdapter.class.getName() + ".dumpTreshold", 4096);
+        } catch (SecurityException se) {
+            if (LOGGER.isLoggable(Level.CONFIG)) {
+                LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.",
+                        new Object[] {HttpAdapter.class.getName() + ".dumpTreshold"});
+            }
+        }
+        try {
+            setPublishStatus(Boolean.getBoolean(HttpAdapter.class.getName() + ".publishStatusPage"));
+        } catch (SecurityException se) {
+            if (LOGGER.isLoggable(Level.CONFIG)) {
+                LOGGER.log(Level.CONFIG, "Cannot read ''{0}'' property, using defaults.",
+                        new Object[] {HttpAdapter.class.getName() + ".publishStatusPage"});
+            }
         }
     }
 
     public static void setDump(boolean dumpMessages) {
         HttpAdapter.dump = dumpMessages;
     }
-    private static final Logger LOGGER = Logger.getLogger(HttpAdapter.class.getName());
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/transport/http/client/HttpTransportPipe.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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
@@ -35,7 +35,9 @@
 import com.sun.xml.internal.ws.client.ClientTransportException;
 import com.sun.xml.internal.ws.developer.HttpConfigFeature;
 import com.sun.xml.internal.ws.resources.ClientMessages;
+import com.sun.xml.internal.ws.resources.WsservletMessages;
 import com.sun.xml.internal.ws.transport.Headers;
+import com.sun.xml.internal.ws.transport.http.HttpAdapter;
 import com.sun.xml.internal.ws.util.ByteArrayBuffer;
 import com.sun.xml.internal.ws.util.RuntimeVersion;
 import com.sun.xml.internal.ws.util.StreamUtils;
@@ -426,7 +428,14 @@
             }
         }
 
-        buf.writeTo(baos);
+        if (buf.size() > HttpAdapter.dump_threshold) {
+            byte[] b = buf.getRawData();
+            baos.write(b, 0, HttpAdapter.dump_threshold);
+            pw.println();
+            pw.println(WsservletMessages.MESSAGE_TOO_LONG(HttpAdapter.class.getName() + ".dumpTreshold"));
+        } else {
+            buf.writeTo(baos);
+        }
         pw.println("--------------------");
 
         String msg = baos.toString();
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/pipe/AbstractSchemaValidationTube.java	Tue Oct 08 14:55:33 2013 -0700
@@ -72,7 +72,7 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import static com.sun.xml.internal.ws.util.xml.XmlUtil.allowFileAccess;
+import static com.sun.xml.internal.ws.util.xml.XmlUtil.allowExternalAccess;
 
 /**
  * {@link Tube} that does the schema validation.
@@ -92,7 +92,7 @@
         super(next);
         this.binding = binding;
         feature = binding.getFeature(SchemaValidationFeature.class);
-        sf = allowFileAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), false);
+        sf = allowExternalAccess(SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI), "file", false);
     }
 
     protected AbstractSchemaValidationTube(AbstractSchemaValidationTube that, TubeCloner cloner) {
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/util/version.properties	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/version.properties	Tue Oct 08 14:55:33 2013 -0700
@@ -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/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/util/xml/XmlUtil.java	Tue Oct 08 14:55:33 2013 -0700
@@ -84,11 +84,11 @@
 
     private static final Logger LOGGER = Logger.getLogger(XmlUtil.class.getName());
 
-    private static boolean globalSecureXmlProcessingEnabled;
+    private static boolean XML_SECURITY_DISABLED;
 
     static {
-        String disableSecureXmlProcessing = System.getProperty("disableSecureXmlProcessing");
-        globalSecureXmlProcessingEnabled = disableSecureXmlProcessing == null || !Boolean.valueOf(disableSecureXmlProcessing);
+        String disableXmlSecurity = System.getProperty("com.sun.xml.internal.ws.disableXmlSecurity");
+        XML_SECURITY_DISABLED = disableXmlSecurity == null || !Boolean.valueOf(disableXmlSecurity);
     }
 
     public static String getPrefix(String s) {
@@ -364,9 +364,9 @@
     public static DocumentBuilderFactory newDocumentBuilderFactory(boolean secureXmlProcessing) {
         DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, checkGlobalOverride(secureXmlProcessing));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessing));
         } catch (ParserConfigurationException e) {
-            LOGGER.log(Level.WARNING, "Factory [{}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
+            LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
         }
         return factory;
     }
@@ -374,9 +374,9 @@
     public static TransformerFactory newTransformerFactory(boolean secureXmlProcessingEnabled) {
         TransformerFactory factory = TransformerFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, checkGlobalOverride(secureXmlProcessingEnabled));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
         } catch (TransformerConfigurationException e) {
-            LOGGER.log(Level.WARNING, "Factory [{}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
+            LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
         }
         return factory;
     }
@@ -388,9 +388,9 @@
     public static SAXParserFactory newSAXParserFactory(boolean secureXmlProcessingEnabled) {
         SAXParserFactory factory = SAXParserFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, checkGlobalOverride(secureXmlProcessingEnabled));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
         } catch (Exception e) {
-            LOGGER.log(Level.WARNING, "Factory [{}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
+            LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[]{factory.getClass().getName()});
         }
         return factory;
     }
@@ -398,16 +398,16 @@
     public static XPathFactory newXPathFactory(boolean secureXmlProcessingEnabled) {
         XPathFactory factory = XPathFactory.newInstance();
         try {
-            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, checkGlobalOverride(secureXmlProcessingEnabled));
+            factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, isXMLSecurityDisabled(secureXmlProcessingEnabled));
         } catch (XPathFactoryConfigurationException e) {
-            LOGGER.log(Level.WARNING, "Factory [{}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
+            LOGGER.log(Level.WARNING, "Factory [{0}] doesn't support secure xml processing!", new Object[] { factory.getClass().getName() } );
         }
         return factory;
     }
 
     public static XMLInputFactory newXMLInputFactory(boolean secureXmlProcessingEnabled)  {
         XMLInputFactory factory = XMLInputFactory.newInstance();
-        if (checkGlobalOverride(secureXmlProcessingEnabled)) {
+        if (isXMLSecurityDisabled(secureXmlProcessingEnabled)) {
             // TODO-Miran: are those apppropriate defaults?
             factory.setProperty(XMLInputFactory.SUPPORT_DTD, false);
             factory.setProperty(XMLInputFactory.IS_SUPPORTING_EXTERNAL_ENTITIES, false);
@@ -415,25 +415,39 @@
         return factory;
     }
 
-    private static boolean checkGlobalOverride(boolean localSecureXmlProcessingEnabled) {
-        return globalSecureXmlProcessingEnabled && localSecureXmlProcessingEnabled;
+    private static boolean isXMLSecurityDisabled(boolean runtimeDisabled) {
+        return XML_SECURITY_DISABLED || runtimeDisabled;
     }
 
-    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 (checkGlobalOverride(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, "Xml Security disabled, no JAXP xsd external access configuration necessary.");
+            }
+            return sf;
+        }
+
+        if (System.getProperty("javax.xml.accessExternalSchema") != null) {
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, "Detected explicitly JAXP configuration, no JAXP xsd external access configuration necessary.");
+            }
             return sf;
         }
 
         try {
-            sf.setProperty(ACCESS_EXTERNAL_SCHEMA, "file");
-            LOGGER.log(Level.FINE, "Property \"{}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
+            sf.setProperty(ACCESS_EXTERNAL_SCHEMA, value);
+            if (LOGGER.isLoggable(Level.FINE)) {
+                LOGGER.log(Level.FINE, "Property \"{0}\" is supported and has been successfully set by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
+            }
         } catch (SAXException ignored) {
-            // depending on JDK/SAX implementation used
-            LOGGER.log(Level.CONFIG, "Property \"{}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
+            // nothing to do; support depends on version JDK or SAX implementation
+            if (LOGGER.isLoggable(Level.CONFIG)) {
+                LOGGER.log(Level.CONFIG, "Property \"{0}\" is not supported by used JAXP implementation.", new Object[]{ACCESS_EXTERNAL_SCHEMA});
+            }
         }
         return sf;
     }
+
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/ActionBasedOperationFinder.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/ActionBasedOperationFinder.java	Tue Oct 08 14:55:33 2013 -0700
@@ -102,7 +102,7 @@
             }
         } else {
             for (WSDLBoundOperation wsdlOp : wsdlModel.getBinding().getBindingOperations()) {
-                QName payloadName = wsdlOp.getReqPayloadName();
+                QName payloadName = wsdlOp.getRequestPayloadName();
                 if (payloadName == null)
                     payloadName = EMPTY_PAYLOAD;
                 String action = wsdlOp.getOperation().getInput().getAction();
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/PayloadQNameBasedOperationFinder.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/PayloadQNameBasedOperationFinder.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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
@@ -104,7 +104,7 @@
             }
         } else {
             for (WSDLBoundOperation wsdlOp : wsdlModel.getBinding().getBindingOperations()) {
-                QName name = wsdlOp.getReqPayloadName();
+                QName name = wsdlOp.getRequestPayloadName();
                 if (name == null)
                     name = EMPTY_PAYLOAD;
                 methodHandlers.put(name, wsdlOperationMapping(wsdlOp));
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/DelegatingParserExtension.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/DelegatingParserExtension.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,7 +25,7 @@
 
 package com.sun.xml.internal.ws.wsdl.parser;
 
-import com.sun.xml.internal.ws.api.model.wsdl.*;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.*;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtensionContext;
 
@@ -48,31 +48,31 @@
         core.start(context);
     }
 
-    public void serviceAttributes(WSDLService service, XMLStreamReader reader) {
+    public void serviceAttributes(EditableWSDLService service, XMLStreamReader reader) {
         core.serviceAttributes(service, reader);
     }
 
-    public boolean serviceElements(WSDLService service, XMLStreamReader reader) {
+    public boolean serviceElements(EditableWSDLService service, XMLStreamReader reader) {
         return core.serviceElements(service, reader);
     }
 
-    public void portAttributes(WSDLPort port, XMLStreamReader reader) {
+    public void portAttributes(EditableWSDLPort port, XMLStreamReader reader) {
         core.portAttributes(port, reader);
     }
 
-    public boolean portElements(WSDLPort port, XMLStreamReader reader) {
+    public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
         return core.portElements(port, reader);
     }
 
-    public boolean portTypeOperationInput(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationInput(EditableWSDLOperation op, XMLStreamReader reader) {
         return core.portTypeOperationInput(op, reader);
     }
 
-    public boolean portTypeOperationOutput(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationOutput(EditableWSDLOperation op, XMLStreamReader reader) {
         return core.portTypeOperationOutput(op, reader);
     }
 
-    public boolean portTypeOperationFault(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationFault(EditableWSDLOperation op, XMLStreamReader reader) {
         return core.portTypeOperationFault(op, reader);
     }
 
@@ -80,91 +80,91 @@
         return core.definitionsElements(reader);
     }
 
-    public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
         return core.bindingElements(binding, reader);
     }
 
-    public void bindingAttributes(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public void bindingAttributes(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
         core.bindingAttributes(binding, reader);
     }
 
-    public boolean portTypeElements(WSDLPortType portType, XMLStreamReader reader) {
+    public boolean portTypeElements(EditableWSDLPortType portType, XMLStreamReader reader) {
         return core.portTypeElements(portType, reader);
     }
 
-    public void portTypeAttributes(WSDLPortType portType, XMLStreamReader reader) {
+    public void portTypeAttributes(EditableWSDLPortType portType, XMLStreamReader reader) {
         core.portTypeAttributes(portType, reader);
     }
 
-    public boolean portTypeOperationElements(WSDLOperation operation, XMLStreamReader reader) {
+    public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader) {
         return core.portTypeOperationElements(operation, reader);
     }
 
-    public void portTypeOperationAttributes(WSDLOperation operation, XMLStreamReader reader) {
+    public void portTypeOperationAttributes(EditableWSDLOperation operation, XMLStreamReader reader) {
         core.portTypeOperationAttributes(operation, reader);
     }
 
-    public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return core.bindingOperationElements(operation, reader);
     }
 
-    public void bindingOperationAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         core.bindingOperationAttributes(operation, reader);
     }
 
-    public boolean messageElements(WSDLMessage msg, XMLStreamReader reader) {
+    public boolean messageElements(EditableWSDLMessage msg, XMLStreamReader reader) {
         return core.messageElements(msg, reader);
     }
 
-    public void messageAttributes(WSDLMessage msg, XMLStreamReader reader) {
+    public void messageAttributes(EditableWSDLMessage msg, XMLStreamReader reader) {
         core.messageAttributes(msg, reader);
     }
 
-    public boolean portTypeOperationInputElements(WSDLInput input, XMLStreamReader reader) {
+    public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader) {
         return core.portTypeOperationInputElements(input, reader);
     }
 
-    public void portTypeOperationInputAttributes(WSDLInput input, XMLStreamReader reader) {
+    public void portTypeOperationInputAttributes(EditableWSDLInput input, XMLStreamReader reader) {
         core.portTypeOperationInputAttributes(input, reader);
     }
 
-    public boolean portTypeOperationOutputElements(WSDLOutput output, XMLStreamReader reader) {
+    public boolean portTypeOperationOutputElements(EditableWSDLOutput output, XMLStreamReader reader) {
         return core.portTypeOperationOutputElements(output, reader);
     }
 
-    public void portTypeOperationOutputAttributes(WSDLOutput output, XMLStreamReader reader) {
+    public void portTypeOperationOutputAttributes(EditableWSDLOutput output, XMLStreamReader reader) {
         core.portTypeOperationOutputAttributes(output, reader);
     }
 
-    public boolean portTypeOperationFaultElements(WSDLFault fault, XMLStreamReader reader) {
+    public boolean portTypeOperationFaultElements(EditableWSDLFault fault, XMLStreamReader reader) {
         return core.portTypeOperationFaultElements(fault, reader);
     }
 
-    public void portTypeOperationFaultAttributes(WSDLFault fault, XMLStreamReader reader) {
+    public void portTypeOperationFaultAttributes(EditableWSDLFault fault, XMLStreamReader reader) {
         core.portTypeOperationFaultAttributes(fault, reader);
     }
 
-    public boolean bindingOperationInputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationInputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return core.bindingOperationInputElements(operation, reader);
     }
 
-    public void bindingOperationInputAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationInputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         core.bindingOperationInputAttributes(operation, reader);
     }
 
-    public boolean bindingOperationOutputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return core.bindingOperationOutputElements(operation, reader);
     }
 
-    public void bindingOperationOutputAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationOutputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         core.bindingOperationOutputAttributes(operation, reader);
     }
 
-    public boolean bindingOperationFaultElements(WSDLBoundFault fault, XMLStreamReader reader) {
+    public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader) {
         return core.bindingOperationFaultElements(fault, reader);
     }
 
-    public void bindingOperationFaultAttributes(WSDLBoundFault fault, XMLStreamReader reader) {
+    public void bindingOperationFaultAttributes(EditableWSDLBoundFault fault, XMLStreamReader reader) {
         core.bindingOperationFaultAttributes(fault, reader);
     }
 
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/FoolProofParserExtension.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/FoolProofParserExtension.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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.wsdl.parser;
 
 
-import com.sun.xml.internal.ws.api.model.wsdl.*;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.*;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension;
 
 import javax.xml.namespace.QName;
@@ -73,11 +73,11 @@
         throw new AssertionError("XMLStreamReader is placed at the wrong place after invoking "+core);
     }
 
-    public boolean serviceElements(WSDLService service, XMLStreamReader reader) {
+    public boolean serviceElements(EditableWSDLService service, XMLStreamReader reader) {
         return post(pre(reader),reader,super.serviceElements(service, reader));
     }
 
-    public boolean portElements(WSDLPort port, XMLStreamReader reader) {
+    public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
         return post(pre(reader),reader,super.portElements(port, reader));
     }
 
@@ -85,47 +85,47 @@
         return post(pre(reader),reader,super.definitionsElements(reader));
     }
 
-    public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
         return post(pre(reader),reader,super.bindingElements(binding, reader));
     }
 
-    public boolean portTypeElements(WSDLPortType portType, XMLStreamReader reader) {
+    public boolean portTypeElements(EditableWSDLPortType portType, XMLStreamReader reader) {
         return post(pre(reader),reader,super.portTypeElements(portType, reader));
     }
 
-    public boolean portTypeOperationElements(WSDLOperation operation, XMLStreamReader reader) {
+    public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader) {
         return post(pre(reader),reader,super.portTypeOperationElements(operation, reader));
     }
 
-    public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return post(pre(reader),reader,super.bindingOperationElements(operation, reader));
     }
 
-    public boolean messageElements(WSDLMessage msg, XMLStreamReader reader) {
+    public boolean messageElements(EditableWSDLMessage msg, XMLStreamReader reader) {
         return post(pre(reader),reader,super.messageElements(msg, reader));
     }
 
-    public boolean portTypeOperationInputElements(WSDLInput input, XMLStreamReader reader) {
+    public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader) {
         return post(pre(reader),reader,super.portTypeOperationInputElements(input, reader));
     }
 
-    public boolean portTypeOperationOutputElements(WSDLOutput output, XMLStreamReader reader) {
+    public boolean portTypeOperationOutputElements(EditableWSDLOutput output, XMLStreamReader reader) {
         return post(pre(reader),reader,super.portTypeOperationOutputElements(output, reader));
     }
 
-    public boolean portTypeOperationFaultElements(WSDLFault fault, XMLStreamReader reader) {
+    public boolean portTypeOperationFaultElements(EditableWSDLFault fault, XMLStreamReader reader) {
         return post(pre(reader),reader,super.portTypeOperationFaultElements(fault, reader));
     }
 
-    public boolean bindingOperationInputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationInputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return super.bindingOperationInputElements(operation, reader);
     }
 
-    public boolean bindingOperationOutputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return post(pre(reader),reader,super.bindingOperationOutputElements(operation, reader));
     }
 
-    public boolean bindingOperationFaultElements(WSDLBoundFault fault, XMLStreamReader reader) {
+    public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader) {
         return post(pre(reader),reader,super.bindingOperationFaultElements(fault, reader));
     }
 }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/MemberSubmissionAddressingWSDLParserExtension.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/MemberSubmissionAddressingWSDLParserExtension.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,13 +27,8 @@
 
 import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
 import com.sun.xml.internal.ws.developer.MemberSubmissionAddressingFeature;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundPortType;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLFeaturedObject;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLOperation;
-import com.sun.xml.internal.ws.api.model.wsdl.WSDLPort;
-import com.sun.xml.internal.ws.model.wsdl.WSDLBoundPortTypeImpl;
-import com.sun.xml.internal.ws.model.wsdl.WSDLOperationImpl;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.*;
 import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil;
 
 import javax.xml.namespace.QName;
@@ -46,12 +41,12 @@
  */
 public class MemberSubmissionAddressingWSDLParserExtension extends W3CAddressingWSDLParserExtension {
     @Override
-    public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
         return addressibleElement(reader, binding);
     }
 
     @Override
-    public boolean portElements(WSDLPort port, XMLStreamReader reader) {
+    public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
         return addressibleElement(reader, port);
     }
 
@@ -68,12 +63,12 @@
     }
 
     @Override
-    public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return false;
     }
 
     @Override
-    protected void patchAnonymousDefault(WSDLBoundPortTypeImpl binding) {
+    protected void patchAnonymousDefault(EditableWSDLBoundPortType binding) {
     }
 
     @Override
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/RuntimeWSDLParser.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/RuntimeWSDLParser.java	Tue Oct 08 14:55:33 2013 -0700
@@ -42,6 +42,20 @@
 import com.sun.xml.internal.ws.api.addressing.WSEndpointReference;
 import com.sun.xml.internal.ws.api.model.ParameterBinding;
 import com.sun.xml.internal.ws.api.model.wsdl.WSDLDescriptorKind;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLModel;
+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.EditableWSDLModel;
+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.EditableWSDLPart;
+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.server.Container;
 import com.sun.xml.internal.ws.api.server.ContainerResolver;
 import com.sun.xml.internal.ws.api.streaming.XMLStreamReaderFactory;
@@ -60,6 +74,7 @@
 import com.sun.xml.internal.ws.util.ServiceFinder;
 import com.sun.xml.internal.ws.util.xml.XmlUtil;
 import com.sun.xml.internal.ws.policy.jaxws.PolicyWSDLParserExtension;
+
 import org.xml.sax.EntityResolver;
 import org.xml.sax.SAXException;
 
@@ -70,6 +85,7 @@
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.ws.Service;
 import javax.xml.ws.WebServiceException;
+
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.FilterInputStream;
@@ -86,7 +102,7 @@
  */
 public class RuntimeWSDLParser {
 
-    private final WSDLModelImpl wsdlDoc;
+    private final EditableWSDLModel wsdlDoc;
     /**
      * Target namespace URI of the WSDL that we are currently parsing.
      */
@@ -126,7 +142,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,
      */
-    public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
+    public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                       boolean isClientSide, Container container,
                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, PolicyResolverFactory.create(),extensions);
@@ -141,7 +157,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,
      */
-    public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
+    public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                       boolean isClientSide, Container container, Class serviceClass,
                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, serviceClass, PolicyResolverFactory.create(),extensions);
@@ -156,7 +172,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,
      */
-    public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
+    public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                       boolean isClientSide, Container container, @NotNull PolicyResolver policyResolver,
                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
         return parse(wsdlLoc, wsdlSource, resolver, isClientSide, container, Service.class, policyResolver, extensions);
@@ -171,7 +187,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,
      */
-    public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
+    public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                       boolean isClientSide, Container container, Class serviceClass,
                                       @NotNull PolicyResolver policyResolver,
                                       WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
@@ -187,7 +203,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,
      */
-    public static WSDLModelImpl parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
+    public static WSDLModel parse(@Nullable URL wsdlLoc, @NotNull Source wsdlSource, @NotNull EntityResolver resolver,
                                       boolean isClientSide, Container container, Class serviceClass,
                                       @NotNull PolicyResolver policyResolver,
                                       boolean isUseStreamFromEntityResolverWrapper,
@@ -226,10 +242,10 @@
         return wsdlParser.wsdlDoc;
     }
 
-    private static WSDLModelImpl tryWithMex(@NotNull RuntimeWSDLParser wsdlParser, @NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Throwable e, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws SAXException, XMLStreamException {
+    private static WSDLModel tryWithMex(@NotNull RuntimeWSDLParser wsdlParser, @NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Throwable e, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws SAXException, XMLStreamException {
         ArrayList<Throwable> exceptions = new ArrayList<Throwable>();
         try {
-            WSDLModelImpl wsdlModel =  wsdlParser.parseUsingMex(wsdlLoc, resolver, isClientSide, container, serviceClass, policyResolver,extensions);
+            WSDLModel wsdlModel = wsdlParser.parseUsingMex(wsdlLoc, resolver, isClientSide, container, serviceClass, policyResolver,extensions);
             if(wsdlModel == null){
                 throw new WebServiceException(ClientMessages.FAILED_TO_PARSE(wsdlLoc.toExternalForm(), e.getMessage()), e);
             }
@@ -244,7 +260,7 @@
         throw new InaccessibleWSDLException(exceptions);
     }
 
-    private WSDLModelImpl parseUsingMex(@NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension[] extensions) throws IOException, SAXException, XMLStreamException, URISyntaxException {
+    private WSDLModel parseUsingMex(@NotNull URL wsdlLoc, @NotNull EntityResolver resolver, boolean isClientSide, Container container, Class serviceClass, PolicyResolver policyResolver, WSDLParserExtension[] extensions) throws IOException, SAXException, XMLStreamException, URISyntaxException {
         //try MEX
         MetaDataResolver mdResolver = null;
         ServiceDescriptor serviceDescriptor = null;
@@ -295,7 +311,7 @@
         return reader.getName().equals(WSDLConstants.QNAME_DEFINITIONS);
     }
 
-    public static WSDLModelImpl parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
+    public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, PolicyResolver policyResolver, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
         assert resolver != null;
         RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, policyResolver, extensions);
         parser.extensionFacade.start(parser.context);
@@ -306,7 +322,7 @@
         return parser.wsdlDoc;
     }
 
-    public static WSDLModelImpl parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
+    public static WSDLModel parse(XMLEntityResolver.Parser wsdl, XMLEntityResolver resolver, boolean isClientSide, Container container, WSDLParserExtension... extensions) throws IOException, XMLStreamException, SAXException {
         assert resolver != null;
         RuntimeWSDLParser parser = new RuntimeWSDLParser( wsdl.systemId.toExternalForm(), resolver, isClientSide, container, PolicyResolverFactory.create(), extensions);
         parser.extensionFacade.start(parser.context);
@@ -460,7 +476,7 @@
         readNSDecl(service_nsdecl,reader);
 
         String serviceName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
-        WSDLServiceImpl service = new WSDLServiceImpl(reader,wsdlDoc,new QName(targetNamespace, serviceName));
+        EditableWSDLService service = new WSDLServiceImpl(reader,wsdlDoc,new QName(targetNamespace, serviceName));
         extensionFacade.serviceAttributes(service, reader);
         while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
             QName name = reader.getName();
@@ -477,7 +493,7 @@
         service_nsdecl =  new HashMap<String, String>();
     }
 
-    private void parsePort(XMLStreamReader reader, WSDLServiceImpl service) {
+    private void parsePort(XMLStreamReader reader, EditableWSDLService service) {
         port_nsdecl.putAll(service_nsdecl);
         readNSDecl(port_nsdecl,reader);
 
@@ -486,7 +502,7 @@
 
         QName bindingName = ParserUtil.getQName(reader, binding);
         QName portQName = new QName(service.getName().getNamespaceURI(), portName);
-        WSDLPortImpl port = new WSDLPortImpl(reader,service, portQName, bindingName);
+        EditableWSDLPort port = new WSDLPortImpl(reader,service, portQName, bindingName);
 
         extensionFacade.portAttributes(port, reader);
 
@@ -551,7 +567,7 @@
             XMLStreamReaderUtil.skipElement(reader);
             return;
         }
-        WSDLBoundPortTypeImpl binding = new WSDLBoundPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, bindingName),
+        EditableWSDLBoundPortType binding = new WSDLBoundPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, bindingName),
                 ParserUtil.getQName(reader, portTypeName));
         extensionFacade.bindingAttributes(binding, reader);
 
@@ -601,7 +617,7 @@
     }
 
 
-    private void parseBindingOperation(XMLStreamReader reader, WSDLBoundPortTypeImpl binding) {
+    private void parseBindingOperation(XMLStreamReader reader, EditableWSDLBoundPortType binding) {
         String bindingOpName = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name");
         if (bindingOpName == null) {
             //TODO: throw exception?
@@ -611,7 +627,7 @@
         }
 
         QName opName = new QName(binding.getPortTypeName().getNamespaceURI(), bindingOpName);
-        WSDLBoundOperationImpl bindingOp = new WSDLBoundOperationImpl(reader,binding, opName);
+        EditableWSDLBoundOperation bindingOp = new WSDLBoundOperationImpl(reader,binding, opName);
         binding.put(opName, bindingOp);
         extensionFacade.bindingOperationAttributes(bindingOp, reader);
 
@@ -651,7 +667,7 @@
         }
     }
 
-    private void parseInputBinding(XMLStreamReader reader, WSDLBoundOperationImpl bindingOp) {
+    private void parseInputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
         boolean bodyFound = false;
         extensionFacade.bindingOperationInputAttributes(bindingOp, reader);
         while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
@@ -670,7 +686,7 @@
         }
     }
 
-    private void parseOutputBinding(XMLStreamReader reader, WSDLBoundOperationImpl bindingOp) {
+    private void parseOutputBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
         boolean bodyFound = false;
         extensionFacade.bindingOperationOutputAttributes(bindingOp, reader);
         while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
@@ -689,9 +705,9 @@
         }
     }
 
-    private void parseFaultBinding(XMLStreamReader reader, WSDLBoundOperationImpl bindingOp) {
+    private void parseFaultBinding(XMLStreamReader reader, EditableWSDLBoundOperation bindingOp) {
         String faultName = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name");
-        WSDLBoundFaultImpl wsdlBoundFault = new WSDLBoundFaultImpl(reader, faultName, bindingOp);
+        EditableWSDLBoundFault wsdlBoundFault = new WSDLBoundFaultImpl(reader, faultName, bindingOp);
         bindingOp.addFault(wsdlBoundFault);
 
         extensionFacade.bindingOperationFaultAttributes(wsdlBoundFault, reader);
@@ -704,7 +720,7 @@
     private enum BindingMode {
         INPUT, OUTPUT, FAULT}
 
-    private static boolean parseSOAPBodyBinding(XMLStreamReader reader, WSDLBoundOperationImpl op, BindingMode mode) {
+    private static boolean parseSOAPBodyBinding(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
         String namespace = reader.getAttributeValue(null, "namespace");
         if (mode == BindingMode.INPUT) {
             op.setRequestNamespace(namespace);
@@ -749,7 +765,7 @@
     }
 
 
-    private static void parseMimeMultipartBinding(XMLStreamReader reader, WSDLBoundOperationImpl op, BindingMode mode) {
+    private static void parseMimeMultipartBinding(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
         while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
             QName name = reader.getName();
             if (MIMEConstants.QNAME_PART.equals(name)) {
@@ -760,7 +776,7 @@
         }
     }
 
-    private static void parseMIMEPart(XMLStreamReader reader, WSDLBoundOperationImpl op, BindingMode mode) {
+    private static void parseMIMEPart(XMLStreamReader reader, EditableWSDLBoundOperation op, BindingMode mode) {
         boolean bodyFound = false;
         Map<String, ParameterBinding> parts = null;
         if (mode == BindingMode.INPUT) {
@@ -820,7 +836,7 @@
             XMLStreamReaderUtil.skipElement(reader);
             return;
         }
-        WSDLPortTypeImpl portType = new WSDLPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, portTypeName));
+        EditableWSDLPortType portType = new WSDLPortTypeImpl(reader,wsdlDoc, new QName(targetNamespace, portTypeName));
         extensionFacade.portTypeAttributes(portType, reader);
         wsdlDoc.addPortType(portType);
         while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
@@ -834,7 +850,7 @@
     }
 
 
-    private void parsePortTypeOperation(XMLStreamReader reader, WSDLPortTypeImpl portType) {
+    private void parsePortTypeOperation(XMLStreamReader reader, EditableWSDLPortType portType) {
         String operationName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
         if (operationName == null) {
             //TODO: throw exception?
@@ -844,7 +860,7 @@
         }
 
         QName operationQName = new QName(portType.getName().getNamespaceURI(), operationName);
-        WSDLOperationImpl operation = new WSDLOperationImpl(reader,portType, operationQName);
+        EditableWSDLOperation operation = new WSDLOperationImpl(reader,portType, operationQName);
         extensionFacade.portTypeOperationAttributes(operation, reader);
         String parameterOrder = ParserUtil.getAttribute(reader, "parameterOrder");
         operation.setParameterOrder(parameterOrder);
@@ -864,11 +880,11 @@
     }
 
 
-    private void parsePortTypeOperationFault(XMLStreamReader reader, WSDLOperationImpl operation) {
+    private void parsePortTypeOperationFault(XMLStreamReader reader, EditableWSDLOperation operation) {
         String msg = ParserUtil.getMandatoryNonEmptyAttribute(reader, "message");
         QName msgName = ParserUtil.getQName(reader, msg);
         String name = ParserUtil.getMandatoryNonEmptyAttribute(reader, "name");
-        WSDLFaultImpl fault = new WSDLFaultImpl(reader,name, msgName, operation);
+        EditableWSDLFault fault = new WSDLFaultImpl(reader,name, msgName, operation);
         operation.addFault(fault);
         extensionFacade.portTypeOperationFaultAttributes(fault, reader);
         extensionFacade.portTypeOperationFault(operation, reader);
@@ -877,11 +893,11 @@
         }
     }
 
-    private void parsePortTypeOperationInput(XMLStreamReader reader, WSDLOperationImpl operation) {
+    private void parsePortTypeOperationInput(XMLStreamReader reader, EditableWSDLOperation operation) {
         String msg = ParserUtil.getMandatoryNonEmptyAttribute(reader, "message");
         QName msgName = ParserUtil.getQName(reader, msg);
         String name = ParserUtil.getAttribute(reader, "name");
-        WSDLInputImpl input = new WSDLInputImpl(reader, name, msgName, operation);
+        EditableWSDLInput input = new WSDLInputImpl(reader, name, msgName, operation);
         operation.setInput(input);
         extensionFacade.portTypeOperationInputAttributes(input, reader);
         extensionFacade.portTypeOperationInput(operation, reader);
@@ -890,11 +906,11 @@
         }
     }
 
-    private void parsePortTypeOperationOutput(XMLStreamReader reader, WSDLOperationImpl operation) {
+    private void parsePortTypeOperationOutput(XMLStreamReader reader, EditableWSDLOperation operation) {
         String msg = ParserUtil.getAttribute(reader, "message");
         QName msgName = ParserUtil.getQName(reader, msg);
         String name = ParserUtil.getAttribute(reader, "name");
-        WSDLOutputImpl output = new WSDLOutputImpl(reader,name, msgName, operation);
+        EditableWSDLOutput output = new WSDLOutputImpl(reader,name, msgName, operation);
         operation.setOutput(output);
         extensionFacade.portTypeOperationOutputAttributes(output, reader);
         extensionFacade.portTypeOperationOutput(operation, reader);
@@ -905,7 +921,7 @@
 
     private void parseMessage(XMLStreamReader reader) {
         String msgName = ParserUtil.getMandatoryNonEmptyAttribute(reader, WSDLConstants.ATTR_NAME);
-        WSDLMessageImpl msg = new WSDLMessageImpl(reader,new QName(targetNamespace, msgName));
+        EditableWSDLMessage msg = new WSDLMessageImpl(reader,new QName(targetNamespace, msgName));
         extensionFacade.messageAttributes(msg, reader);
         int partIndex = 0;
         while (XMLStreamReaderUtil.nextElementContent(reader) != XMLStreamConstants.END_ELEMENT) {
@@ -928,7 +944,7 @@
                     }
                 }
                 if (desc != null) {
-                    WSDLPartImpl wsdlPart = new WSDLPartImpl(reader, part, partIndex, new WSDLPartDescriptorImpl(reader,ParserUtil.getQName(reader, desc), kind));
+                    EditableWSDLPart wsdlPart = new WSDLPartImpl(reader, part, partIndex, new WSDLPartDescriptorImpl(reader,ParserUtil.getQName(reader, desc), kind));
                     msg.add(wsdlPart);
                 }
                 if (reader.getEventType() != XMLStreamConstants.END_ELEMENT)
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingMetadataWSDLParserExtension.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingMetadataWSDLParserExtension.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,9 +25,7 @@
 
 package com.sun.xml.internal.ws.wsdl.parser;
 
-import com.sun.xml.internal.ws.api.model.wsdl.*;
-import com.sun.xml.internal.ws.model.wsdl.WSDLOperationImpl;
-import com.sun.xml.internal.ws.model.wsdl.WSDLBoundPortTypeImpl;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.*;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.namespace.QName;
 
@@ -43,22 +41,22 @@
     String METADATA_WSDL_EXTN_NS = "http://www.w3.org/2007/05/addressing/metadata";
     QName METADATA_WSDL_ACTION_TAG = new QName(METADATA_WSDL_EXTN_NS, "Action", "wsam");
     @Override
-    public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
         return false;
     }
 
     @Override
-    public boolean portElements(WSDLPort port, XMLStreamReader reader) {
+    public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
         return false;
     }
 
     @Override
-    public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         return false;
     }
 
     @Override
-    protected void patchAnonymousDefault(WSDLBoundPortTypeImpl binding) {
+    protected void patchAnonymousDefault(EditableWSDLBoundPortType binding) {
     }
 
     @Override
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingWSDLParserExtension.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/W3CAddressingWSDLParserExtension.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,19 +26,18 @@
 package com.sun.xml.internal.ws.wsdl.parser;
 
 import com.sun.xml.internal.ws.api.addressing.AddressingVersion;
-import com.sun.xml.internal.ws.api.model.wsdl.*;
+import com.sun.xml.internal.ws.api.model.wsdl.WSDLFeaturedObject;
+import static com.sun.xml.internal.ws.api.model.wsdl.WSDLBoundOperation.ANONYMOUS;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.*;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtensionContext;
-import com.sun.xml.internal.ws.model.wsdl.*;
 import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil;
-import com.sun.xml.internal.ws.resources.AddressingMessages;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamException;
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.ws.WebServiceException;
 import javax.xml.ws.soap.AddressingFeature;
-import java.util.Map;
 
 /**
  * W3C WS-Addressing Runtime WSDL parser extension
@@ -47,12 +46,12 @@
  */
 public class W3CAddressingWSDLParserExtension extends WSDLParserExtension {
     @Override
-    public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader) {
+    public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader) {
         return addressibleElement(reader, binding);
     }
 
     @Override
-    public boolean portElements(WSDLPort port, XMLStreamReader reader) {
+    public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
         return addressibleElement(reader, port);
     }
 
@@ -69,8 +68,8 @@
     }
 
     @Override
-    public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) {
-        WSDLBoundOperationImpl impl = (WSDLBoundOperationImpl)operation;
+    public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
+        EditableWSDLBoundOperation edit = (EditableWSDLBoundOperation) operation;
 
         QName anon = reader.getName();
         if (anon.equals(AddressingVersion.W3C.wsdlAnonymousTag)) {
@@ -81,11 +80,11 @@
                     // TODO: throw exception only if wsdl:required=true
                     // TODO: is this the right exception ?
                 } else if (value.equals("optional")) {
-                    impl.setAnonymous(WSDLBoundOperation.ANONYMOUS.optional);
+                    edit.setAnonymous(ANONYMOUS.optional);
                 } else if (value.equals("required")) {
-                    impl.setAnonymous(WSDLBoundOperation.ANONYMOUS.required);
+                    edit.setAnonymous(ANONYMOUS.required);
                 } else if (value.equals("prohibited")) {
-                    impl.setAnonymous(WSDLBoundOperation.ANONYMOUS.prohibited);
+                    edit.setAnonymous(ANONYMOUS.prohibited);
                 } else {
                     throw new WebServiceException("wsaw:Anonymous value \"" + value + "\" not understood.");
                     // TODO: throw exception only if wsdl:required=true
@@ -101,29 +100,29 @@
         return false;
     }
 
-    public void portTypeOperationInputAttributes(WSDLInput input, XMLStreamReader reader) {
+    public void portTypeOperationInputAttributes(EditableWSDLInput input, XMLStreamReader reader) {
        String action = ParserUtil.getAttribute(reader, getWsdlActionTag());
        if (action != null) {
-            ((WSDLInputImpl)input).setAction(action);
-            ((WSDLInputImpl)input).setDefaultAction(false);
+            input.setAction(action);
+            input.setDefaultAction(false);
         }
     }
 
 
-    public void portTypeOperationOutputAttributes(WSDLOutput output, XMLStreamReader reader) {
+    public void portTypeOperationOutputAttributes(EditableWSDLOutput output, XMLStreamReader reader) {
        String action = ParserUtil.getAttribute(reader, getWsdlActionTag());
        if (action != null) {
-            ((WSDLOutputImpl)output).setAction(action);
-            ((WSDLOutputImpl)output).setDefaultAction(false);
+            output.setAction(action);
+            output.setDefaultAction(false);
         }
     }
 
 
-    public void portTypeOperationFaultAttributes(WSDLFault fault, XMLStreamReader reader) {
+    public void portTypeOperationFaultAttributes(EditableWSDLFault fault, XMLStreamReader reader) {
         String action = ParserUtil.getAttribute(reader, getWsdlActionTag());
         if (action != null) {
-            ((WSDLFaultImpl) fault).setAction(action);
-            ((WSDLFaultImpl) fault).setDefaultAction(false);
+            fault.setAction(action);
+            fault.setDefaultAction(false);
         }
     }
 
@@ -139,11 +138,10 @@
      */
     @Override
     public void finished(WSDLParserExtensionContext context) {
-        WSDLModel model = context.getWSDLModel();
-        for (WSDLService service : model.getServices().values()) {
-            for (WSDLPort wp : service.getPorts()) {
-                WSDLPortImpl port = (WSDLPortImpl)wp;
-                WSDLBoundPortTypeImpl binding = port.getBinding();
+        EditableWSDLModel model = context.getWSDLModel();
+        for (EditableWSDLService service : model.getServices().values()) {
+            for (EditableWSDLPort port : service.getPorts()) {
+                EditableWSDLBoundPortType binding = port.getBinding();
 
                 // populate actions for the messages that do not have an explicit wsaw:Action
                 populateActions(binding);
@@ -166,12 +164,12 @@
      *
      * @param binding soapbinding:operation
      */
-    private void populateActions(WSDLBoundPortTypeImpl binding) {
-        WSDLPortTypeImpl porttype = binding.getPortType();
-        for (WSDLOperationImpl o : porttype.getOperations()) {
+    private void populateActions(EditableWSDLBoundPortType binding) {
+        EditableWSDLPortType porttype = binding.getPortType();
+        for (EditableWSDLOperation o : porttype.getOperations()) {
             // TODO: this may be performance intensive. Alternatively default action
             // TODO: can be calculated when the operation is actually invoked.
-            WSDLBoundOperationImpl wboi = binding.get(o.getName());
+                EditableWSDLBoundOperation wboi = binding.get(o.getName());
 
             if (wboi == null) {
                 //If this operation is unbound set the action to default
@@ -202,9 +200,9 @@
             if (o.getFaults() == null || !o.getFaults().iterator().hasNext())
                 continue;
 
-            for (WSDLFault f : o.getFaults()) {
+            for (EditableWSDLFault f : o.getFaults()) {
                 if (f.getAction() == null || f.getAction().equals("")) {
-                    ((WSDLFaultImpl)f).setAction(defaultFaultAction(f.getName(), o));
+                    f.setAction(defaultFaultAction(f.getName(), o));
                 }
 
             }
@@ -216,26 +214,26 @@
      *
      * @param binding WSDLBoundPortTypeImpl
      */
-    protected void patchAnonymousDefault(WSDLBoundPortTypeImpl binding) {
-        for (WSDLBoundOperationImpl wbo : binding.getBindingOperations()) {
+    protected void patchAnonymousDefault(EditableWSDLBoundPortType binding) {
+        for (EditableWSDLBoundOperation wbo : binding.getBindingOperations()) {
             if (wbo.getAnonymous() == null)
-                wbo.setAnonymous(WSDLBoundOperation.ANONYMOUS.optional);
+                wbo.setAnonymous(ANONYMOUS.optional);
         }
     }
 
-    private String defaultInputAction(WSDLOperation o) {
+    private String defaultInputAction(EditableWSDLOperation o) {
         return buildAction(o.getInput().getName(), o, false);
     }
 
-    private String defaultOutputAction(WSDLOperation o) {
+    private String defaultOutputAction(EditableWSDLOperation o) {
         return buildAction(o.getOutput().getName(), o, false);
     }
 
-    private String defaultFaultAction(String name, WSDLOperation o) {
+    private String defaultFaultAction(String name, EditableWSDLOperation o) {
         return buildAction(name, o, true);
     }
 
-    protected static final String buildAction(String name, WSDLOperation o, boolean isFault) {
+    protected static final String buildAction(String name, EditableWSDLOperation o, boolean isFault) {
         String tns = o.getName().getNamespaceURI();
 
         String delim = SLASH_DELIMITER;
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/WSDLParserExtensionContextImpl.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/WSDLParserExtensionContextImpl.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,7 +25,7 @@
 
 package com.sun.xml.internal.ws.wsdl.parser;
 
-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.wsdl.parser.WSDLParserExtensionContext;
 import com.sun.xml.internal.ws.api.policy.PolicyResolver;
@@ -38,7 +38,7 @@
  */
 final class WSDLParserExtensionContextImpl implements WSDLParserExtensionContext {
     private final boolean isClientSide;
-    private final WSDLModel wsdlModel;
+    private final EditableWSDLModel wsdlModel;
     private final Container container;
     private final PolicyResolver policyResolver;
 
@@ -46,7 +46,7 @@
      * Construct {@link WSDLParserExtensionContextImpl} with information that whether its on client side
      * or server side.
      */
-    protected WSDLParserExtensionContextImpl(WSDLModel model, boolean isClientSide, Container container, PolicyResolver policyResolver) {
+    protected WSDLParserExtensionContextImpl(EditableWSDLModel model, boolean isClientSide, Container container, PolicyResolver policyResolver) {
         this.wsdlModel = model;
         this.isClientSide = isClientSide;
         this.container = container;
@@ -57,7 +57,7 @@
         return isClientSide;
     }
 
-    public WSDLModel getWSDLModel() {
+    public EditableWSDLModel getWSDLModel() {
         return wsdlModel;
     }
 
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/WSDLParserExtensionFacade.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/parser/WSDLParserExtensionFacade.java	Tue Oct 08 14:55:33 2013 -0700
@@ -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,10 +27,8 @@
 
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtension;
 import com.sun.xml.internal.ws.api.wsdl.parser.WSDLParserExtensionContext;
-import com.sun.xml.internal.ws.api.model.wsdl.*;
+import com.sun.xml.internal.ws.api.model.wsdl.editable.*;
 import com.sun.xml.internal.ws.streaming.XMLStreamReaderUtil;
-import com.sun.xml.internal.ws.model.wsdl.WSDLPortImpl;
-import com.sun.xml.internal.ws.model.wsdl.WSDLBoundPortTypeImpl;
 
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.Location;
@@ -66,7 +64,7 @@
         }
     }
 
-    public boolean serviceElements(WSDLService service, XMLStreamReader reader) {
+    public boolean serviceElements(EditableWSDLService service, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if(e.serviceElements(service,reader))
                 return true;
@@ -75,12 +73,12 @@
         return true;
     }
 
-    public void serviceAttributes(WSDLService service, XMLStreamReader reader) {
+    public void serviceAttributes(EditableWSDLService service, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions)
             e.serviceAttributes(service,reader);
     }
 
-    public boolean portElements(WSDLPort port, XMLStreamReader reader) {
+    public boolean portElements(EditableWSDLPort port, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if(e.portElements(port,reader))
                 return true;
@@ -88,34 +86,34 @@
         //extension is not understood by any WSDlParserExtension
         //Check if it must be understood.
         if(isRequiredExtension(reader)) {
-            ((WSDLPortImpl)port).addNotUnderstoodExtension(reader.getName(),getLocator(reader));
+            port.addNotUnderstoodExtension(reader.getName(),getLocator(reader));
         }
         XMLStreamReaderUtil.skipElement(reader);
         return true;
     }
 
-    public boolean portTypeOperationInput(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationInput(EditableWSDLOperation op, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions)
             e.portTypeOperationInput(op,reader);
 
         return false;
     }
 
-    public boolean portTypeOperationOutput(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationOutput(EditableWSDLOperation op, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions)
             e.portTypeOperationOutput(op,reader);
 
         return false;
     }
 
-    public boolean portTypeOperationFault(WSDLOperation op, XMLStreamReader reader) {
+    public boolean portTypeOperationFault(EditableWSDLOperation op, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions)
             e.portTypeOperationFault(op,reader);
 
         return false;
     }
 
-    public void portAttributes(WSDLPort port, XMLStreamReader reader) {
+    public void portAttributes(EditableWSDLPort port, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions)
             e.portAttributes(port,reader);
     }
@@ -130,7 +128,7 @@
         return true;
     }
 
-    public boolean bindingElements(WSDLBoundPortType binding, XMLStreamReader reader){
+    public boolean bindingElements(EditableWSDLBoundPortType binding, XMLStreamReader reader){
         for (WSDLParserExtension e : extensions) {
             if (e.bindingElements(binding, reader)) {
                 return true;
@@ -139,20 +137,20 @@
         //extension is not understood by any WSDlParserExtension
         //Check if it must be understood.
         if (isRequiredExtension(reader)) {
-            ((WSDLBoundPortTypeImpl) binding).addNotUnderstoodExtension(
+            binding.addNotUnderstoodExtension(
                     reader.getName(), getLocator(reader));
         }
         XMLStreamReaderUtil.skipElement(reader);
         return true;
     }
 
-    public void bindingAttributes(WSDLBoundPortType binding, XMLStreamReader reader){
+    public void bindingAttributes(EditableWSDLBoundPortType binding, XMLStreamReader reader){
         for (WSDLParserExtension e : extensions) {
             e.bindingAttributes(binding, reader);
         }
     }
 
-    public boolean portTypeElements(WSDLPortType portType, XMLStreamReader reader) {
+    public boolean portTypeElements(EditableWSDLPortType portType, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.portTypeElements(portType, reader)) {
                 return true;
@@ -162,13 +160,13 @@
         return true;
     }
 
-    public void portTypeAttributes(WSDLPortType portType, XMLStreamReader reader) {
+    public void portTypeAttributes(EditableWSDLPortType portType, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.portTypeAttributes(portType, reader);
         }
     }
 
-    public boolean portTypeOperationElements(WSDLOperation operation, XMLStreamReader reader) {
+    public boolean portTypeOperationElements(EditableWSDLOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.portTypeOperationElements(operation, reader)) {
                 return true;
@@ -178,13 +176,13 @@
         return true;
     }
 
-    public void portTypeOperationAttributes(WSDLOperation operation, XMLStreamReader reader) {
+    public void portTypeOperationAttributes(EditableWSDLOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.portTypeOperationAttributes(operation, reader);
         }
     }
 
-    public boolean bindingOperationElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.bindingOperationElements(operation, reader)) {
                 return true;
@@ -194,13 +192,13 @@
         return true;
     }
 
-    public void bindingOperationAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.bindingOperationAttributes(operation, reader);
         }
     }
 
-    public boolean messageElements(WSDLMessage msg, XMLStreamReader reader) {
+    public boolean messageElements(EditableWSDLMessage msg, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.messageElements(msg, reader)) {
                 return true;
@@ -210,13 +208,13 @@
         return true;
     }
 
-    public void messageAttributes(WSDLMessage msg, XMLStreamReader reader) {
+    public void messageAttributes(EditableWSDLMessage msg, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.messageAttributes(msg, reader);
         }
     }
 
-    public boolean portTypeOperationInputElements(WSDLInput input, XMLStreamReader reader) {
+    public boolean portTypeOperationInputElements(EditableWSDLInput input, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.portTypeOperationInputElements(input, reader)) {
                 return true;
@@ -226,13 +224,13 @@
         return true;
     }
 
-    public void portTypeOperationInputAttributes(WSDLInput input, XMLStreamReader reader) {
+    public void portTypeOperationInputAttributes(EditableWSDLInput input, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.portTypeOperationInputAttributes(input, reader);
         }
     }
 
-    public boolean portTypeOperationOutputElements(WSDLOutput output, XMLStreamReader reader) {
+    public boolean portTypeOperationOutputElements(EditableWSDLOutput output, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.portTypeOperationOutputElements(output, reader)) {
                 return true;
@@ -242,13 +240,13 @@
         return true;
     }
 
-    public void portTypeOperationOutputAttributes(WSDLOutput output, XMLStreamReader reader) {
+    public void portTypeOperationOutputAttributes(EditableWSDLOutput output, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.portTypeOperationOutputAttributes(output, reader);
         }
     }
 
-    public boolean portTypeOperationFaultElements(WSDLFault fault, XMLStreamReader reader) {
+    public boolean portTypeOperationFaultElements(EditableWSDLFault fault, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.portTypeOperationFaultElements(fault, reader)) {
                 return true;
@@ -258,13 +256,13 @@
         return true;
     }
 
-    public void portTypeOperationFaultAttributes(WSDLFault fault, XMLStreamReader reader) {
+    public void portTypeOperationFaultAttributes(EditableWSDLFault fault, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.portTypeOperationFaultAttributes(fault, reader);
         }
     }
 
-    public boolean bindingOperationInputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationInputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.bindingOperationInputElements(operation, reader)) {
                 return true;
@@ -274,13 +272,13 @@
         return true;
     }
 
-    public void bindingOperationInputAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationInputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.bindingOperationInputAttributes(operation, reader);
         }
     }
 
-    public boolean bindingOperationOutputElements(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public boolean bindingOperationOutputElements(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.bindingOperationOutputElements(operation, reader)) {
                 return true;
@@ -290,13 +288,13 @@
         return true;
     }
 
-    public void bindingOperationOutputAttributes(WSDLBoundOperation operation, XMLStreamReader reader) {
+    public void bindingOperationOutputAttributes(EditableWSDLBoundOperation operation, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.bindingOperationOutputAttributes(operation, reader);
         }
     }
 
-    public boolean bindingOperationFaultElements(WSDLBoundFault fault, XMLStreamReader reader) {
+    public boolean bindingOperationFaultElements(EditableWSDLBoundFault fault, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             if (e.bindingOperationFaultElements(fault, reader)) {
                 return true;
@@ -306,7 +304,7 @@
         return true;
     }
 
-    public void bindingOperationFaultAttributes(WSDLBoundFault fault, XMLStreamReader reader) {
+    public void bindingOperationFaultAttributes(EditableWSDLBoundFault fault, XMLStreamReader reader) {
         for (WSDLParserExtension e : extensions) {
             e.bindingOperationFaultAttributes(fault, reader);
         }
--- a/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/writer/WSDLGenerator.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/com/sun/xml/internal/ws/wsdl/writer/WSDLGenerator.java	Tue Oct 08 14:55:33 2013 -0700
@@ -209,7 +209,7 @@
     private final Class implType;
 
     private boolean inlineSchemas;      // TODO
-    private final boolean disableSecureXmlProcessing;
+    private final boolean disableXmlSecurity;
 
     /**
      * Creates the WSDLGenerator
@@ -229,12 +229,12 @@
      * @param model The {@link AbstractSEIModelImpl} used to generate the WSDL
      * @param wsdlResolver The {@link WSDLResolver} to use resovle names while generating the WSDL
      * @param binding specifies which {@link javax.xml.ws.BindingType} to generate
-     * @param disableSecureXmlProcessing specifies whether to disable the secure xml processing feature
+     * @param disableXmlSecurity specifies whether to disable the secure xml processing feature
      * @param extensions an array {@link WSDLGeneratorExtension} that will
      * be invoked to generate WSDL extensions
      */
     public WSDLGenerator(AbstractSEIModelImpl model, WSDLResolver wsdlResolver, WSBinding binding, Container container,
-                         Class implType, boolean inlineSchemas, boolean disableSecureXmlProcessing,
+                         Class implType, boolean inlineSchemas, boolean disableXmlSecurity,
                          WSDLGeneratorExtension... extensions) {
 
         this.model = model;
@@ -245,7 +245,7 @@
         this.implType = implType;
         extensionHandlers = new ArrayList<WSDLGeneratorExtension>();
         this.inlineSchemas = inlineSchemas;
-        this.disableSecureXmlProcessing = disableSecureXmlProcessing;
+        this.disableXmlSecurity = disableXmlSecurity;
 
         // register handlers for default extensions
         register(new W3CAddressingWSDLGeneratorExtension());
@@ -463,7 +463,7 @@
             }
         }
         if (resolver.nonGlassfishSchemas != null) {
-            TransformerFactory tf = XmlUtil.newTransformerFactory(!disableSecureXmlProcessing);
+            TransformerFactory tf = XmlUtil.newTransformerFactory(!disableXmlSecurity);
             try {
                 Transformer t = tf.newTransformer();
                 for (DOMResult xsd : resolver.nonGlassfishSchemas) {
--- a/src/share/jaxws_classes/javax/annotation/PostConstruct.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/javax/annotation/PostConstruct.java	Tue Oct 08 14:55:33 2013 -0700
@@ -38,12 +38,31 @@
  * if the class does not request any resources to be injected. Only one
  * method can be annotated with this annotation. The method on which the
  * PostConstruct annotation is applied MUST fulfill all of the following
- * criteria:<ul>
- * <li>The method MUST NOT have any parameters except in the case of EJB
+ * criteria:
+ * <p>
+ * <ul>
+ * <li>The method MUST NOT have any parameters except in the case of
  * interceptors in which case it takes an InvocationContext object as
- * defined by the EJB specification.</li>
- * <li>The return type of the method MUST be void.</li>
- * <li>The method MUST NOT throw a checked exception.</li>
+ * defined by the Interceptors specification.</li>
+ * <li>The method defined on an interceptor class MUST HAVE one of the
+ * following signatures:
+ * <p>
+ * void &#060;METHOD&#062;(InvocationContext)
+ * <p>
+ * Object &#060;METHOD&#062;(InvocationContext) throws Exception
+ * <p>
+ * <i>Note: A PostConstruct interceptor method must not throw application
+ * exceptions, but it may be declared to throw checked exceptions including
+ * the java.lang.Exception if the same interceptor method interposes on
+ * business or timeout methods in addition to lifecycle events. If a
+ * PostConstruct interceptor method returns a value, it is ignored by
+ * the container.</i>
+ * </li>
+ * <li>The method defined on a non-interceptor class MUST HAVE the
+ * following signature:
+ * <p>
+ * void &#060;METHOD&#062;()
+ * </li>
  * <li>The method on which PostConstruct is applied MAY be public, protected,
  * package private or private.</li>
  * <li>The method MUST NOT be static except for the application client.</li>
--- a/src/share/jaxws_classes/javax/annotation/PreDestroy.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/javax/annotation/PreDestroy.java	Tue Oct 08 14:55:33 2013 -0700
@@ -37,18 +37,38 @@
  * supported by all container managed objects that support PostConstruct
  * except the application client container in Java EE 5. The method on which
  * the PreDestroy annotation is applied MUST fulfill all of the following
- * criteria:<ul>
- * <li>The method MUST NOT have any parameters except in the case of EJB
- * interceptors in which case it takes an InvocationContext object as defined
- * by the EJB specification.</li>
- * <li>The return type of the method MUST be void.</li>
- * <li>The method MUST NOT throw a checked exception.</li>
+ * criteria:
+ * <p>
+ * <ul>
+ * <li>The method MUST NOT have any parameters except in the case of
+ * interceptors in which case it takes an InvocationContext object as
+ * defined by the Interceptors specification.</li>
+ * <li>The method defined on an interceptor class MUST HAVE one of the
+ * following signatures:
+ * <p>
+ * void &#060;METHOD&#062;(InvocationContext)
+ * <p>
+ * Object &#060;METHOD&#062;(InvocationContext) throws Exception
+ * <p>
+ * <i>Note: A PreDestroy interceptor method must not throw application
+ * exceptions, but it may be declared to throw checked exceptions including
+ * the java.lang.Exception if the same interceptor method interposes on
+ * business or timeout methods in addition to lifecycle events. If a
+ * PreDestroy interceptor method returns a value, it is ignored by
+ * the container.</i>
+ * </li>
+ * <li>The method defined on a non-interceptor class MUST HAVE the
+ * following signature:
+ * <p>
+ * void &#060;METHOD&#062;()
+ * </li>
  * <li>The method on which PreDestroy is applied MAY be public, protected,
  * package private or private.</li>
  * <li>The method MUST NOT be static.</li>
  * <li>The method MAY be final.</li>
  * <li>If the method throws an unchecked exception it is ignored except in the
  * case of EJBs where the EJB can handle exceptions.</li>
+ * </ul>
  *
  * @see javax.annotation.PostConstruct
  * @see javax.annotation.Resource
--- a/src/share/jaxws_classes/javax/xml/bind/JAXBException.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/javax/xml/bind/JAXBException.java	Tue Oct 08 14:55:33 2013 -0700
@@ -48,7 +48,7 @@
      * Exception reference
      *
      */
-    private Throwable linkedException;
+    private volatile Throwable linkedException;
 
     static final long serialVersionUID = -5621384651494307979L;
 
@@ -133,7 +133,7 @@
      *                  indicates that the linked exception does not exist or
      *                  is unknown).
      */
-    public synchronized void setLinkedException( Throwable exception ) {
+    public void setLinkedException( Throwable exception ) {
         this.linkedException = exception;
     }
 
--- a/src/share/jaxws_classes/javax/xml/bind/Marshaller.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/javax/xml/bind/Marshaller.java	Tue Oct 08 14:55:33 2013 -0700
@@ -175,9 +175,7 @@
  * encoding used during these marshal operations.  Client applications are
  * expected to supply a valid character encoding name as defined in the
  * <a href="http://www.w3.org/TR/2000/REC-xml-20001006#charencoding">W3C XML 1.0
- * Recommendation</a> and supported by your
- * <a href="http://java.sun.com/j2se/1.3/docs/api/java/lang/package-summary.html#charenc">
- * Java Platform</a>.
+ * Recommendation</a> and supported by your Java Platform</a>.
  * </blockquote>
  *
  * <p>
@@ -292,7 +290,7 @@
  *   boolean beforeMarshal(Marshaller);
  *
  *   // Invoked by Marshaller after it has marshalled all properties of this object.
- *   void afterMmarshal(Marshaller);
+ *   void afterMarshal(Marshaller);
  * </pre>
  * </blockquote>
  * The class defined event callback methods should be used when the callback method requires
--- a/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/javax/xml/bind/TypeConstraintException.java	Tue Oct 08 14:55:33 2013 -0700
@@ -57,7 +57,7 @@
      * Exception reference
      *
      */
-    private Throwable linkedException;
+    private volatile Throwable linkedException;
 
 
     /**
@@ -141,7 +141,7 @@
      *                  indicates that the linked exception does not exist or
      *                  is unknown).
      */
-    public synchronized void setLinkedException( Throwable exception ) {
+    public void setLinkedException( Throwable exception ) {
         this.linkedException = exception;
     }
 
--- a/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/package.html	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/javax/xml/bind/annotation/adapters/package.html	Tue Oct 08 14:55:33 2013 -0700
@@ -38,8 +38,7 @@
         <h2>Package Specification</h2>
 
         <ul>
-            <li><a href="http://java.sun.com/xml/downloads/jaxb.html">JAXB
-                Specification</a>
+            <li><a href="http://jcp.org/en/jsr/detail?id=222">JAXB Specification</a>
         </ul>
 
         <h2>Related Documentation</h2>
@@ -47,8 +46,7 @@
         For overviews, tutorials, examples, guides, and tool documentation,
         please see:
         <ul>
-            <li>The <a href="http://java.sun.com/xml/jaxb/index.html">JAXB
-            Website</a>
+            <li>The <a href="http://jaxb.java.net">JAXB Website</a>
         </ul>
 
         <!-- Put @see and @since tags down here. -->
--- a/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java	Wed Oct 02 13:26:41 2013 -0700
+++ b/src/share/jaxws_classes/javax/xml/soap/MessageFactory.java	Tue Oct 08 14:55:33 2013 -0700
@@ -104,8 +104,6 @@
                     MESSAGE_FACTORY_PROPERTY,
                     DEFAULT_MESSAGE_FACTORY,
                     false);
-                FactoryFinder.find(MESSAGE_FACTORY_PROPERTY,
-                        DEFAULT_MESSAGE_FACTORY, false);
 
             if (factory != null) {
                 return factory;