4745d9
--- src/org/apache/xerces/impl/XMLScanner.java	2013/07/03 18:25:06	1499505
4745d9
+++ src/org/apache/xerces/impl/XMLScanner.java	2013/07/03 18:29:43	1499506
4745d9
@@ -542,7 +542,7 @@
4745d9
         // document is until we scan the encoding declaration
4745d9
         // you cannot reliably read any characters outside
4745d9
         // of the ASCII range here. -- mrglavas
4745d9
-        String name = fEntityScanner.scanName();
4745d9
+        String name = scanPseudoAttributeName();
4745d9
         XMLEntityManager.print(fEntityManager.getCurrentEntity());
4745d9
         if (name == null) {
4745d9
             reportFatalError("PseudoAttrNameExpected", null);
4745d9
@@ -599,6 +599,35 @@
4745d9
     } // scanPseudoAttribute(XMLString):String
4745d9
     
4745d9
     /**
4745d9
+     * Scans the name of a pseudo attribute. The only legal names
4745d9
+     * in XML 1.0/1.1 documents are 'version', 'encoding' and 'standalone'.
4745d9
+     * 
4745d9
+     * @return the name of the pseudo attribute or null
4745d9
+     * if a legal pseudo attribute name could not be scanned.
4745d9
+     */
4745d9
+    private String scanPseudoAttributeName() throws IOException, XNIException {
4745d9
+        final int ch = fEntityScanner.peekChar();
4745d9
+        switch (ch) {
4745d9
+            case 'v':
4745d9
+                if (fEntityScanner.skipString(fVersionSymbol)) {
4745d9
+                    return fVersionSymbol;
4745d9
+                }
4745d9
+                break;
4745d9
+            case 'e':
4745d9
+                if (fEntityScanner.skipString(fEncodingSymbol)) {
4745d9
+                    return fEncodingSymbol;
4745d9
+                }
4745d9
+                break;
4745d9
+            case 's':
4745d9
+                if (fEntityScanner.skipString(fStandaloneSymbol)) {
4745d9
+                    return fStandaloneSymbol;
4745d9
+                }
4745d9
+                break;
4745d9
+        }
4745d9
+        return null;
4745d9
+    } // scanPseudoAttributeName()
4745d9
+    
4745d9
+    /**
4745d9
      * Scans a processing instruction.
4745d9
      * 

4745d9
      *