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

22fe22
      *