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

221b3b
      *