changeset 271:47ef99bcbcb0

6894833: Upgrade jaxp drop source bundle
author andrew
date Wed, 28 Sep 2011 16:49:43 +0100
parents c63c5b543551
children c20bbcc510ff
files sources/jaxp_src/ASSEMBLY_EXCEPTION sources/jaxp_src/THIRD_PARTY_README sources/jaxp_src/TRADEMARK sources/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xslt/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/TransletException.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Copy.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Number.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ca.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_cs.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sk.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/xpath.lex sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/AnyNodeCounter.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultipleNodeCounter.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeCounter.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/SingleNodeCounter.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/AttrImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/ParentNode.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/Constants.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages.properties sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages.properties sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMBuilder.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSAllCM.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSCMUniOp.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSCMValidator.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSDFACM.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSEmptyCM.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDocumentInfo.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/util/XMLAttributesImpl.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/xni/parser/XMLConfigurationException.java sources/jaxp_src/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/ref/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/resolver/Catalog.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/EncodingInfo.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/Encodings.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/ThreadControllerWrapper.java sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/compiler/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/functions/ObjectFactory.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java sources/jaxp_src/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java sources/jaxp_src/src/com/sun/xml/internal/stream/XMLInputFactoryImpl.java sources/jaxp_src/src/com/sun/xml/internal/stream/XMLOutputFactoryImpl.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/AttributeImpl.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/CharacterEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/CommentEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/DTDEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/DummyEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/EndDocumentEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/EndElementEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/EntityDeclarationImpl.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/EntityReferenceEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/NamedEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/NotationDeclarationImpl.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/ProcessingInstructionEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/StartDocumentEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/StartElementEvent.java sources/jaxp_src/src/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java sources/jaxp_src/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java sources/jaxp_src/src/javax/xml/stream/EventFilter.java sources/jaxp_src/src/javax/xml/stream/FactoryConfigurationError.java sources/jaxp_src/src/javax/xml/stream/Location.java sources/jaxp_src/src/javax/xml/stream/StreamFilter.java sources/jaxp_src/src/javax/xml/stream/XMLEventFactory.java sources/jaxp_src/src/javax/xml/stream/XMLEventReader.java sources/jaxp_src/src/javax/xml/stream/XMLEventWriter.java sources/jaxp_src/src/javax/xml/stream/XMLInputFactory.java sources/jaxp_src/src/javax/xml/stream/XMLOutputFactory.java sources/jaxp_src/src/javax/xml/stream/XMLReporter.java sources/jaxp_src/src/javax/xml/stream/XMLResolver.java sources/jaxp_src/src/javax/xml/stream/XMLStreamConstants.java sources/jaxp_src/src/javax/xml/stream/XMLStreamException.java sources/jaxp_src/src/javax/xml/stream/XMLStreamReader.java sources/jaxp_src/src/javax/xml/stream/XMLStreamWriter.java sources/jaxp_src/src/javax/xml/stream/events/Attribute.java sources/jaxp_src/src/javax/xml/stream/events/Characters.java sources/jaxp_src/src/javax/xml/stream/events/Comment.java sources/jaxp_src/src/javax/xml/stream/events/DTD.java sources/jaxp_src/src/javax/xml/stream/events/EndDocument.java sources/jaxp_src/src/javax/xml/stream/events/EndElement.java sources/jaxp_src/src/javax/xml/stream/events/EntityDeclaration.java sources/jaxp_src/src/javax/xml/stream/events/EntityReference.java sources/jaxp_src/src/javax/xml/stream/events/Namespace.java sources/jaxp_src/src/javax/xml/stream/events/NotationDeclaration.java sources/jaxp_src/src/javax/xml/stream/events/ProcessingInstruction.java sources/jaxp_src/src/javax/xml/stream/events/StartDocument.java sources/jaxp_src/src/javax/xml/stream/events/StartElement.java sources/jaxp_src/src/javax/xml/stream/events/XMLEvent.java sources/jaxp_src/src/javax/xml/stream/util/EventReaderDelegate.java sources/jaxp_src/src/javax/xml/stream/util/StreamReaderDelegate.java sources/jaxp_src/src/javax/xml/stream/util/XMLEventAllocator.java sources/jaxp_src/src/javax/xml/stream/util/XMLEventConsumer.java sources/jaxp_src/src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java sources/jaxp_src/src/org/xml/sax/SAXException.java sources/jaxp_src/src/org/xml/sax/ext/package.html sources/jaxp_src/src/org/xml/sax/helpers/package.html sources/jaxp_src/src/org/xml/sax/package.html
diffstat 163 files changed, 12825 insertions(+), 10198 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/jaxp_src/ASSEMBLY_EXCEPTION	Wed Sep 28 16:49:43 2011 +0100
@@ -0,0 +1,27 @@
+
+OPENJDK ASSEMBLY EXCEPTION
+
+The OpenJDK source code made available by Sun at openjdk.java.net and
+openjdk.dev.java.net ("OpenJDK Code") is distributed under the terms of the
+GNU General Public License <http://www.gnu.org/copyleft/gpl.html> version 2
+only ("GPL2"), with the following clarification and special exception.
+
+    Linking this OpenJDK Code statically or dynamically with other code
+    is making a combined work based on this library.  Thus, the terms
+    and conditions of GPL2 cover the whole combination.
+
+    As a special exception, Sun gives you permission to link this
+    OpenJDK Code with certain code licensed by Sun as indicated at
+    http://openjdk.java.net/legal/exception-modules-2007-05-08.html
+    ("Designated Exception Modules") to produce an executable,
+    regardless of the license terms of the Designated Exception Modules,
+    and to copy and distribute the resulting executable under GPL2,
+    provided that the Designated Exception Modules continue to be
+    governed by the licenses under which they were offered by Sun.
+
+As such, it allows licensees and sublicensees of Sun's GPL2 OpenJDK Code to
+build an executable that includes those portions of necessary code that Sun
+could not provide under GPL2 (or that Sun has provided under GPL2 with the
+Classpath exception).  If you modify or add to the OpenJDK code, that new
+GPL2 code may still be combined with Designated Exception Modules if the
+new code is made subject to this exception by its copyright holder.
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/jaxp_src/THIRD_PARTY_README	Wed Sep 28 16:49:43 2011 +0100
@@ -0,0 +1,1628 @@
+DO NOT TRANSLATE OR LOCALIZE.
+
+%% This notice is provided with respect to Thai dictionary for text breaking, which may be included with this software: 
+
+--- begin of LICENSE file ---
+
+Copyright (C) 1982 The Royal Institute, Thai Royal Government.
+
+Copyright (C) 1998 National Electronics and Computer Technology Center,
+ National Science and Technology Development Agency,
+ Ministry of Science Technology and Environment,
+ Thai Royal Government.
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the "Software"), to
+deal in the Software without restriction, including without
+limitation the rights to use, copy, modify, merge, publish, distribute,
+sublicense, and/or sell copies of the Software, and to permit persons to
+whom the Software is furnished to do so, subject to the following
+conditions:
+
+The above copyright notice and this permission notice shall be included
+in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
+NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
+OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
+USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+--- end of LICENSE file ---
+%% This notice is provided with respect to ASM, which may be included with this software: 
+Copyright (c) 2000-2005 INRIA, France Telecom
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holders nor the names of its
+   contributors may be used to endorse or promote products derived from
+   this software without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
+INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
+ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
+THE POSSIBILITY OF SUCH DAMAGE.
+
+%% This notice is provided with respect to littlecms, which may be included with this software:  
+
+Little cms
+Copyright (C) 1998-2004 Marti Maria
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
+COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
+IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+%% This notice is provided with respect to zlib 1.1.3, which may be included with this software:   
+
+Acknowledgments:
+
+  The deflate format used by zlib was defined by Phil Katz. The deflate
+  and zlib specifications were written by L. Peter Deutsch. Thanks to all the
+  people who reported problems and suggested various improvements in zlib;
+  they are too numerous to cite here.
+
+Copyright notice:
+
+ (C) 1995-1998 Jean-loup Gailly and Mark Adler
+
+  This software is provided 'as-is', without any express or implied
+  warranty.  In no event will the authors be held liable for any damages
+  arising from the use of this software.
+
+  Permission is granted to anyone to use this software for any purpose,
+  including commercial applications, and to alter it and redistribute it
+  freely, subject to the following restrictions:
+
+  1. The origin of this software must not be misrepresented; you must not
+     claim that you wrote the original software. If you use this software
+     in a product, an acknowledgment in the product documentation would be
+     appreciated but is not required.
+  2. Altered source versions must be plainly marked as such, and must not be
+     misrepresented as being the original software.
+  3. This notice may not be removed or altered from any source distribution.
+
+  Jean-loup Gailly        Mark Adler
+  jloup@gzip.org          madler@alumni.caltech.edu
+
+If you use the zlib library in a product, we would appreciate *not*
+receiving lengthy legal documents to sign. The sources are provided
+for free but without warranty of any kind.  The library has been
+entirely written by Jean-loup Gailly and Mark Adler; it does not
+include third-party code.
+
+If you redistribute modified sources, we would appreciate that you include
+in the file ChangeLog history information documenting your changes.
+
+%% This notice is provided with respect to W3C (DTD for XML Signatures), which may be included with this software: 
+W3C® SOFTWARE NOTICE AND LICENSE
+Copyright © 1994-2002 World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/
+This W3C work (including software, documents, or other related items) is being provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you (the licensee) agree that you have read, understood, and will comply with the following terms and conditions:
+Permission to use, copy, modify, and distribute this software and its documentation, with or without modification,  for any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies of the software and documentation or portions thereof, including modifications, that you make:
+1.The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 
+2.Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, a short notice of the following form (hypertext is preferred, text is permitted) should be used within the body of any redistributed or derivative code: "Copyright © [$date-of-software] World Wide Web Consortium, (Massachusetts Institute of Technology, Institut National de Recherche en Informatique et en Automatique, Keio University). All Rights Reserved. http://www.w3.org/Consortium/Legal/" 
+3.Notice of any changes or modifications to the W3C files, including the date changes were made. (We recommend you provide URIs to the location from which the code is derived.) 
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKE NO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO, WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the software without specific, written prior permission. Title to copyright in this software and any associated documentation will at all times remain with copyright holders.
+____________________________________
+This formulation of W3C's notice and license became active on August 14 1998 so as to improve compatibility with GPL. This version ensures that W3C software licensing terms are no more restrictive than GPL and consequently W3C software may be distributed in GPL packages. See the older formulation for the policy prior to this date. Please see our Copyright FAQ for common questions about using materials from our site, including specific terms and conditions for packages like libwww, Amaya, and Jigsaw. Other questions about this notice can be directed to site-policy@w3.org.
+
+
+%% This notice is provided with respect to PC/SC Lite for Suse Linux v. 1.1.1, which may be included with this software: 
+
+Copyright (c) 1999-2004 David Corcoran 
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions
+are met:
+
+1. Redistributions of source code must retain the above copyright
+   notice, this list of conditions and the following disclaimer.
+2. Redistributions in binary form must reproduce the above copyright
+   notice, this list of conditions and the following disclaimer in the
+   documentation and/or other materials provided with the distribution.
+3. The name of the author may not be used to endorse or promote products
+   derived from this software without specific prior written permission.
+
+Changes to this license can be made only by the copyright author with 
+explicit written consent.
+
+THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
+IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
+IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
+NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+
+%% This notice is provided with respect to IAIK PKCS Wrapper, which may be included with this software: 
+
+Copyright (c) 2002 Graz University of Technology. All rights reserved.
+Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:
+
+
+1. Redistributions of source code must retain the above copyright notice, this   list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright notice,   this list of conditions and the following disclaimer in the documentation   and/or other materials provided with the distribution.
+
+3. The end-user documentation included with the redistribution, if any, must   include the following acknowledgment:
+
+   "This product includes software developed by IAIK of Graz University of    Technology."
+
+   Alternately, this acknowledgment may appear in the software itself, if and   wherever such third-party acknowledgments normally appear.
+
+4. The names "Graz University of Technology" and "IAIK of Graz University of   Technology" must not be used to endorse or promote products derived from this   software without prior written permission.
+
+5. Products derived from this software may not be called "IAIK PKCS Wrapper",   nor may "IAIK" appear in their name, without prior written permission of   Graz University of Technology.
+
+THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESSED OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE LICENSOR BE
+LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,
+OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
+OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
+ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+POSSIBILITY OF SUCH DAMAGE.
+
+%% This notice is provided with respect to Document Object Model (DOM) v. Level 3, which may be included with this software: 
+
+W3Cýý SOFTWARE NOTICE AND LICENSE
+
+http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+This work (and included software, documentation such as READMEs, or other related items) is being
+provided by the copyright holders under the following license. By obtaining, using and/or copying this work, you
+(the licensee) agree that you have read, understood, and will comply with the following terms and conditions.
+
+Permission to copy, modify, and distribute this software and its documentation, with or without modification, for
+any purpose and without fee or royalty is hereby granted, provided that you include the following on ALL copies
+of the software and documentation or portions thereof, including modifications:
+   1.The full text of this NOTICE in a location viewable to users of the redistributed or derivative work. 
+   2.Any pre-existing intellectual property disclaimers, notices, or terms and conditions. If none exist, the
+     W3C Software Short Notice should be included (hypertext is preferred, text is permitted) within the body
+     of any redistributed or derivative code. 
+   3.Notice of any changes or modifications to the files, including the date changes were made. (We
+     recommend you provide URIs to the location from which the code is derived.) 
+THIS SOFTWARE AND DOCUMENTATION IS PROVIDED "AS IS," AND COPYRIGHT HOLDERS MAKENO REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO,
+WARRANTIES OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THEUSE OF THE SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY PATENTS,COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
+
+COPYRIGHT HOLDERS WILL NOT BE LIABLE FOR ANY DIRECT, INDIRECT, SPECIAL ORCONSEQUENTIAL DAMAGES ARISING OUT OF ANY USE OF THE SOFTWARE OR DOCUMENTATION.
+The name and trademarks of copyright holders may NOT be used in advertising or publicity pertaining to the
+software without specific, written prior permission. Title to copyright in this software and any associated
+documentation will at all times remain with copyright holders.
+
+____________________________________
+
+This formulation of W3C's notice and license became active on December 31 2002. This version removes the
+copyright ownership notice such that this license can be used with materials other than those owned by the
+W3C, reflects that ERCIM is now a host of the W3C, includes references to this specific dated version of the
+license, and removes the ambiguous grant of "use". Otherwise, this version is the same as the previous
+version and is written so as to preserve the Free Software Foundation's assessment of GPL compatibility and
+OSI's certification under the Open Source Definition. Please see our Copyright FAQ for common questions
+about using materials from our site, including specific terms and conditions for packages like libwww, Amaya,
+and Jigsaw. Other questions about this notice can be directed to 
+site-policy@w3.org.
+
+%% This notice is provided with respect to Xalan, Xerces, which may be included with this software: 
+
+/*
+ * The Apache Software License, Version 1.1
+ *
+ *
+ * Copyright (c) 1999-2003 The Apache Software Foundation.  All rights  * reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.  *
+ * 2. Redistributions in binary form must reproduce the above copyright *    notice, this list of conditions and the following disclaimer in
+ *    the documentation and/or other materials provided with the
+ *    distribution.
+ *
+ * 3. The end-user documentation included with the redistribution,
+ *    if any, must include the following acknowledgment:  
+ *       "This product includes software developed by the
+ *        Apache Software Foundation (http://www.apache.org/)."
+ *    Alternately, this acknowledgment may appear in the software itself, *    if and wherever such third-party acknowledgments normally appear. *
+ * 4. The names "Xerces" and "Apache Software Foundation" must
+ *    not be used to endorse or promote products derived from this
+ *    software without prior written permission. For written 
+ *    permission, please contact apache@apache.org.
+ *
+ * 5. Products derived from this software may not be called "Apache",
+ *    nor may "Apache" appear in their name, without prior written
+ *    permission of the Apache Software Foundation.
+ *
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+ * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+ * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+ * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ * ==================================================================== *
+ * This software consists of voluntary contributions made by many
+ * individuals on behalf of the Apache Software Foundation and was
+ * originally based on software copyright (c) 1999, International
+ * Business Machines, Inc., http://www.ibm.com.  For more
+ * information on the Apache Software Foundation, please see
+ * 
+
+%% This notice is provided with respect to JavaScript, which may be included with this software: 
+
+AMENDMENTS 
+The Netscape Public License Version 1.1 ("NPL") consists of the Mozilla Public License Version 1.1 with the following Amendments, including Exhibit A-Netscape Public License.  Files identified with "Exhibit A-Netscape Public License" are governed by the Netscape Public License Version 1.1. 
+Additional Terms applicable to the Netscape Public License. 
+I. Effect. 
+These additional terms described in this Netscape Public License -- Amendments shall apply to the Mozilla Communicator client code and to all Covered Code under this License. 
+II. ''Netscape's Branded Code'' means Covered Code that Netscape distributes and/or permits others to distribute under one or more trademark(s) which are controlled by Netscape but which are not licensed for use under this License. 
+III. Netscape and logo. 
+This License does not grant any rights to use the trademarks "Netscape'', the "Netscape N and horizon'' logo or the "Netscape lighthouse" logo, "Netcenter", "Gecko", "Java" or "JavaScript", "Smart Browsing" even if such marks are included in the Original Code or Modifications. 
+IV. Inability to Comply Due to Contractual Obligation. 
+Prior to licensing the Original Code under this License, Netscape has licensed third party code for use in Netscape's Branded Code. To the extent that Netscape is limited contractually from making such third party code available under this License, Netscape may choose to reintegrate such code into Covered Code without being required to distribute such code in Source Code form, even if such code would otherwise be considered ''Modifications'' under this License. 
+V. Use of Modifications and Covered Code by Initial Developer. 
+V.1. In General. 
+The obligations of Section 3 apply to Netscape, except to the extent specified in this Amendment, Section V.2 and V.3. 
+V.2. Other Products. 
+Netscape may include Covered Code in products other than the Netscape's Branded Code which are released by Netscape during the two (2) years following the release date of the Original Code, without such additional products becoming subject to the terms of this License, and may license such additional products on different terms from those contained in this License. 
+V.3. Alternative Licensing. 
+Netscape may license the Source Code of Netscape's Branded Code, including Modifications incorporated therein, without such Netscape Branded Code becoming subject to the terms of this License, and may license such Netscape Branded Code on different terms from those contained in this License. 

+VI. Litigation. 
+Notwithstanding the limitations of Section 11 above, the provisions regarding litigation in Section 11(a), (b) and (c) of the License shall apply to all disputes relating to this License.
+
+EXHIBIT A-Netscape Public License. 

+''The contents of this file are subject to the Netscape Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.mozilla.org/NPL/ 
+Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. 
+The Original Code is Mozilla Communicator client code, released March 31, 1998. 
+The Initial Developer of the Original Code is Netscape Communications Corporation. Portions created by Netscape are Copyright (C) 1998-1999 Netscape Communications Corporation. All Rights Reserved. 
+Contributor(s): ______________________________________.

+Alternatively, the contents of this file may be used under the terms of the _____ license (the  "[___] License"), in which case the provisions of [______] License are applicable  instead of those above.  If you wish to allow use of your version of this file only under the terms of the [____] License and not to allow others to use your version of this file under the NPL, indicate your decision by deleting  the provisions above and replace  them with the notice and other provisions required by the [___] License.  If you do not delete the provisions above, a recipient may use your version of this file under either the NPL or the [___] License."
+
+MOZILLA PUBLIC LICENSE 
+Version 1.1 
+
+1. Definitions. 
+1.0.1. "Commercial Use" means distribution or otherwise making the Covered Code available to a third party. 
+1.1. ''Contributor'' means each entity that creates or contributes to the creation of Modifications. 
+1.2. ''Contributor Version'' means the combination of the Original Code, prior Modifications used by a Contributor, and the Modifications made by that particular Contributor. 
+1.3. ''Covered Code'' means the Original Code or Modifications or the combination of the Original Code and Modifications, in each case including portions thereof. 
+1.4. ''Electronic Distribution Mechanism'' means a mechanism generally accepted in the software development community for the electronic transfer of data. 
+1.5. ''Executable'' means Covered Code in any form other than Source Code. 
+1.6. ''Initial Developer'' means the individual or entity identified as the Initial Developer in the Source Code notice required by Exhibit A. 
+1.7. ''Larger Work'' means a work which combines Covered Code or portions thereof with code not governed by the terms of this License. 
+1.8. ''License'' means this document. 
+1.8.1. "Licensable" means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently acquired, any and all of the rights conveyed herein. 
+1.9. ''Modifications'' means any addition to or deletion from the substance or structure of either the Original Code or any previous Modifications. When Covered Code is released as a series of files, a Modification is: 
+A. Any addition to or deletion from the contents of a file containing Original Code or previous Modifications. 
+B. Any new file that contains any part of the Original Code or previous Modifications. 

+1.10. ''Original Code'' means Source Code of computer software code which is described in the Source Code notice required by Exhibit A as Original Code, and which, at the time of its release under this License is not already Covered Code governed by this License. 
+1.10.1. "Patent Claims" means any patent claim(s), now owned or hereafter acquired, including without limitation,  method, process, and apparatus claims, in any patent Licensable by grantor. 
+1.11. ''Source Code'' means the preferred form of the Covered Code for making modifications to it, including all modules it contains, plus any associated interface definition files, scripts used to control compilation and installation of an Executable, or source code differential comparisons against either the Original Code or another well known, available Covered Code of the Contributor's choice. The Source Code can be in a compressed or archival form, provided the appropriate decompression or de-archiving software is widely available for no charge. 
+1.12. "You'' (or "Your")  means an individual or a legal entity exercising rights under, and complying with all of the terms of, this License or a future version of this License issued under Section 6.1. For legal entities, "You'' includes any entity which controls, is controlled by, or is under common control with You. For purposes of this definition, "control'' means (a) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (b) ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity.
+2. Source Code License. 
+2.1. The Initial Developer Grant. 
+The Initial Developer hereby grants You a world-wide, royalty-free, non-exclusive license, subject to third party intellectual property claims: 
+(a)  under intellectual property rights (other than patent or trademark) Licensable by Initial Developer to use, reproduce, modify, display, perform, sublicense and distribute the Original Code (or portions thereof) with or without Modifications, and/or as part of a Larger Work; and 
+(b) under Patents Claims infringed by the making, using or selling of Original Code, to make, have made, use, practice, sell, and offer for sale, and/or otherwise dispose of the Original Code (or portions thereof). 

+(c) the licenses granted in this Section 2.1(a) and (b) are effective on the date Initial Developer first distributes Original Code under the terms of this License. 
+(d) Notwithstanding Section 2.1(b) above, no patent license is granted: 1) for code that You delete from the Original Code; 2) separate from the Original Code;  or 3) for infringements caused by: i) the modification of the Original Code or ii) the combination of the Original Code with other software or devices. 

+2.2. Contributor Grant. 
+Subject to third party intellectual property claims, each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license 

+(a)  under intellectual property rights (other than patent or trademark) Licensable by Contributor, to use, reproduce, modify, display, perform, sublicense and distribute the Modifications created by such Contributor (or portions thereof) either on an unmodified basis, with other Modifications, as Covered Code and/or as part of a Larger Work; and 
+(b) under Patent Claims infringed by the making, using, or selling of  Modifications made by that Contributor either alone and/or in combination with its Contributor Version (or portions of such combination), to make, use, sell, offer for sale, have made, and/or otherwise dispose of: 1) Modifications made by that Contributor (or portions thereof); and 2) the combination of  Modifications made by that Contributor with its Contributor Version (or portions of such combination). 
+(c) the licenses granted in Sections 2.2(a) and 2.2(b) are effective on the date Contributor first makes Commercial Use of the Covered Code. 
+(d)    Notwithstanding Section 2.2(b) above, no patent license is granted: 1) for any code that Contributor has deleted from the Contributor Version; 2)  separate from the Contributor Version;  3)  for infringements caused by: i) third party modifications of Contributor Version or ii)  the combination of Modifications made by that Contributor with other software  (except as part of the Contributor Version) or other devices; or 4) under Patent Claims infringed by Covered Code in the absence of Modifications made by that Contributor.
+
+3. Distribution Obligations. 
+3.1. Application of License. 
+The Modifications which You create or to which You contribute are governed by the terms of this License, including without limitation Section 2.2. The Source Code version of Covered Code may be distributed only under the terms of this License or a future version of this License released under Section 6.1, and You must include a copy of this License with every copy of the Source Code You distribute. You may not offer or impose any terms on any Source Code version that alters or restricts the applicable version of this License or the recipients' rights hereunder. However, You may include an additional document offering the additional rights described in Section 3.5. 
+3.2. Availability of Source Code. 
+Any Modification which You create or to which You contribute must be made available in Source Code form under the terms of this License either on the same media as an Executable version or via an accepted Electronic Distribution Mechanism to anyone to whom you made an Executable version available; and if made available via Electronic Distribution Mechanism, must remain available for at least twelve (12) months after the date it initially became available, or at least six (6) months after a subsequent version of that particular Modification has been made available to such recipients. You are responsible for ensuring that the Source Code version remains available even if the Electronic Distribution Mechanism is maintained by a third party. 
+3.3. Description of Modifications. 
+You must cause all Covered Code to which You contribute to contain a file documenting the changes You made to create that Covered Code and the date of any change. You must include a prominent statement that the Modification is derived, directly or indirectly, from Original Code provided by the Initial Developer and including the name of the Initial Developer in (a) the Source Code, and (b) in any notice in an Executable version or related documentation in which You describe the origin or ownership of the Covered Code. 
+3.4. Intellectual Property Matters 
+(a) Third Party Claims. 
+If Contributor has knowledge that a license under a third party's intellectual property rights is required to exercise the rights granted by such Contributor under Sections 2.1 or 2.2, Contributor must include a text file with the Source Code distribution titled "LEGAL'' which describes the claim and the party making the claim in sufficient detail that a recipient will know whom to contact. If Contributor obtains such knowledge after the Modification is made available as described in Section 3.2, Contributor shall promptly modify the LEGAL file in all copies Contributor makes available thereafter and shall take other steps (such as notifying appropriate mailing lists or newsgroups) reasonably calculated to inform those who received the Covered Code that new knowledge has been obtained. 
+(b) Contributor APIs. 
+If Contributor's Modifications include an application programming interface and Contributor has knowledge of patent licenses which are reasonably necessary to implement that API, Contributor must also include this information in the LEGAL file. 

+          (c)    Representations. 
+Contributor represents that, except as disclosed pursuant to Section 3.4(a) above, Contributor believes that Contributor's Modifications are Contributor's original creation(s) and/or Contributor has sufficient rights to grant the rights conveyed by this License.
+
+3.5. Required Notices. 
+You must duplicate the notice in Exhibit A in each file of the Source Code.  If it is not possible to put such notice in a particular Source Code file due to its structure, then You must include such notice in a location (such as a relevant directory) where a user would be likely to look for such a notice.  If You created one or more Modification(s) You may add your name as a Contributor to the notice described in Exhibit A.  You must also duplicate this License in any documentation for the Source Code where You describe recipients' rights or ownership rights relating to Covered Code.  You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Code. However, You may do so only on Your own behalf, and not on behalf of the Initial Developer or any Contributor. You must make it absolutely clear than any such warranty, support, indemnity or liability obligation is offered by You alone, and You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of warranty, support, indemnity or liability terms You offer. 
+3.6. Distribution of Executable Versions. 
+You may distribute Covered Code in Executable form only if the requirements of Section 3.1-3.5 have been met for that Covered Code, and if You include a notice stating that the Source Code version of the Covered Code is available under the terms of this License, including a description of how and where You have fulfilled the obligations of Section 3.2. The notice must be conspicuously included in any notice in an Executable version, related documentation or collateral in which You describe recipients' rights relating to the Covered Code. You may distribute the Executable version of Covered Code or ownership rights under a license of Your choice, which may contain terms different from this License, provided that You are in compliance with the terms of this License and that the license for the Executable version does not attempt to limit or alter the recipient's rights in the Source Code version from the rights set forth in this License. If You distribute the Executable version under a different license You must make it absolutely clear that any terms which differ from this License are offered by You alone, not by the Initial Developer or any Contributor. You hereby agree to indemnify the Initial Developer and every Contributor for any liability incurred by the Initial Developer or such Contributor as a result of any such terms You offer. 
+3.7. Larger Works. 
+You may create a Larger Work by combining Covered Code with other code not governed by the terms of this License and distribute the Larger Work as a single product. In such a case, You must make sure the requirements of this License are fulfilled for the Covered Code.
+4. Inability to Comply Due to Statute or Regulation. 
+If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Code due to statute, judicial order, or regulation then You must: (a) comply with the terms of this License to the maximum extent possible; and (b) describe the limitations and the code they affect. Such description must be included in the LEGAL file described in Section 3.4 and must be included with all distributions of the Source Code. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it.
+5. Application of this License. 
+This License applies to code to which the Initial Developer has attached the notice in Exhibit A and to related Covered Code.
+6. Versions of the License. 
+6.1. New Versions. 
+Netscape Communications Corporation (''Netscape'') may publish revised and/or new versions of the License from time to time. Each version will be given a distinguishing version number. 
+6.2. Effect of New Versions. 
+Once Covered Code has been published under a particular version of the License, You may always continue to use it under the terms of that version. You may also choose to use such Covered Code under the terms of any subsequent version of the License published by Netscape. No one other than Netscape has the right to modify the terms applicable to Covered Code created under this License. 
+6.3. Derivative Works. 
+If You create or use a modified version of this License (which you may only do in order to apply it to code which is not already Covered Code governed by this License), You must (a) rename Your license so that the phrases ''Mozilla'', ''MOZILLAPL'', ''MOZPL'', ''Netscape'', "MPL", ''NPL'' or any confusingly similar phrase do not appear in your license (except to note that your license differs from this License) and (b) otherwise make it clear that Your version of the license contains terms which differ from the Mozilla Public License and Netscape Public License. (Filling in the name of the Initial Developer, Original Code or Contributor in the notice described in Exhibit A shall not of themselves be deemed to be modifications of this License.)
+7. DISCLAIMER OF WARRANTY. 
+COVERED CODE IS PROVIDED UNDER THIS LICENSE ON AN "AS IS'' BASIS, WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, WITHOUT LIMITATION, WARRANTIES THAT THE COVERED CODE IS FREE OF DEFECTS, MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE OR NON-INFRINGING. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE COVERED CODE IS WITH YOU. SHOULD ANY COVERED CODE PROVE DEFECTIVE IN ANY RESPECT, YOU (NOT THE INITIAL DEVELOPER OR ANY OTHER CONTRIBUTOR) ASSUME THE COST OF ANY NECESSARY SERVICING, REPAIR OR CORRECTION. THIS DISCLAIMER OF WARRANTY CONSTITUTES AN ESSENTIAL PART OF THIS LICENSE. NO USE OF ANY COVERED CODE IS AUTHORIZED HEREUNDER EXCEPT UNDER THIS DISCLAIMER.
+8. TERMINATION. 
+8.1.  This License and the rights granted hereunder will terminate automatically if You fail to comply with terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses to the Covered Code which are properly granted shall survive any termination of this License. Provisions which, by their nature, must remain in effect beyond the termination of this License shall survive. 
+8.2.  If You initiate litigation by asserting a patent infringement claim (excluding declatory judgment actions) against Initial Developer or a Contributor (the Initial Developer or Contributor against whom You file such action is referred to as "Participant")  alleging that: 
+(a)  such Participant's Contributor Version directly or indirectly infringes any patent, then any and all rights granted by such Participant to You under Sections 2.1 and/or 2.2 of this License shall, upon 60 days notice from Participant terminate prospectively, unless if within 60 days after receipt of notice You either: (i)  agree in writing to pay Participant a mutually agreeable reasonable royalty for Your past and future use of Modifications made by such Participant, or (ii) withdraw Your litigation claim with respect to the Contributor Version against such Participant.  If within 60 days of notice, a reasonable royalty and payment arrangement are not mutually agreed upon in writing by the parties or the litigation claim is not withdrawn, the rights granted by Participant to You under Sections 2.1 and/or 2.2 automatically terminate at the expiration of the 60 day notice period specified above. 
+(b)  any software, hardware, or device, other than such Participant's Contributor Version, directly or indirectly infringes any patent, then any rights granted to You by such Participant under Sections 2.1(b) and 2.2(b) are revoked effective as of the date You first made, used, sold, distributed, or had made, Modifications made by that Participant. 
+8.3.  If You assert a patent infringement claim against Participant alleging that such Participant's Contributor Version directly or indirectly infringes any patent where such claim is resolved (such as by license or settlement) prior to the initiation of patent infringement litigation, then the reasonable value of the licenses granted by such Participant under Sections 2.1 or 2.2 shall be taken into account in determining the amount or value of any payment or license. 
+8.4.  In the event of termination under Sections 8.1 or 8.2 above,  all end user license agreements (excluding distributors and resellers) which have been validly granted by You or any distributor hereunder prior to termination shall survive termination.
+9. LIMITATION OF LIABILITY. 
+UNDER NO CIRCUMSTANCES AND UNDER NO LEGAL THEORY, WHETHER TORT (INCLUDING NEGLIGENCE), CONTRACT, OR OTHERWISE, SHALL YOU, THE INITIAL DEVELOPER, ANY OTHER CONTRIBUTOR, OR ANY DISTRIBUTOR OF COVERED CODE, OR ANY SUPPLIER OF ANY OF SUCH PARTIES, BE LIABLE TO ANY PERSON FOR ANY INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES OF ANY CHARACTER INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF GOODWILL, WORK STOPPAGE, COMPUTER FAILURE OR MALFUNCTION, OR ANY AND ALL OTHER COMMERCIAL DAMAGES OR LOSSES, EVEN IF SUCH PARTY SHALL HAVE BEEN INFORMED OF THE POSSIBILITY OF SUCH DAMAGES. THIS LIMITATION OF LIABILITY SHALL NOT APPLY TO LIABILITY FOR DEATH OR PERSONAL INJURY RESULTING FROM SUCH PARTY'S NEGLIGENCE TO THE EXTENT APPLICABLE LAW PROHIBITS SUCH LIMITATION. SOME JURISDICTIONS DO NOT ALLOW THE EXCLUSION OR LIMITATION OF INCIDENTAL OR CONSEQUENTIAL DAMAGES, SO THIS EXCLUSION AND LIMITATION MAY NOT APPLY TO YOU.
+10. U.S. GOVERNMENT END USERS. 
+The Covered Code is a ''commercial item,'' as that term is defined in 48 C.F.R. 2.101 (Oct. 1995), consisting of ''commercial computer software'' and ''commercial computer software documentation,'' as such terms are used in 48 C.F.R. 12.212 (Sept. 1995). Consistent with 48 C.F.R. 12.212 and 48 C.F.R. 227.7202-1 through 227.7202-4 (June 1995), all U.S. Government End Users acquire Covered Code with only those rights set forth herein.
+11. MISCELLANEOUS. 
+This License represents the complete agreement concerning subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. This License shall be governed by California law provisions (except to the extent applicable law, if any, provides otherwise), excluding its conflict-of-law provisions. With respect to disputes in which at least one party is a citizen of, or an entity chartered or registered to do business in the United States of America, any litigation relating to this License shall be subject to the jurisdiction of the Federal Courts of the Northern District of California, with venue lying in Santa Clara County, California, with the losing party responsible for costs, including without limitation, court costs and reasonable attorneys' fees and expenses. The application of the United Nations Convention on Contracts for the International Sale of Goods is expressly excluded. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not apply to this License.
+12. RESPONSIBILITY FOR CLAIMS. 
+As between Initial Developer and the Contributors, each party is responsible for claims and damages arising, directly or indirectly, out of its utilization of rights under this License and You agree to work with Initial Developer and Contributors to distribute such responsibility on an equitable basis. Nothing herein is intended or shall be deemed to constitute any admission of liability.
+13. MULTIPLE-LICENSED CODE. 
+Initial Developer may designate portions of the Covered Code as "Multiple-Licensed".  "Multiple-Licensed" means that the Initial Developer permits you to utilize portions of the Covered Code under Your choice of the NPL or the alternative licenses, if any, specified by the Initial Developer in the file described in Exhibit A.
+
+EXHIBIT A -Mozilla Public License. 
+``The contents of this file are subject to the Mozilla Public License Version 1.1 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at 
+http://www.mozilla.org/MPL/ 
+Software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTY OF 
+ANY KIND, either express or implied. See the License for the specific language governing rights and 
+limitations under the License. 
+The Original Code is ______________________________________. 
+The Initial Developer of the Original Code is ________________________. Portions created by 
+ ______________________ are Copyright (C) ______ _______________________. All Rights 
+Reserved. 
+Contributor(s): ______________________________________. 
+Alternatively, the contents of this file may be used under the terms of the _____ license (the  "[___] License"), in which case the provisions of [______] License are applicable  instead of those above.  If you wish to allow use of your version of this file only under the terms of the [____] License and not to allow others to use your version of this file under the MPL, indicate your decision by deleting  the provisions above and replace  them with the notice and other provisions required by the [___] License.  If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the [___] License." 
+[NOTE: The text of this Exhibit A may differ slightly from the text of the notices in the Source Code files of the Original Code. You should use the text of this Exhibit A rather than the text found in the Original Code Source Code for Your Modifications.] 
+
+%% This notice is provided with respect to Mesa 3-D graphics library v. 5, which may be included with this software: 
+
+Copyright (c) 2007 The Khronos Group Inc. 
+
+Permission is hereby granted, free of charge, to any person obtaining a 
+copy of this software and/or associated documentation files (the 
+"Materials"), to deal in the Materials without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and/or sell copies of the Materials, and to 
+permit persons to whom the Materials are furnished to do so, subject to 
+the following conditions: 
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Materials. 
+
+THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 
+CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 
+TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 
+MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. 
+
+%% This notice is provided with respect to Byte Code Engineering Library (BCEL), which may be included with this software: 
+
+                     Apache Software License 
+
+                     /*
+====================================================================                      * The Apache Software License, Version 1.1
+                      *
+                      * Copyright (c) 2001 The Apache Software Foundation.  Allrights
+                      * reserved.
+                      *
+                      * Redistribution and use in source and binary forms, withor without
+                      * modification, are permitted provided that the followingconditions
+                      * are met:
+                      *
+                      * 1. Redistributions of source code must retain the abovecopyright
+                      *    notice, this list of conditions and the followingdisclaimer.
+                      *
+                      * 2. Redistributions in binary form must reproduce theabove copyright
+                      *    notice, this list of conditions and the followingdisclaimer in
+                      *    the documentation and/or other materials providedwith the
+                      *    distribution.
+                      *
+                      * 3. The end-user documentation included with theredistribution,
+                      *    if any, must include the following acknowledgment:                      *       "This product includes software developed by the                      *        Apache Software Foundation
+(http://www.apache.org/)."
+                      *    Alternately, this acknowledgment may appear in thesoftware itself,
+                      *    if and wherever such third-party acknowledgmentsnormally appear.
+                      *
+                      * 4. The names "Apache" and "Apache Software Foundation"and 
+                      *    "Apache BCEL" must not be used to endorse or promoteproducts 
+                      *    derived from this software without prior writtenpermission. For 
+                      *    written permission, please contact apache@apache.org.                      *
+                      * 5. Products derived from this software may not be called"Apache",
+                      *    "Apache BCEL", nor may "Apache" appear in their name,without 
+                      *    prior written permission of the Apache SoftwareFoundation.
+                      *
+                      * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED ORIMPLIED
+                      * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES
+                      * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSEARE
+                      * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWAREFOUNDATION OR
+                      * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,INCIDENTAL,
+                      * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,BUT NOT
+                      * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF
+                      * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVERCAUSED AND
+                      * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY,
+                      * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING INANY WAY OUT
+                      * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
+                      * SUCH DAMAGE.
+                      *
+====================================================================                      *
+                      * This software consists of voluntary contributions madeby many
+                      * individuals on behalf of the Apache Software
+Foundation.  For more
+                      * information on the Apache Software Foundation, pleasesee
+                      * .
+                      */
+
+%% This notice is provided with respect to Regexp, Regular Expression Package, which may be included with this software: 
+
+The Apache Software License, Version 1.1
+Copyright (c) 2001 The Apache Software Foundation.  All rights
+reserved.
+Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:
+
+1. Redistributions of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions in binary form must reproduce the above copyright
+notice, this list of conditions and the following disclaimer in
+the documentation and/or other materials provided with the
+distribution.
+
+3. The end-user documentation included with the redistribution,
+if any, must include the following acknowledgment:
+"This product includes software developed by the
+Apache Software Foundation (http://www.apache.org/)."
+Alternately, this acknowledgment may appear in the software itself,
+if and wherever such third-party acknowledgments normally appear.
+
+4. The names "Apache" and "Apache Software Foundation" and 
+"Apache Turbine" must not be used to endorse or promote products 
+derived from this software without prior written permission. For 
+written permission, please contact apache@apache.org.
+
+5. Products derived from this software may not be called "Apache",
+"Apache Turbine", nor may "Apache" appear in their name, without 
+prior written permission of the Apache Software Foundation.
+
+THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
+WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
+ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
+USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
+OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+                                                             
+====================================================================
+This software consists of voluntary contributions made by many
+individuals on behalf of the Apache Software Foundation.  For more
+information on the Apache Software Foundation, please see
+                                                             
+http://www.apache.org.
+
+%% This notice is provided with respect to CUP Parser Generator for Java, which may be included with this software: 
+
+CUP Parser Generator Copyright Notice, License, and Disclaimer
+
+Copyright 1996-1999 by Scott Hudson, Frank Flannery, C. Scott Ananian 
+Permission to use, copy, modify, and distribute this software and its
+documentation for any purpose and without fee is hereby granted, provided thatthe above copyright notice appear in all copies and that both the copyrightnotice and this permission notice and warranty disclaimer appear in
+supporting documentation, and that the names of the authors or their employersnot be used in advertising or publicity pertaining to distribution of
+the software without specific, written prior permission. 
+
+The authors and their employers disclaim all warranties with regard to thissoftware, including all implied warranties of merchantability and
+fitness. In no event shall the authors or their employers be liable for anyspecial, indirect or consequential damages or any damages whatsoever
+resulting from loss of use, data or profits, whether in an action of contract,negligence or other tortious action, arising out of or in connection withthe use or performance of this software. 
+
+%% This notice is provided with respect to SAX v. 2.0.1, which may be included with this software: 
+
+Copyright Status
+
+                         SAX is free!
+
+                         In fact, it's not possible to own a license to SAX, since it's been placed in the public
+                         domain. 
+
+                         No Warranty
+
+                         Because SAX is released to the public domain, there is no warranty for the design or for
+                         the software implementation, to the extent permitted by applicable law. Except when
+                         otherwise stated in writing the copyright holders and/or other parties provide SAX "as is"
+                         without warranty of any kind, either expressed or implied, including, but not limited to, the
+                         implied warranties of merchantability and fitness for a particular purpose. The entire risk as
+                         to the quality and performance of SAX is with you. Should SAX prove defective, you
+                         assume the cost of all necessary servicing, repair or correction.
+
+                         In no event unless required by applicable law or agreed to in writing will any copyright
+                         holder, or any other party who may modify and/or redistribute SAX, be liable to you for
+                         damages, including any general, special, incidental or consequential damages arising out of
+                         the use or inability to use SAX (including but not limited to loss of data or data being
+                         rendered inaccurate or losses sustained by you or third parties or a failure of the SAX to
+                         operate with any other programs), even if such holder or other party has been advised of
+                         the possibility of such damages.
+
+                         Copyright Disclaimers 
+
+                         This page includes statements to that effect by David Megginson, who would have been
+                         able to claim copyright for the original work. 
+                         SAX 1.0 
+
+                         Version 1.0 of the Simple API for XML (SAX), created collectively by the membership of
+                         the XML-DEV mailing list, is hereby released into the public domain.
+
+                         No one owns SAX: you may use it freely in both commercial and non-commercial
+                         applications, bundle it with your software distribution, include it on a CD-ROM, list the
+                         source code in a book, mirror the documentation at your own web site, or use it in any
+                         other way you see fit.
+
+                         David Megginson, sax@megginson.com
+                         1998-05-11
+
+                         SAX 2.0 
+
+                         I hereby abandon any property rights to SAX 2.0 (the Simple API for XML), and release
+                         all of the SAX 2.0 source code, compiled code, and documentation contained in this
+                         distribution into the Public Domain. SAX comes with NO WARRANTY or guarantee of
+                         fitness for any purpose.
+
+                         David Megginson, david@megginson.com
+                         2000-05-05
+
+%% This notice is provided with respect to Cryptix, which may be included with this software: 
+
+Cryptix General License
+
+Copyright © 1995-2003 The Cryptix Foundation Limited. All rights reserved.
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions aremet:
+
+   1.Redistributions of source code must retain the copyright notice, this list of conditions and the following disclaimer.    2.Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the     documentation and/or other materials provided with the distribution. 
+THIS SOFTWARE IS PROVIDED BY THE CRYPTIX FOUNDATION LIMITED AND CONTRIBUTORS ``AS IS'' AND ANY EXPRESS ORIMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FORA PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE CRYPTIX FOUNDATION LIMITED OR CONTRIBUTORS BELIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOTLIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESSINTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OFTHE POSSIBILITY OF SUCH DAMAGE.
+
+%% This notice is provided with respect to X Window System, which may be included with this software: 
+
+Copyright  The Open Group
+
+Permission to use, copy, modify, distribute, and sell this software and itsdocumentation for any purpose is hereby granted without fee, provided that theabove copyright notice appear in all copies and that both that copyright noticeand this permission notice appear in supporting documentation.
+
+The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE OPEN GROUPBE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OFCONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THESOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group.
+
+Portions also covered by other licenses as noted in the above URL.
+
+%% This notice is provided with respect to Retroweaver, which may be included with this software: 
+
+Copyright (c) February 2004, Toby Reyelts
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
+
+Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 
+Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 
+Neither the name of Toby Reyelts nor the names of his contributors may be used to endorse or promote products derived from this software without specific prior written permission. 
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY, 
+OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+%% This notice is provided with respect to stripper, which may be included with this software: 
+
+Stripper : debug information stripper
+ Copyright (c) 2003 Kohsuke Kawaguchi
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions
+ are met:
+ 1. Redistributions of source code must retain the above copyright
+    notice, this list of conditions and the following disclaimer.
+ 2. Redistributions in binary form must reproduce the above copyright
+    notice, this list of conditions and the following disclaimer in the    documentation and/or other materials provided with the distribution. 3. Neither the name of the copyright holders nor the names of its
+    contributors may be used to endorse or promote products derived from    this software without specific prior written permission.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+%% This notice is provided with respect to libpng official PNG reference library, which may be included with this software: 
+
+This copy of the libpng notices is provided for your convenience.  In case ofany discrepancy between this copy and the notices in the file png.h that isincluded in the libpng distribution, the latter shall prevail.
+
+COPYRIGHT NOTICE, DISCLAIMER, and LICENSE:
+
+If you modify libpng you may insert additional notices immediately followingthis sentence.
+
+libpng version 1.2.6, December 3, 2004, is
+Copyright (c) 2004 Glenn Randers-Pehrson, and is
+distributed according to the same disclaimer and license as libpng-1.2.5with the following individual added to the list of Contributing Authors
+   Cosmin Truta
+
+libpng versions 1.0.7, July 1, 2000, through 1.2.5 - October 3, 2002, areCopyright (c) 2000-2002 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-1.0.6with the following individuals added to the list of Contributing Authors
+   Simon-Pierre Cadieux
+   Eric S. Raymond
+   Gilles Vollant
+
+and with the following additions to the disclaimer:
+
+   There is no warranty against interference with your enjoyment of the   library or against infringement.  There is no warranty that our
+   efforts or the library will fulfill any of your particular purposes   or needs.  This library is provided with all faults, and the entire   risk of satisfactory quality, performance, accuracy, and effort is with   the user.
+
+libpng versions 0.97, January 1998, through 1.0.6, March 20, 2000, areCopyright (c) 1998, 1999 Glenn Randers-Pehrson, and are
+distributed according to the same disclaimer and license as libpng-0.96,with the following individuals added to the list of Contributing Authors:
+   Tom Lane
+   Glenn Randers-Pehrson
+   Willem van Schaik
+
+libpng versions 0.89, June 1996, through 0.96, May 1997, are
+Copyright (c) 1996, 1997 Andreas Dilger
+Distributed according to the same disclaimer and license as libpng-0.88,with the following individuals added to the list of Contributing Authors:
+   John Bowler
+   Kevin Bracey
+   Sam Bushell
+   Magnus Holmgren
+   Greg Roelofs
+   Tom Tanner
+
+libpng versions 0.5, May 1995, through 0.88, January 1996, are
+Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.
+
+For the purposes of this copyright and license, "Contributing Authors"is defined as the following set of individuals:
+
+   Andreas Dilger
+   Dave Martindale
+   Guy Eric Schalnat
+   Paul Schmidt
+   Tim Wegner
+
+The PNG Reference Library is supplied "AS IS".  The Contributing Authorsand Group 42, Inc. disclaim all warranties, expressed or implied,
+including, without limitation, the warranties of merchantability and offitness for any purpose.  The Contributing Authors and Group 42, Inc.
+assume no liability for direct, indirect, incidental, special, exemplary,or consequential damages, which may result from the use of the PNG
+Reference Library, even if advised of the possibility of such damage.
+
+Permission is hereby granted to use, copy, modify, and distribute thissource code, or portions hereof, for any purpose, without fee, subjectto the following restrictions:
+
+1. The origin of this source code must not be misrepresented.
+
+2. Altered versions must be plainly marked as such and must not
+   be misrepresented as being the original source.
+
+3. This Copyright notice may not be removed or altered from any
+   source or altered source distribution.
+
+The Contributing Authors and Group 42, Inc. specifically permit, withoutfee, and encourage the use of this source code as a component to
+supporting the PNG file format in commercial products.  If you use thissource code in a product, acknowledgment is not required but would be
+appreciated.
+
+
+A "png_get_copyright" function is available, for convenient use in "about"boxes and the like:
+
+   printf("%s",png_get_copyright(NULL));
+
+Also, the PNG logo (in PNG format, of course) is supplied in the
+files "pngbar.png" and "pngbar.jpg (88x31) and "pngnow.png" (98x31).
+
+Libpng is OSI Certified Open Source Software.  OSI Certified Open Source is acertification mark of the Open Source Initiative.
+
+Glenn Randers-Pehrson
+glennrp at users.sourceforge.net
+December 3, 2004
+
+%% This notice is provided with respect to Libungif - An uncompressed GIF library, which may be included with this software: 
+
+The GIFLIB distribution is Copyright (c) 1997  Eric S. Raymond
+
+Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS INTHE SOFTWARE.
+
+%% This notice is provided with respect to XML Resolver library, Xalan J2, and StAX API, which may be included with this software: 
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,      and distribution as defined by Sections 1 through 9 of this document.
+      "Licensor" shall mean the copyright owner or entity authorized by      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all      other entities that control, are controlled by, or are under common      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the      outstanding shares, or (iii) beneficial ownership of such entity.
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,      including but not limited to software source code, documentation      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object      form, that is based on (or derived from) the Work and for which the      editorial revisions, annotations, elaborations, or other modifications      represent, as a whole, an original work of authorship. For the purposes      of this License, Derivative Works shall not include works that remain      separable from, or merely link (or bind by name) to the interfaces of,      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner      or by an individual or Legal Entity authorized to submit on behalf of      the copyright owner. For the purposes of this definition, "submitted"      means any form of electronic, verbal, or written communication sent      to the Licensor or its representatives, including but not limited to      communication on electronic mailing lists, source code control systems,      and issue tracking systems that are managed by, or on behalf of, the      Licensor for the purpose of discussing and improving the Work, but      excluding communication that is conspicuously marked or otherwise      designated in writing by the copyright owner as "Not a Contribution."
+      "Contributor" shall mean Licensor and any individual or Legal Entity      on behalf of whom a Contribution has been received by Licensor and      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of      this License, each Contributor hereby grants to You a perpetual,      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,      use, offer to sell, sell, import, and otherwise transfer the Work,      where such license applies only to those patent claims licensable      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)      with the Work to which such Contribution(s) was submitted. If You      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work      or a Contribution incorporated within the Work constitutes direct      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must          include a readable copy of the attribution notices contained          within such NOTICE file, excluding those notices that do not          pertain to any part of the Derivative Works, in at least one          of the following places: within a NOTICE text file distributed          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside          or as an addendum to the NOTICE text from the Work, provided          that such additional attribution notices cannot be construed          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and      may provide additional or different license terms and conditions      for use, reproduction, or distribution of Your modifications, or      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,      any Contribution intentionally submitted for inclusion in the Work      by You to the Licensor shall be under the terms and conditions of      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify      the terms of any separate license agreement you may have executed      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade      names, trademarks, service marks, or product names of the Licensor,      except as required for reasonable and customary use in describing the      origin of the Work and reproducing the content of the NOTICE file.
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the      appropriateness of using or redistributing the Work and assume any      risks associated with Your exercise of permissions under this License.
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly      negligent acts) or agreed to in writing, shall any Contributor be      liable to You for damages, including any direct, indirect, special,      incidental, or consequential damages of any character arising as a      result of this License or out of the use or inability to use the      Work (including but not limited to damages for loss of goodwill,      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,      or other liability obligations and/or rights consistent with this      License. However, in accepting such obligations, You may act only      on Your own behalf and on Your sole responsibility, not on behalf      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed under the Apache License, Version 2.0 (the "License");
+   you may not use this file except in compliance with the License.
+   You may obtain a copy of the License at
+
+       http://www.apache.org/licenses/LICENSE-2.0
+
+   Unless required by applicable law or agreed to in writing, software   distributed under the License is distributed on an "AS IS" BASIS,
+   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.   See the License for the specific language governing permissions and   limitations under the License.
+
+%% Some Portions licensed from IBM are available at: 
+http://www.ibm.com/software/globalization/icu/
+
+%% This notice is provided with respect to ICU4J, ICU 1.8.1 and later, which may be included with this software: 
+
+ICU License - ICU 1.8.1 and later COPYRIGHT AND PERMISSION NOTICE Cop
+yright (c)
+1995-2003 International Business Machines Corporation and others All rightsreserved. Permission is hereby granted, free of charge, to any person obtaininga copy of this software and associated documentation files (the "Software"), todeal in the Software without restriction, including without limitation therights to use, copy, modify, merge, publish, distribute, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,provided that the above copyright notice(s) and this permission notice appear inall copies of the Software and that both the above copyright notice(s) and thispermission notice appear in supporting documentation. THE SOFTWARE IS PROVIDED"AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOTLIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSEAND NONINFRINGEMENT OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHTHOLDER OR HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY C
+ LAIM, OR ANYSPECIAL INDIRECT OR CONSEQUENTIAL DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTINGFROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCEOR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE ORPERFORMANCE OF THIS SOFTWARE. Except as contained in this notice, the name of acopyright holder shall not be used in advertising or otherwise to promote thesale, use or other dealings in this Software without prior written authorizationof the copyright holder.
+
+%% This notice is provided with respect to Jing, which may be included with this software: 
+
+Jing Copying Conditions
+
+Copyright (c) 2001-2003 Thai Open Source Software Center Ltd
+All rights reserved.
+
+Redistribution and use in source and binary forms, with or without modification,are permitted provided that the following conditions are met:
+
+    * Redistributions of source code must retain the above copyright notice,this list of conditions and the following disclaimer.
+    * Redistributions in binary form must reproduce the above copyright notice,this list of conditions and the following disclaimer in the documentation and/orother materials provided with the distribution.
+    * Neither the name of the Thai Open Source Software Center Ltd nor the namesof its contributors may be used to endorse or promote products derived from thissoftware without specific prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" ANDANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIEDWARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE AREDISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE FOR ANYDIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ONANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THISSOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+%% This notice is provided with respect to RELAX NG Object Model/Parser, which may be included with this software: 
+
+
+The MIT License
+
+Copyright (c)  
+
+Permission is hereby granted, free of charge, to any person obtaining a copy ofthis software and associated documentation files (the "Software"), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicense, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESSFOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS ORCOPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHERIN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR INCONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+%% This notice is provided with respect to XFree86-VidMode Extension, which may be included with this software: 
+
+Version 1.1 of XFree86 ProjectLicence.
+
+    Copyright (C) 1994-2004 The XFree86 Project, Inc.    All rights reserved.
+
+    Permission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to deal inthe Software without restriction, including without limitation the rights touse, copy, modify, merge, publish, distribute, sublicence, and/or sell copies ofthe Software, and to permit persons to whom the Software is furnished to do so,subject to the following conditions:
+
+       1. Redistributions of source code must retain the above copyright notice,this list of conditions, and the following disclaimer.
+       2. Redistributions in binary form must reproduce the above copyrightnotice, this list of conditions and the following disclaimer in the
+documentation and/or other materials provided with the distribution, and in thesame place and form as other copyright, license and disclaimer information.       3. The end-user documentation included with the redistribution, if any,must include the following acknowledgment: "This product includes softwaredeveloped by The XFree86 Project, Inc (http://www.xfree86.org/) and itscontributors", in the same place and form as other third-party acknowledgments.Alternately, this acknowledgment may appear in the software itself, in the sameform and location as other such third-party acknowledgments.
+       4. Except as contained in this notice, the name of The XFree86 Project,Inc shall not be used in advertising or otherwise to promote the sale, use orother dealings in this Software without prior written authorization from TheXFree86 Project, Inc.
+
+    THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY ANDFITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE XFREE86PROJECT, INC OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; ORBUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER INCONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISINGIN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITYOF SUCH DAMAGE.
+
+%% This notice is provided with respect to XML Security, which may be included with this software: 
+
+  The Apache Software License,
+                                       Version 1.1
+
+
+                                                                                 PDF
+
+
+                                       Copyright (C) 2002 The Apache SoftwareFoundation.
+                                       All rights reserved. Redistribution anduse in
+                                       source and binary forms, with or withoutmodifica-
+                                       tion, are permitted provided that thefollowing
+                                       conditions are met: 1. Redistributions ofsource
+                                       code must retain the above copyrightnotice, this
+                                       list of conditions and the followingdisclaimer.
+                                       2. Redistributions in binary form mustreproduce
+                                       the above copyright notice, this list of                                       conditions and the following disclaimerin the
+                                       documentation and/or other materialsprovided with
+                                       the distribution. 3. The end-userdocumentation
+                                       included with the redistribution, if any,must
+                                       include the following acknowledgment:"This
+                                       product includes software developed bythe Apache
+                                       Software Foundation
+(http://www.apache.org/)."
+                                       Alternately, this acknowledgment mayappear in the
+                                       software itself, if and wherever suchthird-party
+                                       acknowledgments normally appear. 4. Thenames
+                                       "Apache Forrest" and "Apache SoftwareFoundation"
+                                       must not be used to endorse or promoteproducts
+                                       derived from this software without priorwritten
+                                       permission. For written permission,please contact
+                                       apache@apache.org. 5. Products derivedfrom this
+                                       software may not be called "Apache", normay
+                                       "Apache" appear in their name, withoutprior
+                                       written permission of the Apache Software                                       Foundation. THIS SOFTWARE IS PROVIDED``AS IS''
+                                       AND ANY EXPRESSED OR IMPLIED WARRANTIES,                                       INCLUDING, BUT NOT LIMITED TO, THEIMPLIED
+                                       WARRANTIES OF MERCHANTABILITY AND FITNESSFOR A
+                                       PARTICULAR PURPOSE ARE DISCLAIMED. IN NOEVENT
+                                       SHALL THE APACHE SOFTWARE FOUNDATION ORITS
+                                       CONTRIBUTORS BE LIABLE FOR ANY DIRECT,INDIRECT,
+                                       INCIDENTAL, SPECIAL, EXEMPLARY, ORCONSEQUENTIAL
+                                       DAMAGES (INCLU- DING, BUT NOT LIMITED TO,                                       PROCUREMENT OF SUBSTITUTE GOODS ORSERVICES; LOSS
+                                       OF USE, DATA, OR PROFITS; OR BUSINESS                                       INTERRUPTION) HOWEVER CAUSED AND ON ANYTHEORY OF
+                                       LIABILITY, WHETHER IN CONTRACT, STRICTLIABILITY,
+                                       OR TORT (INCLUDING NEGLIGENCE OROTHERWISE)
+                                       ARISING IN ANY WAY OUT OF THE USE OF THIS                                       SOFTWARE, EVEN IF ADVISED OF THEPOSSIBILITY OF
+                                       SUCH DAMAGE. This software consists ofvoluntary
+                                       contributions made by many individuals onbehalf
+                                       of the Apache Software Foundation. Formore
+                                       information on the Apache SoftwareFoundation,
+                                       please see .
+
+%% This notice is provided with respect to Independent JPEG Group's software (libjpeg), which may be included with this software: 
+
+In plain English:
+
+1. We don't promise that this software works.  (But if you find any bugs,
+   please let us know!)
+2. You can use this software for whatever you want.  You don't have to pay us.
+3. You may not pretend that you wrote this software.  If you use it in a program, you must acknowledge somewhere in your documentation that you've used the IJG code.
+
+In legalese:
+
+The authors make NO WARRANTY or representation, either express or implied, with respect to this software, its quality, accuracy, merchantability, or fitness for a particular purpose.  This software is provided "AS IS", and you, its user, assume the entire risk as to its quality and accuracy.
+
+This software is copyright (C) 1991-1998, Thomas G. Lane.
+All Rights Reserved except as specified below.
+
+Permission is hereby granted to use, copy, modify, and distribute this software (or portions thereof) for any purpose, without fee, subject to these conditions:
+
+(1) If any part of the source code for this software is distributed, then this
+README file must be included, with this copyright and no-warranty notice unaltered; and any additions, deletions, or changes to the original files must be clearly indicated in accompanying documentation.
+
+(2) If only executable code is distributed, then the accompanying documentation must state that "this software is based in part on the work of the Independent JPEG Group".
+
+(3) Permission for use of this software is granted only if the user accepts full responsibility for any undesirable consequences; the authors accept NO LIABILITY for damages of any kind.
+
+These conditions apply to any software derived from or based on the IJG code, not just to the unmodified library.  If you use our work, you ought to acknowledge us.
+
+Permission is NOT granted for the use of any IJG author's name or company name in advertising or publicity relating to this software or products derived from it.  This software may be referred to only as "the Independent JPEG Group's software".
+
+We specifically permit and encourage the use of this software as the basis of commercial products, provided that all warranty or liability claims are assumed by the product vendor.
+
+ansi2knr.c is included in this distribution by permission of L. Peter Deutsch, sole proprietor of its copyright holder, Aladdin Enterprises of Menlo Park, CA. ansi2knr.c is NOT covered by the above copyright and conditions, but instead by the usual distribution terms of the Free Software Foundation; principally, that you must include source code if you redistribute it.  (See the file ansi2knr.c for full details.)  However, since ansi2knr.c is not needed as part of any program generated from the IJG code, this does not limit you more than the foregoing paragraphs do.
+
+The Unix configuration script "configure" was produced with GNU Autoconf. It is copyright by the Free Software Foundation but is freely distributable. The same holds for its supporting scripts (config.guess, config.sub, ltconfig, ltmain.sh).  Another support script, install-sh, is copyright by M.I.T. but is also freely distributable.
+
+It appears that the arithmetic coding option of the JPEG spec is covered by patents owned by IBM, AT&T, and Mitsubishi.  Hence arithmetic coding cannot legally be used without obtaining one or more licenses.  For this reason, support for arithmetic coding has been removed from the free JPEG software. (Since arithmetic coding provides only a marginal gain over the unpatented Huffman mode, it is unlikely that very many implementations will support it.) So far as we are aware, there are no patent restrictions on the remaining code.
+
+The IJG distribution formerly included code to read and write GIF files. To avoid entanglement with the Unisys LZW patent, GIF reading support has been removed altogether, and the GIF writer has been simplified to produce "uncompressed GIFs".  This technique does not use the LZW algorithm; the resulting GIF files are larger than usual, but are readable by all standard GIF decoders.
+
+We are required to state that
+    "The Graphics Interchange Format(c) is the Copyright property of
+    CompuServe Incorporated.  GIF(sm) is a Service Mark property of
+    CompuServe Incorporated."
+
+%% This notice is provided with respect to X Resize and Rotate (Xrandr) Extension, which may be included with this software: 
+2. XFree86 License
+
+XFree86 code without an explicit copyright is covered by the following
+copyright/license:
+
+Copyright (C) 1994-2003 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated documentation files (the "Software"), to deal in
+the Software without restriction, including without limitation the rights to
+use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
+the Software, and to permit persons to whom the Software is furnished to do so,
+subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86
+PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
+ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not be
+used in advertising or otherwise to promote the sale, use or other dealings in
+this Software without prior written authorization from the XFree86 Project.
+
+%% This notice is provided with respect to fontconfig, which may be included with this software: 
+Id: COPYING,v 1.3 2003/04/04 20:17:40 keithp Exp $
+Copyright 2001,2003 Keith Packard
+
+Permission to use, copy, modify, distribute, and sell this software and its
+documentation for any purpose is hereby granted without fee, provided that
+the above copyright notice appear in all copies and that both that
+copyright notice and this permission notice appear in supporting
+documentation, and that the name of Keith Packard not be used in
+advertising or publicity pertaining to distribution of the software without
+specific, written prior permission.  Keith Packard makes no
+representations about the suitability of this software for any purpose.  It
+is provided "as is" without express or implied warranty.
+
+KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
+INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
+EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
+CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
+DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
+TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
+PERFORMANCE OF THIS SOFTWARE.
+%% This notice is provided with respect to XFree86, which may be included with this software: 
+Copyright (C) 1994-2002 The XFree86 Project, Inc. All Rights Reserved.
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of
+this software and associated
+documentation files (the "Software"), to deal in the Software without
+restriction, including without limitation
+the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
+sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to the
+following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the
+Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT
+NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
+PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM,
+DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+
+Except as contained in this notice, the name of the XFree86 Project shall not be
+used in advertising or otherwise
+to promote the sale, use or other dealings in this Software without prior
+written authorization from the XFree86
+Project.
+%% This notice is provided with respect to Fast Infoset, which may be included with this software: 
+* Fast Infoset ver. 0.1 software ("Software") 
+* 
+* Copyright, 2004-2005 Sun Microsystems, Inc. All Rights Reserved. 
+* 
+* Software is licensed under the Apache License, Version 2.0 (the "License"); 
+* you may not use this file except in compliance with the License. You may 
+* obtain a copy of the License at: 
+ * 
+ * http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT 
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the 
+* License for the specific language governing permissions and limitations. 
+* 
+* Sun supports and benefits from the global community of open source 
+* developers, and thanks the community for its important contributions and 
+* open standards-based technology, which Sun has adopted into many of its 
+* products. 
+* 
+* Please note that portions of Software may be provided with notices and 
+* open source licenses from such communities and third parties that govern the 
+* use of those portions, and any licenses granted hereunder do not alter any 
+* rights and obligations you may have under such open source licenses, 
+* however, the disclaimer of warranty and limitation of liability provisions 
+* in this License will apply to all Software in this distribution. 
+* 
+* You acknowledge that the Software is not designed, licensed or intended 
+* for use in the design, construction, operation or maintenance of any nuclear 
+* facility. 
+* 
+* Apache License 
+* Version 2.0, January 2004 
+* http://www.apache.org/licenses/ 
+* 
+*/ 
+/* 
+* ==================================================================== 
+* 
+* This code is subject to the freebxml License, Version 1.1 
+* 
+* Copyright (c) 2001 - 2005 freebxml.org. All rights reserved. 
+* 
+* $Header: /cvs/fi/FastInfoset/src/com/sun/xml/internal/fastinfoset/AbstractResourceBundle.java,v 1.2 
+*  ==================================================================== 
+*/ 
+%% This notice is provided with respect to Kerberos, which may be included with this software: 
+
+/* 
+ * Copyright (C) 1998 by the FundsXpress, INC. 
+ * 
+ * All rights reserved. 
+ * 
+ * Export of this software from the United States of America may require 
+ * a specific license from the United States Government.  It is the 
+ * responsibility of any person or organization contemplating export to 
+ * obtain such a license before exporting. 
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 
+ * distribute this software and its documentation for any purpose and 
+ * without fee is hereby granted, provided that the above copyright 
+ * notice appear in all copies and that both that copyright notice and 
+ * this permission notice appear in supporting documentation, and that 
+ * the name of FundsXpress. not be used in advertising or publicity pertaining 
+ * to distribution of the software without specific, written prior 
+ * permission. FundsXpress makes no representations about the suitability of 
+ * this software for any purpose. It is provided "as is" without express 
+ * or implied warranty. 
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 
+ */ 
+
+%% This notice is provided with respect to Unicode's CLDR data repository, which may be included with this software: 
+
+ Unicode Copyright
+
+    For the general privacy policy governing access to this site, see the 
+Unicode Privacy Policy. For trademark usage, see the the Unicode Consortium
+Trademarks and Logo Policy.
+    Notice to End User: Terms of Use
+    Carefully read the following legal agreement ("Agreement"). Use or copying
+of the software and/or codes provided with this agreement (The "Software")
+constitutes your acceptance of these terms
+
+       1. Unicode Copyright.
+             1. Copyright © 1991-2005 Unicode, Inc. All rights reserved.
+             2. Certain documents and files on this website contain a legend
+indicating that "Modification is permitted." Any person is hereby authorized,
+without fee, to modify such documents and files to create derivative works
+conforming to the Unicode® Standard, subject to Terms and Conditions herein.
+             3. Any person is hereby authorized, without fee, to view, use,
+reproduce, and distribute all documents and files solely for informational
+purposes in the creation of products supporting the Unicode Standard, subject to
+the Terms and Conditions herein.
+             4. Further specifications of rights and restrictions pertaining to
+the use of the particular set of data files known as the "Unicode Character
+Database" can be found in Exhibit 1.
+             5. Further specifications of rights and restrictions pertaining to
+the use of the particular set of files that constitute the online edition of The
+Unicode Standard, Version 4.0, may be found in V4.0 online edition.
+             6. No license is granted to "mirror" the Unicode website where a
+fee is charged for access to the "mirror" site.
+             7. Modification is not permitted with respect to this document. All
+copies of this document must be verbatim.
+       2. Restricted Rights Legend. Any technical data or software which is
+licensed to the United States of America, its agencies and/or instrumentalities
+under this Agreement is commercial technical data or commercial computer
+software developed exclusively at private expense as defined in FAR 2.101, or
+DFARS 252.227-7014 (June 1995), as applicable. For technical data, use,
+duplication, or disclosure by the Government is subject to restrictions as set
+forth in DFARS 202.227-7015 Technical Data, Commercial and Items (Nov 1995) and
+this Agreement. For Software, in accordance with FAR 12-212 or DFARS 227-7202,
+as applicable, use, duplication or disclosure by the Government is subject to
+the restrictions set forth in this Agreement.
+       3. Warranties and Disclaimers.
+             1. This publication and/or website may include technical or
+typographical errors or other inaccuracies . Changes are periodically added to
+the information herein; these changes will be incorporated in new editions of
+the publication and/or website. Unicode may make improvements and/or changes in
+the product(s) and/or program(s) described in this publication and/or website at
+any time.
+             2. If this file has been purchased on magnetic or optical media
+from Unicode, Inc. the sole and exclusive remedy for any claim will be exchange
+of the defective media within ninety (90) days of original purchase.
+             3. EXCEPT AS PROVIDED IN SECTION C.2, THIS PUBLICATION AND/OR
+SOFTWARE IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND EITHER EXPRESS,
+IMPLIED, OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, ANY WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, OR NON-INFRINGEMENT. UNICODE
+AND ITS LICENSORS ASSUME NO RESPONSIBILITY FOR ERRORS OR OMISSIONS IN THIS
+PUBLICATION AND/OR SOFTWARE OR OTHER DOCUMENTS WHICH ARE REFERENCED BY OR LINKED
+TO THIS PUBLICATION OR THE UNICODE WEBSITE.
+       4. Waiver of Damages. In no event shall Unicode or its licensors be
+liable for any special, incidental, indirect or consequential damages of any
+kind, or any damages whatsoever, whether or not Unicode was advised of the
+possibility of the damage, including, without limitation, those resulting from
+the following: loss of use, data or profits, in connection with the use,
+modification or distribution of this information or its derivatives.
+       5. Trademarks.
+             1. Unicode and the Unicode logo are registered trademarks of
+Unicode, Inc. 
+             2. This site contains product names and corporate names of other
+companies. All product names and company names and logos mentioned herein are
+the trademarks or registered trademarks of their respective owners. Other
+products and corporate names mentioned herein which are trademarks of a third
+party are used only for explanation and for the owners' benefit and with no
+intent to infringe.
+             3. Use of third party products or information referred to herein is
+at the user's risk.
+       6. Miscellaneous.
+             1. Jurisdiction and Venue. This server is operated from a location
+in the State of California, United States of America. Unicode makes no
+representation that the materials are appropriate for use in other locations. If
+you access this server from other locations, you are responsible for compliance
+with local laws. This Agreement, all use of this site and any claims and damages
+resulting from use of this site are governed solely by the laws of the State of
+California without regard to any principles which would apply the laws of a
+different jurisdiction. The user agrees that any disputes regarding this site
+shall be resolved solely in the courts located in Santa Clara County,
+California. The user agrees said courts have personal jurisdiction and agree to
+waive any right to transfer the dispute to any other forum.
+             2. Modification by Unicode Unicode shall have the right to modify
+this Agreement at any time by posting it to this site. The user may not assign
+any part of this Agreement without Unicode's prior written consent.
+             3. Taxes. The user agrees to pay any taxes arising from access to
+this website or use of the information herein, except for those based on
+Unicode's net income.
+             4. Severability.  If any provision of this Agreement is declared
+invalid or unenforceable, the remaining provisions of this Agreement shall
+remain in effect.
+             5. Entire Agreement. This Agreement constitutes the entire
+agreement between the parties. 
+
+EXHIBIT 1
+UNICODE, INC. LICENSE AGREEMENT - DATA FILES AND SOFTWARE
+
+    Unicode Data Files include all data files under the directories
+http://www.unicode.org/Public/ and http://www.unicode.org/reports/. Unicode
+Software includes any source code under the directories
+http://www.unicode.org/Public/ and http://www.unicode.org/reports/.
+
+    NOTICE TO USER: Carefully read the following legal agreement. BY
+DOWNLOADING, INSTALLING, COPYING OR OTHERWISE USING UNICODE INC.'S DATA FILES
+("DATA FILES"), AND/OR SOFTWARE ("SOFTWARE"), YOU UNEQUIVOCALLY ACCEPT, AND
+AGREE TO BE BOUND BY, ALL OF THE TERMS AND CONDITIONS OF THIS AGREEMENT. IF YOU
+DO NOT AGREE, DO NOT DOWNLOAD, INSTALL, COPY, DISTRIBUTE OR USE THE DATA FILES
+OR SOFTWARE.
+
+    COPYRIGHT AND PERMISSION NOTICE
+
+    Copyright Ã?Â,Ã,© 1991-2004 Unicode, Inc. All rights reserved. Distributed under
+the Terms of Use in http://www.unicode.org/copyright.html.
+
+    Permission is hereby granted, free of charge, to any person obtaining a copy
+of the Unicode data files and associated documentation (the "Data Files") or
+Unicode software and associated documentation (the "Software") to deal in the
+Data Files or Software without restriction, including without limitation the
+rights to use, copy, modify, merge, publish, distribute, and/or sell copies of
+the Data Files or Software, and to permit persons to whom the Data Files or
+Software are furnished to do so, provided that (a) the above copyright notice(s)
+and this permission notice appear with all copies of the Data Files or Software,
+(b) both the above copyright notice(s) and this permission notice appear in
+associated documentation, and (c) there is clear notice in each modified Data
+File or in the Software as well as in the documentation associated with the Data
+File(s) or Software that the data or software has been modified.
+
+    THE DATA FILES AND SOFTWARE ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY
+KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT OF THIRD
+PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR HOLDERS INCLUDED IN THIS
+NOTICE BE LIABLE FOR ANY CLAIM, OR ANY SPECIAL INDIRECT OR CONSEQUENTIAL
+DAMAGES, OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING
+OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THE DATA FILES OR SOFTWARE.
+
+    Except as contained in this notice, the name of a copyright holder shall not
+be used in advertising or otherwise to promote the sale, use or other dealings
+in these Data Files or Software without prior written authorization of the
+copyright holder.
+
+    Unicode and the Unicode logo are trademarks of Unicode, Inc., and may be
+registered in some jurisdictions. All other trademarks and registered trademarks
+mentioned herein are the property of their respective owners.
+%% This notice is provided with respect to RSA PKCS#11 Header Files & Specification, which may be included with this software: 
+
+/* 
+ * Copyright (C) 1998 by the FundsXpress, INC. 
+ * 
+ * All rights reserved. 
+ * 
+ * Export of this software from the United States of America may require 
+ * a specific license from the United States Government.  It is the 
+ * responsibility of any person or organization contemplating export to 
+ * obtain such a license before exporting. 
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and 
+ * distribute this software and its documentation for any purpose and 
+ * without fee is hereby granted, provided that the above copyright 
+ * notice appear in all copies and that both that copyright notice and 
+ * this permission notice appear in supporting documentation, and that 
+ * the name of FundsXpress. not be used in advertising or publicity pertaining 
+ * to distribution of the software without specific, written prior 
+ * permission.  FundsXpress makes no representations about the suitability of 
+ * this software for any purpose.  It is provided "as is" without express 
+ * or implied warranty. 
+ * 
+ * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR 
+ * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED 
+ * WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. 
+ */ 
+
+%% This notice is provided with respect to certain files/code which may included in the implementation of AWT within the software: 
+
+****************************************************** 
+BEGIN  src/solaris/native/sun/awt/HPkeysym.h 
+Copyright 1987, 1998  The Open Group 
+
+All Rights Reserved. 
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software. 
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE. 
+
+Except as contained in this notice, the name of The Open Group shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization 
+from The Open Group. 
+
+Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts, 
+
+All Rights Reserved 
+
+Permission to use, copy, modify, and distribute this software and its 
+documentation for any purpose and without fee is hereby granted, 
+provided that the above copyright notice appear in all copies and that 
+both that copyright notice and this permission notice appear in 
+supporting documentation, and that the names of Hewlett Packard 
+or Digital not be 
+used in advertising or publicity pertaining to distribution of the 
+software without specific, written prior permission. 
+
+DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING 
+ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL 
+DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR 
+ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, 
+WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, 
+ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS 
+SOFTWARE. 
+
+HEWLETT-PACKARD MAKES NO WARRANTY OF ANY KIND WITH REGARD 
+TO THIS SOFWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
+WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 
+PURPOSE.  Hewlett-Packard shall not be liable for errors 
+contained herein or direct, indirect, special, incidental or 
+consequential damages in connection with the furnishing, 
+performance, or use of this material. 
+
+END  src/solaris/native/sun/awt/HPkeysym.h 
+****************************************************** 
+****************************************************** 
+BEGIN src/solaris/native/sun/awt/Xrandr.h 
+/* 
+ * $XFree86: xc/lib/Xrandr/Xrandr.h,v 1.9 2002/09/29 23:39:44 keithp Exp $ 
+ * 
+ * Copyright © 2000 Compaq Computer Corporation, Inc. 
+ * Copyright © 2002 Hewlett-Packard Company, Inc. 
+ * 
+ * Permission to use, copy, modify, distribute, and sell this software and its 
+ * documentation for any purpose is hereby granted without fee, provided that 
+ * the above copyright notice appear in all copies and that both that 
+ * copyright notice and this permission notice appear in supporting 
+ * documentation, and that the name of Compaq not be used in advertising or 
+ * publicity pertaining to distribution of the software without specific, 
+ * written prior permission.  HP makes no representations about the 
+ * suitability of this software for any purpose.  It is provided "as is" 
+ * without express or implied warranty. 
+ * 
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL COMPAQ 
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ * 
+ * Author:  Jim Gettys, HP Labs, HP. 
+ */ 
+
+
+END src/solaris/native/sun/awt/Xrandr.h 
+****************************************************** 
+BEGIN src/solaris/native/sun/awt/extutil.h 
+/* 
+ * $Xorg: extutil.h,v 1.3 2000/08/18 04:05:45 coskrey Exp $ 
+ * 
+Copyright 1989, 1998  The Open Group 
+
+All Rights Reserved. 
+
+The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE 
+OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 
+AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
+CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+
+Except as contained in this notice, the name of The Open Group shall not be 
+used in advertising or otherwise to promote the sale, use or other dealings 
+in this Software without prior written authorization from The Open Group. 
+ * 
+ * Author:  Jim Fulton, MIT The Open Group 
+ * 
+ *                     Xlib Extension-Writing Utilities 
+ * 
+ * This package contains utilities for writing the client API for various 
+ * protocol extensions.  THESE INTERFACES ARE NOT PART OF THE X STANDARD AND 
+ * ARE SUBJECT TO CHANGE! 
+ */ 
+/* $XFree86: xc/include/extensions/extutil.h,v 1.5 2001/01/17 17:53:20 dawes Exp $ */ 
+
+END src/solaris/native/sun/awt/extutil.h 
+****************************************************** 
+BEGIN   src/solaris/native/sun/awt/fontconfig.h 
+/* 
+ * $RCSId: xc/lib/fontconfig/fontconfig/fontconfig.h,v 1.30 2002/09/26 00:17:27 
+keithp Exp $ 
+ * 
+ * Copyright © 2001 Keith Packard 
+ * 
+ * Permission to use, copy, modify, distribute, and sell this software and its 
+ * documentation for any purpose is hereby granted without fee, provided that 
+ * the above copyright notice appear in all copies and that both that 
+ * copyright notice and this permission notice appear in supporting 
+ * documentation, and that the name of Keith Packard not be used in 
+ * advertising or publicity pertaining to distribution of the software without 
+ * specific, written prior permission.  Keith Packard makes no 
+ * representations about the suitability of this software for any purpose.  It 
+ * is provided "as is" without express or implied warranty. 
+ * 
+ * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, 
+ * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO 
+ * EVENT SHALL KEITH PACKARD BE LIABLE FOR ANY SPECIAL, INDIRECT OR 
+ * CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, 
+ * DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 
+ * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 
+ * PERFORMANCE OF THIS SOFTWARE. 
+
+END   src/solaris/native/sun/awt/fontconfig.h 
+****************************************************** 
+BEGIN src/solaris/native/sun/awt/list.c 
+AND  src/solaris/native/sun/awt/list.h 
+AND src/solaris/native/sun/awt/multiVis.c 
+AND  src/solaris/native/sun/awt/multiVis.h 
+AND  src/solaris/native/sun/awt/wsutils.h 
+
+Copyright (c) 1994 Hewlett-Packard Co. 
+Copyright (c) 1996  X Consortium 
+
+Permission is hereby granted, free of charge, to any person obtaining 
+a copy of this software and associated documentation files (the 
+"Software"), to deal in the Software without restriction, including 
+without limitation the rights to use, copy, modify, merge, publish, 
+distribute, sublicense, and sell copies of the Software, and to 
+permit persons to whom the Software is furnished to do so, subject to 
+the following conditions: 
+
+The above copyright notice and this permission notice shall be included 
+in all copies or substantial portions of the Software. 
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 
+IN NO EVENT SHALL THE X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR 
+OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 
+ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 
+OTHER DEALINGS IN THE SOFTWARE. 
+
+Except as contained in this notice, the name of the X Consortium shall 
+not be used in advertising or otherwise to promote the sale, use or 
+other dealings in this Software without prior written authorization 
+from the X Consortium. 
+
+END src/solaris/native/sun/awt/list.c 
+AND  src/solaris/native/sun/awt/list.h 
+AND src/solaris/native/sun/awt/multiVis.c 
+AND  src/solaris/native/sun/awt/multiVis.h 
+AND  src/solaris/native/sun/awt/wsutils.h 
+
+***************************************************************** 
+BEGIN src/solaris/native/sun/awt/randr.h 
+
+ * 
+ * Copyright © 2000, Compaq Computer Corporation, 
+ * Copyright © 2002, Hewlett Packard, Inc. 
+ * 
+ * Permission to use, copy, modify, distribute, and sell this software and its 
+ * documentation for any purpose is hereby granted without fee, provided that 
+ * the above copyright notice appear in all copies and that both that 
+ * copyright notice and this permission notice appear in supporting 
+ * documentation, and that the name of Compaq or HP not be used in advertising 
+ * or publicity pertaining to distribution of the software without specific, 
+ * written prior permission.  HP makes no representations about the 
+ * suitability of this software for any purpose.  It is provided "as is" 
+ * without express or implied warranty. 
+ * 
+ * HP DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL 
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL HP 
+ * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION 
+ * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
+ * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 
+ * 
+ * Author:  Jim Gettys, HP Labs, Hewlett-Packard, Inc. 
+
+END src/solaris/native/sun/awt/randr.h 
+***************************************************** 
+
+BEGIN src/solaris/native/sun/java2d/opengl/J2D_GL/glx.h 
+ * Mesa 3-D graphics library 
+ * Version:  4.1 
+ * 
+ * Copyright (C) 1999-2002  Brian Paul   All Rights Reserved. 
+ * 
+ * Permission is hereby granted, free of charge, to any person obtaining a 
+ * copy of this software and associated documentation files (the "Software"), 
+ * to deal in the Software without restriction, including without limitation 
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense, 
+ * and/or sell copies of the Software, and to permit persons to whom the 
+ * Software is furnished to do so, subject to the following conditions: 
+ * 
+ * The above copyright notice and this permission notice shall be included 
+ * in all copies or substantial portions of the Software. 
+ * 
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS 
+ * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL 
+ * BRIAN PAUL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN 
+ * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
+ * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 
+
+END src/solaris/native/sun/java2d/opengl/J2D_GL/glx.h 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/sources/jaxp_src/TRADEMARK	Wed Sep 28 16:49:43 2011 +0100
@@ -0,0 +1,41 @@
+OpenJDK Trademark Notice
+Version 1.1, 2008/3/10
+
+OpenJDK (the "Name") is a trademark of Sun Microsystems, Inc. (the "Owner").
+Owner permits any person obtaining a copy of this software (the "Software")
+which is based on original software retrieved from one of the following
+websites: http://download.java.net/openjdk, http://hg.openjdk.java.net/jdk6,
+or http://openjdk.java.net (each a "Website", with the original software made
+available by the Owner on a Website being known as the "Website Software") to
+use the Name in package names and version strings of the Software subject to
+the following conditions:
+
+  - The Software is a substantially complete implementation of the OpenJDK
+    development kit or runtime environment code made available by Owner on a
+    Website, and the vast majority of the Software code is identical to the
+    upstream Website Software;
+
+  - No permission is hereby granted to use the Name in any other manner,
+    unless such use constitutes "fair use."
+
+  - The Owner makes no warranties of any kind respecting the Name and all
+    representations and warranties, including any implied warranty of
+    merchantability, fitness for a particular purpose or non-infringement
+    are hereby disclaimed; and
+
+  - This notice and the following legend are included in all copies of the
+    Software or portions of it:
+
+        OpenJDK is a trademark or registered trademark of Sun Microsystems,
+        Inc. in the United States and other countries.
+
+The Name may also be used in connection with descriptions of the Software that
+constitute "fair use," such as "derived from the OpenJDK code base" or "based
+on the OpenJDK source code."
+
+Owner intends to revise this Notice as necessary in order to meet the needs of
+the OpenJDK Community.  Please send questions or comments about this Notice to
+Sun Microsystems at openjdk-tm@sun.com.  Revisions to this Notice will be
+announced on the public mailing list announce@openjdk.java.net, to which you
+may subscribe by visiting http://mail.openjdk.java.net.  The latest version of
+this Notice may be found at http://openjdk.java.net/legal.
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/lib/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:40:59 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -382,9 +383,7 @@
 
     /** Prints a message to standard error if debugging is enabled. */
     private static void debugPrintln(String msg) {
-        if (DEBUG) {
-            System.err.println("JAXP: " + msg);
-        }
+        System.err.println("JAXP: " + msg);
     } // debugPrintln(String)
 
     /**
@@ -393,7 +392,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +448,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +457,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +472,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +486,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +557,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +582,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +599,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +624,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = -7640369932165775029L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xslt/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xslt/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:41:00 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = 2276082712114762609L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/TransletException.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/TransletException.java	Wed Sep 28 16:49:43 2011 +0100
@@ -34,14 +34,15 @@
     static final long serialVersionUID = -878916829521217293L;
 
     public TransletException() {
-        super("Translet error");
+	super("Translet error");
     }
-
+    
     public TransletException(Exception e) {
-        super(e.toString());
+	super(e.toString());
+        initCause(e);
     }
-
+    
     public TransletException(String message) {
-        super(message);
+	super(message);
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/Compile.java	Wed Sep 28 16:49:43 2011 +0100
@@ -44,26 +44,26 @@
     private static int VERSION_MAJOR = 1;
     private static int VERSION_MINOR = 4;
     private static int VERSION_DELTA = 0;
-
-
-
-    // This variable should be set to false to prevent any methods in this
+    
+    
+    
+    // This variable should be set to false to prevent any methods in this 
     // class from calling System.exit(). As this is a command-line tool,
     // calling System.exit() is normally OK, but we also want to allow for
     // this class being used in other ways as well.
-    private static boolean _allowExit = true;
-
+    private static boolean _allowExit = true;    
+ 
 
     public static void printUsage() {
-        StringBuffer vers = new StringBuffer("XSLTC version " +
-            VERSION_MAJOR + "." + VERSION_MINOR +
-            ((VERSION_DELTA > 0) ? ("."+VERSION_DELTA) : ("")));
-        System.err.println(vers + "\n" +
-                new ErrorMsg(ErrorMsg.COMPILE_USAGE_STR));
-        if (_allowExit) System.exit(-1);
+        StringBuffer vers = new StringBuffer("XSLTC version " + 
+	    VERSION_MAJOR + "." + VERSION_MINOR + 
+	    ((VERSION_DELTA > 0) ? ("."+VERSION_DELTA) : ("")));
+	System.err.println(vers + "\n" + 
+		new ErrorMsg(ErrorMsg.COMPILE_USAGE_STR));
+	if (_allowExit) System.exit(-1);        
     }
 
-    /**
+    /** 
      * This method implements the command line compiler. See the USAGE_STRING
      * constant for a description. It may make sense to move the command-line
      * handling to a separate package (ie. make one xsltc.cmdline.Compiler
@@ -71,101 +71,101 @@
      * class that contains the DefaultRun stuff).
      */
     public static void main(String[] args) {
-        try {
-            boolean inputIsURL = false;
-            boolean useStdIn = false;
-            boolean classNameSet = false;
-            final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv");
-            if (args.length < 1) printUsage();
+	try {
+	    boolean inputIsURL = false;
+	    boolean useStdIn = false;
+	    boolean classNameSet = false;
+	    final GetOpt getopt = new GetOpt(args, "o:d:j:p:uxhsinv");
+	    if (args.length < 1) printUsage();
 
-            final XSLTC xsltc = new XSLTC();
-            xsltc.init();
+	    final XSLTC xsltc = new XSLTC();
+	    xsltc.init();
 
-            int c;
-            while ((c = getopt.getNextOption()) != -1) {
-                switch(c) {
-                case 'i':
-                    useStdIn = true;
-                    break;
-                case 'o':
-                    xsltc.setClassName(getopt.getOptionArg());
-                    classNameSet = true;
-                    break;
-                case 'd':
-                    xsltc.setDestDirectory(getopt.getOptionArg());
-                    break;
-                case 'p':
-                    xsltc.setPackageName(getopt.getOptionArg());
-                    break;
-                case 'j':
-                    xsltc.setJarFileName(getopt.getOptionArg());
-                    break;
-                case 'x':
-                    xsltc.setDebug(true);
-                    break;
-                case 'u':
-                    inputIsURL = true;
-                    break;
-                case 's':
-                    _allowExit = false;
-                    break;
-                case 'n':
-                    xsltc.setTemplateInlining(true);    // used to be 'false'
-                    break;
-                case 'v':
-                    // fall through to case h
-                case 'h':
-                default:
-                    printUsage();
-                    break;
-                }
-            }
+	    int c;
+	    while ((c = getopt.getNextOption()) != -1) {
+		switch(c) {
+		case 'i':
+		    useStdIn = true;
+		    break;
+		case 'o':
+		    xsltc.setClassName(getopt.getOptionArg());
+		    classNameSet = true;
+		    break;
+		case 'd':
+		    xsltc.setDestDirectory(getopt.getOptionArg());
+		    break;
+		case 'p':
+		    xsltc.setPackageName(getopt.getOptionArg());
+		    break;
+		case 'j':  
+		    xsltc.setJarFileName(getopt.getOptionArg());
+		    break;
+		case 'x':
+		    xsltc.setDebug(true);
+		    break;
+		case 'u':
+		    inputIsURL = true;
+		    break;
+		case 's':
+		    _allowExit = false;
+		    break;                     
+		case 'n':
+		    xsltc.setTemplateInlining(true);	// used to be 'false'
+		    break;
+		case 'v':
+		    // fall through to case h
+		case 'h':
+		default:
+		    printUsage();
+		    break; 
+		}
+	    }
 
-            boolean compileOK;
+	    boolean compileOK;
 
-            if (useStdIn) {
-                if (!classNameSet) {
-                    System.err.println(new ErrorMsg(ErrorMsg.COMPILE_STDIN_ERR));
+	    if (useStdIn) {
+		if (!classNameSet) {
+		    System.err.println(new ErrorMsg(ErrorMsg.COMPILE_STDIN_ERR));
                     if (_allowExit) System.exit(-1);
-                }
-                compileOK = xsltc.compile(System.in, xsltc.getClassName());
-            }
-            else {
-                // Generate a vector containg URLs for all stylesheets specified
-                final String[] stylesheetNames = getopt.getCmdArgs();
-                final Vector   stylesheetVector = new Vector();
-                for (int i = 0; i < stylesheetNames.length; i++) {
-                    final String name = stylesheetNames[i];
-                    URL url;
-                    if (inputIsURL)
-                        url = new URL(name);
-                    else
-                        url = (new File(name)).toURL();
-                    stylesheetVector.addElement(url);
-                }
-                compileOK = xsltc.compile(stylesheetVector);
-            }
+		}
+		compileOK = xsltc.compile(System.in, xsltc.getClassName());
+	    }
+	    else {
+		// Generate a vector containg URLs for all stylesheets specified
+		final String[] stylesheetNames = getopt.getCmdArgs();
+		final Vector   stylesheetVector = new Vector();
+		for (int i = 0; i < stylesheetNames.length; i++) {
+		    final String name = stylesheetNames[i];
+		    URL url;
+		    if (inputIsURL)
+			url = new URL(name);
+		    else
+			url = (new File(name)).toURI().toURL();
+		    stylesheetVector.addElement(url);
+		}
+		compileOK = xsltc.compile(stylesheetVector);
+	    }
 
-            // Compile the stylesheet and output class/jar file(s)
-            if (compileOK) {
-                xsltc.printWarnings();
-                if (xsltc.getJarFileName() != null) xsltc.outputToJar();
-                if (_allowExit) System.exit(0);
-            }
-            else {
-                xsltc.printWarnings();
-                xsltc.printErrors();
-                if (_allowExit) System.exit(-1);
-            }
-        }
-        catch (GetOptsException ex) {
-            System.err.println(ex);
-            printUsage(); // exits with code '-1'
-        }
-        catch (Exception e) {
-            e.printStackTrace();
+	    // Compile the stylesheet and output class/jar file(s)
+	    if (compileOK) {
+		xsltc.printWarnings();
+		if (xsltc.getJarFileName() != null) xsltc.outputToJar();
+                if (_allowExit) System.exit(0);                
+	    }
+	    else {
+		xsltc.printWarnings();
+		xsltc.printErrors();
+		if (_allowExit) System.exit(-1);                
+	    }
+	}
+	catch (GetOptsException ex) {
+	    System.err.println(ex);
+	    printUsage(); // exits with code '-1'
+	}
+	catch (Exception e) {
+	    e.printStackTrace();
             if (_allowExit) System.exit(-1);
-        }
+	}
     }
 
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/cmdline/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:41:02 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = -6072257854297546607L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Copy.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Copy.java	Wed Sep 28 16:49:43 2011 +0100
@@ -49,111 +49,111 @@
  */
 final class Copy extends Instruction {
     private UseAttributeSets _useSets;
-
+    
     public void parseContents(Parser parser) {
-        final String useSets = getAttribute("use-attribute-sets");
-        if (useSets.length() > 0) {
+	final String useSets = getAttribute("use-attribute-sets");
+	if (useSets.length() > 0) {
             if (!Util.isValidQNames(useSets)) {
                 ErrorMsg err = new ErrorMsg(ErrorMsg.INVALID_QNAME_ERR, useSets, this);
-                parser.reportError(Constants.ERROR, err);
-            }
-            _useSets = new UseAttributeSets(useSets, parser);
-        }
-        parseChildren(parser);
+                parser.reportError(Constants.ERROR, err);	
+            }		
+	    _useSets = new UseAttributeSets(useSets, parser);
+	}
+	parseChildren(parser);
     }
-
+    
     public void display(int indent) {
-        indent(indent);
-        Util.println("Copy");
-        indent(indent + IndentIncrement);
-        displayContents(indent + IndentIncrement);
+	indent(indent);
+	Util.println("Copy");
+	indent(indent + IndentIncrement);
+	displayContents(indent + IndentIncrement);
     }
 
     public Type typeCheck(SymbolTable stable) throws TypeCheckError {
-        if (_useSets != null) {
-            _useSets.typeCheck(stable);
-        }
-        typeCheckContents(stable);
-        return Type.Void;
+	if (_useSets != null) {
+	    _useSets.typeCheck(stable);
+	}
+	typeCheckContents(stable);
+	return Type.Void;
     }
-
+	
     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
-        final ConstantPoolGen cpg = classGen.getConstantPool();
-        final InstructionList il = methodGen.getInstructionList();
+	final ConstantPoolGen cpg = classGen.getConstantPool();
+	final InstructionList il = methodGen.getInstructionList();
 
-        final LocalVariableGen name =
-            methodGen.addLocalVariable2("name",
-                                        Util.getJCRefType(STRING_SIG),
-                                        il.getEnd());
-        final LocalVariableGen length =
-            methodGen.addLocalVariable2("length",
-                                        Util.getJCRefType("I"),
-                                        il.getEnd());
+	final LocalVariableGen name =
+	    methodGen.addLocalVariable2("name",
+					Util.getJCRefType(STRING_SIG),
+					il.getEnd());
+	final LocalVariableGen length =
+	    methodGen.addLocalVariable2("length",
+					Util.getJCRefType("I"),
+					il.getEnd());
 
-        // Get the name of the node to copy and save for later
-        il.append(methodGen.loadDOM());
-        il.append(methodGen.loadCurrentNode());
-        il.append(methodGen.loadHandler());
-        final int cpy = cpg.addInterfaceMethodref(DOM_INTF,
-                                                  "shallowCopy",
-                                                  "("
-                                                  + NODE_SIG
-                                                  + TRANSLET_OUTPUT_SIG
-                                                  + ")" + STRING_SIG);
-        il.append(new INVOKEINTERFACE(cpy, 3));
+	// Get the name of the node to copy and save for later
+	il.append(methodGen.loadDOM());
+	il.append(methodGen.loadCurrentNode());
+	il.append(methodGen.loadHandler());
+	final int cpy = cpg.addInterfaceMethodref(DOM_INTF,
+						  "shallowCopy",
+						  "("
+						  + NODE_SIG
+						  + TRANSLET_OUTPUT_SIG
+						  + ")" + STRING_SIG); 
+	il.append(new INVOKEINTERFACE(cpy, 3));
+	il.append(DUP);
+	il.append(new ASTORE(name.getIndex()));
+	final BranchHandle ifBlock1 = il.append(new IFNULL(null));
+
+	// Get the length of the node name and save for later
+	il.append(new ALOAD(name.getIndex()));
+	final int lengthMethod = cpg.addMethodref(STRING_CLASS,"length","()I");
+	il.append(new INVOKEVIRTUAL(lengthMethod));
         il.append(DUP);
-        il.append(new ASTORE(name.getIndex()));
-        final BranchHandle ifBlock1 = il.append(new IFNULL(null));
-
-        // Get the length of the node name and save for later
-        il.append(new ALOAD(name.getIndex()));
-        final int lengthMethod = cpg.addMethodref(STRING_CLASS,"length","()I");
-        il.append(new INVOKEVIRTUAL(lengthMethod));
-        il.append(DUP);
-        il.append(new ISTORE(length.getIndex()));
+	il.append(new ISTORE(length.getIndex()));
 
         // Ignore attribute sets if current node is ROOT. DOM.shallowCopy()
         // returns "" for ROOT, so skip attribute sets if length == 0
-        final BranchHandle ifBlock4 = il.append(new IFEQ(null));
+	final BranchHandle ifBlock4 = il.append(new IFEQ(null));
+        
+	// Copy in attribute sets if specified
+	if (_useSets != null) {
+	    // If the parent of this element will result in an element being
+	    // output then we know that it is safe to copy out the attributes
+	    final SyntaxTreeNode parent = getParent();
+	    if ((parent instanceof LiteralElement) ||
+		(parent instanceof LiteralElement)) {
+		_useSets.translate(classGen, methodGen);
+	    }
+	    // If not we have to check to see if the copy will result in an
+	    // element being output.
+	    else {
+		// check if element; if not skip to translate body
+		il.append(new ILOAD(length.getIndex()));
+		final BranchHandle ifBlock2 = il.append(new IFEQ(null));
+		// length != 0 -> element -> do attribute sets
+		_useSets.translate(classGen, methodGen);
+		// not an element; root
+		ifBlock2.setTarget(il.append(NOP));
+	    }
+	}
 
-        // Copy in attribute sets if specified
-        if (_useSets != null) {
-            // If the parent of this element will result in an element being
-            // output then we know that it is safe to copy out the attributes
-            final SyntaxTreeNode parent = getParent();
-            if ((parent instanceof LiteralElement) ||
-                (parent instanceof LiteralElement)) {
-                _useSets.translate(classGen, methodGen);
-            }
-            // If not we have to check to see if the copy will result in an
-            // element being output.
-            else {
-                // check if element; if not skip to translate body
-                il.append(new ILOAD(length.getIndex()));
-                final BranchHandle ifBlock2 = il.append(new IFEQ(null));
-                // length != 0 -> element -> do attribute sets
-                _useSets.translate(classGen, methodGen);
-                // not an element; root
-                ifBlock2.setTarget(il.append(NOP));
-            }
-        }
+	// Instantiate body of xsl:copy
+        ifBlock4.setTarget(il.append(NOP));
+	translateContents(classGen, methodGen);
 
-        // Instantiate body of xsl:copy
-        ifBlock4.setTarget(il.append(NOP));
-        translateContents(classGen, methodGen);
-
-        // Call the output handler's endElement() if we copied an element
-        // (The DOM.shallowCopy() method calls startElement().)
-        il.append(new ILOAD(length.getIndex()));
-        final BranchHandle ifBlock3 = il.append(new IFEQ(null));
-        il.append(methodGen.loadHandler());
-        il.append(new ALOAD(name.getIndex()));
-        il.append(methodGen.endElement());
-
-        final InstructionHandle end = il.append(NOP);
-        ifBlock1.setTarget(end);
-        ifBlock3.setTarget(end);
-        methodGen.removeLocalVariable(name);
-        methodGen.removeLocalVariable(length);
+	// Call the output handler's endElement() if we copied an element
+	// (The DOM.shallowCopy() method calls startElement().)
+	il.append(new ILOAD(length.getIndex()));
+	final BranchHandle ifBlock3 = il.append(new IFEQ(null));
+	il.append(methodGen.loadHandler());
+	il.append(new ALOAD(name.getIndex()));
+	il.append(methodGen.endElement());
+	
+	final InstructionHandle end = il.append(NOP);
+	ifBlock1.setTarget(end);
+	ifBlock3.setTarget(end);
+	methodGen.removeLocalVariable(name);
+	methodGen.removeLocalVariable(length);
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Number.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/Number.java	Wed Sep 28 16:49:43 2011 +0100
@@ -62,16 +62,16 @@
     private static final int LEVEL_MULTIPLE = 1;
     private static final int LEVEL_ANY      = 2;
 
-    static final private String[] ClassNames = {
-        "com.sun.org.apache.xalan.internal.xsltc.dom.SingleNodeCounter",          // LEVEL_SINGLE
-        "com.sun.org.apache.xalan.internal.xsltc.dom.MultipleNodeCounter", // LEVEL_MULTIPLE
-        "com.sun.org.apache.xalan.internal.xsltc.dom.AnyNodeCounter"      // LEVEL_ANY
+    static final private String[] ClassNames = { 
+	"com.sun.org.apache.xalan.internal.xsltc.dom.SingleNodeCounter",	  // LEVEL_SINGLE
+	"com.sun.org.apache.xalan.internal.xsltc.dom.MultipleNodeCounter", // LEVEL_MULTIPLE
+	"com.sun.org.apache.xalan.internal.xsltc.dom.AnyNodeCounter"	  // LEVEL_ANY
     };
 
-    static final private String[] FieldNames = {
-        "___single_node_counter",                  // LEVEL_SINGLE
-        "___multiple_node_counter",                // LEVEL_MULTIPLE
-        "___any_node_counter"                      // LEVEL_ANY
+    static final private String[] FieldNames = { 
+	"___single_node_counter",		   // LEVEL_SINGLE
+	"___multiple_node_counter",		   // LEVEL_MULTIPLE
+	"___any_node_counter"			   // LEVEL_ANY
     };
 
     private Pattern _from = null;
@@ -97,126 +97,126 @@
      * if this is a real closure).
      */
     public boolean inInnerClass() {
-        return (_className != null);
+	return (_className != null);
     }
 
     /**
      * Returns a reference to its parent closure or null if outermost.
      */
     public Closure getParentClosure() {
-        return null;
+	return null;
     }
 
     /**
-     * Returns the name of the auxiliary class or null if this predicate
+     * Returns the name of the auxiliary class or null if this predicate 
      * is compiled inside the Translet.
      */
     public String getInnerClassName() {
-        return _className;
+	return _className;
     }
 
     /**
      * Add new variable to the closure.
      */
     public void addVariable(VariableRefBase variableRef) {
-        if (_closureVars == null) {
-            _closureVars = new ArrayList();
-        }
+	if (_closureVars == null) {
+	    _closureVars = new ArrayList();
+	}
 
-        // Only one reference per variable
-        if (!_closureVars.contains(variableRef)) {
-            _closureVars.add(variableRef);
-        }
+	// Only one reference per variable
+	if (!_closureVars.contains(variableRef)) {
+	    _closureVars.add(variableRef);
+	}
     }
 
     // -- End Closure interface ----------------------
 
    public void parseContents(Parser parser) {
-        final int count = _attributes.getLength();
+	final int count = _attributes.getLength();
 
-        for (int i = 0; i < count; i++) {
-            final String name = _attributes.getQName(i);
-            final String value = _attributes.getValue(i);
+	for (int i = 0; i < count; i++) {
+	    final String name = _attributes.getQName(i);
+	    final String value = _attributes.getValue(i);
 
-            if (name.equals("value")) {
-                _value = parser.parseExpression(this, name, null);
-            }
-            else if (name.equals("count")) {
-                _count = parser.parsePattern(this, name, null);
-            }
-            else if (name.equals("from")) {
-                _from = parser.parsePattern(this, name, null);
-            }
-            else if (name.equals("level")) {
-                if (value.equals("single")) {
-                    _level = LEVEL_SINGLE;
-                }
-                else if (value.equals("multiple")) {
-                    _level = LEVEL_MULTIPLE;
-                }
-                else if (value.equals("any")) {
-                    _level = LEVEL_ANY;
-                }
-            }
-            else if (name.equals("format")) {
-                _format = new AttributeValueTemplate(value, parser, this);
-                _formatNeeded = true;
-            }
-            else if (name.equals("lang")) {
-                _lang = new AttributeValueTemplate(value, parser, this);
-                _formatNeeded = true;
-            }
-            else if (name.equals("letter-value")) {
-                _letterValue = new AttributeValueTemplate(value, parser, this);
-                _formatNeeded = true;
-            }
-            else if (name.equals("grouping-separator")) {
-                _groupingSeparator = new AttributeValueTemplate(value, parser, this);
-                _formatNeeded = true;
-            }
-            else if (name.equals("grouping-size")) {
-                _groupingSize = new AttributeValueTemplate(value, parser, this);
-                _formatNeeded = true;
-            }
-        }
+	    if (name.equals("value")) {
+		_value = parser.parseExpression(this, name, null);
+	    }
+	    else if (name.equals("count")) {
+		_count = parser.parsePattern(this, name, null);
+	    }
+	    else if (name.equals("from")) {
+		_from = parser.parsePattern(this, name, null);
+	    }
+	    else if (name.equals("level")) {
+		if (value.equals("single")) {
+		    _level = LEVEL_SINGLE;
+		}
+		else if (value.equals("multiple")) {
+		    _level = LEVEL_MULTIPLE;
+		}
+		else if (value.equals("any")) {
+		    _level = LEVEL_ANY;
+		}
+	    }
+	    else if (name.equals("format")) {
+		_format = new AttributeValueTemplate(value, parser, this);
+		_formatNeeded = true;
+	    }
+	    else if (name.equals("lang")) {
+		_lang = new AttributeValueTemplate(value, parser, this);
+		_formatNeeded = true;
+	    }
+	    else if (name.equals("letter-value")) {
+		_letterValue = new AttributeValueTemplate(value, parser, this);
+		_formatNeeded = true;
+	    }
+	    else if (name.equals("grouping-separator")) {
+		_groupingSeparator = new AttributeValueTemplate(value, parser, this);
+		_formatNeeded = true;
+	    }
+	    else if (name.equals("grouping-size")) {
+		_groupingSize = new AttributeValueTemplate(value, parser, this);
+		_formatNeeded = true;
+	    }
+	}
     }
 
     public Type typeCheck(SymbolTable stable) throws TypeCheckError {
-        if (_value != null) {
-            Type tvalue = _value.typeCheck(stable);
-            if (tvalue instanceof RealType == false) {
-                _value = new CastExpr(_value, Type.Real);
-            }
-        }
-        if (_count != null) {
-            _count.typeCheck(stable);
-        }
-        if (_from != null) {
-            _from.typeCheck(stable);
-        }
-        if (_format != null) {
-            _format.typeCheck(stable);
-        }
-        if (_lang != null) {
-            _lang.typeCheck(stable);
-        }
-        if (_letterValue != null) {
-            _letterValue.typeCheck(stable);
-        }
-        if (_groupingSeparator != null) {
-            _groupingSeparator.typeCheck(stable);
-        }
-        if (_groupingSize != null) {
-            _groupingSize.typeCheck(stable);
-        }
-        return Type.Void;
+	if (_value != null) {
+	    Type tvalue = _value.typeCheck(stable);
+	    if (tvalue instanceof RealType == false) {
+		_value = new CastExpr(_value, Type.Real);
+	    }
+	}
+	if (_count != null) {
+	    _count.typeCheck(stable);
+	}
+	if (_from != null) {
+	    _from.typeCheck(stable);
+	}
+	if (_format != null) {
+	    _format.typeCheck(stable);
+	}
+	if (_lang != null) {
+	    _lang.typeCheck(stable);
+	}
+	if (_letterValue != null) {
+	    _letterValue.typeCheck(stable);
+	}
+	if (_groupingSeparator != null) {
+	    _groupingSeparator.typeCheck(stable);
+	}
+	if (_groupingSize != null) {
+	    _groupingSize.typeCheck(stable);
+	}
+	return Type.Void;
     }
 
     /**
      * True if the has specified a value for this instance of number.
      */
     public boolean hasValue() {
-        return _value != null;
+	return _value != null;
     }
 
     /**
@@ -224,62 +224,62 @@
      * a from nor a count pattern.
      */
     public boolean isDefault() {
-        return _from == null && _count == null;
+	return _from == null && _count == null;
     }
 
     private void compileDefault(ClassGenerator classGen,
-                                MethodGenerator methodGen) {
-        int index;
-        ConstantPoolGen cpg = classGen.getConstantPool();
-        InstructionList il = methodGen.getInstructionList();
+			        MethodGenerator methodGen) {
+	int index;
+	ConstantPoolGen cpg = classGen.getConstantPool();
+	InstructionList il = methodGen.getInstructionList();
 
-        int[] fieldIndexes = getXSLTC().getNumberFieldIndexes();
+	int[] fieldIndexes = getXSLTC().getNumberFieldIndexes();
 
-        if (fieldIndexes[_level] == -1) {
-            Field defaultNode = new Field(ACC_PRIVATE,
-                                          cpg.addUtf8(FieldNames[_level]),
-                                          cpg.addUtf8(NODE_COUNTER_SIG),
-                                          null,
-                                          cpg.getConstantPool());
+	if (fieldIndexes[_level] == -1) {
+	    Field defaultNode = new Field(ACC_PRIVATE, 
+					  cpg.addUtf8(FieldNames[_level]),
+					  cpg.addUtf8(NODE_COUNTER_SIG),
+					  null, 
+					  cpg.getConstantPool());
 
-            // Add a new private field to this class
-            classGen.addField(defaultNode);
+	    // Add a new private field to this class
+	    classGen.addField(defaultNode);
 
-            // Get a reference to the newly added field
-            fieldIndexes[_level] = cpg.addFieldref(classGen.getClassName(),
-                                                   FieldNames[_level],
-                                                   NODE_COUNTER_SIG);
-        }
+	    // Get a reference to the newly added field
+	    fieldIndexes[_level] = cpg.addFieldref(classGen.getClassName(), 
+						   FieldNames[_level],
+						   NODE_COUNTER_SIG);
+	}
 
-        // Check if field is initialized (runtime)
-        il.append(classGen.loadTranslet());
-        il.append(new GETFIELD(fieldIndexes[_level]));
-        final BranchHandle ifBlock1 = il.append(new IFNONNULL(null));
+	// Check if field is initialized (runtime)
+	il.append(classGen.loadTranslet());
+	il.append(new GETFIELD(fieldIndexes[_level]));
+	final BranchHandle ifBlock1 = il.append(new IFNONNULL(null));
 
-        // Create an instance of DefaultNodeCounter
-        index = cpg.addMethodref(ClassNames[_level],
-                                 "getDefaultNodeCounter",
-                                 "(" + TRANSLET_INTF_SIG
-                                 + DOM_INTF_SIG
-                                 + NODE_ITERATOR_SIG
-                                 + ")" + NODE_COUNTER_SIG);
-        il.append(classGen.loadTranslet());
-        il.append(methodGen.loadDOM());
-        il.append(methodGen.loadIterator());
-        il.append(new INVOKESTATIC(index));
-        il.append(DUP);
+	// Create an instance of DefaultNodeCounter
+	index = cpg.addMethodref(ClassNames[_level],
+				 "getDefaultNodeCounter", 
+				 "(" + TRANSLET_INTF_SIG
+				 + DOM_INTF_SIG
+				 + NODE_ITERATOR_SIG 
+				 + ")" + NODE_COUNTER_SIG);
+	il.append(classGen.loadTranslet());
+	il.append(methodGen.loadDOM());
+	il.append(methodGen.loadIterator());
+	il.append(new INVOKESTATIC(index));
+	il.append(DUP);
 
-        // Store the node counter in the field
-        il.append(classGen.loadTranslet());
-        il.append(SWAP);
-        il.append(new PUTFIELD(fieldIndexes[_level]));
-        final BranchHandle ifBlock2 = il.append(new GOTO(null));
+	// Store the node counter in the field
+	il.append(classGen.loadTranslet());
+	il.append(SWAP);
+	il.append(new PUTFIELD(fieldIndexes[_level]));
+	final BranchHandle ifBlock2 = il.append(new GOTO(null));
 
-        // Backpatch conditionals
-        ifBlock1.setTarget(il.append(classGen.loadTranslet()));
-        il.append(new GETFIELD(fieldIndexes[_level]));
-
-        ifBlock2.setTarget(il.append(NOP));
+	// Backpatch conditionals
+	ifBlock1.setTarget(il.append(classGen.loadTranslet()));
+	il.append(new GETFIELD(fieldIndexes[_level]));
+	
+	ifBlock2.setTarget(il.append(NOP));
     }
 
     /**
@@ -288,45 +288,45 @@
      * simply calls the same constructor in the super class.
      */
     private void compileConstructor(ClassGenerator classGen) {
-        MethodGenerator cons;
-        final InstructionList il = new InstructionList();
-        final ConstantPoolGen cpg = classGen.getConstantPool();
+	MethodGenerator cons;
+	final InstructionList il = new InstructionList();
+	final ConstantPoolGen cpg = classGen.getConstantPool();
 
-        cons = new MethodGenerator(ACC_PUBLIC,
-                                   com.sun.org.apache.bcel.internal.generic.Type.VOID,
-                                   new com.sun.org.apache.bcel.internal.generic.Type[] {
-                                       Util.getJCRefType(TRANSLET_INTF_SIG),
-                                       Util.getJCRefType(DOM_INTF_SIG),
-                                       Util.getJCRefType(NODE_ITERATOR_SIG),
+	cons = new MethodGenerator(ACC_PUBLIC,
+				   com.sun.org.apache.bcel.internal.generic.Type.VOID, 
+				   new com.sun.org.apache.bcel.internal.generic.Type[] {
+				       Util.getJCRefType(TRANSLET_INTF_SIG),
+				       Util.getJCRefType(DOM_INTF_SIG),
+				       Util.getJCRefType(NODE_ITERATOR_SIG),
                                        com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN
-                                   },
-                                   new String[] {
-                                       "dom",
-                                       "translet",
-                                       "iterator",
+				   },
+				   new String[] {
+				       "dom",
+				       "translet",
+				       "iterator",
                                        "hasFrom"
-                                   },
-                                   "<init>", _className, il, cpg);
+				   },
+				   "<init>", _className, il, cpg);
 
-        il.append(ALOAD_0);         // this
-        il.append(ALOAD_1);         // translet
-        il.append(ALOAD_2);         // DOM
-        il.append(new ALOAD(3));    // iterator
+	il.append(ALOAD_0);         // this
+	il.append(ALOAD_1);         // translet
+	il.append(ALOAD_2);         // DOM
+	il.append(new ALOAD(3));    // iterator
         il.append(new ILOAD(4));    // hasFrom
 
-        int index = cpg.addMethodref(ClassNames[_level],
-                                     "<init>",
-                                     "(" + TRANSLET_INTF_SIG
-                                     + DOM_INTF_SIG
-                                     + NODE_ITERATOR_SIG
-                                     + "Z)V");
-        il.append(new INVOKESPECIAL(index));
-        il.append(RETURN);
-
-        cons.stripAttributes(true);
-        cons.setMaxLocals();
-        cons.setMaxStack();
-        classGen.addMethod(cons.getMethod());
+	int index = cpg.addMethodref(ClassNames[_level],
+				     "<init>", 
+				     "(" + TRANSLET_INTF_SIG
+				     + DOM_INTF_SIG
+				     + NODE_ITERATOR_SIG 
+				     + "Z)V");
+	il.append(new INVOKESPECIAL(index));
+	il.append(RETURN);
+	
+	cons.stripAttributes(true);
+	cons.setMaxLocals();
+	cons.setMaxStack();
+	classGen.addMethod(cons.getMethod());
     }
 
     /**
@@ -334,278 +334,278 @@
      * matchesCount() in the auxillary class.
      */
     private void compileLocals(NodeCounterGenerator nodeCounterGen,
-                               MatchGenerator matchGen,
-                               InstructionList il)
+			       MatchGenerator matchGen,
+			       InstructionList il) 
     {
-        int field;
-        LocalVariableGen local;
-        ConstantPoolGen cpg = nodeCounterGen.getConstantPool();
-
-        // Get NodeCounter._iterator and store locally
-        local = matchGen.addLocalVariable("iterator",
-                                          Util.getJCRefType(NODE_ITERATOR_SIG),
-                                          null, null);
-        field = cpg.addFieldref(NODE_COUNTER, "_iterator",
-                                ITERATOR_FIELD_SIG);
-        il.append(ALOAD_0); // 'this' pointer on stack
-        il.append(new GETFIELD(field));
-        il.append(new ASTORE(local.getIndex()));
-        matchGen.setIteratorIndex(local.getIndex());
+	int field;
+	LocalVariableGen local;
+	ConstantPoolGen cpg = nodeCounterGen.getConstantPool();
 
-        // Get NodeCounter._translet and store locally
-        local = matchGen.addLocalVariable("translet",
-                                  Util.getJCRefType(TRANSLET_SIG),
-                                  null, null);
-        field = cpg.addFieldref(NODE_COUNTER, "_translet",
-                                "Lcom/sun/org/apache/xalan/internal/xsltc/Translet;");
-        il.append(ALOAD_0); // 'this' pointer on stack
-        il.append(new GETFIELD(field));
-        il.append(new CHECKCAST(cpg.addClass(TRANSLET_CLASS)));
-        il.append(new ASTORE(local.getIndex()));
-        nodeCounterGen.setTransletIndex(local.getIndex());
+	// Get NodeCounter._iterator and store locally
+	local = matchGen.addLocalVariable("iterator", 
+					  Util.getJCRefType(NODE_ITERATOR_SIG),
+					  null, null);
+	field = cpg.addFieldref(NODE_COUNTER, "_iterator",
+				ITERATOR_FIELD_SIG);
+	il.append(ALOAD_0); // 'this' pointer on stack
+	il.append(new GETFIELD(field));
+	il.append(new ASTORE(local.getIndex()));
+	matchGen.setIteratorIndex(local.getIndex());
+	
+	// Get NodeCounter._translet and store locally
+	local = matchGen.addLocalVariable("translet", 
+				  Util.getJCRefType(TRANSLET_SIG),
+				  null, null);
+	field = cpg.addFieldref(NODE_COUNTER, "_translet",
+				"Lcom/sun/org/apache/xalan/internal/xsltc/Translet;");
+	il.append(ALOAD_0); // 'this' pointer on stack
+	il.append(new GETFIELD(field));
+	il.append(new CHECKCAST(cpg.addClass(TRANSLET_CLASS)));
+	il.append(new ASTORE(local.getIndex()));
+	nodeCounterGen.setTransletIndex(local.getIndex());
 
-        // Get NodeCounter._document and store locally
-        local = matchGen.addLocalVariable("document",
-                                          Util.getJCRefType(DOM_INTF_SIG),
-                                          null, null);
-        field = cpg.addFieldref(_className, "_document", DOM_INTF_SIG);
-        il.append(ALOAD_0); // 'this' pointer on stack
-        il.append(new GETFIELD(field));
-        // Make sure we have the correct DOM type on the stack!!!
-        il.append(new ASTORE(local.getIndex()));
-        matchGen.setDomIndex(local.getIndex());
+	// Get NodeCounter._document and store locally
+	local = matchGen.addLocalVariable("document", 
+					  Util.getJCRefType(DOM_INTF_SIG),
+					  null, null);
+	field = cpg.addFieldref(_className, "_document", DOM_INTF_SIG);
+	il.append(ALOAD_0); // 'this' pointer on stack
+	il.append(new GETFIELD(field));
+	// Make sure we have the correct DOM type on the stack!!!
+	il.append(new ASTORE(local.getIndex()));
+	matchGen.setDomIndex(local.getIndex());
     }
 
     private void compilePatterns(ClassGenerator classGen,
-                                 MethodGenerator methodGen)
+				 MethodGenerator methodGen) 
     {
-        int current;
-        int field;
-        LocalVariableGen local;
-        MatchGenerator matchGen;
-        NodeCounterGenerator nodeCounterGen;
+	int current;
+	int field;
+	LocalVariableGen local;
+	MatchGenerator matchGen;
+	NodeCounterGenerator nodeCounterGen;
 
-        _className = getXSLTC().getHelperClassName();
-        nodeCounterGen = new NodeCounterGenerator(_className,
-                                                  ClassNames[_level],
-                                                  toString(),
-                                                  ACC_PUBLIC | ACC_SUPER,
-                                                  null,
-                                                  classGen.getStylesheet());
-        InstructionList il = null;
-        ConstantPoolGen cpg = nodeCounterGen.getConstantPool();
+	_className = getXSLTC().getHelperClassName();
+	nodeCounterGen = new NodeCounterGenerator(_className,
+						  ClassNames[_level],
+						  toString(), 
+						  ACC_PUBLIC | ACC_SUPER,
+						  null,
+						  classGen.getStylesheet());
+	InstructionList il = null;
+	ConstantPoolGen cpg = nodeCounterGen.getConstantPool();
 
-        // Add a new instance variable for each var in closure
-        final int closureLen = (_closureVars == null) ? 0 :
-            _closureVars.size();
+	// Add a new instance variable for each var in closure
+	final int closureLen = (_closureVars == null) ? 0 : 
+	    _closureVars.size();
 
-        for (int i = 0; i < closureLen; i++) {
-            VariableBase var =
-                ((VariableRefBase) _closureVars.get(i)).getVariable();
+	for (int i = 0; i < closureLen; i++) {
+	    VariableBase var = 
+		((VariableRefBase) _closureVars.get(i)).getVariable();
 
-            nodeCounterGen.addField(new Field(ACC_PUBLIC,
-                                        cpg.addUtf8(var.getEscapedName()),
-                                        cpg.addUtf8(var.getType().toSignature()),
-                                        null, cpg.getConstantPool()));
-        }
+	    nodeCounterGen.addField(new Field(ACC_PUBLIC, 
+					cpg.addUtf8(var.getEscapedName()),
+					cpg.addUtf8(var.getType().toSignature()),
+					null, cpg.getConstantPool()));
+	}
 
-        // Add a single constructor to the class
-        compileConstructor(nodeCounterGen);
+	// Add a single constructor to the class
+	compileConstructor(nodeCounterGen);
 
-        /*
-         * Compile method matchesFrom()
-         */
-        if (_from != null) {
-            il = new InstructionList();
-            matchGen =
-                new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
-                                   com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN,
-                                   new com.sun.org.apache.bcel.internal.generic.Type[] {
-                                       com.sun.org.apache.bcel.internal.generic.Type.INT,
-                                   },
-                                   new String[] {
-                                       "node",
-                                   },
-                                   "matchesFrom", _className, il, cpg);
+	/*
+	 * Compile method matchesFrom()
+	 */
+	if (_from != null) {
+	    il = new InstructionList();
+	    matchGen =
+		new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
+				   com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN, 
+				   new com.sun.org.apache.bcel.internal.generic.Type[] {
+				       com.sun.org.apache.bcel.internal.generic.Type.INT,
+				   },
+				   new String[] {
+				       "node",
+				   },
+				   "matchesFrom", _className, il, cpg);
 
-            compileLocals(nodeCounterGen,matchGen,il);
-
-            // Translate Pattern
-            il.append(matchGen.loadContextNode());
-            _from.translate(nodeCounterGen, matchGen);
-            _from.synthesize(nodeCounterGen, matchGen);
-            il.append(IRETURN);
+	    compileLocals(nodeCounterGen,matchGen,il);
 
-            matchGen.stripAttributes(true);
-            matchGen.setMaxLocals();
-            matchGen.setMaxStack();
-            matchGen.removeNOPs();
-            nodeCounterGen.addMethod(matchGen.getMethod());
-        }
+	    // Translate Pattern
+	    il.append(matchGen.loadContextNode());
+	    _from.translate(nodeCounterGen, matchGen);
+	    _from.synthesize(nodeCounterGen, matchGen);
+	    il.append(IRETURN);
+		    
+	    matchGen.stripAttributes(true);
+	    matchGen.setMaxLocals();
+	    matchGen.setMaxStack();
+	    matchGen.removeNOPs();
+	    nodeCounterGen.addMethod(matchGen.getMethod());
+	}
 
-        /*
-         * Compile method matchesCount()
-         */
-        if (_count != null) {
-            il = new InstructionList();
-            matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
-                                          com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN,
-                                          new com.sun.org.apache.bcel.internal.generic.Type[] {
-                                              com.sun.org.apache.bcel.internal.generic.Type.INT,
-                                          },
-                                          new String[] {
-                                              "node",
-                                          },
-                                          "matchesCount", _className, il, cpg);
-
-            compileLocals(nodeCounterGen,matchGen,il);
-
-            // Translate Pattern
-            il.append(matchGen.loadContextNode());
-            _count.translate(nodeCounterGen, matchGen);
-            _count.synthesize(nodeCounterGen, matchGen);
-
-            il.append(IRETURN);
+	/*
+	 * Compile method matchesCount()
+	 */
+	if (_count != null) {
+	    il = new InstructionList();
+	    matchGen = new MatchGenerator(ACC_PUBLIC | ACC_FINAL,
+					  com.sun.org.apache.bcel.internal.generic.Type.BOOLEAN, 
+					  new com.sun.org.apache.bcel.internal.generic.Type[] {
+					      com.sun.org.apache.bcel.internal.generic.Type.INT,
+					  },
+					  new String[] {
+					      "node",
+					  },
+					  "matchesCount", _className, il, cpg);
 
-            matchGen.stripAttributes(true);
-            matchGen.setMaxLocals();
-            matchGen.setMaxStack();
-            matchGen.removeNOPs();
-            nodeCounterGen.addMethod(matchGen.getMethod());
-        }
+	    compileLocals(nodeCounterGen,matchGen,il);
+	    
+	    // Translate Pattern
+	    il.append(matchGen.loadContextNode());
+	    _count.translate(nodeCounterGen, matchGen);
+	    _count.synthesize(nodeCounterGen, matchGen);
+	    
+	    il.append(IRETURN);
+		    
+	    matchGen.stripAttributes(true);
+	    matchGen.setMaxLocals();
+	    matchGen.setMaxStack();
+	    matchGen.removeNOPs();
+	    nodeCounterGen.addMethod(matchGen.getMethod());
+	}
+	
+	getXSLTC().dumpClass(nodeCounterGen.getJavaClass());
 
-        getXSLTC().dumpClass(nodeCounterGen.getJavaClass());
-
-        // Push an instance of the newly created class
-        cpg = classGen.getConstantPool();
-        il = methodGen.getInstructionList();
+	// Push an instance of the newly created class
+	cpg = classGen.getConstantPool();
+	il = methodGen.getInstructionList();
 
-        final int index = cpg.addMethodref(_className, "<init>",
-                                           "(" + TRANSLET_INTF_SIG
-                                           + DOM_INTF_SIG
-                                           + NODE_ITERATOR_SIG
-                                           + "Z)V");
-        il.append(new NEW(cpg.addClass(_className)));
-        il.append(DUP);
-        il.append(classGen.loadTranslet());
-        il.append(methodGen.loadDOM());
-        il.append(methodGen.loadIterator());
+	final int index = cpg.addMethodref(_className, "<init>", 
+					   "(" + TRANSLET_INTF_SIG
+					   + DOM_INTF_SIG 
+					   + NODE_ITERATOR_SIG
+					   + "Z)V");
+	il.append(new NEW(cpg.addClass(_className)));
+	il.append(DUP);
+	il.append(classGen.loadTranslet());
+	il.append(methodGen.loadDOM());
+	il.append(methodGen.loadIterator());
         il.append(_from != null ? ICONST_1 : ICONST_0);
-        il.append(new INVOKESPECIAL(index));
+	il.append(new INVOKESPECIAL(index));
 
-        // Initialize closure variables
-        for (int i = 0; i < closureLen; i++) {
-            final VariableRefBase varRef = (VariableRefBase) _closureVars.get(i);
-            final VariableBase var = varRef.getVariable();
-            final Type varType = var.getType();
+	// Initialize closure variables
+	for (int i = 0; i < closureLen; i++) {
+	    final VariableRefBase varRef = (VariableRefBase) _closureVars.get(i);
+	    final VariableBase var = varRef.getVariable();
+	    final Type varType = var.getType();
 
-            // Store variable in new closure
-            il.append(DUP);
-            il.append(var.loadInstruction());
-            il.append(new PUTFIELD(
-                    cpg.addFieldref(_className, var.getEscapedName(),
-                        varType.toSignature())));
-        }
+	    // Store variable in new closure
+	    il.append(DUP);
+	    il.append(var.loadInstruction());
+	    il.append(new PUTFIELD(
+		    cpg.addFieldref(_className, var.getEscapedName(), 
+			varType.toSignature())));
+	}
     }
 
     public void translate(ClassGenerator classGen, MethodGenerator methodGen) {
-        int index;
-        final ConstantPoolGen cpg = classGen.getConstantPool();
-        final InstructionList il = methodGen.getInstructionList();
+	int index;
+	final ConstantPoolGen cpg = classGen.getConstantPool();
+	final InstructionList il = methodGen.getInstructionList();
 
-        // Push "this" for the call to characters()
-        il.append(classGen.loadTranslet());
+	// Push "this" for the call to characters()
+	il.append(classGen.loadTranslet());
 
-        if (hasValue()) {
-            compileDefault(classGen, methodGen);
-            _value.translate(classGen, methodGen);
+	if (hasValue()) {
+	    compileDefault(classGen, methodGen);
+	    _value.translate(classGen, methodGen);
 
-            // Using java.lang.Math.floor(number + 0.5) to return a double value
+	    // Using java.lang.Math.floor(number + 0.5) to return a double value
             il.append(new PUSH(cpg, 0.5));
             il.append(DADD);
-            index = cpg.addMethodref(MATH_CLASS, "floor", "(D)D");
-            il.append(new INVOKESTATIC(index));
+	    index = cpg.addMethodref(MATH_CLASS, "floor", "(D)D");
+	    il.append(new INVOKESTATIC(index));
 
-            // Call setValue on the node counter
-            index = cpg.addMethodref(NODE_COUNTER,
-                                     "setValue",
-                                     "(D)" + NODE_COUNTER_SIG);
-            il.append(new INVOKEVIRTUAL(index));
-        }
-        else if (isDefault()) {
-            compileDefault(classGen, methodGen);
-        }
-        else {
-            compilePatterns(classGen, methodGen);
-        }
+	    // Call setValue on the node counter
+	    index = cpg.addMethodref(NODE_COUNTER, 
+				     "setValue", 
+				     "(D)" + NODE_COUNTER_SIG);
+	    il.append(new INVOKEVIRTUAL(index));
+	}
+	else if (isDefault()) {
+	    compileDefault(classGen, methodGen);
+	}
+	else {
+	    compilePatterns(classGen, methodGen);
+	}
 
-        // Call setStartNode()
-        if (!hasValue()) {
-            il.append(methodGen.loadContextNode());
-            index = cpg.addMethodref(NODE_COUNTER,
-                                     SET_START_NODE,
-                                     "(I)" + NODE_COUNTER_SIG);
-            il.append(new INVOKEVIRTUAL(index));
-        }
+	// Call setStartNode() 
+	if (!hasValue()) {
+	    il.append(methodGen.loadContextNode());
+	    index = cpg.addMethodref(NODE_COUNTER, 
+				     SET_START_NODE, 
+				     "(I)" + NODE_COUNTER_SIG);
+	    il.append(new INVOKEVIRTUAL(index));
+	}
 
-        // Call getCounter() with or without args
-        if (_formatNeeded) {
-            if (_format != null) {
-                _format.translate(classGen, methodGen);
-            }
-            else {
-                il.append(new PUSH(cpg, "1"));
-            }
+	// Call getCounter() with or without args
+	if (_formatNeeded) {
+	    if (_format != null) {
+		_format.translate(classGen, methodGen);
+	    }
+	    else {
+		il.append(new PUSH(cpg, "1"));
+	    }
 
-            if (_lang != null) {
-                _lang.translate(classGen, methodGen);
-            }
-            else {
-                il.append(new PUSH(cpg, "en"));         // TODO ??
-            }
+	    if (_lang != null) {
+		_lang.translate(classGen, methodGen);
+	    }
+	    else {
+		il.append(new PUSH(cpg, "en")); 	// TODO ??
+	    }
 
-            if (_letterValue != null) {
-                _letterValue.translate(classGen, methodGen);
-            }
-            else {
-                il.append(new PUSH(cpg, Constants.EMPTYSTRING));
-            }
+	    if (_letterValue != null) {
+		_letterValue.translate(classGen, methodGen);
+	    }
+	    else {
+		il.append(new PUSH(cpg, Constants.EMPTYSTRING));
+	    }
 
-            if (_groupingSeparator != null) {
-                _groupingSeparator.translate(classGen, methodGen);
-            }
-            else {
-                il.append(new PUSH(cpg, Constants.EMPTYSTRING));
-            }
+	    if (_groupingSeparator != null) {
+		_groupingSeparator.translate(classGen, methodGen);
+	    }
+	    else {
+		il.append(new PUSH(cpg, Constants.EMPTYSTRING));
+	    }
 
-            if (_groupingSize != null) {
-                _groupingSize.translate(classGen, methodGen);
-            }
-            else {
-                il.append(new PUSH(cpg, "0"));
-            }
+	    if (_groupingSize != null) {
+		_groupingSize.translate(classGen, methodGen);
+	    }
+	    else {
+		il.append(new PUSH(cpg, "0"));
+	    }
 
-            index = cpg.addMethodref(NODE_COUNTER, "getCounter",
-                                     "(" + STRING_SIG + STRING_SIG
-                                     + STRING_SIG + STRING_SIG
-                                     + STRING_SIG + ")" + STRING_SIG);
-            il.append(new INVOKEVIRTUAL(index));
-        }
-        else {
-            index = cpg.addMethodref(NODE_COUNTER, "setDefaultFormatting",
-                                     "()" + NODE_COUNTER_SIG);
-            il.append(new INVOKEVIRTUAL(index));
+	    index = cpg.addMethodref(NODE_COUNTER, "getCounter", 
+				     "(" + STRING_SIG + STRING_SIG 
+				     + STRING_SIG + STRING_SIG 
+				     + STRING_SIG + ")" + STRING_SIG);
+	    il.append(new INVOKEVIRTUAL(index));
+	}
+	else {
+	    index = cpg.addMethodref(NODE_COUNTER, "setDefaultFormatting", 
+				     "()" + NODE_COUNTER_SIG);
+	    il.append(new INVOKEVIRTUAL(index));
 
-            index = cpg.addMethodref(NODE_COUNTER, "getCounter",
-                                     "()" + STRING_SIG);
-            il.append(new INVOKEVIRTUAL(index));
-        }
+	    index = cpg.addMethodref(NODE_COUNTER, "getCounter", 
+				     "()" + STRING_SIG);
+	    il.append(new INVOKEVIRTUAL(index));
+	}
 
-        // Output the resulting string to the handler
-        il.append(methodGen.loadHandler());
-        index = cpg.addMethodref(TRANSLET_CLASS,
-                                 CHARACTERSW,
-                                 CHARACTERSW_SIG);
-        il.append(new INVOKEVIRTUAL(index));
+	// Output the resulting string to the handler
+	il.append(methodGen.loadHandler());
+	index = cpg.addMethodref(TRANSLET_CLASS,
+				 CHARACTERSW,
+				 CHARACTERSW_SIG);
+	il.append(new INVOKEVIRTUAL(index));
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:41:01 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = 3326843611085065902L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/XPathLexer.java	Wed Sep 28 16:49:43 2011 +0100
@@ -31,20 +31,20 @@
 
 
 class XPathLexer implements com.sun.java_cup.internal.runtime.Scanner {
-        private final int YY_BUFFER_SIZE = 512;
-        private final int YY_F = -1;
-        private final int YY_NO_STATE = -1;
-        private final int YY_NOT_ACCEPT = 0;
-        private final int YY_START = 1;
-        private final int YY_END = 2;
-        private final int YY_NO_ANCHOR = 4;
-        private final int YY_BOL = 65536;
-        private final int YY_EOF = 65537;
-        public final int YYEOF = -1;
+	private final int YY_BUFFER_SIZE = 512;
+	private final int YY_F = -1;
+	private final int YY_NO_STATE = -1;
+	private final int YY_NOT_ACCEPT = 0;
+	private final int YY_START = 1;
+	private final int YY_END = 2;
+	private final int YY_NO_ANCHOR = 4;
+	private final int YY_BOL = 65536;
+	private final int YY_EOF = 65537;
+	public final int YYEOF = -1;
 
-        int last;
+        int last, beforeLast;
         void initialize() {
-            last = -1;
+            last = beforeLast = -1;
         }
         static boolean isWhitespace(int c) {
             return (c == ' ' || c == '\t' || c == '\r' || c == '\n'  || c == '\f');
@@ -52,7 +52,7 @@
         /**
          * If symbol is not followed by '::' or '(', then treat it as a
          * name instead of an axis or function (Jira-1912).
-         */
+         */ 
         Symbol disambiguateAxisOrFunction(int ss) throws Exception {
             // Peek in the input buffer without changing the internal state
             int index = yy_buffer_index;
@@ -72,11 +72,14 @@
         }
         /**
          * If symbol is first token or if it follows any of the operators
-         * listed in http://www.w3.org/TR/xpath#exprlex then treat as a
-         * name instead of a keyword (Jira-1912).
-         */
+         * listed in http://www.w3.org/TR/xpath#exprlex then treat as a 
+         * name instead of a keyword (Jira-1912). Look two tokens behind
+         * to desambiguate expressions like "* and *" or "and * and".
+         */ 
         Symbol disambiguateOperator(int ss) throws Exception {
             switch (last) {
+            case sym.STAR:
+                if (beforeLast != sym.QNAME) break;
             case -1:    // first token
             case sym.ATSIGN:
             case sym.DCOLON:
@@ -87,7 +90,6 @@
             case sym.OR:
             case sym.MOD:
             case sym.DIV:
-            case sym.STAR:
             case sym.SLASH:
             case sym.DSLASH:
             case sym.VBAR:
@@ -104,436 +106,440 @@
             return newSymbol(ss);
         }
         Symbol newSymbol(int ss) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss);
         }
         Symbol newSymbol(int ss, String value) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss, value);
         }
         Symbol newSymbol(int ss, Long value) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss, value);
         }
         Symbol newSymbol(int ss, Double value) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss, value);
         }
-        private java.io.BufferedReader yy_reader;
-        private int yy_buffer_index;
-        private int yy_buffer_read;
-        private int yy_buffer_start;
-        private int yy_buffer_end;
-        private char yy_buffer[];
-        private boolean yy_at_bol;
-        private int yy_lexical_state;
+	private java.io.BufferedReader yy_reader;
+	private int yy_buffer_index;
+	private int yy_buffer_read;
+	private int yy_buffer_start;
+	private int yy_buffer_end;
+	private char yy_buffer[];
+	private boolean yy_at_bol;
+	private int yy_lexical_state;
 
-        XPathLexer (java.io.Reader reader) {
-                this ();
-                if (null == reader) {
-                        throw (new Error("Error: Bad input stream initializer."));
-                }
-                yy_reader = new java.io.BufferedReader(reader);
-        }
+	XPathLexer (java.io.Reader reader) {
+		this ();
+		if (null == reader) {
+			throw (new Error("Error: Bad input stream initializer."));
+		}
+		yy_reader = new java.io.BufferedReader(reader);
+	}
 
-        XPathLexer (java.io.InputStream instream) {
-                this ();
-                if (null == instream) {
-                        throw (new Error("Error: Bad input stream initializer."));
-                }
-                yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
-        }
+	XPathLexer (java.io.InputStream instream) {
+		this ();
+		if (null == instream) {
+			throw (new Error("Error: Bad input stream initializer."));
+		}
+		yy_reader = new java.io.BufferedReader(new java.io.InputStreamReader(instream));
+	}
 
-        private XPathLexer () {
-                yy_buffer = new char[YY_BUFFER_SIZE];
-                yy_buffer_read = 0;
-                yy_buffer_index = 0;
-                yy_buffer_start = 0;
-                yy_buffer_end = 0;
-                yy_at_bol = true;
-                yy_lexical_state = YYINITIAL;
-        }
+	private XPathLexer () {
+		yy_buffer = new char[YY_BUFFER_SIZE];
+		yy_buffer_read = 0;
+		yy_buffer_index = 0;
+		yy_buffer_start = 0;
+		yy_buffer_end = 0;
+		yy_at_bol = true;
+		yy_lexical_state = YYINITIAL;
+	}
 
-        private boolean yy_eof_done = false;
-        private final int YYINITIAL = 0;
-        private final int yy_state_dtrans[] = {
-                0
-        };
-        private void yybegin (int state) {
-                yy_lexical_state = state;
-        }
-        private int yy_advance ()
-                throws java.io.IOException {
-                int next_read;
-                int i;
-                int j;
+	private boolean yy_eof_done = false;
+	private final int YYINITIAL = 0;
+	private final int yy_state_dtrans[] = {
+		0
+	};
+	private void yybegin (int state) {
+		yy_lexical_state = state;
+	}
+	private int yy_advance ()
+		throws java.io.IOException {
+		int next_read;
+		int i;
+		int j;
 
-                if (yy_buffer_index < yy_buffer_read) {
-                        return yy_buffer[yy_buffer_index++];
-                }
+		if (yy_buffer_index < yy_buffer_read) {
+			return yy_buffer[yy_buffer_index++];
+		}
 
-                if (0 != yy_buffer_start) {
-                        i = yy_buffer_start;
-                        j = 0;
-                        while (i < yy_buffer_read) {
-                                yy_buffer[j] = yy_buffer[i];
-                                ++i;
-                                ++j;
-                        }
-                        yy_buffer_end = yy_buffer_end - yy_buffer_start;
-                        yy_buffer_start = 0;
-                        yy_buffer_read = j;
-                        yy_buffer_index = j;
-                        next_read = yy_reader.read(yy_buffer,
-                                        yy_buffer_read,
-                                        yy_buffer.length - yy_buffer_read);
-                        if (-1 == next_read) {
-                                return YY_EOF;
-                        }
-                        yy_buffer_read = yy_buffer_read + next_read;
-                }
+		if (0 != yy_buffer_start) {
+			i = yy_buffer_start;
+			j = 0;
+			while (i < yy_buffer_read) {
+				yy_buffer[j] = yy_buffer[i];
+				++i;
+				++j;
+			}
+			yy_buffer_end = yy_buffer_end - yy_buffer_start;
+			yy_buffer_start = 0;
+			yy_buffer_read = j;
+			yy_buffer_index = j;
+			next_read = yy_reader.read(yy_buffer,
+					yy_buffer_read,
+					yy_buffer.length - yy_buffer_read);
+			if (-1 == next_read) {
+				return YY_EOF;
+			}
+			yy_buffer_read = yy_buffer_read + next_read;
+		}
 
-                while (yy_buffer_index >= yy_buffer_read) {
-                        if (yy_buffer_index >= yy_buffer.length) {
-                                yy_buffer = yy_double(yy_buffer);
-                        }
-                        next_read = yy_reader.read(yy_buffer,
-                                        yy_buffer_read,
-                                        yy_buffer.length - yy_buffer_read);
-                        if (-1 == next_read) {
-                                return YY_EOF;
-                        }
-                        yy_buffer_read = yy_buffer_read + next_read;
-                }
-                return yy_buffer[yy_buffer_index++];
-        }
-        private void yy_move_end () {
-                if (yy_buffer_end > yy_buffer_start &&
-                    '\n' == yy_buffer[yy_buffer_end-1])
-                        yy_buffer_end--;
-                if (yy_buffer_end > yy_buffer_start &&
-                    '\r' == yy_buffer[yy_buffer_end-1])
-                        yy_buffer_end--;
-        }
-        private boolean yy_last_was_cr=false;
-        private void yy_mark_start () {
-                yy_buffer_start = yy_buffer_index;
-        }
-        private void yy_mark_end () {
-                yy_buffer_end = yy_buffer_index;
-        }
-        private void yy_to_mark () {
-                yy_buffer_index = yy_buffer_end;
-                yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
-                            ('\r' == yy_buffer[yy_buffer_end-1] ||
-                             '\n' == yy_buffer[yy_buffer_end-1] ||
-                             2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
-                             2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
-        }
-        private java.lang.String yytext () {
-                return (new java.lang.String(yy_buffer,
-                        yy_buffer_start,
-                        yy_buffer_end - yy_buffer_start));
-        }
-        private int yylength () {
-                return yy_buffer_end - yy_buffer_start;
-        }
-        private char[] yy_double (char buf[]) {
-                int i;
-                char newbuf[];
-                newbuf = new char[2*buf.length];
-                for (i = 0; i < buf.length; ++i) {
-                        newbuf[i] = buf[i];
-                }
-                return newbuf;
-        }
-        private final int YY_E_INTERNAL = 0;
-        private final int YY_E_MATCH = 1;
-        private java.lang.String yy_error_string[] = {
-                "Error: Internal error.\n",
-                "Error: Unmatched input.\n"
-        };
-        private void yy_error (int code,boolean fatal) {
-                java.lang.System.out.print(yy_error_string[code]);
-                java.lang.System.out.flush();
-                if (fatal) {
-                        throw new Error("Fatal Error.\n");
-                }
-        }
-        static private int[][] unpackFromString(int size1, int size2, String st) {
-                int colonIndex = -1;
-                String lengthString;
-                int sequenceLength = 0;
-                int sequenceInteger = 0;
+		while (yy_buffer_index >= yy_buffer_read) {
+			if (yy_buffer_index >= yy_buffer.length) {
+				yy_buffer = yy_double(yy_buffer);
+			}
+			next_read = yy_reader.read(yy_buffer,
+					yy_buffer_read,
+					yy_buffer.length - yy_buffer_read);
+			if (-1 == next_read) {
+				return YY_EOF;
+			}
+			yy_buffer_read = yy_buffer_read + next_read;
+		}
+		return yy_buffer[yy_buffer_index++];
+	}
+	private void yy_move_end () {
+		if (yy_buffer_end > yy_buffer_start &&
+		    '\n' == yy_buffer[yy_buffer_end-1])
+			yy_buffer_end--;
+		if (yy_buffer_end > yy_buffer_start &&
+		    '\r' == yy_buffer[yy_buffer_end-1])
+			yy_buffer_end--;
+	}
+	private boolean yy_last_was_cr=false;
+	private void yy_mark_start () {
+		yy_buffer_start = yy_buffer_index;
+	}
+	private void yy_mark_end () {
+		yy_buffer_end = yy_buffer_index;
+	}
+	private void yy_to_mark () {
+		yy_buffer_index = yy_buffer_end;
+		yy_at_bol = (yy_buffer_end > yy_buffer_start) &&
+		            ('\r' == yy_buffer[yy_buffer_end-1] ||
+		             '\n' == yy_buffer[yy_buffer_end-1] ||
+		             2028/*LS*/ == yy_buffer[yy_buffer_end-1] ||
+		             2029/*PS*/ == yy_buffer[yy_buffer_end-1]);
+	}
+	private java.lang.String yytext () {
+		return (new java.lang.String(yy_buffer,
+			yy_buffer_start,
+			yy_buffer_end - yy_buffer_start));
+	}
+	private int yylength () {
+		return yy_buffer_end - yy_buffer_start;
+	}
+	private char[] yy_double (char buf[]) {
+		int i;
+		char newbuf[];
+		newbuf = new char[2*buf.length];
+		for (i = 0; i < buf.length; ++i) {
+			newbuf[i] = buf[i];
+		}
+		return newbuf;
+	}
+	private final int YY_E_INTERNAL = 0;
+	private final int YY_E_MATCH = 1;
+	private java.lang.String yy_error_string[] = {
+		"Error: Internal error.\n",
+		"Error: Unmatched input.\n"
+	};
+	private void yy_error (int code,boolean fatal) {
+		java.lang.System.out.print(yy_error_string[code]);
+		java.lang.System.out.flush();
+		if (fatal) {
+			throw new Error("Fatal Error.\n");
+		}
+	}
+	static private int[][] unpackFromString(int size1, int size2, String st) {
+		int colonIndex = -1;
+		String lengthString;
+		int sequenceLength = 0;
+		int sequenceInteger = 0;
 
-                int commaIndex;
-                String workString;
+		int commaIndex;
+		String workString;
 
-                int res[][] = new int[size1][size2];
-                for (int i= 0; i < size1; i++) {
-                        for (int j= 0; j < size2; j++) {
-                                if (sequenceLength != 0) {
-                                        res[i][j] = sequenceInteger;
-                                        sequenceLength--;
-                                        continue;
-                                }
-                                commaIndex = st.indexOf(',');
-                                workString = (commaIndex==-1) ? st :
-                                        st.substring(0, commaIndex);
-                                st = st.substring(commaIndex+1);
-                                colonIndex = workString.indexOf(':');
-                                if (colonIndex == -1) {
-                                        res[i][j]=Integer.parseInt(workString);
-                                        continue;
-                                }
-                                lengthString =
-                                        workString.substring(colonIndex+1);
-                                sequenceLength=Integer.parseInt(lengthString);
-                                workString=workString.substring(0,colonIndex);
-                                sequenceInteger=Integer.parseInt(workString);
-                                res[i][j] = sequenceInteger;
-                                sequenceLength--;
-                        }
-                }
-                return res;
-        }
-        private int yy_acpt[] = {
-                /* 0 */ YY_NOT_ACCEPT,
-                /* 1 */ YY_NO_ANCHOR,
-                /* 2 */ YY_NO_ANCHOR,
-                /* 3 */ YY_NO_ANCHOR,
-                /* 4 */ YY_NO_ANCHOR,
-                /* 5 */ YY_NO_ANCHOR,
-                /* 6 */ YY_NO_ANCHOR,
-                /* 7 */ YY_NO_ANCHOR,
-                /* 8 */ YY_NO_ANCHOR,
-                /* 9 */ YY_NO_ANCHOR,
-                /* 10 */ YY_NO_ANCHOR,
-                /* 11 */ YY_NO_ANCHOR,
-                /* 12 */ YY_NO_ANCHOR,
-                /* 13 */ YY_NO_ANCHOR,
-                /* 14 */ YY_NO_ANCHOR,
-                /* 15 */ YY_NO_ANCHOR,
-                /* 16 */ YY_NO_ANCHOR,
-                /* 17 */ YY_NO_ANCHOR,
-                /* 18 */ YY_NO_ANCHOR,
-                /* 19 */ YY_NO_ANCHOR,
-                /* 20 */ YY_NO_ANCHOR,
-                /* 21 */ YY_NO_ANCHOR,
-                /* 22 */ YY_NO_ANCHOR,
-                /* 23 */ YY_NO_ANCHOR,
-                /* 24 */ YY_NO_ANCHOR,
-                /* 25 */ YY_NO_ANCHOR,
-                /* 26 */ YY_NO_ANCHOR,
-                /* 27 */ YY_NO_ANCHOR,
-                /* 28 */ YY_NO_ANCHOR,
-                /* 29 */ YY_NO_ANCHOR,
-                /* 30 */ YY_NO_ANCHOR,
-                /* 31 */ YY_NO_ANCHOR,
-                /* 32 */ YY_NO_ANCHOR,
-                /* 33 */ YY_NO_ANCHOR,
-                /* 34 */ YY_NO_ANCHOR,
-                /* 35 */ YY_NO_ANCHOR,
-                /* 36 */ YY_NO_ANCHOR,
-                /* 37 */ YY_NO_ANCHOR,
-                /* 38 */ YY_NO_ANCHOR,
-                /* 39 */ YY_NO_ANCHOR,
-                /* 40 */ YY_NO_ANCHOR,
-                /* 41 */ YY_NO_ANCHOR,
-                /* 42 */ YY_NO_ANCHOR,
-                /* 43 */ YY_NO_ANCHOR,
-                /* 44 */ YY_NO_ANCHOR,
-                /* 45 */ YY_NO_ANCHOR,
-                /* 46 */ YY_NO_ANCHOR,
-                /* 47 */ YY_NO_ANCHOR,
-                /* 48 */ YY_NO_ANCHOR,
-                /* 49 */ YY_NO_ANCHOR,
-                /* 50 */ YY_NO_ANCHOR,
-                /* 51 */ YY_NO_ANCHOR,
-                /* 52 */ YY_NO_ANCHOR,
-                /* 53 */ YY_NO_ANCHOR,
-                /* 54 */ YY_NO_ANCHOR,
-                /* 55 */ YY_NO_ANCHOR,
-                /* 56 */ YY_NO_ANCHOR,
-                /* 57 */ YY_NO_ANCHOR,
-                /* 58 */ YY_NO_ANCHOR,
-                /* 59 */ YY_NO_ANCHOR,
-                /* 60 */ YY_NO_ANCHOR,
-                /* 61 */ YY_NO_ANCHOR,
-                /* 62 */ YY_NO_ANCHOR,
-                /* 63 */ YY_NO_ANCHOR,
-                /* 64 */ YY_NOT_ACCEPT,
-                /* 65 */ YY_NO_ANCHOR,
-                /* 66 */ YY_NO_ANCHOR,
-                /* 67 */ YY_NO_ANCHOR,
-                /* 68 */ YY_NO_ANCHOR,
-                /* 69 */ YY_NOT_ACCEPT,
-                /* 70 */ YY_NO_ANCHOR,
-                /* 71 */ YY_NO_ANCHOR,
-                /* 72 */ YY_NOT_ACCEPT,
-                /* 73 */ YY_NO_ANCHOR,
-                /* 74 */ YY_NO_ANCHOR,
-                /* 75 */ YY_NOT_ACCEPT,
-                /* 76 */ YY_NO_ANCHOR,
-                /* 77 */ YY_NO_ANCHOR,
-                /* 78 */ YY_NOT_ACCEPT,
-                /* 79 */ YY_NO_ANCHOR,
-                /* 80 */ YY_NOT_ACCEPT,
-                /* 81 */ YY_NO_ANCHOR,
-                /* 82 */ YY_NOT_ACCEPT,
-                /* 83 */ YY_NO_ANCHOR,
-                /* 84 */ YY_NOT_ACCEPT,
-                /* 85 */ YY_NO_ANCHOR,
-                /* 86 */ YY_NOT_ACCEPT,
-                /* 87 */ YY_NO_ANCHOR,
-                /* 88 */ YY_NOT_ACCEPT,
-                /* 89 */ YY_NO_ANCHOR,
-                /* 90 */ YY_NOT_ACCEPT,
-                /* 91 */ YY_NO_ANCHOR,
-                /* 92 */ YY_NOT_ACCEPT,
-                /* 93 */ YY_NO_ANCHOR,
-                /* 94 */ YY_NOT_ACCEPT,
-                /* 95 */ YY_NO_ANCHOR,
-                /* 96 */ YY_NOT_ACCEPT,
-                /* 97 */ YY_NO_ANCHOR,
-                /* 98 */ YY_NOT_ACCEPT,
-                /* 99 */ YY_NO_ANCHOR,
-                /* 100 */ YY_NOT_ACCEPT,
-                /* 101 */ YY_NO_ANCHOR,
-                /* 102 */ YY_NOT_ACCEPT,
-                /* 103 */ YY_NO_ANCHOR,
-                /* 104 */ YY_NOT_ACCEPT,
-                /* 105 */ YY_NO_ANCHOR,
-                /* 106 */ YY_NOT_ACCEPT,
-                /* 107 */ YY_NO_ANCHOR,
-                /* 108 */ YY_NOT_ACCEPT,
-                /* 109 */ YY_NO_ANCHOR,
-                /* 110 */ YY_NOT_ACCEPT,
-                /* 111 */ YY_NO_ANCHOR,
-                /* 112 */ YY_NOT_ACCEPT,
-                /* 113 */ YY_NO_ANCHOR,
-                /* 114 */ YY_NOT_ACCEPT,
-                /* 115 */ YY_NO_ANCHOR,
-                /* 116 */ YY_NOT_ACCEPT,
-                /* 117 */ YY_NO_ANCHOR,
-                /* 118 */ YY_NOT_ACCEPT,
-                /* 119 */ YY_NO_ANCHOR,
-                /* 120 */ YY_NOT_ACCEPT,
-                /* 121 */ YY_NO_ANCHOR,
-                /* 122 */ YY_NOT_ACCEPT,
-                /* 123 */ YY_NO_ANCHOR,
-                /* 124 */ YY_NOT_ACCEPT,
-                /* 125 */ YY_NO_ANCHOR,
-                /* 126 */ YY_NOT_ACCEPT,
-                /* 127 */ YY_NO_ANCHOR,
-                /* 128 */ YY_NO_ANCHOR,
-                /* 129 */ YY_NO_ANCHOR,
-                /* 130 */ YY_NO_ANCHOR,
-                /* 131 */ YY_NO_ANCHOR,
-                /* 132 */ YY_NO_ANCHOR,
-                /* 133 */ YY_NO_ANCHOR,
-                /* 134 */ YY_NO_ANCHOR,
-                /* 135 */ YY_NO_ANCHOR,
-                /* 136 */ YY_NO_ANCHOR,
-                /* 137 */ YY_NO_ANCHOR,
-                /* 138 */ YY_NO_ANCHOR,
-                /* 139 */ YY_NO_ANCHOR,
-                /* 140 */ YY_NO_ANCHOR,
-                /* 141 */ YY_NO_ANCHOR,
-                /* 142 */ YY_NO_ANCHOR,
-                /* 143 */ YY_NO_ANCHOR,
-                /* 144 */ YY_NO_ANCHOR,
-                /* 145 */ YY_NO_ANCHOR,
-                /* 146 */ YY_NO_ANCHOR,
-                /* 147 */ YY_NO_ANCHOR,
-                /* 148 */ YY_NO_ANCHOR,
-                /* 149 */ YY_NO_ANCHOR,
-                /* 150 */ YY_NO_ANCHOR,
-                /* 151 */ YY_NO_ANCHOR,
-                /* 152 */ YY_NO_ANCHOR,
-                /* 153 */ YY_NO_ANCHOR,
-                /* 154 */ YY_NO_ANCHOR,
-                /* 155 */ YY_NO_ANCHOR,
-                /* 156 */ YY_NO_ANCHOR,
-                /* 157 */ YY_NO_ANCHOR,
-                /* 158 */ YY_NO_ANCHOR,
-                /* 159 */ YY_NO_ANCHOR,
-                /* 160 */ YY_NO_ANCHOR,
-                /* 161 */ YY_NO_ANCHOR,
-                /* 162 */ YY_NO_ANCHOR,
-                /* 163 */ YY_NO_ANCHOR,
-                /* 164 */ YY_NO_ANCHOR,
-                /* 165 */ YY_NO_ANCHOR,
-                /* 166 */ YY_NO_ANCHOR,
-                /* 167 */ YY_NO_ANCHOR,
-                /* 168 */ YY_NO_ANCHOR,
-                /* 169 */ YY_NO_ANCHOR,
-                /* 170 */ YY_NO_ANCHOR,
-                /* 171 */ YY_NO_ANCHOR,
-                /* 172 */ YY_NO_ANCHOR,
-                /* 173 */ YY_NO_ANCHOR,
-                /* 174 */ YY_NO_ANCHOR,
-                /* 175 */ YY_NO_ANCHOR,
-                /* 176 */ YY_NO_ANCHOR,
-                /* 177 */ YY_NO_ANCHOR,
-                /* 178 */ YY_NO_ANCHOR,
-                /* 179 */ YY_NO_ANCHOR,
-                /* 180 */ YY_NO_ANCHOR,
-                /* 181 */ YY_NO_ANCHOR,
-                /* 182 */ YY_NO_ANCHOR,
-                /* 183 */ YY_NO_ANCHOR,
-                /* 184 */ YY_NO_ANCHOR,
-                /* 185 */ YY_NOT_ACCEPT,
-                /* 186 */ YY_NOT_ACCEPT,
-                /* 187 */ YY_NO_ANCHOR,
-                /* 188 */ YY_NOT_ACCEPT,
-                /* 189 */ YY_NO_ANCHOR,
-                /* 190 */ YY_NOT_ACCEPT,
-                /* 191 */ YY_NO_ANCHOR,
-                /* 192 */ YY_NO_ANCHOR,
-                /* 193 */ YY_NO_ANCHOR,
-                /* 194 */ YY_NO_ANCHOR,
-                /* 195 */ YY_NO_ANCHOR,
-                /* 196 */ YY_NO_ANCHOR,
-                /* 197 */ YY_NO_ANCHOR,
-                /* 198 */ YY_NO_ANCHOR,
-                /* 199 */ YY_NO_ANCHOR,
-                /* 200 */ YY_NO_ANCHOR,
-                /* 201 */ YY_NO_ANCHOR,
-                /* 202 */ YY_NO_ANCHOR,
-                /* 203 */ YY_NO_ANCHOR,
-                /* 204 */ YY_NO_ANCHOR,
-                /* 205 */ YY_NO_ANCHOR,
-                /* 206 */ YY_NO_ANCHOR,
-                /* 207 */ YY_NO_ANCHOR,
-                /* 208 */ YY_NO_ANCHOR,
-                /* 209 */ YY_NO_ANCHOR,
-                /* 210 */ YY_NO_ANCHOR,
-                /* 211 */ YY_NO_ANCHOR,
-                /* 212 */ YY_NO_ANCHOR,
-                /* 213 */ YY_NO_ANCHOR,
-                /* 214 */ YY_NO_ANCHOR,
-                /* 215 */ YY_NO_ANCHOR,
-                /* 216 */ YY_NO_ANCHOR,
-                /* 217 */ YY_NO_ANCHOR,
-                /* 218 */ YY_NO_ANCHOR,
-                /* 219 */ YY_NO_ANCHOR,
-                /* 220 */ YY_NO_ANCHOR,
-                /* 221 */ YY_NO_ANCHOR,
-                /* 222 */ YY_NO_ANCHOR,
-                /* 223 */ YY_NO_ANCHOR,
-                /* 224 */ YY_NO_ANCHOR,
-                /* 225 */ YY_NO_ANCHOR,
-                /* 226 */ YY_NO_ANCHOR,
-                /* 227 */ YY_NO_ANCHOR,
-                /* 228 */ YY_NO_ANCHOR,
-                /* 229 */ YY_NO_ANCHOR,
-                /* 230 */ YY_NO_ANCHOR,
-                /* 231 */ YY_NO_ANCHOR,
-                /* 232 */ YY_NO_ANCHOR,
-                /* 233 */ YY_NO_ANCHOR
-        };
-        static private int yy_cmap[] = unpackFromString(1,65538,
+		int res[][] = new int[size1][size2];
+		for (int i= 0; i < size1; i++) {
+			for (int j= 0; j < size2; j++) {
+				if (sequenceLength != 0) {
+					res[i][j] = sequenceInteger;
+					sequenceLength--;
+					continue;
+				}
+				commaIndex = st.indexOf(',');
+				workString = (commaIndex==-1) ? st :
+					st.substring(0, commaIndex);
+				st = st.substring(commaIndex+1);
+				colonIndex = workString.indexOf(':');
+				if (colonIndex == -1) {
+					res[i][j]=Integer.parseInt(workString);
+					continue;
+				}
+				lengthString =
+					workString.substring(colonIndex+1);
+				sequenceLength=Integer.parseInt(lengthString);
+				workString=workString.substring(0,colonIndex);
+				sequenceInteger=Integer.parseInt(workString);
+				res[i][j] = sequenceInteger;
+				sequenceLength--;
+			}
+		}
+		return res;
+	}
+	private int yy_acpt[] = {
+		/* 0 */ YY_NOT_ACCEPT,
+		/* 1 */ YY_NO_ANCHOR,
+		/* 2 */ YY_NO_ANCHOR,
+		/* 3 */ YY_NO_ANCHOR,
+		/* 4 */ YY_NO_ANCHOR,
+		/* 5 */ YY_NO_ANCHOR,
+		/* 6 */ YY_NO_ANCHOR,
+		/* 7 */ YY_NO_ANCHOR,
+		/* 8 */ YY_NO_ANCHOR,
+		/* 9 */ YY_NO_ANCHOR,
+		/* 10 */ YY_NO_ANCHOR,
+		/* 11 */ YY_NO_ANCHOR,
+		/* 12 */ YY_NO_ANCHOR,
+		/* 13 */ YY_NO_ANCHOR,
+		/* 14 */ YY_NO_ANCHOR,
+		/* 15 */ YY_NO_ANCHOR,
+		/* 16 */ YY_NO_ANCHOR,
+		/* 17 */ YY_NO_ANCHOR,
+		/* 18 */ YY_NO_ANCHOR,
+		/* 19 */ YY_NO_ANCHOR,
+		/* 20 */ YY_NO_ANCHOR,
+		/* 21 */ YY_NO_ANCHOR,
+		/* 22 */ YY_NO_ANCHOR,
+		/* 23 */ YY_NO_ANCHOR,
+		/* 24 */ YY_NO_ANCHOR,
+		/* 25 */ YY_NO_ANCHOR,
+		/* 26 */ YY_NO_ANCHOR,
+		/* 27 */ YY_NO_ANCHOR,
+		/* 28 */ YY_NO_ANCHOR,
+		/* 29 */ YY_NO_ANCHOR,
+		/* 30 */ YY_NO_ANCHOR,
+		/* 31 */ YY_NO_ANCHOR,
+		/* 32 */ YY_NO_ANCHOR,
+		/* 33 */ YY_NO_ANCHOR,
+		/* 34 */ YY_NO_ANCHOR,
+		/* 35 */ YY_NO_ANCHOR,
+		/* 36 */ YY_NO_ANCHOR,
+		/* 37 */ YY_NO_ANCHOR,
+		/* 38 */ YY_NO_ANCHOR,
+		/* 39 */ YY_NO_ANCHOR,
+		/* 40 */ YY_NO_ANCHOR,
+		/* 41 */ YY_NO_ANCHOR,
+		/* 42 */ YY_NO_ANCHOR,
+		/* 43 */ YY_NO_ANCHOR,
+		/* 44 */ YY_NO_ANCHOR,
+		/* 45 */ YY_NO_ANCHOR,
+		/* 46 */ YY_NO_ANCHOR,
+		/* 47 */ YY_NO_ANCHOR,
+		/* 48 */ YY_NO_ANCHOR,
+		/* 49 */ YY_NO_ANCHOR,
+		/* 50 */ YY_NO_ANCHOR,
+		/* 51 */ YY_NO_ANCHOR,
+		/* 52 */ YY_NO_ANCHOR,
+		/* 53 */ YY_NO_ANCHOR,
+		/* 54 */ YY_NO_ANCHOR,
+		/* 55 */ YY_NO_ANCHOR,
+		/* 56 */ YY_NO_ANCHOR,
+		/* 57 */ YY_NO_ANCHOR,
+		/* 58 */ YY_NO_ANCHOR,
+		/* 59 */ YY_NO_ANCHOR,
+		/* 60 */ YY_NO_ANCHOR,
+		/* 61 */ YY_NO_ANCHOR,
+		/* 62 */ YY_NO_ANCHOR,
+		/* 63 */ YY_NO_ANCHOR,
+		/* 64 */ YY_NOT_ACCEPT,
+		/* 65 */ YY_NO_ANCHOR,
+		/* 66 */ YY_NO_ANCHOR,
+		/* 67 */ YY_NO_ANCHOR,
+		/* 68 */ YY_NO_ANCHOR,
+		/* 69 */ YY_NOT_ACCEPT,
+		/* 70 */ YY_NO_ANCHOR,
+		/* 71 */ YY_NO_ANCHOR,
+		/* 72 */ YY_NOT_ACCEPT,
+		/* 73 */ YY_NO_ANCHOR,
+		/* 74 */ YY_NO_ANCHOR,
+		/* 75 */ YY_NOT_ACCEPT,
+		/* 76 */ YY_NO_ANCHOR,
+		/* 77 */ YY_NO_ANCHOR,
+		/* 78 */ YY_NOT_ACCEPT,
+		/* 79 */ YY_NO_ANCHOR,
+		/* 80 */ YY_NOT_ACCEPT,
+		/* 81 */ YY_NO_ANCHOR,
+		/* 82 */ YY_NOT_ACCEPT,
+		/* 83 */ YY_NO_ANCHOR,
+		/* 84 */ YY_NOT_ACCEPT,
+		/* 85 */ YY_NO_ANCHOR,
+		/* 86 */ YY_NOT_ACCEPT,
+		/* 87 */ YY_NO_ANCHOR,
+		/* 88 */ YY_NOT_ACCEPT,
+		/* 89 */ YY_NO_ANCHOR,
+		/* 90 */ YY_NOT_ACCEPT,
+		/* 91 */ YY_NO_ANCHOR,
+		/* 92 */ YY_NOT_ACCEPT,
+		/* 93 */ YY_NO_ANCHOR,
+		/* 94 */ YY_NOT_ACCEPT,
+		/* 95 */ YY_NO_ANCHOR,
+		/* 96 */ YY_NOT_ACCEPT,
+		/* 97 */ YY_NO_ANCHOR,
+		/* 98 */ YY_NOT_ACCEPT,
+		/* 99 */ YY_NO_ANCHOR,
+		/* 100 */ YY_NOT_ACCEPT,
+		/* 101 */ YY_NO_ANCHOR,
+		/* 102 */ YY_NOT_ACCEPT,
+		/* 103 */ YY_NO_ANCHOR,
+		/* 104 */ YY_NOT_ACCEPT,
+		/* 105 */ YY_NO_ANCHOR,
+		/* 106 */ YY_NOT_ACCEPT,
+		/* 107 */ YY_NO_ANCHOR,
+		/* 108 */ YY_NOT_ACCEPT,
+		/* 109 */ YY_NO_ANCHOR,
+		/* 110 */ YY_NOT_ACCEPT,
+		/* 111 */ YY_NO_ANCHOR,
+		/* 112 */ YY_NOT_ACCEPT,
+		/* 113 */ YY_NO_ANCHOR,
+		/* 114 */ YY_NOT_ACCEPT,
+		/* 115 */ YY_NO_ANCHOR,
+		/* 116 */ YY_NOT_ACCEPT,
+		/* 117 */ YY_NO_ANCHOR,
+		/* 118 */ YY_NOT_ACCEPT,
+		/* 119 */ YY_NO_ANCHOR,
+		/* 120 */ YY_NOT_ACCEPT,
+		/* 121 */ YY_NO_ANCHOR,
+		/* 122 */ YY_NOT_ACCEPT,
+		/* 123 */ YY_NO_ANCHOR,
+		/* 124 */ YY_NOT_ACCEPT,
+		/* 125 */ YY_NO_ANCHOR,
+		/* 126 */ YY_NOT_ACCEPT,
+		/* 127 */ YY_NO_ANCHOR,
+		/* 128 */ YY_NO_ANCHOR,
+		/* 129 */ YY_NO_ANCHOR,
+		/* 130 */ YY_NO_ANCHOR,
+		/* 131 */ YY_NO_ANCHOR,
+		/* 132 */ YY_NO_ANCHOR,
+		/* 133 */ YY_NO_ANCHOR,
+		/* 134 */ YY_NO_ANCHOR,
+		/* 135 */ YY_NO_ANCHOR,
+		/* 136 */ YY_NO_ANCHOR,
+		/* 137 */ YY_NO_ANCHOR,
+		/* 138 */ YY_NO_ANCHOR,
+		/* 139 */ YY_NO_ANCHOR,
+		/* 140 */ YY_NO_ANCHOR,
+		/* 141 */ YY_NO_ANCHOR,
+		/* 142 */ YY_NO_ANCHOR,
+		/* 143 */ YY_NO_ANCHOR,
+		/* 144 */ YY_NO_ANCHOR,
+		/* 145 */ YY_NO_ANCHOR,
+		/* 146 */ YY_NO_ANCHOR,
+		/* 147 */ YY_NO_ANCHOR,
+		/* 148 */ YY_NO_ANCHOR,
+		/* 149 */ YY_NO_ANCHOR,
+		/* 150 */ YY_NO_ANCHOR,
+		/* 151 */ YY_NO_ANCHOR,
+		/* 152 */ YY_NO_ANCHOR,
+		/* 153 */ YY_NO_ANCHOR,
+		/* 154 */ YY_NO_ANCHOR,
+		/* 155 */ YY_NO_ANCHOR,
+		/* 156 */ YY_NO_ANCHOR,
+		/* 157 */ YY_NO_ANCHOR,
+		/* 158 */ YY_NO_ANCHOR,
+		/* 159 */ YY_NO_ANCHOR,
+		/* 160 */ YY_NO_ANCHOR,
+		/* 161 */ YY_NO_ANCHOR,
+		/* 162 */ YY_NO_ANCHOR,
+		/* 163 */ YY_NO_ANCHOR,
+		/* 164 */ YY_NO_ANCHOR,
+		/* 165 */ YY_NO_ANCHOR,
+		/* 166 */ YY_NO_ANCHOR,
+		/* 167 */ YY_NO_ANCHOR,
+		/* 168 */ YY_NO_ANCHOR,
+		/* 169 */ YY_NO_ANCHOR,
+		/* 170 */ YY_NO_ANCHOR,
+		/* 171 */ YY_NO_ANCHOR,
+		/* 172 */ YY_NO_ANCHOR,
+		/* 173 */ YY_NO_ANCHOR,
+		/* 174 */ YY_NO_ANCHOR,
+		/* 175 */ YY_NO_ANCHOR,
+		/* 176 */ YY_NO_ANCHOR,
+		/* 177 */ YY_NO_ANCHOR,
+		/* 178 */ YY_NO_ANCHOR,
+		/* 179 */ YY_NO_ANCHOR,
+		/* 180 */ YY_NO_ANCHOR,
+		/* 181 */ YY_NO_ANCHOR,
+		/* 182 */ YY_NO_ANCHOR,
+		/* 183 */ YY_NO_ANCHOR,
+		/* 184 */ YY_NO_ANCHOR,
+		/* 185 */ YY_NOT_ACCEPT,
+		/* 186 */ YY_NOT_ACCEPT,
+		/* 187 */ YY_NO_ANCHOR,
+		/* 188 */ YY_NOT_ACCEPT,
+		/* 189 */ YY_NO_ANCHOR,
+		/* 190 */ YY_NOT_ACCEPT,
+		/* 191 */ YY_NO_ANCHOR,
+		/* 192 */ YY_NO_ANCHOR,
+		/* 193 */ YY_NO_ANCHOR,
+		/* 194 */ YY_NO_ANCHOR,
+		/* 195 */ YY_NO_ANCHOR,
+		/* 196 */ YY_NO_ANCHOR,
+		/* 197 */ YY_NO_ANCHOR,
+		/* 198 */ YY_NO_ANCHOR,
+		/* 199 */ YY_NO_ANCHOR,
+		/* 200 */ YY_NO_ANCHOR,
+		/* 201 */ YY_NO_ANCHOR,
+		/* 202 */ YY_NO_ANCHOR,
+		/* 203 */ YY_NO_ANCHOR,
+		/* 204 */ YY_NO_ANCHOR,
+		/* 205 */ YY_NO_ANCHOR,
+		/* 206 */ YY_NO_ANCHOR,
+		/* 207 */ YY_NO_ANCHOR,
+		/* 208 */ YY_NO_ANCHOR,
+		/* 209 */ YY_NO_ANCHOR,
+		/* 210 */ YY_NO_ANCHOR,
+		/* 211 */ YY_NO_ANCHOR,
+		/* 212 */ YY_NO_ANCHOR,
+		/* 213 */ YY_NO_ANCHOR,
+		/* 214 */ YY_NO_ANCHOR,
+		/* 215 */ YY_NO_ANCHOR,
+		/* 216 */ YY_NO_ANCHOR,
+		/* 217 */ YY_NO_ANCHOR,
+		/* 218 */ YY_NO_ANCHOR,
+		/* 219 */ YY_NO_ANCHOR,
+		/* 220 */ YY_NO_ANCHOR,
+		/* 221 */ YY_NO_ANCHOR,
+		/* 222 */ YY_NO_ANCHOR,
+		/* 223 */ YY_NO_ANCHOR,
+		/* 224 */ YY_NO_ANCHOR,
+		/* 225 */ YY_NO_ANCHOR,
+		/* 226 */ YY_NO_ANCHOR,
+		/* 227 */ YY_NO_ANCHOR,
+		/* 228 */ YY_NO_ANCHOR,
+		/* 229 */ YY_NO_ANCHOR,
+		/* 230 */ YY_NO_ANCHOR,
+		/* 231 */ YY_NO_ANCHOR,
+		/* 232 */ YY_NO_ANCHOR,
+		/* 233 */ YY_NO_ANCHOR
+	};
+	static private int yy_cmap[] = unpackFromString(1,65538,
 "54:9,27:2,54,27:2,54:18,27,17,53,54,15,54:2,55,25,26,1,3,11,4,13,2,56:10,10" +
 ",54,18,16,19,54,12,44,57:3,46,57:3,51,57:4,48,52,43,57,47,50,45,57:3,49,57:" +
 "2,41,54,42,54,58,54,35,38,29,5,21,39,33,36,6,57,20,37,8,28,9,30,57,31,32,23" +
@@ -567,7 +573,7 @@
 ":1008,54:17,58:64,57:84,58:12,57:90,58:10,57:40,58:31443,57:11172,58:92,54:" +
 "8448,58:1232,54:32,58:526,54:2,0:2")[0];
 
-        static private int yy_rmap[] = unpackFromString(1,234,
+	static private int yy_rmap[] = unpackFromString(1,234,
 "0,1:2,2,1:2,3,4,1,5,6,1:3,7,8,1:5,9,1,10:2,1:3,11,1:5,12,10,1,10:5,1:2,10,1" +
 ":2,13,1,10,1,14,10,15,16,1:2,10:4,17,1:2,18,19,20,21,22,23,24,25,26,27,1,25" +
 ",10,28:2,29,5,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,5" +
@@ -579,7 +585,7 @@
 ",156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,17" +
 "4,175,176,177,178,179,180,181")[0];
 
-        static private int yy_nxt[][] = unpackFromString(182,61,
+	static private int yy_nxt[][] = unpackFromString(182,61,
 "1,2,3,4,5,6,65,184,204,70,7,8,9,10,11,12,13,66,14,15,211,184:2,215,184,16,1" +
 "7,18,218,220,221,184,222,184:2,223,184:3,224,184,19,20,184:10,71,74,77,21,1" +
 "84:2,67,74,-1:63,22,-1:62,184:2,73,184:3,64,-1:2,76,-1:6,184,79,184:3,-1:3," +
@@ -742,872 +748,872 @@
 ":13,-1:2,184:10,-1:3,76,184,76:3,-1:4,184:6,64,-1:2,76,-1:6,184:5,-1:3,184:" +
 "4,232,184:8,-1:2,184:10,-1:3,76,184,76:3");
 
-        public com.sun.java_cup.internal.runtime.Symbol next_token ()
-                throws java.io.IOException,
+	public com.sun.java_cup.internal.runtime.Symbol next_token ()
+		throws java.io.IOException, 
 Exception
 
-                {
-                int yy_lookahead;
-                int yy_anchor = YY_NO_ANCHOR;
-                int yy_state = yy_state_dtrans[yy_lexical_state];
-                int yy_next_state = YY_NO_STATE;
-                int yy_last_accept_state = YY_NO_STATE;
-                boolean yy_initial = true;
-                int yy_this_accept;
+		{
+		int yy_lookahead;
+		int yy_anchor = YY_NO_ANCHOR;
+		int yy_state = yy_state_dtrans[yy_lexical_state];
+		int yy_next_state = YY_NO_STATE;
+		int yy_last_accept_state = YY_NO_STATE;
+		boolean yy_initial = true;
+		int yy_this_accept;
 
-                yy_mark_start();
-                yy_this_accept = yy_acpt[yy_state];
-                if (YY_NOT_ACCEPT != yy_this_accept) {
-                        yy_last_accept_state = yy_state;
-                        yy_mark_end();
-                }
-                while (true) {
-                        if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
-                        else yy_lookahead = yy_advance();
-                        yy_next_state = YY_F;
-                        yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
-                        if (YY_EOF == yy_lookahead && true == yy_initial) {
+		yy_mark_start();
+		yy_this_accept = yy_acpt[yy_state];
+		if (YY_NOT_ACCEPT != yy_this_accept) {
+			yy_last_accept_state = yy_state;
+			yy_mark_end();
+		}
+		while (true) {
+			if (yy_initial && yy_at_bol) yy_lookahead = YY_BOL;
+			else yy_lookahead = yy_advance();
+			yy_next_state = YY_F;
+			yy_next_state = yy_nxt[yy_rmap[yy_state]][yy_cmap[yy_lookahead]];
+			if (YY_EOF == yy_lookahead && true == yy_initial) {
 
 return newSymbol(sym.EOF);
-                        }
-                        if (YY_F != yy_next_state) {
-                                yy_state = yy_next_state;
-                                yy_initial = false;
-                                yy_this_accept = yy_acpt[yy_state];
-                                if (YY_NOT_ACCEPT != yy_this_accept) {
-                                        yy_last_accept_state = yy_state;
-                                        yy_mark_end();
-                                }
-                        }
-                        else {
-                                if (YY_NO_STATE == yy_last_accept_state) {
-                                        throw (new Error("Lexical Error: Unmatched Input."));
-                                }
-                                else {
-                                        yy_anchor = yy_acpt[yy_last_accept_state];
-                                        if (0 != (YY_END & yy_anchor)) {
-                                                yy_move_end();
-                                        }
-                                        yy_to_mark();
-                                        switch (yy_last_accept_state) {
-                                        case 1:
-
-                                        case -2:
-                                                break;
-                                        case 2:
-                                                { return newSymbol(sym.STAR); }
-                                        case -3:
-                                                break;
-                                        case 3:
-                                                { return newSymbol(sym.SLASH); }
-                                        case -4:
-                                                break;
-                                        case 4:
-                                                { return newSymbol(sym.PLUS); }
-                                        case -5:
-                                                break;
-                                        case 5:
-                                                { return newSymbol(sym.MINUS); }
-                                        case -6:
-                                                break;
-                                        case 6:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -7:
-                                                break;
-                                        case 7:
-                                                { throw new Exception(yytext()); }
-                                        case -8:
-                                                break;
-                                        case 8:
-                                                { return newSymbol(sym.COMMA); }
-                                        case -9:
-                                                break;
-                                        case 9:
-                                                { return newSymbol(sym.ATSIGN); }
-                                        case -10:
-                                                break;
-                                        case 10:
-                                                { return newSymbol(sym.DOT); }
-                                        case -11:
-                                                break;
-                                        case 11:
-                                                { return newSymbol(sym.VBAR); }
-                                        case -12:
-                                                break;
-                                        case 12:
-                                                { return newSymbol(sym.DOLLAR); }
-                                        case -13:
-                                                break;
-                                        case 13:
-                                                { return newSymbol(sym.EQ); }
-                                        case -14:
-                                                break;
-                                        case 14:
-                                                { return newSymbol(sym.LT); }
-                                        case -15:
-                                                break;
-                                        case 15:
-                                                { return newSymbol(sym.GT); }
-                                        case -16:
-                                                break;
-                                        case 16:
-                                                { return newSymbol(sym.LPAREN); }
-                                        case -17:
-                                                break;
-                                        case 17:
-                                                { return newSymbol(sym.RPAREN); }
-                                        case -18:
-                                                break;
-                                        case 18:
-                                                { /* ignore white space. */ }
-                                        case -19:
-                                                break;
-                                        case 19:
-                                                { return newSymbol(sym.LBRACK); }
-                                        case -20:
-                                                break;
-                                        case 20:
-                                                { return newSymbol(sym.RBRACK); }
-                                        case -21:
-                                                break;
-                                        case 21:
-                                                { return newSymbol(sym.INT, new Long(yytext())); }
-                                        case -22:
-                                                break;
-                                        case 22:
-                                                { return newSymbol(sym.DSLASH); }
-                                        case -23:
-                                                break;
-                                        case 23:
-                                                { return disambiguateAxisOrFunction(sym.ID); }
-                                        case -24:
-                                                break;
-                                        case 24:
-                                                { return disambiguateOperator(sym.OR); }
-                                        case -25:
-                                                break;
-                                        case 25:
-                                                { return newSymbol(sym.DCOLON); }
-                                        case -26:
-                                                break;
-                                        case 26:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -27:
-                                                break;
-                                        case 27:
-                                                { return newSymbol(sym.DDOT); }
-                                        case -28:
-                                                break;
-                                        case 28:
-                                                { return newSymbol(sym.REAL, new Double(yytext())); }
-                                        case -29:
-                                                break;
-                                        case 29:
-                                                { return newSymbol(sym.NE); }
-                                        case -30:
-                                                break;
-                                        case 30:
-                                                { return newSymbol(sym.LE); }
-                                        case -31:
-                                                break;
-                                        case 31:
-                                                { return newSymbol(sym.GE); }
-                                        case -32:
-                                                break;
-                                        case 32:
-                                                { return newSymbol(sym.Literal,
-                              yytext().substring(1, yytext().length() - 1)); }
-                                        case -33:
-                                                break;
-                                        case 33:
-                                                { return newSymbol(sym.Literal,
-                              yytext().substring(1, yytext().length() - 1)); }
-                                        case -34:
-                                                break;
-                                        case 34:
-                                                { return newSymbol(sym.REAL, new Double(yytext())); }
-                                        case -35:
-                                                break;
-                                        case 35:
-                                                { return disambiguateOperator(sym.DIV); }
-                                        case -36:
-                                                break;
-                                        case 36:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -37:
-                                                break;
-                                        case 37:
-                                                { return disambiguateOperator(sym.MOD); }
-                                        case -38:
-                                                break;
-                                        case 38:
-                                                { return disambiguateAxisOrFunction(sym.KEY); }
-                                        case -39:
-                                                break;
-                                        case 39:
-                                                { return disambiguateOperator(sym.AND); }
-                                        case -40:
-                                                break;
-                                        case 40:
-                                                { return disambiguateAxisOrFunction(sym.SELF); }
-                                        case -41:
-                                                break;
-                                        case 41:
-                                                { return disambiguateAxisOrFunction(sym.CHILD); }
-                                        case -42:
-                                                break;
-                                        case 42:
-                                                { return newSymbol(sym.TEXT); }
-                                        case -43:
-                                                break;
-                                        case 43:
-                                                { return newSymbol(sym.NODE); }
-                                        case -44:
-                                                break;
-                                        case 44:
-                                                { return disambiguateAxisOrFunction(sym.PARENT); }
-                                        case -45:
-                                                break;
-                                        case 45:
-                                                { return newSymbol(sym.TEXT); }
-                                        case -46:
-                                                break;
-                                        case 46:
-                                                { return newSymbol(sym.NODE); }
-                                        case -47:
-                                                break;
-                                        case 47:
-                                                { return disambiguateAxisOrFunction(sym.ANCESTOR); }
-                                        case -48:
-                                                break;
-                                        case 48:
-                                                { initialize(); return new Symbol(sym.PATTERN); }
-                                        case -49:
-                                                break;
-                                        case 49:
-                                                { return disambiguateAxisOrFunction(sym.NAMESPACE); }
-                                        case -50:
-                                                break;
-                                        case 50:
-                                                { return newSymbol(sym.COMMENT); }
-                                        case -51:
-                                                break;
-                                        case 51:
-                                                { return disambiguateAxisOrFunction(sym.PRECEDING); }
-                                        case -52:
-                                                break;
-                                        case 52:
-                                                { return disambiguateAxisOrFunction(sym.ATTRIBUTE); }
-                                        case -53:
-                                                break;
-                                        case 53:
-                                                { return disambiguateAxisOrFunction(sym.FOLLOWING); }
-                                        case -54:
-                                                break;
-                                        case 54:
-                                                { return disambiguateAxisOrFunction(sym.DESCENDANT); }
-                                        case -55:
-                                                break;
-                                        case 55:
-                                                { return newSymbol(sym.COMMENT); }
-                                        case -56:
-                                                break;
-                                        case 56:
-                                                { initialize(); return new Symbol(sym.EXPRESSION); }
-                                        case -57:
-                                                break;
-                                        case 57:
-                                                { return disambiguateAxisOrFunction(sym.ANCESTORORSELF); }
-                                        case -58:
-                                                break;
-                                        case 58:
-                                                { return disambiguateAxisOrFunction(sym.PRECEDINGSIBLING); }
-                                        case -59:
-                                                break;
-                                        case 59:
-                                                { return disambiguateAxisOrFunction(sym.FOLLOWINGSIBLING); }
-                                        case -60:
-                                                break;
-                                        case 60:
-                                                { return disambiguateAxisOrFunction(sym.DESCENDANTORSELF); }
-                                        case -61:
-                                                break;
-                                        case 61:
-                                                { return disambiguateAxisOrFunction(sym.PIPARAM); }
-                                        case -62:
-                                                break;
-                                        case 62:
-                                                { return newSymbol(sym.PI); }
-                                        case -63:
-                                                break;
-                                        case 63:
-                                                { return newSymbol(sym.PI); }
-                                        case -64:
-                                                break;
-                                        case 65:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -65:
-                                                break;
-                                        case 66:
-                                                { throw new Exception(yytext()); }
-                                        case -66:
-                                                break;
-                                        case 67:
-                                                { return newSymbol(sym.INT, new Long(yytext())); }
-                                        case -67:
-                                                break;
-                                        case 68:
-                                                { return newSymbol(sym.REAL, new Double(yytext())); }
-                                        case -68:
-                                                break;
-                                        case 70:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -69:
-                                                break;
-                                        case 71:
-                                                { throw new Exception(yytext()); }
-                                        case -70:
-                                                break;
-                                        case 73:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -71:
-                                                break;
-                                        case 74:
-                                                { throw new Exception(yytext()); }
-                                        case -72:
-                                                break;
-                                        case 76:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -73:
-                                                break;
-                                        case 77:
-                                                { throw new Exception(yytext()); }
-                                        case -74:
-                                                break;
-                                        case 79:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -75:
-                                                break;
-                                        case 81:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -76:
-                                                break;
-                                        case 83:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -77:
-                                                break;
-                                        case 85:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -78:
-                                                break;
-                                        case 87:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -79:
-                                                break;
-                                        case 89:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -80:
-                                                break;
-                                        case 91:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -81:
-                                                break;
-                                        case 93:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -82:
-                                                break;
-                                        case 95:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -83:
-                                                break;
-                                        case 97:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -84:
-                                                break;
-                                        case 99:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -85:
-                                                break;
-                                        case 101:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -86:
-                                                break;
-                                        case 103:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -87:
-                                                break;
-                                        case 105:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -88:
-                                                break;
-                                        case 107:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -89:
-                                                break;
-                                        case 109:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -90:
-                                                break;
-                                        case 111:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -91:
-                                                break;
-                                        case 113:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -92:
-                                                break;
-                                        case 115:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -93:
-                                                break;
-                                        case 117:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -94:
-                                                break;
-                                        case 119:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -95:
-                                                break;
-                                        case 121:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -96:
-                                                break;
-                                        case 123:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -97:
-                                                break;
-                                        case 125:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -98:
-                                                break;
-                                        case 127:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -99:
-                                                break;
-                                        case 128:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -100:
-                                                break;
-                                        case 129:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -101:
-                                                break;
-                                        case 130:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -102:
-                                                break;
-                                        case 131:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -103:
-                                                break;
-                                        case 132:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -104:
-                                                break;
-                                        case 133:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -105:
-                                                break;
-                                        case 134:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -106:
-                                                break;
-                                        case 135:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -107:
-                                                break;
-                                        case 136:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -108:
-                                                break;
-                                        case 137:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -109:
-                                                break;
-                                        case 138:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -110:
-                                                break;
-                                        case 139:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -111:
-                                                break;
-                                        case 140:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -112:
-                                                break;
-                                        case 141:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -113:
-                                                break;
-                                        case 142:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -114:
-                                                break;
-                                        case 143:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -115:
-                                                break;
-                                        case 144:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -116:
-                                                break;
-                                        case 145:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -117:
-                                                break;
-                                        case 146:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -118:
-                                                break;
-                                        case 147:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -119:
-                                                break;
-                                        case 148:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -120:
-                                                break;
-                                        case 149:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -121:
-                                                break;
-                                        case 150:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -122:
-                                                break;
-                                        case 151:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -123:
-                                                break;
-                                        case 152:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -124:
-                                                break;
-                                        case 153:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -125:
-                                                break;
-                                        case 154:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -126:
-                                                break;
-                                        case 155:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -127:
-                                                break;
-                                        case 156:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -128:
-                                                break;
-                                        case 157:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -129:
-                                                break;
-                                        case 158:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -130:
-                                                break;
-                                        case 159:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -131:
-                                                break;
-                                        case 160:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -132:
-                                                break;
-                                        case 161:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -133:
-                                                break;
-                                        case 162:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -134:
-                                                break;
-                                        case 163:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -135:
-                                                break;
-                                        case 164:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -136:
-                                                break;
-                                        case 165:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -137:
-                                                break;
-                                        case 166:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -138:
-                                                break;
-                                        case 167:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -139:
-                                                break;
-                                        case 168:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -140:
-                                                break;
-                                        case 169:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -141:
-                                                break;
-                                        case 170:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -142:
-                                                break;
-                                        case 171:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -143:
-                                                break;
-                                        case 172:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -144:
-                                                break;
-                                        case 173:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -145:
-                                                break;
-                                        case 174:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -146:
-                                                break;
-                                        case 175:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -147:
-                                                break;
-                                        case 176:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -148:
-                                                break;
-                                        case 177:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -149:
-                                                break;
-                                        case 178:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -150:
-                                                break;
-                                        case 179:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -151:
-                                                break;
-                                        case 180:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -152:
-                                                break;
-                                        case 181:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -153:
-                                                break;
-                                        case 182:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -154:
-                                                break;
-                                        case 183:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -155:
-                                                break;
-                                        case 184:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -156:
-                                                break;
-                                        case 187:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -157:
-                                                break;
-                                        case 189:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -158:
-                                                break;
-                                        case 191:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -159:
-                                                break;
-                                        case 192:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -160:
-                                                break;
-                                        case 193:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -161:
-                                                break;
-                                        case 194:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -162:
-                                                break;
-                                        case 195:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -163:
-                                                break;
-                                        case 196:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -164:
-                                                break;
-                                        case 197:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -165:
-                                                break;
-                                        case 198:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -166:
-                                                break;
-                                        case 199:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -167:
-                                                break;
-                                        case 200:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -168:
-                                                break;
-                                        case 201:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -169:
-                                                break;
-                                        case 202:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -170:
-                                                break;
-                                        case 203:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -171:
-                                                break;
-                                        case 204:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -172:
-                                                break;
-                                        case 205:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -173:
-                                                break;
-                                        case 206:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -174:
-                                                break;
-                                        case 207:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -175:
-                                                break;
-                                        case 208:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -176:
-                                                break;
-                                        case 209:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -177:
-                                                break;
-                                        case 210:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -178:
-                                                break;
-                                        case 211:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -179:
-                                                break;
-                                        case 212:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -180:
-                                                break;
-                                        case 213:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -181:
-                                                break;
-                                        case 214:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -182:
-                                                break;
-                                        case 215:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -183:
-                                                break;
-                                        case 216:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -184:
-                                                break;
-                                        case 217:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -185:
-                                                break;
-                                        case 218:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -186:
-                                                break;
-                                        case 219:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -187:
-                                                break;
-                                        case 220:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -188:
-                                                break;
-                                        case 221:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -189:
-                                                break;
-                                        case 222:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -190:
-                                                break;
-                                        case 223:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -191:
-                                                break;
-                                        case 224:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -192:
-                                                break;
-                                        case 225:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -193:
-                                                break;
-                                        case 226:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -194:
-                                                break;
-                                        case 227:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -195:
-                                                break;
-                                        case 228:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -196:
-                                                break;
-                                        case 229:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -197:
-                                                break;
-                                        case 230:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -198:
-                                                break;
-                                        case 231:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -199:
-                                                break;
-                                        case 232:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -200:
-                                                break;
-                                        case 233:
-                                                { return newSymbol(sym.QNAME, yytext()); }
-                                        case -201:
-                                                break;
-                                        default:
-                                                yy_error(YY_E_INTERNAL,false);
-                                        case -1:
-                                        }
-                                        yy_initial = true;
-                                        yy_state = yy_state_dtrans[yy_lexical_state];
-                                        yy_next_state = YY_NO_STATE;
-                                        yy_last_accept_state = YY_NO_STATE;
-                                        yy_mark_start();
-                                        yy_this_accept = yy_acpt[yy_state];
-                                        if (YY_NOT_ACCEPT != yy_this_accept) {
-                                                yy_last_accept_state = yy_state;
-                                                yy_mark_end();
-                                        }
-                                }
-                        }
-                }
-        }
+			}
+			if (YY_F != yy_next_state) {
+				yy_state = yy_next_state;
+				yy_initial = false;
+				yy_this_accept = yy_acpt[yy_state];
+				if (YY_NOT_ACCEPT != yy_this_accept) {
+					yy_last_accept_state = yy_state;
+					yy_mark_end();
+				}
+			}
+			else {
+				if (YY_NO_STATE == yy_last_accept_state) {
+					throw (new Error("Lexical Error: Unmatched Input."));
+				}
+				else {
+					yy_anchor = yy_acpt[yy_last_accept_state];
+					if (0 != (YY_END & yy_anchor)) {
+						yy_move_end();
+					}
+					yy_to_mark();
+					switch (yy_last_accept_state) {
+					case 1:
+						
+					case -2:
+						break;
+					case 2:
+						{ return newSymbol(sym.STAR); }
+					case -3:
+						break;
+					case 3:
+						{ return newSymbol(sym.SLASH); }
+					case -4:
+						break;
+					case 4:
+						{ return newSymbol(sym.PLUS); }
+					case -5:
+						break;
+					case 5:
+						{ return newSymbol(sym.MINUS); }
+					case -6:
+						break;
+					case 6:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -7:
+						break;
+					case 7:
+						{ throw new Exception(yytext()); }
+					case -8:
+						break;
+					case 8:
+						{ return newSymbol(sym.COMMA); }
+					case -9:
+						break;
+					case 9:
+						{ return newSymbol(sym.ATSIGN); }
+					case -10:
+						break;
+					case 10:
+						{ return newSymbol(sym.DOT); }
+					case -11:
+						break;
+					case 11:
+						{ return newSymbol(sym.VBAR); }
+					case -12:
+						break;
+					case 12:
+						{ return newSymbol(sym.DOLLAR); }
+					case -13:
+						break;
+					case 13:
+						{ return newSymbol(sym.EQ); }
+					case -14:
+						break;
+					case 14:
+						{ return newSymbol(sym.LT); }
+					case -15:
+						break;
+					case 15:
+						{ return newSymbol(sym.GT); }
+					case -16:
+						break;
+					case 16:
+						{ return newSymbol(sym.LPAREN); }
+					case -17:
+						break;
+					case 17:
+						{ return newSymbol(sym.RPAREN); }
+					case -18:
+						break;
+					case 18:
+						{ /* ignore white space. */ }
+					case -19:
+						break;
+					case 19:
+						{ return newSymbol(sym.LBRACK); }
+					case -20:
+						break;
+					case 20:
+						{ return newSymbol(sym.RBRACK); }
+					case -21:
+						break;
+					case 21:
+						{ return newSymbol(sym.INT, new Long(yytext())); }
+					case -22:
+						break;
+					case 22:
+						{ return newSymbol(sym.DSLASH); }
+					case -23:
+						break;
+					case 23:
+						{ return disambiguateAxisOrFunction(sym.ID); }
+					case -24:
+						break;
+					case 24:
+						{ return disambiguateOperator(sym.OR); }
+					case -25:
+						break;
+					case 25:
+						{ return newSymbol(sym.DCOLON); }
+					case -26:
+						break;
+					case 26:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -27:
+						break;
+					case 27:
+						{ return newSymbol(sym.DDOT); }
+					case -28:
+						break;
+					case 28:
+						{ return newSymbol(sym.REAL, new Double(yytext())); }
+					case -29:
+						break;
+					case 29:
+						{ return newSymbol(sym.NE); }
+					case -30:
+						break;
+					case 30:
+						{ return newSymbol(sym.LE); }
+					case -31:
+						break;
+					case 31:
+						{ return newSymbol(sym.GE); }
+					case -32:
+						break;
+					case 32:
+						{ return newSymbol(sym.Literal,
+			      yytext().substring(1, yytext().length() - 1)); }
+					case -33:
+						break;
+					case 33:
+						{ return newSymbol(sym.Literal,
+			      yytext().substring(1, yytext().length() - 1)); }
+					case -34:
+						break;
+					case 34:
+						{ return newSymbol(sym.REAL, new Double(yytext())); }
+					case -35:
+						break;
+					case 35:
+						{ return disambiguateOperator(sym.DIV); }
+					case -36:
+						break;
+					case 36:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -37:
+						break;
+					case 37:
+						{ return disambiguateOperator(sym.MOD); }
+					case -38:
+						break;
+					case 38:
+						{ return disambiguateAxisOrFunction(sym.KEY); }
+					case -39:
+						break;
+					case 39:
+						{ return disambiguateOperator(sym.AND); }
+					case -40:
+						break;
+					case 40:
+						{ return disambiguateAxisOrFunction(sym.SELF); }
+					case -41:
+						break;
+					case 41:
+						{ return disambiguateAxisOrFunction(sym.CHILD); }
+					case -42:
+						break;
+					case 42:
+						{ return newSymbol(sym.TEXT); }
+					case -43:
+						break;
+					case 43:
+						{ return newSymbol(sym.NODE); }
+					case -44:
+						break;
+					case 44:
+						{ return disambiguateAxisOrFunction(sym.PARENT); }
+					case -45:
+						break;
+					case 45:
+						{ return newSymbol(sym.TEXT); }
+					case -46:
+						break;
+					case 46:
+						{ return newSymbol(sym.NODE); }
+					case -47:
+						break;
+					case 47:
+						{ return disambiguateAxisOrFunction(sym.ANCESTOR); }
+					case -48:
+						break;
+					case 48:
+						{ initialize(); return new Symbol(sym.PATTERN); }
+					case -49:
+						break;
+					case 49:
+						{ return disambiguateAxisOrFunction(sym.NAMESPACE); }
+					case -50:
+						break;
+					case 50:
+						{ return newSymbol(sym.COMMENT); }
+					case -51:
+						break;
+					case 51:
+						{ return disambiguateAxisOrFunction(sym.PRECEDING); }
+					case -52:
+						break;
+					case 52:
+						{ return disambiguateAxisOrFunction(sym.ATTRIBUTE); }
+					case -53:
+						break;
+					case 53:
+						{ return disambiguateAxisOrFunction(sym.FOLLOWING); }
+					case -54:
+						break;
+					case 54:
+						{ return disambiguateAxisOrFunction(sym.DESCENDANT); }
+					case -55:
+						break;
+					case 55:
+						{ return newSymbol(sym.COMMENT); }
+					case -56:
+						break;
+					case 56:
+						{ initialize(); return new Symbol(sym.EXPRESSION); }
+					case -57:
+						break;
+					case 57:
+						{ return disambiguateAxisOrFunction(sym.ANCESTORORSELF); }
+					case -58:
+						break;
+					case 58:
+						{ return disambiguateAxisOrFunction(sym.PRECEDINGSIBLING); }
+					case -59:
+						break;
+					case 59:
+						{ return disambiguateAxisOrFunction(sym.FOLLOWINGSIBLING); }
+					case -60:
+						break;
+					case 60:
+						{ return disambiguateAxisOrFunction(sym.DESCENDANTORSELF); }
+					case -61:
+						break;
+					case 61:
+						{ return disambiguateAxisOrFunction(sym.PIPARAM); }
+					case -62:
+						break;
+					case 62:
+						{ return newSymbol(sym.PI); }
+					case -63:
+						break;
+					case 63:
+						{ return newSymbol(sym.PI); }
+					case -64:
+						break;
+					case 65:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -65:
+						break;
+					case 66:
+						{ throw new Exception(yytext()); }
+					case -66:
+						break;
+					case 67:
+						{ return newSymbol(sym.INT, new Long(yytext())); }
+					case -67:
+						break;
+					case 68:
+						{ return newSymbol(sym.REAL, new Double(yytext())); }
+					case -68:
+						break;
+					case 70:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -69:
+						break;
+					case 71:
+						{ throw new Exception(yytext()); }
+					case -70:
+						break;
+					case 73:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -71:
+						break;
+					case 74:
+						{ throw new Exception(yytext()); }
+					case -72:
+						break;
+					case 76:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -73:
+						break;
+					case 77:
+						{ throw new Exception(yytext()); }
+					case -74:
+						break;
+					case 79:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -75:
+						break;
+					case 81:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -76:
+						break;
+					case 83:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -77:
+						break;
+					case 85:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -78:
+						break;
+					case 87:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -79:
+						break;
+					case 89:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -80:
+						break;
+					case 91:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -81:
+						break;
+					case 93:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -82:
+						break;
+					case 95:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -83:
+						break;
+					case 97:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -84:
+						break;
+					case 99:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -85:
+						break;
+					case 101:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -86:
+						break;
+					case 103:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -87:
+						break;
+					case 105:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -88:
+						break;
+					case 107:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -89:
+						break;
+					case 109:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -90:
+						break;
+					case 111:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -91:
+						break;
+					case 113:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -92:
+						break;
+					case 115:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -93:
+						break;
+					case 117:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -94:
+						break;
+					case 119:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -95:
+						break;
+					case 121:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -96:
+						break;
+					case 123:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -97:
+						break;
+					case 125:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -98:
+						break;
+					case 127:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -99:
+						break;
+					case 128:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -100:
+						break;
+					case 129:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -101:
+						break;
+					case 130:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -102:
+						break;
+					case 131:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -103:
+						break;
+					case 132:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -104:
+						break;
+					case 133:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -105:
+						break;
+					case 134:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -106:
+						break;
+					case 135:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -107:
+						break;
+					case 136:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -108:
+						break;
+					case 137:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -109:
+						break;
+					case 138:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -110:
+						break;
+					case 139:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -111:
+						break;
+					case 140:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -112:
+						break;
+					case 141:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -113:
+						break;
+					case 142:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -114:
+						break;
+					case 143:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -115:
+						break;
+					case 144:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -116:
+						break;
+					case 145:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -117:
+						break;
+					case 146:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -118:
+						break;
+					case 147:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -119:
+						break;
+					case 148:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -120:
+						break;
+					case 149:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -121:
+						break;
+					case 150:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -122:
+						break;
+					case 151:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -123:
+						break;
+					case 152:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -124:
+						break;
+					case 153:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -125:
+						break;
+					case 154:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -126:
+						break;
+					case 155:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -127:
+						break;
+					case 156:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -128:
+						break;
+					case 157:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -129:
+						break;
+					case 158:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -130:
+						break;
+					case 159:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -131:
+						break;
+					case 160:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -132:
+						break;
+					case 161:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -133:
+						break;
+					case 162:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -134:
+						break;
+					case 163:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -135:
+						break;
+					case 164:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -136:
+						break;
+					case 165:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -137:
+						break;
+					case 166:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -138:
+						break;
+					case 167:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -139:
+						break;
+					case 168:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -140:
+						break;
+					case 169:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -141:
+						break;
+					case 170:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -142:
+						break;
+					case 171:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -143:
+						break;
+					case 172:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -144:
+						break;
+					case 173:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -145:
+						break;
+					case 174:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -146:
+						break;
+					case 175:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -147:
+						break;
+					case 176:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -148:
+						break;
+					case 177:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -149:
+						break;
+					case 178:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -150:
+						break;
+					case 179:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -151:
+						break;
+					case 180:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -152:
+						break;
+					case 181:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -153:
+						break;
+					case 182:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -154:
+						break;
+					case 183:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -155:
+						break;
+					case 184:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -156:
+						break;
+					case 187:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -157:
+						break;
+					case 189:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -158:
+						break;
+					case 191:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -159:
+						break;
+					case 192:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -160:
+						break;
+					case 193:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -161:
+						break;
+					case 194:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -162:
+						break;
+					case 195:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -163:
+						break;
+					case 196:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -164:
+						break;
+					case 197:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -165:
+						break;
+					case 198:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -166:
+						break;
+					case 199:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -167:
+						break;
+					case 200:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -168:
+						break;
+					case 201:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -169:
+						break;
+					case 202:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -170:
+						break;
+					case 203:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -171:
+						break;
+					case 204:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -172:
+						break;
+					case 205:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -173:
+						break;
+					case 206:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -174:
+						break;
+					case 207:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -175:
+						break;
+					case 208:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -176:
+						break;
+					case 209:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -177:
+						break;
+					case 210:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -178:
+						break;
+					case 211:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -179:
+						break;
+					case 212:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -180:
+						break;
+					case 213:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -181:
+						break;
+					case 214:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -182:
+						break;
+					case 215:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -183:
+						break;
+					case 216:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -184:
+						break;
+					case 217:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -185:
+						break;
+					case 218:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -186:
+						break;
+					case 219:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -187:
+						break;
+					case 220:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -188:
+						break;
+					case 221:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -189:
+						break;
+					case 222:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -190:
+						break;
+					case 223:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -191:
+						break;
+					case 224:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -192:
+						break;
+					case 225:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -193:
+						break;
+					case 226:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -194:
+						break;
+					case 227:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -195:
+						break;
+					case 228:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -196:
+						break;
+					case 229:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -197:
+						break;
+					case 230:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -198:
+						break;
+					case 231:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -199:
+						break;
+					case 232:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -200:
+						break;
+					case 233:
+						{ return newSymbol(sym.QNAME, yytext()); }
+					case -201:
+						break;
+					default:
+						yy_error(YY_E_INTERNAL,false);
+					case -1:
+					}
+					yy_initial = true;
+					yy_state = yy_state_dtrans[yy_lexical_state];
+					yy_next_state = YY_NO_STATE;
+					yy_last_accept_state = YY_NO_STATE;
+					yy_mark_start();
+					yy_this_accept = yy_acpt[yy_state];
+					if (YY_NOT_ACCEPT != yy_this_accept) {
+						yy_last_accept_state = yy_state;
+						yy_mark_end();
+					}
+				}
+			}
+		}
+	}
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,13 +90,13 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
     public Object[][] getContents()
     {
-      return new Object[][] {
+      return new Object[][] { 
         {ErrorMsg.MULTIPLE_STYLESHEET_ERR,
         "More than one stylesheet defined in the same file."},
 
@@ -652,7 +652,7 @@
          */
         {ErrorMsg.XSLTC_SOURCE_ERR,
         "XSLTCSource.build() called without systemId being set."},
-
+        
         { ErrorMsg.ER_RESULT_NULL,
             "Result should not be null"},
 
@@ -661,7 +661,7 @@
          * of setParameter must be a valid Java Object.
          */
         {ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE,
-        "The value of param {0} must be a valid Java Object"},
+        "The value of param {0} must be a valid Java Object"},            
 
 
         {ErrorMsg.COMPILE_STDIN_ERR,
@@ -846,7 +846,7 @@
          */
         {ErrorMsg.ERROR_MSG,
         "ERROR:  ''{0}''"},
-
+        
         /*
          * Note to translators:  The substitution text is the name of a class.
          */
@@ -905,7 +905,7 @@
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
         "Translet errors:"},
-
+        
         /*
          * Note to translators:  An attribute whose value is constrained to
          * be a "QName" or a list of "QNames" had a value that was incorrect.
@@ -913,7 +913,7 @@
          * substitution text contains the actual value of the attribute.
          */
         {ErrorMsg.INVALID_QNAME_ERR,
-        "An attribute whose value must be a QName or whitespace-separated list of QNames had the value ''{0}''"},
+        "An attribute whose value must be a QName or whitespace-separated list of QNames had the value ''{0}''"}, 
 
         /*
          * Note to translators:  An attribute whose value is required to
@@ -936,16 +936,18 @@
          */
         {ErrorMsg.INVALID_METHOD_IN_OUTPUT,
         "The method attribute of an <xsl:output> element had the value ''{0}''.  The value must be one of ''xml'', ''html'', ''text'', or qname-but-not-ncname"},
-
+        
         {ErrorMsg.JAXP_GET_FEATURE_NULL_NAME,
         "The feature name cannot be null in TransformerFactory.getFeature(String name)."},
-
+        
         {ErrorMsg.JAXP_SET_FEATURE_NULL_NAME,
         "The feature name cannot be null in TransformerFactory.setFeature(String name, boolean value)."},
 
         {ErrorMsg.JAXP_UNSUPPORTED_FEATURE,
-        "Cannot set the feature ''{0}'' on this TransformerFactory."}
+        "Cannot set the feature ''{0}'' on this TransformerFactory."},
 
+        {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ca.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ca.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Errors de translet:"}
+        "Errors de translet:"},
+
+        {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_cs.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_cs.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Chyby transletu:"}
+        "Chyby transletu:"},
+
+        {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_de.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Translet-Fehler:"}
+        "Translet-Fehler:"},
+
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Diese Funktion kann nicht auf \"false\" gesetzt werden, wenn der Security Manager pr\u00e4sent ist."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_es.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Errores de translet:"}
+        "Errores de translet:"},
+		
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: No se puede cambiar la funci\u00f3n a falso cuando el administrador de seguridad est\u00e1 presente."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_fr.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Erreurs de translet :"}
+        "Erreurs de translet :"},
+		
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Impossible de d\u00e9finir la valeur False pour la fonction lorsque le gestionnaire de s\u00e9curit\u00e9 est pr\u00e9sent."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_it.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Errori del translet:"}
+        "Errori del translet:"},
+
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Impossibile impostare la funzionalit\u00e0 su False in presenza di strumenti di gestione della protezione."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ja.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Translet \u30a8\u30e9\u30fc:"}
+        "Translet \u30a8\u30e9\u30fc:"},
+		
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306b\u306f\u3001\u3053\u306e\u6a5f\u80fd\u3092 false \u306b\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093\u3002"}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_ko.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Translet \uc624\ub958:"}
+        "Translet \uc624\ub958:"},
+
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: \ubcf4\uc548 \uad00\ub9ac\uc790\uac00 \uc788\uc73c\uba74 \uc774 \uae30\ub2a5\uc744 False\ub85c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sk.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_sk.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Chyby transletu:"}
+        "Chyby transletu:"},
+
+        {ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present."}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_CN.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "Translet \u9519\u8bef\uff1a"}
+        "Translet \u9519\u8bef\uff1a"},
+
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING\uff1a\u5982\u679c\u6709\u5b89\u5168\u7ba1\u7406\u5668\uff0c\u5219\u65e0\u6cd5\u5c06\u8be5\u529f\u80fd\u8bbe\u7f6e\u4e3a false\u3002"}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMessages_zh_TW.java	Wed Sep 28 16:49:43 2011 +0100
@@ -90,7 +90,7 @@
  */
 
     // These message should be read from a locale-specific resource bundle
-    /** Get the lookup table for error messages.
+    /** Get the lookup table for error messages.   
      *
      * @return The message lookup table.
      */
@@ -847,7 +847,10 @@
          * stylesheet (see above).
          */
         {ErrorMsg.RUNTIME_ERROR_KEY,
-        "\u7de8\u8b6f\u5668\u932f\u8aa4\uff1a"}
+        "\u7de8\u8b6f\u5668\u932f\u8aa4\uff1a"},
+
+		{ErrorMsg.JAXP_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: \u4f7f\u7528\u5b89\u5168\u6027\u7ba1\u7406\u54e1\u6642\uff0c\u4e0d\u53ef\u5c07\u6b64\u529f\u80fd\u8a2d\u70ba false\u3002"}
     };
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ErrorMsg.java	Wed Sep 28 16:49:43 2011 +0100
@@ -121,10 +121,11 @@
     public static final String SAX2DOM_ADAPTER_ERR = "SAX2DOM_ADAPTER_ERR";
     public static final String XSLTC_SOURCE_ERR = "XSLTC_SOURCE_ERR";
     public static final String ER_RESULT_NULL = "ER_RESULT_NULL";
-    public static final String JAXP_INVALID_SET_PARAM_VALUE = "JAXP_INVALID_SET_PARAM_VALUE";
+    public static final String JAXP_INVALID_SET_PARAM_VALUE = "JAXP_INVALID_SET_PARAM_VALUE";        
     public static final String JAXP_SET_FEATURE_NULL_NAME = "JAXP_SET_FEATURE_NULL_NAME";
     public static final String JAXP_GET_FEATURE_NULL_NAME = "JAXP_GET_FEATURE_NULL_NAME";
     public static final String JAXP_UNSUPPORTED_FEATURE = "JAXP_UNSUPPORTED_FEATURE";
+    public static final String JAXP_SECUREPROCESSING_FEATURE = "JAXP_SECUREPROCESSING_FEATURE";
 
     // Command-line error messages
     public static final String COMPILE_STDIN_ERR = "COMPILE_STDIN_ERR";
@@ -155,11 +156,11 @@
     public static final String INVALID_QNAME_ERR = "INVALID_QNAME_ERR";
     public static final String INVALID_NCNAME_ERR = "INVALID_NCNAME_ERR";
     public static final String INVALID_METHOD_IN_OUTPUT = "INVALID_METHOD_IN_OUTPUT";
-
+                                                     
     // All error messages are localized and are stored in resource bundles.
     // This array and the following 4 strings are read from that bundle.
     private static ResourceBundle _bundle;
-
+    
     public final static String ERROR_MESSAGES_KEY   = "ERROR_MESSAGES_KEY";
     public final static String COMPILER_ERROR_KEY   = "COMPILER_ERROR_KEY";
     public final static String COMPILER_WARNING_KEY = "COMPILER_WARNING_KEY";
@@ -172,134 +173,135 @@
     }
 
     public ErrorMsg(String code) {
-        _code = code;
-        _line = 0;
+	_code = code;
+	_line = 0;
     }
-
+	
     public ErrorMsg(Throwable e) {
-        _code = null;
-        _message = e.getMessage();
-        _line = 0;
+   	_code = null;
+	_message = e.getMessage();
+	_line = 0;
     }
 
     public ErrorMsg(String message, int line) {
-        _code = null;
-        _message = message;
-        _line = line;
+	_code = null;
+	_message = message;
+	_line = line;
     }
 
     public ErrorMsg(String code, int line, Object param) {
-        _code = code;
-        _line = line;
-        _params = new Object[] { param };
+	_code = code;
+	_line = line;
+	_params = new Object[] { param };
     }
 
     public ErrorMsg(String code, Object param) {
-        this(code);
-        _params = new Object[1];
-        _params[0] = param;
+	this(code);
+	_params = new Object[1];
+	_params[0] = param;
     }
 
     public ErrorMsg(String code, Object param1, Object param2) {
-        this(code);
-        _params = new Object[2];
-        _params[0] = param1;
-        _params[1] = param2;
+	this(code);
+	_params = new Object[2];
+	_params[0] = param1;
+	_params[1] = param2;
     }
 
     public ErrorMsg(String code, SyntaxTreeNode node) {
-        _code = code;
-        _url  = getFileName(node);
-        _line = node.getLineNumber();
+	_code = code;
+	_url  = getFileName(node);
+	_line = node.getLineNumber();
     }
 
     public ErrorMsg(String code, Object param1, SyntaxTreeNode node) {
-        _code = code;
-        _url  = getFileName(node);
-        _line = node.getLineNumber();
-        _params = new Object[1];
-        _params[0] = param1;
+	_code = code;
+	_url  = getFileName(node);
+	_line = node.getLineNumber();
+	_params = new Object[1];
+	_params[0] = param1;
     }
 
     public ErrorMsg(String code, Object param1, Object param2,
-                    SyntaxTreeNode node) {
-        _code = code;
-        _url  = getFileName(node);
-        _line = node.getLineNumber();
-        _params = new Object[2];
-        _params[0] = param1;
-        _params[1] = param2;
+		    SyntaxTreeNode node) {
+	_code = code;
+	_url  = getFileName(node);
+	_line = node.getLineNumber();
+	_params = new Object[2];
+	_params[0] = param1;
+	_params[1] = param2;
     }
 
     private String getFileName(SyntaxTreeNode node) {
-        Stylesheet stylesheet = node.getStylesheet();
-        if (stylesheet != null)
-            return stylesheet.getSystemId();
-        else
-            return null;
+	Stylesheet stylesheet = node.getStylesheet();
+	if (stylesheet != null)
+	    return stylesheet.getSystemId();
+	else
+	    return null;
     }
 
     private String formatLine() {
-        StringBuffer result = new StringBuffer();
-        if (_url != null) {
-            result.append(_url);
-            result.append(": ");
-        }
-        if (_line > 0) {
-            result.append("line ");
-            result.append(Integer.toString(_line));
-            result.append(": ");
-        }
-        return result.toString();
+	StringBuffer result = new StringBuffer();
+	if (_url != null) {
+	    result.append(_url);
+	    result.append(": ");
+	}
+	if (_line > 0) {
+	    result.append("line ");
+	    result.append(Integer.toString(_line));
+	    result.append(": ");
+	}
+	return result.toString();
     }
-
+	
     /**
      * This version of toString() uses the _params instance variable
      * to format the message. If the <code>_code</code> is negative
      * the use _message as the error string.
      */
     public String toString() {
-        String suffix = (_params == null) ?
-            (null != _code ? new String(getErrorMessage()) : _message)
-            : MessageFormat.format(getErrorMessage(), _params);
-        return formatLine() + suffix;
+	String suffix = (_params == null) ? 
+	    (null != _code ? new String(getErrorMessage()) : _message)
+	    : MessageFormat.format(getErrorMessage(), _params);
+	return formatLine() + suffix;
     }
-
+	
     public String toString(Object obj) {
-        Object params[] = new Object[1];
-        params[0] = obj.toString();
-        String suffix = MessageFormat.format(getErrorMessage(), params);
-        return formatLine() + suffix;
+	Object params[] = new Object[1];
+	params[0] = obj.toString();
+	String suffix = MessageFormat.format(getErrorMessage(), params);
+	return formatLine() + suffix;
     }
-
+	
     public String toString(Object obj0, Object obj1) {
-        Object params[] = new Object[2];
-        params[0] = obj0.toString();
-        params[1] = obj1.toString();
-        String suffix = MessageFormat.format(getErrorMessage(), params);
-        return formatLine() + suffix;
+	Object params[] = new Object[2];
+	params[0] = obj0.toString();
+	params[1] = obj1.toString();
+	String suffix = MessageFormat.format(getErrorMessage(), params);
+	return formatLine() + suffix;
     }
 
     /**
      * Return an ErrorMessages string corresponding to the _code
      * This function is temporary until the three special-cased keys
      * below are moved into ErrorMessages
-     *
+     * 
      * @return ErrorMessages string
-     */
+     */    
     private String getErrorMessage() {
       return _bundle.getString(_code);
     }
-
+    
     // If the _isWarningError flag is true, the error is treated as
     // a warning by the compiler, but should be reported as an error
-    // to the ErrorListener. This is a workaround for the TCK failure
+    // to the ErrorListener. This is a workaround for the TCK failure 
     // ErrorListener.errorTests.error001.
     public void setWarningError(boolean flag) {
-        _isWarningError = flag;
+    	_isWarningError = flag;
 }
 
     public boolean isWarningError() {
         return _isWarningError;
     }
 }
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/util/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:40:59 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = -4417969773510154215L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/xpath.lex	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/compiler/xpath.lex	Wed Sep 28 16:49:43 2011 +0100
@@ -38,10 +38,10 @@
 %yyeof
 
 %{
-        int last;
+        int last, beforeLast;
 
         void initialize() {
-            last = -1;
+            last, beforeLast = -1;
         }
 
         static boolean isWhitespace(int c) {
@@ -76,10 +76,13 @@
         /**
          * If symbol is first token or if it follows any of the operators
          * listed in http://www.w3.org/TR/xpath#exprlex then treat as a 
-         * name instead of a keyword (Jira-1912).
+         * name instead of a keyword (Jira-1912). Look two tokens behind
+         * to desambiguate expressions like "* and *" or "and * and".
          */ 
         Symbol disambiguateOperator(int ss) throws Exception {
             switch (last) {
+            case sym.STAR:
+                if (beforeLast != sym.QNAME) break;
             case -1:    // first token
             case sym.ATSIGN:
             case sym.DCOLON:
@@ -90,7 +93,6 @@
             case sym.OR:
             case sym.MOD:
             case sym.DIV:
-            case sym.STAR:
             case sym.SLASH:
             case sym.DSLASH:
             case sym.VBAR:
@@ -108,21 +110,25 @@
         }
 
         Symbol newSymbol(int ss) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss);
         }
 
         Symbol newSymbol(int ss, String value) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss, value);
         }
 
         Symbol newSymbol(int ss, Long value) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss, value);
         }
 
         Symbol newSymbol(int ss, Double value) {
+            beforeLast = last;    
             last = ss;
             return new Symbol(ss, value);
         }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/AnyNodeCounter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/AnyNodeCounter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -33,99 +33,99 @@
  */
 public abstract class AnyNodeCounter extends NodeCounter {
     public AnyNodeCounter(Translet translet,
-                          DOM document, DTMAxisIterator iterator) {
-        super(translet, document, iterator);
+			  DOM document, DTMAxisIterator iterator) {
+	super(translet, document, iterator);
     }
-
+	
     public AnyNodeCounter(Translet translet,
-                          DOM document,
+			  DOM document, 
                           DTMAxisIterator iterator,
                           boolean hasFrom) {
-        super(translet, document, iterator, hasFrom);
+	super(translet, document, iterator, hasFrom);
     }
-
+    
     public NodeCounter setStartNode(int node) {
-        _node = node;
-        _nodeType = _document.getExpandedTypeID(node);
-        return this;
+	_node = node;
+	_nodeType = _document.getExpandedTypeID(node);
+	return this;
     }
 
     public String getCounter() {
-        int result;
-        if (_value != Integer.MIN_VALUE) {
+	int result;
+	if (_value != Integer.MIN_VALUE) {
             //See Errata E24
             if (_value == 0) return "0";
             else if (Double.isNaN(_value)) return "NaN";
             else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
             else if (Double.isInfinite(_value)) return "Infinity";
             else return formatNumbers((int)_value);
-        }
-        else {
-            int next = _node;
+	}
+	else {
+	    int next = _node; 
             final int root = _document.getDocument();
-            result = 0;
-            while (next >= root && !matchesFrom(next)) {
-                if (matchesCount(next)) {
-                    ++result;
-                }
-                next--;
+	    result = 0;
+	    while (next >= root && !matchesFrom(next)) {
+		if (matchesCount(next)) {
+		    ++result;	
+		}
+		next--;
 //%HZ%:  Is this the best way of finding the root?  Is it better to check
 //%HZ%:  parent(next)?
-                /*
-                if (next == root) {
-                    break;
+		/*
+		if (next == root) {
+		    break;
                 }
-                else {
-                    --next;
+		else {
+		    --next;		
                 }
                 */
-            }
-        }
-        return formatNumbers(result);
+	    }
+	}
+	return formatNumbers(result);
     }
 
     public static NodeCounter getDefaultNodeCounter(Translet translet,
-                                                    DOM document,
-                                                    DTMAxisIterator iterator) {
-        return new DefaultAnyNodeCounter(translet, document, iterator);
+						    DOM document,
+						    DTMAxisIterator iterator) {
+	return new DefaultAnyNodeCounter(translet, document, iterator);
     }
 
     static class DefaultAnyNodeCounter extends AnyNodeCounter {
-        public DefaultAnyNodeCounter(Translet translet,
-                                     DOM document, DTMAxisIterator iterator) {
-            super(translet, document, iterator);
-        }
+	public DefaultAnyNodeCounter(Translet translet,
+				     DOM document, DTMAxisIterator iterator) {
+	    super(translet, document, iterator);
+	}
 
-        public String getCounter() {
-            int result;
-            if (_value != Integer.MIN_VALUE) {
+	public String getCounter() {
+	    int result;
+	    if (_value != Integer.MIN_VALUE) {
                     //See Errata E24
                     if (_value == 0) return "0";
                     else if (Double.isNaN(_value)) return "NaN";
                     else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
                     else if (Double.isInfinite(_value)) return "Infinity";
                     else result = (int) _value;
-            }
-            else {
-                int next = _node;
-                result = 0;
-                final int ntype = _document.getExpandedTypeID(_node);
+	    }
+	    else {
+		int next = _node;
+		result = 0;
+		final int ntype = _document.getExpandedTypeID(_node);
                 final int root = _document.getDocument();
-                while (next >= 0) {
-                    if (ntype == _document.getExpandedTypeID(next)) {
-                        result++;
-                    }
+		while (next >= 0) {
+		    if (ntype == _document.getExpandedTypeID(next)) {
+			result++;
+		    }
 //%HZ%:  Is this the best way of finding the root?  Is it better to check
 //%HZ%:  parent(next)?
-                    if (next == root) {
-                        break;
+		    if (next == root) {
+		        break;
                     }
-                    else {
-                        --next;
+		    else {
+		        --next;
                     }
-                }
-            }
-            return formatNumbers(result);
-        }
+		}
+	    }
+	    return formatNumbers(result);
+	}
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/KeyIndex.java	Wed Sep 28 16:49:43 2011 +0100
@@ -73,7 +73,7 @@
      * id() function.
      */
     private DOM        _dom;
-
+    
     private DOMEnhancedForDTM    _enhancedDOM;
 
     /**
@@ -117,16 +117,16 @@
      * @deprecated
      */
     public void merge(KeyIndex other) {
-        if (other == null) return;
+	if (other == null) return;
 
-        if (other._nodes != null) {
-            if (_nodes == null) {
-                _nodes = (IntegerArray)other._nodes.clone();
-            }
-            else {
-                _nodes.merge(other._nodes);
-            }
-        }
+	if (other._nodes != null) {
+	    if (_nodes == null) {
+		_nodes = (IntegerArray)other._nodes.clone();
+	    }
+	    else {
+		_nodes.merge(other._nodes);
+	    }
+	}
     }
 
     /**
@@ -138,35 +138,35 @@
      * @deprecated
      */
     public void lookupId(Object value) {
-        // Clear _nodes array
-        _nodes = null;
+	// Clear _nodes array
+	_nodes = null;
 
-        final StringTokenizer values = new StringTokenizer((String) value,
+	final StringTokenizer values = new StringTokenizer((String) value,
                                                            " \n\t");
-        while (values.hasMoreElements()) {
+	while (values.hasMoreElements()) {
             final String token = (String) values.nextElement();
-            IntegerArray nodes = (IntegerArray) _index.get(token);
+	    IntegerArray nodes = (IntegerArray) _index.get(token);
 
             if (nodes == null && _enhancedDOM != null
                 && _enhancedDOM.hasDOMSource()) {
                 nodes = getDOMNodeById(token);
             }
 
-            if (nodes == null) continue;
+	    if (nodes == null) continue;
 
-            if (_nodes == null) {
-                 nodes = (IntegerArray)nodes.clone();
-                _nodes = nodes;
-            }
-            else {
-                _nodes.merge(nodes);
-            }
-        }
+	    if (_nodes == null) {
+		 nodes = (IntegerArray)nodes.clone();
+		_nodes = nodes;
+	    }
+	    else {
+		_nodes.merge(nodes);
+	    }
+	}
     }
 
     /**
      * Return an IntegerArray for the DOM Node which has the given id.
-     *
+     * 
      * @param id The id
      * @return A IntegerArray representing the Node whose id is the given value.
      */
@@ -198,7 +198,7 @@
 
         return nodes;
     }
-
+    
     /**
      * <p>This method must be called by the code generated by the key() function
      * prior to returning the node iterator.</p>
@@ -212,17 +212,17 @@
         _position = 0;
     }
 
-    /**
+    /** 
      * <p>Callers should not call next() after it returns END.</p>
      * <p><em>Use of an instance of this class as a {@link DTMAxisIterator} is
      * <b>deprecated.</b></em></p>
      * @deprecated
      */
     public int next() {
-        if (_nodes == null) return DTMAxisIterator.END;
+	if (_nodes == null) return DTMAxisIterator.END;
 
-        return (_position < _nodes.cardinality()) ?
-            _dom.getNodeHandle(_nodes.at(_position++)) : DTMAxisIterator.END;
+	return (_position < _nodes.cardinality()) ? 
+	    _dom.getNodeHandle(_nodes.at(_position++)) : DTMAxisIterator.END;
     }
 
     /**
@@ -261,7 +261,7 @@
             // the look-up.
             if (nodes == null && _enhancedDOM != null
                 && _enhancedDOM.hasDOMSource()) {
-                nodes = getDOMNodeById(token);
+                nodes = getDOMNodeById(token);	
             }
 
             // Did we find the context node in the set of nodes?
@@ -315,8 +315,8 @@
      * @deprecated
      */
     public DTMAxisIterator reset() {
-        _position = 0;
-        return this;
+	_position = 0;
+	return this;
     }
 
     /**
@@ -326,7 +326,7 @@
      * @deprecated
      */
     public int getLast() {
-        return (_nodes == null) ? 0 : _nodes.cardinality();
+	return (_nodes == null) ? 0 : _nodes.cardinality();
     }
 
     /**
@@ -336,7 +336,7 @@
      * @deprecated
      */
     public int getPosition() {
-        return _position;
+	return _position;
     }
 
     /**
@@ -346,7 +346,7 @@
      * @deprecated
      */
     public void setMark() {
-        _markedPosition = _position;
+	_markedPosition = _position;
     }
 
     /**
@@ -356,34 +356,34 @@
      * @deprecated
      */
     public void gotoMark() {
-        _position = _markedPosition;
+	_position = _markedPosition;
     }
 
-    /**
-     * <p>Set start to END should 'close' the iterator,
+    /** 
+     * <p>Set start to END should 'close' the iterator, 
      * i.e. subsequent call to next() should return END.</p>
      * <p><em>Use of an instance of this class as a {@link DTMAxisIterator} is
      * <b>deprecated.</b></em></p>
      * @deprecated
      */
     public DTMAxisIterator setStartNode(int start) {
-        if (start == DTMAxisIterator.END) {
-            _nodes = null;
-        }
-        else if (_nodes != null) {
-            _position = 0;
-        }
-        return (DTMAxisIterator) this;
+	if (start == DTMAxisIterator.END) {
+	    _nodes = null;
+	}
+	else if (_nodes != null) {
+	    _position = 0;
+	}
+	return (DTMAxisIterator) this;
     }
-
-    /**
-     * <p>Get start to END should 'close' the iterator,
+    
+    /** 
+     * <p>Get start to END should 'close' the iterator, 
      * i.e. subsequent call to next() should return END.</p>
      * <p><em>Use of an instance of this class as a {@link DTMAxisIterator} is
      * <b>deprecated.</b></em></p>
      * @deprecated
      */
-    public int getStartNode() {
+    public int getStartNode() {      
         return 0;
     }
 
@@ -394,7 +394,7 @@
      * @deprecated
      */
     public boolean isReverse() {
-        return(false);
+	return(false);
     }
 
     /**
@@ -404,32 +404,32 @@
      * @deprecated
      */
     public DTMAxisIterator cloneIterator() {
-        KeyIndex other = new KeyIndex(0);
-        other._index = _index;
+	KeyIndex other = new KeyIndex(0);
+	other._index = _index;
         other._rootToIndexMap = _rootToIndexMap;
-        other._nodes = _nodes;
-        other._position = _position;
-        return (DTMAxisIterator) other;
+	other._nodes = _nodes;
+	other._position = _position;
+	return (DTMAxisIterator) other;
     }
-
+    
     public void setDom(DOM dom, int node) {
         _dom = dom;
-
+        
         // If a MultiDOM, ensure _enhancedDOM is correctly set
         // so that getElementById() works in lookupNodes below
         if (dom instanceof MultiDOM) {
             dom = ((MultiDOM) dom).getDTM(node);
         }
-
-        if (dom instanceof DOMEnhancedForDTM) {
-            _enhancedDOM = (DOMEnhancedForDTM)dom;
-        }
-        else if (dom instanceof DOMAdapter) {
-            DOM idom = ((DOMAdapter)dom).getDOMImpl();
-            if (idom instanceof DOMEnhancedForDTM) {
-                _enhancedDOM = (DOMEnhancedForDTM)idom;
-            }
-        }
+        
+    	if (dom instanceof DOMEnhancedForDTM) {
+    	    _enhancedDOM = (DOMEnhancedForDTM)dom;
+    	}
+    	else if (dom instanceof DOMAdapter) {
+    	    DOM idom = ((DOMAdapter)dom).getDOMImpl();
+    	    if (idom instanceof DOMEnhancedForDTM) {
+    	        _enhancedDOM = (DOMEnhancedForDTM)idom;
+    	    }
+    	}
     }
 
     /**
@@ -678,7 +678,7 @@
         }
 
         /**
-         * Retrieve nodes for a particular key value or a particular id
+         * Retrieve nodes for a particular key value or a particular id 
          * argument value.
          *
          * @param root The root node of the document containing the context node
@@ -741,7 +741,7 @@
          */
         public DTMAxisIterator setStartNode(int node) {
             _startNode = node;
-
+            
             // If the arugment to the function is a node set, set the
             // context node on it.
             if (_keyValueIterator != null) {
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultipleNodeCounter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/MultipleNodeCounter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -37,84 +37,84 @@
     private DTMAxisIterator _precSiblings = null;
 
     public MultipleNodeCounter(Translet translet,
-                               DOM document, DTMAxisIterator iterator) {
-        super(translet, document, iterator);
+			       DOM document, DTMAxisIterator iterator) {
+	super(translet, document, iterator);
     }
-
+	
     public MultipleNodeCounter(Translet translet,
-                               DOM document,
+			       DOM document, 
                                DTMAxisIterator iterator,
                                boolean hasFrom) {
-        super(translet, document, iterator, hasFrom);
+	super(translet, document, iterator, hasFrom);
     }
-
+    
     public NodeCounter setStartNode(int node) {
-        _node = node;
-        _nodeType = _document.getExpandedTypeID(node);
+	_node = node;
+	_nodeType = _document.getExpandedTypeID(node);
     _precSiblings = _document.getAxisIterator(Axis.PRECEDINGSIBLING);
-        return this;
+	return this;
     }
 
     public String getCounter() {
-        if (_value != Integer.MIN_VALUE) {
+	if (_value != Integer.MIN_VALUE) {
             //See Errata E24
             if (_value == 0) return "0";
             else if (Double.isNaN(_value)) return "NaN";
             else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
             else if (Double.isInfinite(_value)) return "Infinity";
-            else return formatNumbers((int)_value);
-        }
+	    else return formatNumbers((int)_value);
+	}
 
-        IntegerArray ancestors = new IntegerArray();
+	IntegerArray ancestors = new IntegerArray();
 
-        // Gather all ancestors that do not match from pattern
-        int next = _node;
-        ancestors.add(next);            // include self
-        while ((next = _document.getParent(next)) > END &&
-               !matchesFrom(next)) {
-            ancestors.add(next);
-        }
+	// Gather all ancestors that do not match from pattern
+	int next = _node;
+	ancestors.add(next);		// include self
+	while ((next = _document.getParent(next)) > END && 
+	       !matchesFrom(next)) {
+	    ancestors.add(next);
+	}
 
-        // Create an array of counters
-        final int nAncestors = ancestors.cardinality();
-        final int[] counters = new int[nAncestors];
-        for (int i = 0; i < nAncestors; i++) {
-            counters[i] = Integer.MIN_VALUE;
-        }
+	// Create an array of counters
+	final int nAncestors = ancestors.cardinality();
+	final int[] counters = new int[nAncestors]; 
+	for (int i = 0; i < nAncestors; i++) {
+	    counters[i] = Integer.MIN_VALUE;
+	}
 
-        // Increment array of counters according to semantics
-        for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
-            final int counter = counters[j];
-            final int ancestor = ancestors.at(i);
+	// Increment array of counters according to semantics
+	for (int j = 0, i = nAncestors - 1; i >= 0 ; i--, j++) {
+	    final int counter = counters[j];
+	    final int ancestor = ancestors.at(i);
 
-            if (matchesCount(ancestor)) {
-                _precSiblings.setStartNode(ancestor);
-                while ((next = _precSiblings.next()) != END) {
-                    if (matchesCount(next)) {
-                        counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1
-                            : counters[j] + 1;
-                    }
-                }
-                // Count the node itself
-                counters[j] = counters[j] == Integer.MIN_VALUE
-                    ? 1
-                    : counters[j] + 1;
-            }
-        }
-        return formatNumbers(counters);
+	    if (matchesCount(ancestor)) {
+		_precSiblings.setStartNode(ancestor);
+		while ((next = _precSiblings.next()) != END) {
+		    if (matchesCount(next)) {
+			counters[j] = (counters[j] == Integer.MIN_VALUE) ? 1 
+			    : counters[j] + 1;		
+		    }
+		}
+		// Count the node itself
+		counters[j] = counters[j] == Integer.MIN_VALUE
+		    ? 1 
+		    : counters[j] + 1;	
+	    }
+	}
+	return formatNumbers(counters);
     }
 
     public static NodeCounter getDefaultNodeCounter(Translet translet,
-                                                    DOM document,
-                                                    DTMAxisIterator iterator) {
-        return new DefaultMultipleNodeCounter(translet, document, iterator);
+						    DOM document,
+						    DTMAxisIterator iterator) {
+	return new DefaultMultipleNodeCounter(translet, document, iterator);
     }
 
     static class DefaultMultipleNodeCounter extends MultipleNodeCounter {
-        public DefaultMultipleNodeCounter(Translet translet,
-                                          DOM document,
-                                          DTMAxisIterator iterator) {
-            super(translet, document, iterator);
-        }
+	public DefaultMultipleNodeCounter(Translet translet,
+					  DOM document,
+					  DTMAxisIterator iterator) {
+	    super(translet, document, iterator);
+	}
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeCounter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/NodeCounter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -60,29 +60,29 @@
     private int _nSepars  = 0;
     private int _nFormats = 0;
 
-    private final static String[] Thousands =
+    private final static String[] Thousands = 
         {"", "m", "mm", "mmm" };
-    private final static String[] Hundreds =
+    private final static String[] Hundreds = 
     {"", "c", "cc", "ccc", "cd", "d", "dc", "dcc", "dccc", "cm"};
-    private final static String[] Tens =
+    private final static String[] Tens = 
     {"", "x", "xx", "xxx", "xl", "l", "lx", "lxx", "lxxx", "xc"};
-    private final static String[] Ones =
+    private final static String[] Ones = 
     {"", "i", "ii", "iii", "iv", "v", "vi", "vii", "viii", "ix"};
-
+  
     private StringBuffer _tempBuffer = new StringBuffer();
-
+    
     /**
      * Indicates if this instance of xsl:number has a from pattern.
      */
     protected boolean _hasFrom;
-
+    
     protected NodeCounter(Translet translet,
               DOM document, DTMAxisIterator iterator) {
     _translet = translet;
     _document = document;
     _iterator = iterator;
     }
-
+    
     protected NodeCounter(Translet translet,
               DOM document, DTMAxisIterator iterator, boolean hasFrom) {
         _translet = translet;
@@ -91,14 +91,14 @@
         _hasFrom = hasFrom;
     }
 
-    /**
+    /** 
      * Set the start node for this counter. The same <tt>NodeCounter</tt>
      * object can be used multiple times by resetting the starting node.
      */
     abstract public NodeCounter setStartNode(int node);
 
-    /**
-     * If the user specified a value attribute, use this instead of
+    /** 
+     * If the user specified a value attribute, use this instead of 
      * counting nodes.
      */
     public NodeCounter setValue(double value) {
@@ -124,8 +124,8 @@
     setTokens(format);
 
  }
-
-  // format == null assumed here
+  
+  // format == null assumed here 
  private final void setTokens(final String format){
      if( (_format!=null) &&(format.equals(_format)) ){// has already been set
         return;
@@ -141,7 +141,7 @@
      _separToks.clear() ;
      _formatToks.clear();
 
-         /*
+         /* 
           * Tokenize the format string into alphanumeric and non-alphanumeric
           * tokens as described in M. Kay page 241.
           */
@@ -173,7 +173,7 @@
              }
 
          _nSepars = _separToks.size();
-         _nFormats = _formatToks.size();
+         _nFormats = _formatToks.size(); 
          if (_nSepars > _nFormats) _separLast = true;
 
          if (_separFirst) _nSepars--;
@@ -183,7 +183,7 @@
              _nSepars++;
          }
          if (_separFirst) _nSepars ++;
-
+ 
  }
     /**
      * Sets formatting fields to their default values.
@@ -194,13 +194,13 @@
     }
 
     /**
-     * Returns the position of <tt>node</tt> according to the level and
+     * Returns the position of <tt>node</tt> according to the level and 
      * the from and count patterns.
      */
     abstract public String getCounter();
 
     /**
-     * Returns the position of <tt>node</tt> according to the level and
+     * Returns the position of <tt>node</tt> according to the level and 
      * the from and count patterns. This position is converted into a
      * string based on the arguments passed.
      */
@@ -212,7 +212,7 @@
 
     /**
      * Returns true if <tt>node</tt> matches the count pattern. By
-     * default a node matches the count patterns if it is of the
+     * default a node matches the count patterns if it is of the 
      * same type as the starting node.
      */
     public boolean matchesCount(int node) {
@@ -220,7 +220,7 @@
     }
 
     /**
-     * Returns true if <tt>node</tt> matches the from pattern. By default,
+     * Returns true if <tt>node</tt> matches the from pattern. By default, 
      * no node matches the from pattern.
      */
     public boolean matchesFrom(int node) {
@@ -276,7 +276,7 @@
     }
 
     /**
-     * Format a single value based on the appropriate formatting token.
+     * Format a single value based on the appropriate formatting token. 
      * This method is based on saxon (Michael Kay) and only implements
      * lang="en".
      */
@@ -296,12 +296,12 @@
                 s = (char) ((int) zero + (n % 10)) + s;
                 n = n / 10;
             }
-
+                
             for (int i = 0; i < format.length() - s.length(); i++) {
                 temp.append(zero);
             }
             temp.append(s);
-
+            
             if (_groupSize > 0) {
                 for (int i = 0; i < temp.length(); i++) {
                     if (i != 0 && ((temp.length() - i) % _groupSize) == 0) {
@@ -310,18 +310,18 @@
                     buffer.append(temp.charAt(i));
                 }
             }
-        }
+        } 
     else if (c == 'i' && !_letterValue.equals("alphabetic")) {
             buffer.append(romanValue(value));
-        }
+        } 
     else if (c == 'I' && !_letterValue.equals("alphabetic")) {
             buffer.append(romanValue(value).toUpperCase());
-        }
+        } 
     else {
         int min = (int) c;
         int max = (int) c;
 
-        // Special case for Greek alphabet
+        // Special case for Greek alphabet 
         if (c >= 0x3b1 && c <= 0x3c9) {
         max = 0x3c9;    // omega
         }
@@ -344,7 +344,7 @@
         char last = (char)(((value-1) % range) + min);
         if (value > range) {
             return alphaValue((value-1) / range, min, max) + last;
-        }
+        } 
     else {
             return "" + last;
         }
@@ -362,3 +362,4 @@
     }
 
 }
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:41:00 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = -5948733402959678002L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/SingleNodeCounter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/dom/SingleNodeCounter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -38,55 +38,55 @@
     DTMAxisIterator _countSiblings = null;
 
     public SingleNodeCounter(Translet translet,
-                             DOM document,
-                             DTMAxisIterator iterator) {
-        super(translet, document, iterator);
+			     DOM document,
+			     DTMAxisIterator iterator) {
+	super(translet, document, iterator);
     }
 
     public SingleNodeCounter(Translet translet,
-                             DOM document,
-                             DTMAxisIterator iterator,
+			     DOM document,
+			     DTMAxisIterator iterator,
                              boolean hasFrom) {
-        super(translet, document, iterator, hasFrom);
+	super(translet, document, iterator, hasFrom);
     }
-
+    
     public NodeCounter setStartNode(int node) {
-        _node = node;
-        _nodeType = _document.getExpandedTypeID(node);
+	_node = node;
+	_nodeType = _document.getExpandedTypeID(node);
     _countSiblings = _document.getAxisIterator(Axis.PRECEDINGSIBLING);
-        return this;
+	return this;
     }
 
     public String getCounter() {
-        int result;
-        if (_value != Integer.MIN_VALUE) {
+	int result;
+	if (_value != Integer.MIN_VALUE) {
                 //See Errata E24
                 if (_value == 0) return "0";
                 else if (Double.isNaN(_value)) return "NaN";
                 else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
                 else if (Double.isInfinite(_value)) return "Infinity";
                 else result = (int) _value;
-        }
-        else {
-            int next = _node;
-            result = 0;
+	}
+	else {
+	    int next = _node;
+	    result = 0;
             boolean matchesCount = matchesCount(next);
+            
+	    if (!matchesCount) {
+		while ((next = _document.getParent(next)) > END) {
+		    if (matchesCount(next)) {
+			break;		// found target
+		    }
+		    if (matchesFrom(next)) {
+			next = END;
+			break;		// no target found
+		    }
+		}
+	    }
 
-            if (!matchesCount) {
-                while ((next = _document.getParent(next)) > END) {
-                    if (matchesCount(next)) {
-                        break;          // found target
-                    }
-                    if (matchesFrom(next)) {
-                        next = END;
-                        break;          // no target found
-                    }
-                }
-            }
-
-            if (next != END) {
+	    if (next != END) {
                 int from = next;
-
+                
                 if (!matchesCount && _hasFrom) {
                     // Target found, but need to check if ancestor matches from
                     while ((from = _document.getParent(from)) > END) {
@@ -95,64 +95,65 @@
                         }
                     }
                 }
-
+                
                 // Have we found ancestor matching from?
                 if (from != END) {
                     _countSiblings.setStartNode(next);
                     do {
                         if (matchesCount(next)) result++;
                     } while ((next = _countSiblings.next()) != END);
-
+                    
                     return formatNumbers(result);
                 }
-            }
-
+	    }
+            
             // If no target found then pass the empty list
             return formatNumbers(EmptyArray);
-        }
-        return formatNumbers(result);
+	}
+	return formatNumbers(result);
     }
 
     public static NodeCounter getDefaultNodeCounter(Translet translet,
-                                                    DOM document,
-                                                    DTMAxisIterator iterator) {
-        return new DefaultSingleNodeCounter(translet, document, iterator);
+						    DOM document,
+						    DTMAxisIterator iterator) {
+	return new DefaultSingleNodeCounter(translet, document, iterator);
     }
 
     static class DefaultSingleNodeCounter extends SingleNodeCounter {
-        public DefaultSingleNodeCounter(Translet translet,
-                                        DOM document, DTMAxisIterator iterator) {
-            super(translet, document, iterator);
-        }
+	public DefaultSingleNodeCounter(Translet translet,
+					DOM document, DTMAxisIterator iterator) {
+	    super(translet, document, iterator);
+	}
 
-        public NodeCounter setStartNode(int node) {
-            _node = node;
-            _nodeType = _document.getExpandedTypeID(node);
-            _countSiblings =
+	public NodeCounter setStartNode(int node) {
+	    _node = node;
+	    _nodeType = _document.getExpandedTypeID(node);
+	    _countSiblings =
         _document.getTypedAxisIterator(Axis.PRECEDINGSIBLING,
-                                               _document.getExpandedTypeID(node));
-            return this;
-        }
+					       _document.getExpandedTypeID(node));
+	    return this;
+	}
 
-        public String getCounter() {
-            int result;
-            if (_value != Integer.MIN_VALUE) {
+	public String getCounter() {
+	    int result;
+	    if (_value != Integer.MIN_VALUE) {
                 //See Errata E24
                 if (_value == 0) return "0";
                 else if (Double.isNaN(_value)) return "NaN";
                 else if (_value < 0 && Double.isInfinite(_value)) return "-Infinity";
                 else if (Double.isInfinite(_value)) return "Infinity";
                 else result = (int) _value;
-            }
-            else {
-                int next;
-                result = 1;
-                _countSiblings.setStartNode(_node);
-                while ((next = _countSiblings.next()) != END) {
-                    result++;
-                }
-            }
-            return formatNumbers(result);
-        }
+	    }
+	    else {
+		int next;
+		result = 1;
+		_countSiblings.setStartNode(_node);
+		while ((next = _countSiblings.next()) != END) {
+		    result++;
+		}
+	    }
+	    return formatNumbers(result);
+	}
     }
 }
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/runtime/BasisLibrary.java	Wed Sep 28 16:49:43 2011 +0100
@@ -30,7 +30,6 @@
 import java.text.NumberFormat;
 import java.util.Locale;
 import java.util.ResourceBundle;
-
 import javax.xml.transform.dom.DOMSource;
 
 import com.sun.org.apache.xalan.internal.xsltc.DOM;
@@ -54,18 +53,39 @@
 import com.sun.org.apache.xml.internal.utils.XML11Char;
 
 /**
- * Standard XSLT functions. All standard functions expect the current node
+ * Standard XSLT functions. All standard functions expect the current node 
  * and the DOM as their last two arguments.
  */
 public final class BasisLibrary {
 
     private final static String EMPTYSTRING = "";
+    
+    /**
+     * Re-use a single instance of StringBuffer (per thread) in the basis library.
+     * StringBuilder is better, however, DecimalFormat only accept StringBuffer
+     */
+    private static final ThreadLocal<StringBuilder> threadLocalStringBuilder =
+        new ThreadLocal<StringBuilder> () {
+            @Override protected StringBuilder initialValue() {
+                return new StringBuilder();
+            }
+    };
+
+    /**
+     * ThreadLocal for StringBuffer used
+     */
+    private static final ThreadLocal<StringBuffer> threadLocalStringBuffer =
+        new ThreadLocal<StringBuffer> () {
+            @Override protected StringBuffer initialValue() {
+                return new StringBuffer();
+            }
+    };
 
     /**
      * Standard function count(node-set)
      */
     public static int countF(DTMAxisIterator iterator) {
-        return(iterator.getLast());
+	return(iterator.getLast());
     }
 
     /**
@@ -80,117 +100,117 @@
     }
 
     /**
-     * XSLT Standard function sum(node-set).
+     * XSLT Standard function sum(node-set). 
      * stringToDouble is inlined
      */
     public static double sumF(DTMAxisIterator iterator, DOM dom) {
-        try {
-            double result = 0.0;
-            int node;
-            while ((node = iterator.next()) != DTMAxisIterator.END) {
-                result += Double.parseDouble(dom.getStringValueX(node));
-            }
-            return result;
-        }
-        catch (NumberFormatException e) {
-            return Double.NaN;
-        }
+	try {
+	    double result = 0.0;
+	    int node;
+	    while ((node = iterator.next()) != DTMAxisIterator.END) {
+		result += Double.parseDouble(dom.getStringValueX(node));
+	    }
+	    return result;
+	}
+	catch (NumberFormatException e) {
+	    return Double.NaN;
+	}
     }
 
     /**
      * XSLT Standard function string()
      */
     public static String stringF(int node, DOM dom) {
-        return dom.getStringValueX(node);
+	return dom.getStringValueX(node);
     }
 
     /**
      * XSLT Standard function string(value)
      */
     public static String stringF(Object obj, DOM dom) {
-        if (obj instanceof DTMAxisIterator) {
-            return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
-        }
-        else if (obj instanceof Node) {
-            return dom.getStringValueX(((Node)obj).node);
-        }
-        else if (obj instanceof DOM) {
-            return ((DOM)obj).getStringValue();
-        }
-        else {
-            return obj.toString();
-        }
+	if (obj instanceof DTMAxisIterator) {
+	    return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
+	}
+	else if (obj instanceof Node) {
+	    return dom.getStringValueX(((Node)obj).node);
+	}
+	else if (obj instanceof DOM) {
+	    return ((DOM)obj).getStringValue();
+	}
+	else {
+	    return obj.toString();
+	}
     }
 
     /**
      * XSLT Standard function string(value)
      */
     public static String stringF(Object obj, int node, DOM dom) {
-        if (obj instanceof DTMAxisIterator) {
-            return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
-        }
-        else if (obj instanceof Node) {
-            return dom.getStringValueX(((Node)obj).node);
-        }
-        else if (obj instanceof DOM) {
-            // When the first argument is a DOM we want the whole fecking
-            // DOM and not just a single node - that would not make sense.
-            //return ((DOM)obj).getStringValueX(node);
-            return ((DOM)obj).getStringValue();
-        }
-        else if (obj instanceof Double) {
-            Double d = (Double)obj;
-            final String result = d.toString();
-            final int length = result.length();
-            if ((result.charAt(length-2)=='.') &&
-                (result.charAt(length-1) == '0'))
-                return result.substring(0, length-2);
-            else
-                return result;
-        }
-        else {
-            return obj != null ? obj.toString() : "";
-        }
+	if (obj instanceof DTMAxisIterator) {
+	    return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
+	}
+	else if (obj instanceof Node) {
+	    return dom.getStringValueX(((Node)obj).node);
+	}
+	else if (obj instanceof DOM) {
+	    // When the first argument is a DOM we want the whole fecking
+	    // DOM and not just a single node - that would not make sense.
+	    //return ((DOM)obj).getStringValueX(node);
+	    return ((DOM)obj).getStringValue();
+	}
+	else if (obj instanceof Double) {
+	    Double d = (Double)obj;
+	    final String result = d.toString();
+	    final int length = result.length();
+	    if ((result.charAt(length-2)=='.') &&
+		(result.charAt(length-1) == '0'))
+		return result.substring(0, length-2);
+	    else
+		return result;
+	}
+	else {
+	    return obj != null ? obj.toString() : "";
+	}
     }
 
     /**
      * XSLT Standard function number()
      */
     public static double numberF(int node, DOM dom) {
-        return stringToReal(dom.getStringValueX(node));
+	return stringToReal(dom.getStringValueX(node));
     }
 
     /**
      * XSLT Standard function number(value)
      */
     public static double numberF(Object obj, DOM dom) {
-        if (obj instanceof Double) {
-            return ((Double) obj).doubleValue();
-        }
-        else if (obj instanceof Integer) {
-            return ((Integer) obj).doubleValue();
-        }
-        else if (obj instanceof Boolean) {
-            return  ((Boolean) obj).booleanValue() ? 1.0 : 0.0;
-        }
-        else if (obj instanceof String) {
-            return stringToReal((String) obj);
-        }
-        else if (obj instanceof DTMAxisIterator) {
-            DTMAxisIterator iter = (DTMAxisIterator) obj;
-            return stringToReal(dom.getStringValueX(iter.reset().next()));
-        }
-        else if (obj instanceof Node) {
-            return stringToReal(dom.getStringValueX(((Node) obj).node));
-        }
-        else if (obj instanceof DOM) {
-            return stringToReal(((DOM) obj).getStringValue());
-        }
-        else {
-            final String className = obj.getClass().getName();
-            runTimeError(INVALID_ARGUMENT_ERR, className, "number()");
-            return 0.0;
-        }
+	if (obj instanceof Double) {
+	    return ((Double) obj).doubleValue();
+	}
+	else if (obj instanceof Integer) {
+	    return ((Integer) obj).doubleValue();
+	}
+	else if (obj instanceof Boolean) {
+	    return  ((Boolean) obj).booleanValue() ? 1.0 : 0.0;
+	}
+	else if (obj instanceof String) {
+	    return stringToReal((String) obj);
+	}
+	else if (obj instanceof DTMAxisIterator) {
+	    DTMAxisIterator iter = (DTMAxisIterator) obj;
+	    return stringToReal(dom.getStringValueX(iter.reset().next()));
+	}
+	else if (obj instanceof Node) {
+	    return stringToReal(dom.getStringValueX(((Node) obj).node));
+	}
+	else if (obj instanceof DOM) {
+	    return stringToReal(((DOM) obj).getStringValue());
+	}
+	else {
+	    final String className = obj.getClass().getName();
+	    runTimeError(INVALID_ARGUMENT_ERR, className, "number()");
+	    return 0.0;
+	}
     }
 
     /**
@@ -205,35 +225,35 @@
      * XSLT Standard function boolean()
      */
     public static boolean booleanF(Object obj) {
-        if (obj instanceof Double) {
-            final double temp = ((Double) obj).doubleValue();
-            return temp != 0.0 && !Double.isNaN(temp);
-        }
-        else if (obj instanceof Integer) {
-            return ((Integer) obj).doubleValue() != 0;
-        }
-        else if (obj instanceof Boolean) {
-            return  ((Boolean) obj).booleanValue();
-        }
-        else if (obj instanceof String) {
-            return !((String) obj).equals(EMPTYSTRING);
-        }
-        else if (obj instanceof DTMAxisIterator) {
-            DTMAxisIterator iter = (DTMAxisIterator) obj;
-            return iter.reset().next() != DTMAxisIterator.END;
-        }
-        else if (obj instanceof Node) {
-            return true;
-        }
-        else if (obj instanceof DOM) {
-            String temp = ((DOM) obj).getStringValue();
-            return !temp.equals(EMPTYSTRING);
-        }
-        else {
-            final String className = obj.getClass().getName();
-            runTimeError(INVALID_ARGUMENT_ERR, className, "boolean()");
-        }
-        return false;
+	if (obj instanceof Double) {
+	    final double temp = ((Double) obj).doubleValue();
+	    return temp != 0.0 && !Double.isNaN(temp);
+	}
+	else if (obj instanceof Integer) {
+	    return ((Integer) obj).doubleValue() != 0;
+	}
+	else if (obj instanceof Boolean) {
+	    return  ((Boolean) obj).booleanValue();
+	}
+	else if (obj instanceof String) {
+	    return !((String) obj).equals(EMPTYSTRING);
+	}
+	else if (obj instanceof DTMAxisIterator) {
+	    DTMAxisIterator iter = (DTMAxisIterator) obj;
+	    return iter.reset().next() != DTMAxisIterator.END;
+	}
+	else if (obj instanceof Node) {
+	    return true;
+	}
+	else if (obj instanceof DOM) {
+	    String temp = ((DOM) obj).getStringValue();
+	    return !temp.equals(EMPTYSTRING);
+	}
+	else {
+	    final String className = obj.getClass().getName();
+	    runTimeError(INVALID_ARGUMENT_ERR, className, "boolean()");
+	}
+	return false;
     }
 
     /**
@@ -241,20 +261,20 @@
      * conversions resulting into NaNs and rounding.
      */
     public static String substringF(String value, double start) {
-        try {
-            final int strlen = value.length();
-            int istart = (int)Math.round(start) - 1;
+	try {
+	    final int strlen = value.length();
+	    int istart = (int)Math.round(start) - 1;
 
-            if (Double.isNaN(start)) return(EMPTYSTRING);
-            if (istart > strlen) return(EMPTYSTRING);
-            if (istart < 1) istart = 0;
+	    if (Double.isNaN(start)) return(EMPTYSTRING);
+	    if (istart > strlen) return(EMPTYSTRING);
+ 	    if (istart < 1) istart = 0;
 
-            return value.substring(istart);
-        }
-        catch (IndexOutOfBoundsException e) {
-            runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
-            return null;
-        }
+	    return value.substring(istart);
+	}
+	catch (IndexOutOfBoundsException e) {
+	    runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
+	    return null;
+	}
     }
 
     /**
@@ -262,130 +282,132 @@
      * conversions resulting into NaNs and rounding.
      */
     public static String substringF(String value, double start, double length) {
-        try {
-            final int strlen  = value.length();
-            int istart = (int)Math.round(start) - 1;
-            int isum   = istart + (int)Math.round(length);
+	try {
+	    final int strlen  = value.length();
+	    int istart = (int)Math.round(start) - 1;
+	    int isum   = istart + (int)Math.round(length);
 
-            if (Double.isInfinite(length)) isum = Integer.MAX_VALUE;
+	    if (Double.isInfinite(length)) isum = Integer.MAX_VALUE;
 
-            if (Double.isNaN(start) || Double.isNaN(length))
-                return(EMPTYSTRING);
-            if (Double.isInfinite(start)) return(EMPTYSTRING);
-            if (istart > strlen) return(EMPTYSTRING);
-            if (isum < 0) return(EMPTYSTRING);
-            if (istart < 0) istart = 0;
+	    if (Double.isNaN(start) || Double.isNaN(length))
+		return(EMPTYSTRING);
+	    if (Double.isInfinite(start)) return(EMPTYSTRING);
+	    if (istart > strlen) return(EMPTYSTRING);
+	    if (isum < 0) return(EMPTYSTRING);
+ 	    if (istart < 0) istart = 0;
 
-            if (isum > strlen)
-                return value.substring(istart);
-            else
-                return value.substring(istart, isum);
-        }
-        catch (IndexOutOfBoundsException e) {
-            runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
-            return null;
-        }
+	    if (isum > strlen)
+		return value.substring(istart);
+	    else
+		return value.substring(istart, isum);
+	}
+	catch (IndexOutOfBoundsException e) {
+	    runTimeError(RUN_TIME_INTERNAL_ERR, "substring()");
+	    return null;
+	}
     }
 
     /**
-     * XSLT Standard function substring-after().
+     * XSLT Standard function substring-after(). 
      */
     public static String substring_afterF(String value, String substring) {
-        final int index = value.indexOf(substring);
-        if (index >= 0)
-            return value.substring(index + substring.length());
-        else
-            return EMPTYSTRING;
+	final int index = value.indexOf(substring);
+	if (index >= 0)
+	    return value.substring(index + substring.length());
+	else
+	    return EMPTYSTRING;
     }
 
     /**
-     * XSLT Standard function substring-before().
+     * XSLT Standard function substring-before(). 
      */
     public static String substring_beforeF(String value, String substring) {
-        final int index = value.indexOf(substring);
-        if (index >= 0)
-            return value.substring(0, index);
-        else
-            return EMPTYSTRING;
+	final int index = value.indexOf(substring);
+	if (index >= 0)
+	    return value.substring(0, index);
+	else
+	    return EMPTYSTRING;
     }
 
     /**
-     * XSLT Standard function translate().
+     * XSLT Standard function translate(). 
      */
     public static String translateF(String value, String from, String to) {
-        final int tol = to.length();
-        final int froml = from.length();
-        final int valuel = value.length();
+	final int tol = to.length();
+	final int froml = from.length();
+	final int valuel = value.length();
 
-        final StringBuffer result = new StringBuffer();
-        for (int j, i = 0; i < valuel; i++) {
-            final char ch = value.charAt(i);
-            for (j = 0; j < froml; j++) {
-                if (ch == from.charAt(j)) {
-                    if (j < tol)
-                        result.append(to.charAt(j));
-                    break;
-                }
-            }
-            if (j == froml)
-                result.append(ch);
-        }
-        return result.toString();
+	final StringBuilder result = threadLocalStringBuilder.get();
+    result.setLength(0);
+	for (int j, i = 0; i < valuel; i++) {
+	    final char ch = value.charAt(i);
+	    for (j = 0; j < froml; j++) {
+		if (ch == from.charAt(j)) {
+		    if (j < tol)
+			result.append(to.charAt(j));
+		    break;
+		}
+	    }	
+	    if (j == froml)
+		result.append(ch);
+	}
+	return result.toString();
     }
 
     /**
-     * XSLT Standard function normalize-space().
+     * XSLT Standard function normalize-space(). 
      */
     public static String normalize_spaceF(int node, DOM dom) {
-        return normalize_spaceF(dom.getStringValueX(node));
+	return normalize_spaceF(dom.getStringValueX(node));
     }
 
     /**
-     * XSLT Standard function normalize-space(string).
+     * XSLT Standard function normalize-space(string). 
      */
     public static String normalize_spaceF(String value) {
-        int i = 0, n = value.length();
-        StringBuffer result = new StringBuffer();
-
-        while (i < n && isWhiteSpace(value.charAt(i)))
-            i++;
+	int i = 0, n = value.length();
+	StringBuilder result = threadLocalStringBuilder.get();
+    result.setLength(0);
+        
+	while (i < n && isWhiteSpace(value.charAt(i)))
+	    i++;
 
-        while (true) {
-            while (i < n && !isWhiteSpace(value.charAt(i))) {
-                result.append(value.charAt(i++));
-            }
-            if (i == n)
-                break;
-            while (i < n && isWhiteSpace(value.charAt(i))) {
-                i++;
-            }
-            if (i < n)
-                result.append(' ');
-        }
-        return result.toString();
+	while (true) {
+	    while (i < n && !isWhiteSpace(value.charAt(i))) {
+		result.append(value.charAt(i++));
+	    }
+	    if (i == n)
+		break;
+	    while (i < n && isWhiteSpace(value.charAt(i))) {
+		i++;
+	    }
+	    if (i < n)
+		result.append(' ');
+	}
+	return result.toString();
     }
 
     /**
-     * XSLT Standard function generate-id().
+     * XSLT Standard function generate-id(). 
      */
     public static String generate_idF(int node) {
-        if (node > 0)
-            // Only generate ID if node exists
-            return "N" + node;
-        else
-            // Otherwise return an empty string
-            return EMPTYSTRING;
+	if (node > 0)
+	    // Only generate ID if node exists
+	    return "N" + node;
+	else
+	    // Otherwise return an empty string
+	    return EMPTYSTRING;
     }
-
+    
     /**
-     * utility function for calls to local-name().
+     * utility function for calls to local-name(). 
      */
     public static String getLocalName(String value) {
-        int idx = value.lastIndexOf(':');
-        if (idx >= 0) value = value.substring(idx + 1);
-        idx = value.lastIndexOf('@');
-        if (idx >= 0) value = value.substring(idx + 1);
-        return(value);
+	int idx = value.lastIndexOf(':');
+	if (idx >= 0) value = value.substring(idx + 1);
+	idx = value.lastIndexOf('@');
+	if (idx >= 0) value = value.substring(idx + 1);
+	return(value);
     }
 
     /**
@@ -398,11 +420,11 @@
      * an unresolved external function.
      */
     public static void unresolved_externalF(String name) {
-        runTimeError(EXTERNAL_FUNC_ERR, name);
+	runTimeError(EXTERNAL_FUNC_ERR, name);
     }
 
     /**
-     * Utility function to throw a runtime error on the use of an extension
+     * Utility function to throw a runtime error on the use of an extension 
      * function when the secure processing feature is set to true.
      */
     public static void unallowed_extension_functionF(String name) {
@@ -410,7 +432,7 @@
     }
 
     /**
-     * Utility function to throw a runtime error on the use of an extension
+     * Utility function to throw a runtime error on the use of an extension 
      * element when the secure processing feature is set to true.
      */
     public static void unallowed_extension_elementF(String name) {
@@ -419,55 +441,55 @@
 
     /**
      * Utility function to throw a runtime error for an unsupported element.
-     *
+     * 
      * This is only used in forward-compatibility mode, when the control flow
-     * cannot be determined. In 1.0 mode, the error message is emitted at
+     * cannot be determined. In 1.0 mode, the error message is emitted at 
      * compile time.
      */
     public static void unsupported_ElementF(String qname, boolean isExtension) {
-        if (isExtension)
-            runTimeError(UNSUPPORTED_EXT_ERR, qname);
-        else
-            runTimeError(UNSUPPORTED_XSL_ERR, qname);
-    }
+	if (isExtension)
+	    runTimeError(UNSUPPORTED_EXT_ERR, qname);
+	else
+	    runTimeError(UNSUPPORTED_XSL_ERR, qname);
+    }     
 
     /**
      * XSLT Standard function namespace-uri(node-set).
      */
     public static String namespace_uriF(DTMAxisIterator iter, DOM dom) {
-        return namespace_uriF(iter.next(), dom);
+	return namespace_uriF(iter.next(), dom);
     }
 
     /**
      * XSLT Standard function system-property(name)
      */
     public static String system_propertyF(String name) {
-        if (name.equals("xsl:version"))
-            return("1.0");
-        if (name.equals("xsl:vendor"))
-            return("Apache Software Foundation (Xalan XSLTC)");
-        if (name.equals("xsl:vendor-url"))
-            return("http://xml.apache.org/xalan-j");
-
-        runTimeError(INVALID_ARGUMENT_ERR, name, "system-property()");
-        return(EMPTYSTRING);
+	if (name.equals("xsl:version"))
+	    return("1.0");
+	if (name.equals("xsl:vendor"))
+	    return("Apache Software Foundation (Xalan XSLTC)");
+	if (name.equals("xsl:vendor-url"))
+	    return("http://xml.apache.org/xalan-j");
+	
+	runTimeError(INVALID_ARGUMENT_ERR, name, "system-property()");
+	return(EMPTYSTRING);
     }
 
     /**
-     * XSLT Standard function namespace-uri().
+     * XSLT Standard function namespace-uri(). 
      */
     public static String namespace_uriF(int node, DOM dom) {
-        final String value = dom.getNodeName(node);
-        final int colon = value.lastIndexOf(':');
-        if (colon >= 0)
-            return value.substring(0, colon);
-        else
-            return EMPTYSTRING;
+	final String value = dom.getNodeName(node);
+	final int colon = value.lastIndexOf(':');
+	if (colon >= 0)
+	    return value.substring(0, colon);
+	else
+	    return EMPTYSTRING;
     }
 
     /**
      * Implements the object-type() extension function.
-     *
+     * 
      * @see <a href="http://www.exslt.org/">EXSLT</a>
      */
     public static String objectTypeF(Object obj)
@@ -484,74 +506,74 @@
         return "node-set";
       else
         return "unknown";
-    }
+    }  
 
     /**
-     * Implements the nodeset() extension function.
+     * Implements the nodeset() extension function. 
      */
     public static DTMAxisIterator nodesetF(Object obj) {
-        if (obj instanceof DOM) {
-           //final DOMAdapter adapter = (DOMAdapter) obj;
-           final DOM dom = (DOM)obj;
-           return new SingletonIterator(dom.getDocument(), true);
-        }
+	if (obj instanceof DOM) {
+	   //final DOMAdapter adapter = (DOMAdapter) obj;
+	   final DOM dom = (DOM)obj;
+	   return new SingletonIterator(dom.getDocument(), true);
+	}
         else if (obj instanceof DTMAxisIterator) {
-           return (DTMAxisIterator) obj;
+	   return (DTMAxisIterator) obj;
         }
         else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, "node-set", className);
-            return null;
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, "node-set", className);
+	    return null;
         }
     }
 
     //-- Begin utility functions
 
     private static boolean isWhiteSpace(char ch) {
-        return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r';
+	return ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r';
     }
 
     private static boolean compareStrings(String lstring, String rstring,
-                                          int op, DOM dom) {
-        switch (op) {
+					  int op, DOM dom) {
+	switch (op) {
     case Operators.EQ:
-            return lstring.equals(rstring);
+	    return lstring.equals(rstring);
 
     case Operators.NE:
-            return !lstring.equals(rstring);
+	    return !lstring.equals(rstring);
 
     case Operators.GT:
-            return numberF(lstring, dom) > numberF(rstring, dom);
+	    return numberF(lstring, dom) > numberF(rstring, dom);
 
     case Operators.LT:
-            return numberF(lstring, dom) < numberF(rstring, dom);
+	    return numberF(lstring, dom) < numberF(rstring, dom);
 
     case Operators.GE:
-            return numberF(lstring, dom) >= numberF(rstring, dom);
-
+	    return numberF(lstring, dom) >= numberF(rstring, dom);
+        
     case Operators.LE:
-            return numberF(lstring, dom) <= numberF(rstring, dom);
+	    return numberF(lstring, dom) <= numberF(rstring, dom);
 
-        default:
-            runTimeError(RUN_TIME_INTERNAL_ERR, "compare()");
-            return false;
-        }
+	default:
+	    runTimeError(RUN_TIME_INTERNAL_ERR, "compare()");
+	    return false;
+	}
     }
 
     /**
-     * Utility function: node-set/node-set compare.
+     * Utility function: node-set/node-set compare. 
      */
     public static boolean compare(DTMAxisIterator left, DTMAxisIterator right,
-                                  int op, DOM dom) {
-        int lnode;
-        left.reset();
-
-        while ((lnode = left.next()) != DTMAxisIterator.END) {
-            final String lvalue = dom.getStringValueX(lnode);
-
-            int rnode;
-            right.reset();
-            while ((rnode = right.next()) != DTMAxisIterator.END) {
+				  int op, DOM dom) {
+	int lnode;
+	left.reset();
+	
+	while ((lnode = left.next()) != DTMAxisIterator.END) {
+	    final String lvalue = dom.getStringValueX(lnode);
+	    
+	    int rnode;
+	    right.reset();
+	    while ((rnode = right.next()) != DTMAxisIterator.END) {
                 // String value must be the same if both nodes are the same
                 if (lnode == rnode) {
                     if (op == Operators.EQ) {
@@ -560,315 +582,315 @@
                         continue;
                     }
                 }
-                if (compareStrings(lvalue, dom.getStringValueX(rnode), op,
+		if (compareStrings(lvalue, dom.getStringValueX(rnode), op,
                                    dom)) {
-                    return true;
-                }
-            }
-        }
-        return false;
+		    return true;
+		}
+	    }
+	} 
+	return false;
     }
 
     public static boolean compare(int node, DTMAxisIterator iterator,
-                                  int op, DOM dom) {
-        //iterator.reset();
+				  int op, DOM dom) {
+	//iterator.reset();
 
-        int rnode;
-        String value;
+	int rnode;
+	String value;
 
-        switch(op) {
+	switch(op) {
     case Operators.EQ:
             rnode = iterator.next();
             if (rnode != DTMAxisIterator.END) {
-                value = dom.getStringValueX(node);
+	        value = dom.getStringValueX(node);
                 do {
-                    if (node == rnode
+		    if (node == rnode
                           || value.equals(dom.getStringValueX(rnode))) {
                        return true;
                     }
-                } while ((rnode = iterator.next()) != DTMAxisIterator.END);
+	        } while ((rnode = iterator.next()) != DTMAxisIterator.END);
             }
-            break;
+	    break;
     case Operators.NE:
             rnode = iterator.next();
             if (rnode != DTMAxisIterator.END) {
-                value = dom.getStringValueX(node);
+	        value = dom.getStringValueX(node);
                 do {
-                    if (node != rnode
+		    if (node != rnode
                           && !value.equals(dom.getStringValueX(rnode))) {
                         return true;
                     }
-                } while ((rnode = iterator.next()) != DTMAxisIterator.END);
-            }
-            break;
-    case Operators.LT:
-            // Assume we're comparing document order here
-            while ((rnode = iterator.next()) != DTMAxisIterator.END) {
-                if (rnode > node) return true;
+	        } while ((rnode = iterator.next()) != DTMAxisIterator.END);
             }
-            break;
+	    break;
+    case Operators.LT:
+	    // Assume we're comparing document order here
+	    while ((rnode = iterator.next()) != DTMAxisIterator.END) {
+		if (rnode > node) return true;
+	    }
+	    break;
     case Operators.GT:
-            // Assume we're comparing document order here
-            while ((rnode = iterator.next()) != DTMAxisIterator.END) {
-                if (rnode < node) return true;
-            }
-            break;
-        }
-        return(false);
+	    // Assume we're comparing document order here
+	    while ((rnode = iterator.next()) != DTMAxisIterator.END) {
+		if (rnode < node) return true;
+	    }
+	    break;
+	} 
+	return(false);
     }
 
     /**
      * Utility function: node-set/number compare.
      */
     public static boolean compare(DTMAxisIterator left, final double rnumber,
-                                  final int op, DOM dom) {
-        int node;
-        //left.reset();
+				  final int op, DOM dom) {
+	int node;
+	//left.reset();
 
-        switch (op) {
+	switch (op) {
     case Operators.EQ:
-            while ((node = left.next()) != DTMAxisIterator.END) {
-                if (numberF(dom.getStringValueX(node), dom) == rnumber)
-                    return true;
-            }
-            break;
+	    while ((node = left.next()) != DTMAxisIterator.END) {
+		if (numberF(dom.getStringValueX(node), dom) == rnumber)
+		    return true;
+	    }
+	    break;
 
     case Operators.NE:
-            while ((node = left.next()) != DTMAxisIterator.END) {
-                if (numberF(dom.getStringValueX(node), dom) != rnumber)
-                    return true;
-            }
-            break;
+	    while ((node = left.next()) != DTMAxisIterator.END) {
+		if (numberF(dom.getStringValueX(node), dom) != rnumber)
+		    return true;
+	    }
+	    break;
 
     case Operators.GT:
-            while ((node = left.next()) != DTMAxisIterator.END) {
-                if (numberF(dom.getStringValueX(node), dom) > rnumber)
-                    return true;
-            }
-            break;
+	    while ((node = left.next()) != DTMAxisIterator.END) {
+		if (numberF(dom.getStringValueX(node), dom) > rnumber)
+		    return true;
+	    }
+	    break;
 
     case Operators.LT:
-            while ((node = left.next()) != DTMAxisIterator.END) {
-                if (numberF(dom.getStringValueX(node), dom) < rnumber)
-                    return true;
-            }
-            break;
+	    while ((node = left.next()) != DTMAxisIterator.END) {
+		if (numberF(dom.getStringValueX(node), dom) < rnumber)
+		    return true;
+	    }
+	    break;
 
     case Operators.GE:
-            while ((node = left.next()) != DTMAxisIterator.END) {
-                if (numberF(dom.getStringValueX(node), dom) >= rnumber)
-                    return true;
-            }
-            break;
+	    while ((node = left.next()) != DTMAxisIterator.END) {
+		if (numberF(dom.getStringValueX(node), dom) >= rnumber)
+		    return true;
+	    }
+	    break;
 
     case Operators.LE:
-            while ((node = left.next()) != DTMAxisIterator.END) {
-                if (numberF(dom.getStringValueX(node), dom) <= rnumber)
-                    return true;
-            }
-            break;
+	    while ((node = left.next()) != DTMAxisIterator.END) {
+		if (numberF(dom.getStringValueX(node), dom) <= rnumber)
+		    return true;
+	    }
+	    break;
 
-        default:
-            runTimeError(RUN_TIME_INTERNAL_ERR, "compare()");
-        }
+	default:
+	    runTimeError(RUN_TIME_INTERNAL_ERR, "compare()");
+	}
 
-        return false;
+	return false;
     }
 
     /**
-     * Utility function: node-set/string comparison.
+     * Utility function: node-set/string comparison. 
      */
     public static boolean compare(DTMAxisIterator left, final String rstring,
-                                  int op, DOM dom) {
-        int node;
-        //left.reset();
-        while ((node = left.next()) != DTMAxisIterator.END) {
-            if (compareStrings(dom.getStringValueX(node), rstring, op, dom)) {
-                return true;
-            }
-        }
-        return false;
+				  int op, DOM dom) {
+	int node;
+	//left.reset();
+	while ((node = left.next()) != DTMAxisIterator.END) {
+	    if (compareStrings(dom.getStringValueX(node), rstring, op, dom)) {
+		return true;
+	    }
+	}
+	return false;
     }
 
 
     public static boolean compare(Object left, Object right,
-                                  int op, DOM dom)
-    {
-        boolean result = false;
-        boolean hasSimpleArgs = hasSimpleType(left) && hasSimpleType(right);
+				  int op, DOM dom) 
+    { 
+	boolean result = false;
+	boolean hasSimpleArgs = hasSimpleType(left) && hasSimpleType(right);
 
     if (op != Operators.EQ && op != Operators.NE) {
-            // If node-boolean comparison -> convert node to boolean
-            if (left instanceof Node || right instanceof Node) {
-                if (left instanceof Boolean) {
-                    right = new Boolean(booleanF(right));
-                    hasSimpleArgs = true;
-                }
-                if (right instanceof Boolean) {
-                    left = new Boolean(booleanF(left));
-                    hasSimpleArgs = true;
-                }
-            }
+	    // If node-boolean comparison -> convert node to boolean
+	    if (left instanceof Node || right instanceof Node) {
+		if (left instanceof Boolean) {
+		    right = new Boolean(booleanF(right));
+		    hasSimpleArgs = true;
+		}
+		if (right instanceof Boolean) {
+		    left = new Boolean(booleanF(left));
+		    hasSimpleArgs = true;
+		}
+	    }
 
-            if (hasSimpleArgs) {
-                switch (op) {
+	    if (hasSimpleArgs) {
+		switch (op) {
         case Operators.GT:
-                    return numberF(left, dom) > numberF(right, dom);
-
+		    return numberF(left, dom) > numberF(right, dom);
+		    
         case Operators.LT:
-                    return numberF(left, dom) < numberF(right, dom);
-
+		    return numberF(left, dom) < numberF(right, dom);
+		    
         case Operators.GE:
-                    return numberF(left, dom) >= numberF(right, dom);
-
+		    return numberF(left, dom) >= numberF(right, dom);
+		    
         case Operators.LE:
-                    return numberF(left, dom) <= numberF(right, dom);
-
+		    return numberF(left, dom) <= numberF(right, dom);
+		    
         default:
-                    runTimeError(RUN_TIME_INTERNAL_ERR, "compare()");
-                }
-            }
-            // falls through
-        }
+		    runTimeError(RUN_TIME_INTERNAL_ERR, "compare()");
+		}
+	    }
+	    // falls through
+	}
 
-        if (hasSimpleArgs) {
-            if (left instanceof Boolean || right instanceof Boolean) {
-                result = booleanF(left) == booleanF(right);
-            }
-            else if (left instanceof Double || right instanceof Double ||
-                     left instanceof Integer || right instanceof Integer) {
-                result = numberF(left, dom) == numberF(right, dom);
-            }
-            else { // compare them as strings
-                result = stringF(left, dom).equals(stringF(right, dom));
-            }
+	if (hasSimpleArgs) {
+	    if (left instanceof Boolean || right instanceof Boolean) {
+		result = booleanF(left) == booleanF(right);
+	    }
+	    else if (left instanceof Double || right instanceof Double ||
+		     left instanceof Integer || right instanceof Integer) {
+		result = numberF(left, dom) == numberF(right, dom);
+	    }
+	    else { // compare them as strings
+		result = stringF(left, dom).equals(stringF(right, dom));
+	    }
 
-            if (op == Operators.NE) {
-                result = !result;
-            }
-        }
-        else {
-            if (left instanceof Node) {
-                left = new SingletonIterator(((Node)left).node);
-            }
-            if (right instanceof Node) {
-                right = new SingletonIterator(((Node)right).node);
-            }
+	    if (op == Operators.NE) {
+		result = !result;
+	    }
+	}
+	else {
+	    if (left instanceof Node) {
+		left = new SingletonIterator(((Node)left).node);
+	    }
+	    if (right instanceof Node) {
+		right = new SingletonIterator(((Node)right).node);
+	    }
 
-            if (hasSimpleType(left) ||
-                left instanceof DOM && right instanceof DTMAxisIterator) {
-                // swap operands and operator
-                final Object temp = right; right = left; left = temp;
+	    if (hasSimpleType(left) ||
+		left instanceof DOM && right instanceof DTMAxisIterator) {
+		// swap operands and operator
+		final Object temp = right; right = left; left = temp;
                 op = Operators.swapOp(op);
-            }
+	    }
 
-            if (left instanceof DOM) {
-                if (right instanceof Boolean) {
-                    result = ((Boolean)right).booleanValue();
-                    return result == (op == Operators.EQ);
-                }
+	    if (left instanceof DOM) {
+		if (right instanceof Boolean) {
+		    result = ((Boolean)right).booleanValue();
+		    return result == (op == Operators.EQ);
+		}
 
-                final String sleft = ((DOM)left).getStringValue();
+		final String sleft = ((DOM)left).getStringValue();
 
-                if (right instanceof Number) {
-                    result = ((Number)right).doubleValue() ==
-                        stringToReal(sleft);
-                }
-                else if (right instanceof String) {
-                    result = sleft.equals((String)right);
-                }
-                else if (right instanceof DOM) {
-                    result = sleft.equals(((DOM)right).getStringValue());
-                }
+		if (right instanceof Number) {
+		    result = ((Number)right).doubleValue() ==
+			stringToReal(sleft);
+		}
+		else if (right instanceof String) {
+		    result = sleft.equals((String)right);
+		}
+		else if (right instanceof DOM) {
+		    result = sleft.equals(((DOM)right).getStringValue());
+		}
 
-                if (op == Operators.NE) {
-                    result = !result;
-                }
-                return result;
-            }
+		if (op == Operators.NE) {
+		    result = !result;
+		}
+		return result;
+	    }
 
-            // Next, node-set/t for t in {real, string, node-set, result-tree}
+	    // Next, node-set/t for t in {real, string, node-set, result-tree}
 
-            DTMAxisIterator iter = ((DTMAxisIterator)left).reset();
+	    DTMAxisIterator iter = ((DTMAxisIterator)left).reset();
 
-            if (right instanceof DTMAxisIterator) {
-                result = compare(iter, (DTMAxisIterator)right, op, dom);
-            }
-            else if (right instanceof String) {
-                result = compare(iter, (String)right, op, dom);
-            }
-            else if (right instanceof Number) {
-                final double temp = ((Number)right).doubleValue();
-                result = compare(iter, temp, op, dom);
-            }
-            else if (right instanceof Boolean) {
-                boolean temp = ((Boolean)right).booleanValue();
-                result = (iter.reset().next() != DTMAxisIterator.END) == temp;
-            }
-            else if (right instanceof DOM) {
-                result = compare(iter, ((DOM)right).getStringValue(),
-                                 op, dom);
-            }
-            else if (right == null) {
-                return(false);
-            }
-            else {
-                final String className = right.getClass().getName();
-                runTimeError(INVALID_ARGUMENT_ERR, className, "compare()");
-            }
-        }
-        return result;
+	    if (right instanceof DTMAxisIterator) {
+		result = compare(iter, (DTMAxisIterator)right, op, dom);
+	    }
+	    else if (right instanceof String) {
+		result = compare(iter, (String)right, op, dom);
+	    }	
+	    else if (right instanceof Number) {
+		final double temp = ((Number)right).doubleValue();
+		result = compare(iter, temp, op, dom);
+	    }
+	    else if (right instanceof Boolean) {
+		boolean temp = ((Boolean)right).booleanValue();
+		result = (iter.reset().next() != DTMAxisIterator.END) == temp;
+	    }
+	    else if (right instanceof DOM) {
+		result = compare(iter, ((DOM)right).getStringValue(),
+				 op, dom);
+	    }
+	    else if (right == null) {
+		return(false);
+	    }
+	    else {
+		final String className = right.getClass().getName();
+		runTimeError(INVALID_ARGUMENT_ERR, className, "compare()");
+	    }
+	}
+	return result;
     }
 
     /**
      * Utility function: used to test context node's language
      */
     public static boolean testLanguage(String testLang, DOM dom, int node) {
-        // language for context node (if any)
-        String nodeLang = dom.getLanguage(node);
-        if (nodeLang == null)
-            return(false);
-        else
-            nodeLang = nodeLang.toLowerCase();
+	// language for context node (if any)
+	String nodeLang = dom.getLanguage(node);
+	if (nodeLang == null)
+	    return(false);
+	else
+	    nodeLang = nodeLang.toLowerCase();
 
-        // compare context node's language agains test language
-        testLang = testLang.toLowerCase();
-        if (testLang.length() == 2) {
-            return(nodeLang.startsWith(testLang));
-        }
-        else {
-            return(nodeLang.equals(testLang));
-        }
+	// compare context node's language agains test language
+	testLang = testLang.toLowerCase();
+	if (testLang.length() == 2) {
+	    return(nodeLang.startsWith(testLang));
+	}
+	else {
+	    return(nodeLang.equals(testLang));
+	}
     }
 
     private static boolean hasSimpleType(Object obj) {
-        return obj instanceof Boolean || obj instanceof Double ||
-            obj instanceof Integer || obj instanceof String ||
-            obj instanceof Node || obj instanceof DOM;
+	return obj instanceof Boolean || obj instanceof Double ||
+	    obj instanceof Integer || obj instanceof String ||
+	    obj instanceof Node || obj instanceof DOM; 
     }
 
     /**
      * Utility function: used in StringType to convert a string to a real.
      */
     public static double stringToReal(String s) {
-        try {
-            return Double.valueOf(s).doubleValue();
-        }
-        catch (NumberFormatException e) {
-            return Double.NaN;
-        }
+	try {
+	    return Double.valueOf(s).doubleValue();
+	}
+	catch (NumberFormatException e) {
+	    return Double.NaN;
+	}
     }
 
     /**
      * Utility function: used in StringType to convert a string to an int.
      */
     public static int stringToInt(String s) {
-        try {
-            return Integer.parseInt(s);
-        }
-        catch (NumberFormatException e) {
-            return(-1); // ???
-        }
+	try {
+	    return Integer.parseInt(s);
+	}
+	catch (NumberFormatException e) {
+	    return(-1); // ???
+	}
     }
 
     private static final int DOUBLE_FRACTION_DIGITS = 340;
@@ -878,24 +900,24 @@
     private static String defaultPattern = "";
 
     static {
-        NumberFormat f = NumberFormat.getInstance(Locale.getDefault());
-        defaultFormatter = (f instanceof DecimalFormat) ?
-            (DecimalFormat) f : new DecimalFormat();
-        // Set max fraction digits so that truncation does not occur. Setting
+	NumberFormat f = NumberFormat.getInstance(Locale.getDefault());
+	defaultFormatter = (f instanceof DecimalFormat) ?
+	    (DecimalFormat) f : new DecimalFormat();
+	// Set max fraction digits so that truncation does not occur. Setting 
         // the max to Integer.MAX_VALUE may cause problems with some JDK's.
-        defaultFormatter.setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS);
+	defaultFormatter.setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS);
         defaultFormatter.setMinimumFractionDigits(0);
         defaultFormatter.setMinimumIntegerDigits(1);
         defaultFormatter.setGroupingUsed(false);
 
         // This formatter is used to convert numbers according to the XPath
         // 1.0 syntax which ignores locales (http://www.w3.org/TR/xpath#NT-Number)
-        xpathFormatter = new DecimalFormat("",
+        xpathFormatter = new DecimalFormat("", 
             new DecimalFormatSymbols(Locale.US));
-        xpathFormatter.setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS);
+	xpathFormatter.setMaximumFractionDigits(DOUBLE_FRACTION_DIGITS);
         xpathFormatter.setMinimumFractionDigits(0);
         xpathFormatter.setMinimumIntegerDigits(1);
-        xpathFormatter.setGroupingUsed(false);
+        xpathFormatter.setGroupingUsed(false);        
     }
 
     /**
@@ -905,82 +927,84 @@
      * using always using "." as a decimal separator.
      */
     public static String realToString(double d) {
-        final double m = Math.abs(d);
-        if ((m >= lowerBounds) && (m < upperBounds)) {
-            final String result = Double.toString(d);
-            final int length = result.length();
-            // Remove leading zeros.
-            if ((result.charAt(length-2) == '.') &&
-                (result.charAt(length-1) == '0'))
-                return result.substring(0, length-2);
-            else
-                return result;
-        }
-        else {
-            if (Double.isNaN(d) || Double.isInfinite(d))
-                return(Double.toString(d));
-
+	final double m = Math.abs(d);
+	if ((m >= lowerBounds) && (m < upperBounds)) {
+	    final String result = Double.toString(d);
+	    final int length = result.length();
+	    // Remove leading zeros.
+	    if ((result.charAt(length-2) == '.') &&
+		(result.charAt(length-1) == '0'))
+		return result.substring(0, length-2);
+	    else
+		return result;
+	}
+	else {
+	    if (Double.isNaN(d) || Double.isInfinite(d))
+		return(Double.toString(d));
+            
             // Use the XPath formatter to ignore locales
-            StringBuffer result = new StringBuffer();
+            StringBuffer result = threadLocalStringBuffer.get();
+            result.setLength(0);
             xpathFormatter.format(d, result, _fieldPosition);
-            return result.toString();
-        }
+	    return result.toString();
+	}
     }
 
     /**
      * Utility function: used in RealType to convert a real to an integer
      */
     public static int realToInt(double d) {
-        return (int)d;
+	return (int)d;
     }
 
     /**
-     * Utility function: used to format/adjust  a double to a string. The
-     * DecimalFormat object comes from the 'formatSymbols' hashtable in
+     * Utility function: used to format/adjust  a double to a string. The 
+     * DecimalFormat object comes from the 'formatSymbols' hashtable in 
      * AbstractTranslet.
      */
     private static FieldPosition _fieldPosition = new FieldPosition(0);
 
     public static String formatNumber(double number, String pattern,
-                                      DecimalFormat formatter) {
-        // bugzilla fix 12813
-        if (formatter == null) {
-            formatter = defaultFormatter;
-        }
-        try {
-            StringBuffer result = new StringBuffer();
-            if (pattern != defaultPattern) {
-                formatter.applyLocalizedPattern(pattern);
-            }
-            formatter.format(number, result, _fieldPosition);
-            return result.toString();
-        }
-        catch (IllegalArgumentException e) {
-            runTimeError(FORMAT_NUMBER_ERR, Double.toString(number), pattern);
-            return(EMPTYSTRING);
-        }
+				      DecimalFormat formatter) {
+        // bugzilla fix 12813 
+	if (formatter == null) {
+	    formatter = defaultFormatter;
+	}
+	try {
+	    StringBuffer result = threadLocalStringBuffer.get();
+        result.setLength(0);
+	    if (pattern != defaultPattern) {
+		formatter.applyLocalizedPattern(pattern);
+	    }
+        formatter.format(number, result, _fieldPosition);
+	    return result.toString();
+	}
+	catch (IllegalArgumentException e) {
+	    runTimeError(FORMAT_NUMBER_ERR, Double.toString(number), pattern);
+	    return(EMPTYSTRING);
+	}
     }
-
+    
     /**
      * Utility function: used to convert references to node-sets. If the
      * obj is an instanceof Node then create a singleton iterator.
      */
     public static DTMAxisIterator referenceToNodeSet(Object obj) {
-        // Convert var/param -> node
-        if (obj instanceof Node) {
-            return(new SingletonIterator(((Node)obj).node));
-        }
-        // Convert var/param -> node-set
-        else if (obj instanceof DTMAxisIterator) {
-            return(((DTMAxisIterator)obj).cloneIterator());
-        }
-        else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, className, "node-set");
-            return null;
-        }
+	// Convert var/param -> node
+	if (obj instanceof Node) {
+	    return(new SingletonIterator(((Node)obj).node));
+	}
+	// Convert var/param -> node-set
+	else if (obj instanceof DTMAxisIterator) {
+	    return(((DTMAxisIterator)obj).cloneIterator());
+	}
+	else {
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, className, "node-set");
+	    return null;
+	}
     }
-
+    
     /**
      * Utility function: used to convert reference to org.w3c.dom.NodeList.
      */
@@ -993,12 +1017,12 @@
           dom = (DOM)obj;
           return dom.makeNodeList(DTMDefaultBase.ROOTNODE);
         }
-        else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, className,
+	else {
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, className, 
                 "org.w3c.dom.NodeList");
-            return null;
-        }
+	    return null;
+	}
     }
 
     /**
@@ -1014,13 +1038,13 @@
           DTMAxisIterator iter = dom.getChildren(DTMDefaultBase.ROOTNODE);
           return dom.makeNode(iter);
         }
-        else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, className, "org.w3c.dom.Node");
-            return null;
-        }
+	else {
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, className, "org.w3c.dom.Node");
+	    return null;
+	}
     }
-
+   
     /**
      * Utility function: used to convert reference to long.
      */
@@ -1029,12 +1053,12 @@
             return ((Number) obj).longValue();    // handles Integer and Double
         }
         else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, className, Long.TYPE);
-            return 0;
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, className, Long.TYPE);
+	    return 0;
         }
     }
-
+            
     /**
      * Utility function: used to convert reference to double.
      */
@@ -1043,9 +1067,9 @@
             return ((Number) obj).doubleValue();   // handles Integer and Double
         }
         else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, className, Double.TYPE);
-            return 0;
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, className, Double.TYPE);
+	    return 0;
         }
     }
 
@@ -1057,9 +1081,9 @@
             return ((Boolean) obj).booleanValue();
         }
         else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, className, Boolean.TYPE);
-            return false;
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, className, Boolean.TYPE);
+	    return false;
         }
     }
 
@@ -1071,35 +1095,35 @@
             return (String) obj;
         }
         else if (obj instanceof DTMAxisIterator) {
-            return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
-        }
-        else if (obj instanceof Node) {
-            return dom.getStringValueX(((Node)obj).node);
-        }
-        else if (obj instanceof DOM) {
-            return ((DOM) obj).getStringValue();
-        }
+	    return dom.getStringValueX(((DTMAxisIterator)obj).reset().next());
+	}
+	else if (obj instanceof Node) {
+	    return dom.getStringValueX(((Node)obj).node);
+	}
+	else if (obj instanceof DOM) {
+	    return ((DOM) obj).getStringValue();
+	}
         else {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, className, String.class);
-            return null;
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, className, String.class);
+	    return null;
         }
     }
 
     /**
-     * Utility function used to convert a w3c Node into an internal DOM iterator.
+     * Utility function used to convert a w3c Node into an internal DOM iterator. 
      */
     public static DTMAxisIterator node2Iterator(org.w3c.dom.Node node,
-        Translet translet, DOM dom)
+	Translet translet, DOM dom) 
     {
         final org.w3c.dom.Node inNode = node;
-        // Create a dummy NodeList which only contains the given node to make
+        // Create a dummy NodeList which only contains the given node to make 
         // use of the nodeList2Iterator() interface.
-        org.w3c.dom.NodeList nodelist = new org.w3c.dom.NodeList() {
+        org.w3c.dom.NodeList nodelist = new org.w3c.dom.NodeList() {            
             public int getLength() {
                 return 1;
             }
-
+            
             public org.w3c.dom.Node item(int index) {
                 if (index == 0)
                     return inNode;
@@ -1107,20 +1131,20 @@
                     return null;
             }
         };
-
+        
         return nodeList2Iterator(nodelist, translet, dom);
     }
-
+    
     /**
      * Utility function used to copy a node list to be under a parent node.
      */
-    private static void copyNodes(org.w3c.dom.NodeList nodeList,
-        org.w3c.dom.Document doc, org.w3c.dom.Node parent)
+    private static void copyNodes(org.w3c.dom.NodeList nodeList, 
+	org.w3c.dom.Document doc, org.w3c.dom.Node parent)
     {
         final int size = nodeList.getLength();
 
           // copy Nodes from NodeList into new w3c DOM
-        for (int i = 0; i < size; i++)
+        for (int i = 0; i < size; i++) 
         {
             org.w3c.dom.Node curr = nodeList.item(i);
             int nodeType = curr.getNodeType();
@@ -1131,21 +1155,21 @@
                 runTimeError(RUN_TIME_INTERNAL_ERR, ex.getMessage());
                 return;
             }
-
+            
             String nodeName = curr.getNodeName();
-            org.w3c.dom.Node newNode = null;
+            org.w3c.dom.Node newNode = null; 
             switch (nodeType){
                 case org.w3c.dom.Node.ATTRIBUTE_NODE:
-                     newNode = doc.createAttributeNS(curr.getNamespaceURI(),
-                        nodeName);
+                     newNode = doc.createAttributeNS(curr.getNamespaceURI(), 
+			nodeName);
                      break;
-                case org.w3c.dom.Node.CDATA_SECTION_NODE:
+                case org.w3c.dom.Node.CDATA_SECTION_NODE: 
                      newNode = doc.createCDATASection(value);
                      break;
-                case org.w3c.dom.Node.COMMENT_NODE:
+                case org.w3c.dom.Node.COMMENT_NODE: 
                      newNode = doc.createComment(value);
                      break;
-                case org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE:
+                case org.w3c.dom.Node.DOCUMENT_FRAGMENT_NODE: 
                      newNode = doc.createDocumentFragment();
                      break;
                 case org.w3c.dom.Node.DOCUMENT_NODE:
@@ -1155,37 +1179,37 @@
                 case org.w3c.dom.Node.DOCUMENT_TYPE_NODE:
                      // nothing?
                      break;
-                case org.w3c.dom.Node.ELEMENT_NODE:
-                     // For Element node, also copy the children and the
-                     // attributes.
+                case org.w3c.dom.Node.ELEMENT_NODE: 
+                     // For Element node, also copy the children and the 
+		     // attributes.
                      org.w3c.dom.Element element = doc.createElementNS(
-                        curr.getNamespaceURI(), nodeName);
+			curr.getNamespaceURI(), nodeName);
                      if (curr.hasAttributes())
                      {
                        org.w3c.dom.NamedNodeMap attributes = curr.getAttributes();
                        for (int k = 0; k < attributes.getLength(); k++) {
                          org.w3c.dom.Node attr = attributes.item(k);
-                         element.setAttributeNS(attr.getNamespaceURI(),
+                         element.setAttributeNS(attr.getNamespaceURI(), 
                                  attr.getNodeName(), attr.getNodeValue());
                        }
                      }
                      copyNodes(curr.getChildNodes(), doc, element);
                      newNode = element;
                      break;
-                case org.w3c.dom.Node.ENTITY_NODE:
-                     // nothing ?
+                case org.w3c.dom.Node.ENTITY_NODE: 
+                     // nothing ? 
                      break;
-                case org.w3c.dom.Node.ENTITY_REFERENCE_NODE:
+                case org.w3c.dom.Node.ENTITY_REFERENCE_NODE: 
                      newNode = doc.createEntityReference(nodeName);
                      break;
-                case org.w3c.dom.Node.NOTATION_NODE:
-                     // nothing ?
+                case org.w3c.dom.Node.NOTATION_NODE: 
+                     // nothing ? 
                      break;
-                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE:
+                case org.w3c.dom.Node.PROCESSING_INSTRUCTION_NODE: 
                      newNode = doc.createProcessingInstruction(nodeName,
                         value);
                      break;
-                case org.w3c.dom.Node.TEXT_NODE:
+                case org.w3c.dom.Node.TEXT_NODE: 
                      newNode = doc.createTextNode(value);
                      break;
             }
@@ -1194,74 +1218,74 @@
             } catch (DOMException e) {
                 runTimeError(RUN_TIME_INTERNAL_ERR, e.getMessage());
                 return;
-            }
+            }           
         }
     }
 
     /**
      * Utility function used to convert a w3c NodeList into a internal
-     * DOM iterator.
+     * DOM iterator. 
      */
     public static DTMAxisIterator nodeList2Iterator(
                                         org.w3c.dom.NodeList nodeList,
-                                        Translet translet, DOM dom)
+                                    	Translet translet, DOM dom) 
     {
-        // w3c NodeList -> w3c DOM
-        Document doc = null;
-        try {
-            doc = ((AbstractTranslet) translet).newDocument("", "__top__");
-        }
+	// w3c NodeList -> w3c DOM
+	Document doc = null;
+	try {
+	    doc = ((AbstractTranslet) translet).newDocument("", "__top__");
+	} 
         catch (javax.xml.parsers.ParserConfigurationException e) {
-            runTimeError(RUN_TIME_INTERNAL_ERR, e.getMessage());
+	    runTimeError(RUN_TIME_INTERNAL_ERR, e.getMessage());
             return null;
-        }
-
+	}
+        
         // Copy all the nodes in the nodelist to be under the top element
         copyNodes(nodeList, doc, doc.getDocumentElement());
 
         // w3cDOM -> DTM -> DOMImpl
-        if (dom instanceof MultiDOM) {
+	if (dom instanceof MultiDOM) {
             final MultiDOM multiDOM = (MultiDOM) dom;
 
-            DTMDefaultBase dtm = (DTMDefaultBase)((DOMAdapter)multiDOM.getMain()).getDOMImpl();
-            DTMManager dtmManager = dtm.getManager();
-
-            DOM idom = (DOM)dtmManager.getDTM(new DOMSource(doc), false,
-                                              null, true, false);
-            // Create DOMAdapter and register with MultiDOM
-            DOMAdapter domAdapter = new DOMAdapter(idom,
+	    DTMDefaultBase dtm = (DTMDefaultBase)((DOMAdapter)multiDOM.getMain()).getDOMImpl();
+	    DTMManager dtmManager = dtm.getManager();
+	    
+	    DOM idom = (DOM)dtmManager.getDTM(new DOMSource(doc), false,
+					      null, true, false);
+	    // Create DOMAdapter and register with MultiDOM
+	    DOMAdapter domAdapter = new DOMAdapter(idom, 
                 translet.getNamesArray(),
                 translet.getUrisArray(),
                 translet.getTypesArray(),
-                translet.getNamespaceArray());
+		translet.getNamespaceArray());
             multiDOM.addDOMAdapter(domAdapter);
 
-            DTMAxisIterator iter1 = idom.getAxisIterator(Axis.CHILD);
-            DTMAxisIterator iter2 = idom.getAxisIterator(Axis.CHILD);
+	    DTMAxisIterator iter1 = idom.getAxisIterator(Axis.CHILD);
+	    DTMAxisIterator iter2 = idom.getAxisIterator(Axis.CHILD);
             DTMAxisIterator iter = new AbsoluteIterator(
                 new StepIterator(iter1, iter2));
 
-            iter.setStartNode(DTMDefaultBase.ROOTNODE);
-            return iter;
-        }
+ 	    iter.setStartNode(DTMDefaultBase.ROOTNODE);
+	    return iter;
+	}
         else {
-            runTimeError(RUN_TIME_INTERNAL_ERR, "nodeList2Iterator()");
-            return null;
+	    runTimeError(RUN_TIME_INTERNAL_ERR, "nodeList2Iterator()");
+	    return null;
         }
     }
 
     /**
-     * Utility function used to convert references to DOMs.
+     * Utility function used to convert references to DOMs. 
      */
     public static DOM referenceToResultTree(Object obj) {
-        try {
-            return ((DOM) obj);
-        }
-        catch (IllegalArgumentException e) {
-            final String className = obj.getClass().getName();
-            runTimeError(DATA_CONVERSION_ERR, "reference", className);
-            return null;
-        }
+	try {
+	    return ((DOM) obj);
+	}
+	catch (IllegalArgumentException e) {
+	    final String className = obj.getClass().getName();
+	    runTimeError(DATA_CONVERSION_ERR, "reference", className);
+	    return null;
+	}
     }
 
     /**
@@ -1269,8 +1293,8 @@
      * of nodes to just one single node (the one at position n).
      */
     public static DTMAxisIterator getSingleNode(DTMAxisIterator iterator) {
-        int node = iterator.next();
-        return(new SingletonIterator(node));
+	int node = iterator.next();
+	return(new SingletonIterator(node));
     }
 
     /**
@@ -1279,103 +1303,103 @@
     private static char[] _characterArray = new char[32];
 
     public static void copy(Object obj,
-                            SerializationHandler handler,
-                            int node,
-                            DOM dom) {
-        try {
-            if (obj instanceof DTMAxisIterator)
+ 			    SerializationHandler handler,
+			    int node,
+			    DOM dom) {
+	try {
+	    if (obj instanceof DTMAxisIterator) 
       {
-                DTMAxisIterator iter = (DTMAxisIterator) obj;
-                dom.copy(iter.reset(), handler);
-            }
-            else if (obj instanceof Node) {
-                dom.copy(((Node) obj).node, handler);
-            }
-            else if (obj instanceof DOM) {
-                //((DOM)obj).copy(((com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase)((DOMAdapter)obj).getDOMImpl()).getDocument(), handler);
-                DOM newDom = (DOM)obj;
-                newDom.copy(newDom.getDocument(), handler);
-            }
-            else {
-                String string = obj.toString();         // or call stringF()
-                final int length = string.length();
-                if (length > _characterArray.length)
-                    _characterArray = new char[length];
-                string.getChars(0, length, _characterArray, 0);
-                handler.characters(_characterArray, 0, length);
-            }
-        }
-        catch (SAXException e) {
-            runTimeError(RUN_TIME_COPY_ERR);
-        }
+		DTMAxisIterator iter = (DTMAxisIterator) obj;
+		dom.copy(iter.reset(), handler);
+	    }
+	    else if (obj instanceof Node) {
+		dom.copy(((Node) obj).node, handler);
+	    }
+	    else if (obj instanceof DOM) {
+		//((DOM)obj).copy(((com.sun.org.apache.xml.internal.dtm.ref.DTMDefaultBase)((DOMAdapter)obj).getDOMImpl()).getDocument(), handler);
+		DOM newDom = (DOM)obj;
+		newDom.copy(newDom.getDocument(), handler);
+	    }
+	    else {
+		String string = obj.toString();		// or call stringF()
+		final int length = string.length();
+		if (length > _characterArray.length)
+		    _characterArray = new char[length];
+		string.getChars(0, length, _characterArray, 0);
+		handler.characters(_characterArray, 0, length);
+	    }
+	}
+	catch (SAXException e) {
+	    runTimeError(RUN_TIME_COPY_ERR);
+	}
     }
-
+    
     /**
      * Utility function to check if xsl:attribute has a valid qname
      * This method should only be invoked if the name attribute is an AVT
-     */
+     */    
     public static void checkAttribQName(String name) {
         final int firstOccur = name.indexOf(":");
         final int lastOccur = name.lastIndexOf(":");
         final String localName = name.substring(lastOccur + 1);
-
+        
         if (firstOccur > 0) {
-            final String newPrefix = name.substring(0, firstOccur);
-
+            final String newPrefix = name.substring(0, firstOccur); 
+        
             if (firstOccur != lastOccur) {
-               final String oriPrefix = name.substring(firstOccur+1, lastOccur);
+               final String oriPrefix = name.substring(firstOccur+1, lastOccur); 
                 if (!XML11Char.isXML11ValidNCName(oriPrefix)) {
                     // even though the orignal prefix is ignored, it should still get checked for valid NCName
                     runTimeError(INVALID_QNAME_ERR,oriPrefix+":"+localName);
                 }
             }
-
+            
             // prefix must be a valid NCName
             if (!XML11Char.isXML11ValidNCName(newPrefix)) {
-                runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName);
-            }
+                runTimeError(INVALID_QNAME_ERR,newPrefix+":"+localName); 
+            }  
         }
-
+                
         // local name must be a valid NCName and must not be XMLNS
         if ((!XML11Char.isXML11ValidNCName(localName))||(localName.equals(Constants.XMLNS_PREFIX))) {
-            runTimeError(INVALID_QNAME_ERR,localName);
+            runTimeError(INVALID_QNAME_ERR,localName); 
         }
     }
-
+    
     /**
      * Utility function to check if a name is a valid ncname
      * This method should only be invoked if the attribute value is an AVT
-     */
+     */    
     public static void checkNCName(String name) {
         if (!XML11Char.isXML11ValidNCName(name)) {
-            runTimeError(INVALID_NCNAME_ERR,name);
-        }
-    }
+            runTimeError(INVALID_NCNAME_ERR,name); 
+        }  
+    }        
 
     /**
      * Utility function to check if a name is a valid qname
      * This method should only be invoked if the attribute value is an AVT
-     */
+     */    
     public static void checkQName(String name) {
         if (!XML11Char.isXML11ValidQName(name)) {
-            runTimeError(INVALID_QNAME_ERR,name);
-        }
+            runTimeError(INVALID_QNAME_ERR,name); 
+        }  
     }
-
+    
     /**
      * Utility function for the implementation of xsl:element.
      */
     public static String startXslElement(String qname, String namespace,
-        SerializationHandler handler, DOM dom, int node)
+	SerializationHandler handler, DOM dom, int node)
     {
         try {
             // Get prefix from qname
             String prefix;
             final int index = qname.indexOf(':');
-
+            
             if (index > 0) {
                 prefix = qname.substring(0, index);
-
+                
                 // Handle case when prefix is not known at compile time
                 if (namespace == null || namespace.length() == 0) {
                     try {
@@ -1391,44 +1415,44 @@
                         }
                     }
                 }
-
+                
                 handler.startElement(namespace, qname.substring(index+1),
                                          qname);
-                handler.namespaceAfterStartElement(prefix, namespace);
+                handler.namespaceAfterStartElement(prefix, namespace); 
             }
-            else {
+            else {                      
                 // Need to generate a prefix?
                 if (namespace != null && namespace.length() > 0) {
                     prefix = generatePrefix();
-                    qname = prefix + ':' + qname;
-                    handler.startElement(namespace, qname, qname);
+                    qname = prefix + ':' + qname;   
+                    handler.startElement(namespace, qname, qname);   
                     handler.namespaceAfterStartElement(prefix, namespace);
                 }
                 else {
-                    handler.startElement(null, null, qname);
+                    handler.startElement(null, null, qname);   
                 }
             }
         }
         catch (SAXException e) {
             throw new RuntimeException(e.getMessage());
         }
-
+    
         return qname;
-    }
+    }    
 
     /**
      * This function is used in the execution of xsl:element
      */
     public static String getPrefix(String qname) {
-        final int index = qname.indexOf(':');
-        return (index > 0) ? qname.substring(0, index) : null;
+	final int index = qname.indexOf(':');
+	return (index > 0) ? qname.substring(0, index) : null;
     }
 
     /**
      * This function is used in the execution of xsl:element
      */
     private static int prefixIndex = 0;
-
+    
     public static String generatePrefix() {
         synchronized (BasisLibrary.class) {
             return ("ns" + prefixIndex++);
@@ -1456,7 +1480,7 @@
     public static final String TYPED_AXIS_SUPPORT_ERR =
                                            "TYPED_AXIS_SUPPORT_ERR";
     public static final String STRAY_ATTRIBUTE_ERR =
-                                           "STRAY_ATTRIBUTE_ERR";
+                                           "STRAY_ATTRIBUTE_ERR"; 
     public static final String STRAY_NAMESPACE_ERR =
                                            "STRAY_NAMESPACE_ERR";
     public static final String NAMESPACE_PREFIX_ERR =
@@ -1475,70 +1499,71 @@
                                            "UNSUPPORTED_EXT_ERR";
     public static final String UNKNOWN_TRANSLET_VERSION_ERR =
                                            "UNKNOWN_TRANSLET_VERSION_ERR";
-    public static final String INVALID_QNAME_ERR = "INVALID_QNAME_ERR";
+    public static final String INVALID_QNAME_ERR = "INVALID_QNAME_ERR";                                           
     public static final String INVALID_NCNAME_ERR = "INVALID_NCNAME_ERR";
     public static final String UNALLOWED_EXTENSION_FUNCTION_ERR = "UNALLOWED_EXTENSION_FUNCTION_ERR";
     public static final String UNALLOWED_EXTENSION_ELEMENT_ERR = "UNALLOWED_EXTENSION_ELEMENT_ERR";
 
     // All error messages are localized and are stored in resource bundles.
     private static ResourceBundle m_bundle;
-
+    
     public final static String ERROR_MESSAGES_KEY = "error-messages";
 
     static {
-        String resource = "com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages";
-        m_bundle = ResourceBundle.getBundle(resource);
+	String resource = "com.sun.org.apache.xalan.internal.xsltc.runtime.ErrorMessages";
+	m_bundle = ResourceBundle.getBundle(resource);
     }
 
     /**
      * Print a run-time error message.
      */
     public static void runTimeError(String code) {
-        throw new RuntimeException(m_bundle.getString(code));
+	throw new RuntimeException(m_bundle.getString(code));
     }
 
     public static void runTimeError(String code, Object[] args) {
-        final String message = MessageFormat.format(m_bundle.getString(code),
+	final String message = MessageFormat.format(m_bundle.getString(code),
                                                     args);
-        throw new RuntimeException(message);
+	throw new RuntimeException(message);
     }
 
     public static void runTimeError(String code, Object arg0) {
-        runTimeError(code, new Object[]{ arg0 } );
+	runTimeError(code, new Object[]{ arg0 } );
     }
 
     public static void runTimeError(String code, Object arg0, Object arg1) {
-        runTimeError(code, new Object[]{ arg0, arg1 } );
+	runTimeError(code, new Object[]{ arg0, arg1 } );
     }
 
     public static void consoleOutput(String msg) {
-        System.out.println(msg);
+	System.out.println(msg);
     }
 
     /**
      * Replace a certain character in a string with a new substring.
      */
     public static String replace(String base, char ch, String str) {
-        return (base.indexOf(ch) < 0) ? base :
-            replace(base, String.valueOf(ch), new String[] { str });
+	return (base.indexOf(ch) < 0) ? base : 
+	    replace(base, String.valueOf(ch), new String[] { str });
     }
 
     public static String replace(String base, String delim, String[] str) {
-        final int len = base.length();
-        final StringBuffer result = new StringBuffer();
+	final int len = base.length();
+	final StringBuilder result = threadLocalStringBuilder.get();
+        result.setLength(0);
 
-        for (int i = 0; i < len; i++) {
-            final char ch = base.charAt(i);
-            final int k = delim.indexOf(ch);
+	for (int i = 0; i < len; i++) {
+	    final char ch = base.charAt(i);
+	    final int k = delim.indexOf(ch);
 
-            if (k >= 0) {
-                result.append(str[k]);
-            }
-            else {
-                result.append(ch);
-            }
-        }
-        return result.toString();
+	    if (k >= 0) {
+		result.append(str[k]);
+	    }
+	    else {
+		result.append(ch);
+	    }
+	}
+	return result.toString();
     }
 
 
@@ -1547,9 +1572,9 @@
      * {namespaceuri}localName
      * which get mapped to an instance variable in the class
      * Hence  a parameter of the form "{http://foo.bar}xyz"
-     * will be replaced with the corresponding values
+     * will be replaced with the corresponding values  
      * by the BasisLibrary's utility method mapQNametoJavaName
-     * and thus get mapped to legal java variable names
+     * and thus get mapped to legal java variable names 
      */
     public static String mapQNameToJavaName (String base ) {
        return replace(base, ".-:/{}?#%*",
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/runtime/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:40:59 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = -2293620736651286953L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.9 2008/04/02 00:41:02 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = -1877553852268428278L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/SAX2DOM.java	Wed Sep 28 16:49:43 2011 +0100
@@ -26,6 +26,7 @@
 
 import java.util.Stack;
 import java.util.Vector;
+import javax.xml.parsers.DocumentBuilder;
 
 import javax.xml.parsers.DocumentBuilderFactory;
 import javax.xml.parsers.ParserConfigurationException;
@@ -59,46 +60,57 @@
     private Node _lastSibling = null;
     private Locator locator = null;
     private boolean needToSetDocumentInfo = true;
-
+    
+    //Replace StringBuffer with StringBuilder now that we no long support jdk1.4
+    private StringBuilder _textBuffer = new StringBuilder();
+    private Node _nextSiblingCache = null;
     /**
      * JAXP document builder factory. Create a single instance and use
-     * synchronization because the Javadoc is not explicit about
+     * synchronization because the Javadoc is not explicit about 
      * thread safety.
      */
     static final DocumentBuilderFactory _factory =
             DocumentBuilderFactory.newInstance();
-
-   public SAX2DOM() throws ParserConfigurationException {
-        synchronized (SAX2DOM.class) {
-          _document = _factory.newDocumentBuilder().newDocument();
+    static final DocumentBuilder _internalBuilder;
+    static {
+        DocumentBuilder tmpBuilder = null;
+        try {
+            if (_factory instanceof com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderFactoryImpl) {
+                tmpBuilder = _factory.newDocumentBuilder();
+            }
+        } catch(Exception e) {
+            // It's OK. Will create DocumentBuilder every time
         }
-        _root = _document;
+        _internalBuilder = tmpBuilder;
+    }
+    
+    public SAX2DOM() throws ParserConfigurationException {
+        _document = createDocument();
+	_root = _document;
     }
 
     public SAX2DOM(Node root, Node nextSibling) throws ParserConfigurationException {
-        _root = root;
-        if (root instanceof Document) {
-          _document = (Document)root;
-        }
-        else if (root != null) {
-          _document = root.getOwnerDocument();
-        }
-        else {
-          synchronized (SAX2DOM.class) {
-              _document = _factory.newDocumentBuilder().newDocument();
-          }
-          _root = _document;
-        }
-
-        _nextSibling = nextSibling;
+	_root = root;
+	if (root instanceof Document) {
+	  _document = (Document)root;
+	}
+	else if (root != null) {
+	  _document = root.getOwnerDocument();
+	}
+	else {
+          _document = createDocument();
+	  _root = _document;
+	}
+	
+	_nextSibling = nextSibling;
     }
-
+    
     public SAX2DOM(Node root) throws ParserConfigurationException {
         this(root, null);
     }
 
     public Node getDOM() {
-        return _root;
+	return _root;
     }
 
     public void characters(char[] ch, int start, int length) {
@@ -106,84 +118,87 @@
         if (length == 0) {
             return;
         }
-
-        final Node last = (Node)_nodeStk.peek();
+        
+	final Node last = (Node)_nodeStk.peek();
 
         // No text nodes can be children of root (DOM006 exception)
         if (last != _document) {
-            final String text = new String(ch, start, length);
-            if( _lastSibling != null && _lastSibling.getNodeType() == Node.TEXT_NODE ){
-                  ((Text)_lastSibling).appendData(text);
-            }
-            else if (last == _root && _nextSibling != null) {
-                _lastSibling = last.insertBefore(_document.createTextNode(text), _nextSibling);
+            _nextSiblingCache = _nextSibling;
+            _textBuffer.append(ch, start, length);
+        }
+    }
+    private void appendTextNode() {
+        if (_textBuffer.length() > 0) {
+            final Node last = (Node)_nodeStk.peek();
+            if (last == _root && _nextSiblingCache != null) {
+                _lastSibling = last.insertBefore(_document.createTextNode(_textBuffer.toString()), _nextSiblingCache);
             }
             else {
-                _lastSibling = last.appendChild(_document.createTextNode(text));
+                _lastSibling = last.appendChild(_document.createTextNode(_textBuffer.toString()));
             }
+            _textBuffer.setLength(0);
         }
     }
-
     public void startDocument() {
-        _nodeStk.push(_root);
+	_nodeStk.push(_root);
     }
 
     public void endDocument() {
         _nodeStk.pop();
     }
-
+    
     private void setDocumentInfo() {
         //try to set document version
         if (locator == null) return;
         try{
             _document.setXmlVersion(((Locator2)locator).getXMLVersion());
         }catch(ClassCastException e){}
-
+        
     }
-
+    
     public void startElement(String namespace, String localName, String qName,
-        Attributes attrs)
+	Attributes attrs)
     {
-
+        appendTextNode();
         if (needToSetDocumentInfo) {
             setDocumentInfo();
             needToSetDocumentInfo = false;
         }
-
-        final Element tmp = (Element)_document.createElementNS(namespace, qName);
+        
+	final Element tmp = (Element)_document.createElementNS(namespace, qName);
 
-        // Add namespace declarations first
-        if (_namespaceDecls != null) {
-            final int nDecls = _namespaceDecls.size();
-            for (int i = 0; i < nDecls; i++) {
-                final String prefix = (String) _namespaceDecls.elementAt(i++);
+	// Add namespace declarations first
+	if (_namespaceDecls != null) {
+	    final int nDecls = _namespaceDecls.size();
+	    for (int i = 0; i < nDecls; i++) {
+		final String prefix = (String) _namespaceDecls.elementAt(i++);
 
-                if (prefix == null || prefix.equals(EMPTYSTRING)) {
-                    tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX,
-                        (String) _namespaceDecls.elementAt(i));
-                }
-                else {
-                    tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix,
-                        (String) _namespaceDecls.elementAt(i));
-                }
-            }
-            _namespaceDecls.clear();
-        }
+		if (prefix == null || prefix.equals(EMPTYSTRING)) {
+		    tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX,
+			(String) _namespaceDecls.elementAt(i));
+		}
+		else {
+		    tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix,
+			(String) _namespaceDecls.elementAt(i));
+		}
+	    }
+	    _namespaceDecls.clear();
+	}
 
-        // Add attributes to element
-/*      final int nattrs = attrs.getLength();
-        for (int i = 0; i < nattrs; i++) {
-            if (attrs.getLocalName(i) == null) {
-                tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
-            }
-            else {
-                tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i),
-                    attrs.getValue(i));
-            }
-        } */
-
-
-        // Add attributes to element
+	// Add attributes to element
+/*	final int nattrs = attrs.getLength();
+	for (int i = 0; i < nattrs; i++) {
+	    if (attrs.getLocalName(i) == null) {
+		tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
+	    }
+	    else {
+		tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i),
+		    attrs.getValue(i));
+	    }
+	} */
+        
+        
+	// Add attributes to element
         final int nattrs = attrs.getLength();
         for (int i = 0; i < nattrs; i++) {
             // checking if Namespace processing is being done
@@ -201,38 +216,39 @@
                 }
             }
         }
-
-
-        // Append this new node onto current stack node
-        Node last = (Node)_nodeStk.peek();
+        
 
-        // If the SAX2DOM is created with a non-null next sibling node,
-        // insert the result nodes before the next sibling under the root.
-        if (last == _root && _nextSibling != null)
-            last.insertBefore(tmp, _nextSibling);
-        else
-            last.appendChild(tmp);
+	// Append this new node onto current stack node
+	Node last = (Node)_nodeStk.peek();
+	
+	// If the SAX2DOM is created with a non-null next sibling node,
+	// insert the result nodes before the next sibling under the root.
+	if (last == _root && _nextSibling != null)
+	    last.insertBefore(tmp, _nextSibling);
+	else
+	    last.appendChild(tmp);
 
-        // Push this node onto stack
-        _nodeStk.push(tmp);
+	// Push this node onto stack
+	_nodeStk.push(tmp);
         _lastSibling = null;
     }
 
     public void endElement(String namespace, String localName, String qName) {
-        _nodeStk.pop();
+        appendTextNode();
+	_nodeStk.pop();
         _lastSibling = null;
     }
 
     public void startPrefixMapping(String prefix, String uri) {
-        if (_namespaceDecls == null) {
-            _namespaceDecls = new Vector(2);
-        }
-        _namespaceDecls.addElement(prefix);
-        _namespaceDecls.addElement(uri);
+	if (_namespaceDecls == null) {
+	    _namespaceDecls = new Vector(2);
+	}
+	_namespaceDecls.addElement(prefix);
+	_namespaceDecls.addElement(uri);
     }
 
     public void endPrefixMapping(String prefix) {
-        // do nothing
+	// do nothing
     }
 
     /**
@@ -246,15 +262,16 @@
      * adds processing instruction node to DOM.
      */
     public void processingInstruction(String target, String data) {
-        final Node last = (Node)_nodeStk.peek();
-        ProcessingInstruction pi = _document.createProcessingInstruction(
-                target, data);
-        if (pi != null){
+        appendTextNode();
+	final Node last = (Node)_nodeStk.peek();
+	ProcessingInstruction pi = _document.createProcessingInstruction(
+		target, data);
+	if (pi != null){
           if (last == _root && _nextSibling != null)
               last.insertBefore(pi, _nextSibling);
           else
               last.appendChild(pi);
-
+          
           _lastSibling = pi;
         }
     }
@@ -279,14 +296,15 @@
      * Lexical Handler method to create comment node in DOM tree.
      */
     public void comment(char[] ch, int start, int length) {
-        final Node last = (Node)_nodeStk.peek();
-        Comment comment = _document.createComment(new String(ch,start,length));
-        if (comment != null){
+        appendTextNode();
+	final Node last = (Node)_nodeStk.peek();
+	Comment comment = _document.createComment(new String(ch,start,length));
+	if (comment != null){
           if (last == _root && _nextSibling != null)
               last.insertBefore(comment, _nextSibling);
           else
               last.appendChild(comment);
-
+          
           _lastSibling = comment;
         }
     }
@@ -299,4 +317,18 @@
     public void endEntity(String name) { }
     public void startDTD(String name, String publicId, String systemId)
         throws SAXException {}
+    
+    private static Document createDocument() throws ParserConfigurationException {
+        Document doc;
+        if (_internalBuilder != null) {
+            //default implementation is thread safe
+            doc = _internalBuilder.newDocument();
+        } else {
+            synchronized(SAX2DOM.class) {
+                doc = _factory.newDocumentBuilder().newDocument();
+            }
+        }
+        return doc;
+    }
+    
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerFactoryImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -59,6 +59,7 @@
 import javax.xml.transform.sax.TransformerHandler;
 import javax.xml.transform.stream.StreamResult;
 import javax.xml.transform.stream.StreamSource;
+import javax.xml.transform.stax.*;
 
 import com.sun.org.apache.xml.internal.utils.StylesheetPIHandler;
 import com.sun.org.apache.xml.internal.utils.StopParseException;
@@ -77,12 +78,12 @@
 
 /**
  * Implementation of a JAXP1.1 TransformerFactory for Translets.
- * @author G. Todd Miller
+ * @author G. Todd Miller 
  * @author Morten Jorgensen
  * @author Santiago Pericas-Geertsen
  */
 public class TransformerFactoryImpl
-    extends SAXTransformerFactory implements SourceLoader, ErrorListener
+    extends SAXTransformerFactory implements SourceLoader, ErrorListener 
 {
     // Public constants for attributes supported by the XSLTC TransformerFactory.
     public final static String TRANSLET_NAME = "translet-name";
@@ -95,19 +96,19 @@
     public final static String DEBUG = "debug";
     public final static String ENABLE_INLINING = "enable-inlining";
     public final static String INDENT_NUMBER = "indent-number";
-
+        
     /**
      * This error listener is used only for this factory and is not passed to
      * the Templates or Transformer objects that we create.
      */
-    private ErrorListener _errorListener = this;
+    private ErrorListener _errorListener = this; 
 
     /**
      * This URIResolver is passed to all created Templates and Transformers
      */
     private URIResolver _uriResolver = null;
 
-    /**
+    /** 
      * As Gregor Samsa awoke one morning from uneasy dreams he found himself
      * transformed in his bed into a gigantic insect. He was lying on his hard,
      * as it were armour plated, back, and if he lifted his head a little he
@@ -118,22 +119,22 @@
      * "What has happened to me?", he thought. It was no dream....
      */
     protected final static String DEFAULT_TRANSLET_NAME = "GregorSamsa";
-
+    
     /**
      * The class name of the translet
      */
     private String _transletName = DEFAULT_TRANSLET_NAME;
-
+    
     /**
      * The destination directory for the translet
      */
     private String _destinationDirectory = null;
-
+    
     /**
      * The package name prefix for all generated translet classes
      */
     private String _packageName = null;
-
+    
     /**
      * The jar file name which the translet classes are packaged into
      */
@@ -149,15 +150,15 @@
      * The above hashtable stores objects of this class.
      */
     private static class PIParamWrapper {
-        public String _media = null;
-        public String _title = null;
-        public String _charset = null;
-
-        public PIParamWrapper(String media, String title, String charset) {
-            _media = media;
-            _title = title;
-            _charset = charset;
-        }
+	public String _media = null;
+	public String _title = null;
+	public String _charset = null;
+	
+	public PIParamWrapper(String media, String title, String charset) {
+	    _media = media;
+	    _title = title;
+	    _charset = charset;
+	}
     }
 
     /**
@@ -169,13 +170,13 @@
      * Set to <code>true</code> when templates are inlined.
      */
     private boolean _enableInlining = false;
-
+    
     /**
-     * Set to <code>true</code> when we want to generate
+     * Set to <code>true</code> when we want to generate 
      * translet classes from the stylesheet.
      */
     private boolean _generateTranslet = false;
-
+    
     /**
      * If this is set to <code>true</code>, we attempt to use translet classes
      * for transformation if possible without compiling the stylesheet. The
@@ -183,7 +184,7 @@
      * of the stylesheet.
      */
     private boolean _autoTranslet = false;
-
+    
     /**
      * If this is set to <code>true</code>, we attempt to load the translet
      * from the CLASSPATH.
@@ -207,12 +208,19 @@
      * <p>State of secure processing feature.</p>
      */
     private boolean _isSecureProcessing = false;
-
+    /**
+     * <p>State of secure mode.</p>
+     */
+    private boolean _isSecureMode = false;
     /**
      * javax.xml.transform.sax.TransformerFactory implementation.
      */
     public TransformerFactoryImpl() {
         m_DTMManagerClass = XSLTCDTMManager.getDTMManagerClass();
+        if (System.getSecurityManager() != null) {
+            _isSecureMode = true;
+            _isSecureProcessing = true;
+        }
     }
 
     /**
@@ -224,15 +232,15 @@
      * @param listener The error listener to use with the TransformerFactory
      * @throws IllegalArgumentException
      */
-    public void setErrorListener(ErrorListener listener)
-        throws IllegalArgumentException
+    public void setErrorListener(ErrorListener listener) 
+	throws IllegalArgumentException 
     {
-        if (listener == null) {
-            ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
-                                        "TransformerFactory");
+	if (listener == null) {
+	    ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
+					"TransformerFactory");
             throw new IllegalArgumentException(err.toString());
-        }
-        _errorListener = listener;
+	}
+	_errorListener = listener;
     }
 
     /**
@@ -241,8 +249,8 @@
      *
      * @return The error listener used with the TransformerFactory
      */
-    public ErrorListener getErrorListener() {
-        return _errorListener;
+    public ErrorListener getErrorListener() { 
+	return _errorListener;
     }
 
     /**
@@ -253,23 +261,23 @@
      * @return An object representing the attribute value
      * @throws IllegalArgumentException
      */
-    public Object getAttribute(String name)
-        throws IllegalArgumentException
-    {
-        // Return value for attribute 'translet-name'
-        if (name.equals(TRANSLET_NAME)) {
-            return _transletName;
-        }
-        else if (name.equals(GENERATE_TRANSLET)) {
-            return new Boolean(_generateTranslet);
-        }
-        else if (name.equals(AUTO_TRANSLET)) {
-            return new Boolean(_autoTranslet);
-        }
+    public Object getAttribute(String name) 
+	throws IllegalArgumentException 
+    { 
+	// Return value for attribute 'translet-name'
+	if (name.equals(TRANSLET_NAME)) {
+	    return _transletName;
+	}
+	else if (name.equals(GENERATE_TRANSLET)) {
+	    return new Boolean(_generateTranslet);
+	}
+	else if (name.equals(AUTO_TRANSLET)) {
+	    return new Boolean(_autoTranslet);
+	}
 
-        // Throw an exception for all other attributes
-        ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
-        throw new IllegalArgumentException(err.toString());
+	// Throw an exception for all other attributes
+	ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
+	throw new IllegalArgumentException(err.toString());
     }
 
     /**
@@ -280,103 +288,103 @@
      * @param value An object representing the attribute value
      * @throws IllegalArgumentException
      */
-    public void setAttribute(String name, Object value)
-        throws IllegalArgumentException
-    {
-        // Set the default translet name (ie. class name), which will be used
-        // for translets that cannot be given a name from their system-id.
-        if (name.equals(TRANSLET_NAME) && value instanceof String) {
-            _transletName = (String) value;
-            return;
-        }
-        else if (name.equals(DESTINATION_DIRECTORY) && value instanceof String) {
-            _destinationDirectory = (String) value;
-            return;
-        }
-        else if (name.equals(PACKAGE_NAME) && value instanceof String) {
-            _packageName = (String) value;
-            return;
-        }
-        else if (name.equals(JAR_NAME) && value instanceof String) {
-            _jarFileName = (String) value;
-            return;
-        }
-        else if (name.equals(GENERATE_TRANSLET)) {
-            if (value instanceof Boolean) {
-                _generateTranslet = ((Boolean) value).booleanValue();
-                return;
-            }
-            else if (value instanceof String) {
-                _generateTranslet = ((String) value).equalsIgnoreCase("true");
-                return;
-            }
-        }
-        else if (name.equals(AUTO_TRANSLET)) {
-            if (value instanceof Boolean) {
-                _autoTranslet = ((Boolean) value).booleanValue();
-                return;
-            }
-            else if (value instanceof String) {
-                _autoTranslet = ((String) value).equalsIgnoreCase("true");
-                return;
-            }
-        }
-        else if (name.equals(USE_CLASSPATH)) {
-            if (value instanceof Boolean) {
-                _useClasspath = ((Boolean) value).booleanValue();
-                return;
-            }
-            else if (value instanceof String) {
-                _useClasspath = ((String) value).equalsIgnoreCase("true");
-                return;
-            }
-        }
-        else if (name.equals(DEBUG)) {
-            if (value instanceof Boolean) {
-                _debug = ((Boolean) value).booleanValue();
-                return;
-            }
-            else if (value instanceof String) {
-                _debug = ((String) value).equalsIgnoreCase("true");
-                return;
-            }
-        }
-        else if (name.equals(ENABLE_INLINING)) {
-            if (value instanceof Boolean) {
-                _enableInlining = ((Boolean) value).booleanValue();
-                return;
-            }
-            else if (value instanceof String) {
-                _enableInlining = ((String) value).equalsIgnoreCase("true");
-                return;
-            }
-        }
-        else if (name.equals(INDENT_NUMBER)) {
-            if (value instanceof String) {
-                try {
-                    _indentNumber = Integer.parseInt((String) value);
-                    return;
-                }
-                catch (NumberFormatException e) {
-                    // Falls through
-                }
-            }
-            else if (value instanceof Integer) {
-                _indentNumber = ((Integer) value).intValue();
-                return;
-            }
-        }
+    public void setAttribute(String name, Object value) 
+	throws IllegalArgumentException 
+    { 
+	// Set the default translet name (ie. class name), which will be used
+	// for translets that cannot be given a name from their system-id.
+	if (name.equals(TRANSLET_NAME) && value instanceof String) {
+	    _transletName = (String) value;	      
+	    return;
+	}
+	else if (name.equals(DESTINATION_DIRECTORY) && value instanceof String) {
+	    _destinationDirectory = (String) value;
+	    return;
+	}
+	else if (name.equals(PACKAGE_NAME) && value instanceof String) {
+	    _packageName = (String) value;
+	    return;
+	}
+	else if (name.equals(JAR_NAME) && value instanceof String) {
+	    _jarFileName = (String) value;
+	    return;
+	}
+	else if (name.equals(GENERATE_TRANSLET)) {
+	    if (value instanceof Boolean) {
+		_generateTranslet = ((Boolean) value).booleanValue();
+		return;
+	    }
+	    else if (value instanceof String) {
+		_generateTranslet = ((String) value).equalsIgnoreCase("true");
+		return;
+	    }
+	}
+	else if (name.equals(AUTO_TRANSLET)) {
+	    if (value instanceof Boolean) {
+		_autoTranslet = ((Boolean) value).booleanValue();
+		return;
+	    }
+	    else if (value instanceof String) {
+		_autoTranslet = ((String) value).equalsIgnoreCase("true");
+		return;
+	    }
+	}
+	else if (name.equals(USE_CLASSPATH)) {
+	    if (value instanceof Boolean) {
+		_useClasspath = ((Boolean) value).booleanValue();
+		return;
+	    }
+	    else if (value instanceof String) {
+		_useClasspath = ((String) value).equalsIgnoreCase("true");
+		return;
+	    }	    
+	}
+	else if (name.equals(DEBUG)) {
+	    if (value instanceof Boolean) {
+		_debug = ((Boolean) value).booleanValue();
+		return;
+	    }
+	    else if (value instanceof String) {
+		_debug = ((String) value).equalsIgnoreCase("true");
+		return;
+	    }
+	}
+	else if (name.equals(ENABLE_INLINING)) {
+	    if (value instanceof Boolean) {
+		_enableInlining = ((Boolean) value).booleanValue();
+		return;
+	    }
+	    else if (value instanceof String) {
+		_enableInlining = ((String) value).equalsIgnoreCase("true");
+		return;
+	    }
+	}
+	else if (name.equals(INDENT_NUMBER)) {
+	    if (value instanceof String) {
+		try {
+		    _indentNumber = Integer.parseInt((String) value);
+		    return;
+		}
+		catch (NumberFormatException e) {
+		    // Falls through
+		}
+	    }
+	    else if (value instanceof Integer) {
+		_indentNumber = ((Integer) value).intValue();
+		return;
+	    }
+	}
 
-        // Throw an exception for all other attributes
-        final ErrorMsg err
-            = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
-        throw new IllegalArgumentException(err.toString());
+	// Throw an exception for all other attributes
+	final ErrorMsg err 
+	    = new ErrorMsg(ErrorMsg.JAXP_INVALID_ATTR_ERR, name);
+	throw new IllegalArgumentException(err.toString());
     }
 
     /**
      * <p>Set a feature for this <code>TransformerFactory</code> and <code>Transformer</code>s
      * or <code>Template</code>s created by this factory.</p>
-     *
+     * 
      * <p>
      * Feature names are fully qualified {@link java.net.URI}s.
      * Implementations may define their own features.
@@ -384,12 +392,12 @@
      * <code>Transformer</code>s or <code>Template</code>s it creates cannot support the feature.
      * It is possible for an <code>TransformerFactory</code> to expose a feature value but be unable to change its state.
      * </p>
-     *
+     * 
      * <p>See {@link javax.xml.transform.TransformerFactory} for full documentation of specific features.</p>
-     *
+     * 
      * @param name Feature name.
      * @param value Is feature state <code>true</code> or <code>false</code>.
-     *
+     *  
      * @throws TransformerConfigurationException if this <code>TransformerFactory</code>
      *   or the <code>Transformer</code>s or <code>Template</code>s it creates cannot support this feature.
      * @throws NullPointerException If the <code>name</code> parameter is null.
@@ -397,19 +405,23 @@
     public void setFeature(String name, boolean value)
         throws TransformerConfigurationException {
 
-        // feature name cannot be null
-        if (name == null) {
+	// feature name cannot be null
+	if (name == null) {
             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SET_FEATURE_NULL_NAME);
-            throw new NullPointerException(err.toString());
-        }
-        // secure processing?
-        else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
-            _isSecureProcessing = value;
-            // all done processing feature
-            return;
-        }
-        else {
-            // unknown feature
+    	    throw new NullPointerException(err.toString());
+	}		
+	// secure processing?
+	else if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+            if ((_isSecureMode) && (!value)) {
+                ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_SECUREPROCESSING_FEATURE);
+                throw new TransformerConfigurationException(err.toString());
+            }
+	    _isSecureProcessing = value;		
+	    // all done processing feature
+	    return;
+	}
+	else {	
+	    // unknown feature
             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNSUPPORTED_FEATURE, name);
             throw new TransformerConfigurationException(err.toString());
         }
@@ -424,38 +436,40 @@
      * @param name The feature name
      * @return 'true' if feature is supported, 'false' if not
      */
-    public boolean getFeature(String name) {
-        // All supported features should be listed here
-        String[] features = {
-            DOMSource.FEATURE,
-            DOMResult.FEATURE,
-            SAXSource.FEATURE,
-            SAXResult.FEATURE,
-            StreamSource.FEATURE,
-            StreamResult.FEATURE,
-            SAXTransformerFactory.FEATURE,
-            SAXTransformerFactory.FEATURE_XMLFILTER
-        };
+    public boolean getFeature(String name) { 
+	// All supported features should be listed here
+	String[] features = {
+	    DOMSource.FEATURE,
+	    DOMResult.FEATURE,
+	    SAXSource.FEATURE,
+	    SAXResult.FEATURE,
+	    StAXSource.FEATURE,
+	    StAXResult.FEATURE,
+	    StreamSource.FEATURE,
+	    StreamResult.FEATURE,
+	    SAXTransformerFactory.FEATURE,
+	    SAXTransformerFactory.FEATURE_XMLFILTER
+	};
 
-        // feature name cannot be null
-        if (name == null) {
-            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
-            throw new NullPointerException(err.toString());
-        }
+	// feature name cannot be null
+	if (name == null) {
+    	    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_GET_FEATURE_NULL_NAME);
+    	    throw new NullPointerException(err.toString());
+	}
 
-        // Inefficient, but array is small
-        for (int i =0; i < features.length; i++) {
-            if (name.equals(features[i])) {
-                return true;
-            }
-        }
-        // secure processing?
-        if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
-                return _isSecureProcessing;
-        }
+	// Inefficient, but array is small
+	for (int i =0; i < features.length; i++) {
+	    if (name.equals(features[i])) {
+		return true;
+	    }
+	}
+	// secure processing?
+	if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+		return _isSecureProcessing;
+	}
 
-        // Feature not supported
-        return false;
+	// Feature not supported
+	return false;
     }
 
     /**
@@ -465,10 +479,10 @@
      *
      * @return The URLResolver used for this TransformerFactory and all
      * Templates and Transformer objects created using this factory
-     */
+     */    
     public URIResolver getURIResolver() {
-        return _uriResolver;
-    }
+	return _uriResolver;
+    } 
 
     /**
      * javax.xml.transform.sax.TransformerFactory implementation.
@@ -479,9 +493,9 @@
      *
      * @param resolver The URLResolver used for this TransformerFactory and all
      * Templates and Transformer objects created using this factory
-     */
+     */    
     public void setURIResolver(URIResolver resolver) {
-        _uriResolver = resolver;
+	_uriResolver = resolver;
     }
 
     /**
@@ -500,8 +514,8 @@
      * @throws TransformerConfigurationException
      */
     public Source  getAssociatedStylesheet(Source source, String media,
-                                          String title, String charset)
-        throws TransformerConfigurationException {
+					  String title, String charset)
+	throws TransformerConfigurationException {
 
         String baseId;
         XMLReader reader = null;
@@ -514,7 +528,7 @@
         StylesheetPIHandler _stylesheetPIHandler = new StylesheetPIHandler(null,media,title,charset);
 
         try {
-
+  
             if (source instanceof DOMSource ) {
                 final DOMSource domsrc = (DOMSource) source;
                 baseId = domsrc.getSystemId();
@@ -531,14 +545,14 @@
 
                 SAXParserFactory factory = SAXParserFactory.newInstance();
                 factory.setNamespaceAware(true);
-
+                
                 if (_isSecureProcessing) {
                     try {
                         factory.setFeature(XMLConstants.FEATURE_SECURE_PROCESSING, true);
                     }
                     catch (org.xml.sax.SAXException e) {}
                 }
-
+                
                 SAXParser jaxpParser = factory.newSAXParser();
 
                 reader = jaxpParser.getXMLReader();
@@ -586,20 +600,20 @@
      *
      * @return A Transformer object that simply copies the source to the result.
      * @throws TransformerConfigurationException
-     */
+     */    
     public Transformer newTransformer()
-        throws TransformerConfigurationException
-    {
-        TransformerImpl result = new TransformerImpl(new Properties(),
-            _indentNumber, this);
-        if (_uriResolver != null) {
-            result.setURIResolver(_uriResolver);
-        }
-
-        if (_isSecureProcessing) {
-            result.setSecureProcessing(true);
-        }
-        return result;
+	throws TransformerConfigurationException 
+    { 
+	TransformerImpl result = new TransformerImpl(new Properties(), 
+	    _indentNumber, this);
+	if (_uriResolver != null) {
+	    result.setURIResolver(_uriResolver);
+	}
+	
+	if (_isSecureProcessing) {
+	    result.setSecureProcessing(true);
+	}
+	return result;
     }
 
     /**
@@ -613,57 +627,57 @@
      * @throws TransformerConfigurationException
      */
     public Transformer newTransformer(Source source) throws
-        TransformerConfigurationException
+	TransformerConfigurationException 
     {
-        final Templates templates = newTemplates(source);
-        final Transformer transformer = templates.newTransformer();
-        if (_uriResolver != null) {
-            transformer.setURIResolver(_uriResolver);
-        }
-        return(transformer);
+	final Templates templates = newTemplates(source);
+	final Transformer transformer = templates.newTransformer();
+	if (_uriResolver != null) {
+	    transformer.setURIResolver(_uriResolver);
+	}
+	return(transformer);
     }
 
     /**
      * Pass warning messages from the compiler to the error listener
      */
-    private void passWarningsToListener(Vector messages)
-        throws TransformerException
+    private void passWarningsToListener(Vector messages) 
+	throws TransformerException 
     {
-        if (_errorListener == null || messages == null) {
-            return;
-        }
-        // Pass messages to listener, one by one
-        final int count = messages.size();
-        for (int pos = 0; pos < count; pos++) {
-            ErrorMsg msg = (ErrorMsg)messages.elementAt(pos);
-            // Workaround for the TCK failure ErrorListener.errorTests.error001.
-            if (msg.isWarningError())
-                _errorListener.error(
-                    new TransformerConfigurationException(msg.toString()));
-            else
-                _errorListener.warning(
-                    new TransformerConfigurationException(msg.toString()));
-        }
+	if (_errorListener == null || messages == null) {
+	    return;
+	}
+	// Pass messages to listener, one by one
+	final int count = messages.size();
+	for (int pos = 0; pos < count; pos++) {
+	    ErrorMsg msg = (ErrorMsg)messages.elementAt(pos);
+	    // Workaround for the TCK failure ErrorListener.errorTests.error001.
+	    if (msg.isWarningError())
+	        _errorListener.error(
+		    new TransformerConfigurationException(msg.toString()));
+	    else
+	    	_errorListener.warning(
+		    new TransformerConfigurationException(msg.toString()));
+	}
     }
 
     /**
      * Pass error messages from the compiler to the error listener
      */
     private void passErrorsToListener(Vector messages) {
-        try {
-            if (_errorListener == null || messages == null) {
-                return;
-            }
-            // Pass messages to listener, one by one
-            final int count = messages.size();
-            for (int pos = 0; pos < count; pos++) {
-                String message = messages.elementAt(pos).toString();
-                _errorListener.error(new TransformerException(message));
-            }
-        }
-        catch (TransformerException e) {
-            // nada
-        }
+	try {
+	    if (_errorListener == null || messages == null) {
+		return;
+	    }
+	    // Pass messages to listener, one by one
+	    final int count = messages.size();
+	    for (int pos = 0; pos < count; pos++) {
+		String message = messages.elementAt(pos).toString();
+		_errorListener.error(new TransformerException(message));
+	    }
+	}
+	catch (TransformerException e) {
+	    // nada
+	}
     }
 
     /**
@@ -676,162 +690,162 @@
      * @throws TransformerConfigurationException
      */
     public Templates newTemplates(Source source)
-        throws TransformerConfigurationException
+	throws TransformerConfigurationException 
     {
-        // If the _useClasspath attribute is true, try to load the translet from
-        // the CLASSPATH and create a template object using the loaded
-        // translet.
-        if (_useClasspath) {
-            String transletName = getTransletBaseName(source);
-
-            if (_packageName != null)
-                transletName = _packageName + "." + transletName;
-
-            try {
+	// If the _useClasspath attribute is true, try to load the translet from
+	// the CLASSPATH and create a template object using the loaded
+	// translet.
+	if (_useClasspath) {
+	    String transletName = getTransletBaseName(source);
+	            
+	    if (_packageName != null)
+	        transletName = _packageName + "." + transletName;
+	        
+	    try {
                 final Class clazz = ObjectFactory.findProviderClass(
                     transletName, ObjectFactory.findClassLoader(), true);
-                resetTransientAttributes();
-
-                return new TemplatesImpl(new Class[]{clazz}, transletName, null, _indentNumber, this);
-            }
-            catch (ClassNotFoundException cnfe) {
-                ErrorMsg err = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, transletName);
-                throw new TransformerConfigurationException(err.toString());
-            }
-            catch (Exception e) {
-                ErrorMsg err = new ErrorMsg(
+	        resetTransientAttributes();
+	            
+	        return new TemplatesImpl(new Class[]{clazz}, transletName, null, _indentNumber, this);
+	    }
+	    catch (ClassNotFoundException cnfe) {
+	        ErrorMsg err = new ErrorMsg(ErrorMsg.CLASS_NOT_FOUND_ERR, transletName);
+	        throw new TransformerConfigurationException(err.toString());
+	    }
+	    catch (Exception e) {
+	        ErrorMsg err = new ErrorMsg(
                                      new ErrorMsg(ErrorMsg.RUNTIME_ERROR_KEY)
                                      + e.getMessage());
-                throw new TransformerConfigurationException(err.toString());
-            }
-        }
-
-        // If _autoTranslet is true, we will try to load the bytecodes
-        // from the translet classes without compiling the stylesheet.
-        if (_autoTranslet)  {
-            byte[][] bytecodes = null;
-            String transletClassName = getTransletBaseName(source);
-
-            if (_packageName != null)
-                transletClassName = _packageName + "." + transletClassName;
-
-            if (_jarFileName != null)
-                bytecodes = getBytecodesFromJar(source, transletClassName);
-            else
-                bytecodes = getBytecodesFromClasses(source, transletClassName);
-
-            if (bytecodes != null) {
-                if (_debug) {
-                    if (_jarFileName != null)
-                        System.err.println(new ErrorMsg(
-                            ErrorMsg.TRANSFORM_WITH_JAR_STR, transletClassName, _jarFileName));
-                    else
-                        System.err.println(new ErrorMsg(
-                            ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, transletClassName));
-                }
+	        throw new TransformerConfigurationException(err.toString());
+	    }
+	}
+	
+	// If _autoTranslet is true, we will try to load the bytecodes
+	// from the translet classes without compiling the stylesheet.
+	if (_autoTranslet)  {
+	    byte[][] bytecodes = null;
+	    String transletClassName = getTransletBaseName(source);
+	    
+	    if (_packageName != null)
+	        transletClassName = _packageName + "." + transletClassName;
+	    
+	    if (_jarFileName != null)
+	    	bytecodes = getBytecodesFromJar(source, transletClassName);
+	    else
+	    	bytecodes = getBytecodesFromClasses(source, transletClassName);	    
+	  
+	    if (bytecodes != null) {
+	    	if (_debug) {
+	      	    if (_jarFileName != null)
+	        	System.err.println(new ErrorMsg(
+	            	    ErrorMsg.TRANSFORM_WITH_JAR_STR, transletClassName, _jarFileName));
+	            else
+	            	System.err.println(new ErrorMsg(
+	            	    ErrorMsg.TRANSFORM_WITH_TRANSLET_STR, transletClassName));
+	    	}
 
-                // Reset the per-session attributes to their default values
-                // after each newTemplates() call.
-                resetTransientAttributes();
-
-                return new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this);
-            }
-        }
-
-        // Create and initialize a stylesheet compiler
-        final XSLTC xsltc = new XSLTC();
-        if (_debug) xsltc.setDebug(true);
-        if (_enableInlining) xsltc.setTemplateInlining(true);
-        if (_isSecureProcessing) xsltc.setSecureProcessing(true);
-        xsltc.init();
+	    	// Reset the per-session attributes to their default values
+	    	// after each newTemplates() call.
+	    	resetTransientAttributes();
+	    
+	    	return new TemplatesImpl(bytecodes, transletClassName, null, _indentNumber, this);	    
+	    }
+	}
+	
+	// Create and initialize a stylesheet compiler
+	final XSLTC xsltc = new XSLTC();
+	if (_debug) xsltc.setDebug(true);
+	if (_enableInlining) xsltc.setTemplateInlining(true);
+	if (_isSecureProcessing) xsltc.setSecureProcessing(true);
+	xsltc.init();
 
-        // Set a document loader (for xsl:include/import) if defined
-        if (_uriResolver != null) {
-            xsltc.setSourceLoader(this);
-        }
+	// Set a document loader (for xsl:include/import) if defined
+	if (_uriResolver != null) {
+	    xsltc.setSourceLoader(this);
+	}
 
-        // Pass parameters to the Parser to make sure it locates the correct
-        // <?xml-stylesheet ...?> PI in an XML input document
-        if ((_piParams != null) && (_piParams.get(source) != null)) {
-            // Get the parameters for this Source object
-            PIParamWrapper p = (PIParamWrapper)_piParams.get(source);
-            // Pass them on to the compiler (which will pass then to the parser)
-            if (p != null) {
-                xsltc.setPIParameters(p._media, p._title, p._charset);
-            }
-        }
+	// Pass parameters to the Parser to make sure it locates the correct
+	// <?xml-stylesheet ...?> PI in an XML input document
+	if ((_piParams != null) && (_piParams.get(source) != null)) {
+	    // Get the parameters for this Source object
+	    PIParamWrapper p = (PIParamWrapper)_piParams.get(source);
+	    // Pass them on to the compiler (which will pass then to the parser)
+	    if (p != null) {
+		xsltc.setPIParameters(p._media, p._title, p._charset);
+	    }
+	}
 
-        // Set the attributes for translet generation
-        int outputType = XSLTC.BYTEARRAY_OUTPUT;
-        if (_generateTranslet || _autoTranslet) {
-            // Set the translet name
-            xsltc.setClassName(getTransletBaseName(source));
-
-            if (_destinationDirectory != null)
-                xsltc.setDestDirectory(_destinationDirectory);
-            else {
-                String xslName = getStylesheetFileName(source);
-                if (xslName != null) {
-                    File xslFile = new File(xslName);
-                    String xslDir = xslFile.getParent();
-
-                    if (xslDir != null)
-                        xsltc.setDestDirectory(xslDir);
-                }
-            }
-
-            if (_packageName != null)
-                xsltc.setPackageName(_packageName);
-
-            if (_jarFileName != null) {
-                xsltc.setJarFileName(_jarFileName);
-                outputType = XSLTC.BYTEARRAY_AND_JAR_OUTPUT;
-            }
-            else
-                outputType = XSLTC.BYTEARRAY_AND_FILE_OUTPUT;
-        }
+	// Set the attributes for translet generation
+	int outputType = XSLTC.BYTEARRAY_OUTPUT;
+	if (_generateTranslet || _autoTranslet) {
+	    // Set the translet name
+	    xsltc.setClassName(getTransletBaseName(source));
+	  
+	    if (_destinationDirectory != null)
+	    	xsltc.setDestDirectory(_destinationDirectory);
+	    else {
+	    	String xslName = getStylesheetFileName(source);
+	    	if (xslName != null) {
+	      	    File xslFile = new File(xslName);
+	            String xslDir = xslFile.getParent();
+	    
+	      	    if (xslDir != null)
+	                xsltc.setDestDirectory(xslDir);
+	    	}
+	    }
+	  
+	    if (_packageName != null)
+	        xsltc.setPackageName(_packageName);
+	
+	    if (_jarFileName != null) {
+	    	xsltc.setJarFileName(_jarFileName);
+	    	outputType = XSLTC.BYTEARRAY_AND_JAR_OUTPUT;
+	    }
+	    else
+	    	outputType = XSLTC.BYTEARRAY_AND_FILE_OUTPUT;
+	}
 
-        // Compile the stylesheet
-        final InputSource input = Util.getInputSource(xsltc, source);
-        byte[][] bytecodes = xsltc.compile(null, input, outputType);
-        final String transletName = xsltc.getClassName();
+	// Compile the stylesheet
+	final InputSource input = Util.getInputSource(xsltc, source);
+	byte[][] bytecodes = xsltc.compile(null, input, outputType);
+	final String transletName = xsltc.getClassName();
 
-        // Output to the jar file if the jar file name is set.
-        if ((_generateTranslet || _autoTranslet)
-                && bytecodes != null && _jarFileName != null) {
-            try {
-                xsltc.outputToJar();
-            }
-            catch (java.io.IOException e) { }
-        }
+	// Output to the jar file if the jar file name is set.
+	if ((_generateTranslet || _autoTranslet)
+	   	&& bytecodes != null && _jarFileName != null) {
+	    try {
+	    	xsltc.outputToJar();
+	    }
+	    catch (java.io.IOException e) { }
+	}
 
-        // Reset the per-session attributes to their default values
-        // after each newTemplates() call.
-        resetTransientAttributes();
+	// Reset the per-session attributes to their default values
+	// after each newTemplates() call.
+	resetTransientAttributes();
 
-        // Pass compiler warnings to the error listener
-        if (_errorListener != this) {
-            try {
-                passWarningsToListener(xsltc.getWarnings());
-            }
-            catch (TransformerException e) {
-                throw new TransformerConfigurationException(e);
-            }
-        }
-        else {
-            xsltc.printWarnings();
-        }
+	// Pass compiler warnings to the error listener
+	if (_errorListener != this) {
+	    try {
+		passWarningsToListener(xsltc.getWarnings());
+	    }
+	    catch (TransformerException e) {
+		throw new TransformerConfigurationException(e);
+	    }
+	}
+	else {
+	    xsltc.printWarnings();
+	}
 
-        // Check that the transformation went well before returning
+	// Check that the transformation went well before returning
     if (bytecodes == null) {
-
+        
         ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_COMPILE_ERR);
         TransformerConfigurationException exc =  new TransformerConfigurationException(err.toString());
-
+        
         // Pass compiler errors to the error listener
         if (_errorListener != null) {
             passErrorsToListener(xsltc.getErrors());
-
+            
             // As required by TCK 1.2, send a fatalError to the
             // error listener because compilation of the stylesheet
             // failed and no further processing will be possible.
@@ -839,7 +853,7 @@
                 _errorListener.fatalError(exc);
             } catch (TransformerException te) {
                 // well, we tried.
-            }
+            }    
         }
         else {
             xsltc.printErrors();
@@ -847,8 +861,8 @@
         throw exc;
     }
 
-        return new TemplatesImpl(bytecodes, transletName,
-            xsltc.getOutputProperties(), _indentNumber, this);
+	return new TemplatesImpl(bytecodes, transletName,
+	    xsltc.getOutputProperties(), _indentNumber, this);
     }
 
     /**
@@ -859,15 +873,15 @@
      * @return A TemplatesHandler object that can handle SAX events
      * @throws TransformerConfigurationException
      */
-    public TemplatesHandler newTemplatesHandler()
-        throws TransformerConfigurationException
-    {
-        final TemplatesHandlerImpl handler =
-            new TemplatesHandlerImpl(_indentNumber, this);
-        if (_uriResolver != null) {
-            handler.setURIResolver(_uriResolver);
-        }
-        return handler;
+    public TemplatesHandler newTemplatesHandler() 
+	throws TransformerConfigurationException 
+    { 
+	final TemplatesHandlerImpl handler = 
+	    new TemplatesHandlerImpl(_indentNumber, this);
+	if (_uriResolver != null) {
+	    handler.setURIResolver(_uriResolver);
+	}
+	return handler;
     }
 
     /**
@@ -878,14 +892,14 @@
      * @return A TransformerHandler object that can handle SAX events
      * @throws TransformerConfigurationException
      */
-    public TransformerHandler newTransformerHandler()
-        throws TransformerConfigurationException
+    public TransformerHandler newTransformerHandler() 
+	throws TransformerConfigurationException 
     {
-        final Transformer transformer = newTransformer();
-        if (_uriResolver != null) {
-            transformer.setURIResolver(_uriResolver);
-        }
-        return new TransformerHandlerImpl((TransformerImpl) transformer);
+	final Transformer transformer = newTransformer();
+	if (_uriResolver != null) {
+	    transformer.setURIResolver(_uriResolver);
+	}
+	return new TransformerHandlerImpl((TransformerImpl) transformer);
     }
 
     /**
@@ -898,14 +912,14 @@
      * @return A TransformerHandler object that can handle SAX events
      * @throws TransformerConfigurationException
      */
-    public TransformerHandler newTransformerHandler(Source src)
-        throws TransformerConfigurationException
-    {
-        final Transformer transformer = newTransformer(src);
-        if (_uriResolver != null) {
-            transformer.setURIResolver(_uriResolver);
-        }
-        return new TransformerHandlerImpl((TransformerImpl) transformer);
+    public TransformerHandler newTransformerHandler(Source src) 
+	throws TransformerConfigurationException 
+    { 
+	final Transformer transformer = newTransformer(src);
+	if (_uriResolver != null) {
+	    transformer.setURIResolver(_uriResolver);
+	}
+	return new TransformerHandlerImpl((TransformerImpl) transformer);
     }
 
     /**
@@ -917,13 +931,13 @@
      * @param templates Represents a pre-processed stylesheet
      * @return A TransformerHandler object that can handle SAX events
      * @throws TransformerConfigurationException
-     */
-    public TransformerHandler newTransformerHandler(Templates templates)
-        throws TransformerConfigurationException
+     */    
+    public TransformerHandler newTransformerHandler(Templates templates) 
+	throws TransformerConfigurationException  
     {
-        final Transformer transformer = templates.newTransformer();
-        final TransformerImpl internal = (TransformerImpl)transformer;
-        return new TransformerHandlerImpl(internal);
+	final Transformer transformer = templates.newTransformer();
+	final TransformerImpl internal = (TransformerImpl)transformer;
+	return new TransformerHandlerImpl(internal);
     }
 
     /**
@@ -935,12 +949,12 @@
      * @return An XMLFilter object, or null if this feature is not supported.
      * @throws TransformerConfigurationException
      */
-    public XMLFilter newXMLFilter(Source src)
-        throws TransformerConfigurationException
+    public XMLFilter newXMLFilter(Source src) 
+	throws TransformerConfigurationException 
     {
-        Templates templates = newTemplates(src);
-        if (templates == null) return null;
-        return newXMLFilter(templates);
+	Templates templates = newTemplates(src);
+	if (templates == null) return null; 
+	return newXMLFilter(templates);
     }
 
     /**
@@ -952,41 +966,41 @@
      * @return An XMLFilter object, or null if this feature is not supported.
      * @throws TransformerConfigurationException
      */
-    public XMLFilter newXMLFilter(Templates templates)
-        throws TransformerConfigurationException
+    public XMLFilter newXMLFilter(Templates templates) 
+	throws TransformerConfigurationException 
     {
-        try {
-            return new com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter(templates);
-        }
-        catch (TransformerConfigurationException e1) {
-            if (_errorListener != null) {
+	try {
+      	    return new com.sun.org.apache.xalan.internal.xsltc.trax.TrAXFilter(templates);
+    	}
+	catch (TransformerConfigurationException e1) {
+      	    if (_errorListener != null) {
                 try {
-                    _errorListener.fatalError(e1);
-                    return null;
-                }
-                catch (TransformerException e2) {
-                    new TransformerConfigurationException(e2);
-                }
-            }
-            throw e1;
-        }
+          	    _errorListener.fatalError(e1);
+          	    return null;
+        	}
+		catch (TransformerException e2) {
+          	    new TransformerConfigurationException(e2);
+        	}
+      	    }
+      	    throw e1;
+    	}
     }
 
     /**
-     * Receive notification of a recoverable error.
+     * Receive notification of a recoverable error. 
      * The transformer must continue to provide normal parsing events after
      * invoking this method. It should still be possible for the application
      * to process the document through to the end.
      *
-     * @param e The warning information encapsulated in a transformer
+     * @param e The warning information encapsulated in a transformer 
      * exception.
      * @throws TransformerException if the application chooses to discontinue
      * the transformation (always does in our case).
      */
     public void error(TransformerException e)
-        throws TransformerException
+	throws TransformerException 
     {
-        Throwable wrapped = e.getException();
+	Throwable wrapped = e.getException();
         if (wrapped != null) {
             System.err.println(new ErrorMsg(ErrorMsg.ERROR_PLUS_WRAPPED_MSG,
                                             e.getMessageAndLocation(),
@@ -994,12 +1008,12 @@
         } else {
             System.err.println(new ErrorMsg(ErrorMsg.ERROR_MSG,
                                             e.getMessageAndLocation()));
-        }
-        throw e;
+	}
+	throw e; 	
     }
 
     /**
-     * Receive notification of a non-recoverable error.
+     * Receive notification of a non-recoverable error. 
      * The application must assume that the transformation cannot continue
      * after the Transformer has invoked this method, and should continue
      * (if at all) only to collect addition error messages. In fact,
@@ -1012,9 +1026,9 @@
      * the transformation (always does in our case).
      */
     public void fatalError(TransformerException e)
-        throws TransformerException
+	throws TransformerException 
     {
-        Throwable wrapped = e.getException();
+	Throwable wrapped = e.getException();
         if (wrapped != null) {
             System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_PLUS_WRAPPED_MSG,
                                             e.getMessageAndLocation(),
@@ -1023,7 +1037,7 @@
             System.err.println(new ErrorMsg(ErrorMsg.FATAL_ERR_MSG,
                                             e.getMessageAndLocation()));
         }
-        throw e;
+	throw e;
     }
 
     /**
@@ -1040,14 +1054,14 @@
      * the transformation (never does in our case).
      */
     public void warning(TransformerException e)
-        throws TransformerException
+	throws TransformerException 
     {
-        Throwable wrapped = e.getException();
-        if (wrapped != null) {
+	Throwable wrapped = e.getException();
+	if (wrapped != null) {
             System.err.println(new ErrorMsg(ErrorMsg.WARNING_PLUS_WRAPPED_MSG,
                                             e.getMessageAndLocation(),
                                             wrapped.getMessage()));
-        } else {
+	} else {
             System.err.println(new ErrorMsg(ErrorMsg.WARNING_MSG,
                                             e.getMessageAndLocation()));
         }
@@ -1063,33 +1077,33 @@
      * @return An InputSource with the loaded document
      */
     public InputSource loadSource(String href, String context, XSLTC xsltc) {
-        try {
-            if (_uriResolver != null) {
-                final Source source = _uriResolver.resolve(href, context);
-                if (source != null) {
-                    return Util.getInputSource(xsltc, source);
-                }
-            }
-        }
-        catch (TransformerException e) {
-            // should catch it when the resolver explicitly throws the exception
+	try {
+	    if (_uriResolver != null) {
+		final Source source = _uriResolver.resolve(href, context);
+		if (source != null) {
+		    return Util.getInputSource(xsltc, source);
+		}
+	    }
+	}
+	catch (TransformerException e) {            
+	    // should catch it when the resolver explicitly throws the exception 
             final ErrorMsg msg = new ErrorMsg(ErrorMsg.INVALID_URI_ERR, href + "\n" + e.getMessage(), this);
             xsltc.getParser().reportError(Constants.FATAL, msg);
-        }
-
-        return null;
+	}
+ 
+	return null;
     }
 
     /**
      * Reset the per-session attributes to their default values
      */
     private void resetTransientAttributes() {
-        _transletName = DEFAULT_TRANSLET_NAME;
-        _destinationDirectory = null;
-        _packageName = null;
-        _jarFileName = null;
+	_transletName = DEFAULT_TRANSLET_NAME;
+	_destinationDirectory = null;
+	_packageName = null;
+	_jarFileName = null;    
     }
-
+        
     /**
      * Load the translet classes from local .class files and return
      * the bytecode array.
@@ -1100,134 +1114,134 @@
      */
     private byte[][] getBytecodesFromClasses(Source source, String fullClassName)
     {
-        if (fullClassName == null)
-            return null;
-
-        String xslFileName = getStylesheetFileName(source);
-        File xslFile = null;
-        if (xslFileName != null)
-            xslFile = new File(xslFileName);
-
-        // Find the base name of the translet
-        final String transletName;
-        int lastDotIndex = fullClassName.lastIndexOf('.');
-        if (lastDotIndex > 0)
-            transletName = fullClassName.substring(lastDotIndex+1);
-        else
-            transletName = fullClassName;
-
-        // Construct the path name for the translet class file
-        String transletPath = fullClassName.replace('.', '/');
-        if (_destinationDirectory != null) {
-            transletPath = _destinationDirectory + "/" + transletPath + ".class";
-        }
-        else {
-            if (xslFile != null && xslFile.getParent() != null)
-                transletPath = xslFile.getParent() + "/" + transletPath + ".class";
-            else
-                transletPath = transletPath + ".class";
-        }
-
-        // Return null if the translet class file does not exist.
-        File transletFile = new File(transletPath);
-        if (!transletFile.exists())
-            return null;
-
-        // Compare the timestamps of the translet and the xsl file.
-        // If the translet is older than the xsl file, return null
-        // so that the xsl file is used for the transformation and
-        // the translet is regenerated.
-        if (xslFile != null && xslFile.exists()) {
-            long xslTimestamp = xslFile.lastModified();
-            long transletTimestamp = transletFile.lastModified();
-            if (transletTimestamp < xslTimestamp)
-                return null;
-        }
-
-        // Load the translet into a bytecode array.
-        Vector bytecodes = new Vector();
-        int fileLength = (int)transletFile.length();
-        if (fileLength > 0) {
-            FileInputStream input = null;
-            try {
-                input = new FileInputStream(transletFile);
-            }
-            catch (FileNotFoundException e) {
-                return null;
-            }
-
-            byte[] bytes = new byte[fileLength];
-            try {
-                readFromInputStream(bytes, input, fileLength);
-                input.close();
-            }
-            catch (IOException e) {
-                return null;
-            }
-
-            bytecodes.addElement(bytes);
-        }
-        else
-            return null;
-
-        // Find the parent directory of the translet.
-        String transletParentDir = transletFile.getParent();
-        if (transletParentDir == null)
-            transletParentDir = System.getProperty("user.dir");
-
-        File transletParentFile = new File(transletParentDir);
-
-        // Find all the auxiliary files which have a name pattern of "transletClass$nnn.class".
-        final String transletAuxPrefix = transletName + "$";
-        File[] auxfiles = transletParentFile.listFiles(new FilenameFilter() {
-                public boolean accept(File dir, String name)
-                {
-                    return (name.endsWith(".class") && name.startsWith(transletAuxPrefix));
-                }
-              });
-
-        // Load the auxiliary class files and add them to the bytecode array.
-        for (int i = 0; i < auxfiles.length; i++)
-        {
-            File auxfile = auxfiles[i];
-            int auxlength = (int)auxfile.length();
-            if (auxlength > 0) {
-                FileInputStream auxinput = null;
-                try {
-                    auxinput = new FileInputStream(auxfile);
-                }
-                catch (FileNotFoundException e) {
-                    continue;
-                }
-
-                byte[] bytes = new byte[auxlength];
-
-                try {
-                    readFromInputStream(bytes, auxinput, auxlength);
-                    auxinput.close();
-                }
-                catch (IOException e) {
-                    continue;
-                }
-
-                bytecodes.addElement(bytes);
-            }
-        }
-
-        // Convert the Vector of byte[] to byte[][].
-        final int count = bytecodes.size();
-        if ( count > 0) {
-            final byte[][] result = new byte[count][1];
-            for (int i = 0; i < count; i++) {
-                result[i] = (byte[])bytecodes.elementAt(i);
-            }
-
-            return result;
-        }
-        else
-            return null;
+    	if (fullClassName == null)
+    	    return null;
+    	  
+    	String xslFileName = getStylesheetFileName(source);
+    	File xslFile = null;
+    	if (xslFileName != null)
+    	    xslFile = new File(xslFileName);
+    	
+    	// Find the base name of the translet
+    	final String transletName;
+    	int lastDotIndex = fullClassName.lastIndexOf('.');
+    	if (lastDotIndex > 0)
+    	    transletName = fullClassName.substring(lastDotIndex+1);
+    	else
+    	    transletName = fullClassName;
+    	    	
+    	// Construct the path name for the translet class file
+    	String transletPath = fullClassName.replace('.', '/');
+    	if (_destinationDirectory != null) {
+    	    transletPath = _destinationDirectory + "/" + transletPath + ".class";
+    	}
+    	else {
+    	    if (xslFile != null && xslFile.getParent() != null)
+    	    	transletPath = xslFile.getParent() + "/" + transletPath + ".class";
+    	    else
+    	    	transletPath = transletPath + ".class";
+    	}
+    	    	    	
+    	// Return null if the translet class file does not exist.
+    	File transletFile = new File(transletPath);
+    	if (!transletFile.exists())
+    	    return null;
+    	    	  
+    	// Compare the timestamps of the translet and the xsl file.
+    	// If the translet is older than the xsl file, return null 
+    	// so that the xsl file is used for the transformation and
+    	// the translet is regenerated.
+    	if (xslFile != null && xslFile.exists()) {
+    	    long xslTimestamp = xslFile.lastModified();
+    	    long transletTimestamp = transletFile.lastModified();
+    	    if (transletTimestamp < xslTimestamp)
+    	    	return null;
+    	}
+    	
+    	// Load the translet into a bytecode array.
+    	Vector bytecodes = new Vector();
+    	int fileLength = (int)transletFile.length();
+    	if (fileLength > 0) {
+    	    FileInputStream input = null;
+    	    try {
+    	    	input = new FileInputStream(transletFile);
+    	    }
+    	    catch (FileNotFoundException e) {
+    	    	return null;
+    	    }
+    	  
+    	    byte[] bytes = new byte[fileLength];
+    	    try {
+	    	readFromInputStream(bytes, input, fileLength);
+	    	input.close();
+	    }
+	    catch (IOException e) {
+    	    	return null;
+    	    }
+    	  
+    	    bytecodes.addElement(bytes);
+    	}
+    	else
+    	    return null;
+    	
+    	// Find the parent directory of the translet.
+    	String transletParentDir = transletFile.getParent();
+    	if (transletParentDir == null)
+    	    transletParentDir = System.getProperty("user.dir");
+    	  
+    	File transletParentFile = new File(transletParentDir);
+    	
+    	// Find all the auxiliary files which have a name pattern of "transletClass$nnn.class".
+    	final String transletAuxPrefix = transletName + "$";
+    	File[] auxfiles = transletParentFile.listFiles(new FilenameFilter() {
+        	public boolean accept(File dir, String name)
+    		{
+    		    return (name.endsWith(".class") && name.startsWith(transletAuxPrefix));	
+    		}
+    	      });
+    	
+    	// Load the auxiliary class files and add them to the bytecode array.
+    	for (int i = 0; i < auxfiles.length; i++)
+    	{
+    	    File auxfile = auxfiles[i];
+    	    int auxlength = (int)auxfile.length();
+    	    if (auxlength > 0) {
+    	    	FileInputStream auxinput = null;
+    	    	try {
+    	      	    auxinput = new FileInputStream(auxfile);
+    	    	}
+    	    	catch (FileNotFoundException e) {
+    	      	    continue;
+    	    	}
+    	  
+    	    	byte[] bytes = new byte[auxlength];
+    	    
+    	    	try {
+    	      	    readFromInputStream(bytes, auxinput, auxlength);
+    	      	    auxinput.close();
+    	    	}
+    	    	catch (IOException e) {
+    	      	    continue;
+    	    	}
+    	    
+    	    	bytecodes.addElement(bytes);   	    
+    	    }
+    	}
+    	
+    	// Convert the Vector of byte[] to byte[][].
+    	final int count = bytecodes.size();
+    	if ( count > 0) {
+    	    final byte[][] result = new byte[count][1];
+    	    for (int i = 0; i < count; i++) {
+    	    	result[i] = (byte[])bytecodes.elementAt(i);
+    	    }
+    	  
+    	    return result;
+    	}
+    	else
+    	    return null;
     }
-
+    
     /**
      * Load the translet classes from the jar file and return the bytecode.
      *
@@ -1237,91 +1251,91 @@
      */
     private byte[][] getBytecodesFromJar(Source source, String fullClassName)
     {
-        String xslFileName = getStylesheetFileName(source);
-        File xslFile = null;
-        if (xslFileName != null)
-            xslFile = new File(xslFileName);
-
-        // Construct the path for the jar file
-        String jarPath = null;
-        if (_destinationDirectory != null)
+    	String xslFileName = getStylesheetFileName(source);
+    	File xslFile = null;
+    	if (xslFileName != null)
+    	    xslFile = new File(xslFileName);
+      
+      	// Construct the path for the jar file
+      	String jarPath = null;
+      	if (_destinationDirectory != null)
             jarPath = _destinationDirectory + "/" + _jarFileName;
-        else {
-            if (xslFile != null && xslFile.getParent() != null)
-                jarPath = xslFile.getParent() + "/" + _jarFileName;
-            else
-                jarPath = _jarFileName;
-        }
-
-        // Return null if the jar file does not exist.
-        File file = new File(jarPath);
-        if (!file.exists())
+      	else {
+      	    if (xslFile != null && xslFile.getParent() != null)
+    	    	jarPath = xslFile.getParent() + "/" + _jarFileName;
+    	    else
+    	    	jarPath = _jarFileName;
+    	}
+            
+      	// Return null if the jar file does not exist.
+      	File file = new File(jarPath);
+      	if (!file.exists())
             return null;
 
-        // Compare the timestamps of the jar file and the xsl file. Return null
-        // if the xsl file is newer than the jar file.
-        if (xslFile != null && xslFile.exists()) {
-            long xslTimestamp = xslFile.lastModified();
-            long transletTimestamp = file.lastModified();
-            if (transletTimestamp < xslTimestamp)
-                return null;
-        }
-
-        // Create a ZipFile object for the jar file
-        ZipFile jarFile = null;
-        try {
+     	// Compare the timestamps of the jar file and the xsl file. Return null
+     	// if the xsl file is newer than the jar file.
+    	if (xslFile != null && xslFile.exists()) {
+    	    long xslTimestamp = xslFile.lastModified();
+    	    long transletTimestamp = file.lastModified();
+    	    if (transletTimestamp < xslTimestamp)
+    	        return null;
+    	}
+      
+      	// Create a ZipFile object for the jar file
+      	ZipFile jarFile = null;
+      	try {
             jarFile = new ZipFile(file);
-        }
-        catch (IOException e) {
+      	}
+      	catch (IOException e) {
             return null;
-        }
-
-        String transletPath = fullClassName.replace('.', '/');
-        String transletAuxPrefix = transletPath + "$";
-        String transletFullName = transletPath + ".class";
-
-        Vector bytecodes = new Vector();
-
-        // Iterate through all entries in the jar file to find the
-        // translet and auxiliary classes.
-        Enumeration entries = jarFile.entries();
-        while (entries.hasMoreElements())
-        {
+      	}
+      
+      	String transletPath = fullClassName.replace('.', '/');
+      	String transletAuxPrefix = transletPath + "$";
+      	String transletFullName = transletPath + ".class";
+      
+      	Vector bytecodes = new Vector();      
+      
+      	// Iterate through all entries in the jar file to find the 
+      	// translet and auxiliary classes.
+      	Enumeration entries = jarFile.entries();
+      	while (entries.hasMoreElements())
+      	{
             ZipEntry entry = (ZipEntry)entries.nextElement();
             String entryName = entry.getName();
-            if (entry.getSize() > 0 &&
-                  (entryName.equals(transletFullName) ||
-                  (entryName.endsWith(".class") &&
-                      entryName.startsWith(transletAuxPrefix))))
+            if (entry.getSize() > 0 && 
+            	  (entryName.equals(transletFullName) ||
+              	  (entryName.endsWith(".class") && 
+              	      entryName.startsWith(transletAuxPrefix))))
             {
-                try {
-                    InputStream input = jarFile.getInputStream(entry);
-                    int size = (int)entry.getSize();
-                    byte[] bytes = new byte[size];
-                    readFromInputStream(bytes, input, size);
-                    input.close();
-                    bytecodes.addElement(bytes);
-                }
-                catch (IOException e) {
-                    return null;
-                }
+            	try {
+              	    InputStream input = jarFile.getInputStream(entry);
+              	    int size = (int)entry.getSize();
+              	    byte[] bytes = new byte[size];
+              	    readFromInputStream(bytes, input, size);
+              	    input.close();
+              	    bytecodes.addElement(bytes);
+            	}
+            	catch (IOException e) {
+              	    return null;
+            	}          
             }
-        }
-
+      	}
+      
         // Convert the Vector of byte[] to byte[][].
-        final int count = bytecodes.size();
-        if (count > 0) {
-            final byte[][] result = new byte[count][1];
-            for (int i = 0; i < count; i++) {
-                result[i] = (byte[])bytecodes.elementAt(i);
-            }
-
-            return result;
-        }
-        else
-            return null;
+    	final int count = bytecodes.size();
+    	if (count > 0) {
+    	    final byte[][] result = new byte[count][1];
+    	    for (int i = 0; i < count; i++) {
+    	    	result[i] = (byte[])bytecodes.elementAt(i);
+    	    }
+    	  
+    	    return result;
+    	}
+    	else
+    	    return null;
     }
-
+    
     /**
      * Read a given number of bytes from the InputStream into a byte array.
      *
@@ -1330,7 +1344,7 @@
      * @param size The number of bytes to read.
      */
     private void readFromInputStream(byte[] bytes, InputStream input, int size)
-        throws IOException
+      	throws IOException
     {
       int n = 0;
       int offset = 0;
@@ -1338,7 +1352,7 @@
       while (length > 0 && (n = input.read(bytes, offset, length)) > 0) {
           offset = offset + n;
           length = length - n;
-      }
+      }    
     }
 
     /**
@@ -1353,24 +1367,24 @@
      * @return The name of the translet class
      */
     private String getTransletBaseName(Source source)
-    {
+    {      
         String transletBaseName = null;
         if (!_transletName.equals(DEFAULT_TRANSLET_NAME))
             return _transletName;
-        else {
+      	else {
             String systemId = source.getSystemId();
             if (systemId != null) {
-                String baseName = Util.baseName(systemId);
-                if (baseName != null) {
-                    baseName = Util.noExtName(baseName);
-                    transletBaseName = Util.toJavaName(baseName);
-                }
+          	String baseName = Util.baseName(systemId);
+		if (baseName != null) {
+		    baseName = Util.noExtName(baseName);
+		    transletBaseName = Util.toJavaName(baseName);
+		}
             }
-        }
-
+      	}
+      
         return (transletBaseName != null) ? transletBaseName : DEFAULT_TRANSLET_NAME;
     }
-
+        
     /**
      *  Return the local file name from the systemId of the Source object
      *
@@ -1380,27 +1394,27 @@
      */
     private String getStylesheetFileName(Source source)
     {
-        String systemId = source.getSystemId();
-        if (systemId != null) {
+    	String systemId = source.getSystemId();
+      	if (systemId != null) {
             File file = new File(systemId);
             if (file.exists())
                 return systemId;
             else {
-                URL url = null;
-                try {
-                    url = new URL(systemId);
-                }
-                catch (MalformedURLException e) {
-                    return null;
-                }
-
-                if ("file".equals(url.getProtocol()))
-                    return url.getFile();
-                else
-                    return null;
+              	URL url = null;
+          	try {
+            	    url = new URL(systemId);
+          	}
+          	catch (MalformedURLException e) {
+            	    return null;
+          	}
+          
+          	if ("file".equals(url.getProtocol()))
+            	    return url.getFile();
+          	else
+            	    return null;
             }
-        }
-        else
+      	}
+      	else
             return null;
     }
 
--- a/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xalan/internal/xsltc/trax/TransformerImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -102,16 +102,16 @@
     private final static String XML_STRING   = "xml";
 
     private final static String LEXICAL_HANDLER_PROPERTY =
-        "http://xml.org/sax/properties/lexical-handler";
+	"http://xml.org/sax/properties/lexical-handler";
     private static final String NAMESPACE_FEATURE =
-        "http://xml.org/sax/features/namespaces";
-
+	"http://xml.org/sax/features/namespaces";
+    
     /**
      * Namespace prefixes feature for {@link XMLReader}.
      */
     private static final String NAMESPACE_PREFIXES_FEATURE =
         "http://xml.org/sax/features/namespace-prefixes";
-
+    
     /**
      * A reference to the translet or null if the identity transform.
      */
@@ -183,14 +183,14 @@
      * A reference to an object that creates and caches XMLReader objects.
      */
     private XMLReaderManager _readerManager = XMLReaderManager.getInstance();
-
+    
     /**
      * A flag indicating whether we use incremental building of the DTM.
      */
     //private boolean _isIncremental = false;
 
     /**
-     * A flag indicating whether this transformer implements the identity
+     * A flag indicating whether this transformer implements the identity 
      * transform.
      */
     private boolean _isIdentity = false;
@@ -202,7 +202,7 @@
 
     /**
      * A hashtable to store parameters for the identity transform. These
-     * are not needed during the transformation, but we must keep track of
+     * are not needed during the transformation, but we must keep track of 
      * them to be fully complaint with the JAXP API.
      */
     private Hashtable _parameters = null;
@@ -211,47 +211,47 @@
      * This class wraps an ErrorListener into a MessageHandler in order to
      * capture messages reported via xsl:message.
      */
-    static class MessageHandler
-           extends com.sun.org.apache.xalan.internal.xsltc.runtime.MessageHandler
+    static class MessageHandler 
+           extends com.sun.org.apache.xalan.internal.xsltc.runtime.MessageHandler 
     {
-        private ErrorListener _errorListener;
-
-        public MessageHandler(ErrorListener errorListener) {
-            _errorListener = errorListener;
-        }
-
-        public void displayMessage(String msg) {
-            if(_errorListener == null) {
-                System.err.println(msg);
-            }
-            else {
-                try {
-                    _errorListener.warning(new TransformerException(msg));
-                }
-                catch (TransformerException e) {
-                    // ignored
-                }
-            }
-        }
+	private ErrorListener _errorListener;
+     
+	public MessageHandler(ErrorListener errorListener) {
+	    _errorListener = errorListener;
+	}
+     
+	public void displayMessage(String msg) {
+	    if(_errorListener == null) {
+		System.err.println(msg); 
+	    }
+	    else {
+		try {
+		    _errorListener.warning(new TransformerException(msg));
+		}
+		catch (TransformerException e) {
+		    // ignored 
+		}
+	    }
+	}
     }
 
-    protected TransformerImpl(Properties outputProperties, int indentNumber,
-        TransformerFactoryImpl tfactory)
+    protected TransformerImpl(Properties outputProperties, int indentNumber, 
+	TransformerFactoryImpl tfactory) 
     {
-        this(null, outputProperties, indentNumber, tfactory);
-        _isIdentity = true;
-        // _properties.put(OutputKeys.METHOD, "xml");
+	this(null, outputProperties, indentNumber, tfactory);
+	_isIdentity = true;
+	// _properties.put(OutputKeys.METHOD, "xml");
     }
 
     protected TransformerImpl(Translet translet, Properties outputProperties,
-        int indentNumber, TransformerFactoryImpl tfactory)
+	int indentNumber, TransformerFactoryImpl tfactory) 
     {
-        _translet = (AbstractTranslet) translet;
-        _properties = createOutputProperties(outputProperties);
-        _propertiesClone = (Properties) _properties.clone();
-        _indentNumber = indentNumber;
-        _tfactory = tfactory;
-        //_isIncremental = tfactory._incremental;
+	_translet = (AbstractTranslet) translet;
+	_properties = createOutputProperties(outputProperties);
+	_propertiesClone = (Properties) _properties.clone();
+	_indentNumber = indentNumber;
+	_tfactory = tfactory;
+	//_isIncremental = tfactory._incremental;
     }
 
     /**
@@ -260,7 +260,7 @@
     public boolean isSecureProcessing() {
         return _isSecureProcessing;
     }
-
+    
     /**
      * Set the state of the secure processing feature.
      */
@@ -273,11 +273,11 @@
      * null if this is the identity transform.
      */
     protected AbstractTranslet getTranslet() {
-        return _translet;
+	return _translet;
     }
 
     public boolean isIdentity() {
-        return _isIdentity;
+	return _isIdentity;
     }
 
     /**
@@ -288,33 +288,33 @@
      * @throws TransformerException
      */
     public void transform(Source source, Result result)
-        throws TransformerException
+	throws TransformerException 
     {
-        if (!_isIdentity) {
-            if (_translet == null) {
-                ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_TRANSLET_ERR);
-                throw new TransformerException(err.toString());
-            }
-            // Pass output properties to the translet
-            transferOutputProperties(_translet);
-        }
+	if (!_isIdentity) {
+	    if (_translet == null) {
+		ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_TRANSLET_ERR);
+		throw new TransformerException(err.toString());
+	    }
+	    // Pass output properties to the translet
+	    transferOutputProperties(_translet);
+	}
+	    
+	final SerializationHandler toHandler = getOutputHandler(result);
+	if (toHandler == null) {
+	    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_HANDLER_ERR);
+	    throw new TransformerException(err.toString());
+	}
 
-        final SerializationHandler toHandler = getOutputHandler(result);
-        if (toHandler == null) {
-            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_HANDLER_ERR);
-            throw new TransformerException(err.toString());
-        }
+	if (_uriResolver != null && !_isIdentity) {
+	    _translet.setDOMCache(this);
+	}
 
-        if (_uriResolver != null && !_isIdentity) {
-            _translet.setDOMCache(this);
-        }
+	// Pass output properties to handler if identity
+	if (_isIdentity) {
+	    transferOutputProperties(toHandler);
+	}
 
-        // Pass output properties to handler if identity
-        if (_isIdentity) {
-            transferOutputProperties(toHandler);
-        }
-
-        transform(source, toHandler, _encoding);
+	transform(source, toHandler, _encoding);
         try{
             if (result instanceof DOMResult) {
                 ((DOMResult)result).setNode(_tohFactory.getNode());
@@ -334,102 +334,102 @@
     }
 
     /**
-     * Create an output handler for the transformation output based on
-     * the type and contents of the TrAX Result object passed to the
-     * transform() method.
+     * Create an output handler for the transformation output based on 
+     * the type and contents of the TrAX Result object passed to the 
+     * transform() method. 
      */
-    public SerializationHandler getOutputHandler(Result result)
-        throws TransformerException
+    public SerializationHandler getOutputHandler(Result result) 
+	throws TransformerException 
     {
-        // Get output method using get() to ignore defaults
-        _method = (String) _properties.get(OutputKeys.METHOD);
+	// Get output method using get() to ignore defaults 
+	_method = (String) _properties.get(OutputKeys.METHOD);
 
-        // Get encoding using getProperty() to use defaults
-        _encoding = (String) _properties.getProperty(OutputKeys.ENCODING);
+	// Get encoding using getProperty() to use defaults
+	_encoding = (String) _properties.getProperty(OutputKeys.ENCODING);
 
-        _tohFactory = TransletOutputHandlerFactory.newInstance();
-        _tohFactory.setEncoding(_encoding);
-        if (_method != null) {
-            _tohFactory.setOutputMethod(_method);
-        }
+	_tohFactory = TransletOutputHandlerFactory.newInstance();
+	_tohFactory.setEncoding(_encoding);
+	if (_method != null) {
+	    _tohFactory.setOutputMethod(_method);
+	}
 
-        // Set indentation number in the factory
-        if (_indentNumber >= 0) {
-            _tohFactory.setIndentNumber(_indentNumber);
-        }
+	// Set indentation number in the factory
+	if (_indentNumber >= 0) {
+	    _tohFactory.setIndentNumber(_indentNumber);
+	}
 
-        // Return the content handler for this Result object
-        try {
-            // Result object could be SAXResult, DOMResult, or StreamResult
-            if (result instanceof SAXResult) {
+	// Return the content handler for this Result object
+	try {
+	    // Result object could be SAXResult, DOMResult, or StreamResult 
+	    if (result instanceof SAXResult) {
                 final SAXResult target = (SAXResult)result;
                 final ContentHandler handler = target.getHandler();
 
-                _tohFactory.setHandler(handler);
+		_tohFactory.setHandler(handler);
 
                 /**
                  * Fix for bug 24414
                  * If the lexicalHandler is set then we need to get that
-                 * for obtaining the lexical information
+                 * for obtaining the lexical information 
                  */
                 LexicalHandler lexicalHandler = target.getLexicalHandler();
 
                 if (lexicalHandler != null ) {
-                    _tohFactory.setLexicalHandler(lexicalHandler);
-                }
+		    _tohFactory.setLexicalHandler(lexicalHandler);
+		}
 
-                _tohFactory.setOutputType(TransletOutputHandlerFactory.SAX);
-                return _tohFactory.getSerializationHandler();
+		_tohFactory.setOutputType(TransletOutputHandlerFactory.SAX);
+		return _tohFactory.getSerializationHandler();
             }
             else if (result instanceof StAXResult) {
-                if (((StAXResult) result).getXMLEventWriter() != null)
+                if (((StAXResult) result).getXMLEventWriter() != null) 
                     _tohFactory.setXMLEventWriter(((StAXResult) result).getXMLEventWriter());
-                else if (((StAXResult) result).getXMLStreamWriter() != null)
+                else if (((StAXResult) result).getXMLStreamWriter() != null) 
                     _tohFactory.setXMLStreamWriter(((StAXResult) result).getXMLStreamWriter());
                 _tohFactory.setOutputType(TransletOutputHandlerFactory.STAX);
                 return _tohFactory.getSerializationHandler();
             }
-            else if (result instanceof DOMResult) {
-                _tohFactory.setNode(((DOMResult) result).getNode());
-                _tohFactory.setNextSibling(((DOMResult) result).getNextSibling());
-                _tohFactory.setOutputType(TransletOutputHandlerFactory.DOM);
-                return _tohFactory.getSerializationHandler();
+	    else if (result instanceof DOMResult) {
+		_tohFactory.setNode(((DOMResult) result).getNode());
+		_tohFactory.setNextSibling(((DOMResult) result).getNextSibling());
+		_tohFactory.setOutputType(TransletOutputHandlerFactory.DOM);
+		return _tohFactory.getSerializationHandler();
             }
-            else if (result instanceof StreamResult) {
-                // Get StreamResult
-                final StreamResult target = (StreamResult) result;
+	    else if (result instanceof StreamResult) {
+		// Get StreamResult
+		final StreamResult target = (StreamResult) result;	
 
-                // StreamResult may have been created with a java.io.File,
-                // java.io.Writer, java.io.OutputStream or just a String
-                // systemId.
+		// StreamResult may have been created with a java.io.File,
+		// java.io.Writer, java.io.OutputStream or just a String
+		// systemId. 
 
-                _tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
+		_tohFactory.setOutputType(TransletOutputHandlerFactory.STREAM);
 
-                // try to get a Writer from Result object
-                final Writer writer = target.getWriter();
-                if (writer != null) {
-                    _tohFactory.setWriter(writer);
-                    return _tohFactory.getSerializationHandler();
-                }
+		// try to get a Writer from Result object
+		final Writer writer = target.getWriter();
+		if (writer != null) {
+		    _tohFactory.setWriter(writer);
+		    return _tohFactory.getSerializationHandler();
+		}
 
-                // or try to get an OutputStream from Result object
-                final OutputStream ostream = target.getOutputStream();
-                if (ostream != null) {
-                    _tohFactory.setOutputStream(ostream);
-                    return _tohFactory.getSerializationHandler();
-                }
+		// or try to get an OutputStream from Result object
+		final OutputStream ostream = target.getOutputStream();
+		if (ostream != null) {
+		    _tohFactory.setOutputStream(ostream);
+		    return _tohFactory.getSerializationHandler();
+		}
 
-                // or try to get just a systemId string from Result object
-                String systemId = result.getSystemId();
-                if (systemId == null) {
-                    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR);
+		// or try to get just a systemId string from Result object
+		String systemId = result.getSystemId();
+		if (systemId == null) {
+		    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_RESULT_ERR);
                     throw new TransformerException(err.toString());
-                }
+		}
 
-                // System Id may be in one of several forms, (1) a uri
-                // that starts with 'file:', (2) uri that starts with 'http:'
-                // or (3) just a filename on the local system.
-                URL url = null;
+		// System Id may be in one of several forms, (1) a uri
+		// that starts with 'file:', (2) uri that starts with 'http:'
+		// or (3) just a filename on the local system.
+		URL url = null;
                 if (systemId.startsWith("file:")) {
                     // if StreamResult(File) or setSystemID(File) was used,
                     // the systemId will be URI encoded as a result of File.toURI(),
@@ -443,15 +443,15 @@
                         String host = uri.getHost(); // decoded String
                         String path = uri.getPath(); //decoded String
                         if (path == null) {
-                         path = "";
+                         path = "";   
                         }
 
                         // if host (URI authority) then file:// + host + path
                         // else just path (may be absolute or relative)
                         if (host != null) {
-                         systemId += "//" + host + path;
+                         systemId += "//" + host + path;   
                         } else {
-                         systemId += "//" + path;
+                         systemId += "//" + path;   
                         }
                     }
                     catch(ClassNotFoundException e){
@@ -461,27 +461,26 @@
                     catch (Exception  exception) {
                         // URI exception which means nothing can be done so OK to ignore
                     }
-
+                        
                     url = new URL(systemId);
                     _ostream = new FileOutputStream(url.getFile());
-                    _tohFactory.setOutputStream(_ostream);
-                    return _tohFactory.getSerializationHandler();
+		    _tohFactory.setOutputStream(_ostream);
+		    return _tohFactory.getSerializationHandler();
                 }
                 else if (systemId.startsWith("http:")) {
                     url = new URL(systemId);
                     final URLConnection connection = url.openConnection();
-                    _tohFactory.setOutputStream(_ostream = connection.getOutputStream());
-                    return _tohFactory.getSerializationHandler();
+		    _tohFactory.setOutputStream(_ostream = connection.getOutputStream());
+		    return _tohFactory.getSerializationHandler();
                 }
                 else {
                     // system id is just a filename
-                    url = new File(systemId).toURL();
-                    _tohFactory.setOutputStream(
-                        _ostream = new FileOutputStream(url.getFile()));
-                    return _tohFactory.getSerializationHandler();
+		    _tohFactory.setOutputStream(
+		        _ostream = new FileOutputStream(new File(systemId)));
+		    return _tohFactory.getSerializationHandler();
                 }
-            }
-        }
+	    }
+	}
         // If we cannot write to the location specified by the SystemId
         catch (UnknownServiceException e) {
             throw new TransformerException(e);
@@ -493,14 +492,14 @@
         catch (IOException e) {
             throw new TransformerException(e);
         }
-        return null;
+	return null;
     }
 
     /**
      * Set the internal DOM that will be used for the next transformation
      */
     protected void setDOM(DOM dom) {
-        _dom = dom;
+	_dom = dom;
     }
 
     /**
@@ -517,7 +516,7 @@
                  } else {
                     wsfilter = null;
                  }
-
+            
                  boolean hasIdCall = (_translet != null) ? _translet.hasIdCall()
                                                          : false;
 
@@ -551,7 +550,7 @@
             throw new TransformerException(e);
         }
     }
-
+ 
     /**
      * Returns the {@link com.sun.org.apache.xalan.internal.xsltc.trax.TransformerFactoryImpl}
      * object that create this <code>Transformer</code>.
@@ -559,7 +558,7 @@
     protected TransformerFactoryImpl getTransformerFactory() {
         return _tfactory;
     }
-
+    
     /**
      * Returns the {@link com.sun.org.apache.xalan.internal.xsltc.runtime.output.TransletOutputHandlerFactory}
      * object that create the <code>TransletOutputHandler</code>.
@@ -569,7 +568,7 @@
     }
 
     private void transformIdentity(Source source, SerializationHandler handler)
-        throws Exception
+	throws Exception 
     {
         // Get systemId from source
         if (source != null) {
@@ -596,15 +595,15 @@
                 InputSource input;
                 if (streamInput != null) {
                     input = new InputSource(streamInput);
-                    input.setSystemId(_sourceSystemId);
-                }
+                    input.setSystemId(_sourceSystemId); 
+                } 
                 else if (streamReader != null) {
                     input = new InputSource(streamReader);
-                    input.setSystemId(_sourceSystemId);
-                }
+                    input.setSystemId(_sourceSystemId); 
+                } 
                 else if (_sourceSystemId != null) {
                     input = new InputSource(_sourceSystemId);
-                }
+                } 
                 else {
                     ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_NO_SOURCE_ERR);
                     throw new TransformerException(err.toString());
@@ -647,7 +646,7 @@
         } else if (source instanceof StAXSource) {
             final StAXSource staxSource = (StAXSource)source;
             StAXEvent2SAX staxevent2sax = null;
-            StAXStream2SAX staxStream2SAX = null;
+            StAXStream2SAX staxStream2SAX = null; 
             if (staxSource.getXMLEventReader() != null) {
                 final XMLEventReader xmlEventReader = staxSource.getXMLEventReader();
                 staxevent2sax = new StAXEvent2SAX(xmlEventReader);
@@ -676,29 +675,29 @@
     /**
      * Internal transformation method - uses the internal APIs of XSLTC
      */
-    private void transform(Source source, SerializationHandler handler,
-        String encoding) throws TransformerException
+    private void transform(Source source, SerializationHandler handler, 
+	String encoding) throws TransformerException 
     {
-        try {
+	try {
             /*
              * According to JAXP1.2, new SAXSource()/StreamSource()
-             * should create an empty input tree, with a default root node.
+             * should create an empty input tree, with a default root node. 
              * new DOMSource()creates an empty document using DocumentBuilder.
-             * newDocument(); Use DocumentBuilder.newDocument() for all 3
-             * situations, since there is no clear spec. how to create
+             * newDocument(); Use DocumentBuilder.newDocument() for all 3 
+             * situations, since there is no clear spec. how to create 
              * an empty tree when both SAXSource() and StreamSource() are used.
              */
-            if ((source instanceof StreamSource && source.getSystemId()==null
+            if ((source instanceof StreamSource && source.getSystemId()==null 
                 && ((StreamSource)source).getInputStream()==null &&
                 ((StreamSource)source).getReader()==null)||
                 (source instanceof SAXSource &&
                 ((SAXSource)source).getInputSource()==null &&
                 ((SAXSource)source).getXMLReader()==null )||
-                (source instanceof DOMSource &&
+                (source instanceof DOMSource && 
                 ((DOMSource)source).getNode()==null)){
-                        DocumentBuilderFactory builderF =
+                        DocumentBuilderFactory builderF = 
                                 DocumentBuilderFactory.newInstance();
-                        DocumentBuilder builder =
+                        DocumentBuilder builder = 
                                 builderF.newDocumentBuilder();
                         String systemID = source.getSystemId();
                         source = new DOMSource(builder.newDocument());
@@ -707,33 +706,33 @@
                         if (systemID != null) {
                           source.setSystemId(systemID);
                         }
-            }
-            if (_isIdentity) {
-                transformIdentity(source, handler);
-            } else {
-                _translet.transform(getDOM(source), handler);
-            }
-        } catch (TransletException e) {
-            if (_errorListener != null) postErrorToListener(e.getMessage());
-            throw new TransformerException(e);
-        } catch (RuntimeException e) {
-            if (_errorListener != null) postErrorToListener(e.getMessage());
-            throw new TransformerException(e);
-        } catch (Exception e) {
-            if (_errorListener != null) postErrorToListener(e.getMessage());
-            throw new TransformerException(e);
-        } finally {
+            }           
+	    if (_isIdentity) {
+		transformIdentity(source, handler);
+	    } else {
+		_translet.transform(getDOM(source), handler);
+	    }
+	} catch (TransletException e) {
+	    if (_errorListener != null)	postErrorToListener(e.getMessage());
+	    throw new TransformerException(e);
+	} catch (RuntimeException e) {
+	    if (_errorListener != null)	postErrorToListener(e.getMessage());
+	    throw new TransformerException(e);
+	} catch (Exception e) {
+	    if (_errorListener != null)	postErrorToListener(e.getMessage());
+	    throw new TransformerException(e);
+	} finally {
             _dtmManager = null;
         }
 
-        // If we create an output stream for the Result, we need to close it after the transformation.
-        if (_ostream != null) {
-            try {
-                _ostream.close();
-            }
-            catch (IOException e) {}
-            _ostream = null;
-        }
+	// If we create an output stream for the Result, we need to close it after the transformation.
+	if (_ostream != null) {
+	    try {
+	        _ostream.close();
+	    }
+	    catch (IOException e) {}
+	    _ostream = null;
+	}
     }
 
     /**
@@ -742,8 +741,8 @@
      *
      * @return The error event handler currently in effect
      */
-    public ErrorListener getErrorListener() {
-        return _errorListener;
+    public ErrorListener getErrorListener() {  
+	return _errorListener; 
     }
 
     /**
@@ -756,17 +755,17 @@
      * @throws IllegalArgumentException
      */
     public void setErrorListener(ErrorListener listener)
-        throws IllegalArgumentException {
+	throws IllegalArgumentException {
         if (listener == null) {
-            ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
-                                        "Transformer");
+	    ErrorMsg err = new ErrorMsg(ErrorMsg.ERROR_LISTENER_NULL_ERR,
+					"Transformer");
             throw new IllegalArgumentException(err.toString());
-        }
+	}
         _errorListener = listener;
-
-        // Register a message handler to report xsl:messages
+        
+	// Register a message handler to report xsl:messages
     if (_translet != null)
-        _translet.setMessageHandler(new MessageHandler(_errorListener));
+    	_translet.setMessageHandler(new MessageHandler(_errorListener));
     }
 
     /**
@@ -775,8 +774,8 @@
     private void postErrorToListener(String message) {
         try {
             _errorListener.error(new TransformerException(message));
-        }
-        catch (TransformerException e) {
+	}
+	catch (TransformerException e) {
             // ignored - transformation cannot be continued
         }
     }
@@ -788,7 +787,7 @@
         try {
             _errorListener.warning(new TransformerException(message));
         }
-        catch (TransformerException e) {
+	catch (TransformerException e) {
             // ignored - transformation cannot be continued
         }
     }
@@ -799,23 +798,23 @@
      * list of elements given in the <xsl:output> element.
      */
     private String makeCDATAString(Hashtable cdata) {
-        // Return a 'null' string if no CDATA section elements were specified
-        if (cdata == null) return null;
+	// Return a 'null' string if no CDATA section elements were specified
+	if (cdata == null) return null;
 
-        StringBuffer result = new StringBuffer();
+	StringBuffer result = new StringBuffer();
 
-        // Get an enumeration of all the elements in the hashtable
-        Enumeration elements = cdata.keys();
-        if (elements.hasMoreElements()) {
-            result.append((String)elements.nextElement());
-            while (elements.hasMoreElements()) {
-                String element = (String)elements.nextElement();
-                result.append(' ');
-                result.append(element);
-            }
-        }
-
-        return(result.toString());
+	// Get an enumeration of all the elements in the hashtable
+	Enumeration elements = cdata.keys();
+	if (elements.hasMoreElements()) {
+	    result.append((String)elements.nextElement());
+	    while (elements.hasMoreElements()) {
+		String element = (String)elements.nextElement();
+		result.append(' ');
+		result.append(element);
+	    }
+	}
+	
+	return(result.toString());
     }
 
     /**
@@ -829,8 +828,8 @@
      *
      * @return Properties in effect for this Transformer
      */
-    public Properties getOutputProperties() {
-        return (Properties) _properties.clone();
+    public Properties getOutputProperties() { 
+	return (Properties) _properties.clone();
     }
 
     /**
@@ -843,13 +842,13 @@
      * @throws IllegalArgumentException if the property name is not known
      */
     public String getOutputProperty(String name)
-        throws IllegalArgumentException
+	throws IllegalArgumentException 
     {
-        if (!validOutputProperty(name)) {
-            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
-            throw new IllegalArgumentException(err.toString());
-        }
-        return _properties.getProperty(name);
+	if (!validOutputProperty(name)) {
+	    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
+	    throw new IllegalArgumentException(err.toString());
+	}
+	return _properties.getProperty(name);
     }
 
     /**
@@ -861,36 +860,36 @@
      * @param properties The properties to use for the Transformer
      * @throws IllegalArgumentException Never, errors are ignored
      */
-    public void setOutputProperties(Properties properties)
-        throws IllegalArgumentException
+    public void setOutputProperties(Properties properties) 
+	throws IllegalArgumentException 
     {
-        if (properties != null) {
-            final Enumeration names = properties.propertyNames();
+	if (properties != null) {
+	    final Enumeration names = properties.propertyNames();
 
-            while (names.hasMoreElements()) {
-                final String name = (String) names.nextElement();
+	    while (names.hasMoreElements()) {
+		final String name = (String) names.nextElement();
 
-                // Ignore lower layer properties
-                if (isDefaultProperty(name, properties)) continue;
+		// Ignore lower layer properties
+		if (isDefaultProperty(name, properties)) continue;
 
-                if (validOutputProperty(name)) {
-                    _properties.setProperty(name, properties.getProperty(name));
-                }
-                else {
-                    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
-                    throw new IllegalArgumentException(err.toString());
-                }
-            }
-        }
-        else {
-            _properties = _propertiesClone;
-        }
+		if (validOutputProperty(name)) {
+		    _properties.setProperty(name, properties.getProperty(name));
+		}
+		else {
+		    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
+		    throw new IllegalArgumentException(err.toString());
+		}
+	    }
+	}
+	else {
+	    _properties = _propertiesClone;
+	}
     }
 
     /**
      * Implements JAXP's Transformer.setOutputProperty().
      * Get an output property that is in effect for the transformation. The
-     * property specified may be a property that was set with
+     * property specified may be a property that was set with 
      * setOutputProperty(), or it may be a property specified in the stylesheet.
      *
      * @param name The name of the property to set
@@ -898,13 +897,13 @@
      * @throws IllegalArgumentException Never, errors are ignored
      */
     public void setOutputProperty(String name, String value)
-        throws IllegalArgumentException
+	throws IllegalArgumentException 
     {
-        if (!validOutputProperty(name)) {
-            ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
-            throw new IllegalArgumentException(err.toString());
-        }
-        _properties.setProperty(name, value);
+	if (!validOutputProperty(name)) {
+	    ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_UNKNOWN_PROP_ERR, name);
+	    throw new IllegalArgumentException(err.toString());
+	}
+	_properties.setProperty(name, value);
     }
 
     /**
@@ -913,49 +912,49 @@
      */
     private void transferOutputProperties(AbstractTranslet translet)
     {
-        // Return right now if no properties are set
-        if (_properties == null) return;
+	// Return right now if no properties are set
+	if (_properties == null) return;
 
-        // Get a list of all the defined properties
-        Enumeration names = _properties.propertyNames();
-        while (names.hasMoreElements()) {
-            // Note the use of get() instead of getProperty()
-            String name  = (String) names.nextElement();
-            String value = (String) _properties.get(name);
+	// Get a list of all the defined properties
+	Enumeration names = _properties.propertyNames();
+	while (names.hasMoreElements()) {
+	    // Note the use of get() instead of getProperty()
+	    String name  = (String) names.nextElement();
+	    String value = (String) _properties.get(name);
 
-            // Ignore default properties
-            if (value == null) continue;
+	    // Ignore default properties
+	    if (value == null) continue;
 
-            // Pass property value to translet - override previous setting
-            if (name.equals(OutputKeys.ENCODING)) {
-                translet._encoding = value;
-            }
-            else if (name.equals(OutputKeys.METHOD)) {
-                translet._method = value;
-            }
-            else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
-                translet._doctypePublic = value;
-            }
-            else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
-                translet._doctypeSystem = value;
-            }
-            else if (name.equals(OutputKeys.MEDIA_TYPE)) {
-                translet._mediaType = value;
-            }
-            else if (name.equals(OutputKeys.STANDALONE)) {
-                translet._standalone = value;
-            }
-            else if (name.equals(OutputKeys.VERSION)) {
-                translet._version = value;
-            }
-            else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
-                translet._omitHeader =
-                    (value != null && value.toLowerCase().equals("yes"));
-            }
-            else if (name.equals(OutputKeys.INDENT)) {
-                translet._indent =
-                    (value != null && value.toLowerCase().equals("yes"));
-            }
+	    // Pass property value to translet - override previous setting
+	    if (name.equals(OutputKeys.ENCODING)) {
+		translet._encoding = value;
+	    }
+	    else if (name.equals(OutputKeys.METHOD)) {
+		translet._method = value;
+	    }
+	    else if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
+		translet._doctypePublic = value;
+	    }
+	    else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
+		translet._doctypeSystem = value;
+	    }
+	    else if (name.equals(OutputKeys.MEDIA_TYPE)) {
+		translet._mediaType = value;
+	    }
+	    else if (name.equals(OutputKeys.STANDALONE)) {
+		translet._standalone = value;
+	    }
+	    else if (name.equals(OutputKeys.VERSION)) {
+		translet._version = value;
+	    }
+	    else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
+		translet._omitHeader = 
+		    (value != null && value.toLowerCase().equals("yes"));
+	    }
+	    else if (name.equals(OutputKeys.INDENT)) {
+		translet._indent = 
+		    (value != null && value.toLowerCase().equals("yes"));
+	    }
             else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
                  if (value != null) {
                      translet._indentamount = Integer.parseInt(value);
@@ -966,16 +965,16 @@
                      translet._indentamount = Integer.parseInt(value);
                  }
             }
-            else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
-                if (value != null) {
-                    translet._cdata = null; // clear previous setting
-                    StringTokenizer e = new StringTokenizer(value);
-                    while (e.hasMoreTokens()) {
-                        translet.addCdataElement(e.nextToken());
-                    }
-                }
-            }
-        }
+	    else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
+		if (value != null) {
+		    translet._cdata = null; // clear previous setting
+		    StringTokenizer e = new StringTokenizer(value);
+		    while (e.hasMoreTokens()) {
+			translet.addCdataElement(e.nextToken());
+		    }
+		}
+	    }
+	}
     }
 
     /**
@@ -984,46 +983,46 @@
      */
     public void transferOutputProperties(SerializationHandler handler)
     {
-        // Return right now if no properties are set
-        if (_properties == null) return;
+	// Return right now if no properties are set
+	if (_properties == null) return;
 
-        String doctypePublic = null;
-        String doctypeSystem = null;
+	String doctypePublic = null;
+	String doctypeSystem = null;
 
-        // Get a list of all the defined properties
-        Enumeration names = _properties.propertyNames();
-        while (names.hasMoreElements()) {
-            // Note the use of get() instead of getProperty()
-            String name  = (String) names.nextElement();
-            String value = (String) _properties.get(name);
+	// Get a list of all the defined properties
+	Enumeration names = _properties.propertyNames();
+	while (names.hasMoreElements()) {
+	    // Note the use of get() instead of getProperty()
+	    String name  = (String) names.nextElement();
+	    String value = (String) _properties.get(name);
 
-            // Ignore default properties
-            if (value == null) continue;
+	    // Ignore default properties
+	    if (value == null) continue;
 
-            // Pass property value to translet - override previous setting
-            if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
-                doctypePublic = value;
-            }
-            else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
-                doctypeSystem = value;
-            }
-            else if (name.equals(OutputKeys.MEDIA_TYPE)) {
-                handler.setMediaType(value);
-            }
-            else if (name.equals(OutputKeys.STANDALONE)) {
-                handler.setStandalone(value);
-            }
-            else if (name.equals(OutputKeys.VERSION)) {
-                handler.setVersion(value);
-            }
-            else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
-                handler.setOmitXMLDeclaration(
-                    value != null && value.toLowerCase().equals("yes"));
-            }
-            else if (name.equals(OutputKeys.INDENT)) {
-                handler.setIndent(
-                    value != null && value.toLowerCase().equals("yes"));
-            }
+	    // Pass property value to translet - override previous setting
+	    if (name.equals(OutputKeys.DOCTYPE_PUBLIC)) {
+		doctypePublic = value;
+	    }
+	    else if (name.equals(OutputKeys.DOCTYPE_SYSTEM)) {
+		doctypeSystem = value;
+	    }
+	    else if (name.equals(OutputKeys.MEDIA_TYPE)) {
+		handler.setMediaType(value);
+	    }
+	    else if (name.equals(OutputKeys.STANDALONE)) {
+		handler.setStandalone(value);
+	    }
+	    else if (name.equals(OutputKeys.VERSION)) {
+		handler.setVersion(value);
+	    }
+	    else if (name.equals(OutputKeys.OMIT_XML_DECLARATION)) {
+		handler.setOmitXMLDeclaration(
+		    value != null && value.toLowerCase().equals("yes"));
+	    }
+	    else if (name.equals(OutputKeys.INDENT)) {
+		handler.setIndent( 
+		    value != null && value.toLowerCase().equals("yes"));
+	    }
             else if (name.equals(OutputPropertiesFactory.S_BUILTIN_OLD_EXTENSIONS_UNIVERSAL +"indent-amount")) {
                 if (value != null) {
                     handler.setIndentAmount(Integer.parseInt(value));
@@ -1033,13 +1032,13 @@
                 if (value != null) {
                     handler.setIndentAmount(Integer.parseInt(value));
                 }
-            }
-            else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
-                if (value != null) {
-                    StringTokenizer e = new StringTokenizer(value);
+            } 
+	    else if (name.equals(OutputKeys.CDATA_SECTION_ELEMENTS)) {
+		if (value != null) {
+		    StringTokenizer e = new StringTokenizer(value);
                     Vector uriAndLocalNames = null;
-                    while (e.hasMoreTokens()) {
-                        final String token = e.nextToken();
+		    while (e.hasMoreTokens()) {
+			final String token = e.nextToken();
 
                         // look for the last colon, as the String may be
                         // something like "http://abc.com:local"
@@ -1064,14 +1063,14 @@
                         uriAndLocalNames.addElement(localName);
                     }
                     handler.setCdataSectionElements(uriAndLocalNames);
-                }
-            }
-        }
+		}
+	    }
+	}
 
-        // Call setDoctype() if needed
-        if (doctypePublic != null || doctypeSystem != null) {
-            handler.setDoctype(doctypeSystem, doctypePublic);
-        }
+	// Call setDoctype() if needed
+	if (doctypePublic != null || doctypeSystem != null) {
+	    handler.setDoctype(doctypeSystem, doctypePublic);
+	}
     }
 
     /**
@@ -1081,80 +1080,80 @@
      * the user using this API.
      */
     private Properties createOutputProperties(Properties outputProperties) {
-        final Properties defaults = new Properties();
-        setDefaults(defaults, "xml");
+	final Properties defaults = new Properties();
+	setDefaults(defaults, "xml");
 
-        // Copy propeties set in stylesheet to base
-        final Properties base = new Properties(defaults);
-        if (outputProperties != null) {
-            final Enumeration names = outputProperties.propertyNames();
-            while (names.hasMoreElements()) {
-                final String name = (String) names.nextElement();
-                base.setProperty(name, outputProperties.getProperty(name));
-            }
-        }
-        else {
-            base.setProperty(OutputKeys.ENCODING, _translet._encoding);
-            if (_translet._method != null)
-                base.setProperty(OutputKeys.METHOD, _translet._method);
-        }
+	// Copy propeties set in stylesheet to base
+	final Properties base = new Properties(defaults);
+	if (outputProperties != null) {
+	    final Enumeration names = outputProperties.propertyNames();
+	    while (names.hasMoreElements()) {
+		final String name = (String) names.nextElement();
+		base.setProperty(name, outputProperties.getProperty(name));
+	    }
+	}
+	else {
+	    base.setProperty(OutputKeys.ENCODING, _translet._encoding);
+	    if (_translet._method != null)
+	        base.setProperty(OutputKeys.METHOD, _translet._method);
+	}
 
-        // Update defaults based on output method
-        final String method = base.getProperty(OutputKeys.METHOD);
-        if (method != null) {
-            if (method.equals("html")) {
-                setDefaults(defaults,"html");
-            }
-            else if (method.equals("text")) {
-                setDefaults(defaults,"text");
-            }
-        }
+	// Update defaults based on output method
+	final String method = base.getProperty(OutputKeys.METHOD);
+	if (method != null) {
+	    if (method.equals("html")) {
+	        setDefaults(defaults,"html");
+	    }
+	    else if (method.equals("text")) {
+	        setDefaults(defaults,"text");
+	    }
+	}
 
-        return base;
+	return base; 
     }
 
-        /**
-         * Internal method to get the default properties from the
-         * serializer factory and set them on the property object.
-         * @param props a java.util.Property object on which the properties are set.
-         * @param method The output method type, one of "xml", "text", "html" ...
-         */
-        private void setDefaults(Properties props, String method)
-        {
-                final Properties method_props =
-                        OutputPropertiesFactory.getDefaultMethodProperties(method);
-                {
-                        final Enumeration names = method_props.propertyNames();
-                        while (names.hasMoreElements())
-                        {
-                                final String name = (String)names.nextElement();
-                                props.setProperty(name, method_props.getProperty(name));
-                        }
-                }
-        }
+	/**
+	 * Internal method to get the default properties from the
+	 * serializer factory and set them on the property object.
+	 * @param props a java.util.Property object on which the properties are set.
+	 * @param method The output method type, one of "xml", "text", "html" ...
+	 */
+	private void setDefaults(Properties props, String method)
+	{
+		final Properties method_props =
+			OutputPropertiesFactory.getDefaultMethodProperties(method);
+		{
+			final Enumeration names = method_props.propertyNames();
+			while (names.hasMoreElements())
+			{
+				final String name = (String)names.nextElement();
+				props.setProperty(name, method_props.getProperty(name));
+			}
+		}
+	}
     /**
      * Verifies if a given output property name is a property defined in
      * the JAXP 1.1 / TrAX spec
      */
     private boolean validOutputProperty(String name) {
-        return (name.equals(OutputKeys.ENCODING) ||
-                name.equals(OutputKeys.METHOD) ||
-                name.equals(OutputKeys.INDENT) ||
-                name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
-                name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
-                name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
-                name.equals(OutputKeys.MEDIA_TYPE) ||
-                name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
-                name.equals(OutputKeys.STANDALONE) ||
-                name.equals(OutputKeys.VERSION) ||
-                name.charAt(0) == '{');
+	return (name.equals(OutputKeys.ENCODING) ||
+		name.equals(OutputKeys.METHOD) ||
+		name.equals(OutputKeys.INDENT) ||
+		name.equals(OutputKeys.DOCTYPE_PUBLIC) ||
+		name.equals(OutputKeys.DOCTYPE_SYSTEM) ||
+		name.equals(OutputKeys.CDATA_SECTION_ELEMENTS) ||
+		name.equals(OutputKeys.MEDIA_TYPE) ||
+		name.equals(OutputKeys.OMIT_XML_DECLARATION)   ||
+		name.equals(OutputKeys.STANDALONE) ||
+		name.equals(OutputKeys.VERSION) ||
+		name.charAt(0) == '{');
     }
 
     /**
      * Checks if a given output property is default (2nd layer only)
      */
     private boolean isDefaultProperty(String name, Properties properties) {
-        return (properties.get(name) == null);
+	return (properties.get(name) == null);
     }
 
     /**
@@ -1167,21 +1166,21 @@
      * @param value The value to assign to the parameter
      */
     public void setParameter(String name, Object value) {
-
+        
         if (value == null) {
             ErrorMsg err = new ErrorMsg(ErrorMsg.JAXP_INVALID_SET_PARAM_VALUE, name);
             throw new IllegalArgumentException(err.toString());
         }
-
-        if (_isIdentity) {
-            if (_parameters == null) {
-                _parameters = new Hashtable();
-            }
-            _parameters.put(name, value);
-        }
-        else {
-            _translet.addParameter(name, value);
-        }
+             
+	if (_isIdentity) {
+	    if (_parameters == null) {
+		_parameters = new Hashtable();
+	    }
+	    _parameters.put(name, value);
+	}
+	else {
+	    _translet.addParameter(name, value);
+	}
     }
 
     /**
@@ -1189,13 +1188,13 @@
      * Clear all parameters set with setParameter. Clears the translet's
      * parameter stack.
      */
-    public void clearParameters() {
-        if (_isIdentity && _parameters != null) {
-            _parameters.clear();
-        }
-        else {
-            _translet.clearParameters();
-        }
+    public void clearParameters() {  
+	if (_isIdentity && _parameters != null) {
+	    _parameters.clear();
+	}
+	else {
+	    _translet.clearParameters();
+	}
     }
 
     /**
@@ -1207,12 +1206,12 @@
      * @return An object that contains the value assigned to the parameter
      */
     public final Object getParameter(String name) {
-        if (_isIdentity) {
-            return (_parameters != null) ? _parameters.get(name) : null;
-        }
-        else {
-            return _translet.getParameter(name);
-        }
+	if (_isIdentity) {
+	    return (_parameters != null) ? _parameters.get(name) : null;
+	}
+	else {
+	    return _translet.getParameter(name);
+	}
     }
 
     /**
@@ -1222,7 +1221,7 @@
      * @return  The URLResolver object currently in use
      */
     public URIResolver getURIResolver() {
-        return _uriResolver;
+	return _uriResolver;
     }
 
     /**
@@ -1231,8 +1230,8 @@
      *
      * @param resolver The URIResolver to use in document()
      */
-    public void setURIResolver(URIResolver resolver) {
-        _uriResolver = resolver;
+    public void setURIResolver(URIResolver resolver) { 
+	_uriResolver = resolver;
     }
 
     /**
@@ -1250,16 +1249,16 @@
      * @param translet A reference to the translet requesting the document
      */
     public DOM retrieveDocument(String baseURI, String href, Translet translet) {
-        try {
+	try {        
             // Argument to document function was: document('');
             if (href.length() == 0) {
                 href = new String(baseURI);
-            }
+            }    
 
             /*
              *  Fix for bug 24188
              *  Incase the _uriResolver.resolve(href,base) is null
-             *  try to still  retrieve the document before returning null
+             *  try to still  retrieve the document before returning null 
              *  and throwing the FileNotFoundException in
              *  com.sun.org.apache.xalan.internal.xsltc.dom.LoadDocument
              *
@@ -1269,30 +1268,30 @@
                 StreamSource streamSource = new StreamSource(
                      SystemIDResolver.getAbsoluteURI(href, baseURI));
                 return getDOM(streamSource) ;
-            }
+            } 
 
             return getDOM(resolvedSource);
-        }
-        catch (TransformerException e) {
-            if (_errorListener != null)
-                postErrorToListener("File not found: " + e.getMessage());
-            return(null);
-        }
+	}
+	catch (TransformerException e) {
+	    if (_errorListener != null)
+		postErrorToListener("File not found: " + e.getMessage());
+	    return(null);
+	}
     }
 
     /**
-     * Receive notification of a recoverable error.
+     * Receive notification of a recoverable error. 
      * The transformer must continue to provide normal parsing events after
      * invoking this method. It should still be possible for the application
      * to process the document through to the end.
      *
-     * @param e The warning information encapsulated in a transformer
+     * @param e The warning information encapsulated in a transformer 
      * exception.
      * @throws TransformerException if the application chooses to discontinue
      * the transformation (always does in our case).
      */
     public void error(TransformerException e)
-        throws TransformerException
+	throws TransformerException 
     {
         Throwable wrapped = e.getException();
         if (wrapped != null) {
@@ -1307,7 +1306,7 @@
     }
 
     /**
-     * Receive notification of a non-recoverable error.
+     * Receive notification of a non-recoverable error. 
      * The application must assume that the transformation cannot continue
      * after the Transformer has invoked this method, and should continue
      * (if at all) only to collect addition error messages. In fact,
@@ -1320,7 +1319,7 @@
      * the transformation (always does in our case).
      */
     public void fatalError(TransformerException e)
-        throws TransformerException
+	throws TransformerException 
     {
         Throwable wrapped = e.getException();
         if (wrapped != null) {
@@ -1348,7 +1347,7 @@
      * the transformation (never does in our case).
      */
     public void warning(TransformerException e)
-        throws TransformerException
+	throws TransformerException 
     {
         Throwable wrapped = e.getException();
         if (wrapped != null) {
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/AttrImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/AttrImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -104,11 +104,12 @@
  *
  * @xerces.internal
  *
- * @see AttrNSImpl
+ * @see AttrNSImpl 
  *
  * @author Arnaud  Le Hors, IBM
  * @author Joe Kesselman, IBM
- * @author Andy Clark, IBM
+ * @author Andy Clark, IBM 
+ * @version $Id: AttrImpl.java,v 1.5 2008/06/10 00:59:32 joehw Exp $
  * @since PR-DOM-Level-1-19980818.
  *
  */
@@ -122,7 +123,7 @@
 
     /** Serialization version. */
     static final long serialVersionUID = 7277707688218972102L;
-
+    
     /** DTD namespace. **/
     static final String DTD_URI = "http://www.w3.org/TR/REC-xml";
 
@@ -135,12 +136,12 @@
 
     /** Attribute name. */
     protected String name;
-
+    
     /** Type information */
     // REVISIT: we are losing the type information in DOM during serialization
     transient Object type;
 
-    protected static TextImpl textNode = null;
+    protected TextImpl textNode = null;
 
     //
     // Constructors
@@ -151,7 +152,7 @@
      * method in the Document class.
      */
     protected AttrImpl(CoreDocumentImpl ownerDocument, String name) {
-        super(ownerDocument);
+    	super(ownerDocument);
         this.name = name;
         /** False for default attributes. */
         isSpecified(true);
@@ -207,7 +208,7 @@
 
     /**
      * NON-DOM: set the type of this attribute to be ID type.
-     *
+     * 
      * @param id
      */
     public void setIdAttribute(boolean id){
@@ -227,7 +228,7 @@
     //
     // Node methods
     //
-
+    
     public Node cloneNode(boolean deep) {
 
         if (needsSyncChildren()) {
@@ -236,13 +237,13 @@
         AttrImpl clone = (AttrImpl) super.cloneNode(deep);
 
         // take care of case where there are kids
-        if (!clone.hasStringValue()) {
+    	if (!clone.hasStringValue()) {
 
             // Need to break the association w/ original kids
             clone.value = null;
 
-            // Cloning an Attribute always clones its children,
-            // since they represent its value, no matter whether this
+            // Cloning an Attribute always clones its children, 
+            // since they represent its value, no matter whether this 
             // is a deep clone or not
             for (Node child = (Node) value; child != null;
                  child = child.getNextSibling()) {
@@ -278,9 +279,9 @@
      * true.... even if that value equals the default.
      */
     public void setNodeValue(String value) throws DOMException {
-        setValue(value);
+    	setValue(value);
     }
-
+    
     /**
      * @see org.w3c.dom.TypeInfo#getTypeName()
      */
@@ -297,7 +298,7 @@
         }
         return null;
     }
-
+    
     /**
      * Method getSchemaTypeInfo.
      * @return TypeInfo
@@ -313,7 +314,7 @@
      * @see #getValue()
      */
     public String getNodeValue() {
-        return getValue();
+    	return getValue();
     }
 
     //
@@ -329,7 +330,7 @@
         if (needsSyncData()) {
             synchronizeData();
         }
-        return name;
+    	return name;
 
     } // getName():String
 
@@ -341,12 +342,12 @@
     public void setValue(String newvalue) {
 
         CoreDocumentImpl ownerDocument = ownerDocument();
-
+        
         if (ownerDocument.errorChecking && isReadOnly()) {
             String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null);
             throw new DOMException(DOMException.NO_MODIFICATION_ALLOWED_ERR, msg);
         }
-
+        
         Element ownerElement = getOwnerElement();
         String oldvalue = "";
         if (needsSyncData()) {
@@ -412,7 +413,7 @@
         // capture/bubble listeners on the Attr.
         // Note that aggregate events are NOT dispatched here,
         // since we need to combine the remove and insert.
-        isSpecified(true);
+    	isSpecified(true);
         if (ownerDocument.getMutationEvents()) {
             // if there are any event handlers create a real node
             internalInsertBefore(ownerDocument.createTextNode(newvalue),
@@ -450,7 +451,7 @@
         if (hasStringValue()) {
             return (String) value;
         }
-
+        
         ChildNode firstChild = ((ChildNode) value);
 
         String data = null;
@@ -460,13 +461,13 @@
         else {
                 data =  firstChild.getNodeValue();
         }
-
+        
         ChildNode node = firstChild.nextSibling;
-
+        
         if (node == null || data == null)  return (data == null)?"":data;
-
+        
         StringBuffer value = new StringBuffer(data);
-        while (node != null) {
+    	while (node != null) {
             if (node.getNodeType()  == Node.ENTITY_REFERENCE_NODE){
                 data = ((EntityReferenceImpl)node).getEntityRefValue();
                 if (data == null) return "";
@@ -476,12 +477,12 @@
                 value.append(node.getNodeValue());
             }
             node = node.nextSibling;
-        }
-        return value.toString();
+    	}
+    	return value.toString();
 
     } // getValue():String
-
-
+    
+    
     /**
      * The "specified" flag is true if and only if this attribute's
      * value was explicitly specified in the original document. Note that
@@ -498,7 +499,7 @@
         if (needsSyncData()) {
             synchronizeData();
         }
-        return isSpecified();
+    	return isSpecified();
 
     } // getSpecified():boolean
 
@@ -532,7 +533,7 @@
         // our ownerDocument and we don't have an ownerElement
         return (Element) (isOwned() ? ownerNode : null);
     }
-
+    
     public void normalize() {
 
         // No need to normalize if already normalized or
@@ -582,14 +583,14 @@
         if (needsSyncData()) {
             synchronizeData();
         }
-        isSpecified(arg);
+    	isSpecified(arg);
 
     } // setSpecified(boolean)
-
-        /**
-         * NON-DOM: used by the parser
-         * @param type
-         */
+    
+	/**
+	 * NON-DOM: used by the parser
+	 * @param type
+	 */
     public void setType (Object type){
         this.type = type;
     }
@@ -600,7 +601,7 @@
 
     /** NON-DOM method for debugging convenience */
     public String toString() {
-        return getName() + "=" + "\"" + getValue() + "\"";
+    	return getName() + "=" + "\"" + getValue() + "\"";
     }
 
     /**
@@ -628,7 +629,7 @@
      * differently.
      */
     public NodeList getChildNodes() {
-        // JKESS: KNOWN ISSUE HERE
+        // JKESS: KNOWN ISSUE HERE 
 
         if (needsSyncChildren()) {
             synchronizeChildren();
@@ -644,7 +645,7 @@
             synchronizeChildren();
         }
         makeChildNode();
-        return (Node) value;
+    	return (Node) value;
 
     }   // getFirstChild():Node
 
@@ -699,18 +700,18 @@
      * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is
      * read-only.
      */
-    public Node insertBefore(Node newChild, Node refChild)
+    public Node insertBefore(Node newChild, Node refChild) 
         throws DOMException {
         // Tail-call; optimizer should be able to do good things with.
         return internalInsertBefore(newChild, refChild, false);
     } // insertBefore(Node,Node):Node
-
+     
     /** NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able
      * to control which mutation events are spawned. This version of the
      * insertBefore operation allows us to do so. It is not intended
      * for use by application programs.
      */
-    Node internalInsertBefore(Node newChild, Node refChild, boolean replace)
+    Node internalInsertBefore(Node newChild, Node refChild, boolean replace) 
         throws DOMException {
 
         CoreDocumentImpl ownerDocument = ownerDocument();
@@ -878,17 +879,17 @@
      * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is
      * read-only.
      */
-    public Node removeChild(Node oldChild)
+    public Node removeChild(Node oldChild) 
         throws DOMException {
         // Tail-call, should be optimizable
         if (hasStringValue()) {
             // we don't have any child per say so it can't be one of them!
             String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null);
-            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);
+            throw new DOMException(DOMException.NOT_FOUND_ERR, msg);            
         }
         return internalRemoveChild(oldChild, false);
     } // removeChild(Node) :Node
-
+     
     /** NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able
      * to control which mutation events are spawned. This version of the
      * removeChild operation allows us to do so. It is not intended
@@ -987,8 +988,8 @@
         makeChildNode();
 
         // If Mutation Events are being generated, this operation might
-        // throw aggregate events twice when modifying an Attr -- once
-        // on insertion and once on removal. DOM Level 2 does not specify
+        // throw aggregate events twice when modifying an Attr -- once 
+        // on insertion and once on removal. DOM Level 2 does not specify 
         // this as either desirable or undesirable, but hints that
         // aggregations should be issued only once per user request.
 
@@ -1052,7 +1053,7 @@
         ChildNode node = (ChildNode) value;
         for (int i = 0; i < index && node != null; i++) {
             node = node.nextSibling;
-        }
+        } 
         return node;
 
     } // item(int):Node
@@ -1074,24 +1075,24 @@
      * Introduced in DOM Level 3. <p>
      * Checks if a type is derived from another by restriction. See:
      * http://www.w3.org/TR/DOM-Level-3-Core/core.html#TypeInfo-isDerivedFrom
-     *
-     * @param ancestorNS
+     * 
+     * @param ancestorNS 
      *        The namspace of the ancestor type declaration
      * @param ancestorName
      *        The name of the ancestor type declaration
      * @param type
      *        The reference type definition
-     *
+     * 
      * @return boolean True if the type is derived by restriciton for the
      *         reference type
      */
-    public boolean isDerivedFrom(String typeNamespaceArg,
-                                 String typeNameArg,
+    public boolean isDerivedFrom(String typeNamespaceArg, 
+                                 String typeNameArg, 
                                  int derivationMethod) {
-
+                                 	
         return false;
     }
-
+        
 
     //
     // Public methods
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/CoreDocumentImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -24,6 +24,7 @@
 import java.util.Enumeration;
 import java.util.Hashtable;
 import com.sun.org.apache.xerces.internal.util.URI;
+import com.sun.org.apache.xerces.internal.impl.Constants;
 
 import org.w3c.dom.DOMConfiguration;
 import org.w3c.dom.UserDataHandler;
@@ -69,13 +70,14 @@
  * <p>
  * <b>Note:</b> When any node in the document is serialized, the
  * entire document is serialized along with it.
- *
- * @xerces.internal
+ * 
+ * @xerces.internal 
  *
  * @author Arnaud  Le Hors, IBM
  * @author Joe Kesselman, IBM
  * @author Andy Clark, IBM
  * @author Ralf Pfeiffer, IBM
+ * @version $Id: CoreDocumentImpl.java,v 1.7 2009/08/04 05:07:20 joehw Exp $
  * @since  PR-DOM-Level-1-19980818.
  */
 
@@ -83,12 +85,12 @@
 public class CoreDocumentImpl
 extends ParentNode implements Document  {
 
-        /**TODO::
-         * 1. Change XML11Char method names similar to XMLChar. That will prevent lot
-         * of dirty version checking code.
-         *
-         * 2. IMO during cloneNode qname/isXMLName check should not be made.
-         */
+	/**TODO::
+	 * 1. Change XML11Char method names similar to XMLChar. That will prevent lot
+	 * of dirty version checking code.
+	 *
+	 * 2. IMO during cloneNode qname/isXMLName check should not be made.
+	 */
     //
     // Constants
     //
@@ -126,7 +128,7 @@
     /**Experimental DOM Level 3 feature: documentURI */
     protected String fDocumentURI;
 
-        //Revisit :: change to a better data structure.
+	//Revisit :: change to a better data structure.
     /** Table for user data attached to this document nodes. */
     protected Hashtable userData;
 
@@ -137,8 +139,8 @@
     // DOM Level 3: normalizeDocument
     transient DOMNormalizer domNormalizer = null;
     transient DOMConfigurationImpl fConfiguration = null;
-
-    // support of XPath API
+    
+    // support of XPath API   
     transient Object fXPathEvaluator = null;
 
     /** Table for quick check of child insertion. */
@@ -187,7 +189,9 @@
 
     /** Bypass error checking. */
     protected boolean errorChecking = true;
-
+    /** Ancestor checking */
+    protected boolean ancestorChecking = true;
+    
     //Did version change at any point when the document was created ?
     //this field helps us to optimize when normalizingDocument.
     protected boolean xmlVersionChanged = false ;
@@ -254,6 +258,13 @@
         super(null);
         ownerDocument = this;
         allowGrammarAccess = grammarAccess;
+        SecuritySupport ss = SecuritySupport.getInstance();
+        String systemProp = ss.getSystemProperty(Constants.SUN_DOM_PROPERTY_PREFIX+Constants.SUN_DOM_ANCESTOR_CHECCK);
+        if (systemProp != null) {
+            if (systemProp.equalsIgnoreCase("false")) {
+                ancestorChecking = false;
+            }
+        }
     }
 
     /**
@@ -444,12 +455,12 @@
         }
 
         if (errorChecking &&((docType != null &&
-            oldChild.getNodeType() != Node.DOCUMENT_TYPE_NODE &&
-            newChild.getNodeType() == Node.DOCUMENT_TYPE_NODE)
-            || (docElement != null &&
-            oldChild.getNodeType() != Node.ELEMENT_NODE &&
+            oldChild.getNodeType() != Node.DOCUMENT_TYPE_NODE && 
+            newChild.getNodeType() == Node.DOCUMENT_TYPE_NODE) 
+            || (docElement != null && 
+            oldChild.getNodeType() != Node.ELEMENT_NODE && 
             newChild.getNodeType() == Node.ELEMENT_NODE))) {
-
+            	
             throw new DOMException(
                 DOMException.HIERARCHY_REQUEST_ERR,
                 DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null));
@@ -487,9 +498,9 @@
      * @since DOM Level 3
      */
     public Object getFeature(String feature, String version) {
-
+        
         boolean anyVersion = version == null || version.length() == 0;
-
+        
         // if a plus sign "+" is prepended to any feature name, implementations
         // are considered in which the specified feature may not be directly
         // castable DOMImplementation.getFeature(feature, version). Without a
@@ -497,20 +508,20 @@
         // considered.
         if ((feature.equalsIgnoreCase("+XPath"))
             && (anyVersion || version.equals("3.0"))) {
-
-            // If an XPathEvaluator was created previously
+            
+            // If an XPathEvaluator was created previously 
             // return it otherwise create a new one.
             if (fXPathEvaluator != null) {
                 return fXPathEvaluator;
             }
-
+            
             try {
                 Class xpathClass = ObjectFactory.findProviderClass(
                     "com.sun.org.apache.xpath.internal.domapi.XPathEvaluatorImpl",
                     ObjectFactory.findClassLoader(), true);
-                Constructor xpathClassConstr =
+                Constructor xpathClassConstr = 
                     xpathClass.getConstructor(new Class[] { Document.class });
-
+                
                 // Check if the DOM XPath implementation implements
                 // the interface org.w3c.dom.XPathEvaluator
                 Class interfaces[] = xpathClass.getInterfaces();
@@ -532,22 +543,22 @@
     //
     // Document methods
     //
-
+    
     // factory methods
-
+    
     /**
      * Factory method; creates an Attribute having this Document as its
      * OwnerDoc.
-     *
+     * 
      * @param name The name of the attribute. Note that the attribute's value is
      * _not_ established at the factory; remember to set it!
-     *
+     * 
      * @throws DOMException(INVALID_NAME_ERR)
      * if the attribute name is not acceptable.
      */
     public Attr createAttribute(String name)
         throws DOMException {
-
+        
         if (errorChecking && !isXMLName(name,xml11Version)) {
             String msg =
                 DOMMessageFormatter.formatMessage(
@@ -557,7 +568,7 @@
             throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
         }
         return new AttrImpl(this, name);
-
+        
     } // createAttribute(String):Attr
 
     /**
@@ -813,7 +824,7 @@
     public void setXmlEncoding(String value) {
         encoding = value;
     }
-
+    
     /**
      * @deprecated This method is internal and only exists for
      * compatibility with older applications. New applications
@@ -830,7 +841,7 @@
     public String getXmlEncoding() {
         return encoding;
     }
-
+    
     /**
      * @deprecated This method is internal and only exists for
      * compatibility with older applications. New applications
@@ -871,7 +882,7 @@
             xml11Version = false;
         }
     }
-
+    
     /**
      * @deprecated This method is internal and only exists for
      * compatibility with older applications. New applications
@@ -885,10 +896,11 @@
      * DOM Level 3 WD - Experimental.
      * The version of this document (part of XML Declaration)
      */
+
     public String getXmlVersion() {
         return (version == null)?"1.0":version;
     }
-
+    
     /**
      * @deprecated This method is internal and only exists for
      * compatibility with older applications. New applications
@@ -912,7 +924,7 @@
                                   throws DOMException {
             standalone = value;
     }
-
+    
     /**
      * @deprecated This method is internal and only exists for
      * compatibility with older applications. New applications
@@ -930,7 +942,7 @@
     public boolean getXmlStandalone() {
         return standalone;
     }
-
+    
     /**
      * @deprecated This method is internal and only exists for
      * compatibility with older applications. New applications
@@ -959,7 +971,7 @@
      */
     public Node renameNode(Node n,String namespaceURI,String name)
     throws DOMException{
-
+        
         if (errorChecking && n.getOwnerDocument() != this && n != this) {
             String msg = DOMMessageFormatter.formatMessage(
                     DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
@@ -970,7 +982,7 @@
                 ElementImpl el = (ElementImpl) n;
                 if (el instanceof ElementNSImpl) {
                     ((ElementNSImpl) el).rename(namespaceURI, name);
-
+                    
                     // fire user data NODE_RENAMED event
                     callUserDataHandlers(el, null, UserDataHandler.NODE_RENAMED);
                 }
@@ -995,7 +1007,7 @@
                             }
                         }
                         el.rename(name);
-
+                        
                         // fire user data NODE_RENAMED event
                         callUserDataHandlers(el, null,
                                 UserDataHandler.NODE_RENAMED);
@@ -1004,13 +1016,13 @@
                         // we need to create a new object
                         ElementNSImpl nel =
                             new ElementNSImpl(this, namespaceURI, name);
-
+                        
                         // register event listeners on new node
                         copyEventListeners(el, nel);
-
+                        
                         // remove user data from old node
                         Hashtable data = removeUserDataTable(el);
-
+                        
                         // remove old node from parent if any
                         Node parent = el.getParentNode();
                         Node nextSib = el.getNextSibling();
@@ -1026,14 +1038,14 @@
                         }
                         // move specified attributes to new node
                         nel.moveSpecifiedAttributes(el);
-
+                        
                         // attach user data to new node
                         setUserDataTable(nel, data);
-
+                        
                         // and fire user data NODE_RENAMED event
                         callUserDataHandlers(el, nel,
                                 UserDataHandler.NODE_RENAMED);
-
+                        
                         // insert new node where old one was
                         if (parent != null) {
                             parent.insertBefore(nel, nextSib);
@@ -1047,7 +1059,7 @@
             }
             case ATTRIBUTE_NODE: {
                 AttrImpl at = (AttrImpl) n;
-
+                
                 // dettach attr from element
                 Element el = at.getOwnerElement();
                 if (el != null) {
@@ -1059,7 +1071,7 @@
                     if (el != null) {
                         el.setAttributeNodeNS(at);
                     }
-
+                    
                     // fire user data NODE_RENAMED event
                     callUserDataHandlers(at, null, UserDataHandler.NODE_RENAMED);
                 }
@@ -1070,20 +1082,20 @@
                         if (el != null) {
                             el.setAttributeNode(at);
                         }
-
+                        
                         // fire user data NODE_RENAMED event
                         callUserDataHandlers(at, null, UserDataHandler.NODE_RENAMED);
                     }
                     else {
                         // we need to create a new object
                         AttrNSImpl nat = new AttrNSImpl(this, namespaceURI, name);
-
+                        
                         // register event listeners on new node
                         copyEventListeners(at, nat);
-
+                        
                         // remove user data from old node
                         Hashtable data = removeUserDataTable(at);
-
+                        
                         // move children to new node
                         Node child = at.getFirstChild();
                         while (child != null) {
@@ -1091,13 +1103,13 @@
                             nat.appendChild(child);
                             child = at.getFirstChild();
                         }
-
+                        
                         // attach user data to new node
                         setUserDataTable(nat, data);
-
+                        
                         // and fire user data NODE_RENAMED event
                         callUserDataHandlers(at, nat, UserDataHandler.NODE_RENAMED);
-
+                        
                         // reattach attr to element
                         if (el != null) {
                             el.setAttributeNode(nat);
@@ -1107,7 +1119,7 @@
                 }
                 // fire AttributeNameChanged event
                 renamedAttrNode((Attr) n, at);
-
+                
                 return at;
             }
             default: {
@@ -1115,7 +1127,7 @@
                 throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
             }
         }
-
+        
     }
 
 
@@ -1170,7 +1182,7 @@
      * Returns the absolute base URI of this node or null if the implementation
      * wasn't able to obtain an absolute URI. Note: If the URI is malformed, a
      * null is returned.
-     *
+     * 
      * @return The absolute base URI of this node or null.
      * @since DOM Level 3
      */
@@ -1183,7 +1195,7 @@
                 // REVISIT: what should happen in this case?
                 return null;
             }
-        }
+        }            
         return fDocumentURI;
     }
 
@@ -1506,7 +1518,7 @@
     Hashtable reversedIdentifiers)
     throws DOMException {
         Node newnode=null;
-                Hashtable userData = null;
+		Hashtable userData = null;
 
         // Sigh. This doesn't work; too many nodes have private data that
         // would have to be manually tweaked. May be able to add local
@@ -1519,8 +1531,8 @@
         //  newnode.ownerDocument=this;
         // }
         // else
-                if(source instanceof NodeImpl)
-                        userData = ((NodeImpl)source).getUserDataRecord();
+		if(source instanceof NodeImpl)
+			userData = ((NodeImpl)source).getUserDataRecord();
         int type = source.getNodeType();
         switch (type) {
             case ELEMENT_NODE: {
@@ -1723,8 +1735,8 @@
             }
         }
 
-                if(userData != null)
-                        callUserDataHandlers(source, newnode, UserDataHandler.NODE_IMPORTED,userData);
+		if(userData != null)
+			callUserDataHandlers(source, newnode, UserDataHandler.NODE_IMPORTED,userData);
 
         // If deep, replicate and attach the kids.
         if (deep) {
@@ -1751,26 +1763,26 @@
      **/
     public Node adoptNode(Node source) {
         NodeImpl node;
-                Hashtable userData = null;
+		Hashtable userData = null;
         try {
             node = (NodeImpl) source;
         } catch (ClassCastException e) {
             // source node comes from a different DOMImplementation
             return null;
         }
-
+        
         // Return null if the source is null
-
+        
         if (source == null ) {
-                return null;
+        	return null;
         } else if (source != null && source.getOwnerDocument() != null) {
 
             DOMImplementation thisImpl = this.getImplementation();
             DOMImplementation otherImpl = source.getOwnerDocument().getImplementation();
-
+            
             // when the source node comes from a different implementation.
             if (thisImpl != otherImpl) {
-
+            
                 // Adopting from a DefferedDOM to DOM
                 if (thisImpl instanceof com.sun.org.apache.xerces.internal.dom.DOMImplementationImpl &&
                         otherImpl instanceof com.sun.org.apache.xerces.internal.dom.DeferredDOMImplementationImpl) {
@@ -1781,11 +1793,11 @@
                     // Adopting from a DOM into a DefferedDOM, this should be okay
                 } else {
                     // Adopting between two dissimilar DOM's is not allowed
-                    return null;
-                }
+                    return null;  
                 }
+        	}
         }
-
+        
         switch (node.getNodeType()) {
             case ATTRIBUTE_NODE: {
                 AttrImpl attr = (AttrImpl) node;
@@ -1796,12 +1808,12 @@
                 }
                 //2. specified flag is set to true
                 attr.isSpecified(true);
-                                userData = node.getUserDataRecord();
+				userData = node.getUserDataRecord();
 
                 //3. change ownership
                 attr.setOwnerDocument(this);
-                                if(userData != null )
-                                        setUserDataTable(node,userData);
+				if(userData != null )
+					setUserDataTable(node,userData);
                 break;
             }
             //entity, notation nodes are read only nodes.. so they can't be adopted.
@@ -1820,7 +1832,7 @@
                 throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
             }
             case ENTITY_REFERENCE_NODE: {
-                                userData = node.getUserDataRecord();
+				userData = node.getUserDataRecord();
                 // remove node from wherever it is
                 Node parent = node.getParentNode();
                 if (parent != null) {
@@ -1833,8 +1845,8 @@
                 }
                 // change ownership
                 node.setOwnerDocument(this);
-                                if(userData != null)
-                                        setUserDataTable(node,userData);
+				if(userData != null)
+					setUserDataTable(node,userData);
                 // set its new replacement value if any
                 if (docType == null) {
                     break;
@@ -1852,7 +1864,7 @@
                 break;
             }
             case ELEMENT_NODE: {
-                                userData = node.getUserDataRecord();
+				userData = node.getUserDataRecord();
                 // remove node from wherever it is
                 Node parent = node.getParentNode();
                 if (parent != null) {
@@ -1860,14 +1872,14 @@
                 }
                 // change ownership
                 node.setOwnerDocument(this);
-                                if(userData != null)
-                                        setUserDataTable(node,userData);
+				if(userData != null)
+					setUserDataTable(node,userData);
                 // reconcile default attributes
                 ((ElementImpl)node).reconcileDefaultAttributes();
                 break;
             }
             default: {
-                                userData = node.getUserDataRecord();
+				userData = node.getUserDataRecord();
                 // remove node from wherever it is
                 Node parent = node.getParentNode();
                 if (parent != null) {
@@ -1875,15 +1887,15 @@
                 }
                 // change ownership
                 node.setOwnerDocument(this);
-                                if(userData != null)
-                                        setUserDataTable(node,userData);
+				if(userData != null)
+					setUserDataTable(node,userData);
             }
         }
 
-                //DOM L3 Core CR
-                //http://www.w3.org/TR/2003/CR-DOM-Level-3-Core-20031107/core.html#UserDataHandler-ADOPTED
-                if(userData != null)
-                        callUserDataHandlers(source, null, UserDataHandler.NODE_ADOPTED,userData);
+		//DOM L3 Core CR
+		//http://www.w3.org/TR/2003/CR-DOM-Level-3-Core-20031107/core.html#UserDataHandler-ADOPTED
+		if(userData != null)
+			callUserDataHandlers(source, null, UserDataHandler.NODE_ADOPTED,userData);
 
         return node;
     }
@@ -1891,18 +1903,18 @@
     /**
      * Traverses the DOM Tree and expands deferred nodes and their
      * children.
-     *
+     * 
      */
     protected void undeferChildren(Node node) {
-
+        
         Node top = node;
-
+        
         while (null != node) {
-
+            
             if (((NodeImpl)node).needsSyncData()) {
                 ((NodeImpl)node).synchronizeData();
             }
-
+            
             NamedNodeMap attributes = node.getAttributes();
             if (attributes != null) {
                 int length = attributes.getLength();
@@ -1910,31 +1922,31 @@
                     undeferChildren(attributes.item(i));
                 }
             }
-
+            
             Node nextNode = null;
             nextNode = node.getFirstChild();
-
+            
             while (null == nextNode) {
-
+                
                 if (top.equals(node))
                     break;
-
+                
                 nextNode = node.getNextSibling();
-
+                
                 if (null == nextNode) {
                     node = node.getParentNode();
-
+                    
                     if ((null == node) || (top.equals(node))) {
                         nextNode = null;
                         break;
                     }
                 }
             }
-
+            
             node = nextNode;
         }
     }
-
+    
     // identifier maintenence
     /**
      * Introduced in DOM Level 2
@@ -2347,7 +2359,7 @@
             return null;
         }
     }
-
+	
 
     /**
      * Retrieves the object associated to a key on a this node. The object
@@ -2375,7 +2387,7 @@
         return null;
     }
 
-        protected Hashtable getUserDataRecord(Node n){
+	protected Hashtable getUserDataRecord(Node n){
         if (userData == null) {
             return null;
         }
@@ -2383,10 +2395,10 @@
         if (t == null) {
             return null;
         }
-                return t;
-        }
-
-        /**
+		return t;
+	}
+    
+	/**
      * Remove user data table for the given node.
      * @param n The node this operation applies to.
      * @return The removed table.
@@ -2404,8 +2416,8 @@
      * @param data The user data table.
      */
     void setUserDataTable(Node n, Hashtable data) {
-                if (userData == null)
-                        userData = new Hashtable();
+		if (userData == null)
+			userData = new Hashtable();
         if (data != null) {
             userData.put(n, data);
         }
@@ -2422,23 +2434,23 @@
             return;
         }
         //Hashtable t = (Hashtable) userData.get(n);
-                if(n instanceof NodeImpl){
-                        Hashtable t = ((NodeImpl)n).getUserDataRecord();
-                        if (t == null || t.isEmpty()) {
-                                return;
-                        }
-                        callUserDataHandlers(n, c, operation,t);
-                }
+		if(n instanceof NodeImpl){
+			Hashtable t = ((NodeImpl)n).getUserDataRecord();
+			if (t == null || t.isEmpty()) {
+				return;
+			}
+			callUserDataHandlers(n, c, operation,t);
+		}
     }
 
-        /**
+	/**
      * Call user data handlers when a node is deleted (finalized)
      * @param n The node this operation applies to.
      * @param c The copy node or null.
      * @param operation The operation - import, clone, or delete.
-         * @param handlers Data associated with n.
-        */
-        void callUserDataHandlers(Node n, Node c, short operation,Hashtable userData) {
+	 * @param handlers Data associated with n.
+	*/
+	void callUserDataHandlers(Node n, Node c, short operation,Hashtable userData) {
         if (userData == null || userData.isEmpty()) {
             return;
         }
@@ -2451,8 +2463,8 @@
             }
         }
     }
-
-        /**
+    
+	/**
      * Call user data handlers to let them know the nodes they are related to
      * are being deleted. The alternative would be to do that on Node but
      * because the nodes are used as the keys we have a reference to them that
@@ -2553,7 +2565,7 @@
             return;
         }
 
-                // check that both prefix and local part match NCName
+		// check that both prefix and local part match NCName
         boolean validNCName = false;
         if (!xml11Version) {
             validNCName = (prefix == null || XMLChar.isValidNCName(prefix))
@@ -2720,7 +2732,7 @@
     void replacedCharacterData(NodeImpl node, String oldvalue, String value) {
     }
 
-
+    
     /**
      * A method to be called when an attribute value has been modified
      */
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/DeferredDocumentImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -37,9 +37,10 @@
  * objects. The Node objects created have a ownerDocument attribute
  * which associates them with the Document within whose context they
  * were created.
- *
+ * 
  * @xerces.internal
  *
+ * @version $Id: DeferredDocumentImpl.java,v 1.6 2009/09/09 23:09:49 joehw Exp $
  * @since  PR-DOM-Level-1-19980818.
  */
 public class DeferredDocumentImpl
@@ -67,7 +68,7 @@
     // protected
 
     /** Chunk shift. */
-    protected static final int CHUNK_SHIFT = 11;           // 2^11 = 2k
+    protected static final int CHUNK_SHIFT = 8;           // 2^8 = 256
 
     /** Chunk size. */
     protected static final int CHUNK_SIZE = (1 << CHUNK_SHIFT);
@@ -76,7 +77,7 @@
     protected static final int CHUNK_MASK = CHUNK_SIZE - 1;
 
     /** Initial chunk size. */
-    protected static final int INITIAL_CHUNK_COUNT = (1 << (16 - CHUNK_SHIFT));   // 2^16 = 64k
+    protected static final int INITIAL_CHUNK_COUNT = (1 << (13 - CHUNK_SHIFT));   // 32
 
     //
     // Data
@@ -127,7 +128,7 @@
     // Implementation Note: The deferred element and attribute must know how to
     // interpret the int representing the qname.
     protected boolean fNamespacesEnabled = false;
-
+    
     //
     // private data
     //
@@ -180,7 +181,7 @@
         // information anyway.
         return DeferredDOMImplementationImpl.getDOMImplementation();
     }
-
+    
     /** Returns the cached parser.getNamespaces() value.*/
     boolean getNamespacesEnabled() {
         return fNamespacesEnabled;
@@ -222,10 +223,10 @@
         int index     = doctypeIndex & CHUNK_MASK;
 
         // create extra data node to store internal subset
-        int extraDataIndex = createNode(Node.DOCUMENT_TYPE_NODE);
+        int extraDataIndex = createNode(Node.DOCUMENT_TYPE_NODE); 
         int echunk = extraDataIndex >> CHUNK_SHIFT;
         int eindex = extraDataIndex & CHUNK_MASK;
-        setChunkIndex(fNodeExtra, extraDataIndex, chunk, index);
+        setChunkIndex(fNodeExtra, extraDataIndex, chunk, index);        
         setChunkValue(fNodeValue, subset, echunk, eindex);
     }
 
@@ -240,7 +241,7 @@
 
 
         // create extra data node
-        int extraDataIndex = createNode(Node.NOTATION_NODE);
+        int extraDataIndex = createNode(Node.NOTATION_NODE); 
         int echunk = extraDataIndex >> CHUNK_SHIFT;
         int eindex = extraDataIndex & CHUNK_MASK;
 
@@ -260,7 +261,7 @@
 
     /** Creates an entity in the table. */
     public int createDeferredEntity(String entityName, String publicId,
-                                    String systemId, String notationName,
+                                    String systemId, String notationName, 
                                     String baseURI) {
         // create node
         int nodeIndex = createNode(Node.ENTITY_NODE);
@@ -268,7 +269,7 @@
         int index     = nodeIndex & CHUNK_MASK;
 
         // create extra data node
-        int extraDataIndex = createNode(Node.ENTITY_NODE);
+        int extraDataIndex = createNode(Node.ENTITY_NODE); 
         int echunk = extraDataIndex >> CHUNK_SHIFT;
         int eindex = extraDataIndex & CHUNK_MASK;
 
@@ -323,7 +324,7 @@
 
 
     /**
-     * DOM Internal
+     * DOM Internal 
      *
      * An attribute specifying the actual encoding of this document. This is
      * <code>null</code> otherwise.
@@ -338,9 +339,9 @@
 
         int echunk = extraDataIndex >> CHUNK_SHIFT;
         int eindex = extraDataIndex & CHUNK_MASK;
-
+        
         setChunkValue(fNodeValue, value, echunk, eindex);
-
+        
     }
 
     /** Creates an entity reference node in the table. */
@@ -360,7 +361,7 @@
 
 
     /** Creates an element node with a URI in the table and type information. */
-    public int createDeferredElement(String elementURI, String elementName,
+    public int createDeferredElement(String elementURI, String elementName, 
                                       Object type) {
 
         // create node
@@ -370,7 +371,7 @@
         setChunkValue(fNodeName, elementName, elementChunk, elementIndex);
         setChunkValue(fNodeURI, elementURI, elementChunk, elementIndex);
         setChunkValue(fNodeValue, type, elementChunk, elementIndex);
-
+ 
         // return node index
         return elementNodeIndex;
 
@@ -390,74 +391,74 @@
         int elementIndex     = elementNodeIndex & CHUNK_MASK;
         setChunkValue(fNodeName, elementName, elementChunk, elementIndex);
         setChunkValue(fNodeURI, elementURI, elementChunk, elementIndex);
-
+ 
         // return node index
         return elementNodeIndex;
 
     } // createDeferredElement(String,String):int
-
+    
+    
+	/**
+	 * This method is used by the DOMParser to create attributes.
+	 * @param elementNodeIndex
+	 * @param attrName
+	 * @param attrURI
+	 * @param attrValue
+	 * @param specified
+	 * @param id
+	 * @param type
+	 * @return int
+	 */
+	public int setDeferredAttribute(int elementNodeIndex,
+		                        String attrName,
+                          		String attrURI,
+                        		String attrValue,
+                        		boolean specified,
+                        		boolean id,
+                        		Object type) {
+                                    
+		// create attribute
+		int attrNodeIndex = createDeferredAttribute(attrName, attrURI, attrValue, specified);
+		int attrChunk = attrNodeIndex >> CHUNK_SHIFT;
+		int attrIndex = attrNodeIndex & CHUNK_MASK;
+		// set attribute's parent to element
+		setChunkIndex(fNodeParent, elementNodeIndex, attrChunk, attrIndex);
 
-        /**
-         * This method is used by the DOMParser to create attributes.
-         * @param elementNodeIndex
-         * @param attrName
-         * @param attrURI
-         * @param attrValue
-         * @param specified
-         * @param id
-         * @param type
-         * @return int
-         */
-        public int setDeferredAttribute(int elementNodeIndex,
-                                        String attrName,
-                                        String attrURI,
-                                        String attrValue,
-                                        boolean specified,
-                                        boolean id,
-                                        Object type) {
-
-                // create attribute
-                int attrNodeIndex = createDeferredAttribute(attrName, attrURI, attrValue, specified);
-                int attrChunk = attrNodeIndex >> CHUNK_SHIFT;
-                int attrIndex = attrNodeIndex & CHUNK_MASK;
-                // set attribute's parent to element
-                setChunkIndex(fNodeParent, elementNodeIndex, attrChunk, attrIndex);
-
-                int elementChunk = elementNodeIndex >> CHUNK_SHIFT;
-                int elementIndex = elementNodeIndex & CHUNK_MASK;
+		int elementChunk = elementNodeIndex >> CHUNK_SHIFT;
+		int elementIndex = elementNodeIndex & CHUNK_MASK;
 
-                // get element's last attribute
-                int lastAttrNodeIndex = getChunkIndex(fNodeExtra, elementChunk, elementIndex);
-                if (lastAttrNodeIndex != 0) {
-                        int lastAttrChunk = lastAttrNodeIndex >> CHUNK_SHIFT;
-                        int lastAttrIndex = lastAttrNodeIndex & CHUNK_MASK;
-                        // add link from new attribute to last attribute
-                        setChunkIndex(fNodePrevSib, lastAttrNodeIndex, attrChunk, attrIndex);
-                }
-                // add link from element to new last attribute
-                setChunkIndex(fNodeExtra, attrNodeIndex, elementChunk, elementIndex);
+		// get element's last attribute
+		int lastAttrNodeIndex = getChunkIndex(fNodeExtra, elementChunk, elementIndex);
+		if (lastAttrNodeIndex != 0) {
+			int lastAttrChunk = lastAttrNodeIndex >> CHUNK_SHIFT;
+			int lastAttrIndex = lastAttrNodeIndex & CHUNK_MASK;
+			// add link from new attribute to last attribute
+			setChunkIndex(fNodePrevSib, lastAttrNodeIndex, attrChunk, attrIndex);
+		}
+		// add link from element to new last attribute
+		setChunkIndex(fNodeExtra, attrNodeIndex, elementChunk, elementIndex);
 
-                int extra = getChunkIndex(fNodeExtra, attrChunk, attrIndex);
-                if (id) {
-                        extra = extra | ID;
-                        setChunkIndex(fNodeExtra, extra, attrChunk, attrIndex);
-                        String value = getChunkValue(fNodeValue, attrChunk, attrIndex);
-                        putIdentifier(value, elementNodeIndex);
-                }
-                // store type information
-                if (type != null) {
-                        int extraDataIndex = createNode(DeferredNode.TYPE_NODE);
-                        int echunk = extraDataIndex >> CHUNK_SHIFT;
-                        int eindex = extraDataIndex & CHUNK_MASK;
+		int extra = getChunkIndex(fNodeExtra, attrChunk, attrIndex);
+		if (id) {
+			extra = extra | ID;
+			setChunkIndex(fNodeExtra, extra, attrChunk, attrIndex);
+			String value = getChunkValue(fNodeValue, attrChunk, attrIndex);
+			putIdentifier(value, elementNodeIndex);
+		}
+		// store type information
+		if (type != null) {
+			int extraDataIndex = createNode(DeferredNode.TYPE_NODE);
+			int echunk = extraDataIndex >> CHUNK_SHIFT;
+			int eindex = extraDataIndex & CHUNK_MASK;
 
-                        setChunkIndex(fNodeLastChild, extraDataIndex, attrChunk, attrIndex);
-                        setChunkValue(fNodeValue, type, echunk, eindex);
-                }
+			setChunkIndex(fNodeLastChild, extraDataIndex, attrChunk, attrIndex);
+			setChunkValue(fNodeValue, type, echunk, eindex);
+		}
 
-                // return node index
-                return attrNodeIndex;
-        }
-
+		// return node index
+		return attrNodeIndex;
+	}
+    
     /** @deprecated. Sets an attribute on an element node.*/
     public int setDeferredAttribute(int elementNodeIndex,
                                     String attrName, String attrURI,
@@ -484,7 +485,7 @@
         // add link from element to new last attribute
         setChunkIndex(fNodeExtra, attrNodeIndex,
                       elementChunk, elementIndex);
-
+ 
         // return node index
         return attrNodeIndex;
 
@@ -592,7 +593,7 @@
     public int cloneNode(int nodeIndex, boolean deep) {
 
         // clone immediate node
-
+        
         int nchunk = nodeIndex >> CHUNK_SHIFT;
         int nindex = nodeIndex & CHUNK_MASK;
         int nodeType = fNodeType[nchunk][nindex];
@@ -620,10 +621,10 @@
                 prevIndex = clonedChildIndex;
                 childIndex = getRealPrevSibling(childIndex, false);
             }
-
+            
 
         }
-
+        
         // return cloned node index
         return cloneIndex;
 
@@ -1132,7 +1133,7 @@
         if (nodeIndex == -1) {
             return null;
         }
-
+        
         int chunk = nodeIndex >> CHUNK_SHIFT;
         int index = nodeIndex & CHUNK_MASK;
         String value = free ? clearChunkValue(fNodeValue, chunk, index)
@@ -1140,7 +1141,7 @@
         if (value == null) {
             return null;
         }
-
+        
         int type  = getChunkIndex(fNodeType, chunk, index);
         if (type == Node.TEXT_NODE) {
             int prevSib = getRealPrevSibling(nodeIndex);
@@ -1162,14 +1163,14 @@
                         break;
                     }
                 } while (getNodeType(prevSib, false) == Node.TEXT_NODE);
-
+                
                 int chunkCount = fStrChunks.size();
 
                 // add to the buffer in the correct order.
-                for (int i = chunkCount - 1; i >= 0; i--) {
+                for (int i = chunkCount - 1; i >= 0; i--) {                                                               
                     fBufferStr.append((String)fStrChunks.elementAt(i));
                 }
-
+                
                 value = fBufferStr.toString();
                 fStrChunks.removeAllElements();
                 fBufferStr.setLength(0);
@@ -1192,10 +1193,10 @@
                     child = getChunkIndex(fNodePrevSib, chunk, index);
                 }
                 // add to the buffer in the correct order.
-                for (int i=fStrChunks.size()-1; i>=0; i--) {
+                for (int i=fStrChunks.size()-1; i>=0; i--) {                                                               
                      fBufferStr.append((String)fStrChunks.elementAt(i));
                 }
-
+                                                         
                 value = fBufferStr.toString();
                 fStrChunks.setSize(0);
                 fBufferStr.setLength(0);
@@ -1213,12 +1214,12 @@
     public String getNodeValue(int nodeIndex) {
         return getNodeValue(nodeIndex, true);
     }
-
-        /**
-         * Clears the type info that is stored in the fNodeValue array
-         * @param nodeIndex
-         * @return Object - type information for the attribute/element node
-         */
+    
+	/**
+	 * Clears the type info that is stored in the fNodeValue array
+	 * @param nodeIndex
+	 * @return Object - type information for the attribute/element node
+	 */
     public Object getTypeInfo(int nodeIndex) {
         if (nodeIndex == -1) {
             return null;
@@ -1226,8 +1227,8 @@
 
         int chunk = nodeIndex >> CHUNK_SHIFT;
         int index = nodeIndex & CHUNK_MASK;
-
-
+        
+        
         Object value = fNodeValue[chunk] != null ? fNodeValue[chunk][index] : null;
         if (value != null) {
             fNodeValue[chunk][index] = null;
@@ -1944,11 +1945,17 @@
         if (value == -1) {
             return clearChunkIndex(data, chunk, index);
         }
-        int ovalue = data[chunk][index];
+        int [] dataChunk = data[chunk];
+        // Re-create chunk if it was deleted.
+        if (dataChunk == null) {
+            createChunk(data, chunk);
+            dataChunk = data[chunk];
+        }
+        int ovalue = dataChunk[index];
         if (ovalue == -1) {
-            data[chunk][CHUNK_SIZE]++;
+            dataChunk[CHUNK_SIZE]++;
         }
-        data[chunk][index] = value;
+        dataChunk[index] = value;
         return ovalue;
     }
     private final String setChunkValue(Object data[][], Object value,
@@ -1956,12 +1963,18 @@
         if (value == null) {
             return clearChunkValue(data, chunk, index);
         }
-        String ovalue = (String) data[chunk][index];
+        Object [] dataChunk = data[chunk];
+        // Re-create chunk if it was deleted.
+        if (dataChunk == null) {
+            createChunk(data, chunk);
+            dataChunk = data[chunk];
+        }
+        String ovalue = (String) dataChunk[index];
         if (ovalue == null) {
-            RefCount c = (RefCount) data[chunk][CHUNK_SIZE];
+            RefCount c = (RefCount) dataChunk[CHUNK_SIZE];
             c.fCount++;
         }
-        data[chunk][index] = value;
+        dataChunk[index] = value;
         return ovalue;
     }
 
@@ -1987,7 +2000,7 @@
             return data.toString();
         }
     }
-
+    
 
     /**
      * Clears the specified value in the given data at the chunk and index.
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/ParentNode.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/dom/ParentNode.java	Wed Sep 28 16:49:43 2011 +0100
@@ -62,12 +62,13 @@
  *
  * <p><b>WARNING</b>: Some of the code here is partially duplicated in
  * AttrImpl, be careful to keep these two classes in sync!
- *
+ * 
  * @xerces.internal
  *
  * @author Arnaud  Le Hors, IBM
  * @author Joe Kesselman, IBM
  * @author Andy Clark, IBM
+ * @version $Id: ParentNode.java,v 1.6 2009/07/21 20:30:28 joehw Exp $
  */
 public abstract class ParentNode
     extends ChildNode {
@@ -125,23 +126,23 @@
      * editable copies of locked portions of the tree.
      */
     public Node cloneNode(boolean deep) {
-
+    	
         if (needsSyncChildren()) {
             synchronizeChildren();
         }
-        ParentNode newnode = (ParentNode) super.cloneNode(deep);
+    	ParentNode newnode = (ParentNode) super.cloneNode(deep);
 
         // set owner document
         newnode.ownerDocument = ownerDocument;
 
-        // Need to break the association w/ original kids
-        newnode.firstChild      = null;
+    	// Need to break the association w/ original kids
+    	newnode.firstChild      = null;
 
         // invalidate cache for children NodeList
         newnode.fNodeListCache = null;
 
         // Then, if deep, clone the kids too.
-        if (deep) {
+    	if (deep) {
             for (ChildNode child = firstChild;
                  child != null;
                  child = child.nextSibling) {
@@ -149,7 +150,7 @@
             }
         }
 
-        return newnode;
+    	return newnode;
 
     } // cloneNode(boolean):Node
 
@@ -179,10 +180,10 @@
             synchronizeChildren();
         }
        for (ChildNode child = firstChild;
-             child != null; child = child.nextSibling) {
+	     child != null; child = child.nextSibling) {
              child.setOwnerDocument(doc);
-        }
-        /* setting the owner document of self, after it's children makes the
+	}
+        /* setting the owner document of self, after it's children makes the 
            data of children available to the new document. */
         super.setOwnerDocument(doc);
         ownerDocument = doc;
@@ -227,7 +228,7 @@
         if (needsSyncChildren()) {
             synchronizeChildren();
         }
-        return firstChild;
+    	return firstChild;
 
     }   // getFirstChild():Node
 
@@ -281,18 +282,18 @@
      * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is
      * read-only.
      */
-    public Node insertBefore(Node newChild, Node refChild)
+    public Node insertBefore(Node newChild, Node refChild) 
         throws DOMException {
         // Tail-call; optimizer should be able to do good things with.
         return internalInsertBefore(newChild, refChild, false);
     } // insertBefore(Node,Node):Node
-
+     
     /** NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able
      * to control which mutation events are spawned. This version of the
      * insertBefore operation allows us to do so. It is not intended
      * for use by application programs.
      */
-    Node internalInsertBefore(Node newChild, Node refChild, boolean replace)
+    Node internalInsertBefore(Node newChild, Node refChild, boolean replace) 
         throws DOMException {
 
         boolean errorChecking = ownerDocument.errorChecking;
@@ -321,7 +322,7 @@
 
                     if (!ownerDocument.isKidOK(this, kid)) {
                         throw new DOMException(
-                              DOMException.HIERARCHY_REQUEST_ERR,
+                              DOMException.HIERARCHY_REQUEST_ERR, 
                               DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null));
                     }
                 }
@@ -348,15 +349,15 @@
         if (errorChecking) {
             if (isReadOnly()) {
                 throw new DOMException(
-                              DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                              DOMException.NO_MODIFICATION_ALLOWED_ERR, 
                               DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null));
             }
             if (newChild.getOwnerDocument() != ownerDocument && newChild != ownerDocument) {
-                throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
+                throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, 
                             DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null));
             }
             if (!ownerDocument.isKidOK(this, newChild)) {
-                throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
+                throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, 
                             DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null));
             }
             // refChild must be a child of this node (or null)
@@ -368,14 +369,16 @@
             // Prevent cycles in the tree
             // newChild cannot be ancestor of this Node,
             // and actually cannot be this
-            boolean treeSafe = true;
-            for (NodeImpl a = this; treeSafe && a != null; a = a.parentNode())
-            {
-                treeSafe = newChild != a;
-            }
-            if(!treeSafe) {
-                throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR,
-                            DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null));
+            if (ownerDocument.ancestorChecking) {
+                boolean treeSafe = true;
+                for (NodeImpl a = this; treeSafe && a != null; a = a.parentNode())
+                {
+                    treeSafe = newChild != a;
+                }
+                if(!treeSafe) {
+                    throw new DOMException(DOMException.HIERARCHY_REQUEST_ERR, 
+                                DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "HIERARCHY_REQUEST_ERR", null));
+                }
             }
         }
 
@@ -475,12 +478,12 @@
      * @throws DOMException(NO_MODIFICATION_ALLOWED_ERR) if this node is
      * read-only.
      */
-    public Node removeChild(Node oldChild)
+    public Node removeChild(Node oldChild) 
         throws DOMException {
         // Tail-call, should be optimizable
         return internalRemoveChild(oldChild, false);
     } // removeChild(Node) :Node
-
+     
     /** NON-DOM INTERNAL: Within DOM actions,we sometimes need to be able
      * to control which mutation events are spawned. This version of the
      * removeChild operation allows us to do so. It is not intended
@@ -493,11 +496,11 @@
         if (ownerDocument.errorChecking) {
             if (isReadOnly()) {
                 throw new DOMException(
-                            DOMException.NO_MODIFICATION_ALLOWED_ERR,
+                            DOMException.NO_MODIFICATION_ALLOWED_ERR, 
                             DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NO_MODIFICATION_ALLOWED_ERR", null));
             }
             if (oldChild != null && oldChild.getParentNode() != this) {
-                throw new DOMException(DOMException.NOT_FOUND_ERR,
+                throw new DOMException(DOMException.NOT_FOUND_ERR, 
                             DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "NOT_FOUND_ERR", null));
             }
         }
@@ -592,8 +595,8 @@
     public Node replaceChild(Node newChild, Node oldChild)
         throws DOMException {
         // If Mutation Events are being generated, this operation might
-        // throw aggregate events twice when modifying an Attr -- once
-        // on insertion and once on removal. DOM Level 2 does not specify
+        // throw aggregate events twice when modifying an Attr -- once 
+        // on insertion and once on removal. DOM Level 2 does not specify 
         // this as either desirable or undesirable, but hints that
         // aggregations should be issued only once per user request.
 
@@ -820,7 +823,7 @@
                 public int getLength() {
                     return nodeListGetLength();
                 } // getLength():int
-
+                
                 /**
                  * @see NodeList.item(int)
                  */
@@ -1023,7 +1026,7 @@
     class UserDataRecord implements Serializable {
         /** Serialization version. */
         private static final long serialVersionUID = 3258126977134310455L;
-
+        
         Object fData;
         UserDataHandler fHandler;
         UserDataRecord(Object data, UserDataHandler handler) {
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/Constants.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/Constants.java	Wed Sep 28 16:49:43 2011 +0100
@@ -25,14 +25,15 @@
 
 /**
  * Commonly used constants.
- *
+ * 
  * @xerces.internal
  *
  * @author Andy Clark, IBM
  *
+ * @version $Id: Constants.java,v 1.10 2009/08/04 05:07:19 joehw Exp $
  */
 public final class Constants {
-
+    
     //
     // Constants
     //
@@ -40,9 +41,13 @@
     public static final String NS_XMLSCHEMA = "http://www.w3.org/2001/XMLSchema".intern();
     public static final String NS_DTD = "http://www.w3.org/TR/REC-xml".intern();
 
-    //stax properties
+    // Schema features
+    public static final String SUN_SCHEMA_FEATURE_PREFIX = "http://java.sun.com/xml/schema/features/";
+    public static final String SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE = "report-ignored-element-content-whitespace";
 
-    public static final String ZEPHYR_PROPERTY_PREFIX = "http://java.sun.com/xml/stream/properties/" ;
+    //stax properties
+    
+    public static final String ZEPHYR_PROPERTY_PREFIX = "http://java.sun.com/xml/stream/properties/" ;    
     public static final String STAX_PROPERTIES = "stax-properties" ;
     public static final String STAX_ENTITY_RESOLVER_PROPERTY = "internal/stax-entity-resolver";
     public static final String STAX_REPORT_CDATA_EVENT = "report-cdata-event";
@@ -50,93 +55,104 @@
     public static final String ADD_NAMESPACE_DECL_AS_ATTRIBUTE = "add-namespacedecl-as-attrbiute";
     public static final String ESCAPE_CHARACTERS = "escapeCharacters";
     public static final String REUSE_INSTANCE = "reuse-instance" ;
+    
+    //DOM properties
+    public static final String SUN_DOM_PROPERTY_PREFIX = "http://java.sun.com/xml/dom/properties/" ;
+    public static final String SUN_DOM_ANCESTOR_CHECCK = "ancestor-check";
 
+    /**
+     * If true, ignore DOCTYPE declaration as if it wasn't present at all.
+     * Note that this is a violation of the XML recommendation.
+     * The full property name is prefixed by {@link #ZEPHYR_PROPERTY_PREFIX}.
+     */
+    public static final String IGNORE_EXTERNAL_DTD = "ignore-external-dtd";
+    
     // sax features
-
+    
     /** SAX feature prefix ("http://xml.org/sax/features/"). */
     public static final String SAX_FEATURE_PREFIX = "http://xml.org/sax/features/";
 
     public static final String NAMESPACES_FEATURE = "namespaces";
-
+    
     /** Namespace prefixes feature ("namespace-prefixes"). */
     public static final String NAMESPACE_PREFIXES_FEATURE = "namespace-prefixes";
-
+    
     /** String interning feature ("string-interning"). */
     public static final String STRING_INTERNING_FEATURE = "string-interning";
-
+    
     /** Validation feature ("validation"). */
     public static final String VALIDATION_FEATURE = "validation";
-
+    
     /** External general entities feature ("external-general-entities "). */
     public static final String EXTERNAL_GENERAL_ENTITIES_FEATURE = "external-general-entities";
-
+    
     /** External parameter entities feature ("external-parameter-entities "). */
     public static final String EXTERNAL_PARAMETER_ENTITIES_FEATURE = "external-parameter-entities";
-
+    
     /** Lexical handler parameter entities feature ("lexical-handler/parameter-entities"). */
     public static final String LEXICAL_HANDLER_PARAMETER_ENTITIES_FEATURE = "lexical-handler/parameter-entities";
-
+    
     /** Is standalone feature ("is-standalone"). */
     public static final String IS_STANDALONE_FEATURE = "is-standalone";
-
+    
     /** Resolve DTD URIs feature ("resolve-dtd-uris"). */
     public static final String RESOLVE_DTD_URIS_FEATURE = "resolve-dtd-uris";
-
+    
     /** Use Attributes2 feature ("use-attributes2"). */
     public static final String USE_ATTRIBUTES2_FEATURE = "use-attributes2";
-
+    
     /** Use Locator2 feature ("use-locator2"). */
     public static final String USE_LOCATOR2_FEATURE = "use-locator2";
-
+    
     /** Use EntityResolver2 feature ("use-entity-resolver2"). */
     public static final String USE_ENTITY_RESOLVER2_FEATURE = "use-entity-resolver2";
-
+    
     /** Unicode normalization checking feature ("unicode-normalization-checking"). */
     public static final String UNICODE_NORMALIZATION_CHECKING_FEATURE = "unicode-normalization-checking";
-
+    
     /** xmlns URIs feature ("xmlns-uris"). */
     public static final String XMLNS_URIS_FEATURE = "xmlns-uris";
-
+    
     /** XML 1.1 feature ("xml-1.1"). */
     public static final String XML_11_FEATURE = "xml-1.1";
-
+    
     /** Allow unparsed entity and notation declaration events to be sent after the end DTD event ("allow-dtd-events-after-endDTD") */
     public static final String ALLOW_DTD_EVENTS_AFTER_ENDDTD_FEATURE = "allow-dtd-events-after-endDTD";
-
+    
     // sax properties
-
+    
     /** SAX property prefix ("http://xml.org/sax/properties/"). */
     public static final String SAX_PROPERTY_PREFIX = "http://xml.org/sax/properties/";
-
+    
     /** Declaration handler property ("declaration-handler"). */
     public static final String DECLARATION_HANDLER_PROPERTY = "declaration-handler";
-
+    
     /** Lexical handler property ("lexical-handler"). */
     public static final String LEXICAL_HANDLER_PROPERTY = "lexical-handler";
-
+    
     /** DOM node property ("dom-node"). */
     public static final String DOM_NODE_PROPERTY = "dom-node";
-
+    
     /** XML string property ("xml-string"). */
     public static final String XML_STRING_PROPERTY = "xml-string";
-
-        public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
-
+    
+	public static final String FEATURE_SECURE_PROCESSING = "http://javax.xml.XMLConstants/feature/secure-processing";
+    
     /** Document XML version property ("document-xml-version"). */
     public static final String DOCUMENT_XML_VERSION_PROPERTY = "document-xml-version";
-
-
+    
+    
     //
     // JAXP properties
     //
-
+    
     /** JAXP property prefix ("http://java.sun.com/xml/jaxp/properties/"). */
     public static final String JAXP_PROPERTY_PREFIX =
         "http://java.sun.com/xml/jaxp/properties/";
-
+    
     /** JAXP schemaSource property: when used internally may include DTD sources (DOM) */
     public static final String SCHEMA_SOURCE = "schemaSource";
-
+    
     /** JAXP schemaSource language: when used internally may include DTD namespace (DOM) */
     public static final String SCHEMA_LANGUAGE = "schemaLanguage";
 
@@ -145,21 +161,21 @@
     //
     // DOM features
     //
-
+    
     /** Comments feature ("include-comments"). */
     public static final String INCLUDE_COMMENTS_FEATURE = "include-comments";
-
+    
     /** Create cdata nodes feature ("create-cdata-nodes"). */
     public static final String CREATE_CDATA_NODES_FEATURE = "create-cdata-nodes";
-
+    
     /** Feature id: load as infoset. */
     public static final String LOAD_AS_INFOSET = "load-as-infoset";
-
-
+    
+    
     //
     // Constants: DOM Level 3 feature ids
     //
-
+    
     public static final String DOM_CANONICAL_FORM = "canonical-form";
     public static final String DOM_CDATA_SECTIONS ="cdata-sections";
 
@@ -178,19 +194,19 @@
     public static final String DOM_NAMESPACE_DECLARATIONS = "namespace-declarations";
     public static final String DOM_SUPPORTED_MEDIATYPES_ONLY =
         "supported-media-types-only";
-
+    
     public static final String DOM_VALIDATE_IF_SCHEMA = "validate-if-schema";
     public static final String DOM_VALIDATE = "validate";
     public static final String DOM_ELEMENT_CONTENT_WHITESPACE =
         "element-content-whitespace";
-
+    
     // DOM Level 3 features defined in Core:
     public static final String DOM_DISCARD_DEFAULT_CONTENT = "discard-default-content";
     public static final String DOM_NORMALIZE_CHARACTERS    = "normalize-characters";
     public static final String DOM_CHECK_CHAR_NORMALIZATION  = "check-character-normalization";
     public static final String DOM_WELLFORMED  = "well-formed";
     public static final String DOM_SPLIT_CDATA = "split-cdata-sections";
-
+    
     // Load and Save
     public static final String DOM_FORMAT_PRETTY_PRINT = "format-pretty-print";
     public static final String DOM_XMLDECL = "xml-declaration";
@@ -198,88 +214,88 @@
     public static final String DOM_CERTIFIED =  "certified";
     public static final String DOM_DISALLOW_DOCTYPE =  "disallow-doctype";
     public static final String DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS =  "ignore-unknown-character-denormalizations";
-
+    
     // DOM Properties
     public static final String DOM_RESOURCE_RESOLVER = "resource-resolver";
     public static final String DOM_ERROR_HANDLER = "error-handler";
     public static final String DOM_SCHEMA_TYPE = "schema-type";
     public static final String DOM_SCHEMA_LOCATION = "schema-location";
-
+    public static final String DOM_ANCESTOR_CHECCK = "ancestor-check";
     // XSModel
     public static final String DOM_PSVI = "psvi";
-
-
+    
+    
     // xerces features
-
+    
     /** Xerces features prefix ("http://apache.org/xml/features/"). */
     public static final String XERCES_FEATURE_PREFIX = "http://apache.org/xml/features/";
-
+    
     /** Schema validation feature ("validation/schema"). */
     public static final String SCHEMA_VALIDATION_FEATURE = "validation/schema";
-
+    
     /** Expose schema normalized values */
     public static final String SCHEMA_NORMALIZED_VALUE = "validation/schema/normalized-value";
-
+    
     /** Send schema default value via characters() */
     public static final String SCHEMA_ELEMENT_DEFAULT = "validation/schema/element-default";
-
+    
     /** Schema full constraint checking ("validation/schema-full-checking"). */
     public static final String SCHEMA_FULL_CHECKING = "validation/schema-full-checking";
-
+    
     /** Augment Post-Schema-Validation-Infoset */
     public static final String SCHEMA_AUGMENT_PSVI = "validation/schema/augment-psvi";
-
+    
     /** Dynamic validation feature ("validation/dynamic"). */
     public static final String DYNAMIC_VALIDATION_FEATURE = "validation/dynamic";
-
+    
     /** Warn on duplicate attribute declaration feature ("validation/warn-on-duplicate-attdef"). */
     public static final String WARN_ON_DUPLICATE_ATTDEF_FEATURE = "validation/warn-on-duplicate-attdef";
-
+    
     /** Warn on undeclared element feature ("validation/warn-on-undeclared-elemdef"). */
     public static final String WARN_ON_UNDECLARED_ELEMDEF_FEATURE = "validation/warn-on-undeclared-elemdef";
-
+    
     /** Warn on duplicate entity declaration feature ("warn-on-duplicate-entitydef"). */
     public static final String WARN_ON_DUPLICATE_ENTITYDEF_FEATURE = "warn-on-duplicate-entitydef";
-
+    
     /** Allow Java encoding names feature ("allow-java-encodings"). */
     public static final String ALLOW_JAVA_ENCODINGS_FEATURE = "allow-java-encodings";
-
+    
     /** Disallow DOCTYPE declaration feature ("disallow-doctype-decl"). */
     public static final String DISALLOW_DOCTYPE_DECL_FEATURE = "disallow-doctype-decl";
-
+    
     /** Continue after fatal error feature ("continue-after-fatal-error"). */
     public static final String CONTINUE_AFTER_FATAL_ERROR_FEATURE = "continue-after-fatal-error";
-
+    
     /** Load dtd grammar when nonvalidating feature ("nonvalidating/load-dtd-grammar"). */
     public static final String LOAD_DTD_GRAMMAR_FEATURE = "nonvalidating/load-dtd-grammar";
-
+    
     /** Load external dtd when nonvalidating feature ("nonvalidating/load-external-dtd"). */
     public static final String LOAD_EXTERNAL_DTD_FEATURE = "nonvalidating/load-external-dtd";
-
+    
     /** Defer node expansion feature ("dom/defer-node-expansion"). */
     public static final String DEFER_NODE_EXPANSION_FEATURE = "dom/defer-node-expansion";
-
+    
     /** Create entity reference nodes feature ("dom/create-entity-ref-nodes"). */
     public static final String CREATE_ENTITY_REF_NODES_FEATURE = "dom/create-entity-ref-nodes";
-
+    
     /** Include ignorable whitespace feature ("dom/include-ignorable-whitespace"). */
     public static final String INCLUDE_IGNORABLE_WHITESPACE = "dom/include-ignorable-whitespace";
-
+    
     /** Default attribute values feature ("validation/default-attribute-values"). */
     public static final String DEFAULT_ATTRIBUTE_VALUES_FEATURE = "validation/default-attribute-values";
-
+    
     /** Validate content models feature ("validation/validate-content-models"). */
     public static final String VALIDATE_CONTENT_MODELS_FEATURE = "validation/validate-content-models";
-
+    
     /** Validate datatypes feature ("validation/validate-datatypes"). */
     public static final String VALIDATE_DATATYPES_FEATURE = "validation/validate-datatypes";
-
+    
     /** Notify character references feature (scanner/notify-char-refs"). */
     public static final String NOTIFY_CHAR_REFS_FEATURE = "scanner/notify-char-refs";
-
+    
     /** Notify built-in (&amp;amp;, etc.) references feature (scanner/notify-builtin-refs"). */
     public static final String NOTIFY_BUILTIN_REFS_FEATURE = "scanner/notify-builtin-refs";
-
+    
     /** Standard URI conformant feature ("standard-uri-conformant"). */
     public static final String STANDARD_URI_CONFORMANT_FEATURE = "standard-uri-conformant";
 
@@ -288,29 +304,29 @@
 
     /** Validate annotations feature ("validate-annotations"). */
     public static final String VALIDATE_ANNOTATIONS_FEATURE = "validate-annotations";
-
+    
 
         /** Honour all schemaLocations feature ("honour-all-schemaLocations"). */
     public static final String HONOUR_ALL_SCHEMALOCATIONS_FEATURE = "honour-all-schemaLocations";
-
+    
     /** XInclude processing feature ("xinclude"). */
     public static final String XINCLUDE_FEATURE = "xinclude";
-
+    
     /** XInclude fixup base URIs feature ("xinclude/fixup-base-uris"). */
     public static final String XINCLUDE_FIXUP_BASE_URIS_FEATURE = "xinclude/fixup-base-uris";
-
+    
     /** XInclude fixup language feature ("xinclude/fixup-language"). */
     public static final String XINCLUDE_FIXUP_LANGUAGE_FEATURE = "xinclude/fixup-language";
-
+    
     /**
      * Internal feature. When set to true the schema validator will only use
      * schema components from the grammar pool provided.
      */
     public static final String USE_GRAMMAR_POOL_ONLY_FEATURE = "internal/validation/schema/use-grammar-pool-only";
-
-    /** Internal performance related feature:
+   
+    /** Internal performance related feature: 
      * false - the parser settings (features/properties) have not changed between 2 parses
-     * true - the parser settings have changed between 2 parses
+     * true - the parser settings have changed between 2 parses  
      * NOTE: this feature should only be set by the parser configuration.
      */
     public static final String PARSER_SETTINGS = "internal/parser-settings";
@@ -321,7 +337,7 @@
 
     /** Ignore xsi:schemaLocation and xsi:noNamespaceSchemaLocation. */
     public static final String IGNORE_SCHEMA_LOCATION_HINTS = "validation/schema/ignore-schema-location-hints";
-
+    
     /**
      * When true, the schema processor will change characters events
      * to ignorableWhitespaces events, when characters are expected to
@@ -329,38 +345,38 @@
      */
     public static final String CHANGE_IGNORABLE_CHARACTERS_INTO_IGNORABLE_WHITESPACES =
         "validation/change-ignorable-characters-into-ignorable-whitespaces";
-
+    
     // xerces properties
-
+    
     /** Xerces properties prefix ("http://apache.org/xml/properties/"). */
     public static final String XERCES_PROPERTY_PREFIX = "http://apache.org/xml/properties/";
-
+    
     /** Current element node property ("dom/current-element-node"). */
     public static final String CURRENT_ELEMENT_NODE_PROPERTY = "dom/current-element-node";
-
+    
     /** Document class name property ("dom/document-class-name"). */
     public static final String DOCUMENT_CLASS_NAME_PROPERTY = "dom/document-class-name";
-
+    
     /** Symbol table property ("internal/symbol-table"). */
     public static final String SYMBOL_TABLE_PROPERTY = "internal/symbol-table";
-
+    
     /** Error reporter property ("internal/error-reporter"). */
     public static final String ERROR_REPORTER_PROPERTY = "internal/error-reporter";
-
+    
     /** Error handler property ("internal/error-handler"). */
     public static final String ERROR_HANDLER_PROPERTY = "internal/error-handler";
-
+    
     /** XInclude handler property ("internal/xinclude-handler"). */
     public static final String XINCLUDE_HANDLER_PROPERTY = "internal/xinclude-handler";
-
+    
     /** XPointer handler property ("internal/xpointer-handler"). */
     public static final String XPOINTER_HANDLER_PROPERTY = "internal/xpointer-handler";
-
+    
     /** Entity manager property ("internal/entity-manager"). */
     public static final String ENTITY_MANAGER_PROPERTY = "internal/entity-manager";
     /** Input buffer size property ("input-buffer-size"). */
     public static final String BUFFER_SIZE_PROPERTY = "input-buffer-size";
-
+    
     /** Security manager property ("security-manager"). */
     public static final String SECURITY_MANAGER_PROPERTY = "security-manager";
 
@@ -368,46 +384,46 @@
     /** property identifier: security manager. */
     protected static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
-
+    
 
     public static final String ENTITY_RESOLVER_PROPERTY = "internal/entity-resolver";
-
+    
     /** Grammar pool property ("internal/grammar-pool"). */
     public static final String XMLGRAMMAR_POOL_PROPERTY = "internal/grammar-pool";
-
+    
     /** Datatype validator factory ("internal/datatype-validator-factory"). */
     public static final String DATATYPE_VALIDATOR_FACTORY_PROPERTY = "internal/datatype-validator-factory";
-
+    
     /** Document scanner property ("internal/document-scanner"). */
     public static final String DOCUMENT_SCANNER_PROPERTY = "internal/document-scanner";
-
+    
     /** DTD scanner property ("internal/dtd-scanner"). */
     public static final String DTD_SCANNER_PROPERTY = "internal/dtd-scanner";
-
+    
     /** DTD processor property ("internal/dtd-processor"). */
     public static final String DTD_PROCESSOR_PROPERTY = "internal/dtd-processor";
-
+    
     /** Validator property ("internal/validator"). */
     public static final String VALIDATOR_PROPERTY = "internal/validator";
-
+    
     /** Validator property ("internal/validator/dtd"). */
     public static final String DTD_VALIDATOR_PROPERTY = "internal/validator/dtd";
-
+    
     /** Validator property ("internal/validator/schema"). */
     public static final String SCHEMA_VALIDATOR_PROPERTY = "internal/validator/schema";
-
+    
     /** No namespace schema location property ("schema/external-schemaLocation"). */
     public static final String SCHEMA_LOCATION = "schema/external-schemaLocation";
-
+    
     /** Schema location property ("schema/external-noNamespaceSchemaLocation"). */
     public static final String SCHEMA_NONS_LOCATION = "schema/external-noNamespaceSchemaLocation";
 
     /** Namespace binder property ("internal/namespace-binder"). */
     public static final String NAMESPACE_BINDER_PROPERTY = "internal/namespace-binder";
-
+    
     /** Namespace context property ("internal/namespace-context"). */
     public static final String NAMESPACE_CONTEXT_PROPERTY = "internal/namespace-context";
-
+    
     /** Validation manager property ("internal/validation-manager"). */
     public static final String VALIDATION_MANAGER_PROPERTY = "internal/validation-manager";
 
@@ -417,64 +433,64 @@
 
 
     // general constants
-
+    
     /** Element PSVI is stored in augmentations using string "ELEMENT_PSVI" */
     public final static String ELEMENT_PSVI = "ELEMENT_PSVI";
-
+    
     /* Attribute PSVI is stored in augmentations using string "ATTRIBUTE_PSVI" */
     public final static String ATTRIBUTE_PSVI = "ATTRIBUTE_PSVI";
-
-    /**
-     * Boolean indicating whether an attribute is declared in the DTD is stored
+        
+    /** 
+     * Boolean indicating whether an attribute is declared in the DTD is stored 
      * in augmentations using the string "ATTRIBUTE_DECLARED". The absence of this
      * augmentation indicates that the attribute was not declared in the DTD.
      */
     public final static String ATTRIBUTE_DECLARED = "ATTRIBUTE_DECLARED";
-
-        public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
-
-        public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
+    
+	public final static String ENTITY_EXPANSION_LIMIT = "entityExpansionLimit";
+	
+	public final static String MAX_OCCUR_LIMIT = "maxOccurLimit";
 
     /**
      * {@link org.w3c.dom.TypeInfo} associated with current element/attribute
      * is stored in augmentations using this string as the key.
-     *
+     * 
      * This will ultimately controls {@link com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser}
      * regarding what object the DOM will return from
-     * {@link org.w3c.dom.Attr#getSchemaTypeInfo()} and
-     * {@link org.w3c.dom.Element#getSchemaTypeInfo()} and
+     * {@link org.w3c.dom.Attr#getSchemaTypeInfo()} and 
+     * {@link org.w3c.dom.Element#getSchemaTypeInfo()} and 
      */
     public final static String TYPEINFO = "org.w3c.dom.TypeInfo";
-
+    
     /**
-     * Whether an attribute is an id or not is stored in augmentations
+     * Whether an attribute is an id or not is stored in augmentations 
      * using this string as the key. The value is {@link Boolean#TRUE}
      * or {@link Boolean#FALSE}.
-     *
+     * 
      * This will ultimately controls {@link com.sun.org.apache.xerces.internal.parsers.AbstractDOMParser}
      * about whether it will mark an attribute as ID or not.
      */
     public final static String ID_ATTRIBUTE = "ID_ATTRIBUTE";
-
+    
     // XML version constants
-
-    /**
+    
+    /** 
      * Boolean indicating whether an entity referenced in the document has
-     * not been read is stored in augmentations using the string "ENTITY_SKIPPED".
-     * The absence of this augmentation indicates that the entity had a
+     * not been read is stored in augmentations using the string "ENTITY_SKIPPED". 
+     * The absence of this augmentation indicates that the entity had a 
      * declaration and was expanded.
      */
     public final static String ENTITY_SKIPPED = "ENTITY_SKIPPED";
-
+    
     /**
      * Boolean indicating whether a character is a probable white space
-     * character (ch <= 0x20) that was the replacement text of a character
-     * reference is stored in augmentations using the string "CHAR_REF_PROBABLE_WS".
-     * The absence of this augmentation indicates that the character is not
+     * character (ch <= 0x20) that was the replacement text of a character 
+     * reference is stored in augmentations using the string "CHAR_REF_PROBABLE_WS". 
+     * The absence of this augmentation indicates that the character is not 
      * probable white space and/or was not included from a character reference.
      */
     public final static String CHAR_REF_PROBABLE_WS = "CHAR_REF_PROBABLE_WS";
-
+    
     /** Boolean indicating if this entity is the last opened entity.
      *
      *@see com.sun.org.apache.xerces.internal.impl.XMLEntityManager#endEntity()
@@ -482,25 +498,25 @@
      *@see com.sun.org.apache.xerces.internal.impl.XMLDTDScannerImpl#endEntity()
      */
     public final static String LAST_ENTITY = "LAST_ENTITY";
-
-    // XML version constants
+    
+    // XML version constants 
     public final static short XML_VERSION_1_0 = 1;
     public final static short XML_VERSION_1_1 = 2;
 
 
-
+    
     // DOM related constants
     public final static String ANONYMOUS_TYPE_NAMESPACE =
         "http://apache.org/xml/xmlschema/1.0/anonymousTypes";
-
+    
 
-
+    
     // Constant to enable Schema 1.1 support
     public final static boolean SCHEMA_1_1_SUPPORT = false;
-
+    
 
     // private
-
+    
     /** SAX features. */
     private static final String[] fgSAXFeatures = {
             NAMESPACES_FEATURE,
@@ -510,7 +526,7 @@
             EXTERNAL_GENERAL_ENTITIES_FEATURE,
             EXTERNAL_PARAMETER_ENTITIES_FEATURE,
     };
-
+    
     /** SAX properties. */
     private static final String[] fgSAXProperties = {
             DECLARATION_HANDLER_PROPERTY,
@@ -518,7 +534,7 @@
             DOM_NODE_PROPERTY,
             XML_STRING_PROPERTY,
     };
-
+    
     /** Xerces features. */
     private static final String[] fgXercesFeatures = {
 
@@ -551,7 +567,7 @@
         XINCLUDE_FIXUP_LANGUAGE_FEATURE
 
     };
-
+    
     /** Xerces properties. */
     private static final String[] fgXercesProperties = {
             CURRENT_ELEMENT_NODE_PROPERTY,
@@ -572,53 +588,53 @@
             BUFFER_SIZE_PROPERTY,
             SECURITY_MANAGER_PROPERTY
     };
-
+    
     /** Empty enumeration. */
     private static final Enumeration fgEmptyEnumeration = new ArrayEnumeration(new Object[] {});
-
+    
     //
     // Constructors
     //
-
+    
     /** This class cannot be instantiated. */
     private Constants() {}
-
+    
     //
     // Public methods
     //
-
+    
     // sax
-
+    
     /** Returns an enumeration of the SAX features. */
     public static Enumeration getSAXFeatures() {
         return fgSAXFeatures.length > 0
         ? new ArrayEnumeration(fgSAXFeatures) : fgEmptyEnumeration;
     } // getSAXFeatures():Enumeration
-
+    
     /** Returns an enumeration of the SAX properties. */
     public static Enumeration getSAXProperties() {
         return fgSAXProperties.length > 0
         ? new ArrayEnumeration(fgSAXProperties) : fgEmptyEnumeration;
     } // getSAXProperties():Enumeration
-
+    
     // xerces
-
+    
     /** Returns an enumeration of the Xerces features. */
     public static Enumeration getXercesFeatures() {
         return fgXercesFeatures.length > 0
         ? new ArrayEnumeration(fgXercesFeatures) : fgEmptyEnumeration;
     } // getXercesFeatures():Enumeration
-
+    
     /** Returns an enumeration of the Xerces properties. */
     public static Enumeration getXercesProperties() {
         return fgXercesProperties.length > 0
         ? new ArrayEnumeration(fgXercesProperties) : fgEmptyEnumeration;
     } // getXercesProperties():Enumeration
-
+    
     //
     // Classes
     //
-
+    
     /**
      * An array enumeration.
      *
@@ -626,30 +642,30 @@
      */
     static class ArrayEnumeration
     implements Enumeration {
-
+        
         //
         // Data
         //
-
+        
         /** Array. */
         private Object[] array;
-
+        
         /** Index. */
         private int index;
-
+        
         //
         // Constructors
         //
-
+        
         /** Constructs an array enumeration. */
         public ArrayEnumeration(Object[] array) {
             this.array = array;
         } // <init>(Object[])
-
+        
         //
         // Enumeration methods
         //
-
+        
         /**
          * Tests if this enumeration contains more elements.
          *
@@ -660,7 +676,7 @@
         public boolean hasMoreElements() {
             return index < array.length;
         } // hasMoreElement():boolean
-
+        
         /**
          * Returns the next element of this enumeration.
          *
@@ -674,23 +690,23 @@
             }
             throw new NoSuchElementException();
         } // nextElement():Object
-
+        
     } // class ArrayEnumeration
-
+    
     //
     // MAIN
     //
-
+    
     /** Prints all of the constants to standard output. */
     public static void main(String[] argv) {
-
+        
         print("SAX features:", SAX_FEATURE_PREFIX, fgSAXFeatures);
         print("SAX properties:", SAX_PROPERTY_PREFIX, fgSAXProperties);
         print("Xerces features:", XERCES_FEATURE_PREFIX, fgXercesFeatures);
         print("Xerces properties:", XERCES_PROPERTY_PREFIX, fgXercesProperties);
-
+        
     } // main(String[])
-
+    
     /** Prints a list of features/properties. */
     private static void print(String header, String prefix, Object[] array) {
         System.out.print(header);
@@ -706,5 +722,5 @@
             System.out.println(" none.");
         }
     } // print(String,String,Object[])
-
+    
 } // class Constants
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/PropertyManager.java	Wed Sep 28 16:49:43 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2006 Sun Microsystems, Inc.  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
@@ -43,19 +43,19 @@
  */
 
 public class PropertyManager {
-
-
+    
+    
     public static final String STAX_NOTATIONS = "javax.xml.stream.notations";
     public static final String STAX_ENTITIES = "javax.xml.stream.entities";
-
+    
     private static final String STRING_INTERNING = "http://xml.org/sax/features/string-interning";
-
-
+    
+            
     HashMap supportedProps = new HashMap();
-
+    
     public static final int CONTEXT_READER = 1;
     public static final int CONTEXT_WRITER = 2;
-
+    
     /** Creates a new instance of PropertyManager */
     public PropertyManager(int context) {
         switch(context){
@@ -69,21 +69,21 @@
             }
         }
     }
-
+    
     /**
      * Initialize this object with the properties taken from passed PropertyManager object.
      */
     public PropertyManager(PropertyManager propertyManager){
-
+        
         HashMap properties = propertyManager.getProperties();
         supportedProps.putAll(properties);
     }
-
+    
     private HashMap getProperties(){
         return supportedProps ;
     }
-
-
+    
+    
     /**
      * Important point:
      * 1. We are not exposing Xerces namespace property. Application should configure namespace through
@@ -102,29 +102,30 @@
         supportedProps.put(XMLInputFactory.RESOLVER, null);
         supportedProps.put(XMLInputFactory.ALLOCATOR, null);
         supportedProps.put(STAX_NOTATIONS,null );
-
+        
         //zephyr (implementation) specific properties which can be set by the application.
         //interning is always done
         supportedProps.put(Constants.SAX_FEATURE_PREFIX + Constants.STRING_INTERNING_FEATURE , new Boolean(true));
         //recognizing java encoding names by default
         supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE,  new Boolean(true)) ;
         //in stax mode, namespace declarations are not added as attributes
-        supportedProps.put(Constants.ADD_NAMESPACE_DECL_AS_ATTRIBUTE ,  Boolean.FALSE) ;
+        supportedProps.put(Constants.ADD_NAMESPACE_DECL_AS_ATTRIBUTE ,  Boolean.FALSE) ;        
         supportedProps.put(Constants.READER_IN_DEFINED_STATE, new Boolean(true));
         supportedProps.put(Constants.REUSE_INSTANCE, new Boolean(true));
         supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.STAX_REPORT_CDATA_EVENT , new Boolean(false));
+        supportedProps.put(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD, Boolean.FALSE);
         supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ATTDEF_FEATURE, new Boolean(false));
         supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE, new Boolean(false));
         supportedProps.put(Constants.XERCES_FEATURE_PREFIX + Constants.WARN_ON_UNDECLARED_ELEMDEF_FEATURE, new Boolean(false));
     }
-
+    
     private void initWriterProps(){
         supportedProps.put(XMLOutputFactory.IS_REPAIRING_NAMESPACES , Boolean.FALSE);
         //default value of escaping characters is 'true'
         supportedProps.put(Constants.ESCAPE_CHARACTERS , Boolean.TRUE);
         supportedProps.put(Constants.REUSE_INSTANCE, new Boolean(true));
     }
-
+    
     /**
      * public void reset(){
      * supportedProps.clear() ;
@@ -133,11 +134,11 @@
     public boolean containsProperty(String property){
         return supportedProps.containsKey(property) ;
     }
-
+    
     public Object getProperty(String property){
         return supportedProps.get(property);
     }
-
+    
     public void setProperty(String property, Object value){
         String equivalentProperty = null ;
         if(property == XMLInputFactory.IS_NAMESPACE_AWARE || property.equals(XMLInputFactory.IS_NAMESPACE_AWARE)){
@@ -162,9 +163,9 @@
             supportedProps.put(equivalentProperty, value ) ;
         }
     }
-
+    
     public String toString(){
         return supportedProps.toString();
     }
-
+    
 }//PropertyManager
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDTDScannerImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -66,162 +66,163 @@
  * @author Glenn Marcy, IBM
  * @author Eric Ye, IBM
  *
+ * @version $Id: XMLDTDScannerImpl.java,v 1.7 2007/09/26 12:52:40 ndw Exp $
  */
 public class XMLDTDScannerImpl
 extends XMLScanner
 implements XMLDTDScanner, XMLComponent, XMLEntityHandler {
-
+    
     //
     // Constants
     //
-
+    
     // scanner states
-
+    
     /** Scanner state: end of input. */
     protected static final int SCANNER_STATE_END_OF_INPUT = 0;
-
+    
     /** Scanner state: text declaration. */
     protected static final int SCANNER_STATE_TEXT_DECL = 1;
-
+    
     /** Scanner state: markup declaration. */
     protected static final int SCANNER_STATE_MARKUP_DECL = 2;
-
+    
     // recognized features and properties
-
+    
     /** Recognized features. */
     private static final String[] RECOGNIZED_FEATURES = {
         VALIDATION,
         NOTIFY_CHAR_REFS,
     };
-
+    
     /** Feature defaults. */
     private static final Boolean[] FEATURE_DEFAULTS = {
         null,
         Boolean.FALSE,
     };
-
+    
     /** Recognized properties. */
     private static final String[] RECOGNIZED_PROPERTIES = {
         SYMBOL_TABLE,
         ERROR_REPORTER,
         ENTITY_MANAGER,
     };
-
+    
     /** Property defaults. */
     private static final Object[] PROPERTY_DEFAULTS = {
         null,
         null,
         null,
     };
-
+    
     // debugging
-
+    
     /** Debug scanner state. */
     private static final boolean DEBUG_SCANNER_STATE = false;
-
+    
     //
     // Data
     //
-
+    
     // handlers
-
+    
     /** DTD handler. */
     public XMLDTDHandler fDTDHandler = null;
-
+    
     /** DTD content model handler. */
     protected XMLDTDContentModelHandler fDTDContentModelHandler;
-
+    
     // state
-
+    
     /** Scanner state. */
     protected int fScannerState;
-
+    
     /** Standalone. */
     protected boolean fStandalone;
-
+    
     /** Seen external DTD. */
     protected boolean fSeenExternalDTD;
-
+    
     /** Seen external parameter entity. */
     protected boolean fSeenExternalPE;
-
+    
     // private data
-
+    
     /** Start DTD called. */
     private boolean fStartDTDCalled;
-
+    
     /** Default attribute */
     private XMLAttributesImpl fAttributes = new XMLAttributesImpl();
-
+    
     /**
      * Stack of content operators (either '|' or ',') in children
      * content.
      */
     private int[] fContentStack = new int[5];
-
+    
     /** Size of content stack. */
     private int fContentDepth;
-
+    
     /** Parameter entity stack to check well-formedness. */
     private int[] fPEStack = new int[5];
-
-
+    
+    
     /** Parameter entity stack to report start/end entity calls. */
     private boolean[] fPEReport = new boolean[5];
-
+    
     /** Number of opened parameter entities. */
     private int fPEDepth;
-
+    
     /** Markup depth. */
     private int fMarkUpDepth;
-
+    
     /** Number of opened external entities. */
     private int fExtEntityDepth;
-
+    
     /** Number of opened include sections. */
     private int fIncludeSectDepth;
-
+    
     // temporary variables
-
+    
     /** Array of 3 strings. */
     private String[] fStrings = new String[3];
-
+    
     /** String. */
     private XMLString fString = new XMLString();
-
+    
     /** String buffer. */
     private XMLStringBuffer fStringBuffer = new XMLStringBuffer();
-
+    
     /** String buffer. */
     private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer();
-
+    
     /** Literal text. */
     private XMLString fLiteral = new XMLString();
-
+    
     /** Literal text. */
     private XMLString fLiteral2 = new XMLString();
-
+    
     /** Enumeration values. */
     private String[] fEnumeration = new String[5];
-
+    
     /** Enumeration values count. */
     private int fEnumerationCount;
-
+    
     /** Ignore conditional section buffer. */
     private XMLStringBuffer fIgnoreConditionalBuffer = new XMLStringBuffer(128);
-
+    
     /** Object contains grammar information for a non-validaing parser. */
     DTDGrammar nvGrammarInfo = null;
-
+    
     boolean nonValidatingMode = false;
     //
     // Constructors
     //
-
+    
     /** Default constructor. */
     public XMLDTDScannerImpl() {
     } // <init>()
-
+    
     /** Constructor for he use of non-XMLComponentManagers. */
     public XMLDTDScannerImpl(SymbolTable symbolTable,
             XMLErrorReporter errorReporter, XMLEntityManager entityManager) {
@@ -230,11 +231,11 @@
         fEntityManager = entityManager;
         entityManager.setProperty(SYMBOL_TABLE, fSymbolTable);
     }
-
+    
     //
     // XMLDTDScanner methods
     //
-
+    
     /**
      * Sets the input source.
      *
@@ -258,7 +259,7 @@
         fEntityManager.setEntityHandler(this);
         fEntityManager.startDTDEntity(inputSource);
     } // setInputSource(XMLInputSource)
-
+    
     /**
      * Scans the external subset of the document.
      *
@@ -274,7 +275,7 @@
      */
     public boolean scanDTDExternalSubset(boolean complete)
     throws IOException, XNIException {
-
+        
         fEntityManager.setEntityHandler(this);
         if (fScannerState == SCANNER_STATE_TEXT_DECL) {
             fSeenExternalDTD = true;
@@ -297,12 +298,12 @@
                 return false;
             }
         } while (complete);
-
+        
         // return that there is more to scan
         return true;
-
+        
     } // scanDTDExternalSubset(boolean):boolean
-
+    
     /**
      * Scans the internal subset of the document.
      *
@@ -329,7 +330,7 @@
         // reset entity scanner
         //xxx:stax getText() is supposed to return only DTD internal subset
         //shouldn't we record position here before we go ahead ??
-
+       
         fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner();
         fEntityManager.setEntityHandler(this);
         fStandalone = standalone;
@@ -340,7 +341,7 @@
                 fDTDHandler.startDTD(fEntityScanner, null);
                 fStartDTDCalled = true;
             }
-
+            
             if (nonValidatingMode){
                 fStartDTDCalled = true;
                 nvGrammarInfo.startDTD(fEntityScanner,null);
@@ -363,16 +364,16 @@
                 return false;
             }
         } while (complete);
-
+        
         // return that there is more to scan
         return true;
-
+        
     } // scanDTDInternalSubset(boolean,boolean,boolean):boolean
-
+    
     //
     // XMLComponent methods
     //
-
+    
     /**
      * reset
      *
@@ -380,26 +381,26 @@
      */
     public void reset(XMLComponentManager componentManager)
     throws XMLConfigurationException {
-
-        super.reset(componentManager);
+        
+        super.reset(componentManager);        
         init();
-
+        
     } // reset(XMLComponentManager)
-
+    
     // this is made for something like XMLDTDLoader--XMLComponentManager-free operation...
     public void reset() {
         super.reset();
         init();
 
     }
-
+    
     public void reset(PropertyManager props) {
         setPropertyManager(props);
         super.reset(props);
         init() ;
         nonValidatingMode = true;
         //Revisit : Create new grammar until we implement GrammarPool.
-        nvGrammarInfo = new DTDGrammar(fSymbolTable);
+        nvGrammarInfo = new DTDGrammar(fSymbolTable);        
     }
     /**
      * Returns a list of feature identifiers that are recognized by
@@ -409,7 +410,7 @@
     public String[] getRecognizedFeatures() {
         return (String[])(RECOGNIZED_FEATURES.clone());
     } // getRecognizedFeatures():String[]
-
+    
     /**
      * Returns a list of property identifiers that are recognized by
      * this component. This method may return null if no properties
@@ -418,7 +419,7 @@
     public String[] getRecognizedProperties() {
         return (String[])(RECOGNIZED_PROPERTIES.clone());
     } // getRecognizedProperties():String[]
-
+    
     /**
      * Returns the default state for a feature, or null if this
      * component does not want to report a default value for this
@@ -436,7 +437,7 @@
         }
         return null;
     } // getFeatureDefault(String):Boolean
-
+    
     /**
      * Returns the default state for a property, or null if this
      * component does not want to report a default value for this
@@ -454,11 +455,11 @@
         }
         return null;
     } // getPropertyDefault(String):Object
-
+    
     //
     // XMLDTDSource methods
     //
-
+    
     /**
      * setDTDHandler
      *
@@ -467,7 +468,7 @@
     public void setDTDHandler(XMLDTDHandler dtdHandler) {
         fDTDHandler = dtdHandler;
     } // setDTDHandler(XMLDTDHandler)
-
+    
     /**
      * getDTDHandler
      *
@@ -476,11 +477,11 @@
     public XMLDTDHandler getDTDHandler() {
         return fDTDHandler;
     } // getDTDHandler():  XMLDTDHandler
-
+    
     //
     // XMLDTDContentModelSource methods
     //
-
+    
     /**
      * setDTDContentModelHandler
      *
@@ -490,7 +491,7 @@
     dtdContentModelHandler) {
         fDTDContentModelHandler = dtdContentModelHandler;
     } // setDTDContentModelHandler
-
+    
     /**
      * getDTDContentModelHandler
      *
@@ -499,11 +500,11 @@
     public XMLDTDContentModelHandler getDTDContentModelHandler() {
         return fDTDContentModelHandler ;
     } // setDTDContentModelHandler
-
+    
     //
     // XMLEntityHandler methods
     //
-
+    
     /**
      * This method notifies of the start of an entity. The DTD has the
      * pseudo-name of "[dtd]" parameter entity names start with '%'; and
@@ -520,7 +521,7 @@
      *
      * @throws XNIException Thrown by handler to signal an error.
      */
-    public void startEntity(String name,
+    public void startEntity(String name, 
                             XMLResourceIdentifier identifier,
                             String encoding, Augmentations augs) throws XNIException {
 
@@ -545,14 +546,14 @@
                 fExtEntityDepth++;
             }
         }
-
+        
         // call handler
         if (fDTDHandler != null && !dtdEntity && fReportEntity) {
             fDTDHandler.startParameterEntity(name, identifier, encoding, null);
         }
-
+        
     } // startEntity(String,XMLResourceIdentifier,String)
-
+    
     /**
      * This method notifies the end of an entity. The DTD has the pseudo-name
      * of "[dtd]" parameter entity names start with '%'; and general entities
@@ -564,14 +565,14 @@
      */
     public void endEntity(String name, Augmentations augs)
     throws XNIException, IOException {
-
+        
         super.endEntity(name, augs);
-
+        
         // if there is no data after the doctype
         //
         if (fScannerState == SCANNER_STATE_END_OF_INPUT)
             return;
-
+        
         // Handle end of PE
         boolean reportEntity = fReportEntity;
         if (name.startsWith("%")) {
@@ -602,13 +603,13 @@
                 fExtEntityDepth--;
             }
         }
-
+        
         // call handler
         boolean dtdEntity = name.equals("[dtd]");
         if (fDTDHandler != null && !dtdEntity && reportEntity) {
             fDTDHandler.endParameterEntity(name, null);
         }
-
+        
         // end DTD
         if (dtdEntity) {
             if (fIncludeSectDepth != 0) {
@@ -618,7 +619,7 @@
             // call handler
             fEntityManager.endExternalSubset();
             fEntityStore.endExternalSubset();
-
+            
             if (fDTDHandler != null) {
                 fDTDHandler.endExternalSubset(null);
                 fDTDHandler.endDTD(null);
@@ -629,42 +630,42 @@
         //XML (Document Entity) is the last opened entity, however
         //if for some reason DTD Scanner receives this callback
         //there is something wrong (probably invalid XML), throw exception.
-        //or
+        //or 
         //For standalone DTD loader, it might be the last opened entity
-        //and if this is the last opened entity and fMarkUpDepth != 0 or
+        //and if this is the last opened entity and fMarkUpDepth != 0 or 
         //fIncludeSectDepth != 0 or fExtEntityDepth != 0 throw Exception
-        if (augs != null && Boolean.TRUE.equals(augs.getItem(Constants.LAST_ENTITY))
+        if (augs != null && Boolean.TRUE.equals(augs.getItem(Constants.LAST_ENTITY)) 
             && ( fMarkUpDepth != 0 || fExtEntityDepth !=0 || fIncludeSectDepth != 0)){
             throw new EOFException();
         }
 
     } // endEntity(String)
-
+        
     // helper methods
-
+    
     /**
      * Sets the scanner state.
      *
      * @param state The new scanner state.
      */
     protected final void setScannerState(int state) {
-
+        
         fScannerState = state;
         if (DEBUG_SCANNER_STATE) {
             System.out.print("### setScannerState: ");
             System.out.print(getScannerStateName(state));
             //System.out.println();
         }
-
+        
     } // setScannerState(int)
-
+    
     //
     // Private methods
     //
-
+    
     /** Returns the scanner state name. */
     private static String getScannerStateName(int state) {
-
+        
         if (DEBUG_SCANNER_STATE) {
             switch (state) {
                 case SCANNER_STATE_END_OF_INPUT: return "SCANNER_STATE_END_OF_INPUT";
@@ -672,15 +673,15 @@
                 case SCANNER_STATE_MARKUP_DECL: return "SCANNER_STATE_MARKUP_DECL";
             }
         }
-
+        
         return "??? ("+state+')';
-
+        
     } // getScannerStateName(int):String
-
+    
     protected final boolean scanningInternalSubset() {
         return fExtEntityDepth == 0;
     }
-
+    
     /**
      * start a parameter entity dealing with the textdecl if there is any
      *
@@ -703,7 +704,7 @@
             scanTextDecl();
         }
     }
-
+    
     /**
      * Dispatch an XML "event".
      *
@@ -718,7 +719,7 @@
      */
     protected final boolean scanTextDecl()
     throws IOException, XNIException {
-
+        
         // scan XMLDecl
         boolean textDecl = false;
         if (fEntityScanner.skipString("<?xml")) {
@@ -737,22 +738,22 @@
                 fStringBuffer.length);
                 scanPIData(target, fString);
             }
-
+            
             // standard Text declaration
             else {
                 // pseudo-attribute values
                 String version = null;
                 String encoding = null;
-
+                
                 scanXMLDeclOrTextDecl(true, fStrings);
                 textDecl = true;
                 fMarkUpDepth--;
-
+                
                 version = fStrings[0];
                 encoding = fStrings[1];
-
+                
                 fEntityScanner.setEncoding(encoding);
-
+                
                 // call handler
                 if (fDTDHandler != null) {
                     fDTDHandler.textDecl(version, encoding, null);
@@ -760,11 +761,11 @@
             }
         }
         fEntityManager.fCurrentEntity.mayReadChunks = true;
-
+        
         return textDecl;
-
+        
     } // scanTextDecl(boolean):boolean
-
+    
     /**
      * Scans a processing data. This is needed to handle the situation
      * where a document starts with a processing instruction whose
@@ -778,14 +779,14 @@
         //Venu REVISIT
         //      super.scanPIData(target, data);
         fMarkUpDepth--;
-
+        
         // call handler
         if (fDTDHandler != null) {
             fDTDHandler.processingInstruction(target, data, null);
         }
-
+        
     } // scanPIData(String)
-
+    
     /**
      * Scans a comment.
      * <p>
@@ -796,19 +797,19 @@
      * <strong>Note:</strong> Called after scanning past '&lt;!--'
      */
     protected final void scanComment() throws IOException, XNIException {
-
+        
         fReportEntity = false;
         scanComment(fStringBuffer);
         fMarkUpDepth--;
-
+        
         // call handler
         if (fDTDHandler != null) {
             fDTDHandler.comment(fStringBuffer, null);
         }
         fReportEntity = true;
-
+        
     } // scanComment()
-
+    
     /**
      * Scans an element declaration
      * <p>
@@ -820,27 +821,27 @@
      * <strong>Note:</strong> Called after scanning past '&lt;!ELEMENT'
      */
     protected final void scanElementDecl() throws IOException, XNIException {
-
+        
         // spaces
         fReportEntity = false;
         if (!skipSeparator(true, !scanningInternalSubset())) {
             reportFatalError("MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ELEMENTDECL",
             null);
         }
-
+        
         // element name
         String name = fEntityScanner.scanName();
         if (name == null) {
             reportFatalError("MSG_ELEMENT_TYPE_REQUIRED_IN_ELEMENTDECL",
             null);
         }
-
+        
         // spaces
         if (!skipSeparator(true, !scanningInternalSubset())) {
             reportFatalError("MSG_SPACE_REQUIRED_BEFORE_CONTENTSPEC_IN_ELEMENTDECL",
             new Object[]{name});
         }
-
+        
         // content model
         if (fDTDContentModelHandler != null) {
             fDTDContentModelHandler.startContentModel(name, null);
@@ -873,7 +874,7 @@
             fStringBuffer.append('(');
             fMarkUpDepth++;
             skipSeparator(false, !scanningInternalSubset());
-
+            
             // Mixed content model
             if (fEntityScanner.skipString("#PCDATA")) {
                 scanMixed(name);
@@ -883,12 +884,12 @@
             }
             contentModel = fStringBuffer.toString();
         }
-
+        
         // call handler
         if (fDTDContentModelHandler != null) {
             fDTDContentModelHandler.endContentModel(null);
         }
-
+        
         fReportEntity = false;
         skipSeparator(false, !scanningInternalSubset());
         // end
@@ -897,14 +898,14 @@
         }
         fReportEntity = true;
         fMarkUpDepth--;
-
+        
         // call handler
         if (fDTDHandler != null) {
             fDTDHandler.elementDecl(name, contentModel, null);
         }
         if (nonValidatingMode) nvGrammarInfo.elementDecl(name, contentModel, null);
     } // scanElementDecl()
-
+    
     /**
      * scan Mixed content model
      * This assumes the content model has been parsed up to #PCDATA and
@@ -920,9 +921,9 @@
      */
     private final void scanMixed(String elName)
     throws IOException, XNIException {
-
+        
         String childName = null;
-
+        
         fStringBuffer.append("#PCDATA");
         // call handler
         if (fDTDContentModelHandler != null) {
@@ -937,7 +938,7 @@
                 null);
             }
             skipSeparator(false, !scanningInternalSubset());
-
+            
             childName = fEntityScanner.scanName();
             if (childName == null) {
                 reportFatalError("MSG_ELEMENT_TYPE_REQUIRED_IN_MIXED_CONTENT",
@@ -981,7 +982,7 @@
         fMarkUpDepth--;
         // we are done
     }
-
+    
     /**
      * scan children content model
      * This assumes it can simply append to fStringBuffer.
@@ -999,7 +1000,7 @@
      */
     private final void scanChildren(String elName)
     throws IOException, XNIException {
-
+        
         fContentDepth = 0;
         pushContentStack(0);
         int currentOp = 0;
@@ -1127,7 +1128,7 @@
             skipSeparator(false, !scanningInternalSubset());
         }
     }
-
+    
     /**
      * Scans an attlist declaration
      * <p>
@@ -1139,26 +1140,26 @@
      * <strong>Note:</strong> Called after scanning past '&lt;!ATTLIST'
      */
     protected final void scanAttlistDecl() throws IOException, XNIException {
-
+        
         // spaces
         fReportEntity = false;
         if (!skipSeparator(true, !scanningInternalSubset())) {
             reportFatalError("MSG_SPACE_REQUIRED_BEFORE_ELEMENT_TYPE_IN_ATTLISTDECL",
             null);
         }
-
+        
         // element name
         String elName = fEntityScanner.scanName();
         if (elName == null) {
             reportFatalError("MSG_ELEMENT_TYPE_REQUIRED_IN_ATTLISTDECL",
             null);
         }
-
+        
         // call handler
         if (fDTDHandler != null) {
             fDTDHandler.startAttlist(elName, null);
         }
-
+        
         // spaces
         if (!skipSeparator(true, !scanningInternalSubset())) {
             // no space, is it the end yet?
@@ -1176,7 +1177,7 @@
                 new Object[]{elName});
             }
         }
-
+        
         // definitions
         while (!fEntityScanner.skipChar('>')) {
             String name = fEntityScanner.scanName();
@@ -1191,13 +1192,13 @@
             }
             // type
             String type = scanAttType(elName, name);
-
+            
             // spaces
             if (!skipSeparator(true, !scanningInternalSubset())) {
                 reportFatalError("MSG_SPACE_REQUIRED_BEFORE_DEFAULTDECL_IN_ATTDEF",
                 new Object[]{elName, name});
             }
-
+            
             // default decl
             String defaultType = scanAttDefaultDecl(elName, name,
             type,
@@ -1225,7 +1226,7 @@
                 if(nonValidatingMode){
                     nvGrammarInfo.attributeDecl(elName, name, type, enumr,
                     defaultType, null, null, null);
-
+                    
                 }
             }
             else {
@@ -1240,16 +1241,16 @@
             }
             skipSeparator(false, !scanningInternalSubset());
         }
-
+        
         // call handler
         if (fDTDHandler != null) {
             fDTDHandler.endAttlist(null);
         }
         fMarkUpDepth--;
         fReportEntity = true;
-
+        
     } // scanAttlistDecl()
-
+    
     /**
      * Scans an attribute type definition
      * <p>
@@ -1275,7 +1276,7 @@
      */
     private final String scanAttType(String elName, String atName)
     throws IOException, XNIException {
-
+        
         String type = null;
         fEnumerationCount = 0;
         /*
@@ -1368,10 +1369,10 @@
             fMarkUpDepth--;
         }
         return type;
-
+        
     } // scanAttType():String
-
-
+    
+    
     /**
      * Scans an attribute default declaration
      * <p>
@@ -1387,7 +1388,7 @@
     XMLString defaultVal,
     XMLString nonNormalizedDefaultVal)
     throws IOException, XNIException {
-
+        
         String defaultType = null;
         fString.clear();
         defaultVal.clear();
@@ -1412,9 +1413,9 @@
             fAttributes, 0, isVC);
         }
         return defaultType;
-
+        
     } // ScanAttDefaultDecl
-
+    
     /**
      * Scans an entity declaration
      * <p>
@@ -1432,7 +1433,7 @@
      * <strong>Note:</strong> Called after scanning past '&lt;!ENTITY'
      */
     private final void scanEntityDecl() throws IOException, XNIException {
-
+        
         boolean isPEDecl = false;
         boolean sawPERef = false;
         fReportEntity = false;
@@ -1498,28 +1499,28 @@
                 }
             }
         }
-
+        
         // name
         String name = fEntityScanner.scanName();
         if (name == null) {
             reportFatalError("MSG_ENTITY_NAME_REQUIRED_IN_ENTITYDECL", null);
         }
-
+        
         // spaces
         if (!skipSeparator(true, !scanningInternalSubset())) {
             reportFatalError("MSG_SPACE_REQUIRED_AFTER_ENTITY_NAME_IN_ENTITYDECL",
             new Object[]{name});
         }
-
+        
         // external id
         scanExternalID(fStrings, false);
         String systemId = fStrings[0];
         String publicId = fStrings[1];
-
+        
         if (isPEDecl && systemId != null) {
             fSeenExternalPE = true;
         }
-
+        
         String notation = null;
         // NDATA
         boolean sawSpace = skipSeparator(true, !scanningInternalSubset());
@@ -1529,7 +1530,7 @@
                 reportFatalError("MSG_SPACE_REQUIRED_BEFORE_NDATA_IN_UNPARSED_ENTITYDECL",
                 new Object[]{name});
             }
-
+            
             // spaces
             if (!skipSeparator(true, !scanningInternalSubset())) {
                 reportFatalError("MSG_SPACE_REQUIRED_BEFORE_NOTATION_NAME_IN_UNPARSED_ENTITYDECL",
@@ -1541,7 +1542,7 @@
                 new Object[]{name});
             }
         }
-
+        
         // internal entity
         if (systemId == null) {
             scanEntityValue(fLiteral, fLiteral2);
@@ -1552,16 +1553,16 @@
             fStringBuffer.append(fLiteral.ch, fLiteral.offset, fLiteral.length);
             fStringBuffer2.append(fLiteral2.ch, fLiteral2.offset, fLiteral2.length);
         }
-
+        
         // skip possible trailing space
         skipSeparator(false, !scanningInternalSubset());
-
+        
         // end
         if (!fEntityScanner.skipChar('>')) {
             reportFatalError("EntityDeclUnterminated", new Object[]{name});
         }
         fMarkUpDepth--;
-
+        
         // register entity and make callback
         if (isPEDecl) {
             name = "%" + name;
@@ -1578,7 +1579,7 @@
             if (fDTDHandler != null) {
                 //Venu Revisit : why false has been removed in expandSYstem
                 fResourceIdentifier.setValues(publicId, systemId, baseSystemId, XMLEntityManager.expandSystemId(systemId, baseSystemId ));
-
+                
                 if (notation != null) {
                     fDTDHandler.unparsedEntityDecl(name, fResourceIdentifier,
                     notation, null);
@@ -1595,9 +1596,9 @@
             }
         }
         fReportEntity = true;
-
+        
     } // scanEntityDecl()
-
+    
     /**
      * Scans an entity value.
      *
@@ -1618,7 +1619,7 @@
         }
         // store at which depth of entities we start
         int entityDepth = fEntityDepth;
-
+        
         XMLString literal = fString;
         XMLString literal2 = fString;
         if (fEntityScanner.scanLiteral(quote, fString) != quote) {
@@ -1714,7 +1715,7 @@
             reportFatalError("CloseQuoteMissingInDecl", null);
         }
     } // scanEntityValue(XMLString,XMLString):void
-
+    
     /**
      * Scans a notation declaration
      * <p>
@@ -1726,47 +1727,47 @@
      * <strong>Note:</strong> Called after scanning past '&lt;!NOTATION'
      */
     private final void scanNotationDecl() throws IOException, XNIException {
-
+        
         // spaces
         fReportEntity = false;
         if (!skipSeparator(true, !scanningInternalSubset())) {
             reportFatalError("MSG_SPACE_REQUIRED_BEFORE_NOTATION_NAME_IN_NOTATIONDECL",
             null);
         }
-
+        
         // notation name
         String name = fEntityScanner.scanName();
         if (name == null) {
             reportFatalError("MSG_NOTATION_NAME_REQUIRED_IN_NOTATIONDECL",
             null);
         }
-
+        
         // spaces
         if (!skipSeparator(true, !scanningInternalSubset())) {
             reportFatalError("MSG_SPACE_REQUIRED_AFTER_NOTATION_NAME_IN_NOTATIONDECL",
             new Object[]{name});
         }
-
+        
         // external id
         scanExternalID(fStrings, true);
         String systemId = fStrings[0];
         String publicId = fStrings[1];
         String baseSystemId = fEntityScanner.getBaseSystemId();
-
+        
         if (systemId == null && publicId == null) {
             reportFatalError("ExternalIDorPublicIDRequired",
             new Object[]{name});
         }
-
+        
         // skip possible trailing space
         skipSeparator(false, !scanningInternalSubset());
-
+        
         // end
         if (!fEntityScanner.skipChar('>')) {
             reportFatalError("NotationDeclUnterminated", new Object[]{name});
         }
         fMarkUpDepth--;
-
+        
         fResourceIdentifier.setValues(publicId, systemId, baseSystemId, XMLEntityManager.expandSystemId(systemId, baseSystemId ));
         if (nonValidatingMode) nvGrammarInfo.notationDecl(name, fResourceIdentifier, null);
         // call handler
@@ -1776,9 +1777,9 @@
             fDTDHandler.notationDecl(name, fResourceIdentifier, null);
         }
         fReportEntity = true;
-
+        
     } // scanNotationDecl()
-
+    
     /**
      * Scans a conditional section. If it's a section to ignore the whole
      * section gets scanned through and this method only returns after the
@@ -1797,10 +1798,10 @@
      * <strong>Note:</strong> Called after scanning past '&lt;![' */
     private final void scanConditionalSect(int currPEDepth)
     throws IOException, XNIException {
-
+        
         fReportEntity = false;
         skipSeparator(false, !scanningInternalSubset());
-
+        
         if (fEntityScanner.skipString("INCLUDE")) {
             skipSeparator(false, !scanningInternalSubset());
             if(currPEDepth != fPEDepth && fValidation) {
@@ -1813,7 +1814,7 @@
             if (!fEntityScanner.skipChar('[')) {
                 reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
             }
-
+            
             if (fDTDHandler != null) {
                 fDTDHandler.startConditional(XMLDTDHandler.CONDITIONAL_INCLUDE,
                 null);
@@ -1914,9 +1915,9 @@
         else {
             reportFatalError("MSG_MARKUP_NOT_RECOGNIZED_IN_DTD", null);
         }
-
+        
     } // scanConditionalSect()
-
+    
     /**
      * Dispatch an XML "event".
      *
@@ -1931,7 +1932,7 @@
      */
     protected final boolean scanDecls(boolean complete)
     throws IOException, XNIException {
-
+        
         skipSeparator(false, true);
         boolean again = true;
         //System.out.println("scanDecls"+fScannerState);
@@ -1942,6 +1943,7 @@
                 if (fEntityScanner.skipChar('?')) {
                     fStringBuffer.clear();
                     scanPI(fStringBuffer);
+                    fMarkUpDepth--; // we're done with this decl
                 }
                 else if (fEntityScanner.skipChar('!')) {
                     if (fEntityScanner.skipChar('-')) {
@@ -2008,7 +2010,7 @@
         }
         return fScannerState != SCANNER_STATE_END_OF_INPUT;
     }
-
+    
     /**
      * Skip separator. This is typically just whitespace but it can also be one
      * or more parameter entity references.
@@ -2047,8 +2049,8 @@
                 return true;
         }
     }
-
-
+    
+    
     /*
      * Element Children Content Stack
      */
@@ -2060,12 +2062,12 @@
         }
         fContentStack[fContentDepth++] = c;
     }
-
+    
     private final int popContentStack() {
         return fContentStack[--fContentDepth];
     }
-
-
+    
+    
     /*
      * Parameter Entity Stack
      */
@@ -2078,23 +2080,23 @@
             boolean[] newBooleanStack = new boolean[fPEDepth * 2];
             System.arraycopy(fPEReport, 0, newBooleanStack, 0, fPEDepth);
             fPEReport = newBooleanStack;
-
+            
         }
         fPEReport[fPEDepth] = report;
         fPEStack[fPEDepth++] = depth;
     }
-
+    
     /** pop the stack */
     private final int popPEStack() {
         return fPEStack[--fPEDepth];
     }
-
+    
     /** look at the top of the stack */
     private final boolean peekReportEntity() {
         return fPEReport[fPEDepth-1];
     }
-
-
+    
+    
     /*
      * Utility method
      */
@@ -2105,7 +2107,7 @@
             fEnumeration = newEnum;
         }
     }
-
+    
     // private methods
     private void init() {
         // reset state related data
@@ -2114,18 +2116,18 @@
         fIncludeSectDepth = 0;
         fMarkUpDepth = 0;
         fPEDepth = 0;
-
+        
         fStandalone = false;
         fSeenExternalDTD = false;
         fSeenExternalPE = false;
-
+        
         // set starting state
         setScannerState(SCANNER_STATE_TEXT_DECL);
         //new SymbolTable());
     }
-
+    
     public DTDGrammar getGrammar(){
         return nvGrammarInfo;
     }
-
+    
 } // class XMLDTDScannerImpl
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentFragmentScannerImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
  */
 
 /*
@@ -72,103 +72,104 @@
  * @author Arnaud  Le Hors, IBM
  * @author Eric Ye, IBM
  * @author Sunitha Reddy, SUN Microsystems
+ * @version $Id: XMLDocumentFragmentScannerImpl.java,v 1.17 2009/06/10 18:50:48 joehw Exp $
  *
  */
 public class XMLDocumentFragmentScannerImpl
         extends XMLScanner
         implements XMLDocumentScanner, XMLComponent, XMLEntityHandler, XMLBufferListener {
-
+    
     //
     // Constants
     //
-
+    
     protected int fElementAttributeLimit;
-
+    
     /** External subset resolver. **/
     protected ExternalSubsetResolver fExternalSubsetResolver;
-
+    
     // scanner states
-
+    
     //XXX this should be divided into more states.
     /** Scanner state: start of markup. */
     protected static final int SCANNER_STATE_START_OF_MARKUP = 21;
-
+    
     /** Scanner state: content. */
     protected static final int SCANNER_STATE_CONTENT = 22;
-
+    
     /** Scanner state: processing instruction. */
     protected static final int SCANNER_STATE_PI = 23;
-
+    
     /** Scanner state: DOCTYPE. */
     protected static final int SCANNER_STATE_DOCTYPE = 24;
-
+    
     /** Scanner state: XML Declaration */
     protected static final int SCANNER_STATE_XML_DECL = 25;
-
+    
     /** Scanner state: root element. */
     protected static final int SCANNER_STATE_ROOT_ELEMENT = 26;
-
+    
     /** Scanner state: comment. */
     protected static final int SCANNER_STATE_COMMENT = 27;
-
+    
     /** Scanner state: reference. */
     protected static final int SCANNER_STATE_REFERENCE = 28;
-
+    
     // <book type="hard"> reading attribute name 'type'
     protected static final int SCANNER_STATE_ATTRIBUTE = 29;
-
+    
     // <book type="hard"> //reading attribute value.
     protected static final int SCANNER_STATE_ATTRIBUTE_VALUE = 30;
-
+    
     /** Scanner state: trailing misc. USED BY DOCUMENT_SCANNER_IMPL*/
     //protected static final int SCANNER_STATE_TRAILING_MISC = 32;
-
+    
     /** Scanner state: end of input. */
     protected static final int SCANNER_STATE_END_OF_INPUT = 33;
-
+    
     /** Scanner state: terminated. */
     protected static final int SCANNER_STATE_TERMINATED = 34;
-
+    
     /** Scanner state: CDATA section. */
     protected static final int SCANNER_STATE_CDATA = 35;
-
+    
     /** Scanner state: Text declaration. */
     protected static final int SCANNER_STATE_TEXT_DECL = 36;
-
+    
     /** Scanner state: Text declaration. */
     protected static final int SCANNER_STATE_CHARACTER_DATA = 37;
-
+    
     //<book type="hard">foo</book>
     protected static final int SCANNER_STATE_START_ELEMENT_TAG = 38;
-
+    
     //<book type="hard">foo</book> reading </book>
     protected static final int SCANNER_STATE_END_ELEMENT_TAG = 39;
-
+    
     protected static final int SCANNER_STATE_CHAR_REFERENCE = 40;
     protected static final int SCANNER_STATE_BUILT_IN_REFS = 41;
-
+    
     // feature identifiers
-
-
+    
+    
     /** Feature identifier: notify built-in refereces. */
     protected static final String NOTIFY_BUILTIN_REFS =
             Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE;
-
+    
     /** Property identifier: entity resolver. */
     protected static final String ENTITY_RESOLVER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
-
+        
     // recognized features and properties
-
+    
     /** Recognized features. */
     private static final String[] RECOGNIZED_FEATURES = {
                 NAMESPACES,
                 VALIDATION,
                 NOTIFY_BUILTIN_REFS,
                 NOTIFY_CHAR_REFS,
-                Constants.STAX_REPORT_CDATA_EVENT
+                Constants.STAX_REPORT_CDATA_EVENT                
     };
-
+    
     /** Feature defaults. */
     private static final Boolean[] FEATURE_DEFAULTS = {
                 Boolean.TRUE,
@@ -177,111 +178,112 @@
                 Boolean.FALSE,
                 Boolean.TRUE
     };
-
+    
     /** Recognized properties. */
     private static final String[] RECOGNIZED_PROPERTIES = {
         SYMBOL_TABLE,
                 ERROR_REPORTER,
                 ENTITY_MANAGER,
     };
-
+    
     /** Property defaults. */
     private static final Object[] PROPERTY_DEFAULTS = {
                 null,
                 null,
                 null,
     };
-
+    
     protected static final char [] cdata = {'[','C','D','A','T','A','['};
     protected static final char [] xmlDecl = {'<','?','x','m','l'};
     protected static final char [] endTag = {'<','/'};
     // debugging
-
+    
     /** Debug scanner state. */
     private static final boolean DEBUG_SCANNER_STATE = false;
-
+    
     /** Debug driver. */
     private static final boolean DEBUG_DISPATCHER = false;
-
+    
     /** Debug content driver scanning. */
-    protected static final boolean DEBUG_START_END_ELEMENT = false;
-
-
+    protected static final boolean DEBUG_START_END_ELEMENT = false; 
+    
+    
     /** Debug driver next */
     protected static final boolean DEBUG_NEXT = false ;
-
+    
     /** Debug driver next */
     protected static final boolean DEBUG = false;
     protected static final boolean DEBUG_COALESCE = false;
     //
     // Data
     //
-
+    
     // protected data
-
+    
     /** Document handler. */
     protected XMLDocumentHandler fDocumentHandler;
     protected int fScannerLastState ;
-
+    
     /** Entity Storage */
     protected XMLEntityStorage fEntityStore;
-
+    
     /** Entity stack. */
     protected int[] fEntityStack = new int[4];
-
+    
     /** Markup depth. */
     protected int fMarkupDepth;
-
+    
     //is the element empty
     protected boolean fEmptyElement ;
-
+    
     //track if we are reading attributes, this is usefule while
     //there is a callback
     protected boolean fReadingAttributes = false;
-
+    
     /** Scanner state. */
     protected int fScannerState;
-
+    
     /** SubScanner state: inside scanContent method. */
     protected boolean fInScanContent = false;
     protected boolean fLastSectionWasCData = false;
     protected boolean fLastSectionWasEntityReference = false;
-    protected boolean fLastSectionWasCharacterData = false;
-
+    protected boolean fLastSectionWasCharacterData = false;        
+    
     /** has external dtd */
     protected boolean fHasExternalDTD;
-
+    
     /** Standalone. */
+    protected boolean fStandaloneSet;
     protected boolean fStandalone;
     protected String fVersion;
-
+    
     // element information
-
+    
     /** Current element. */
     protected QName fCurrentElement;
-
+    
     /** Element stack. */
     protected ElementStack fElementStack = new ElementStack();
     protected ElementStack2 fElementStack2 = new ElementStack2();
-
+    
     // other info
-
+    
     /** Document system identifier.
      * REVISIT:  So what's this used for?  - NG
      * protected String fDocumentSystemId;
      ******/
-
+    
     protected String fPITarget ;
-
+    
     //xxx do we need to create an extra XMLString object... look for using fTempString for collecting all the data values
     protected XMLString fPIData  = new XMLString();
-
+    
     // features
-
-
+    
+    
     /** Notify built-in references. */
     protected boolean fNotifyBuiltInRefs = false;
-
+    
     //STAX related properties
     //defaultValues.
     protected boolean fReplaceEntityReferences = true;
@@ -291,65 +293,65 @@
     protected String fDeclaredEncoding =  null;
     /** Disallow doctype declaration. */
     protected boolean fDisallowDoctype = false;
-
+    
     // drivers
-
+    
     /** Active driver. */
     protected Driver fDriver;
-
+    
     /** Content driver. */
     protected Driver fContentDriver = createContentDriver();
-
+    
     // temporary variables
-
+    
     /** Element QName. */
     protected QName fElementQName = new QName();
-
+    
     /** Attribute QName. */
     protected QName fAttributeQName = new QName();
-
+    
     /**
      * CHANGED: Using XMLAttributesIteratorImpl instead of XMLAttributesImpl. This class
      * implements Iterator interface so we can directly give Attributes in the form of
      * iterator.
      */
     protected XMLAttributesIteratorImpl fAttributes = new XMLAttributesIteratorImpl();
-
-
+    
+    
     /** String. */
     protected XMLString fTempString = new XMLString();
-
+    
     /** String. */
     protected XMLString fTempString2 = new XMLString();
-
+    
     /** Array of 3 strings. */
     private String[] fStrings = new String[3];
-
+    
     /** Making the buffer accesible to derived class -- String buffer. */
     protected XMLStringBuffer fStringBuffer = new XMLStringBuffer();
-
+    
     /** Making the buffer accesible to derived class -- String buffer. */
     protected XMLStringBuffer fStringBuffer2 = new XMLStringBuffer();
-
+    
     /** stores character data. */
     /** Making the buffer accesible to derived class -- stores PI data */
     protected XMLStringBuffer fContentBuffer = new XMLStringBuffer();
-
+    
     /** Single character array. */
     private final char[] fSingleChar = new char[1];
     private String fCurrentEntityName = null;
-
+    
     // New members
     protected boolean fScanToEnd = false;
-
+    
     protected DTDGrammarUtil dtdGrammarUtil= null;
-
+    
     protected boolean fAddDefaultAttr = false;
-
+    
     protected boolean foundBuiltInRefs = false;
-
+    
     protected SecurityManager fSecurityManager = null;
-
+    
     //skip element algorithm
     static final short MAX_DEPTH_LIMIT = 5 ;
     static final short ELEMENT_ARRAY_LENGTH = 200 ;
@@ -366,21 +368,21 @@
     protected boolean fShouldSkip = false;
     protected boolean fAdd = false ;
     protected boolean fSkip = false;
-
+    
     /** Reusable Augmentations. */
     private Augmentations fTempAugmentations = null;
     //
     // Constructors
     //
-
+    
     /** Default constructor. */
     public XMLDocumentFragmentScannerImpl() {
     } // <init>()
-
+    
     //
     // XMLDocumentScanner methods
     //
-
+    
     /**
      * Sets the input source.
      *
@@ -393,7 +395,7 @@
         fEntityManager.startEntity("$fragment$", inputSource, false, true);
         // fDocumentSystemId = fEntityManager.expandSystemId(inputSource.getSystemId());
     } // setInputSource(XMLInputSource)
-
+    
     /**
      * Scans a document.
      *
@@ -409,22 +411,22 @@
      */
    /* public boolean scanDocument(boolean complete)
     throws IOException, XNIException {
-
+    
         // keep dispatching "events"
         fEntityManager.setEntityHandler(this);
-
+    
         return true;
-
+    
     } // scanDocument(boolean):boolean
     */
-
+    
     public boolean scanDocument(boolean complete)
     throws IOException, XNIException {
-
+        
         // keep dispatching "events"
         fEntityManager.setEntityHandler(this);
         //System.out.println(" get Document Handler in NSDocumentHandler " + fDocumentHandler );
-
+        
         int event = next();
         do {
             switch (event) {
@@ -474,49 +476,49 @@
                 case XMLStreamConstants.ATTRIBUTE :
                     break;
                 case XMLStreamConstants.END_ELEMENT :
-                    //do not give callback here.
+                    //do not give callback here. 
                     //this callback is given in scanEndElement function.
                     //fDocumentHandler.endElement(getElementQName(),null);
                     break;
                 default :
                     throw new InternalError("processing event: " + event);
-
+                    
             }
             //System.out.println("here in before calling next");
             event = next();
             //System.out.println("here in after calling next");
         } while (event!=XMLStreamConstants.END_DOCUMENT && complete);
-
-        if(event == XMLStreamConstants.END_DOCUMENT) {
+        
+        if(event == XMLStreamConstants.END_DOCUMENT) {            
             fDocumentHandler.endDocument(null);
             return false;
         }
-
+        
         return true;
-
+        
     } // scanDocument(boolean):boolean
-
-
-
+    
+    
+    
     public com.sun.org.apache.xerces.internal.xni.QName getElementQName(){
         if(fScannerLastState == XMLEvent.END_ELEMENT){
             fElementQName.setValues(fElementStack.getLastPoppedElement());
         }
         return fElementQName ;
     }
-
+    
     /** return the next state on the input
      * @return int
      */
-
+    
     public int next() throws IOException, XNIException {
         return fDriver.next();
     }
-
+    
     //
     // XMLComponent methods
     //
-
+    
     /**
      * Resets the component. The component can query the component manager
      * about any features and properties that affect the operation of the
@@ -531,18 +533,18 @@
      *                      SAXNotRecognizedException or a
      *                      SAXNotSupportedException.
      */
-
+    
     public void reset(XMLComponentManager componentManager)
     throws XMLConfigurationException {
-
+        
         super.reset(componentManager);
-
+        
         // other settings
         // fDocumentSystemId = null;
-
+                
         // sax features
         //fAttributes.setNamespaces(fNamespaces);
-
+                
         // xerces features
         try{
             fReportCdataEvent = componentManager.getFeature(Constants.STAX_REPORT_CDATA_EVENT);
@@ -551,20 +553,20 @@
             //note that default value of this feature is true in stax configuration
             fReportCdataEvent = true;
         }
-
+        
         try {
             fSecurityManager = (SecurityManager)componentManager.getProperty(Constants.SECURITY_MANAGER);
         } catch (XMLConfigurationException e) {
             fSecurityManager = null;
         }
         fElementAttributeLimit = (fSecurityManager != null)?fSecurityManager.getElementAttrLimit():0;
-
+        
         try {
             fNotifyBuiltInRefs = componentManager.getFeature(NOTIFY_BUILTIN_REFS);
         } catch (XMLConfigurationException e) {
             fNotifyBuiltInRefs = false;
         }
-
+        
         try {
             Object resolver = componentManager.getProperty(ENTITY_RESOLVER);
             fExternalSubsetResolver = (resolver instanceof ExternalSubsetResolver) ?
@@ -572,19 +574,20 @@
         } catch (XMLConfigurationException e) {
             fExternalSubsetResolver = null;
         }
-
+                        
         // initialize vars
         fMarkupDepth = 0;
         fCurrentElement = null;
         fElementStack.clear();
         fHasExternalDTD = false;
+        fStandaloneSet = false;
         fStandalone = false;
         fInScanContent = false;
         //skipping algorithm
         fShouldSkip = false;
         fAdd = false;
         fSkip = false;
-
+        
         //attribute
         fReadingAttributes = false;
         //xxx: external entities are supported in Xerces
@@ -592,28 +595,28 @@
         fSupportExternalEntities = true;
         fReplaceEntityReferences = true;
         fIsCoalesce = false;
-
+        
         // setup Driver
         setScannerState(SCANNER_STATE_CONTENT);
         setDriver(fContentDriver);
         fEntityStore = fEntityManager.getEntityStore();
-
+        
         dtdGrammarUtil = null;
-
-
+                
+        
         //fEntityManager.test();
     } // reset(XMLComponentManager)
-
-
+    
+    
     public void reset(PropertyManager propertyManager){
-
+        
         super.reset(propertyManager);
-
+        
         // other settings
         // fDocumentSystemId = null;
         fNamespaces = ((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
         fNotifyBuiltInRefs = false ;
-
+                
         // initialize vars
         fMarkupDepth = 0;
         fCurrentElement = null;
@@ -623,6 +626,7 @@
         fElementStack.clear();
         //fElementStack2.clear();
         fHasExternalDTD = false;
+        fStandaloneSet = false;
         fStandalone = false;
         //fReplaceEntityReferences = true;
         //fSupportExternalEntities = true;
@@ -646,11 +650,11 @@
         //setDriver(fContentDriver);
         fEntityStore = fEntityManager.getEntityStore();
         //fEntityManager.test();
-
+        
         dtdGrammarUtil = null;
-
+                
     } // reset(XMLComponentManager)
-
+    
     /**
      * Returns a list of feature identifiers that are recognized by
      * this component. This method may return null if no features
@@ -659,7 +663,7 @@
     public String[] getRecognizedFeatures() {
         return (String[])(RECOGNIZED_FEATURES.clone());
     } // getRecognizedFeatures():String[]
-
+    
     /**
      * Sets the state of a feature. This method is called by the component
      * manager any time after reset when a feature changes state.
@@ -677,9 +681,9 @@
      */
     public void setFeature(String featureId, boolean state)
     throws XMLConfigurationException {
-
+        
         super.setFeature(featureId, state);
-
+        
         // Xerces properties
         if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
             String feature = featureId.substring(Constants.XERCES_FEATURE_PREFIX.length());
@@ -687,9 +691,9 @@
                 fNotifyBuiltInRefs = state;
             }
         }
-
+        
     } // setFeature(String,boolean)
-
+    
     /**
      * Returns a list of property identifiers that are recognized by
      * this component. This method may return null if no properties
@@ -698,7 +702,7 @@
     public String[] getRecognizedProperties() {
         return (String[])(RECOGNIZED_PROPERTIES.clone());
     } // getRecognizedProperties():String[]
-
+    
     /**
      * Sets the value of a property. This method is called by the component
      * manager any time after reset when a property changes value.
@@ -716,9 +720,9 @@
      */
     public void setProperty(String propertyId, Object value)
     throws XMLConfigurationException {
-
+        
         super.setProperty(propertyId, value);
-
+        
         // Xerces properties
         if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
             final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
@@ -734,8 +738,8 @@
                 return;
             }
         }
-
-
+        
+        
                 // Xerces properties
         if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
             String property = propertyId.substring(Constants.XERCES_PROPERTY_PREFIX.length());
@@ -744,9 +748,9 @@
             }
             return;
         }
-
+        
     } // setProperty(String,Object)
-
+    
     /**
      * Returns the default state for a feature, or null if this
      * component does not want to report a default value for this
@@ -764,7 +768,7 @@
         }
         return null;
     } // getFeatureDefault(String):Boolean
-
+    
     /**
      * Returns the default state for a property, or null if this
      * component does not want to report a default value for this
@@ -782,11 +786,11 @@
         }
         return null;
     } // getPropertyDefault(String):Object
-
+    
     //
     // XMLDocumentSource methods
     //
-
+    
     /**
      * setDocumentHandler
      *
@@ -796,17 +800,17 @@
         fDocumentHandler = documentHandler;
         //System.out.println(" In Set DOCUMENT HANDLER" + fDocumentHandler + " scanner =" + this);
     } // setDocumentHandler(XMLDocumentHandler)
-
-
+    
+    
     /** Returns the document handler */
     public XMLDocumentHandler getDocumentHandler(){
         return fDocumentHandler;
     }
-
+    
     //
     // XMLEntityHandler methods
     //
-
+    
     /**
      * This method notifies of the start of an entity. The DTD has the
      * pseudo-name of "[dtd]" parameter entity names start with '%'; and
@@ -825,7 +829,7 @@
     public void startEntity(String name,
             XMLResourceIdentifier identifier,
             String encoding, Augmentations augs) throws XNIException {
-
+        
         // keep track of this entity before fEntityDepth is increased
         if (fEntityDepth == fEntityStack.length) {
             int[] entityarray = new int[fEntityStack.length * 2];
@@ -833,15 +837,15 @@
             fEntityStack = entityarray;
         }
         fEntityStack[fEntityDepth] = fMarkupDepth;
-
+        
         super.startEntity(name, identifier, encoding, augs);
-
+        
         // WFC:  entity declared in external subset in standalone doc
         if(fStandalone && fEntityStore.isEntityDeclInExternalSubset(name)) {
             reportFatalError("MSG_REFERENCE_TO_EXTERNALLY_DECLARED_ENTITY_WHEN_STANDALONE",
                     new Object[]{name});
         }
-
+        
         /** we are not calling the handlers yet.. */
         // call handler
         if (fDocumentHandler != null && !fScanningAttribute) {
@@ -849,9 +853,9 @@
                 fDocumentHandler.startGeneralEntity(name, identifier, encoding, null);
             }
         }
-
+        
     } // startEntity(String,XMLResourceIdentifier,String)
-
+    
     /**
      * This method notifies the end of an entity. The DTD has the pseudo-name
      * of "[dtd]" parameter entity names start with '%'; and general entities
@@ -862,7 +866,7 @@
      * @throws XNIException Thrown by handler to signal an error.
      */
     public void endEntity(String name, Augmentations augs) throws IOException, XNIException {
-
+        
         /**
          * // flush possible pending output buffer - see scanContent
          * if (fInScanContent && fStringBuffer.length != 0
@@ -872,12 +876,12 @@
          * }
          */
         super.endEntity(name, augs);
-
+        
         // make sure markup is properly balanced
         if (fMarkupDepth != fEntityStack[fEntityDepth]) {
             reportFatalError("MarkupEntityMismatch", null);
         }
-
+        
         /**/
         // call handler
         if (fDocumentHandler != null && !fScanningAttribute) {
@@ -885,23 +889,23 @@
                 fDocumentHandler.endGeneralEntity(name, null);
             }
         }
-
-
+        
+        
     } // endEntity(String)
-
+    
     //
     // Protected methods
     //
-
+    
     // Driver factory methods
-
+    
     /** Creates a content Driver. */
     protected Driver createContentDriver() {
         return new FragmentContentDriver();
     } // createContentDriver():Driver
-
+    
     // scanning methods
-
+    
     /**
      * Scans an XML or text declaration.
      * <p>
@@ -922,23 +926,24 @@
      */
     protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl)
     throws IOException, XNIException {
-
+        
         // scan decl
         super.scanXMLDeclOrTextDecl(scanningTextDecl, fStrings);
         fMarkupDepth--;
-
+        
         // pseudo-attribute values
         String version = fStrings[0];
         String encoding = fStrings[1];
         String standalone = fStrings[2];
         fDeclaredEncoding = encoding;
         // set standalone
-        fStandalone = standalone != null && standalone.equals("yes");
+        fStandaloneSet = standalone != null;
+        fStandalone = fStandaloneSet && standalone.equals("yes");
         ///xxx see where its used.. this is not used anywhere. it may be useful for entity to store this information
         //but this information is only related with Document Entity.
         fEntityManager.setStandalone(fStandalone);
-
-
+        
+        
         // call handler
         if (fDocumentHandler != null) {
             if (scanningTextDecl) {
@@ -947,7 +952,7 @@
                 fDocumentHandler.xmlDecl(version, encoding, standalone, null);
             }
         }
-
+       
         if(version != null){
             fEntityScanner.setVersion(version);
             fEntityScanner.setXMLVersion(version);
@@ -956,17 +961,17 @@
         if (encoding != null && !fEntityScanner.getCurrentEntity().isEncodingExternallySpecified()) {
              fEntityScanner.setEncoding(encoding);
         }
-
+        
     } // scanXMLDeclOrTextDecl(boolean)
-
+    
     public String getPITarget(){
         return fPITarget ;
     }
-
+    
     public XMLStringBuffer getPIData(){
         return fContentBuffer ;
     }
-
+    
     //XXX: why not this function behave as per the state of the parser?
     public XMLString getCharacterData(){
         if(fUsebuffer){
@@ -974,10 +979,10 @@
         }else{
             return fTempString;
         }
-
+        
     }
-
-
+    
+    
     /**
      * Scans a processing data. This is needed to handle the situation
      * where a document starts with a processing instruction whose
@@ -988,16 +993,16 @@
      */
     protected void scanPIData(String target, XMLStringBuffer data)
     throws IOException, XNIException {
-
+        
         super.scanPIData(target, data);
-
+        
         //set the PI target and values
         fPITarget = target ;
-
+        
         fMarkupDepth--;
-
+        
     } // scanPIData(String)
-
+    
     /**
      * Scans a comment.
      * <p>
@@ -1013,20 +1018,20 @@
         //getTextCharacters can also be called for reading comments
         fUsebuffer = true;
         fMarkupDepth--;
-
+        
     } // scanComment()
-
+    
     //xxx value returned by this function may not remain valid if another event is scanned.
     public String getComment(){
         return fContentBuffer.toString();
     }
-
+    
     void addElement(String rawname){
         if(fElementPointer < ELEMENT_ARRAY_LENGTH){
             //storing element raw name in a linear list of array
             fElementArray[fElementPointer] = rawname ;
             //storing elemnetPointer for particular element depth
-
+            
             if(DEBUG_SKIP_ALGORITHM){
                 StringBuffer sb = new StringBuffer() ;
                 sb.append(" Storing element information ") ;
@@ -1035,7 +1040,7 @@
                 sb.append(" fElementStack.fDepth = " + fElementStack.fDepth);
                 System.out.println(sb.toString()) ;
             }
-
+            
             //store pointer information only when element depth is less MAX_DEPTH_LIMIT
             if(fElementStack.fDepth < MAX_DEPTH_LIMIT){
                 short column = storePointerForADepth(fElementPointer);
@@ -1058,20 +1063,20 @@
             fElementPointer++ ;
         }
     }
-
-
+    
+    
     void resetPointer(short depth, short column){
         fPointerInfo[depth] [column] = (short)0;
     }
-
+    
     //returns column information at which pointer was stored.
     short storePointerForADepth(short elementPointer){
         short depth = (short) fElementStack.fDepth ;
-
+        
         //Stores element pointer locations at particular depth , only 4 pointer locations
         //are stored at particular depth for now.
         for(short i = 0 ; i < MAX_POINTER_AT_A_DEPTH ; i++){
-
+            
             if(canStore(depth, i)){
                 fPointerInfo[depth][i] = elementPointer ;
                 if(DEBUG_SKIP_ALGORITHM){
@@ -1089,22 +1094,22 @@
         }
         return -1 ;
     }
-
+    
     boolean canStore(short depth, short column){
         //colum = 0 , means first element at particular depth
         //column = 1, means second element at particular depth
         //        calle should make sure that it doesn't call for value outside allowed co-ordinates
         return fPointerInfo[depth][column] == 0 ? true : false ;
     }
-
-
+    
+    
     short getElementPointer(short depth, short column){
         //colum = 0 , means first element at particular depth
         //column = 1, means second element at particular depth
         //        calle should make sure that it doesn't call for value outside allowed co-ordinates
         return fPointerInfo[depth][column] ;
     }
-
+    
     //this function assumes that string passed is not null and skips
     //the following string from the buffer this makes sure
     boolean skipFromTheBuffer(String rawname) throws IOException{
@@ -1121,9 +1126,9 @@
         } else
             return false ;
     }
-
+            
     boolean skipQElement(String rawname) throws IOException{
-
+        
         final int c = fEntityScanner.getChar(rawname.length());
         //if this character is still valid element name -- this means string can't match
         if(XMLChar.isName(c)){
@@ -1132,11 +1137,11 @@
             return fEntityScanner.skipString(rawname);
         }
     }
-
+    
     protected boolean skipElement() throws IOException {
-
+        
         if(!fShouldSkip) return false ;
-
+        
         if(fLastPointerLocation != 0){
             //Look at the next element stored in the array list.. we might just get a match.
             String rawname = fElementArray[fLastPointerLocation + 1] ;
@@ -1149,7 +1154,7 @@
             } else{
                 //reset it back to zero... we haven't got the correct subset yet.
                 fLastPointerLocation = 0 ;
-
+                
             }
         }
         //xxx: we can put some logic here as from what column it should start looking
@@ -1157,23 +1162,23 @@
         //fallback to tolerant algorithm, it would look for differnt element stored at different
         //depth and get us the pointer location.
         return fShouldSkip && skipElement((short)0);
-
+        
     }
-
+    
     //start of the column at which it should try searching
     boolean skipElement(short column) throws IOException {
         short depth = (short)fElementStack.fDepth ;
-
+        
         if(depth > MAX_DEPTH_LIMIT){
             return fShouldSkip = false ;
         }
         for(short i = column ; i < MAX_POINTER_AT_A_DEPTH ; i++){
             short pointer = getElementPointer(depth , i ) ;
-
+            
             if(pointer == 0){
                 return fShouldSkip = false ;
             }
-
+            
             if(fElementArray[pointer] != null && skipFromTheBuffer(fElementArray[pointer])){
                 if(DEBUG_SKIP_ALGORITHM){
                     System.out.println();
@@ -1186,7 +1191,7 @@
         }
         return fShouldSkip = false ;
     }
-
+    
     /**
      * Scans a start element. This method will handle the binding of
      * namespace information and notifying the handler of the start
@@ -1213,22 +1218,22 @@
     // fAttributes will have the details of all the attributes.
     protected boolean scanStartElement()
     throws IOException, XNIException {
-
+        
         if (DEBUG_START_END_ELEMENT) System.out.println( this.getClass().toString() + ">>> scanStartElement()");
         //when skipping is true and no more elements should be added
         if(fSkip && !fAdd){
             //get the stored element -- if everything goes right this should match the
             //token in the buffer
-
+            
             QName name = fElementStack.getNext();
-
+            
             if(DEBUG_SKIP_ALGORITHM){
                 System.out.println("Trying to skip String = " + name.rawname);
             }
-
+            
             //Be conservative -- if skipping fails -- stop.
             fSkip = fEntityScanner.skipString(name.rawname);
-
+                        
             if(fSkip){
                 if(DEBUG_SKIP_ALGORITHM){
                     System.out.println("Element SUCESSFULLY skipped = " + name.rawname);
@@ -1243,7 +1248,7 @@
                 }
             }
         }
-
+        
         //we are still at the stage of adding elements
         //the elements were not matched or
         //fSkip is not set to true
@@ -1257,32 +1262,32 @@
                 String name = fEntityScanner.scanName();
                 fElementQName.setValues(null, name, name, null);
             }
-
+            
             if(DEBUG)System.out.println("Element scanned in start element is " + fElementQName.toString());
             if(DEBUG_SKIP_ALGORITHM){
                 if(fAdd){
                     System.out.println("Elements are being ADDED -- elemet added is = " + fElementQName.rawname + " at count = " + fElementStack.fCount);
                 }
             }
-
+            
         }
-
+        
         //when the elements are being added , we need to check if we are set for skipping the elements
         if(fAdd){
             //this sets the value of fAdd variable
             fElementStack.matchElement(fElementQName);
         }
-
-
+        
+        
         //xxx: We dont need another pointer, fCurrentElement, we can use fElementQName
         fCurrentElement = fElementQName;
-
+                
         String rawname = fElementQName.rawname;
-
+        
         fEmptyElement = false;
-
+        
         fAttributes.removeAllAttributes();
-
+        
         if(!seekCloseOfStartTag()){
             fReadingAttributes = true;
             fAttributeCacheUsedCount =0;
@@ -1290,21 +1295,21 @@
             fAddDefaultAttr = true;
             do {
                 scanAttribute(fAttributes);
-                if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){
+                if (fSecurityManager != null && fAttributes.getLength() > fElementAttributeLimit){  
                     fErrorReporter.reportError(XMLMessageFormatter.XML_DOMAIN,
                                                  "ElementAttributeLimit",
                                                  new Object[]{rawname, new Integer(fAttributes.getLength()) },
                                                  XMLErrorReporter.SEVERITY_FATAL_ERROR );
                 }
-
+                
             } while (!seekCloseOfStartTag());
             fReadingAttributes=false;
         }
-
+        
         if (fEmptyElement) {
             //decrease the markup depth..
             fMarkupDepth--;
-
+            
             // check that this element was opened in the same entity
             if (fMarkupDepth < fEntityStack[fEntityDepth - 1]) {
                 reportFatalError("ElementEntityMismatch",
@@ -1314,32 +1319,32 @@
             if (fDocumentHandler != null) {
                 fDocumentHandler.emptyElement(fElementQName, fAttributes, null);
             }
-
+            
             //We should not be popping out the context here in endELement becaause the namespace context is still
-            //valid when parser is at the endElement state.
+            //valid when parser is at the endElement state.            
             //if (fNamespaces) {
             //  fNamespaceContext.popContext();
             //}
-
+            
             //pop the element off the stack..
             fElementStack.popElement();
-
+            
         } else {
-
+            
             if(dtdGrammarUtil != null)
-                dtdGrammarUtil.startElement(fElementQName, fAttributes);
+                dtdGrammarUtil.startElement(fElementQName, fAttributes); 
             if(fDocumentHandler != null){
                 //complete element and attributes are traversed in this function so we can send a callback
                 //here.
-                //<strong>we shouldn't be sending callback in scanDocument()</strong>
+                //<strong>we shouldn't be sending callback in scanDocument()</strong>                                
                 fDocumentHandler.startElement(fElementQName, fAttributes, null);
             }
         }
-
-
+        
+        
         if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() + "<<< scanStartElement(): "+fEmptyElement);
         return fEmptyElement;
-
+        
     } // scanStartElement():boolean
 
     /**
@@ -1349,7 +1354,7 @@
     protected boolean seekCloseOfStartTag() throws IOException, XNIException {
         // spaces
         boolean sawSpace = fEntityScanner.skipSpaces();
-
+        
         // end tag?
         final int c = fEntityScanner.peekChar();
         if (c == '>') {
@@ -1366,15 +1371,15 @@
         } else if (!isValidNameStartChar(c) || !sawSpace) {
             reportFatalError("ElementUnterminated", new Object[]{fElementQName.rawname});
         }
-
+        
         return false;
     }
-
+    
     public boolean hasAttributes(){
         return fAttributes.getLength() > 0 ? true : false ;
     }
-
-
+    
+    
     /**
      * Scans an attribute.
      * <p>
@@ -1392,7 +1397,7 @@
      *
      * @param attributes The attributes list for the scanned attribute.
      */
-
+    
     /**
      * protected void scanAttribute(AttributeIteratorImpl attributes)
      * throws IOException, XNIException {
@@ -1430,25 +1435,25 @@
      * fAttributeQName.rawname});
      * }
      */
-
+    
     /*
         //REVISIT: one more case needs to be included: external PE and standalone is no
         boolean isVC =  fHasExternalDTD && !fStandalone;
         scanAttributeValue(fTempString, fTempString2,
                            fAttributeQName.rawname, attributes,
                            oldLen, isVC);
-
+     
         //attributes.setValue(oldLen, fTempString.toString());
         //attributes.setNonNormalizedValue(oldLen, fTempString2.toString());
         //attributes.setSpecified(oldLen, true);
-
+     
         AttributeImpl attribute = new AttributeImpl(fAttributeQName.prefix,fAttributeQName.localpart,fAttributeQName.uri,fTempString.toString(),fTempString2.toString(),XMLSymbols.fCDATASymbol,true);
         fAttributes.addAttribute(attribute);
         if (DEBUG_START_END_ELEMENT) System.out.println("<<< scanAttribute()");
     } // scanAttribute(XMLAttributes)
-
+     
      */
-
+    
     /** return the attribute iterator implementation */
     public XMLAttributesIteratorImpl getAttributeIterator(){
         if(dtdGrammarUtil != null && fAddDefaultAttr){
@@ -1457,7 +1462,11 @@
         }
         return fAttributes;
     }
-
+    
+    /** return if standalone is set */
+    public boolean standaloneSet(){
+        return fStandaloneSet;
+    }
     /** return if the doucment is standalone */
     public boolean isStandAlone(){
         return fStandalone ;
@@ -1479,11 +1488,11 @@
      *
      * @param attributes The attributes list for the scanned attribute.
      */
-
+    
     protected void scanAttribute(XMLAttributes attributes)
     throws IOException, XNIException {
         if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanAttribute()");
-
+        
         // name
         if (fNamespaces) {
             fEntityScanner.scanQName(fAttributeQName);
@@ -1491,7 +1500,7 @@
             String name = fEntityScanner.scanName();
             fAttributeQName.setValues(null, name, name, null);
         }
-
+        
         // equals
         fEntityScanner.skipSpaces();
         if (!fEntityScanner.skipChar('=')) {
@@ -1499,19 +1508,19 @@
                 new Object[] {fCurrentElement.rawname, fAttributeQName.rawname});
         }
         fEntityScanner.skipSpaces();
-
+        
         int attIndex = 0 ;
         //REVISIT: one more case needs to be included: external PE and standalone is no
         boolean isVC =  fHasExternalDTD && !fStandalone;
         //fTempString would store attribute value
         ///fTempString2 would store attribute non-normalized value
-
+        
         //this function doesn't use 'attIndex'. We are adding the attribute later
         //after we have figured out that current attribute is not namespace declaration
         //since scanAttributeValue doesn't use attIndex parameter therefore we
         //can safely add the attribute later..
         XMLString tmpStr = getString();
-
+        
         scanAttributeValue(tmpStr, fTempString2,
                 fAttributeQName.rawname, attributes,
                 attIndex, isVC);
@@ -1520,7 +1529,7 @@
         int oldLen = attributes.getLength();
         //if the attribute name already exists.. new value is replaced with old value
         attIndex = attributes.addAttribute(fAttributeQName, XMLSymbols.fCDATASymbol, null);
-
+        
         // WFC: Unique Att Spec
         //attributes count will be same if the current attribute  name already exists for this element name.
         //this means there are two duplicate attributes.
@@ -1529,7 +1538,7 @@
                     new Object[]{fCurrentElement.rawname,
                             fAttributeQName.rawname});
         }
-
+        
         //tmpString contains attribute value
         //we are passing null as the attribute value
         attributes.setValue(attIndex, null, tmpStr);
@@ -1537,11 +1546,11 @@
         ///xxx: nonNormalizedValue is not being set as it is not required by SAX & DOM
         //attributes.setNonNormalizedValue(oldLen, fTempString2.toString());
         attributes.setSpecified(attIndex, true);
-
+        
         if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +"<<< scanAttribute()");
-
+        
     } // scanAttribute(XMLAttributes)
-
+    
     /**
      * Scans element content.
      *
@@ -1593,10 +1602,10 @@
             //fDocumentHandler.characters(content, null);
         }
         return c;
-
+        
     } // scanContent():int
-
-
+    
+    
     /**
      * Scans a CDATA section.
      * <p>
@@ -1611,12 +1620,12 @@
     //CHANGED:
     protected boolean scanCDATASection(XMLStringBuffer contentBuffer, boolean complete)
     throws IOException, XNIException {
-
+        
         // call handler
         if (fDocumentHandler != null) {
             //fDocumentHandler.startCDATA(null);
         }
-
+        
         while (true) {
             //scanData will fill the contentBuffer
             if (!fEntityScanner.scanData("]]>", contentBuffer)) {
@@ -1667,20 +1676,20 @@
             }
         }
         fMarkupDepth--;
-
+        
         if (fDocumentHandler != null && contentBuffer.length > 0) {
             //fDocumentHandler.characters(contentBuffer, null);
         }
-
+        
         // call handler
         if (fDocumentHandler != null) {
             //fDocumentHandler.endCDATA(null);
         }
-
+        
         return true;
-
+        
     } // scanCDATASection(XMLStringBuffer, boolean):boolean
-
+    
     /**
      * Scans an end element.
      * <p>
@@ -1697,26 +1706,26 @@
      */
     protected int scanEndElement() throws IOException, XNIException {
         if (DEBUG_START_END_ELEMENT) System.out.println(this.getClass().toString() +">>> scanEndElement()");
-
+        
         // pop context
         QName endElementName = fElementStack.popElement();
-
+        
         String rawname = endElementName.rawname;
         if(DEBUG)System.out.println("endElementName = " + endElementName.toString());
         // Take advantage of the fact that next string _should_ be "fElementQName.rawName",
         //In scanners most of the time is consumed on checks done for XML characters, we can
         // optimize on it and avoid the checks done for endElement,
         //we will also avoid symbol table lookup - neeraj.bajaj@sun.com
-
+        
         // this should work both for namespace processing true or false...
-
+        
         //REVISIT: if the string is not the same as expected.. we need to do better error handling..
         //We can skip this for now... In any case if the string doesn't match -- document is not well formed.
-
+        
         if (!fEntityScanner.skipString(endElementName.rawname)) {
              reportFatalError("ETagRequired", new Object[]{rawname});
         }
-
+        
         // end
         fEntityScanner.skipSpaces();
         if (!fEntityScanner.skipChar('>')) {
@@ -1724,38 +1733,38 @@
                     new Object[]{rawname});
         }
         fMarkupDepth--;
-
+        
         //we have increased the depth for two markup "<" characters
         fMarkupDepth--;
-
+        
         // check that this element was opened in the same entity
         if (fMarkupDepth < fEntityStack[fEntityDepth - 1]) {
             reportFatalError("ElementEntityMismatch",
                     new Object[]{rawname});
         }
-
+        
         //We should not be popping out the context here in endELement becaause the namespace context is still
         //valid when parser is at the endElement state.
-
+        
         //if (fNamespaces) {
         //  fNamespaceContext.popContext();
         //}
-
+        
         // call handler
-        if (fDocumentHandler != null ) {
+        if (fDocumentHandler != null ) {            
             //end element is scanned in this function so we can send a callback
             //here.
-            //<strong>we shouldn't be sending callback in scanDocument()</strong>
-
+            //<strong>we shouldn't be sending callback in scanDocument()</strong>                
+            
             fDocumentHandler.endElement(endElementName, null);
         }
         if(dtdGrammarUtil != null)
             dtdGrammarUtil.endElement(endElementName);
-
+        
         return fMarkupDepth;
-
+        
     } // scanEndElement():int
-
+    
     /**
      * Scans a character reference.
      * <p>
@@ -1765,20 +1774,20 @@
      */
     protected void scanCharReference()
     throws IOException, XNIException {
-
+        
         fStringBuffer2.clear();
         int ch = scanCharReferenceValue(fStringBuffer2, null);
         fMarkupDepth--;
         if (ch != -1) {
             // call handler
-
+            
             if (fDocumentHandler != null) {
                 if (fNotifyCharRefs) {
                     fDocumentHandler.startGeneralEntity(fCharRefLiteral, null, null, null);
                 }
                 Augmentations augs = null;
                 if (fValidation && ch <= 0x20) {
-                    if (fTempAugmentations != null) {
+                    if (fTempAugmentations != null) { 
                         fTempAugmentations.removeAllItems();
                     }
                     else {
@@ -1795,10 +1804,10 @@
                 }
             }
         }
-
+        
     } // scanCharReference()
-
-
+    
+    
     /**
      * Scans an entity reference.
      *
@@ -1821,7 +1830,7 @@
         }
         fMarkupDepth--;
         fCurrentEntityName = name;
-
+        
         // handle built-in entities
         if (name == fAmpSymbol) {
             handleCharacter('&', fAmpSymbol, content);
@@ -1844,7 +1853,7 @@
             fScannerState = SCANNER_STATE_BUILT_IN_REFS;
             return ;
         }
-
+        
         //1. if the entity is external and support to external entities is not required
         // 2. or entities should not be replaced
         //3. or if it is built in entity reference.
@@ -1876,9 +1885,9 @@
         //setScannerState(SCANNER_STATE_CONTENT);
         //return true ;
     } // scanEntityReference()
-
+    
     // utility methods
-
+    
     /**
      * Calls document handler with a single character resulting from
      * built-in entity resolution.
@@ -1902,22 +1911,22 @@
             }
             fTempString.setValues(fSingleChar, 0, 1);
             //fDocumentHandler.characters(fTempString, null);
-
+            
             if (fNotifyBuiltInRefs) {
                 fDocumentHandler.endGeneralEntity(entity, null);
             }
         }
     } // handleCharacter(char)
-
+    
     // helper methods
-
+    
     /**
      * Sets the scanner state.
      *
      * @param state The new scanner state.
      */
     protected final void setScannerState(int state) {
-
+        
         fScannerState = state;
         if (DEBUG_SCANNER_STATE) {
             System.out.print("### setScannerState: ");
@@ -1925,10 +1934,10 @@
             System.out.print(getScannerStateName(state));
             System.out.println();
         }
-
+        
     } // setScannerState(int)
-
-
+    
+    
     /**
      * Sets the Driver.
      *
@@ -1942,14 +1951,14 @@
             System.out.println();
         }
     }
-
+    
     //
     // Private methods
     //
-
+    
     /** Returns the scanner state name. */
     protected String getScannerStateName(int state) {
-
+        
         switch (state) {
             case SCANNER_STATE_DOCTYPE: return "SCANNER_STATE_DOCTYPE";
             case SCANNER_STATE_ROOT_ELEMENT: return "SCANNER_STATE_ROOT_ELEMENT";
@@ -1968,18 +1977,18 @@
             case SCANNER_STATE_END_ELEMENT_TAG: return "SCANNER_STATE_END_ELEMENT_TAG";
             case SCANNER_STATE_CHARACTER_DATA: return "SCANNER_STATE_CHARACTER_DATA" ;
         }
-
+        
         return "??? ("+state+')';
-
+        
     } // getScannerStateName(int):String
     public String getEntityName(){
         //return the cached name
         return fCurrentEntityName;
     }
-
+    
     /** Returns the driver name. */
     public String getDriverName(Driver driver) {
-
+        
         if (DEBUG_DISPATCHER) {
             if (driver != null) {
                 String name = driver.getClass().getName();
@@ -1995,35 +2004,35 @@
             }
         }
         return "null";
-
+        
     } // getDriverName():String
-
+    
     //
     // Classes
     //
-
+    
     /**
      * @author Neeraj Bajaj, Sun Microsystems.
      */
     protected static final class Element {
-
+        
         //
         // Data
         //
-
+        
         /** Symbol. */
         public QName qname;
-
+        
         //raw name stored as characters
         public char[] fRawname;
-
+        
         /** The next Element entry. */
         public Element next;
-
+        
         //
         // Constructors
         //
-
+        
         /**
          * Constructs a new Element from the given QName and next Element
          * reference.
@@ -2033,23 +2042,23 @@
             this.fRawname = qname.rawname.toCharArray();
             this.next = next;
         }
-
+        
     } // class Element
-
+    
     /**
      * Element stack.
      *
      * @author Neeraj Bajaj, Sun Microsystems.
      */
     protected class ElementStack2 {
-
+        
         //
         // Data
         //
-
+        
         /** The stack data. */
         protected QName [] fQName = new QName[20];
-
+        
         //Element depth
         protected int fDepth;
         //total number of elements
@@ -2058,13 +2067,13 @@
         protected int fPosition;
         //Mark refers to the position
         protected int fMark;
-
+        
         protected int fLastDepth ;
-
+        
         //
         // Constructors
         //
-
+        
         /** Default constructor. */
         public ElementStack2() {
             for (int i = 0; i < fQName.length; i++) {
@@ -2072,7 +2081,7 @@
             }
             fMark = fPosition = 1;
         } // <init>()
-
+        
         public void resize(){
             /**
              * int length = fElements.length;
@@ -2085,18 +2094,18 @@
             QName [] tmp = new QName[oldLength * 2];
             System.arraycopy(fQName, 0, tmp, 0, oldLength);
             fQName = tmp;
-
+            
             for (int i = oldLength; i < fQName.length; i++) {
                 fQName[i] = new QName();
             }
-
+            
         }
-
-
+        
+        
         //
         // Public methods
         //
-
+        
         /** Check if the element scanned during the start element
          *matches the stored element.
          *
@@ -2140,7 +2149,7 @@
             fLastDepth = fDepth++;
             return match;
         } // pushElement(QName):QName
-
+        
         /**
          * This function doesn't increase depth. The function in this function is
          *broken down into two functions for efficiency. <@see>matchElement</see>.
@@ -2149,7 +2158,7 @@
          *@return QName reference to the next element in the list
          */
         public QName nextElement() {
-
+            
             //if number of elements becomes equal to the length of array -- stop the skipping
             if (fCount == fQName.length) {
                 fShouldSkip = false;
@@ -2163,9 +2172,9 @@
                 System.out.println("fCount = " + fCount);
             }
             return fQName[fCount++];
-
+            
         }
-
+        
         /** Note that this function is considerably different than nextElement()
          * This function just returns the previously stored elements
          */
@@ -2177,14 +2186,14 @@
             }
             return fQName[fPosition++];
         }
-
+        
         /** returns the current depth
          */
         public int popElement(){
             return fDepth--;
         }
-
-
+        
+        
         /** Clears the stack without throwing away existing QName objects. */
         public void clear() {
             fLastDepth = 0;
@@ -2192,9 +2201,9 @@
             fCount = 0 ;
             fPosition = fMark = 1;
         } // clear()
-
+        
     } // class ElementStack
-
+    
     /**
      * Element stack. This stack operates without synchronization, error
      * checking, and it re-uses objects instead of throwing popped items
@@ -2203,16 +2212,16 @@
      * @author Andy Clark, IBM
      */
     protected class ElementStack {
-
+        
         //
         // Data
         //
-
+        
         /** The stack data. */
         protected QName[] fElements;
         protected int []  fInt = new int[20];
-
-
+        
+        
         //Element depth
         protected int fDepth;
         //total number of elements
@@ -2221,13 +2230,13 @@
         protected int fPosition;
         //Mark refers to the position
         protected int fMark;
-
+        
         protected int fLastDepth ;
-
+        
         //
         // Constructors
         //
-
+        
         /** Default constructor. */
         public ElementStack() {
             fElements = new QName[20];
@@ -2235,11 +2244,11 @@
                 fElements[i] = new QName();
             }
         } // <init>()
-
+        
         //
         // Public methods
         //
-
+        
         /**
          * Pushes an element on the stack.
          * <p>
@@ -2266,8 +2275,8 @@
             fElements[fDepth].setValues(element);
             return fElements[fDepth++];
         } // pushElement(QName):QName
-
-
+        
+        
         /** Note that this function is considerably different than nextElement()
          * This function just returns the previously stored elements
          */
@@ -2285,17 +2294,17 @@
             //return fElements[fPosition++];
             return fElements[fPosition];
         }
-
+        
         /** This function should be called only when element was skipped sucessfully.
          * 1. Increase the depth - because element was sucessfully skipped.
          *2. Store the position of the element token in array  "last opened tag" at depth.
          *3. increase the position counter so as to point to the next element in the array
          */
         public void push(){
-
+            
             fInt[++fDepth] = fPosition++;
         }
-
+        
         /** Check if the element scanned during the start element
          *matches the stored element.
          *
@@ -2353,7 +2362,7 @@
                 //sicne fInt[fDepth] contains pointer to the element array which are 0 based.
                 fInt[fDepth] = fCount - 1;
             }
-
+            
             //if number of elements becomes equal to the length of array -- stop the skipping
             //xxx: should we do "fCount == fInt.length"
             if (fCount == fElements.length) {
@@ -2380,8 +2389,8 @@
             fLastDepth = fDepth;
             return match;
         } // matchElement(QName):QName
-
-
+        
+        
         /**
          * Returns the next element on the stack.
          *
@@ -2401,12 +2410,12 @@
                     fElements[i] = new QName();
                 }
             }
-
+            
             return fElements[fDepth++];
-
+            
         } // pushElement(QName):QName
-
-
+        
+        
         /**
          * Pops an element off of the stack by setting the values of
          * the specified QName.
@@ -2433,7 +2442,7 @@
             }
             //element.setValues(fElements[--fDepth]);
         } // popElement(QName)
-
+        
         /** Reposition the stack. fInt [] contains all the opened tags at particular depth.
          * Transfer all the opened tags starting from depth '2' to the current depth and reposition them
          *as per the depth.
@@ -2448,16 +2457,16 @@
                 }
             }
         }
-
+        
         /** Clears the stack without throwing away existing QName objects. */
         public void clear() {
             fDepth = 0;
             fLastDepth = 0;
             fCount = 0 ;
             fPosition = fMark = 1;
-
+            
         } // clear()
-
+        
         /**
          * This function is as a result of optimization done for endElement --
          * we dont need to set the value for every end element encouterd.
@@ -2465,12 +2474,12 @@
          * the values will be set only if application need to know about the endElement
          * -- neeraj.bajaj@sun.com
          */
-
+        
         public QName getLastPoppedElement(){
             return fElements[fDepth];
         }
     } // class ElementStack
-
+    
     /**
      * Drives the parser to the next state/event on the input. Parser is guaranteed
      * to stop at the next state/event.
@@ -2486,8 +2495,8 @@
      * @author Neeraj Bajaj, Sun Microsystems
      */
     protected interface Driver {
-
-
+        
+        
         /**
          * Drives the parser to the next state/event on the input. Parser is guaranteed
          * to stop at the next state/event.
@@ -2504,11 +2513,11 @@
          * @throws IOException  Thrown on i/o error.
          * @throws XNIException Thrown on parse error.
          */
-
+        
         public int next() throws IOException, XNIException;
-
+        
     } // interface Driver
-
+    
     /**
      * Driver to handle content scanning. This driver is capable of reading
      * the fragment of XML document. When it has finished reading fragment
@@ -2526,20 +2535,20 @@
      */
     protected class FragmentContentDriver
             implements Driver {
-
+        
         //
         // Driver methods
         //
         private boolean fContinueDispatching = true;
         private boolean fScanningForMarkup = true;
-
+        
         /**
          *  decides the appropriate state of the parser
          */
         private void startOfMarkup() throws IOException {
             fMarkupDepth++;
             final int ch = fEntityScanner.peekChar();
-
+            
             switch(ch){
                 case '?' :{
                     setScannerState(SCANNER_STATE_PI);
@@ -2576,9 +2585,9 @@
                     }
                 }
             }
-
+            
         }//startOfMarkup
-
+        
         private void startOfContent() throws IOException {
             if (fEntityScanner.skipChar('<')) {
                 setScannerState(SCANNER_STATE_START_OF_MARKUP);
@@ -2589,8 +2598,8 @@
                 setScannerState(SCANNER_STATE_CHARACTER_DATA);
             }
         }//startOfContent
-
-
+        
+        
         /**
          *
          * SCANNER_STATE_CONTENT and SCANNER_STATE_START_OF_MARKUP are two super states of the parser.
@@ -2606,14 +2615,14 @@
          */
         public void decideSubState() throws IOException {
             while( fScannerState == SCANNER_STATE_CONTENT || fScannerState == SCANNER_STATE_START_OF_MARKUP){
-
+                
                 switch (fScannerState) {
-
+                    
                     case SCANNER_STATE_CONTENT: {
                         startOfContent() ;
                         break;
                     }
-
+                    
                     case SCANNER_STATE_START_OF_MARKUP: {
                         startOfMarkup() ;
                         break;
@@ -2621,7 +2630,7 @@
                 }
             }
         }//decideSubState
-
+        
         /**
          * Drives the parser to the next state/event on the input. Parser is guaranteed
          * to stop at the next state/event. Internally XML document
@@ -2639,17 +2648,17 @@
          * @throws IOException  Thrown on i/o error.
          * @throws XNIException Thrown on parse error.
          */
-
+        
         public int next() throws IOException, XNIException {
             try {
                 if(DEBUG_NEXT){
                     System.out.println("NOW IN FragmentContentDriver");
                     System.out.println("Entering the FragmentContentDriver with = " + getScannerStateName(fScannerState));
                 }
-
+                
                 //decide the actual sub state of the scanner.For more information refer to the javadoc of
                 //decideSubState.
-
+                
                 switch (fScannerState) {
                     case SCANNER_STATE_CONTENT: {
                         final int ch = fEntityScanner.peekChar();
@@ -2666,21 +2675,21 @@
                             break;
                         }
                     }
-
+                    
                     case SCANNER_STATE_START_OF_MARKUP: {
                         startOfMarkup();
                         break;
                     }//case: SCANNER_STATE_START_OF_MARKUP
-
+                    
                 }//end of switch
                 //decideSubState() ;
-
+                
                 //do some special handling if isCoalesce is set to true.
                 if(fIsCoalesce){
                     fUsebuffer = true ;
                     //if the last section was character data
                     if(fLastSectionWasCharacterData){
-
+                        
                         //if we dont encounter any CDATA or ENITY REFERENCE and current state is also not SCANNER_STATE_CHARACTER_DATA
                         //return the last scanned charactrer data.
                         if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
@@ -2698,26 +2707,26 @@
                         //return the CHARACTERS event.
                         if((fScannerState != SCANNER_STATE_CDATA) && (fScannerState != SCANNER_STATE_REFERENCE)
                         && (fScannerState != SCANNER_STATE_CHARACTER_DATA)){
-
+                            
                             fLastSectionWasCData = false;
                             fLastSectionWasEntityReference = false;
                             return XMLEvent.CHARACTERS;
                         }
                     }
                 }
-
-
+                
+                
                 if(DEBUG_NEXT){
                     System.out.println("Actual scanner state set by decideSubState is = " + getScannerStateName(fScannerState));
                 }
-
+                
                 switch(fScannerState){
-
+                    
                     case XMLEvent.START_DOCUMENT :
                         return XMLEvent.START_DOCUMENT;
-
+                        
                     case SCANNER_STATE_START_ELEMENT_TAG :{
-
+                        
                         //xxx this function returns true when element is empty.. can be linked to end element event.
                         //returns true if the element is empty
                         fEmptyElement = scanStartElement() ;
@@ -2730,7 +2739,7 @@
                         }
                         return XMLEvent.START_ELEMENT ;
                     }
-
+                    
                     case SCANNER_STATE_CHARACTER_DATA: {
                         if(DEBUG_COALESCE){
                             System.out.println("fLastSectionWasCData = " + fLastSectionWasCData);
@@ -2738,7 +2747,7 @@
                         }
                         //if last section was either entity reference or cdata or character data we should be using buffer
                         fUsebuffer = fLastSectionWasEntityReference || fLastSectionWasCData || fLastSectionWasCharacterData ;
-
+                        
                         //When coalesce is set to true and last state was REFERENCE or CDATA or CHARACTER_DATA, buffer should not be cleared.
                         if( fIsCoalesce && (fLastSectionWasEntityReference || fLastSectionWasCData || fLastSectionWasCharacterData) ){
                             fLastSectionWasEntityReference = false;
@@ -2749,10 +2758,10 @@
                             //clear the buffer
                             fContentBuffer.clear();
                         }
-
+                        
                         //set the fTempString length to 0 before passing it on to scanContent
                         //scanContent sets the correct co-ordinates as per the content read
-                        fTempString.length = 0;
+                        fTempString.length = 0;                        
                         int c = fEntityScanner.scanContent(fTempString);
                         if(DEBUG){
                             System.out.println("fTempString = " + fTempString);
@@ -2793,7 +2802,7 @@
                                 return XMLEvent.SPACE;
                             }else
                                 return XMLEvent.CHARACTERS;
-
+                            
                         } else{
                             fUsebuffer = true ;
                             if(DEBUG){
@@ -2822,7 +2831,7 @@
                             // could flush the buffer out - this happens when we're parsing an
                             // entity which ends with a ]
                             fInScanContent = true;
-
+                            
                             // We work on a single character basis to handle cases such as:
                             // ']]]>' which we might otherwise miss.
                             //
@@ -2838,11 +2847,11 @@
                             c = -1 ;
                             fInScanContent = false;
                         }
-
+                        
                         do{
                             //xxx: we should be using only one buffer..
                             // we need not to grow the buffer only when isCoalesce() is not true;
-
+                            
                             if (c == '<') {
                                 fEntityScanner.scanChar();
                                 setScannerState(SCANNER_STATE_START_OF_MARKUP);
@@ -2869,14 +2878,14 @@
                             //xxx: scanContent also gives character callback.
                             c = scanContent(fContentBuffer) ;
                             //we should not be iterating again if fIsCoalesce is not set to true
-
+                            
                             if(!fIsCoalesce){
                                 setScannerState(SCANNER_STATE_CONTENT);
                                 break;
                             }
-
+                            
                         }while(true);
-
+                        
                         //if (fDocumentHandler != null) {
                         //  fDocumentHandler.characters(fContentBuffer, null);
                         //}
@@ -2893,7 +2902,7 @@
                                 return XMLEvent.CHARACTERS ;
                         }
                     }
-
+                    
                     case SCANNER_STATE_END_ELEMENT_TAG :{
                         if(fEmptyElement){
                             //set it back to false.
@@ -2902,7 +2911,7 @@
                             //check the case when there is comment after single element document
                             //<foo/> and some comment after this
                             return (fMarkupDepth == 0 && elementDepthIsZeroHook() ) ? XMLEvent.END_ELEMENT : XMLEvent.END_ELEMENT ;
-
+                            
                         } else if(scanEndElement() == 0) {
                             //It is last element of the document
                             if (elementDepthIsZeroHook()) {
@@ -2911,12 +2920,12 @@
                                 //xxx understand this point once again..
                                 return XMLEvent.END_ELEMENT ;
                             }
-
+                            
                         }
                         setScannerState(SCANNER_STATE_CONTENT);
                         return XMLEvent.END_ELEMENT ;
                     }
-
+                    
                     case SCANNER_STATE_COMMENT: { //SCANNER_STATE_COMMENT:
                         scanComment();
                         setScannerState(SCANNER_STATE_CONTENT);
@@ -2937,7 +2946,7 @@
                     case SCANNER_STATE_CDATA :{ //SCANNER_STATE_CDATA: {
                         //xxx: What if CDATA is the first event
                         //<foo><![CDATA[hello<><>]]>append</foo>
-
+                        
                         //we should not clear the buffer only when the last state was either SCANNER_STATE_REFERENCE or
                         //SCANNER_STATE_CHARACTER_DATA or SCANNER_STATE_REFERENCE
                         if(fIsCoalesce && ( fLastSectionWasEntityReference || fLastSectionWasCData || fLastSectionWasCharacterData)){
@@ -2969,11 +2978,11 @@
                             return XMLEvent.CHARACTERS;
                         }
                     }
-
+                    
                     case SCANNER_STATE_REFERENCE :{
                         fMarkupDepth++;
                         foundBuiltInRefs = false;
-
+                        
                         //we should not clear the buffer only when the last state was either CDATA or
                         //SCANNER_STATE_CHARACTER_DATA or SCANNER_STATE_REFERENCE
                         if(fIsCoalesce && ( fLastSectionWasEntityReference || fLastSectionWasCData || fLastSectionWasCharacterData)){
@@ -3004,13 +3013,13 @@
                                 setScannerState(SCANNER_STATE_CONTENT);
                                 return XMLEvent.CHARACTERS;
                             }
-
+                            
                             //if there was a text declaration, call next() it will be taken care.
                             if(fScannerState == SCANNER_STATE_TEXT_DECL){
                                 fLastSectionWasEntityReference = true ;
                                 return fDriver.next();
                             }
-
+                            
                             if(fScannerState == SCANNER_STATE_REFERENCE){
                                 setScannerState(SCANNER_STATE_CONTENT);
                                 if (fReplaceEntityReferences && fEntityStore.isDeclaredEntity(fCurrentEntityName)) {
@@ -3026,7 +3035,7 @@
                         fLastSectionWasEntityReference = true ;
                         return fDriver.next();
                     }
-
+                    
                     case SCANNER_STATE_TEXT_DECL: {
                         // scan text decl
                         if (fEntityScanner.skipString("<?xml")) {
@@ -3036,7 +3045,7 @@
                             if (isValidNameChar(fEntityScanner.peekChar())) {
                                 fStringBuffer.clear();
                                 fStringBuffer.append("xml");
-
+                                
                                 if (fNamespaces) {
                                     while (isValidNCName(fEntityScanner.peekChar())) {
                                         fStringBuffer.append((char)fEntityScanner.scanChar());
@@ -3047,10 +3056,10 @@
                                     }
                                 }
                                 String target = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
-                                fStringBuffer.clear();
-                                scanPIData(target, fStringBuffer);
+                                fContentBuffer.clear();
+                                scanPIData(target, fContentBuffer);
                             }
-
+                            
                             // standard text declaration
                             else {
                                 //xxx: this function gives callback
@@ -3065,8 +3074,8 @@
                         //and when to allow adapter issue a callback.
                         return fDriver.next();
                     }
-
-
+                    
+                    
                     case SCANNER_STATE_ROOT_ELEMENT: {
                         if (scanRootElementHook()) {
                             fEmptyElement = true;
@@ -3074,7 +3083,7 @@
                             return XMLEvent.START_ELEMENT;
                         }
                         setScannerState(SCANNER_STATE_CONTENT);
-                        return XMLEvent.START_ELEMENT ;
+                        return XMLEvent.START_ELEMENT ;                        
                     }
                     case SCANNER_STATE_CHAR_REFERENCE : {
                         fContentBuffer.clear();
@@ -3085,27 +3094,27 @@
                     }
                     default:
                         throw new XNIException("Scanner State " + fScannerState + " not Recognized ");
-
+                        
                 }//switch
             }
             // premature end of file
             catch (EOFException e) {
                 endOfFileHook(e);
                 return -1;
-            }
-
+            }            
+            
         }//next
-
-
+        
+        
         //
         // Protected methods
         //
-
+        
         // hooks
-
+        
         // NOTE: These hook methods are added so that the full document
         //       scanner can share the majority of code with this class.
-
+        
         /**
          * Scan for DOCTYPE hook. This method is a hook for subclasses
          * to add code to handle scanning for a the "DOCTYPE" string
@@ -3118,7 +3127,7 @@
         throws IOException, XNIException {
             return false;
         } // scanForDoctypeHook():boolean
-
+        
         /**
          * Element depth iz zero. This methos is a hook for subclasses
          * to add code to handle when the element depth hits zero. When
@@ -3136,7 +3145,7 @@
         throws IOException, XNIException {
             return false;
         } // elementDepthIsZeroHook():boolean
-
+        
         /**
          * Scan for root element hook. This method is a hook for
          * subclasses to add code that handles scanning for the root
@@ -3153,7 +3162,7 @@
         throws IOException, XNIException {
             return false;
         } // scanRootElementHook():boolean
-
+        
         /**
          * End of file hook. This method is a hook for subclasses to
          * add code that handles the end of file. The end of file in
@@ -3163,24 +3172,24 @@
          */
         protected void endOfFileHook(EOFException e)
         throws IOException, XNIException {
-
+            
             // NOTE: An end of file is only only an error if we were
             //       in the middle of scanning some markup. -Ac
             if (fMarkupDepth != 0) {
                 reportFatalError("PrematureEOF", null);
             }
-
+            
         } // endOfFileHook()
-
+        
     } // class FragmentContentDriver
-
+    
     static void pr(String str) {
         System.out.println(str) ;
     }
-
+    
     protected boolean fUsebuffer ;
-
-    /** this function gets an XMLString (which is used to store the attribute value) from the special pool
+    
+    /** this function gets an XMLString (which is used to store the attribute value) from the special pool 
      *  maintained for attributes.
      *  fAttributeCacheUsedCount tracks the number of attributes that has been consumed from the pool.
      *  if all the attributes has been consumed, it adds a new XMLString inthe pool and returns the same
@@ -3188,7 +3197,7 @@
      *
      * @return XMLString XMLString used to store an attribute value.
      */
-
+    
     protected XMLString getString(){
         if(fAttributeCacheUsedCount < initialCacheCount || fAttributeCacheUsedCount < attributeValueCache.size()){
             return (XMLString)attributeValueCache.get(fAttributeCacheUsedCount++);
@@ -3203,7 +3212,7 @@
     /**
      * Implements XMLBufferListener interface.
      */
-
+    
     public void refresh(){
         refresh(0);
     }
@@ -3228,5 +3237,5 @@
             fUsebuffer = true;
         }
     }
-
+    
 } // class XMLDocumentFragmentScannerImpl
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLDocumentScannerImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Portions Copyright 2003-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Portions Copyright 2003-2006 Sun Microsystems, Inc.  All Rights Reserved.
  */
 
 /*
@@ -62,61 +62,62 @@
  * @author Arnaud  Le Hors, IBM
  * @author Eric Ye, IBM
  * @author Sunitha Reddy, Sun Microsystems
- *
+ * 
  * Refer to the table in unit-test javax.xml.stream.XMLStreamReaderTest.SupportDTD for changes
  * related to property SupportDTD.
  * @author Joe Wang, Sun Microsystems
+ * @version $Id: XMLDocumentScannerImpl.java,v 1.15 2009/08/20 06:04:39 joehw Exp $
  */
 public class XMLDocumentScannerImpl
         extends XMLDocumentFragmentScannerImpl{
-
+    
     //
     // Constants
     //
-
+    
     // scanner states
-
+    
     /** Scanner state: XML declaration. */
     protected static final int SCANNER_STATE_XML_DECL = 42;
-
+    
     /** Scanner state: prolog. */
     protected static final int SCANNER_STATE_PROLOG = 43;
-
+    
     /** Scanner state: trailing misc. */
     protected static final int SCANNER_STATE_TRAILING_MISC = 44;
-
+    
     /** Scanner state: DTD internal declarations. */
     protected static final int SCANNER_STATE_DTD_INTERNAL_DECLS = 45;
-
+    
     /** Scanner state: open DTD external subset. */
     protected static final int SCANNER_STATE_DTD_EXTERNAL = 46;
-
+    
     /** Scanner state: DTD external declarations. */
     protected static final int SCANNER_STATE_DTD_EXTERNAL_DECLS = 47;
-
+    
     /** Scanner state: NO MORE ELEMENTS. */
     protected static final int SCANNER_STATE_NO_SUCH_ELEMENT_EXCEPTION = 48;
-
+    
     // feature identifiers
-
+    
     /** Property identifier document scanner: */
     protected static final String DOCUMENT_SCANNER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.DOCUMENT_SCANNER_PROPERTY;
-
+    
     /** Feature identifier: load external DTD. */
     protected static final String LOAD_EXTERNAL_DTD =
             Constants.XERCES_FEATURE_PREFIX + Constants.LOAD_EXTERNAL_DTD_FEATURE;
-
+    
     /** Feature identifier: load external DTD. */
     protected static final String DISALLOW_DOCTYPE_DECL_FEATURE =
             Constants.XERCES_FEATURE_PREFIX + Constants.DISALLOW_DOCTYPE_DECL_FEATURE;
-
+    
     // property identifiers
-
+    
     /** Property identifier: DTD scanner. */
     protected static final String DTD_SCANNER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.DTD_SCANNER_PROPERTY;
-
+    
     // property identifier:  ValidationManager
     protected static final String VALIDATION_MANAGER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
@@ -124,126 +125,126 @@
     /** property identifier:  NamespaceContext */
     protected static final String NAMESPACE_CONTEXT =
         Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
-
+    
     // recognized features and properties
-
+    
     /** Recognized features. */
     private static final String[] RECOGNIZED_FEATURES = {
         LOAD_EXTERNAL_DTD,
                 DISALLOW_DOCTYPE_DECL_FEATURE,
     };
-
+    
     /** Feature defaults. */
     private static final Boolean[] FEATURE_DEFAULTS = {
         Boolean.TRUE,
                 Boolean.FALSE,
     };
-
+    
     /** Recognized properties. */
     private static final String[] RECOGNIZED_PROPERTIES = {
         DTD_SCANNER,
                 VALIDATION_MANAGER
     };
-
+    
     /** Property defaults. */
     private static final Object[] PROPERTY_DEFAULTS = {
         null,
                 null
     };
-
+    
     //
     // Data((Boolean)propertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
     //
-
+    
     // properties
-
+    
     /** DTD scanner. */
     protected XMLDTDScanner fDTDScanner = null;
-
+        
     /** Validation manager . */
     //xxx: fValidationManager code needs to be added yet!
     protected ValidationManager fValidationManager;
-
+    
     protected XMLStringBuffer fDTDDecl = null;
     protected boolean fReadingDTD = false;
     protected boolean fAddedListener = false;
-
+    
     // protected data
-
+    
     // other info
-
+    
     /** Doctype name. */
     protected String fDoctypeName;
-
+    
     /** Doctype declaration public identifier. */
     protected String fDoctypePublicId;
-
+    
     /** Doctype declaration system identifier. */
     protected String fDoctypeSystemId;
-
+    
     /** Namespace support. */
     protected NamespaceContext fNamespaceContext = new NamespaceSupport();
-
+    
     // features
-
+    
     /** Load external DTD. */
     protected boolean fLoadExternalDTD = true;
-
+    
     // state
-
+    
     /** Seen doctype declaration. */
     protected boolean fSeenDoctypeDecl;
-
+        
     protected boolean fScanEndElement;
-
+    
     //protected int fScannerLastState ;
-
+    
     // drivers
-
+    
     /** XML declaration driver. */
     protected Driver fXMLDeclDriver = new XMLDeclDriver();
-
+    
     /** Prolog driver. */
     protected Driver fPrologDriver = new PrologDriver();
-
+    
     /** DTD driver. */
     protected Driver fDTDDriver = null ;
-
+    
     /** Trailing miscellaneous section driver. */
     protected Driver fTrailingMiscDriver = new TrailingMiscDriver();
     protected int fStartPos = 0;
     protected int fEndPos = 0;
     protected boolean fSeenInternalSubset= false;
     // temporary variables
-
+    
     /** Array of 3 strings. */
     private String[] fStrings = new String[3];
-
+    
     /** External subset source. */
     private XMLInputSource fExternalSubsetSource = null;
-
+    
     /** A DTD Description. */
     private final XMLDTDDescription fDTDDescription = new XMLDTDDescription(null, null, null, null, null);
 
     /** String. */
     private XMLString fString = new XMLString();
-
+    
     private static final char [] DOCTYPE = {'D','O','C','T','Y','P','E'};
     private static final char [] COMMENTSTRING = {'-','-'};
-
+        
     //
     // Constructors
     //
-
+    
     /** Default constructor. */
     public XMLDocumentScannerImpl() {} // <init>()
-
-
+    
+    
     //
     // XMLDocumentScanner methods
     //
-
-
+    
+    
     /**
      * Sets the input source.
      *
@@ -258,17 +259,17 @@
         // fDocumentSystemId = fEntityManager.expandSystemId(inputSource.getSystemId());
         setScannerState(XMLEvent.START_DOCUMENT);
     } // setInputSource(XMLInputSource)
-
-
-
+    
+    
+    
     /**return the state of the scanner */
     public int getScannetState(){
         return fScannerState ;
     }
-
-
-
-
+    
+    
+    
+    
     public void reset(PropertyManager propertyManager) {
         super.reset(propertyManager);
         // other settings
@@ -278,9 +279,9 @@
         fSeenDoctypeDecl = false;
         fNamespaceContext.reset();
         fDisallowDoctype = !((Boolean)propertyManager.getProperty(XMLInputFactory.SUPPORT_DTD)).booleanValue();
-
+        
         // xerces features
-        fLoadExternalDTD = true ;
+        fLoadExternalDTD = !((Boolean)propertyManager.getProperty(Constants.ZEPHYR_PROPERTY_PREFIX + Constants.IGNORE_EXTERNAL_DTD)).booleanValue();
         setScannerState(XMLEvent.START_DOCUMENT);
         setDriver(fXMLDeclDriver);
         fSeenInternalSubset = false;
@@ -292,9 +293,9 @@
         if(fDTDDecl != null){
             fDTDDecl.clear();
         }
-
+                
     }
-
+    
     /**
      * Resets the component. The component can query the component manager
      * about any features and properties that affect the operation of the
@@ -311,39 +312,39 @@
      */
     public void reset(XMLComponentManager componentManager)
     throws XMLConfigurationException {
-
+        
         super.reset(componentManager);
-
+        
         // other settings
         fDoctypeName = null;
         fDoctypePublicId = null;
         fDoctypeSystemId = null;
         fSeenDoctypeDecl = false;
         fExternalSubsetSource = null;
-
+        
         // xerces features
         try {
             fLoadExternalDTD = componentManager.getFeature(LOAD_EXTERNAL_DTD);
         } catch (XMLConfigurationException e) {
             fLoadExternalDTD = true;
         }
-
+        
         try {
             fDisallowDoctype = componentManager.getFeature(DISALLOW_DOCTYPE_DECL_FEATURE);
         } catch (XMLConfigurationException e) {
             fDisallowDoctype = false;
         }
-
+        
         try {
             fNamespaces = componentManager.getFeature(NAMESPACES);
         } catch (XMLConfigurationException e) {
             fNamespaces = true;
         }
-
+        
         fSeenInternalSubset = false;
         // xerces properties
-        fDTDScanner = (XMLDTDScanner)componentManager.getProperty(DTD_SCANNER);
-
+        fDTDScanner = (XMLDTDScanner)componentManager.getProperty(DTD_SCANNER);        
+        
         try {
             fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER);
         }
@@ -359,22 +360,22 @@
             fNamespaceContext = new NamespaceSupport();
         }
         fNamespaceContext.reset();
-
+        
         fEndPos = 0;
         fStartPos = 0;
         if(fDTDDecl != null)
             fDTDDecl.clear();
-
+            
 
         //fEntityScanner.registerListener((XMLBufferListener)componentManager.getProperty(DOCUMENT_SCANNER));
-
+        
         // setup driver
         setScannerState(SCANNER_STATE_XML_DECL);
         setDriver(fXMLDeclDriver);
-
+        
     } // reset(XMLComponentManager)
-
-
+    
+    
     /**
      * Returns a list of feature identifiers that are recognized by
      * this component. This method may return null if no features
@@ -390,7 +391,7 @@
         System.arraycopy(RECOGNIZED_FEATURES, 0, combinedFeatureIds, length, RECOGNIZED_FEATURES.length);
         return combinedFeatureIds;
     } // getRecognizedFeatures():String[]
-
+    
     /**
      * Sets the state of a feature. This method is called by the component
      * manager any time after reset when a feature changes state.
@@ -408,27 +409,27 @@
      */
     public void setFeature(String featureId, boolean state)
     throws XMLConfigurationException {
-
+        
         super.setFeature(featureId, state);
-
+        
         // Xerces properties
         if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
             final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
-
-            if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() &&
+        	
+            if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() && 
                 featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
                 fLoadExternalDTD = state;
                 return;
             }
-            else if (suffixLength == Constants.DISALLOW_DOCTYPE_DECL_FEATURE.length() &&
+            else if (suffixLength == Constants.DISALLOW_DOCTYPE_DECL_FEATURE.length() && 
                 featureId.endsWith(Constants.DISALLOW_DOCTYPE_DECL_FEATURE)) {
                 fDisallowDoctype = state;
                 return;
             }
         }
-
+                
     } // setFeature(String,boolean)
-
+    
     /**
      * Returns a list of property identifiers that are recognized by
      * this component. This method may return null if no properties
@@ -444,7 +445,7 @@
         System.arraycopy(RECOGNIZED_PROPERTIES, 0, combinedPropertyIds, length, RECOGNIZED_PROPERTIES.length);
         return combinedPropertyIds;
     } // getRecognizedProperties():String[]
-
+    
     /**
      * Sets the value of a property. This method is called by the component
      * manager any time after reset when a property changes value.
@@ -462,18 +463,18 @@
      */
     public void setProperty(String propertyId, Object value)
     throws XMLConfigurationException {
-
+        
         super.setProperty(propertyId, value);
-
+        
         // Xerces properties
         if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
             final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
-
-            if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length() &&
+            
+            if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length() && 
                 propertyId.endsWith(Constants.DTD_SCANNER_PROPERTY)) {
                 fDTDScanner = (XMLDTDScanner)value;
             }
-            if (suffixLength == Constants.NAMESPACE_CONTEXT_PROPERTY.length() &&
+            if (suffixLength == Constants.NAMESPACE_CONTEXT_PROPERTY.length() && 
                 propertyId.endsWith(Constants.NAMESPACE_CONTEXT_PROPERTY)) {
                 if (value != null) {
                     fNamespaceContext = (NamespaceContext)value;
@@ -481,10 +482,10 @@
             }
 
             return;
-        }
-
+        }        
+        
     } // setProperty(String,Object)
-
+    
     /**
      * Returns the default state for a feature, or null if this
      * component does not want to report a default value for this
@@ -495,7 +496,7 @@
      * @since Xerces 2.2.0
      */
     public Boolean getFeatureDefault(String featureId) {
-
+        
         for (int i = 0; i < RECOGNIZED_FEATURES.length; i++) {
             if (RECOGNIZED_FEATURES[i].equals(featureId)) {
                 return FEATURE_DEFAULTS[i];
@@ -503,7 +504,7 @@
         }
         return super.getFeatureDefault(featureId);
     } // getFeatureDefault(String):Boolean
-
+    
     /**
      * Returns the default state for a property, or null if this
      * component does not want to report a default value for this
@@ -521,11 +522,11 @@
         }
         return super.getPropertyDefault(propertyId);
     } // getPropertyDefault(String):Object
-
+    
     //
     // XMLEntityHandler methods
     //
-
+    
     /**
      * This method notifies of the start of an entity. The DTD has the
      * pseudo-name of "[dtd]" parameter entity names start with '%'; and
@@ -544,12 +545,12 @@
     public void startEntity(String name,
             XMLResourceIdentifier identifier,
             String encoding, Augmentations augs) throws XNIException {
-
+        
         super.startEntity(name, identifier, encoding,augs);
-
+        
         //register current document scanner as a listener for XMLEntityScanner
         fEntityScanner.registerListener(this);
-
+        
         // prepare to look for a TextDecl if external general entity
         if (!name.equals("[xml]") && fEntityScanner.isExternal()) {
             // Don't do this if we're skipping the entity!
@@ -557,16 +558,16 @@
                 setScannerState(SCANNER_STATE_TEXT_DECL);
             }
         }
-
+        
         // call handler
         /** comment this part.. LOCATOR problem.. */
         if (fDocumentHandler != null && name.equals("[xml]")) {
             fDocumentHandler.startDocument(fEntityScanner, encoding, fNamespaceContext, null);
         }
-
+        
     } // startEntity(String,identifier,String)
-
-
+    
+    
     /**
      * This method notifies the end of an entity. The DTD has the pseudo-name
      * of "[dtd]" parameter entity names start with '%'; and general entities
@@ -577,9 +578,9 @@
      * @throws XNIException Thrown by handler to signal an error.
      */
     public void endEntity(String name, Augmentations augs) throws IOException, XNIException {
-
+        
         super.endEntity(name, augs);
-
+        
         if(name.equals("[xml]")){
             //if fMarkupDepth has reached 0.
             //and driver is fTrailingMiscDriver (which
@@ -593,16 +594,16 @@
                 //so throw EOFException.
                 throw new java.io.EOFException();
             }
-
+            
             //this is taken care in wrapper which generates XNI callbacks, There are no next events
-
+            
             //if (fDocumentHandler != null) {
                 //fDocumentHandler.endDocument(null);
             //}
         }
     } // endEntity(String)
-
-
+    
+        
     public XMLStringBuffer getDTDDecl(){
         Entity entity = fEntityScanner.getCurrentEntity();
         fDTDDecl.append(((Entity.ScannedEntity)entity).ch,fStartPos , fEndPos-fStartPos);
@@ -610,55 +611,55 @@
             fDTDDecl.append("]>");
         return fDTDDecl;
     }
-
+    
     public String getCharacterEncodingScheme(){
         return fDeclaredEncoding;
     }
-
+    
     /** return the next state on the input
      *
      * @return int
      */
-
+    
     public int next() throws IOException, XNIException {
         return fDriver.next();
     }
-
+    
     //getNamespaceContext
     public NamespaceContext getNamespaceContext(){
         return fNamespaceContext ;
     }
 
 
-
+    
     //
     // Protected methods
     //
-
+    
     // driver factory methods
-
+    
     /** Creates a content driver. */
     protected Driver createContentDriver() {
         return new ContentDriver();
     } // createContentDriver():Driver
-
+    
     // scanning methods
-
+    
     /** Scans a doctype declaration. */
     protected boolean scanDoctypeDecl(boolean ignore) throws IOException, XNIException {
-
+        
         // spaces
         if (!fEntityScanner.skipSpaces()) {
             reportFatalError("MSG_SPACE_REQUIRED_BEFORE_ROOT_ELEMENT_TYPE_IN_DOCTYPEDECL",
                     null);
         }
-
+        
         // root element name
         fDoctypeName = fEntityScanner.scanName();
         if (fDoctypeName == null) {
             reportFatalError("MSG_ROOT_ELEMENT_TYPE_REQUIRED", null);
         }
-
+        
         // external id
         if (fEntityScanner.skipSpaces()) {
             scanExternalID(fStrings, false);
@@ -666,9 +667,9 @@
             fDoctypePublicId = fStrings[1];
             fEntityScanner.skipSpaces();
         }
-
+        
         fHasExternalDTD = fDoctypeSystemId != null;
-
+        
         // Attempt to locate an external subset with an external subset resolver.
         if (!ignore && !fHasExternalDTD && fExternalSubsetResolver != null) {
             fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
@@ -676,7 +677,7 @@
             fExternalSubsetSource = fExternalSubsetResolver.getExternalSubset(fDTDDescription);
             fHasExternalDTD = fExternalSubsetSource != null;
         }
-
+        
         // call handler
         if (!ignore && fDocumentHandler != null) {
             // NOTE: I don't like calling the doctypeDecl callback until
@@ -689,9 +690,9 @@
             }
             else {
                 fDocumentHandler.doctypeDecl(fDoctypeName, fExternalSubsetSource.getPublicId(), fExternalSubsetSource.getSystemId(), null);
-            }
+            }            
         }
-
+        
         // is there an internal subset?
         boolean internalSubset = true;
         if (!fEntityScanner.skipChar('[')) {
@@ -703,9 +704,9 @@
             fMarkupDepth--;
         }
         return internalSubset;
-
+        
     } // scanDoctypeDecl():boolean
-
+    
     //
     // Private methods
     //
@@ -713,12 +714,13 @@
     protected void setEndDTDScanState() {
         setScannerState(SCANNER_STATE_PROLOG);
         setDriver(fPrologDriver);
-        fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
+        fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);  
+        fReadingDTD=false;
     }
-
+    
     /** Returns the scanner state name. */
     protected String getScannerStateName(int state) {
-
+        
         switch (state) {
             case SCANNER_STATE_XML_DECL: return "SCANNER_STATE_XML_DECL";
             case SCANNER_STATE_PROLOG: return "SCANNER_STATE_PROLOG";
@@ -728,13 +730,13 @@
             case SCANNER_STATE_DTD_EXTERNAL_DECLS: return "SCANNER_STATE_DTD_EXTERNAL_DECLS";
         }
         return super.getScannerStateName(state);
-
+        
     } // getScannerStateName(int):String
-
+    
     //
     // Classes
     //
-
+    
     /**
      * Driver to handle XMLDecl scanning.
      *
@@ -748,22 +750,22 @@
      */
     protected final class XMLDeclDriver
             implements Driver {
-
+        
         //
         // Driver methods
         //
-
-
+        
+        
         public int next() throws IOException, XNIException {
             if(DEBUG_NEXT){
                 System.out.println("NOW IN XMLDeclDriver");
             }
-
+            
             // next driver is prolog regardless of whether there
             // is an XMLDecl in this document
             setScannerState(SCANNER_STATE_PROLOG);
             setDriver(fPrologDriver);
-
+            
             //System.out.println("fEntityScanner = " + fEntityScanner);
             // scan XMLDecl
             try {
@@ -779,8 +781,8 @@
                         }
                         String target = fSymbolTable.addSymbol(fStringBuffer.ch, fStringBuffer.offset, fStringBuffer.length);
                         //this function should fill the data.. and set the fEvent object to this event.
-                        fStringBuffer.clear() ;
-                        scanPIData(target, fStringBuffer);
+                        fContentBuffer.clear() ;
+                        scanPIData(target, fContentBuffer);
                         //REVISIT:where else we can set this value to 'true'
                         fEntityManager.fCurrentEntity.mayReadChunks = true;
                         //return PI event since PI was encountered
@@ -800,23 +802,23 @@
                     //cosume the XML declaration if any.
                     return XMLEvent.START_DOCUMENT;
                 }
-
-
+                
+                
                 //START_OF_THE_DOCUMENT
-
-
+                
+                
             }
-
+            
             // premature end of file
             catch (EOFException e) {
                 reportFatalError("PrematureEOF", null);
                 return -1;
                 //throw e;
             }
-
+            
         }
     } // class XMLDeclDriver
-
+    
     /**
      * Driver to handle prolog scanning.
      *
@@ -824,7 +826,7 @@
      */
     protected final class PrologDriver
             implements Driver {
-
+        
         /**
          * Drives the parser to the next state/event on the input. Parser is guaranteed
          * to stop at the next state/event.
@@ -841,10 +843,10 @@
          * @throws IOException  Thrown on i/o error.
          * @throws XNIException Thrown on parse error.
          */
-
+        
         public int next() throws IOException, XNIException {
             //System.out.println("here in next");
-
+            
             if(DEBUG_NEXT){
                 System.out.println("NOW IN PrologDriver");
             }
@@ -862,10 +864,10 @@
                             }
                             break;
                         }
-
+                        
                         case SCANNER_STATE_START_OF_MARKUP: {
                             fMarkupDepth++;
-
+                            
                             if (fEntityScanner.skipChar('?')) {
                                 setScannerState(SCANNER_STATE_PI);
                             } else if (fEntityScanner.skipChar('!')) {
@@ -885,7 +887,7 @@
                                     if(fDTDDecl == null)
                                         fDTDDecl = new XMLStringBuffer();
                                     fDTDDecl.append("<!DOCTYPE");
-
+                                    
                                 } else {
                                     reportFatalError("MarkupNotRecognizedInProlog",
                                             null);
@@ -895,7 +897,7 @@
                                 setDriver(fContentDriver);
                                 //from now onwards this would be handled by fContentDriver,in the same next() call
                                 return fContentDriver.next();
-
+                                
                             } else {
                                 reportFatalError("MarkupNotRecognizedInProlog",
                                         null);
@@ -904,7 +906,7 @@
                         }
                     }
                 } while (fScannerState == SCANNER_STATE_PROLOG || fScannerState == SCANNER_STATE_START_OF_MARKUP );
-
+                
                 switch(fScannerState){
                     /**
                     //this part is handled by FragmentContentHandler
@@ -932,11 +934,12 @@
                     }
 
                     case SCANNER_STATE_DOCTYPE: {
-
+                        
                         if (fSeenDoctypeDecl) {
                             reportFatalError("AlreadySeenDoctype", null);
                         }
                         fSeenDoctypeDecl = true;
+                        
                         // scanDoctypeDecl() sends XNI doctypeDecl event that
                         // in SAX is converted to startDTD() event.
                         if (scanDoctypeDecl(fDisallowDoctype)) {
@@ -952,8 +955,7 @@
                             // If no DTD support, ignore and continue parsing
                             //return fDisallowDoctype ? next() : dtdEvent;
                         }
-
-                        /** xxx:check this part again
+                        
                         if(fSeenDoctypeDecl){
                             Entity entity = fEntityScanner.getCurrentEntity();
                             if(entity instanceof Entity.ScannedEntity){
@@ -961,41 +963,40 @@
                             }
                             fReadingDTD = false;
                         }
-                         */
 
                         // handle external subset
                         if (fDoctypeSystemId != null) {
-                            if (((fValidation || fLoadExternalDTD)
+                            if (((fValidation || fLoadExternalDTD) 
                                 && (fValidationManager == null || !fValidationManager.isCachedDTD()))) {
-                                if (!fDisallowDoctype)
-                                    setScannerState(SCANNER_STATE_DTD_EXTERNAL);
-                                else
-                                    setScannerState(SCANNER_STATE_PROLOG);
-                                setDriver(fContentDriver);
-                                if(fDTDDriver == null)
-                                    fDTDDriver = new DTDDriver();
-                                return fDTDDriver.next();
-
+                            if (!fDisallowDoctype)
+                                setScannerState(SCANNER_STATE_DTD_EXTERNAL);
+                            else
+                                setScannerState(SCANNER_STATE_PROLOG);
+                            setDriver(fContentDriver);
+                            if(fDTDDriver == null)
+                                fDTDDriver = new DTDDriver();
+                            return fDTDDriver.next();
+                                
                             }
                         }
                         else if (fExternalSubsetSource != null) {
-                            if (((fValidation || fLoadExternalDTD)
+                            if (((fValidation || fLoadExternalDTD) 
                                 && (fValidationManager == null || !fValidationManager.isCachedDTD()))) {
                                 // This handles the case of a DOCTYPE that had neither an internal subset or an external subset.
                                 fDTDScanner.setInputSource(fExternalSubsetSource);
                                 fExternalSubsetSource = null;
-                                if (!fDisallowDoctype)
-                                    setScannerState(SCANNER_STATE_DTD_EXTERNAL_DECLS);
-                                else
-                                    setScannerState(SCANNER_STATE_PROLOG);
-                                setDriver(fContentDriver);
-                                if(fDTDDriver == null)
-                                    fDTDDriver = new DTDDriver();
-                                return fDTDDriver.next();
-                            }
+                            if (!fDisallowDoctype)
+                                setScannerState(SCANNER_STATE_DTD_EXTERNAL_DECLS);
+                            else
+                                setScannerState(SCANNER_STATE_PROLOG);
+                            setDriver(fContentDriver);
+                            if(fDTDDriver == null)
+                                fDTDDriver = new DTDDriver();
+                            return fDTDDriver.next();
+                            }                       	
                         }
 
-                        // Send endDTD() call if:
+                        // Send endDTD() call if: 
                         // a) systemId is null or if an external subset resolver could not locate an external subset.
                         // b) "load-external-dtd" and validation are false
                         // c) DTD grammar is cached
@@ -1008,7 +1009,7 @@
                         setScannerState(SCANNER_STATE_PROLOG);
                         return XMLEvent.DTD;
                     }
-
+                    
                     case SCANNER_STATE_CONTENT: {
                         reportFatalError("ContentIllegalInProlog", null);
                         fEntityScanner.scanChar();
@@ -1016,7 +1017,7 @@
                     case SCANNER_STATE_REFERENCE: {
                         reportFatalError("ReferenceIllegalInProlog", null);
                     }
-
+                    
                     /**
                      * if (complete) {
                      * if (fEntityScanner.scanChar() != '<') {
@@ -1037,12 +1038,12 @@
             }
             //xxx  what should be returned here.... ???
             return -1;
-
+            
         }
-
-
+        
+        
     } // class PrologDriver
-
+    
     /**
      * Driver to handle the internal and external DTD subsets.
      *
@@ -1050,32 +1051,32 @@
      */
     protected final class DTDDriver
             implements Driver {
-
+        
         //
         // Driver methods
         //
-
+        
         public int next() throws IOException, XNIException{
             // throw new XNIException("DTD Parsing is currently not supported");
             if(DEBUG_NEXT){
                 System.out.println("Now in DTD Driver");
             }
-
+            
             dispatch(true);
-
+            
             if(DEBUG_NEXT){
                 System.out.println("After calling dispatch(true) -- At this point whole DTD is read.");
             }
-
+            
             //xxx: remove this hack and align this with reusing DTD components
             //currently this routine will only be executed from Stax
             if(fPropertyManager != null){
                 dtdGrammarUtil =  new DTDGrammarUtil(((XMLDTDScannerImpl)fDTDScanner).getGrammar(),fSymbolTable, fNamespaceContext);
             }
-
+            
             return XMLEvent.DTD ;
         }
-
+        
         /**
          * Dispatch an XML "event".
          *
@@ -1095,13 +1096,13 @@
                 boolean again;
                 XMLResourceIdentifierImpl resourceIdentifier = new XMLResourceIdentifierImpl();
                 if( fDTDScanner == null){
-
+                    
                     if (fEntityManager.getEntityScanner() instanceof XML11EntityScanner){
                         fDTDScanner = new XML11DTDScannerImpl();
                     } else
-
+                    
                     fDTDScanner = new XMLDTDScannerImpl();
-
+                    
                     ((XMLDTDScannerImpl)fDTDScanner).reset(fPropertyManager);
                 }
                 do {
@@ -1111,7 +1112,7 @@
                             // REVISIT: Should there be a feature for
                             //          the "complete" parameter?
                             boolean completeDTD = true;
-
+                            
                             boolean moreToScan = fDTDScanner.scanDTDInternalSubset(completeDTD, fStandalone, fHasExternalDTD && fLoadExternalDTD);
                             Entity entity = fEntityScanner.getCurrentEntity();
                             if(entity instanceof Entity.ScannedEntity){
@@ -1129,9 +1130,9 @@
                                     reportFatalError("DoctypedeclUnterminated", new Object[]{fDoctypeName});
                                 }
                                 fMarkupDepth--;
-
+                                
                                 if (fDisallowDoctype) {
-                                    //simply reset the entity store without having to mess around
+                                    //simply reset the entity store without having to mess around 
                                     //with the DTD Scanner code
                                     fEntityStore = fEntityManager.getEntityStore();
                                     fEntityStore.reset();
@@ -1140,11 +1141,12 @@
                                     if (fDoctypeSystemId != null && (fValidation || fLoadExternalDTD)) {
                                         setScannerState(SCANNER_STATE_DTD_EXTERNAL);
                                         break;
-                                    }
+                                    }                                    
                                 }
 
                                 setEndDTDScanState();
                                 return true;
+                            
                             }
                             break;
                         }
@@ -1159,7 +1161,7 @@
                             again = true;
                             break;
                              */
-
+                            
                             resourceIdentifier.setValues(fDoctypePublicId, fDoctypeSystemId, null, null);
                             XMLInputSource xmlInputSource = null ;
                             StaxXMLInputSource staxInputSource =  fEntityManager.resolveEntityAsPerStax(resourceIdentifier);
@@ -1191,7 +1193,7 @@
                     }
                 } while (complete || again);
             }
-
+            
             // premature end of file
             catch (EOFException e) {
                 e.printStackTrace();
@@ -1199,20 +1201,20 @@
                 return false;
                 //throw e;
             }
-
+            
             // cleanup
             finally {
                 fEntityManager.setEntityHandler(XMLDocumentScannerImpl.this);
             }
-
+            
             return true;
-
+            
         }
-
+        
         // dispatch(boolean):boolean
-
+        
     } // class DTDDriver
-
+    
     /**
      * Driver to handle content scanning.
      *
@@ -1221,16 +1223,16 @@
      */
     protected class ContentDriver
             extends FragmentContentDriver {
-
+        
         //
         // Protected methods
         //
-
+        
         // hooks
-
+        
         // NOTE: These hook methods are added so that the full document
         //       scanner can share the majority of code with this class.
-
+        
         /**
          * Scan for DOCTYPE hook. This method is a hook for subclasses
          * to add code to handle scanning for a the "DOCTYPE" string
@@ -1241,16 +1243,16 @@
          */
         protected boolean scanForDoctypeHook()
         throws IOException, XNIException {
-
+            
             if (fEntityScanner.skipString(DOCTYPE)) {
                 setScannerState(SCANNER_STATE_DOCTYPE);
                 //                fEntityScanner.markStartOfDTD();
                 return true;
             }
             return false;
-
+            
         } // scanForDoctypeHook():boolean
-
+        
         /**
          * Element depth iz zero. This methos is a hook for subclasses
          * to add code to handle when the element depth hits zero. When
@@ -1266,13 +1268,13 @@
          */
         protected boolean elementDepthIsZeroHook()
         throws IOException, XNIException {
-
+            
             setScannerState(SCANNER_STATE_TRAILING_MISC);
             setDriver(fTrailingMiscDriver);
             return true;
-
+            
         } // elementDepthIsZeroHook():boolean
-
+        
         /**
          * Scan for root element hook. This method is a hook for
          * subclasses to add code that handles scanning for the root
@@ -1287,16 +1289,16 @@
          */
         protected boolean scanRootElementHook()
         throws IOException, XNIException {
-
+            
             if (scanStartElement()) {
                 setScannerState(SCANNER_STATE_TRAILING_MISC);
                 setDriver(fTrailingMiscDriver);
                 return true;
             }
             return false;
-
+            
         } // scanRootElementHook():boolean
-
+        
         /**
          * End of file hook. This method is a hook for subclasses to
          * add code that handles the end of file. The end of file in
@@ -1306,20 +1308,20 @@
          */
         protected void endOfFileHook(EOFException e)
         throws IOException, XNIException {
-
+            
             reportFatalError("PrematureEOF", null);
             // in case continue-after-fatal-error set, should not do this...
             //throw e;
-
+            
         } // endOfFileHook()
-
+        
         protected void resolveExternalSubsetAndRead()
         throws IOException, XNIException {
-
+            
             fDTDDescription.setValues(null, null, fEntityManager.getCurrentResourceIdentifier().getExpandedSystemId(), null);
-            fDTDDescription.setRootName(fElementQName.rawname);
+            fDTDDescription.setRootName(fElementQName.rawname);            
             XMLInputSource src = fExternalSubsetResolver.getExternalSubset(fDTDDescription);
-
+            
             if (src != null) {
                 fDoctypeName = fElementQName.rawname;
                 fDoctypePublicId = src.getPublicId();
@@ -1338,11 +1340,11 @@
                 }
             }
         } // resolveExternalSubsetAndRead()
-
-
-
+        
+        
+        
     } // class ContentDriver
-
+    
     /**
      * Driver to handle trailing miscellaneous section scanning.
      *
@@ -1351,7 +1353,7 @@
      */
     protected final class TrailingMiscDriver
             implements Driver {
-
+        
         //
         // Driver methods
         //
@@ -1362,14 +1364,14 @@
                 fEmptyElement = false;
                 return XMLEvent.END_ELEMENT;
             }
-
+            
             try {
                 if(fScannerState == SCANNER_STATE_TERMINATED){
                     return XMLEvent.END_DOCUMENT ;}
                 do {
                     switch (fScannerState) {
                         case SCANNER_STATE_TRAILING_MISC: {
-
+                            
                             fEntityScanner.skipSpaces();
                             //we should have reached the end of the document in
                             //most cases.
@@ -1435,7 +1437,7 @@
                             setScannerState(SCANNER_STATE_TRAILING_MISC);
                             return XMLEvent.CHARACTERS;
                         }
-
+                        
                     }
                     case SCANNER_STATE_REFERENCE: {
                         reportFatalError("ReferenceIllegalInTrailingMisc",
@@ -1455,7 +1457,7 @@
                     }
                     default: throw new XNIException("Scanner State " + fScannerState + " not Recognized ");
                 }//switch
-
+                
             } catch (EOFException e) {
                 // NOTE: This is the only place we're allowed to reach
                 //       the real end of the document stream. Unless the
@@ -1468,17 +1470,17 @@
                 System.out.println("EOFException thrown") ;
                 setScannerState(SCANNER_STATE_TERMINATED);
             }
-
+            
             return XMLEvent.END_DOCUMENT;
-
+            
         }//next
-
+        
     } // class TrailingMiscDriver
-
+    
     /**
      * Implements XMLBufferListener interface.
      */
-
+    
 
     /**
      * receives callbacks from {@link XMLEntityReader } when buffer
@@ -1496,5 +1498,5 @@
             fStartPos = refreshPosition;
         }
     }
-
+    
 } // class XMLDocumentScannerImpl
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLEntityManager.java	Wed Sep 28 16:49:43 2011 +0100
@@ -94,76 +94,77 @@
  * @author K.Venugopal SUN Microsystems
  * @author Neeraj Bajaj SUN Microsystems
  * @author Sunitha Reddy SUN Microsystems
+ * @version $Id: XMLEntityManager.java,v 1.16 2009/03/02 19:34:25 joehw Exp $
  */
 public class XMLEntityManager implements XMLComponent, XMLEntityResolver {
-
+    
     //
     // Constants
     //
-
+    
     /** Default buffer size (2048). */
     public static final int DEFAULT_BUFFER_SIZE = 8192;
-
+    
     /** Default buffer size before we've finished with the XMLDecl:  */
     public static final int DEFAULT_XMLDECL_BUFFER_SIZE = 64;
-
+    
     /** Default internal entity buffer size (1024). */
     public static final int DEFAULT_INTERNAL_BUFFER_SIZE = 1024;
-
+    
     // feature identifiers
-
+    
     /** Feature identifier: validation. */
     protected static final String VALIDATION =
             Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
-
+    
     /**
      * standard uri conformant (strict uri).
      * http://apache.org/xml/features/standard-uri-conformant
      */
     protected boolean fStrictURI;
-
-
+    
+    
     /** Feature identifier: external general entities. */
     protected static final String EXTERNAL_GENERAL_ENTITIES =
             Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
-
+    
     /** Feature identifier: external parameter entities. */
     protected static final String EXTERNAL_PARAMETER_ENTITIES =
             Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
-
+    
     /** Feature identifier: allow Java encodings. */
     protected static final String ALLOW_JAVA_ENCODINGS =
             Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE;
-
+    
     /** Feature identifier: warn on duplicate EntityDef */
     protected static final String WARN_ON_DUPLICATE_ENTITYDEF =
             Constants.XERCES_FEATURE_PREFIX +Constants.WARN_ON_DUPLICATE_ENTITYDEF_FEATURE;
-
+    
     // property identifiers
-
+    
     /** Property identifier: symbol table. */
     protected static final String SYMBOL_TABLE =
             Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
-
+    
     /** Property identifier: error reporter. */
     protected static final String ERROR_REPORTER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
+    
     /** Feature identifier: standard uri conformant */
     protected static final String STANDARD_URI_CONFORMANT =
             Constants.XERCES_FEATURE_PREFIX +Constants.STANDARD_URI_CONFORMANT_FEATURE;
-
+    
     /** Property identifier: entity resolver. */
     protected static final String ENTITY_RESOLVER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
-
+    
     protected static final String STAX_ENTITY_RESOLVER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.STAX_ENTITY_RESOLVER_PROPERTY;
-
+    
     // property identifier:  ValidationManager
     protected static final String VALIDATION_MANAGER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
-
+    
     /** property identifier: buffer size. */
     protected static final String BUFFER_SIZE =
             Constants.XERCES_PROPERTY_PREFIX + Constants.BUFFER_SIZE_PROPERTY;
@@ -172,10 +173,10 @@
     protected static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
 
-protected static final String PARSER_SETTINGS =
-        Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
+protected static final String PARSER_SETTINGS = 
+        Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;        
     // recognized features and properties
-
+    
     /** Recognized features. */
     private static final String[] RECOGNIZED_FEATURES = {
                 VALIDATION,
@@ -184,7 +185,7 @@
                 ALLOW_JAVA_ENCODINGS,
                 WARN_ON_DUPLICATE_ENTITYDEF
     };
-
+    
     /** Feature defaults. */
     private static final Boolean[] FEATURE_DEFAULTS = {
                 null,
@@ -193,7 +194,7 @@
                 Boolean.TRUE,
                 Boolean.FALSE,
     };
-
+    
     /** Recognized properties. */
     private static final String[] RECOGNIZED_PROPERTIES = {
                 SYMBOL_TABLE,
@@ -202,9 +203,9 @@
                 VALIDATION_MANAGER,
                 BUFFER_SIZE,
                 SECURITY_MANAGER,
-
+                
     };
-
+    
     /** Property defaults. */
     private static final Object[] PROPERTY_DEFAULTS = {
                 null,
@@ -214,94 +215,94 @@
                 new Integer(DEFAULT_BUFFER_SIZE),
                 null
     };
-
+    
     private static final String XMLEntity = "[xml]".intern();
     private static final String DTDEntity = "[dtd]".intern();
-
+    
     // debugging
-
+    
     /**
      * Debug printing of buffer. This debugging flag works best when you
      * resize the DEFAULT_BUFFER_SIZE down to something reasonable like
      * 64 characters.
      */
     private static final boolean DEBUG_BUFFER = false;
-
+    
     /** warn on duplicate Entity declaration.
      *  http://apache.org/xml/features/warn-on-duplicate-entitydef
      */
     protected boolean fWarnDuplicateEntityDef;
-
+    
     /** Debug some basic entities. */
     private static final boolean DEBUG_ENTITIES = false;
-
+    
     /** Debug switching readers for encodings. */
     private static final boolean DEBUG_ENCODINGS = false;
-
+    
     // should be diplayed trace resolving messages
     private static final boolean DEBUG_RESOLVER = false ;
-
+    
     //
     // Data
     //
-
+    
     // features
-
+    
     /**
      * Validation. This feature identifier is:
      * http://xml.org/sax/features/validation
      */
     protected boolean fValidation;
-
+    
     /**
      * External general entities. This feature identifier is:
      * http://xml.org/sax/features/external-general-entities
      */
     protected boolean fExternalGeneralEntities;
-
+    
     /**
      * External parameter entities. This feature identifier is:
      * http://xml.org/sax/features/external-parameter-entities
      */
     protected boolean fExternalParameterEntities;
-
+    
     /**
      * Allow Java encoding names. This feature identifier is:
      * http://apache.org/xml/features/allow-java-encodings
      */
     protected boolean fAllowJavaEncodings = true ;
-
-
+    
+    
     // properties
-
+    
     /**
      * Symbol table. This property identifier is:
      * http://apache.org/xml/properties/internal/symbol-table
      */
     protected SymbolTable fSymbolTable;
-
+    
     /**
      * Error reporter. This property identifier is:
      * http://apache.org/xml/properties/internal/error-reporter
      */
     protected XMLErrorReporter fErrorReporter;
-
+    
     /**
      * Entity resolver. This property identifier is:
      * http://apache.org/xml/properties/internal/entity-resolver
      */
     protected XMLEntityResolver fEntityResolver;
-
+    
     /** Stax Entity Resolver. This property identifier is XMLInputFactory.ENTITY_RESOLVER */
-
+    
     protected StaxEntityResolverWrapper fStaxEntityResolver;
-
+    
     /** Property Manager. This is used from Stax */
     protected PropertyManager fPropertyManager ;
 
-
+    
     // settings
-
+    
     /**
      * Validation manager. This property identifier is:
      * http://apache.org/xml/properties/internal/validation-manager
@@ -320,76 +321,76 @@
     // stores defaults for entity expansion limit if it has
     // been set on the configuration.
     protected SecurityManager fSecurityManager = null;
-
+    
     /**
      * True if the document entity is standalone. This should really
      * only be set by the document source (e.g. XMLDocumentScanner).
      */
     protected boolean fStandalone;
-
+    
     // are the entities being parsed in the external subset?
     // NOTE:  this *is not* the same as whether they're external entities!
     protected boolean fInExternalSubset = false;
-
-
+           
+        
     // handlers
     /** Entity handler. */
     protected XMLEntityHandler fEntityHandler;
-
+    
     /** Current entity scanner */
     protected XMLEntityScanner fEntityScanner ;
-
+    
     /** XML 1.0 entity scanner. */
     protected XMLEntityScanner fXML10EntityScanner;
 
     /** XML 1.1 entity scanner. */
     protected XMLEntityScanner fXML11EntityScanner;
-
+    
     /** entity expansion limit (contains useful data if and only if
     fSecurityManager is non-null) */
     protected int fEntityExpansionLimit = 0;
-
+    
     /** count of entities expanded: */
     protected int fEntityExpansionCount = 0;
-
+    
     // entities
-
+    
     /** Entities. */
     protected Hashtable fEntities = new Hashtable();
-
+    
     /** Entity stack. */
     protected Stack fEntityStack = new Stack();
-
+    
     /** Current entity. */
     protected Entity.ScannedEntity fCurrentEntity = null;
-
+    
     // shared context
-
+    
     /** Shared declared entities.
      * XXX understand it more deeply, why are we doing this ?? Is it really required ?
      */
     protected Hashtable fDeclaredEntities;
-
+    
     protected XMLEntityStorage fEntityStorage ;
-
+    
     protected final Object [] defaultEncoding = new Object[]{"UTF-8", null};
-
-
+    
+    
     // temp vars
-
+    
     /** Resource identifer. */
     private final XMLResourceIdentifierImpl fResourceIdentifier = new XMLResourceIdentifierImpl();
-
+    
     /** Augmentations for entities. */
     private final Augmentations fEntityAugs = new AugmentationsImpl();
-
+    
     /** Pool of character buffers. */
     private CharacterBufferPool fBufferPool = new CharacterBufferPool(fBufferSize, DEFAULT_INTERNAL_BUFFER_SIZE);
 
     //
     // Constructors
     //
-
+    
     /**
      * If this constructor is used to create the object, reset() should be invoked on this object
      */
@@ -397,7 +398,7 @@
         fEntityStorage = new XMLEntityStorage(this) ;
         setScannerVersion(Constants.XML_VERSION_1_0);
     } // <init>()
-
+    
     /** Default constructor. */
     public XMLEntityManager(PropertyManager propertyManager) {
         fPropertyManager = propertyManager ;
@@ -407,7 +408,7 @@
         fEntityScanner = new XMLEntityScanner(propertyManager, this) ;
         reset(propertyManager);
     } // <init>()
-
+    
     /**
      * Constructs an entity manager that shares the specified entity
      * declarations during each parse.
@@ -425,7 +426,7 @@
 
         setScannerVersion(Constants.XML_VERSION_1_0);
     } // <init>(XMLEntityManager)
-
+    
     /**
      * Adds an internal entity declaration.
      * <p>
@@ -452,9 +453,9 @@
                         XMLErrorReporter.SEVERITY_WARNING );
             }
         }
-
+        
     } // addInternalEntity(String,String)
-
+    
     /**
      * Adds an external entity declaration.
      * <p>
@@ -508,10 +509,10 @@
                         XMLErrorReporter.SEVERITY_WARNING );
             }
         }
-
+        
     } // addExternalEntity(String,String,String,String)
-
-
+    
+    
     /**
      * Adds an unparsed entity declaration.
      * <p>
@@ -545,15 +546,15 @@
             }
         }
     } // addUnparsedEntity(String,String,String,String)
-
-
+    
+    
     /** get the entity storage object from entity manager */
     public XMLEntityStorage getEntityStore(){
         return fEntityStorage ;
     }
-
+    
     /** return the entity responsible for reading the entity */
-    public XMLEntityScanner getEntityScanner(){
+    public XMLEntityScanner getEntityScanner(){        
         if(fEntityScanner == null) {
             // default to 1.0
             if(fXML10EntityScanner == null) {
@@ -563,9 +564,9 @@
             fEntityScanner = fXML10EntityScanner;
         }
         return fEntityScanner;
-
+        
     }
-
+    
     public void setScannerVersion(short version) {
 
         if(version == Constants.XML_VERSION_1_0) {
@@ -583,9 +584,9 @@
             fEntityScanner = fXML11EntityScanner;
             fEntityScanner.setCurrentEntity(fCurrentEntity);
         }
-
+        
     }
-
+    
     /**
      * This method uses the passed-in XMLInputSource to make
      * fCurrentEntity usable for reading.
@@ -603,18 +604,18 @@
             boolean literal, boolean isExternal)
             throws IOException, XNIException {
         // get information
-
+        
         final String publicId = xmlInputSource.getPublicId();
         String literalSystemId = xmlInputSource.getSystemId();
         String baseSystemId = xmlInputSource.getBaseSystemId();
         String encoding = xmlInputSource.getEncoding();
         final boolean encodingExternallySpecified = (encoding != null);
-        Boolean isBigEndian = null;
-
+        Boolean isBigEndian = null;        
+        
         // create reader
         InputStream stream = null;
         Reader reader = xmlInputSource.getCharacterStream();
-
+        
         // First chance checking strict URI
         String expandedSystemId = expandSystemId(literalSystemId, baseSystemId, fStrictURI);
         if (baseSystemId == null) {
@@ -623,39 +624,39 @@
         if (reader == null) {
             stream = xmlInputSource.getByteStream();
             if (stream == null) {
-                URL location = new URL(expandedSystemId);
+                URL location = new URL(expandedSystemId); 
                 URLConnection connect = location.openConnection();
                 if (!(connect instanceof HttpURLConnection)) {
                     stream = connect.getInputStream();
                 }
                 else {
                     boolean followRedirects = true;
-
+                    
                     // setup URLConnection if we have an HTTPInputSource
                     if (xmlInputSource instanceof HTTPInputSource) {
                         final HttpURLConnection urlConnection = (HttpURLConnection) connect;
                         final HTTPInputSource httpInputSource = (HTTPInputSource) xmlInputSource;
-
+                        
                         // set request properties
                         Iterator propIter = httpInputSource.getHTTPRequestProperties();
                         while (propIter.hasNext()) {
                             Map.Entry entry = (Map.Entry) propIter.next();
                             urlConnection.setRequestProperty((String) entry.getKey(), (String) entry.getValue());
                         }
-
+                        
                         // set preference for redirection
                         followRedirects = httpInputSource.getFollowHTTPRedirects();
                         if (!followRedirects) {
                             setInstanceFollowRedirects(urlConnection, followRedirects);
                         }
                     }
-
+                    
                     stream = connect.getInputStream();
-
+                    
                     // REVISIT: If the URLConnection has external encoding
                     // information, we should be reading it here. It's located
                     // in the charset parameter of Content-Type. -- mrglavas
-
+                    
                     if (followRedirects) {
                         String redirect = connect.getURL().toString();
                         // E43: Check if the URL was redirected, and then
@@ -667,10 +668,10 @@
                     }
                 }
             }
-
+            
             // wrap this stream in RewindableInputStream
             stream = new RewindableInputStream(stream);
-
+            
             // perform auto-detect of encoding if necessary
             if (encoding == null) {
                 // read first four bytes and determine encoding
@@ -683,8 +684,8 @@
                     Object [] encodingDesc = getEncodingName(b4, count);
                     encoding = (String)(encodingDesc[0]);
                     isBigEndian = (Boolean)(encodingDesc[1]);
-
-                    stream.reset();
+                    
+                    stream.reset();                    
                     // Special case UTF-8 files with BOM created by Microsoft
                     // tools. It's more efficient to consume the BOM than make
                     // the reader perform extra checks. -Ac
@@ -702,11 +703,11 @@
                     reader = createReader(stream, encoding, isBigEndian);
                 }
             }
-
+            
             // use specified encoding
             else {
                 encoding = encoding.toUpperCase(Locale.ENGLISH);
-
+                
                 // If encoding is UTF-8, consume BOM if one is present.
                 if (encoding.equals("UTF-8")) {
                     final int[] b3 = new int[3];
@@ -736,7 +737,7 @@
                             break;
                     }
                     stream.reset();
-
+                    
                     String utf16Encoding = "UTF-16";
                     if (count >= 2) {
                         final int b0 = b4[0];
@@ -779,7 +780,7 @@
                             break;
                     }
                     stream.reset();
-
+                    
                     // Ignore unusual octet order for now.
                     if (count == 4) {
                         // UCS-4, big endian (1234)
@@ -803,7 +804,7 @@
                             break;
                     }
                     stream.reset();
-
+                    
                     if (count == 4) {
                         // UCS-2, big endian
                         if (b4[0] == 0x00 && b4[1] == 0x3C && b4[2] == 0x00 && b4[3] == 0x3F) {
@@ -815,10 +816,10 @@
                         }
                     }
                 }
-
+                
                 reader = createReader(stream, encoding, isBigEndian);
             }
-
+            
             // read one character at a time so we don't jump too far
             // ahead, converting characters from the byte stream in
             // the wrong encoding
@@ -827,22 +828,22 @@
             }
             //reader = new OneCharReader(reader);
         }
-
+        
         // We've seen a new Reader.
         // Push it on the stack so we can close it later.
         //fOwnReaders.add(reader);
-
+        
         // push entity on stack
         if (fCurrentEntity != null) {
             fEntityStack.push(fCurrentEntity);
         }
-
+        
         // create entity
-        /* if encoding is specified externally, 'encoding' information present
+        /* if encoding is specified externally, 'encoding' information present 
          * in the prolog of the XML document is not considered. Hence, prolog can
-         * be read in Chunks of data instead of byte by byte.
+         * be read in Chunks of data instead of byte by byte.  
          */
-        fCurrentEntity = new com.sun.xml.internal.stream.Entity.ScannedEntity(name,new XMLResourceIdentifierImpl(publicId, literalSystemId, baseSystemId, expandedSystemId),stream, reader, encoding, literal, encodingExternallySpecified, isExternal);
+        fCurrentEntity = new com.sun.xml.internal.stream.Entity.ScannedEntity(name,new XMLResourceIdentifierImpl(publicId, literalSystemId, baseSystemId, expandedSystemId),stream, reader, encoding, literal, encodingExternallySpecified, isExternal);        
         fCurrentEntity.setEncodingExternallySpecified(encodingExternallySpecified);
         fEntityScanner.setCurrentEntity(fCurrentEntity);
         fResourceIdentifier.setValues(publicId, literalSystemId, baseSystemId, expandedSystemId);
@@ -856,16 +857,16 @@
      * @param entityName The name of the entity to check.
      * @return True if the entity is external, false otherwise
      * (including when the entity is not declared).
-     */
+     */               
     public boolean isExternalEntity(String entityName) {
-
+        
         Entity entity = (Entity)fEntities.get(entityName);
         if (entity == null) {
             return false;
         }
         return entity.isExternal();
     }
-
+    
     /**
      * Checks whether the declaration of an entity given by name is
      * // in the external subset.
@@ -875,20 +876,20 @@
      *           (including when the entity is not declared).
      */
     public boolean isEntityDeclInExternalSubset(String entityName) {
-
+        
         Entity entity = (Entity)fEntities.get(entityName);
         if (entity == null) {
             return false;
         }
         return entity.isEntityDeclInExternalSubset();
     }
-
-
-
+    
+    
+    
     //
     // Public methods
     //
-
+    
     /**
      * Sets whether the document entity is standalone.
      *
@@ -898,29 +899,29 @@
         fStandalone = standalone;
     }
     // setStandalone(boolean)
-
+    
     /** Returns true if the document entity is standalone. */
     public boolean isStandalone() {
         return fStandalone;
     }  //isStandalone():boolean
-
+    
     public boolean isDeclaredEntity(String entityName) {
-
+        
         Entity entity = (Entity)fEntities.get(entityName);
         return entity != null;
     }
-
+    
     public boolean isUnparsedEntity(String entityName) {
-
+        
         Entity entity = (Entity)fEntities.get(entityName);
         if (entity == null) {
             return false;
         }
         return entity.isUnparsed();
     }
-
-
-
+    
+    
+    
     // this simply returns the fResourceIdentifier object;
     // this should only be used with caution by callers that
     // carefully manage the entity manager's behaviour, so that
@@ -929,23 +930,23 @@
     public XMLResourceIdentifier getCurrentResourceIdentifier() {
         return fResourceIdentifier;
     }
-
+    
     /**
      * Sets the entity handler. When an entity starts and ends, the
      * entity handler is notified of the change.
      *
      * @param entityHandler The new entity handler.
      */
-
+    
     public void setEntityHandler(com.sun.org.apache.xerces.internal.impl.XMLEntityHandler entityHandler) {
         fEntityHandler = (XMLEntityHandler) entityHandler;
     } // setEntityHandler(XMLEntityHandler)
-
+    
     //this function returns StaxXMLInputSource
     public StaxXMLInputSource resolveEntityAsPerStax(XMLResourceIdentifier resourceIdentifier) throws java.io.IOException{
-
+        
         if(resourceIdentifier == null ) return null;
-
+        
         String publicId = resourceIdentifier.getPublicId();
         String literalSystemId = resourceIdentifier.getLiteralSystemId();
         String baseSystemId = resourceIdentifier.getBaseSystemId();
@@ -967,13 +968,13 @@
         }
         if (needExpand)
             expandedSystemId = expandSystemId(literalSystemId, baseSystemId,false);
-
+        
         // give the entity resolver a chance
         StaxXMLInputSource staxInputSource = null;
         XMLInputSource xmlInputSource = null;
 
         XMLResourceIdentifierImpl ri = null;
-
+        
         if (resourceIdentifier instanceof XMLResourceIdentifierImpl) {
             ri = (XMLResourceIdentifierImpl)resourceIdentifier;
         } else {
@@ -984,21 +985,21 @@
         if(DEBUG_RESOLVER){
             System.out.println("BEFORE Calling resolveEntity") ;
         }
-
+        
         //either of Stax or Xerces would be null
         if(fStaxEntityResolver != null){
             staxInputSource = fStaxEntityResolver.resolveEntity(ri);
         }
-
+        
         if(fEntityResolver != null){
             xmlInputSource = fEntityResolver.resolveEntity(ri);
         }
-
+        
         if(xmlInputSource != null){
             //wrap this XMLInputSource to StaxInputSource
             staxInputSource = new StaxXMLInputSource(xmlInputSource);
         }
-
+        
         // do default resolution
         //this works for both stax & Xerces, if staxInputSource is null, it means parser need to revert to default resolution
         if (staxInputSource == null) {
@@ -1009,16 +1010,16 @@
         }else if(staxInputSource.hasXMLStreamOrXMLEventReader()){
             //Waiting for the clarification from EG. - nb
         }
-
+        
         if (DEBUG_RESOLVER) {
             System.err.println("XMLEntityManager.resolveEntity(" + publicId + ")");
             System.err.println(" = " + xmlInputSource);
         }
-
+        
         return staxInputSource;
-
+        
     }
-
+    
     /**
      * Resolves the specified public and system identifiers. This
      * method first attempts to resolve the entity based on the
@@ -1048,7 +1049,7 @@
         String baseSystemId = resourceIdentifier.getBaseSystemId();
         String expandedSystemId = resourceIdentifier.getExpandedSystemId();
         String namespace = resourceIdentifier.getNamespace();
-
+        
         // if no base systemId given, assume that it's relative
         // to the systemId of the current scanned entity
         // Sometimes the system id is not (properly) expanded.
@@ -1066,16 +1067,16 @@
         }
         if (needExpand)
             expandedSystemId = expandSystemId(literalSystemId, baseSystemId,false);
-
+        
         // give the entity resolver a chance
         XMLInputSource xmlInputSource = null;
-
+        
         if (fEntityResolver != null) {
             resourceIdentifier.setBaseSystemId(baseSystemId);
             resourceIdentifier.setExpandedSystemId(expandedSystemId);
             xmlInputSource = fEntityResolver.resolveEntity(resourceIdentifier);
         }
-
+        
         // do default resolution
         // REVISIT: what's the correct behavior if the user provided an entity
         // resolver (fEntityResolver != null), but resolveEntity doesn't return
@@ -1087,16 +1088,16 @@
             //if (systemId != null)
             xmlInputSource = new XMLInputSource(publicId, literalSystemId, baseSystemId);
         }
-
+        
         if (DEBUG_RESOLVER) {
             System.err.println("XMLEntityManager.resolveEntity(" + publicId + ")");
             System.err.println(" = " + xmlInputSource);
         }
-
+        
         return xmlInputSource;
-
+        
     } // resolveEntity(XMLResourceIdentifier):XMLInputSource
-
+    
     /**
      * Starts a named entity.
      *
@@ -1109,7 +1110,7 @@
      */
     public void startEntity(String entityName, boolean literal)
     throws IOException, XNIException {
-
+        
         // was entity declared?
         Entity entity = (Entity)fEntityStorage.getDeclaredEntities().get(entityName);
         if (entity == null) {
@@ -1125,7 +1126,7 @@
             }
             return;
         }
-
+        
         // should we skip external entities?
         boolean external = entity.isExternal();
         if (external) {
@@ -1134,7 +1135,7 @@
             boolean general = !parameter;
             if (unparsed || (general && !fExternalGeneralEntities) ||
                     (parameter && !fExternalParameterEntities)) {
-
+                
                 if (fEntityHandler != null) {
                     fResourceIdentifier.clear();
                     final String encoding = null;
@@ -1158,7 +1159,7 @@
                 return;
             }
         }
-
+        
         // is entity recursive?
         int size = fEntityStack.size();
         for (int i = size; i >= 0; i--) {
@@ -1177,7 +1178,7 @@
                         "RecursiveReference",
                         new Object[] { entityName, path },
                         XMLErrorReporter.SEVERITY_FATAL_ERROR);
-
+                        
                         if (fEntityHandler != null) {
                             fResourceIdentifier.clear();
                             final String encoding = null;
@@ -1198,15 +1199,15 @@
                             fEntityAugs.putItem(Constants.ENTITY_SKIPPED, Boolean.TRUE);
                             fEntityHandler.endEntity(entityName, fEntityAugs);
                         }
-
+                        
                         return;
             }
         }
-
+        
         // resolve external entity
         StaxXMLInputSource staxInputSource = null;
         XMLInputSource xmlInputSource = null ;
-
+        
         if (external) {
             Entity.ExternalEntity externalEntity = (Entity.ExternalEntity)entity;
             staxInputSource = resolveEntityAsPerStax(externalEntity.entityLocation);
@@ -1223,12 +1224,12 @@
             Reader reader = new StringReader(internalEntity.text);
             xmlInputSource = new XMLInputSource(null, null, null, reader, null);
         }
-
+        
         // start the entity
         startEntity(entityName, xmlInputSource, literal, external);
-
+        
     } // startEntity(String,boolean)
-
+    
     /**
      * Starts the document entity. The document entity has the "[xml]"
      * pseudo-name.
@@ -1242,7 +1243,7 @@
     throws IOException, XNIException {
         startEntity(XMLEntity, xmlInputSource, false, true);
     } // startDocumentEntity(XMLInputSource)
-
+    
     //xxx these methods are not required.
     /**
      * Starts the DTD entity. The DTD entity has the "[dtd]"
@@ -1257,17 +1258,17 @@
     throws IOException, XNIException {
         startEntity(DTDEntity, xmlInputSource, false, true);
     } // startDTDEntity(XMLInputSource)
-
+    
     // indicate start of external subset so that
     // location of entity decls can be tracked
     public void startExternalSubset() {
         fInExternalSubset = true;
     }
-
+    
     public void endExternalSubset() {
         fInExternalSubset = false;
     }
-
+    
     /**
      * Starts an entity.
      * <p>
@@ -1287,9 +1288,9 @@
             XMLInputSource xmlInputSource,
             boolean literal, boolean isExternal)
             throws IOException, XNIException {
-
+       
         String encoding = setupCurrentEntity(name, xmlInputSource, literal, isExternal);
-
+        
         //when entity expansion limit is set by the Application, we need to
         //check for the entity expansion limit set by the parser, if number of entity
         //expansions exceeds the entity expansion limit, parser will throw fatal error.
@@ -1310,30 +1311,30 @@
         if (fEntityHandler != null) {
             fEntityHandler.startEntity(name, fResourceIdentifier, encoding, null);
         }
-
+        
     } // startEntity(String,XMLInputSource)
-
+    
     /**
      * Return the current entity being scanned. Current entity is SET using startEntity function.
      * @return Entity.ScannedEntity
      */
-
+    
     public Entity.ScannedEntity getCurrentEntity(){
         return fCurrentEntity ;
     }
-
+    
     /**
      * Return the top level entity handled by this manager, or null
      * if no entity was added.
      */
     public Entity.ScannedEntity getTopLevelEntity() {
-        return (Entity.ScannedEntity)
+        return (Entity.ScannedEntity) 
             (fEntityStack.empty() ? null : fEntityStack.elementAt(0));
     }
-
+    
     // a list of Readers ever seen
     protected Vector fOwnReaders = new Vector();
-
+    
     /**
      * Close all opened InputStreams and Readers opened by this parser.
      */
@@ -1349,18 +1350,18 @@
         // and clear the list
         fOwnReaders.removeAllElements();
     }
-
+    
     public void endEntity() throws IOException, XNIException {
-
+        
         // call handler
         if (DEBUG_BUFFER) {
             System.out.print("(endEntity: ");
             print();
             System.out.println();
-        }
-        //pop the entity from the stack
+        }                
+        //pop the entity from the stack 
         Entity.ScannedEntity entity = fEntityStack.size() > 0 ? (Entity.ScannedEntity)fEntityStack.pop() : null ;
-
+        
         if (fEntityHandler != null) {
             //so this is the last opened entity, signal it to current fEntityHandler using Augmentation
             if(entity == null){
@@ -1374,38 +1375,38 @@
         }
         //check if it is a document entity
         boolean documentEntity = fCurrentEntity.name == XMLEntity;
-
+        
         //close the reader
         if(fCurrentEntity != null){
             //close the reader
             try{
-                fCurrentEntity.reader.close();
+                fCurrentEntity.close();
             }catch(IOException ex){
                 throw new XNIException(ex);
             }
         }
-
+        
         //set popped entity as current entity
         fCurrentEntity = entity;
         fEntityScanner.setCurrentEntity(fCurrentEntity);
-
+        
         //check if there are any entity left in the stack -- if there are
-        //no entries EOF has been reached.
+        //no entries EOF has been reached.        
         // throw exception when it is the last entity but it is not a document entity
-
+        
         if(fCurrentEntity == null & !documentEntity){
             throw new EOFException() ;
         }
-
+         
         if (DEBUG_BUFFER) {
             System.out.print(")endEntity: ");
             print();
             System.out.println();
         }
-
+        
     } // endEntity()
-
-
+    
+    
     //
     // XMLComponent methods
     //
@@ -1422,7 +1423,7 @@
         } catch (XMLConfigurationException e) {
             fStaxEntityResolver = null;
         }
-
+        
         // initialize state
         //fStandalone = false;
         fEntities.clear();
@@ -1432,10 +1433,10 @@
         fExternalGeneralEntities = true;
         fExternalParameterEntities = true;
         fAllowJavaEncodings = true ;
-
+        
         //test();
     }
-
+    
     /**
      * Resets the component. The component can query the component manager
      * about any features and properties that affect the operation of the
@@ -1467,11 +1468,11 @@
                 fEntityScanner.reset(componentManager);
             }
             if(fEntityStorage != null){
-                fEntityStorage.reset(componentManager);
+                fEntityStorage.reset(componentManager);            
             }
             return;
         }
-
+        
         // sax features
         try {
             fValidation = componentManager.getFeature(VALIDATION);
@@ -1488,14 +1489,14 @@
         } catch (XMLConfigurationException e) {
             fExternalParameterEntities = true;
         }
-
+        
         // xerces features
         try {
             fAllowJavaEncodings = componentManager.getFeature(ALLOW_JAVA_ENCODINGS);
         } catch (XMLConfigurationException e) {
             fAllowJavaEncodings = false;
         }
-
+        
         try {
             fWarnDuplicateEntityDef = componentManager.getFeature(WARN_ON_DUPLICATE_ENTITYDEF);
         } catch (XMLConfigurationException e) {
@@ -1506,7 +1507,7 @@
         } catch (XMLConfigurationException e) {
             fStrictURI = false;
         }
-
+        
         // xerces properties
         fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
         fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
@@ -1515,13 +1516,13 @@
         } catch (XMLConfigurationException e) {
             fEntityResolver = null;
         }
-
+        
         try {
             fStaxEntityResolver = (StaxEntityResolverWrapper)componentManager.getProperty(STAX_ENTITY_RESOLVER);
         } catch (XMLConfigurationException e) {
             fStaxEntityResolver = null;
         }
-
+        
         try {
             fValidationManager = (ValidationManager)componentManager.getProperty(VALIDATION_MANAGER);
         }
@@ -1537,18 +1538,18 @@
 
         //reset general state
         reset();
-
+        
         fEntityScanner.reset(componentManager);
         fEntityStorage.reset(componentManager);
-
+        
     } // reset(XMLComponentManager)
-
+    
     // reset general state.  Should not be called other than by
     // a class acting as a component manager but not
     // implementing that interface for whatever reason.
     public void reset() {
         fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
-
+                
         // initialize state
         fStandalone = false;
         fEntities.clear();
@@ -1596,11 +1597,11 @@
             }
         }
         fEntityHandler = null;
-
+               
         // reset scanner
         //if(fEntityScanner!=null)
           //  fEntityScanner.reset(fSymbolTable, this,fErrorReporter);
-
+        
     }
     /**
      * Returns a list of feature identifiers that are recognized by
@@ -1610,7 +1611,7 @@
     public String[] getRecognizedFeatures() {
         return (String[])(RECOGNIZED_FEATURES.clone());
     } // getRecognizedFeatures():String[]
-
+    
     /**
      * Sets the state of a feature. This method is called by the component
      * manager any time after reset when a feature changes state.
@@ -1628,18 +1629,18 @@
      */
     public void setFeature(String featureId, boolean state)
     throws XMLConfigurationException {
-
+        
         // xerces features
         if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
             final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
-            if (suffixLength == Constants.ALLOW_JAVA_ENCODINGS_FEATURE.length() &&
+            if (suffixLength == Constants.ALLOW_JAVA_ENCODINGS_FEATURE.length() && 
                 featureId.endsWith(Constants.ALLOW_JAVA_ENCODINGS_FEATURE)) {
                 fAllowJavaEncodings = state;
             }
         }
-
+        
     } // setFeature(String,boolean)
-
+    
     /**
      * Sets the value of a property. This method is called by the component
      * manager any time after reset when a property changes value.
@@ -1659,23 +1660,23 @@
         // Xerces properties
         if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
             final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
-
-            if (suffixLength == Constants.SYMBOL_TABLE_PROPERTY.length() &&
+        	
+            if (suffixLength == Constants.SYMBOL_TABLE_PROPERTY.length() && 
                 propertyId.endsWith(Constants.SYMBOL_TABLE_PROPERTY)) {
                 fSymbolTable = (SymbolTable)value;
                 return;
             }
-            if (suffixLength == Constants.ERROR_REPORTER_PROPERTY.length() &&
+            if (suffixLength == Constants.ERROR_REPORTER_PROPERTY.length() && 
                 propertyId.endsWith(Constants.ERROR_REPORTER_PROPERTY)) {
                 fErrorReporter = (XMLErrorReporter)value;
                 return;
             }
-            if (suffixLength == Constants.ENTITY_RESOLVER_PROPERTY.length() &&
+            if (suffixLength == Constants.ENTITY_RESOLVER_PROPERTY.length() && 
                 propertyId.endsWith(Constants.ENTITY_RESOLVER_PROPERTY)) {
                 fEntityResolver = (XMLEntityResolver)value;
                 return;
             }
-            if (suffixLength == Constants.BUFFER_SIZE_PROPERTY.length() &&
+            if (suffixLength == Constants.BUFFER_SIZE_PROPERTY.length() && 
                 propertyId.endsWith(Constants.BUFFER_SIZE_PROPERTY)) {
                 Integer bufferSize = (Integer)value;
                 if (bufferSize != null &&
@@ -1685,13 +1686,13 @@
                     fBufferPool.setExternalBufferSize(fBufferSize);
                 }
             }
-            if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() &&
+            if (suffixLength == Constants.SECURITY_MANAGER_PROPERTY.length() && 
                 propertyId.endsWith(Constants.SECURITY_MANAGER_PROPERTY)) {
-                fSecurityManager = (SecurityManager)value;
+                fSecurityManager = (SecurityManager)value; 
                 fEntityExpansionLimit = (fSecurityManager != null)?fSecurityManager.getEntityExpansionLimit():0;
             }
         }
-
+        
     }
     /**
      * Returns a list of property identifiers that are recognized by
@@ -1718,7 +1719,7 @@
         }
         return null;
     } // getFeatureDefault(String):Boolean
-
+    
     /**
      * Returns the default state for a property, or null if this
      * component does not want to report a default value for this
@@ -1736,11 +1737,11 @@
         }
         return null;
     } // getPropertyDefault(String):Object
-
+    
     //
     // Public static methods
     //
-
+    
     /**
      * Expands a system id and returns the system id as a URI, if
      * it can be expanded. A return value of null means that the
@@ -1757,7 +1758,7 @@
     public static String expandSystemId(String systemId) {
         return expandSystemId(systemId, null);
     } // expandSystemId(String):String
-
+    
     //
     // Public static methods
     //
@@ -1816,7 +1817,7 @@
         }
 
         // return empty string if property value is empty string.
-        if (userDir.length() == 0)
+        if (userDir.length() == 0) 
             return new URI("file", "", "", null, null);
         // compute the new escaped value if the new property value doesn't
         // match the previous one
@@ -1900,19 +1901,19 @@
 
         return gUserDirURI;
     }
-
+    
     /**
      * Absolutizes a URI using the current value
      * of the "user.dir" property as the base URI. If
      * the URI is already absolute, this is a no-op.
-     *
+     * 
      * @param uri the URI to absolutize
      */
-    public static void absolutizeAgainstUserDir(URI uri)
+    public static void absolutizeAgainstUserDir(URI uri) 
         throws URI.MalformedURIException {
         uri.absolutize(getUserDir());
     }
-
+    
     /**
      * Expands a system id and returns the system id as a URI, if
      * it can be expanded. A return value of null means that the
@@ -1997,8 +1998,8 @@
     public static String expandSystemId(String systemId, String baseSystemId,
                                         boolean strict)
             throws URI.MalformedURIException {
-
-        // check if there is a system id before
+            
+        // check if there is a system id before 
         // trying to expand it.
         if (systemId == null) {
             return null;
@@ -2008,7 +2009,7 @@
         if (strict) {
 
 
-            // check if there is a system id before
+            // check if there is a system id before 
             // trying to expand it.
             if (systemId == null) {
                 return null;
@@ -2061,7 +2062,7 @@
 
         // normalize id
         String id = fixURI(systemId);
-
+        
         // normalize base
         URI base = null;
         URI uri = null;
@@ -2090,7 +2091,7 @@
         }
         catch (Exception e) {
             // let it go through
-
+            
         }
 
         if (uri == null) {
@@ -2163,7 +2164,7 @@
             if (systemURI.getScheme().length() > 1) {
                 return systemId;
             }
-            /**
+            /** 
              * If the scheme's length is only one character,
              * it's likely that this was intended as a file
              * path. Fixing this up in expandSystemId to
@@ -2187,7 +2188,7 @@
 
         // absolutize the system identifier using the base URI
         systemURI.absolutize(baseURI);
-
+        
         // return the string rep of the new uri (an absolute one)
         return systemURI.toString();
 
@@ -2398,7 +2399,7 @@
             System.out.println();
         }
         return new BufferedReader( new InputStreamReader(inputStream, javaEncoding));
-
+        
     } // createReader(InputStream,String, Boolean): Reader
 
 
@@ -2594,12 +2595,34 @@
                 str = "file:" + str;
             }
         }
-
+        
+        // replace spaces in file names with %20.
+        // Original comment from JDK5: the following algorithm might not be
+        // very performant, but people who want to use invalid URI's have to
+        // pay the price.
+        int pos = str.indexOf(' ');
+        if (pos >= 0) {
+            StringBuilder sb = new StringBuilder(str.length());
+            // put characters before ' ' into the string builder
+            for (int i = 0; i < pos; i++)
+                sb.append(str.charAt(i));
+            // and %20 for the space
+            sb.append("%20");
+            // for the remamining part, also convert ' ' to "%20".
+            for (int i = pos+1; i < str.length(); i++) {
+                if (str.charAt(i) == ' ')
+                    sb.append("%20");
+                else
+                    sb.append(str.charAt(i));
+            }
+            str = sb.toString();
+        }
+        
         // done
         return str;
 
     } // fixURI(String):String
-
+    
     /**
      * Escape invalid URI characters.
      *
@@ -2623,7 +2646,7 @@
         if (str == null) {
             return str;
         }
-
+        
         // get UTF-8 bytes for the string
         StringBuffer buffer = new StringBuffer();
         byte[] bytes = null;
@@ -2657,7 +2680,7 @@
             }
         }
         return buffer.toString();
-    }
+    } 
 
     //
     // Package visible methods
@@ -2714,36 +2737,36 @@
             }
         }
     } // print()
-
+    
     /**
      * Buffer used in entity manager to reuse character arrays instead
      * of creating new ones every time.
-     *
+     * 
      * @xerces.internal
-     *
+     * 
      * @author Ankit Pasricha, IBM
      */
     private static class CharacterBuffer {
 
         /** character buffer */
         private char[] ch;
-
+        
         /** whether the buffer is for an external or internal scanned entity */
         private boolean isExternal;
-
+        
         public CharacterBuffer(boolean isExternal, int size) {
             this.isExternal = isExternal;
             ch = new char[size];
         }
     }
-
-
+    
+    
      /**
      * Stores a number of character buffers and provides it to the entity
      * manager to use when an entity is seen.
-     *
-     * @xerces.internal
-     *
+     * 
+     * @xerces.internal 
+     * 
      * @author Ankit Pasricha, IBM
      */
     private static class CharacterBufferPool {
@@ -2818,7 +2841,7 @@
             fExternalTop = -1;
         }
     }
-
+        
     /**
     * This class wraps the byte inputstreams we're presented with.
     * We need it because java.io.InputStreams don't provide
@@ -2837,7 +2860,7 @@
     * won't buffer data read this way!</strong>
     *
     * @xerces.internal
-    *
+    *  
     * @author Neil Graham, IBM
     * @author Glenn Marcy, IBM
     */
@@ -2892,21 +2915,21 @@
             fOffset++;
             return b & 0xff;
         }
-
+ 
         public int read(byte[] b, int off, int len) throws IOException {
             int bytesLeft = fLength - fOffset;
             if (bytesLeft == 0) {
                 if (fOffset == fEndOffset) {
                     return -1;
                 }
-
+               
                 /**
                  * //System.out.println("fCurrentEntitty = " + fCurrentEntity );
                  * //System.out.println("fInputStream = " + fInputStream );
                  * // better get some more for the voracious reader... */
-
+                
                 if(fCurrentEntity.mayReadChunks || !fCurrentEntity.xmlDeclChunkRead) {
-
+                    
                     if (!fCurrentEntity.xmlDeclChunkRead)
                     {
                         fCurrentEntity.xmlDeclChunkRead = true;
@@ -2914,15 +2937,15 @@
                     }
                     return fInputStream.read(b, off, len);
                 }
-
+                 
                 int returnedVal = read();
                 if(returnedVal == -1) {
                   fEndOffset = fOffset;
                   return -1;
                 }
                 b[off] = (byte)returnedVal;
-                return 1;
-
+                return 1; 
+               
             }
             if (len < bytesLeft) {
                 if (len <= 0) {
@@ -3003,7 +3026,7 @@
             }
         }
     } // end of RewindableInputStream class
-
+            
     public void test(){
         //System.out.println("TESTING: Added familytree to entityManager");
         //Usecase1
@@ -3027,5 +3050,5 @@
         fEntityStorage.addInternalEntity("ch1","&#84;");
         fEntityStorage.addInternalEntity("% ch2","param");
     }
-
+            
 } // class XMLEntityManager
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLScanner.java	Wed Sep 28 16:49:43 2011 +0100
@@ -66,170 +66,171 @@
  * @author Eric Ye, IBM
  * @author K.Venugopal SUN Microsystems
  * @author Sunitha Reddy, SUN Microsystems
+ * @version $Id: XMLScanner.java,v 1.11 2009/08/18 00:54:44 joehw Exp $
  */
 public abstract class XMLScanner
         implements XMLComponent {
-
+    
     //
     // Constants
     //
-
+    
     // feature identifiers
-
+    
     /** Feature identifier: namespaces. */
     protected static final String NAMESPACES =
             Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
-
+    
     /** Feature identifier: validation. */
     protected static final String VALIDATION =
             Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
-
+    
     /** Feature identifier: notify character references. */
     protected static final String NOTIFY_CHAR_REFS =
             Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_CHAR_REFS_FEATURE;
-
+    
     // property identifiers
-
-    protected static final String PARSER_SETTINGS =
-                                Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
+    
+    protected static final String PARSER_SETTINGS = 
+				Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;    
     /** Property identifier: symbol table. */
     protected static final String SYMBOL_TABLE =
             Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
-
+    
     /** Property identifier: error reporter. */
     protected static final String ERROR_REPORTER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
+    
     /** Property identifier: entity manager. */
     protected static final String ENTITY_MANAGER =
             Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
-
+    
     // debugging
-
+    
     /** Debug attribute normalization. */
     protected static final boolean DEBUG_ATTR_NORMALIZATION = false;
-
-
+    
+    
     //xxx: setting the default value as false, as we dont need to calculate this value
     //we should have a feature when set to true computes this value
     private boolean fNeedNonNormalizedValue = false;
-
+    
     protected ArrayList attributeValueCache = new ArrayList();
     protected ArrayList stringBufferCache = new ArrayList();
     protected int fStringBufferIndex = 0;
     protected boolean fAttributeCacheInitDone = false;
     protected int fAttributeCacheUsedCount = 0;
-
+    
     //
     // Data
     //
-
+    
     // features
-
+    
     /**
      * Validation. This feature identifier is:
      * http://xml.org/sax/features/validation
      */
     protected boolean fValidation = false;
-
+    
     /** Namespaces. */
     protected boolean fNamespaces;
-
+    
     /** Character references notification. */
     protected boolean fNotifyCharRefs = false;
 
     /** Internal parser-settings feature */
-        protected boolean fParserSettings = true;
-
+	protected boolean fParserSettings = true;
+    
     // properties
-
+    
     protected PropertyManager fPropertyManager = null ;
     /** Symbol table. */
     protected SymbolTable fSymbolTable;
-
+    
     /** Error reporter. */
     protected XMLErrorReporter fErrorReporter;
-
+    
     /** Entity manager. */
     //protected XMLEntityManager fEntityManager = PropertyManager.getEntityManager();
     protected XMLEntityManager fEntityManager = null ;
-
+    
     /** xxx this should be available from EntityManager Entity storage */
     protected XMLEntityStorage fEntityStore = null ;
-
+    
     // protected data
-
+    
     /** event type */
     protected XMLEvent fEvent ;
-
+    
     /** Entity scanner, this alwasy works on last entity that was opened. */
     protected XMLEntityScanner fEntityScanner = null;
-
+    
     /** Entity depth. */
     protected int fEntityDepth;
-
+    
     /** Literal value of the last character refence scanned. */
     protected String fCharRefLiteral = null;
-
+    
     /** Scanning attribute. */
     protected boolean fScanningAttribute;
-
+    
     /** Report entity boundary. */
     protected boolean fReportEntity;
-
+    
     // symbols
-
+    
     /** Symbol: "version". */
     protected final static String fVersionSymbol = "version".intern();
-
+    
     /** Symbol: "encoding". */
     protected final static String fEncodingSymbol = "encoding".intern();
-
+    
     /** Symbol: "standalone". */
     protected final static String fStandaloneSymbol = "standalone".intern();
-
+    
     /** Symbol: "amp". */
     protected final static String fAmpSymbol = "amp".intern();
-
+    
     /** Symbol: "lt". */
     protected final static String fLtSymbol = "lt".intern();
-
+    
     /** Symbol: "gt". */
     protected final static String fGtSymbol = "gt".intern();
-
+    
     /** Symbol: "quot". */
     protected final static String fQuotSymbol = "quot".intern();
-
+    
     /** Symbol: "apos". */
     protected final static String fAposSymbol = "apos".intern();
-
+    
     // temporary variables
-
+    
     // NOTE: These objects are private to help prevent accidental modification
     //       of values by a subclass. If there were protected *and* the sub-
     //       modified the values, it would be difficult to track down the real
     //       cause of the bug. By making these private, we avoid this
     //       possibility.
-
+    
     /** String. */
     private XMLString fString = new XMLString();
-
+    
     /** String buffer. */
     private XMLStringBuffer fStringBuffer = new XMLStringBuffer();
-
+    
     /** String buffer. */
     private XMLStringBuffer fStringBuffer2 = new XMLStringBuffer();
-
+    
     /** String buffer. */
     private XMLStringBuffer fStringBuffer3 = new XMLStringBuffer();
-
+    
     // temporary location for Resource identification information.
     protected XMLResourceIdentifierImpl fResourceIdentifier = new XMLResourceIdentifierImpl();
     int initialCacheCount = 6;
     //
     // XMLComponent methods
     //
-
+    
     /**
      *
      *
@@ -240,28 +241,28 @@
      */
     public void reset(XMLComponentManager componentManager)
     throws XMLConfigurationException {
-
-                try {
-                        fParserSettings = componentManager.getFeature(PARSER_SETTINGS);
-                } catch (XMLConfigurationException e) {
-                        fParserSettings = true;
-                }
+        
+		try {
+			fParserSettings = componentManager.getFeature(PARSER_SETTINGS);
+		} catch (XMLConfigurationException e) {
+			fParserSettings = true;
+		}
 
-                if (!fParserSettings) {
-                        // parser settings have not been changed
-                        init();
-                        return;
-                }
+		if (!fParserSettings) {
+			// parser settings have not been changed
+			init();
+			return;
+		}
 
-
+        
         // Xerces properties
         fSymbolTable = (SymbolTable)componentManager.getProperty(SYMBOL_TABLE);
         fErrorReporter = (XMLErrorReporter)componentManager.getProperty(ERROR_REPORTER);
         fEntityManager = (XMLEntityManager)componentManager.getProperty(ENTITY_MANAGER);
-
+        
         //this step is extra because we have separated the storage of entity
         fEntityStore = fEntityManager.getEntityStore() ;
-
+        
         // sax features
         try {
             fValidation = componentManager.getFeature(VALIDATION);
@@ -279,14 +280,14 @@
         } catch (XMLConfigurationException e) {
             fNotifyCharRefs = false;
         }
-
+        
         init();
     } // reset(XMLComponentManager)
-
+    
     protected void setPropertyManager(PropertyManager propertyManager){
         fPropertyManager = propertyManager ;
     }
-
+        
     /**
      * Sets the value of a property during parsing.
      *
@@ -295,7 +296,7 @@
      */
     public void setProperty(String propertyId, Object value)
     throws XMLConfigurationException {
-
+        
         // Xerces properties
         if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
             String property =
@@ -313,28 +314,28 @@
             //TODO::discuss with neeraj what are his thoughts on passing properties.
             //For now use this
         }*/
-
+        
     } // setProperty(String,Object)
-
+    
     /*
      * Sets the feature of the scanner.
      */
     public void setFeature(String featureId, boolean value)
     throws XMLConfigurationException {
-
+        
         if (VALIDATION.equals(featureId)) {
             fValidation = value;
         } else if (NOTIFY_CHAR_REFS.equals(featureId)) {
             fNotifyCharRefs = value;
         }
     }
-
+    
     /*
      * Gets the state of the feature of the scanner.
      */
     public boolean getFeature(String featureId)
     throws XMLConfigurationException {
-
+        
         if (VALIDATION.equals(featureId)) {
             return fValidation;
         } else if (NOTIFY_CHAR_REFS.equals(featureId)) {
@@ -342,11 +343,11 @@
         }
         throw new XMLConfigurationException(XMLConfigurationException.NOT_RECOGNIZED, featureId);
     }
-
+    
     //
     // Protected methods
     //
-
+    
     // anybody calling this had better have set Symtoltable!
     protected void reset() {
         init();
@@ -356,14 +357,14 @@
         fNotifyCharRefs = false;
 
     }
-
+    
     public void reset(PropertyManager propertyManager) {
         init();
         // Xerces properties
         fSymbolTable = (SymbolTable)propertyManager.getProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY);
-
+        
         fErrorReporter = (XMLErrorReporter)propertyManager.getProperty(Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY);
-
+        
         fEntityManager = (XMLEntityManager)propertyManager.getProperty(ENTITY_MANAGER);
         fEntityStore = fEntityManager.getEntityStore() ;
         fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner() ;
@@ -371,10 +372,10 @@
         // DTD preparsing defaults:
         fValidation = false;
         fNotifyCharRefs = false;
-
+        
     }
     // common scanning methods
-
+    
     /**
      * Scans an XML or text declaration.
      * <p>
@@ -402,19 +403,19 @@
     protected void scanXMLDeclOrTextDecl(boolean scanningTextDecl,
             String[] pseudoAttributeValues)
             throws IOException, XNIException {
-
+        
         // pseudo-attribute values
         String version = null;
         String encoding = null;
         String standalone = null;
-
+        
         // scan pseudo-attributes
         final int STATE_VERSION = 0;
         final int STATE_ENCODING = 1;
         final int STATE_STANDALONE = 2;
         final int STATE_DONE = 3;
         int state = STATE_VERSION;
-
+        
         boolean dataFoundForTarget = false;
         boolean sawSpace = fEntityScanner.skipSpaces();
         while (fEntityScanner.peekChar() != '?') {
@@ -435,7 +436,7 @@
                             reportFatalError("VersionNotSupported",
                                     new Object[]{version});
                         }
-
+                        
                         if (version.equals("1.1")) {
                             Entity.ScannedEntity top = fEntityManager.getTopLevelEntity();
                             if (top != null && (top.version == null || top.version.equals("1.0"))) {
@@ -443,7 +444,7 @@
                             }
                             fEntityManager.setScannerVersion(Constants.XML_VERSION_1_1);
                         }
-
+                        
                     } else if (name.equals(fEncodingSymbol)) {
                         if (!scanningTextDecl) {
                             reportFatalError("VersionInfoRequired", null);
@@ -485,7 +486,7 @@
                         standalone = fString.toString();
                         state = STATE_DONE;
                         if (!standalone.equals("yes") && !standalone.equals("no")) {
-                            reportFatalError("SDDeclInvalid", null);
+                            reportFatalError("SDDeclInvalid", new Object[] {standalone});
                         }
                     } else {
                         reportFatalError("EncodingDeclRequired", null);
@@ -501,7 +502,7 @@
                         standalone = fString.toString();
                         state = STATE_DONE;
                         if (!standalone.equals("yes") && !standalone.equals("no")) {
-                            reportFatalError("SDDeclInvalid", null);
+                            reportFatalError("SDDeclInvalid",  new Object[] {standalone});
                         }
                     } else {
                         reportFatalError("EncodingDeclRequired", null);
@@ -518,7 +519,7 @@
         if (scanningTextDecl && state != STATE_DONE) {
             reportFatalError("MorePseudoAttributes", null);
         }
-
+        
         // If there is no data in the xml or text decl then we fail to report error
         // for version or encoding info above.
         if (scanningTextDecl) {
@@ -530,23 +531,23 @@
                 reportFatalError("VersionInfoRequired", null);
             }
         }
-
+        
         // end
         if (!fEntityScanner.skipChar('?')) {
             reportFatalError("XMLDeclUnterminated", null);
         }
         if (!fEntityScanner.skipChar('>')) {
             reportFatalError("XMLDeclUnterminated", null);
-
+            
         }
-
+        
         // fill in return array
         pseudoAttributeValues[0] = version;
         pseudoAttributeValues[1] = encoding;
         pseudoAttributeValues[2] = standalone;
-
+        
     } // scanXMLDeclOrTextDecl(boolean)
-
+    
     /**
      * Scans a pseudo attribute.
      *
@@ -565,10 +566,10 @@
     public String scanPseudoAttribute(boolean scanningTextDecl,
             XMLString value)
             throws IOException, XNIException {
-
+        
         String name = fEntityScanner.scanName();
         // XMLEntityManager.print(fEntityManager.getCurrentEntity());
-
+        
         if (name == null) {
             reportFatalError("PseudoAttrNameExpected", null);
         }
@@ -612,12 +613,12 @@
                     : "CloseQuoteMissingInXMLDecl",
                     new Object[]{name});
         }
-
+        
         // return
         return name;
-
+        
     } // scanPseudoAttribute(XMLString):String
-
+    
     /**
      * Scans a processing instruction.
      * <p>
@@ -631,22 +632,22 @@
     //NOW: scanPI(XMLStringBuffer)
     //it makes things more easy if XMLStringBUffer is passed. Motivation for this change is same
     // as that for scanContent()
-
+    
     protected void scanPI(XMLStringBuffer data) throws IOException, XNIException {
-
+        
         // target
         fReportEntity = false;
         String target = fEntityScanner.scanName();
         if (target == null) {
             reportFatalError("PITargetRequired", null);
         }
-
+        
         // scan data
         scanPIData(target, data);
         fReportEntity = true;
-
+        
     } // scanPI(XMLStringBuffer)
-
+    
     /**
      * Scans a processing data. This is needed to handle the situation
      * where a document starts with a processing instruction whose
@@ -658,16 +659,16 @@
      * @param target The PI target
      * @param data The string to fill in with the data
      */
-
+    
     //CHANGED:
     //Earlier:This method uses the fStringBuffer and later buffer values are set to
     //the supplied XMLString....
     //Now: Changed the signature of this function to pass XMLStringBuffer.. and data would
     //be appended to that buffer
-
+    
     protected void scanPIData(String target, XMLStringBuffer data)
     throws IOException, XNIException {
-
+        
         // check target
         if (target.length() == 3) {
             char c0 = Character.toLowerCase(target.charAt(0));
@@ -677,7 +678,7 @@
                 reportFatalError("ReservedPITarget", null);
             }
         }
-
+        
         // spaces
         if (!fEntityScanner.skipSpaces()) {
             if (fEntityScanner.skipString("?>")) {
@@ -688,7 +689,7 @@
                 reportFatalError("SpaceRequiredInPI", null);
             }
         }
-
+        
         // since scanData appends the parsed data to the buffer passed
         // a while loop would append the whole of parsed data to the buffer(data:XMLStringBuffer)
         //until all of the data is buffered.
@@ -706,9 +707,9 @@
                 }
             } while (fEntityScanner.scanData("?>", data));
         }
-
+        
     } // scanPIData(String,XMLString)
-
+    
     /**
      * Scans a comment.
      * <p>
@@ -724,17 +725,17 @@
      */
     protected void scanComment(XMLStringBuffer text)
     throws IOException, XNIException {
-
+        
         //System.out.println( "XMLScanner#scanComment# In Scan Comment" );
         // text
         // REVISIT: handle invalid character, eof
         text.clear();
         while (fEntityScanner.scanData("--", text)) {
             int c = fEntityScanner.peekChar();
-
+            
             //System.out.println( "XMLScanner#scanComment#text.toString() == " + text.toString() );
             //System.out.println( "XMLScanner#scanComment#c == " + c );
-
+            
             if (c != -1) {
                 if (XMLChar.isHighSurrogate(c)) {
                     scanSurrogates(text);
@@ -749,9 +750,9 @@
         if (!fEntityScanner.skipChar('>')) {
             reportFatalError("DashDashInComment", null);
         }
-
+        
     } // scanComment()
-
+    
     /**
      * Scans an attribute value and normalizes whitespace converting all
      * whitespace characters to space characters.
@@ -782,10 +783,10 @@
         if (quote != '\'' && quote != '"') {
             reportFatalError("OpenQuoteExpected", new Object[]{atName});
         }
-
+        
         fEntityScanner.scanChar();
         int entityDepth = fEntityDepth;
-
+        
         int c = fEntityScanner.scanLiteral(quote, value);
         if (DEBUG_ATTR_NORMALIZATION) {
             System.out.println("** scanLiteral -> \""
@@ -825,7 +826,7 @@
                             ch = scanCharReferenceValue(stringBuffer, fStringBuffer2);
                         else
                             ch = scanCharReferenceValue(stringBuffer, null);
-
+                        
                         if (ch != -1) {
                             if (DEBUG_ATTR_NORMALIZATION) {
                                 System.out.println("** value3: \""
@@ -966,15 +967,15 @@
         }
         if(fNeedNonNormalizedValue)
             nonNormalizedValue.setValues(fStringBuffer2);
-
+        
         // quote
         int cquote = fEntityScanner.scanChar();
         if (cquote != quote) {
             reportFatalError("CloseQuoteExpected", new Object[]{atName});
         }
     } // scanAttributeValue()
-
-
+    
+    
     /**
      * Scans External ID and return the public and system IDs.
      *
@@ -988,7 +989,7 @@
     protected void scanExternalID(String[] identifiers,
             boolean optionalSystemId)
             throws IOException, XNIException {
-
+        
         String systemId = null;
         String publicId = null;
         if (fEntityScanner.skipString("PUBLIC")) {
@@ -997,12 +998,12 @@
             }
             scanPubidLiteral(fString);
             publicId = fString.toString();
-
+            
             if (!fEntityScanner.skipSpaces() && !optionalSystemId) {
                 reportFatalError("SpaceRequiredBetweenPublicAndSystem", null);
             }
         }
-
+        
         if (publicId != null || fEntityScanner.skipString("SYSTEM")) {
             if (publicId == null && !fEntityScanner.skipSpaces()) {
                 reportFatalError("SpaceRequiredAfterSYSTEM", null);
@@ -1040,13 +1041,13 @@
                 reportFatalError("SystemIDUnterminated", null);
             }
         }
-
+        
         // store result in array
         identifiers[0] = systemId;
         identifiers[1] = publicId;
     }
-
-
+    
+    
     /**
      * Scans public ID literal.
      *
@@ -1073,7 +1074,7 @@
             reportFatalError("QuoteRequiredInPublicID", null);
             return false;
         }
-
+        
         fStringBuffer.clear();
         // skip leading whitespace
         boolean skipSpace = true;
@@ -1107,8 +1108,8 @@
         }
         return dataok;
     }
-
-
+    
+    
     /**
      * Normalize whitespace in an XMLString converting all whitespace
      * characters to space characters.
@@ -1127,11 +1128,11 @@
             i++;
         }
     }
-
+    
     //
     // XMLEntityHandler methods
     //
-
+    
     /**
      * This method notifies of the start of an entity. The document entity
      * has the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]"
@@ -1151,14 +1152,14 @@
     public void startEntity(String name,
             XMLResourceIdentifier identifier,
             String encoding, Augmentations augs) throws XNIException {
-
+        
         // keep track of the entity depth
         fEntityDepth++;
         // must reset entity scanner
         fEntityScanner = fEntityManager.getEntityScanner();
         fEntityStore = fEntityManager.getEntityStore() ;
     } // startEntity(String,XMLResourceIdentifier,String)
-
+    
     /**
      * This method notifies the end of an entity. The document entity has
      * the pseudo-name of "[xml]" the DTD has the pseudo-name of "[dtd]"
@@ -1170,12 +1171,12 @@
      * @throws XNIException Thrown by handler to signal an error.
      */
     public void endEntity(String name, Augmentations augs) throws IOException, XNIException {
-
+        
         // keep track of the entity depth
         fEntityDepth--;
-
+        
     } // endEntity(String)
-
+    
     /**
      * Scans a character reference and append the corresponding chars to the
      * specified buffer.
@@ -1202,7 +1203,7 @@
             hex = true;
             fStringBuffer3.clear();
             boolean digit = true;
-
+            
             int c = fEntityScanner.peekChar();
             digit = (c >= '0' && c <= '9') ||
                     (c >= 'a' && c <= 'f') ||
@@ -1211,7 +1212,7 @@
                 if (buf2 != null) { buf2.append((char)c); }
                 fEntityScanner.scanChar();
                 fStringBuffer3.append((char)c);
-
+                
                 do {
                     c = fEntityScanner.peekChar();
                     digit = (c >= '0' && c <= '9') ||
@@ -1227,19 +1228,19 @@
                 reportFatalError("HexdigitRequiredInCharRef", null);
             }
         }
-
+        
         // scan decimal value
         else {
             fStringBuffer3.clear();
             boolean digit = true;
-
+            
             int c = fEntityScanner.peekChar();
             digit = c >= '0' && c <= '9';
             if (digit) {
                 if (buf2 != null) { buf2.append((char)c); }
                 fEntityScanner.scanChar();
                 fStringBuffer3.append((char)c);
-
+                
                 do {
                     c = fEntityScanner.peekChar();
                     digit = c >= '0' && c <= '9';
@@ -1253,19 +1254,19 @@
                 reportFatalError("DigitRequiredInCharRef", null);
             }
         }
-
+        
         // end
         if (!fEntityScanner.skipChar(';')) {
             reportFatalError("SemicolonRequiredInCharRef", null);
         }
         if (buf2 != null) { buf2.append(';'); }
-
+        
         // convert string to number
         int value = -1;
         try {
             value = Integer.parseInt(fStringBuffer3.toString(),
                     hex ? 16 : 10);
-
+            
             // character reference must be a valid XML character
             if (isInvalid(value)) {
                 StringBuffer errorBuf = new StringBuffer(fStringBuffer3.length + 1);
@@ -1283,7 +1284,7 @@
             reportFatalError("InvalidCharRef",
                     new Object[]{errorBuf.toString()});
         }
-
+        
         // append corresponding chars to the given buffer
         if (!XMLChar.isSupplemental(value)) {
             buf.append((char) value);
@@ -1292,7 +1293,7 @@
             buf.append(XMLChar.highSurrogate(value));
             buf.append(XMLChar.lowSurrogate(value));
         }
-
+        
         // char refs notification code
         if (fNotifyCharRefs && value != -1) {
             String literal = "#" + (hex ? "x" : "") + fStringBuffer3.toString();
@@ -1300,7 +1301,7 @@
                 fCharRefLiteral = literal;
             }
         }
-
+        
         return value;
     }
     // returns true if the given character is not
@@ -1309,39 +1310,39 @@
     protected boolean isInvalid(int value) {
         return (XMLChar.isInvalid(value));
     } // isInvalid(int):  boolean
-
+    
     // returns true if the given character is not
     // valid or may not be used outside a character reference
     // with respect to the version of XML understood by this scanner.
     protected boolean isInvalidLiteral(int value) {
         return (XMLChar.isInvalid(value));
     } // isInvalidLiteral(int):  boolean
-
+    
     // returns true if the given character is
     // a valid nameChar with respect to the version of
     // XML understood by this scanner.
     protected boolean isValidNameChar(int value) {
         return (XMLChar.isName(value));
     } // isValidNameChar(int):  boolean
-
+    
     // returns true if the given character is
     // a valid NCName character with respect to the version of
     // XML understood by this scanner.
     protected boolean isValidNCName(int value) {
         return (XMLChar.isNCName(value));
     } // isValidNCName(int):  boolean
-
+    
     // returns true if the given character is
     // a valid nameStartChar with respect to the version of
     // XML understood by this scanner.
     protected boolean isValidNameStartChar(int value) {
         return (XMLChar.isNameStart(value));
     } // isValidNameStartChar(int):  boolean
-
+    
     protected boolean versionSupported(String version ) {
         return version.equals("1.0") || version.equals("1.1");
     } // version Supported
-
+    
     /**
      * Scans surrogates and append them to the specified buffer.
      * <p>
@@ -1353,7 +1354,7 @@
      */
     protected boolean scanSurrogates(XMLStringBuffer buf)
     throws IOException, XNIException {
-
+        
         int high = fEntityScanner.scanChar();
         int low = fEntityScanner.peekChar();
         if (!XMLChar.isLowSurrogate(low)) {
@@ -1362,26 +1363,26 @@
                     return false;
         }
         fEntityScanner.scanChar();
-
+        
         // convert surrogates to supplemental character
         int c = XMLChar.supplemental((char)high, (char)low);
-
+        
         // supplemental character must be a valid XML character
         if (isInvalid(c)) {
             reportFatalError("InvalidCharInContent",
                     new Object[]{Integer.toString(c, 16)});
                     return false;
         }
-
+        
         // fill in the buffer
         buf.append((char)high);
         buf.append((char)low);
-
+        
         return true;
-
+        
     } // scanSurrogates():boolean
-
-
+    
+    
     /**
      * Convenience function used in all XML scanners.
      */
@@ -1391,11 +1392,11 @@
                 msgId, args,
                 XMLErrorReporter.SEVERITY_FATAL_ERROR);
     }
-
+    
     // private methods
     private void init() {
         // initialize scanner
-        fEntityScanner = null;
+        fEntityScanner = null;        
         // initialize vars
         fEntityDepth = 0;
         fReportEntity = true;
@@ -1410,9 +1411,9 @@
         }
         fStringBufferIndex = 0;
         fAttributeCacheUsedCount = 0;
-
+        
     }
-
+    
     XMLStringBuffer getStringBuffer(){
         if((fStringBufferIndex < initialCacheCount )|| (fStringBufferIndex < stringBufferCache.size())){
             return (XMLStringBuffer)stringBufferCache.get(fStringBufferIndex++);
@@ -1423,6 +1424,6 @@
             return tmpObj;
         }
     }
-
-
+    
+    
 } // class XMLScanner
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLStreamFilterImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2006 Sun Microsystems, Inc.  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/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/XMLStreamReaderImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -71,42 +71,42 @@
  * @author Sunitha Reddy Sun Microsystems,Inc.
  */
 public class XMLStreamReaderImpl implements javax.xml.stream.XMLStreamReader {
-
+    
     /** Property identifier: entity manager. */
     protected static final String ENTITY_MANAGER =
     Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
-
+    
     /** Property identifier: Error Reporter. */
     protected static final String ERROR_REPORTER =
     Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
+    
     /** Property identifier: Symbol table. */
     protected static final String SYMBOL_TABLE =
     Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
-
+    
     protected static final String READER_IN_DEFINED_STATE =
     Constants.READER_IN_DEFINED_STATE;
-
+    
     private SymbolTable fSymbolTable = new SymbolTable();
-
+    
     /** Document scanner. */
     protected XMLDocumentScannerImpl fScanner = new XMLNSDocumentScannerImpl();
-
+        
     //make Global NamespaceContextWrapper object,  fScanner.getNamespaceContext() is dynamic object and ita value changes
     //as per the state of the parser.
     protected NamespaceContextWrapper fNamespaceContextWrapper = new NamespaceContextWrapper((NamespaceSupport)fScanner.getNamespaceContext()) ;
     protected XMLEntityManager fEntityManager = new XMLEntityManager();
     protected StaxErrorReporter fErrorReporter = new StaxErrorReporter();
-
-
+    
+    
     /** Entity scanner, this alwasy works on last entity that was opened. */
     protected XMLEntityScanner fEntityScanner = null;
-
+    
     /** Input Source */
     protected XMLInputSource fInputSource = null;
     /** Store properties*/
     protected PropertyManager fPropertyManager = null ;
-
+    
     /** current event type */
     private int fEventType ;
     /** debug flag*/
@@ -117,7 +117,7 @@
     private boolean fBindNamespaces = true;
     private String fDTDDecl = null;
     private String versionStr = null;
-
+    
     /**
      * @param inputStream
      * @param props
@@ -130,7 +130,7 @@
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
-
+    
     public XMLDocumentScannerImpl getScanner(){
         System.out.println("returning scanner");
         return fScanner;
@@ -147,8 +147,8 @@
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
-
-
+    
+    
     /**
      * @param inputStream
      * @param encoding
@@ -162,7 +162,7 @@
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
-
+    
     /**
      * @param reader
      * @param props
@@ -176,7 +176,7 @@
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
-
+    
     /**
      * @param inputSource
      * @param props
@@ -187,7 +187,7 @@
         //pass the input source to document scanner impl.
         setInputSource(inputSource);
     }
-
+    
     /**
      * @param inputSource
      * @throws XMLStreamException
@@ -197,26 +197,28 @@
         //this instances is free for reuse if parser has reached END_DOCUMENT state or application has
         //called close()
         fReuse = false;
-
+        
         try{
-
+            
             fScanner.setInputSource(inputSource) ;
             //XMLStreamReader should be in defined state
             if(fReaderInDefinedState){
                 fEventType = fScanner.next();
                 if (versionStr == null)
                     versionStr = getVersion();
-
+                
                 if (fEventType == XMLStreamConstants.START_DOCUMENT && versionStr != null && versionStr.equals("1.1")){
                     switchToXML11Scanner();
                 }
-
+                
             }
         }catch(java.io.IOException ex){
             throw new XMLStreamException(ex);
+        } catch(XNIException ex){ //Issue 56 XNIException not caught
+            throw new XMLStreamException(ex.getMessage(), getLocation(), ex.getException());
         }
     }//setInputSource
-
+    
     void init(PropertyManager propertyManager) throws XMLStreamException {
         fPropertyManager = propertyManager;
         //set Stax internal properties -- Note that these instances are being created in XMLReaderImpl.
@@ -233,7 +235,7 @@
         //4.
         reset();
     }
-
+    
     /** This function tells if this instances is available for reuse.
      * One must call reset() and setInputSource() to be able to reuse
      * this instance.
@@ -247,7 +249,7 @@
         //fReuse is set to 'true' when application calls close()
         return fReuse;
     }
-
+    
     /**
      * Resets this instance so that this instance is ready for reuse.
      */
@@ -268,8 +270,8 @@
         fBindNamespaces = ((Boolean)fPropertyManager.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue();
         versionStr = null;
     }
-
-
+    
+    
     /** Frees any resources associated with this Reader. This method does not close the underlying input source.
      * @throws XMLStreamException if there are errors freeing associated resources
      */
@@ -278,45 +280,45 @@
         //reset();
         fReuse = true ;
     }
-
-
+    
+    
     /** Returns the character encoding declared on the xml declaration Returns null if none was declared
      * @return the encoding declared in the document or null
      */
     public String getCharacterEncodingScheme() {
         return fScanner.getCharacterEncodingScheme();
-
+        
     }
-
-
+    
+    
     /**
      * @return
      */
     public int getColumnNumber() {
         return fEntityScanner.getColumnNumber();
     }//getColumnNumber
-
+    
     /** Return input encoding if known or null if unknown.
      * @return the encoding of this instance or null
      */
     public String getEncoding() {
         return fEntityScanner.getEncoding();
     }//getEncoding
-
+    
     /** Returns the current value of the parse event as a string, this returns the string value of a CHARACTERS event, returns the value of a COMMENT, the replacement value for an ENTITY_REFERENCE, the string value of a CDATA section, the string value for a SPACE event, or the String value of the internal subset of the DTD. If an ENTITY_REFERENCE has been resolved, any character data will be reported as CHARACTERS events.
      * @return the current text or null
      */
     public int getEventType() {
         return fEventType ;
     }//getEventType
-
+    
     /**
      * @return
      */
     public int getLineNumber() {
         return fEntityScanner.getLineNumber() ;
     }//getLineNumber
-
+    
     public String getLocalName() {
         if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT){
             //xxx check whats the value of fCurrentElement
@@ -328,7 +330,7 @@
         throw new IllegalStateException("Method getLocalName() cannot be called for " +
             getEventTypeString(fEventType) + " event.");
     }//getLocalName()
-
+    
     /**
      * @return
      */
@@ -339,11 +341,11 @@
         }
         return null ;
     }//getNamespaceURI
-
+    
     /** Get the data section of a processing instruction
      * @return the data or null
      */
-
+    
     public String getPIData() {
         if( fEventType == XMLEvent.PROCESSING_INSTRUCTION){
             return fScanner.getPIData().toString();
@@ -351,8 +353,8 @@
         else throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType) +
         " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION  ) ;
     }//getPIData
-
-
+    
+    
     /** Get the target of a processing instruction
      * @return the target or null
      */
@@ -362,13 +364,13 @@
         }
         else throw new java.lang.IllegalStateException("Current state of the parser is " + getEventTypeString(fEventType) +
         " But Expected state is " + XMLEvent.PROCESSING_INSTRUCTION  ) ;
-
+        
     }//getPITarget
-
-
+    
+    
     /**
-    * @return the prefix of the current event, or null if the event does
-    * not have a prefix. For START_ELEMENT and END_ELEMENT, return
+    * @return the prefix of the current event, or null if the event does 
+    * not have a prefix. For START_ELEMENT and END_ELEMENT, return 
     * XMLConstants.DEFAULT_NS_PREFIX when no prefix is available.
     */
     public String getPrefix() {
@@ -378,9 +380,9 @@
         }
         return null ;
     }//getPrefix()
-
-
-
+    
+    
+    
     /**
      * @return
      */
@@ -395,7 +397,7 @@
                      + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextCharacters() " ) ;
          }
     }
-
+    
     /**
      * @return
      */
@@ -404,14 +406,14 @@
                  || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
              return fScanner.getCharacterData().length;
          } else{
-             throw new IllegalStateException("Current state = " + getEventTypeString(fEventType)
-             + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , "
-                     + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA)
+             throw new IllegalStateException("Current state = " + getEventTypeString(fEventType) 
+             + " is not among the states " + getEventTypeString(XMLEvent.CHARACTERS) + " , " 
+                     + getEventTypeString(XMLEvent.COMMENT) + " , " + getEventTypeString(XMLEvent.CDATA) 
                      + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextLength() " ) ;
          }
-
+        
    }
-
+    
     /**
      * @return
      */
@@ -425,7 +427,7 @@
                      + " , " + getEventTypeString(XMLEvent.SPACE) +" valid for getTextStart() " ) ;
          }
     }
-
+    
     /**
      * @return
      */
@@ -441,39 +443,40 @@
         }
         return null;
     }//getValue()
-
+    
     /** Get the XML language version of the current document being parsed */
     public String getVersion() {
-        return fEntityScanner.getXMLVersion();
+        return fEntityScanner.getXMLVersion(); 
     }
-
+    
     /**
      * @return
      */
     public boolean hasAttributes() {
         return fScanner.getAttributeIterator().getLength() > 0 ? true : false ;
     }
-
+    
     /** this Funtion returns true if the current event has name */
     public boolean hasName() {
-        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT
-        || fEventType == XMLEvent.ENTITY_REFERENCE) {
+        if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT) {
             return true;
         }  else {
             return false;
         }
     }//hasName()
-
+    
     /**
      * @throws XMLStreamException
      * @return
      */
     public boolean hasNext() throws XMLStreamException {
-        //we can check in scanners if the scanner state is not set to
+        //the scanner returns -1 when it detects a broken stream
+        if (fEventType == -1) return false;
+        //we can check in scanners if the scanner state is not set to 
         //terminating, we still have more events.
         return fEventType != XMLEvent.END_DOCUMENT;
     }
-
+    
     /**
      * @return
      */
@@ -485,30 +488,30 @@
         } else {
             return false;
         }
-
+        
     }
-
+    
     /**
      * @return
      */
     public boolean isEndElement() {
         return fEventType == XMLEvent.END_ELEMENT;
     }
-
+    
     /**
      * @return
      */
     public boolean isStandalone() {
         return fScanner.isStandAlone();
     }
-
+    
     /**
      * @return
      */
     public boolean isStartElement() {
         return fEventType == XMLEvent.START_ELEMENT;
     }
-
+    
     /**
      *  Returns true if the cursor points to a character data event that consists of all whitespace
      *  Application calling this method needs to cache the value and avoid calling this method again
@@ -529,16 +532,20 @@
         }
         return false;
     }
-
-
-
+    
+    
+    
     /**
      * @throws XMLStreamException
      * @return
      */
     public int next() throws XMLStreamException {
         if( !hasNext() ) {
-            throw new java.util.NoSuchElementException( "END_DOCUMENT reached: no more elements on the stream." );
+            if (fEventType != -1) {
+                throw new java.util.NoSuchElementException( "END_DOCUMENT reached: no more elements on the stream." );
+            } else { 
+                throw new XMLStreamException( "Error processing input source. The input stream is not complete." ); 
+            }
         }
         try {
             fEventType = fScanner.next();
@@ -562,7 +569,7 @@
                         XMLInputFactory.IS_VALIDATING);
                 if (isValidating != null
                         && !isValidating.booleanValue()) {
-                    // ignore the error, set scanner to known state
+                    // ignore the error, set scanner to known state                    
                     fEventType = XMLEvent.DTD;
                     fScanner.setScannerState(fScanner.SCANNER_STATE_PROLOG);
                     fScanner.setDriver(fScanner.fPrologDriver);
@@ -589,26 +596,26 @@
     } //next()
 
     private void switchToXML11Scanner() throws IOException{
-
+        
         int oldEntityDepth = fScanner.fEntityDepth;
         com.sun.org.apache.xerces.internal.xni.NamespaceContext oldNamespaceContext = fScanner.fNamespaceContext;
-
+        
         fScanner = new XML11NSDocumentScannerImpl();
-
+        
         //get the new scanner state to old scanner's previous state
         fScanner.reset(fPropertyManager);
         fScanner.setPropertyManager(fPropertyManager);
         fEntityScanner = (XMLEntityScanner)fEntityManager.getEntityScanner()  ;
         fEntityManager.fCurrentEntity.mayReadChunks = true;
         fScanner.setScannerState(XMLEvent.START_DOCUMENT);
-
+        
         fScanner.fEntityDepth = oldEntityDepth;
         fScanner.fNamespaceContext = oldNamespaceContext;
         fEventType = fScanner.next();
     }
-
-
-
+    
+    
+    
     final static String getEventTypeString(int eventType) {
         switch (eventType){
             case XMLEvent.START_ELEMENT:
@@ -638,7 +645,7 @@
         }
         return "UNKNOWN_EVENT_TYPE, " + String.valueOf(eventType);
     }
-
+    
     /** Returns the count of attributes on this START_ELEMENT,
      * this method is only valid on a START_ELEMENT or ATTRIBUTE.  This
      * count excludes namespace definitions.  Attribute indices are
@@ -649,18 +656,18 @@
     public int getAttributeCount() {
         //xxx: recognize SAX properties namespace, namespace-prefix to get XML Namespace declarations
         //does length includes namespace declarations ?
-
+        
         //State should be either START_ELEMENT or ATTRIBUTE
         if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getLength() ;
         } else{
-            throw new java.lang.IllegalStateException( "Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException( "Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributeCount()") ;
         }
     }//getAttributeCount
-
+    
     /** Returns the localName of the attribute at the provided
      * index
      * @param index the position of the attribute
@@ -672,13 +679,13 @@
         if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return convertXNIQNametoJavaxQName(fScanner.getAttributeIterator().getQualifiedName(index)) ;
         } else{
-            throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributeName()") ;
         }
     }//getAttributeName
-
+    
     /**
      * @param index
      * @return
@@ -691,7 +698,7 @@
             throw new java.lang.IllegalStateException() ;
         }
     }//getAttributeName
-
+    
     /** Returns the namespace of the attribute at the provided
      * index
      * @param index the position of the attribute
@@ -703,14 +710,14 @@
         if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getURI(index);
         } else{
-            throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributeNamespace()") ;
         }
-
+        
     }//getAttributeNamespace
-
+    
     /** Returns the prefix of this attribute at the
      * provided index
      * @param index the position of the attribute
@@ -722,13 +729,13 @@
         if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getPrefix(index);
         } else{
-            throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributePrefix()") ;
         }
     }//getAttributePrefix
-
+    
     /** Returns the qname of the attribute at the provided index
      *
      * @param index the position of the attribute
@@ -743,13 +750,13 @@
             String uri = fScanner.getAttributeIterator().getURI(index) ;
             return new javax.xml.namespace.QName(uri, localName) ;
         } else{
-            throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributeQName()") ;
         }
     }//getAttributeQName
-
+    
     /** Returns the XML type of the attribute at the provided
      * index
      * @param index the position of the attribute
@@ -761,14 +768,14 @@
         if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getType(index) ;
         } else{
-            throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributeType()") ;
         }
-
+        
     }//getAttributeType
-
+    
     /** Returns the value of the attribute at the
      * index
      * @param index the position of the attribute
@@ -780,14 +787,14 @@
         if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getValue(index) ;
         } else{
-            throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributeValue()") ;
         }
-
+        
     }//getAttributeValue
-
+    
     /**
      * @param namespaceURI
      * @param localName
@@ -798,14 +805,14 @@
         if( fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.ATTRIBUTE) {
             return fScanner.getAttributeIterator().getValue(namespaceURI, localName) ;
         } else{
-            throw new java.lang.IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new java.lang.IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for getAttributeValue()") ;
         }
-
+        
     }
-
+    
     /** Reads the content of a text-only element. Precondition:
      * the current event is START_ELEMENT. Postcondition:
      * The current event is the corresponding END_ELEMENT.
@@ -813,7 +820,7 @@
      * a non text element is encountered
      */
     public String getElementText() throws XMLStreamException {
-
+        
         if(getEventType() != XMLStreamConstants.START_ELEMENT) {
             throw new XMLStreamException(
             "parser must be on START_ELEMENT to read next text", getLocation());
@@ -842,7 +849,7 @@
         }
         return content.toString();
     }
-
+    
     /** Return the current location of the processor.
      * If the Location is unknown the processor should return
      * an implementation of Location that returns -1 for the
@@ -852,31 +859,35 @@
      */
     public Location getLocation() {
         return new Location() {
-
+            String _systemId = fEntityScanner.getExpandedSystemId();
+            String _publicId = fEntityScanner.getPublicId();
+            int _offset = fEntityScanner.getCharacterOffset();
+            int _columnNumber = fEntityScanner.getColumnNumber();
+            int _lineNumber = fEntityScanner.getLineNumber(); 
             public String getLocationURI(){
-                return fEntityScanner.getExpandedSystemId();
+                return _systemId;
             }
-
+            
             public int getCharacterOffset(){
-                return fEntityScanner.getCharacterOffset();
-            }
-
-            public int getColumnNumber() {
-                return fEntityScanner.getColumnNumber();
+                return _offset;
             }
-
+            
+            public int getColumnNumber() {
+                return _columnNumber;
+            }
+            
             public int getLineNumber(){
-                return fEntityScanner.getLineNumber();
+                return _lineNumber;
             }
-
+            
             public String getPublicId(){
-                return fEntityScanner.getPublicId();
+                return _publicId;
             }
-
+            
             public String getSystemId(){
-                return fEntityScanner.getExpandedSystemId();
+                return _systemId;
             }
-
+            
             public String toString(){
                 StringBuffer sbuffer = new StringBuffer() ;
                 sbuffer.append("Line number = " + getLineNumber());
@@ -894,9 +905,9 @@
                 return sbuffer.toString();
             }
         } ;
-
+        
     }
-
+    
     /** Returns a QName for the current START_ELEMENT or END_ELEMENT event
      * @return the QName for the current START_ELEMENT or END_ELEMENT event
      */
@@ -904,12 +915,12 @@
         if(fEventType == XMLEvent.START_ELEMENT || fEventType == XMLEvent.END_ELEMENT)
             return convertXNIQNametoJavaxQName(fScanner.getElementQName());
         else
-            throw new java.lang.IllegalArgumentException("Illegal to call getName() "+
+            throw new java.lang.IllegalStateException("Illegal to call getName() "+
             "when event type is "+ getEventTypeString(fEventType) + "."
                      + " Valid states are " + getEventTypeString(XMLEvent.START_ELEMENT) + ", "
                      + getEventTypeString(XMLEvent.END_ELEMENT));
     }
-
+    
     /** Returns a read only namespace context for the current
      * position.  The context is transient and only valid until
      * a call to next() changes the state of the reader.
@@ -918,7 +929,7 @@
     public NamespaceContext getNamespaceContext() {
         return fNamespaceContextWrapper ;
     }
-
+    
     /** Returns the count of namespaces declared on this START_ELEMENT or END_ELEMENT,
      * this method is only valid on a START_ELEMENT, END_ELEMENT or NAMESPACE. On
      * an END_ELEMENT the count is of the namespaces that are about to go
@@ -940,7 +951,7 @@
              + " valid for getNamespaceCount()." );
         }
     }
-
+    
     /** Returns the prefix for the namespace declared at the
      * index.  Returns null if this is the default namespace
      * declaration
@@ -963,7 +974,7 @@
              + " valid for getNamespacePrefix()." );
         }
     }
-
+    
     /** Returns the uri for the namespace declared at the
      * index.
      *
@@ -983,9 +994,9 @@
                      + getEventTypeString(XMLEvent.NAMESPACE)
              + " valid for getNamespaceURI()." );
         }
-
+        
     }
-
+    
     /** Get the value of a feature/property from the underlying implementation
      * @param name The name of the property, may not be null
      * @return The value of the property
@@ -1003,7 +1014,7 @@
         }
         return null;
     }
-
+    
     /** Returns the current value of the parse event as a string,
      * this returns the string value of a CHARACTERS event,
      * returns the value of a COMMENT, the replacement value
@@ -1014,7 +1025,7 @@
      * a valid text state.
      */
     public String getText() {
-        if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT
+        if( fEventType == XMLEvent.CHARACTERS || fEventType == XMLEvent.COMMENT 
                 || fEventType == XMLEvent.CDATA || fEventType == XMLEvent.SPACE){
             //this requires creation of new string
             //fEventType == XMLEvent.ENTITY_REFERENCE
@@ -1024,7 +1035,7 @@
             if(name != null){
                 if(fScanner.foundBuiltInRefs)
                     return fScanner.getCharacterData().toString();
-
+                
                 XMLEntityStorage entityStore = fEntityManager.getEntityStore();
                 Hashtable ht = entityStore.getDeclaredEntities();
                  Entity en = (Entity)ht.get(name);
@@ -1045,7 +1056,7 @@
                 fDTDDecl = tmpBuffer.toString();
                 return fDTDDecl;
         } else{
-                throw new IllegalStateException("Current state " + getEventTypeString(fEventType)
+                throw new IllegalStateException("Current state " + getEventTypeString(fEventType) 
                      + " is not among the states" + getEventTypeString(XMLEvent.CHARACTERS) + ", "
                      + getEventTypeString(XMLEvent.COMMENT) + ", "
                      + getEventTypeString(XMLEvent.CDATA) + ", "
@@ -1054,8 +1065,8 @@
                      + getEventTypeString(XMLEvent.DTD) + " valid for getText() " ) ;
         }
     }//getText
-
-
+    
+    
     /** Test if the current event is of the given type and if the namespace and name match the current namespace and name of the current event.
      * If the namespaceURI is null it is not checked for equality, if the localName is null it is not checked for equality.
      * @param type the event type
@@ -1075,7 +1086,7 @@
                      "current local name");
         return;
     }
-
+    
     /** Gets the the text associated with a CHARACTERS, SPACE or CDATA event.
      * Text starting a "sourceStart" is copied into "destination" starting at "targetStart".
      * Up to "length" characters are copied.  The number of characters actually copied is returned.
@@ -1113,16 +1124,16 @@
      * @throws NullPointerException is if target is null
      */
     public int getTextCharacters(int sourceStart, char[] target, int targetStart, int length) throws XMLStreamException {
-
+        
         if(target == null){
             throw new NullPointerException("target char array can't be null") ;
         }
-
+        
         if(targetStart < 0 || length < 0 || sourceStart < 0 || targetStart >= target.length ||
             (targetStart + length ) > target.length) {
             throw new IndexOutOfBoundsException();
         }
-
+        
         //getTextStart() + sourceStart should not be greater than the lenght of number of characters
         //present
         int copiedLength = 0;
@@ -1137,11 +1148,11 @@
         } else{
             copiedLength = length;
         }
-
+        
         System.arraycopy(getTextCharacters(), getTextStart() + sourceStart , target, targetStart, copiedLength);
         return copiedLength;
     }
-
+    
     /** Return true if the current event has text, false otherwise
      * The following events have text:
      * CHARACTERS,DTD ,ENTITY_REFERENCE, COMMENT
@@ -1155,7 +1166,7 @@
             if(name != null){
                 if(fScanner.foundBuiltInRefs)
                     return true;
-
+                
                 XMLEntityStorage entityStore = fEntityManager.getEntityStore();
                 Hashtable ht = entityStore.getDeclaredEntities();
                 Entity en =(Entity)ht.get(name);
@@ -1174,7 +1185,7 @@
         }
         return false;
     }
-
+    
     /** Returns a boolean which indicates if this
      * attribute was created by default
      * @param index the position of the attribute
@@ -1186,20 +1197,20 @@
         if( (fEventType == XMLEvent.START_ELEMENT) || (fEventType == XMLEvent.ATTRIBUTE)){
             return fScanner.getAttributeIterator().isSpecified(index) ;
         } else{
-            throw new IllegalStateException("Current state is not among the states "
-                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , "
+            throw new IllegalStateException("Current state is not among the states " 
+                     + getEventTypeString(XMLEvent.START_ELEMENT) + " , " 
                      + getEventTypeString(XMLEvent.ATTRIBUTE)
                      + "valid for isAttributeSpecified()")  ;
         }
     }
-
+    
     /** Returns true if the cursor points to a character data event
      * @return true if the cursor points to character data, false otherwise
      */
     public boolean isCharacters() {
         return fEventType == XMLEvent.CHARACTERS ;
     }
-
+    
     /** Skips any insignificant events (COMMENT and PROCESSING_INSTRUCTION)
      * until a START_ELEMENT or
      * END_ELEMENT is reached. If other than space characters are
@@ -1211,7 +1222,7 @@
      * @throws XMLStreamException if the current event is not white space
      */
     public int nextTag() throws XMLStreamException {
-
+        
         int eventType = next();
         while((eventType == XMLStreamConstants.CHARACTERS && isWhiteSpace()) // skip whitespace
         || (eventType == XMLStreamConstants.CDATA && isWhiteSpace())
@@ -1233,16 +1244,16 @@
 
         return eventType;
     }
-
+    
     /** Checks if standalone was set in the document
      * @return true if standalone was set in the document, or false otherwise
      */
     public boolean standaloneSet() {
         //xxx: it requires if the standalone was set in the document ? This is different that if the document
         // is standalone
-        return fScanner.isStandAlone() ;
+        return fScanner.standaloneSet() ;
     }
-
+    
     /**
      * @param qname
      * @return
@@ -1256,7 +1267,7 @@
             return new javax.xml.namespace.QName(qname.uri, qname.localpart, qname.prefix) ;
         }
     }
-
+    
     /** Return the uri for the given prefix.
      * The uri returned depends on the current state of the processor.
      *
@@ -1272,11 +1283,11 @@
      */
     public String getNamespaceURI(String prefix) {
         if(prefix == null) throw new java.lang.IllegalArgumentException("prefix cannot be null.") ;
-
+        
         //first add the string to symbol table.. since internally identity comparisons are done.
         return fScanner.getNamespaceContext().getURI(fSymbolTable.addSymbol(prefix)) ;
     }
-
+    
     //xxx: this function is not being used.
     protected void setPropertyManager(PropertyManager propertyManager){
         fPropertyManager = propertyManager ;
@@ -1284,18 +1295,18 @@
         fScanner.setProperty("stax-properties",propertyManager);
         fScanner.setPropertyManager(propertyManager) ;
     }
-
+    
     /**
      * @return returns the reference to property manager.
      */
     protected PropertyManager getPropertyManager(){
         return fPropertyManager ;
     }
-
+    
     static void pr(String str) {
         System.out.println(str) ;
     }
-
+    
     protected List getEntityDecls(){
         if(fEventType == XMLStreamConstants.DTD){
             XMLEntityStorage entityStore = fEntityManager.getEntityStore();
@@ -1323,14 +1334,14 @@
         }
         return null;
     }
-
+    
     protected List getNotationDecls(){
         if(fEventType == XMLStreamConstants.DTD){
             if(fScanner.fDTDScanner == null) return null;
             DTDGrammar grammar = ((XMLDTDScannerImpl)(fScanner.fDTDScanner)).getGrammar();
             if(grammar == null) return null;
             List notations = grammar.getNotationDecls();
-
+            
             Iterator it = notations.iterator();
             ArrayList list = new ArrayList();
             while(it.hasNext()){
@@ -1343,7 +1354,7 @@
         }
         return null;
     }
-
-
-
+    
+    
+    
 }//XMLReaderImpl
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages.properties	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/msg/SAXMessages.properties	Wed Sep 28 16:49:43 2011 +0100
@@ -33,3 +33,5 @@
 nullparameter=the name parameter for "{0}" is null
 errorHandlerNotSet=Warning\: validation was turned on but an org.xml.sax.ErrorHandler was not set, which is probably not what is desired.  Parser will use a default ErrorHandler to print the first {0}  errors.  Please call the 'setErrorHandler' method to fix this.
 errorHandlerDebugMsg=Error\: URI \= "{0}", Line \= "{1}", \: {2} 
+null
+null
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages.properties	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/msg/XMLSchemaMessages.properties	Wed Sep 28 16:49:43 2011 +0100
@@ -42,6 +42,7 @@
         cvc-complex-type.2.4.b = cvc-complex-type.2.4.b: The content of element ''{0}'' is not complete. One of ''{1}'' is expected.
         cvc-complex-type.2.4.c = cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration can be found for element ''{0}''.
         cvc-complex-type.2.4.d = cvc-complex-type.2.4.d: Invalid content was found starting with element ''{0}''. No child element is expected at this point.
+        cvc-complex-type.2.4.e = cvc-complex-type.2.4.d: Invalid content was found starting with element ''{0}''. No child element ''{1}'' is expected at this point.
         cvc-complex-type.3.1 = cvc-complex-type.3.1: Value ''{2}'' of attribute ''{1}'' of element ''{0}'' is not valid with respect to the corresponding attribute use. Attribute ''{1}'' has a fixed value of ''{3}''.
         cvc-complex-type.3.2.1 = cvc-complex-type.3.2.1: Element ''{0}'' does not have an attribute wildcard for attribute ''{1}''.
         cvc-complex-type.3.2.2 = cvc-complex-type.3.2.2: Attribute ''{1}'' is not allowed to appear in element ''{0}''.
@@ -284,3 +285,4 @@
         TargetNamespace.2 = TargetNamespace.2: Expecting no namespace, but the schema document has a target namespace of ''{1}''.
         UndeclaredEntity = UndeclaredEntity: Entity ''{0}'' is not declared.
         UndeclaredPrefix = UndeclaredPrefix: Cannot resolve ''{0}'' as a QName: the prefix ''{1}'' is not declared.
+null
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/XMLSchemaValidator.java	Wed Sep 28 16:49:43 2011 +0100
@@ -26,6 +26,7 @@
 import java.util.Hashtable;
 import java.util.Stack;
 import java.util.Vector;
+import java.util.ArrayList;
 
 import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.impl.RevalidationHandler;
@@ -79,6 +80,7 @@
 import com.sun.org.apache.xerces.internal.xs.XSTypeDefinition;
 import org.xml.sax.SAXNotRecognizedException;
 import org.xml.sax.SAXNotSupportedException;
+import com.sun.org.apache.xerces.internal.parsers.XMLParser;
 
 /**
  * The XML Schema validator. The validator implements a document
@@ -95,13 +97,14 @@
  *  <li>http://apache.org/xml/properties/internal/error-reporter</li>
  *  <li>http://apache.org/xml/properties/internal/entity-resolver</li>
  * </ul>
- *
- * @xerces.internal
+ * 
+ * @xerces.internal 
  *
  * @author Sandy Gao IBM
  * @author Elena Litani IBM
  * @author Andy Clark IBM
  * @author Neeraj Bajaj, Sun Microsystems, inc.
+ * @version $Id: XMLSchemaValidator.java,v 1.11 2009/07/28 15:18:12 spericas Exp $
  */
 public class XMLSchemaValidator
     implements XMLComponent, XMLDocumentFilter, FieldActivator, RevalidationHandler {
@@ -148,17 +151,17 @@
     /** Feature identifier: standard uri conformant feature. */
     protected static final String STANDARD_URI_CONFORMANT_FEATURE =
         Constants.XERCES_FEATURE_PREFIX + Constants.STANDARD_URI_CONFORMANT_FEATURE;
-
+    
     /** Feature: generate synthetic annotations */
-    protected static final String GENERATE_SYNTHETIC_ANNOTATIONS =
+    protected static final String GENERATE_SYNTHETIC_ANNOTATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE;
-
+    
     /** Feature identifier: validate annotations. */
     protected static final String VALIDATE_ANNOTATIONS =
         Constants.XERCES_FEATURE_PREFIX + Constants.VALIDATE_ANNOTATIONS_FEATURE;
-
+    
     /** Feature identifier: honour all schemaLocations */
-    protected static final String HONOUR_ALL_SCHEMALOCATIONS =
+    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
 
     /** Feature identifier: use grammar pool only */
@@ -171,6 +174,9 @@
 
     protected static final String PARSER_SETTINGS =
             Constants.XERCES_FEATURE_PREFIX + Constants.PARSER_SETTINGS;
+    
+    protected static final String REPORT_WHITESPACE =
+            Constants.SUN_SCHEMA_FEATURE_PREFIX + Constants.SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE;
 
     // property identifiers
 
@@ -229,7 +235,6 @@
             HONOUR_ALL_SCHEMALOCATIONS,
             USE_GRAMMAR_POOL_ONLY};
 
-
     /** Feature defaults. */
     private static final Boolean[] FEATURE_DEFAULTS = { null,
         // NOTE: The following defaults are nulled out on purpose.
@@ -312,6 +317,9 @@
     protected boolean fEntityRef = false;
     protected boolean fInCDATA = false;
 
+    // Did we see only whitespace in element content?
+    protected boolean fSawOnlyWhitespaceInElementContent = false;
+    
     // properties
 
     /** Symbol table. */
@@ -460,6 +468,8 @@
 
     protected XMLDocumentSource fDocumentSource;
 
+    boolean reportWhitespace = false;
+            
     //
     // XMLComponent methods
     //
@@ -561,6 +571,17 @@
     /** Sets the document handler to receive information about the document. */
     public void setDocumentHandler(XMLDocumentHandler documentHandler) {
         fDocumentHandler = documentHandler;
+
+        // Init reportWhitespace for this handler
+        if (documentHandler instanceof XMLParser) {
+            try {
+                reportWhitespace = 
+                    ((XMLParser) documentHandler).getFeature(REPORT_WHITESPACE);
+            }
+            catch (Exception e) {
+                reportWhitespace = false;
+            }
+        }
     } // setDocumentHandler(XMLDocumentHandler)
 
     /** Returns the document handler */
@@ -737,8 +758,15 @@
      * @throws XNIException Thrown by handler to signal an error.
      */
     public void characters(XMLString text, Augmentations augs) throws XNIException {
-
         text = handleCharacters(text);
+        
+        if (fSawOnlyWhitespaceInElementContent) {
+            if (!reportWhitespace) {
+                ignorableWhitespace(text, augs);
+                return;
+            }
+        }
+
         // call handlers
         if (fDocumentHandler != null) {
             if (fNormalizeData && fUnionType) {
@@ -769,7 +797,6 @@
      * @throws XNIException Thrown by handler to signal an error.
      */
     public void ignorableWhitespace(XMLString text, Augmentations augs) throws XNIException {
-
         handleIgnorableWhitespace(text);
         // call handlers
         if (fDocumentHandler != null) {
@@ -980,7 +1007,7 @@
      * @throws XNIException Thrown by application to signal an error.
      */
     public void comment(XMLString text, Augmentations augs) throws XNIException {
-
+        
         // call handlers
         if (fDocumentHandler != null) {
             fDocumentHandler.comment(text, augs);
@@ -1074,7 +1101,7 @@
     /** used to build content models */
     // REVISIT: create decl pool, and pass it to each traversers
     private final CMBuilder fCMBuilder = new CMBuilder(nodeFactory);
-
+    
     // Schema grammar loader
     private final XMLSchemaLoader fSchemaLoader =
         new XMLSchemaLoader(
@@ -1348,10 +1375,10 @@
         } catch (XMLConfigurationException e) {
             fSchemaType = null;
         }
-
+        
         try {
             fUseGrammarPoolOnly = componentManager.getFeature(USE_GRAMMAR_POOL_ONLY);
-        }
+        } 
         catch (XMLConfigurationException e) {
             fUseGrammarPoolOnly = false;
         }
@@ -1570,6 +1597,7 @@
 
         // When it's a complex type with element-only content, we need to
         // find out whether the content contains any non-whitespace character.
+        fSawOnlyWhitespaceInElementContent = false;
         if (fCurrentType != null
             && fCurrentType.getTypeCategory() == XSTypeDefinition.COMPLEX_TYPE) {
             XSComplexTypeDecl ctype = (XSComplexTypeDecl) fCurrentType;
@@ -1580,6 +1608,7 @@
                         fSawCharacters = true;
                         break;
                     }
+                    fSawOnlyWhitespaceInElementContent = !fSawCharacters;
                 }
             }
         }
@@ -2097,7 +2126,7 @@
                 fCurrCMState = fCMStateStack[fElementDepth];
                 fSawText = fSawTextStack[fElementDepth];
                 fSawCharacters = fStringContent[fElementDepth];
-            }
+            } 
             else {
                 fElementDepth--;
             }
@@ -3014,7 +3043,7 @@
                         }
                     }
                 } else if (fCurrentType.getTypeCategory() == XSTypeDefinition.SIMPLE_TYPE) {
-                    if (actualValue != null && (!isComparable(fValidatedInfo, fCurrentElemDecl.fDefault)
+                    if (actualValue != null && (!isComparable(fValidatedInfo, fCurrentElemDecl.fDefault) 
                             || !actualValue.equals(fCurrentElemDecl.fDefault.actualValue))) {
                         // REVISIT: the spec didn't mention this case: fixed
                         //          value with simple type
@@ -3132,34 +3161,22 @@
                     reportSchemaError(
                         "cvc-complex-type.2.4.b",
                         new Object[] { element.rawname, expected });
-                }
-
-                // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
-                // After the DFA has completed, check that the number of transitions
-                // is within minOccurs and maxOccurs, unless maxOccurs is set to
-                // unbounded in which case only minOccurs is checked. Uses the user
-                // data stored in the validator, which was originally copied from
-                // the content model node.
-                Object userData = fCurrentCM.getUserData();
-                if (userData instanceof int[]) {
-                    int minOccurs = ((int[]) userData)[0];
-                    int maxOccurs = ((int[]) userData)[1];
-                    int n = fCurrentCM.getOneTransitionCounter();
-                    if (n < minOccurs) {
-                        String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
-                        reportSchemaError(
-                            "cvc-complex-type.2.4.b",
-                            new Object[] { element.rawname, expected });
-                    }
-                    if (maxOccurs != SchemaSymbols.OCCURRENCE_UNBOUNDED && n > maxOccurs) {
-                        String expected = expectedStr(fCurrentCM.whatCanGoHere(fCurrCMState));
-                        reportSchemaError(
-                            "cvc-complex-type.2.4.d",
-                            new Object[] { expected });
+                } else {
+                    // Constant space algorithm for a{n,m} for n > 1 and m <= unbounded
+                    // After the DFA has completed, check minOccurs and maxOccurs
+                    // for all elements and wildcards in this content model where
+                    // a{n,m} is subsumed to a* or a+
+                    ArrayList errors = fCurrentCM.checkMinMaxBounds();
+                    if (errors != null) {
+                        for (int i = 0; i < errors.size(); i += 2) {
+                            reportSchemaError(
+                                (String) errors.get(i),
+                                new Object[] { element.rawname, errors.get(i + 1) });
+                        }
                     }
                 }
-            }
-        }
+             }
+        }        
         return actualValue;
     } // elementLocallyValidComplexType
 
@@ -3171,12 +3188,12 @@
                 arguments,
                 XMLErrorReporter.SEVERITY_ERROR);
     }
-
+    
     /** Returns true if the two ValidatedInfo objects can be compared in the same value space. **/
     private boolean isComparable(ValidatedInfo info1, ValidatedInfo info2) {
         final short primitiveType1 = convertToPrimitiveKind(info1.actualValueType);
         final short primitiveType2 = convertToPrimitiveKind(info2.actualValueType);
-        if (primitiveType1 != primitiveType2) {
+        if (primitiveType1 != primitiveType2) {    
             return (primitiveType1 == XSConstants.ANYSIMPLETYPE_DT && primitiveType2 == XSConstants.STRING_DT ||
                     primitiveType1 == XSConstants.STRING_DT && primitiveType2 == XSConstants.ANYSIMPLETYPE_DT);
         }
@@ -3202,7 +3219,7 @@
         }
         return true;
     }
-
+    
     private short convertToPrimitiveKind(short valueType) {
         /** Primitive datatypes. */
         if (valueType <= XSConstants.NOTATION_DT) {
@@ -3219,7 +3236,7 @@
         /** Other types. */
         return valueType;
     }
-
+    
     private String expectedStr(Vector expected) {
         StringBuffer ret = new StringBuffer("{");
         int size = expected.size();
@@ -3352,11 +3369,11 @@
         public final Vector fValues = new Vector();
         public ShortVector fValueTypes = null;
         public Vector fItemValueTypes = null;
-
+        
         private boolean fUseValueTypeVector = false;
-        private int fValueTypesLength = 0;
+        private int fValueTypesLength = 0; 
         private short fValueType = 0;
-
+        
         private boolean fUseItemValueTypeVector = false;
         private int fItemValueTypesLength = 0;
         private ShortList fItemValueType = null;
@@ -3390,7 +3407,7 @@
         public void clear() {
             fValuesCount = 0;
             fUseValueTypeVector = false;
-            fValueTypesLength = 0;
+            fValueTypesLength = 0; 
             fValueType = 0;
             fUseItemValueTypeVector = false;
             fItemValueTypesLength = 0;
@@ -3575,8 +3592,8 @@
          * key sequence.
          */
         public int contains(ValueStoreBase vsb) {
-
-            final Vector values = vsb.fValues;
+            
+            final Vector values = vsb.fValues;         
             final int size1 = values.size();
             if (fFieldCount <= 1) {
                 for (int i = 0; i < size1; ++i) {
@@ -3621,7 +3638,7 @@
                 }
             }
             return -1;
-
+            
         } // contains(Vector):Object
 
         //
@@ -3653,7 +3670,7 @@
             return fTempBuffer.toString();
 
         } // toString(Object[]):String
-
+        
         /** Returns a string of the specified values. */
         protected String toString(Vector values, int start, int length) {
 
@@ -3661,7 +3678,7 @@
             if (length == 0) {
                 return "";
             }
-
+            
             // one value
             if (length == 1) {
                 return String.valueOf(values.elementAt(start));
@@ -3696,11 +3713,11 @@
             }
             return s + '[' + fIdentityConstraint + ']';
         } // toString():String
-
+        
         //
         // Private methods
         //
-
+        
         private void addValueType(short type) {
             if (fUseValueTypeVector) {
                 fValueTypes.add(type);
@@ -3719,21 +3736,21 @@
                 fValueTypes.add(type);
             }
         }
-
+        
         private short getValueTypeAt(int index) {
             if (fUseValueTypeVector) {
                 return fValueTypes.valueAt(index);
             }
             return fValueType;
         }
-
+        
         private boolean valueTypeContains(short value) {
             if (fUseValueTypeVector) {
                 return fValueTypes.contains(value);
             }
             return fValueType == value;
         }
-
+        
         private void addItemValueType(ShortList itemValueType) {
             if (fUseItemValueTypeVector) {
                 fItemValueTypes.add(itemValueType);
@@ -3753,19 +3770,19 @@
                 fItemValueTypes.add(itemValueType);
             }
         }
-
+        
         private ShortList getItemValueTypeAt(int index) {
             if (fUseItemValueTypeVector) {
                 return (ShortList) fItemValueTypes.elementAt(index);
             }
             return fItemValueType;
         }
-
+        
         private boolean itemValueTypeContains(ShortList value) {
             if (fUseItemValueTypeVector) {
                 return fItemValueTypes.contains(value);
             }
-            return fItemValueType == value ||
+            return fItemValueType == value || 
                 (fItemValueType != null && fItemValueType.equals(value));
         }
 
@@ -4173,7 +4190,7 @@
      * A simple vector for <code>short</code>s.
      */
     protected static final class ShortVector {
-
+        
         //
         // Data
         //
@@ -4183,13 +4200,13 @@
 
         /** Data. */
         private short[] fData;
-
+        
         //
         // Constructors
         //
-
+        
         public ShortVector() {}
-
+        
         public ShortVector(int initialCapacity) {
             fData = new short[initialCapacity];
         }
@@ -4218,7 +4235,7 @@
         public void clear() {
             fLength = 0;
         }
-
+        
         /** Returns whether the short is contained in the vector. */
         public boolean contains(short value) {
             for (int i = 0; i < fLength; ++i) {
@@ -4245,5 +4262,5 @@
             }
         }
     }
-
+    
 } // class SchemaValidator
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMBuilder.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/CMBuilder.java	Wed Sep 28 16:49:43 2011 +0100
@@ -31,11 +31,12 @@
 /**
  * This class constructs content models for a given grammar.
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Elena Litani, IBM
  * @author Sandy Gao, IBM
  *
+ * @version $Id: CMBuilder.java,v 1.9 2009/08/10 16:52:55 spericas Exp $
  */
 public class CMBuilder {
 
@@ -177,8 +178,11 @@
             boolean twoChildren = false;
             for (int i = 0; i < group.fParticleCount; i++) {
                 // first convert each child to a CM tree
-                temp = buildSyntaxTree(group.fParticles[i],
-                        optimize && (group.fParticleCount == 1));
+                temp = buildSyntaxTree(group.fParticles[i], 
+                        optimize &&
+                        minOccurs == 1 && maxOccurs == 1 &&
+                        (group.fCompositor == XSModelGroupImpl.MODELGROUP_SEQUENCE ||
+                         group.fParticleCount == 1));
                 // then combine them using binary operation
                 if (temp != null) {
                     if (nodeRet == null) {
@@ -231,13 +235,13 @@
             //one or more
             nodeRet = fNodeFactory.getCMUniOpNode(XSParticleDecl.PARTICLE_ONE_OR_MORE, node);
         }
-        else if (optimize && node.type() == XSParticleDecl.PARTICLE_ELEMENT ||
+        else if (optimize && node.type() == XSParticleDecl.PARTICLE_ELEMENT ||        
                  node.type() == XSParticleDecl.PARTICLE_WILDCARD) {
             // Only for elements and wildcards, subsume e{n,m} and e{n,unbounded} to e*
-            // or e+ and, once the DFA reaches a final state, check if the actual number
-            // of elements is between minOccurs and maxOccurs. This new algorithm runs
+            // or e+ and, once the DFA reaches a final state, check if the actual number 
+            // of elements is between minOccurs and maxOccurs. This new algorithm runs 
             // in constant space.
-
+            
             // TODO: What is the impact of this optimization on the PSVI?
             nodeRet = fNodeFactory.getCMUniOpNode(
                     minOccurs == 0 ? XSParticleDecl.PARTICLE_ZERO_OR_MORE
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSAllCM.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSAllCM.java	Wed Sep 28 16:49:43 2011 +0100
@@ -27,13 +27,15 @@
 import com.sun.org.apache.xerces.internal.impl.xs.XSConstraints;
 
 import java.util.Vector;
+import java.util.ArrayList;
 
 /**
  * XSAllCM implements XSCMValidator and handles <all>
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Pavani Mukthipudi, Sun Microsystems Inc.
+ * @version $Id: XSAllCM.java,v 1.7 2009/07/28 15:18:11 spericas Exp $
  */
 public class XSAllCM implements XSCMValidator {
 
@@ -78,20 +80,6 @@
     //
 
     /**
-     * This method is only implemented by <code>XSDFACM</code>.
-     */
-    public Object getUserData() {
-        return null;
-    }
-
-    /**
-     * This method is only implemented by <code>XSDFACM</code>.
-     */
-    public int getOneTransitionCounter() {
-        throw new UnsupportedOperationException();
-    }
-
-    /**
      * This methods to be called on entering a first element whose type
      * has this content model. It will return the initial state of the
      * content model
@@ -137,7 +125,7 @@
 
         // seen child
         currentState[0] = STATE_CHILD;
-
+        
         Object matchingDecl = null;
 
         for (int i = 0; i < fNumElements; i++) {
@@ -213,7 +201,7 @@
      * Check which elements are valid to appear at this point. This method also
      * works if the state is in error, in which case it returns what should
      * have been seen.
-     *
+     * 
      * @param state  the current state
      * @return       a Vector whose entries are instances of
      *               either XSWildcardDecl or XSElementDecl.
@@ -229,4 +217,9 @@
         return ret;
     }
 
+    public ArrayList checkMinMaxBounds() {
+        return null;
+    }
+
 } // class XSAllCM
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSCMUniOp.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSCMUniOp.java	Wed Sep 28 16:49:43 2011 +0100
@@ -28,9 +28,10 @@
  *
  * Content model Uni-Op node.
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Neil Graham, IBM
+ * @version $$
  */
 public class XSCMUniOp extends CMNode {
     // -------------------------------------------------------------------
@@ -68,9 +69,9 @@
         //  repetitions. Otherwise, '*' style nodes are always nullable.
         //
         if (type() == XSParticleDecl.PARTICLE_ONE_OR_MORE)
-                return fChild.isNullable();
-            else
-                return true;
+	        return fChild.isNullable();
+	    else
+	        return true;
     }
 
 
@@ -87,6 +88,18 @@
         toSet.setTo(fChild.lastPos());
     }
 
+    /**
+     * Allows the user to set arbitrary data on this content model
+     * node. This is used by the a{n,m} optimization that runs
+     * in constant space. For convenience, set user data in
+     * children node too.
+     */
+    @Override
+    public void setUserData(Object userData) {
+        super.setUserData(userData);
+        fChild.setUserData(userData);
+    }
+
 
     // -------------------------------------------------------------------
     //  Private data members
@@ -97,3 +110,4 @@
     // -------------------------------------------------------------------
     private CMNode  fChild;
 } // XSCMUniOp
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSCMValidator.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSCMValidator.java	Wed Sep 28 16:49:43 2011 +0100
@@ -25,14 +25,16 @@
 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaException;
 
 import java.util.Vector;
+import java.util.ArrayList;
 
 /**
  * Note: State of the content model is stored in the validator
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Sandy Gao, IBM
  * @author Elena Litani, IBM
+ * @version $Id: XSCMValidator.java,v 1.6 2009/07/28 15:18:12 spericas Exp $
  */
 public interface XSCMValidator {
 
@@ -84,7 +86,7 @@
      * Check which elements are valid to appear at this point. This method also
      * works if the state is in error, in which case it returns what should
      * have been seen.
-     *
+     * 
      * @param state  the current state
      * @return       a Vector whose entries are instances of
      *               either XSWildcardDecl or XSElementDecl.
@@ -92,15 +94,18 @@
     public Vector whatCanGoHere(int[] state);
 
     /**
-     * Allows the user to get arbitrary data originally set on the content
-     * model node used to create this validator.
+     * Used by constant space algorithm for a{n,m} for n > 1 and
+     * m <= unbounded. Called by a validator if validation of
+     * countent model succeeds after subsuming a{n,m} to a*
+     * (or a+) to check the n and m bounds.
+     * Returns <code>null</code> if validation of bounds is
+     * successful. Returns a list of strings with error info
+     * if not. Even entries in list returned are error codes
+     * (used to look up properties) and odd entries are parameters
+     * to be passed when formatting error message. Each parameter
+     * is associated with the error code that preceeds it in
+     * the list.
      */
-    public Object getUserData();
-
-    /**
-     * Return the number of times the <code>oneTransition()</code> method
-     * was called, resulting on the validator to move into a non-error state.
-     */
-    public int getOneTransitionCounter();
-
+    public ArrayList checkMinMaxBounds();
+    
 } // XSCMValidator
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSDFACM.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSDFACM.java	Wed Sep 28 16:49:43 2011 +0100
@@ -32,6 +32,7 @@
 import com.sun.org.apache.xerces.internal.impl.xs.XSConstraints;
 
 import java.util.Vector;
+import java.util.ArrayList;
 
 /**
  * DFAContentModel is the implementation of XSCMValidator that does
@@ -39,9 +40,10 @@
  * the conversion from the regular expression to the DFA that
  * it then uses in its validation algorithm.
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Neil Graham, IBM
+ * @version $Id: XSDFACM.java,v 1.7 2009/07/28 15:18:12 spericas Exp $
  */
 public class XSDFACM
     implements XSCMValidator {
@@ -81,7 +83,7 @@
      * id of the unique input symbol
      */
     private int fElemMapId[] = null;
-
+    
     /** The element map size. */
     private int fElemMapSize = 0;
 
@@ -141,10 +143,32 @@
      * related tables such as fFinalStateFlags.
      */
     private int fTransTableSize = 0;
+    
+    /**
+     * Array of counters for all the for elements (or wildcards)
+     * of the form a{n,m} where n > 1 and m <= unbounded. Used
+     * to count the a's to later check against n and m. Counter
+     * set to -1 if element (or wildcard) not optimized by
+     * constant space algorithm.
+     */
+    private int fElemMapCounter[];
 
-    private int fOneTransitionCounter = 0;
+    /**
+     * Array of lower bounds for all the for elements (or wildcards)
+     * of the form a{n,m} where n > 1 and m <= unbounded. This array
+     * stores the n's for those elements (or wildcards) for which
+     * the constant space algorithm applies (or -1 otherwise).
+     */
+    private int fElemMapCounterLowerBound[];
 
-    private Object fUserData;
+    /**
+     * Array of upper bounds for all the for elements (or wildcards)
+     * of the form a{n,m} where n > 1 and m <= unbounded. This array
+     * stores the n's for those elements (or wildcards) for which
+     * the constant space algorithm applies, or -1 if algorithm does
+     * not apply or m = unbounded.
+     */
+    private int fElemMapCounterUpperBound[];   // -1 if no upper bound
 
     // temp variables
 
@@ -162,12 +186,10 @@
      */
 
    public XSDFACM(CMNode syntaxTree, int leafCount) {
-
+   
         // Store away our index and pools in members
         fLeafCount = leafCount;
 
-        fUserData = syntaxTree.getUserData();
-
         //
         //  Create some string pool indexes that represent the names of some
         //  magical nodes in the syntax tree.
@@ -201,25 +223,7 @@
     //
     // XSCMValidator methods
     //
-
-    /**
-     * Return the number of times the <code>oneTransition()</code> method
-     * was called, resulting on the DFA to move into a non-error state.
-     * This is used to check the minOccurs and maxOccurs bounds using a
-     * constant space algorithm.
-     */
-    public int getOneTransitionCounter() {
-        return fOneTransitionCounter;
-    }
-
-    /**
-     * Allows the user to get arbitrary data originally set on the content
-     * model node used to create this DFA.
-     */
-    public Object getUserData() {
-        return fUserData;
-    }
-
+    
     /**
      * check whether the given state is one of the final states
      *
@@ -270,12 +274,20 @@
             if (type == XSParticleDecl.PARTICLE_ELEMENT) {
                 matchingDecl = subGroupHandler.getMatchingElemDecl(curElem, (XSElementDecl)fElemMap[elemIndex]);
                 if (matchingDecl != null) {
+                    // Increment counter if constant space algorithm applies
+                    if (fElemMapCounter[elemIndex] >= 0) {
+                        fElemMapCounter[elemIndex]++;
+                    }
                     break;
                 }
             }
             else if (type == XSParticleDecl.PARTICLE_WILDCARD) {
                 if(((XSWildcardDecl)fElemMap[elemIndex]).allowNamespace(curElem.uri)) {
                     matchingDecl = fElemMap[elemIndex];
+                    // Increment counter if constant space algorithm applies
+                    if (fElemMapCounter[elemIndex] >= 0) {
+                        fElemMapCounter[elemIndex]++;
+                    }
                     break;
                 }
             }
@@ -289,7 +301,6 @@
             return findMatchingDecl(curElem, subGroupHandler);
         }
 
-        fOneTransitionCounter++;
         state[0] = nextState;
         return matchingDecl;
     } // oneTransition(QName, int[], SubstitutionGroupHandler):  Object
@@ -318,7 +329,12 @@
     public int[] startContentModel() {
         int[] val = new int[2];
         val[0] = 0;
-        fOneTransitionCounter = 0;      // reset transition counter
+        // Clear all constant space algorithm counters in use
+        for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
+            if (fElemMapCounter[elemIndex] != -1) {
+                fElemMapCounter[elemIndex] = 0;
+            }
+        }
         return val;
     } // startContentModel():int[]
 
@@ -439,7 +455,13 @@
         fElemMap = new Object[fLeafCount];
         fElemMapType = new int[fLeafCount];
         fElemMapId = new int[fLeafCount];
+
+        fElemMapCounter = new int[fLeafCount];
+        fElemMapCounterLowerBound = new int[fLeafCount];
+        fElemMapCounterUpperBound = new int[fLeafCount];
+
         fElemMapSize = 0;
+        
         for (int outIndex = 0; outIndex < fLeafCount; outIndex++) {
             // optimization from Henry Zongaro:
             //fElemMap[outIndex] = new Object ();
@@ -457,6 +479,20 @@
                 fElemMap[fElemMapSize] = fLeafList[outIndex].getLeaf();
                 fElemMapType[fElemMapSize] = fLeafListType[outIndex];
                 fElemMapId[fElemMapSize] = id;
+
+                // Init counters and bounds for a{n,m} algorithm
+                XSCMLeaf leaf = fLeafList[outIndex];
+                int[] bounds = (int[]) leaf.getUserData();
+                if (bounds != null) {
+                    fElemMapCounter[fElemMapSize] = 0;
+                    fElemMapCounterLowerBound[fElemMapSize] = bounds[0];
+                    fElemMapCounterUpperBound[fElemMapSize] = bounds[1];
+                } else {
+                    fElemMapCounter[fElemMapSize] = -1;
+                    fElemMapCounterLowerBound[fElemMapSize] = -1;
+                    fElemMapCounterUpperBound[fElemMapSize] = -1;
+                }
+                
                 fElemMapSize++;
             }
         }
@@ -951,7 +987,7 @@
      * Check which elements are valid to appear at this point. This method also
      * works if the state is in error, in which case it returns what should
      * have been seen.
-     *
+     * 
      * @param state  the current state
      * @return       a Vector whose entries are instances of
      *               either XSWildcardDecl or XSElementDecl.
@@ -969,4 +1005,40 @@
         return ret;
     }
 
+    /**
+     * Used by constant space algorithm for a{n,m} for n > 1 and
+     * m <= unbounded. Called by a validator if validation of
+     * countent model succeeds after subsuming a{n,m} to a*
+     * (or a+) to check the n and m bounds.
+     * Returns <code>null</code> if validation of bounds is
+     * successful. Returns a list of strings with error info
+     * if not. Even entries in list returned are error codes
+     * (used to look up properties) and odd entries are parameters
+     * to be passed when formatting error message. Each parameter
+     * is associated with the error code that preceeds it in
+     * the list.
+     */
+    public ArrayList checkMinMaxBounds() {
+        ArrayList result = null;
+        for (int elemIndex = 0; elemIndex < fElemMapSize; elemIndex++) {
+            int count = fElemMapCounter[elemIndex];
+            if (count == -1) {
+                continue;
+            }
+            final int minOccurs = fElemMapCounterLowerBound[elemIndex];
+            final int maxOccurs = fElemMapCounterUpperBound[elemIndex];
+            if (count < minOccurs) {
+                if (result == null) result = new ArrayList();
+                result.add("cvc-complex-type.2.4.b");
+                result.add("{" + fElemMap[elemIndex] + "}");
+            }
+            if (maxOccurs != -1 && count > maxOccurs) {
+                if (result == null) result = new ArrayList();
+                result.add("cvc-complex-type.2.4.e");
+                result.add("{" + fElemMap[elemIndex] + "}");
+            }
+        }
+        return result;
+    }
+
 } // class DFAContentModel
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSEmptyCM.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/models/XSEmptyCM.java	Wed Sep 28 16:49:43 2011 +0100
@@ -25,6 +25,7 @@
 import com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaException;
 
 import java.util.Vector;
+import java.util.ArrayList;
 
 /**
  * XSEmptyCM is a derivative of the abstract content model base class that
@@ -32,10 +33,11 @@
  *
  * This model validated on the way in.
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Elena Litani, Lisa Martin
  * @author IBM
+ * @version $Id: XSEmptyCM.java,v 1.7 2009/07/28 15:18:11 spericas Exp $
  */
 public class XSEmptyCM  implements XSCMValidator {
 
@@ -45,7 +47,7 @@
 
     // start the content model: did not see any children
     private static final short STATE_START = 0;
-
+    
     private static final Vector EMPTY = new Vector(0);
 
     //
@@ -55,21 +57,7 @@
     //
     // XSCMValidator methods
     //
-
-    /**
-     * This method is only implemented by <code>XSDFACM</code>.
-     */
-    public Object getUserData() {
-        return null;
-    }
-
-    /**
-     * This method is only implemented by <code>XSDFACM</code>.
-     */
-    public int getOneTransitionCounter() {
-        throw new UnsupportedOperationException();
-    }
-
+    
     /**
      * This methods to be called on entering a first element whose type
      * has this content model. It will return the initial state of the content model
@@ -137,7 +125,7 @@
      * Check which elements are valid to appear at this point. This method also
      * works if the state is in error, in which case it returns what should
      * have been seen.
-     *
+     * 
      * @param state  the current state
      * @return       a Vector whose entries are instances of
      *               either XSWildcardDecl or XSElementDecl.
@@ -145,5 +133,9 @@
     public Vector whatCanGoHere(int[] state) {
         return EMPTY;
     }
+    
+    public ArrayList checkMinMaxBounds() {
+        return null;
+    }
 
 } // class XSEmptyCM
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSAttributeChecker.java	Wed Sep 28 16:49:43 2011 +0100
@@ -65,6 +65,7 @@
  * @xerces.internal
  *
  * @author Sandy Gao, IBM
+ * @version $Id: XSAttributeChecker.java,v 1.9 2007/07/29 20:47:06 joehw Exp $
  */
 
 public class XSAttributeChecker {
@@ -1082,7 +1083,7 @@
             String attrName = sattr.getName();
             String attrURI = DOMUtil.getNamespaceURI(sattr);
             String attrVal = DOMUtil.getValue(sattr);
-
+            
             if (attrName.startsWith("xml")) {
                 String attrPrefix = DOMUtil.getPrefix(sattr);
                 // we don't want to add namespace declarations to the non-schema attributes
@@ -1213,7 +1214,7 @@
             int min = ((XInt)attrValues[ATTIDX_MINOCCURS]).intValue();
             int max = ((XInt)attrValues[ATTIDX_MAXOCCURS]).intValue();
             if (max != SchemaSymbols.OCCURRENCE_UNBOUNDED) {
-
+                
                 // maxOccurLimit is only check in secure mode
                 if (fSchemaHandler.fSecureProcessing != null) {
                     String localName = element.getLocalName();
@@ -1223,10 +1224,10 @@
                     // particle. These are now validated using a constant
                     // space algorithm. The restriction still applies to all
                     // other cases.
-
+                
                     // Determine if constant-space algorithm can be applied
-                    final boolean optimize =
-                            (localName.equals("element") || localName.equals("any")) &&
+                    final boolean optimize = 
+                            (localName.equals("element") || localName.equals("any")) && 
                             (element.getNextSibling() == null) &&
                             (element.getPreviousSibling() == null) &&
                             (element.getParentNode().getLocalName().equals("sequence"));
@@ -1237,15 +1238,15 @@
                     int maxOccurNodeLimit = fSchemaHandler.fSecureProcessing.getMaxOccurNodeLimit();
                     if (max > maxOccurNodeLimit) {
                         reportSchemaFatalError("maxOccurLimit", new Object[] {new Integer(maxOccurNodeLimit)}, element);
-
+                    
                         // reset max values in case processing continues on error
                         attrValues[ATTIDX_MAXOCCURS] = fXIntPool.getXInt(maxOccurNodeLimit);
-                                                //new Integer(maxOccurNodeLimit);
+						//new Integer(maxOccurNodeLimit);
                         max = maxOccurNodeLimit;
-                    }
+                    } 
                 }
                 }
-
+                
                 if (min > max) {
                     reportSchemaError ("p-props-correct.2.1",
                                        new Object[] {elName, attrValues[ATTIDX_MINOCCURS], attrValues[ATTIDX_MAXOCCURS]},
@@ -1266,7 +1267,7 @@
         // To validate these types, we don't actually need to normalize the
         // strings. We only need to remove the whitespace from both ends.
         // In some special cases (list types), StringTokenizer can correctly
-        // process the un-normalized whitespace.
+        // process the un-normalized whitespace.        
         /**
          * REVISIT: Trim removes all leading and trailing characters less
          * than or equal to U+0020. This is okay for XML 1.0 since all
@@ -1314,12 +1315,11 @@
                 throw new InvalidDatatypeValueException("cvc-datatype-valid.1.2.1", new Object[]{value, "positiveInteger"});
             break;
         case DT_BLOCK:
-            // block = (#all | List of (substitution | extension | restriction | list | union))
+            // block = (#all | List of (substitution | extension | restriction))
             choice = 0;
             if (value.equals (SchemaSymbols.ATTVAL_POUNDALL)) {
                 choice = XSConstants.DERIVATION_SUBSTITUTION|XSConstants.DERIVATION_EXTENSION|
-                         XSConstants.DERIVATION_RESTRICTION|XSConstants.DERIVATION_LIST|
-                         XSConstants.DERIVATION_UNION;
+                         XSConstants.DERIVATION_RESTRICTION;
             }
             else {
                 // use the default \t\r\n\f delimiters
@@ -1621,7 +1621,7 @@
     void reportSchemaFatalError (String key, Object[] args, Element ele) {
         fSchemaHandler.reportSchemaFatalError(key, args, ele);
     }
-
+    
     void reportSchemaError (String key, Object[] args, Element ele) {
         fSchemaHandler.reportSchemaError(key, args, ele);
     }
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDHandler.java	Wed Sep 28 16:49:43 2011 +0100
@@ -88,96 +88,97 @@
  * <redefined> information items).  If any of the schemas imports a
  * schema, other grammars may be constructed as a side-effect.
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Neil Graham, IBM
  * @author Pavani Mukthipudi, Sun Microsystems
- *
+ * 
+ * @version $Id: XSDHandler.java,v 1.5 2007/07/29 20:47:06 joehw Exp $
  */
 public class XSDHandler {
-
+    
     /** Feature identifier: validation. */
     protected static final String VALIDATION =
         Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
-
+    
     /** feature identifier: XML Schema validation */
     protected static final String XMLSCHEMA_VALIDATION =
         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE;
-
+    
     /** Feature identifier:  allow java encodings */
     protected static final String ALLOW_JAVA_ENCODINGS =
         Constants.XERCES_FEATURE_PREFIX + Constants.ALLOW_JAVA_ENCODINGS_FEATURE;
-
+    
     /** Feature identifier:  continue after fatal error */
     protected static final String CONTINUE_AFTER_FATAL_ERROR =
         Constants.XERCES_FEATURE_PREFIX + Constants.CONTINUE_AFTER_FATAL_ERROR_FEATURE;
-
+    
     /** Feature identifier:  allow java encodings */
     protected static final String STANDARD_URI_CONFORMANT_FEATURE =
         Constants.XERCES_FEATURE_PREFIX + Constants.STANDARD_URI_CONFORMANT_FEATURE;
-
+    
     /** Feature: disallow doctype*/
     protected static final String DISALLOW_DOCTYPE =
         Constants.XERCES_FEATURE_PREFIX + Constants.DISALLOW_DOCTYPE_DECL_FEATURE;
-
+    
     /** Feature: generate synthetic annotations */
-    protected static final String GENERATE_SYNTHETIC_ANNOTATIONS =
+    protected static final String GENERATE_SYNTHETIC_ANNOTATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE;
-
+    
     /** Feature identifier: validate annotations. */
     protected static final String VALIDATE_ANNOTATIONS =
         Constants.XERCES_FEATURE_PREFIX + Constants.VALIDATE_ANNOTATIONS_FEATURE;
-
+    
     /** Feature identifier: honour all schemaLocations */
-    protected static final String HONOUR_ALL_SCHEMALOCATIONS =
+    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
       Constants.XERCES_FEATURE_PREFIX + Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
-
+    
     /** Feature identifier: namespace prefixes. */
     private static final String NAMESPACE_PREFIXES =
         Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACE_PREFIXES_FEATURE;
-
+    
     /** Feature identifier: string interning. */
     protected static final String STRING_INTERNING =
         Constants.SAX_FEATURE_PREFIX + Constants.STRING_INTERNING_FEATURE;
-
+   
     /** Property identifier: error handler. */
     protected static final String ERROR_HANDLER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
-
+    
     /** Property identifier: JAXP schema source. */
     protected static final String JAXP_SCHEMA_SOURCE =
         Constants.JAXP_PROPERTY_PREFIX + Constants.SCHEMA_SOURCE;
-
+    
     /** Property identifier: entity resolver. */
     public static final String ENTITY_RESOLVER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
     /** Property identifier: entity manager. */
     protected static final String ENTITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
-
+    
     /** Property identifier: error reporter. */
     public static final String ERROR_REPORTER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
+    
     /** Property identifier: grammar pool. */
     public static final String XMLGRAMMAR_POOL =
         Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
-
+    
     /** Property identifier: symbol table. */
     public static final String SYMBOL_TABLE =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
-
+    
     /** Property identifier: security manager. */
     protected static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
-
+    
     private static final String SECURE_PROCESSING =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
-
+   
     protected static final boolean DEBUG_NODE_POOL = false;
-
+    
     // Data
-
+    
     // different sorts of declarations; should make lookup and
     // traverser calling more efficient/less bulky.
     final static int ATTRIBUTE_TYPE          = 1;
@@ -187,26 +188,26 @@
     final static int IDENTITYCONSTRAINT_TYPE = 5;
     final static int NOTATION_TYPE           = 6;
     final static int TYPEDECL_TYPE           = 7;
-
+    
     // this string gets appended to redefined names; it's purpose is to be
     // as unlikely as possible to cause collisions.
     public final static String REDEF_IDENTIFIER = "_fn3dktizrknc9pi";
-
+    
     //
     //protected data that can be accessable by any traverser
     // stores <notation> decl
     protected Hashtable fNotationRegistry = new Hashtable();
-
+    
     protected XSDeclarationPool fDeclPool = null;
-
+   
     /**
      * <p>Security manager in effect.</p>
-     *
+     * 
      * <p>Protected to allow access by any traverser.</p>
      */
     protected SecurityManager fSecureProcessing = null;
 
-
+    
     // These tables correspond to the symbol spaces defined in the
     // spec.
     // They are keyed with a QName (that is, String("URI,localpart) and
@@ -221,7 +222,7 @@
     private Hashtable fUnparsedIdentityConstraintRegistry = new Hashtable();
     private Hashtable fUnparsedNotationRegistry = new Hashtable();
     private Hashtable fUnparsedTypeRegistry = new Hashtable();
-    // Compensation for the above hashtables to locate XSDocumentInfo,
+    // Compensation for the above hashtables to locate XSDocumentInfo, 
     // Since we may take Schema Element directly, so can not get the
     // corresponding XSDocumentInfo object just using above hashtables.
     private Hashtable fUnparsedAttributeRegistrySub = new Hashtable();
@@ -231,7 +232,7 @@
     private Hashtable fUnparsedIdentityConstraintRegistrySub = new Hashtable();
     private Hashtable fUnparsedNotationRegistrySub = new Hashtable();
     private Hashtable fUnparsedTypeRegistrySub = new Hashtable();
-
+    
     // this is keyed with a documentNode (or the schemaRoot nodes
     // contained in the XSDocumentInfo objects) and its value is the
     // XSDocumentInfo object corresponding to that document.
@@ -239,12 +240,12 @@
     // between the nodes we fetch from calls to the fUnparsed*
     // arrays and the XSDocumentInfos they live in.
     private Hashtable fXSDocumentInfoRegistry = new Hashtable();
-
+    
     // this hashtable is keyed on by XSDocumentInfo objects.  Its values
     // are Vectors containing the XSDocumentInfo objects <include>d,
     // <import>ed or <redefine>d by the key XSDocumentInfo.
     private Hashtable fDependencyMap = new Hashtable();
-
+    
     // this hashtable is keyed on by a target namespace.  Its values
     // are Vectors containing namespaces imported by schema documents
     // with the key target namespace.
@@ -256,11 +257,11 @@
     private Vector fAllTNSs = new Vector();
     // stores instance document mappings between namespaces and schema hints
     private Hashtable fLocationPairs = null;
-
-    //this hashtable is keyded on by DOM node objects.
+    
+    //this hashtable is keyded on by DOM node objects. 
     //The table stores the hidden nodes
     private Hashtable fHiddenNodes = null;
-
+    
     // convenience methods
     private String null2EmptyString(String ns) {
         return ns == null ? XMLSymbols.EMPTY_STRING : ns;
@@ -279,32 +280,32 @@
         }
         return documentURI != null ? documentURI : (String) fDoc2SystemId.get(ele);
     }
-
+    
     // This vector stores strings which are combinations of the
     // publicId and systemId of the inputSource corresponding to a
     // schema document.  This combination is used so that the user's
     // EntityResolver can provide a consistent way of identifying a
     // schema document that is included in multiple other schemas.
     private Hashtable fTraversed = new Hashtable();
-
+    
     // this hashtable contains a mapping from Schema Element to its systemId
     // this is useful to resolve a uri relative to the referring document
     private Hashtable fDoc2SystemId = new Hashtable();
-
+    
     // the primary XSDocumentInfo we were called to parse
     private XSDocumentInfo fRoot = null;
-
+    
     // This hashtable's job is to act as a link between the Schema Element and its
     // XSDocumentInfo object.
     private Hashtable fDoc2XSDocumentMap = new Hashtable();
-
+    
     // map between <redefine> elements and the XSDocumentInfo
     // objects that correspond to the documents being redefined.
     private Hashtable fRedefine2XSDMap = new Hashtable();
-
+    
     // map between <redefine> elements and the namespace support
     private Hashtable fRedefine2NSSupport = new Hashtable();
-
+    
     // these objects store a mapping between the names of redefining
     // groups/attributeGroups and the groups/AttributeGroups which
     // they redefine by restriction (implicitly).  It is up to the
@@ -312,36 +313,36 @@
     // validity.
     private Hashtable fRedefinedRestrictedAttributeGroupRegistry = new Hashtable();
     private Hashtable fRedefinedRestrictedGroupRegistry = new Hashtable();
-
+    
     // a variable storing whether the last schema document
     // processed (by getSchema) was a duplicate.
     private boolean fLastSchemaWasDuplicate;
-
+    
     // validate annotations feature
     private boolean fValidateAnnotations = false;
-
+    
     //handle multiple import feature
     private boolean fHonourAllSchemaLocations = false;
 
     // the XMLErrorReporter
     private XMLErrorReporter fErrorReporter;
     private XMLEntityResolver fEntityResolver;
-
+    
     // the XSAttributeChecker
     private XSAttributeChecker fAttributeChecker;
-
+    
     // the symbol table
     private SymbolTable fSymbolTable;
-
+    
     // the GrammarResolver
     private XSGrammarBucket fGrammarBucket;
-
+    
     // the Grammar description
     private XSDDescription fSchemaGrammarDescription;
-
+    
     // the Grammar Pool
     private XMLGrammarPool fGrammarPool;
-
+    
     //************ Traversers **********
     XSDAttributeGroupTraverser fAttributeGroupTraverser;
     XSDAttributeTraverser fAttributeTraverser;
@@ -353,63 +354,63 @@
     XSDSimpleTypeTraverser fSimpleTypeTraverser;
     XSDUniqueOrKeyTraverser fUniqueOrKeyTraverser;
     XSDWildcardTraverser fWildCardTraverser;
-
+    
     SchemaDOMParser fSchemaParser;
     SchemaContentHandler fXSContentHandler;
     XML11Configuration fAnnotationValidator;
     XSAnnotationGrammarPool fGrammarBucketAdapter;
-
+    
     // these data members are needed for the deferred traversal
     // of local elements.
-
+    
     // the initial size of the array to store deferred local elements
     private static final int INIT_STACK_SIZE = 30;
     // the incremental size of the array to store deferred local elements
     private static final int INC_STACK_SIZE  = 10;
     // current position of the array (# of deferred local elements)
     private int fLocalElemStackPos = 0;
-
+    
     private XSParticleDecl[] fParticle = new XSParticleDecl[INIT_STACK_SIZE];
     private Element[] fLocalElementDecl = new Element[INIT_STACK_SIZE];
     private XSDocumentInfo[] fLocalElementDecl_schema = new XSDocumentInfo[INIT_STACK_SIZE]; //JACK
     private int[] fAllContext = new int[INIT_STACK_SIZE];
     private XSObject[] fParent = new XSObject[INIT_STACK_SIZE];
     private String [][] fLocalElemNamespaceContext = new String [INIT_STACK_SIZE][1];
-
+    
     // these data members are needed for the deferred traversal
     // of keyrefs.
-
+    
     // the initial size of the array to store deferred keyrefs
     private static final int INIT_KEYREF_STACK = 2;
     // the incremental size of the array to store deferred keyrefs
     private static final int INC_KEYREF_STACK_AMOUNT = 2;
     // current position of the array (# of deferred keyrefs)
     private int fKeyrefStackPos = 0;
-
+    
     private Element [] fKeyrefs = new Element[INIT_KEYREF_STACK];
     private XSDocumentInfo [] fKeyrefsMapXSDocumentInfo = new XSDocumentInfo[INIT_KEYREF_STACK];
     private XSElementDecl [] fKeyrefElems = new XSElementDecl [INIT_KEYREF_STACK];
     private String [][] fKeyrefNamespaceContext = new String[INIT_KEYREF_STACK][1];
-
+    
     // Constructors
     public XSDHandler(){
-        fHiddenNodes = new Hashtable();
+        fHiddenNodes = new Hashtable();       
         fSchemaParser = new SchemaDOMParser(new SchemaParsingConfig());
     }
-
+    
     // it should be possible to use the same XSDHandler to parse
     // multiple schema documents; this will allow one to be
     // constructed.
     public XSDHandler (XSGrammarBucket gBucket) {
         this();
         fGrammarBucket = gBucket;
-
+        
         // Note: don't use SchemaConfiguration internally
         //       we will get stack overflaw because
         //       XMLSchemaValidator will be instantiating XSDHandler...
         fSchemaGrammarDescription = new XSDDescription();
     } // end constructor
-
+       
     /**
      * This method initiates the parse of a schema.  It will likely be
      * called from the Validator and it will make the
@@ -425,7 +426,7 @@
             Hashtable locationPairs)
     throws IOException {
         fLocationPairs = locationPairs;
-        fSchemaParser.resetNodePool();
+        fSchemaParser.resetNodePool();   
         SchemaGrammar grammar = null;
         String schemaNamespace  = null;
         short referType = desc.getContextType();
@@ -451,11 +452,11 @@
                 schemaNamespace = fSymbolTable.addSymbol(schemaNamespace);
             }
         }
-
+        
         // before parsing a schema, need to clear registries associated with
         // parsing schemas
-        prepareForParse();
-
+        prepareForParse();       
+        
         Document schemaRootDoc = null;
         Element schemaRoot = null;
         // first phase:  construct trees.
@@ -463,7 +464,7 @@
             //clean up the field fHiddenNodes, used for DOMInputSource
             fHiddenNodes.clear();
             Node domNode = ((DOMInputSource)is).getNode();
-
+            
             if (domNode instanceof Document) {
                 schemaRootDoc = (Document)domNode;
                 schemaRoot = DOMUtil.getRoot(schemaRootDoc);
@@ -477,7 +478,7 @@
         } // DOMInputSource
         else if (is instanceof SAXInputSource) {
             XMLReader parser = ((SAXInputSource)is).getXMLReader();
-            InputSource inputSource = ((SAXInputSource)is).getInputSource();
+            InputSource inputSource = ((SAXInputSource)is).getInputSource(); 
             boolean namespacePrefixes = false;
             if (parser != null) {
                 try {
@@ -513,37 +514,37 @@
             if (fXSContentHandler == null) {
                 fXSContentHandler = new SchemaContentHandler();
             }
-            fXSContentHandler.reset(fSchemaParser, fSymbolTable,
+            fXSContentHandler.reset(fSchemaParser, fSymbolTable, 
                     namespacePrefixes, stringsInternalized);
             parser.setContentHandler(fXSContentHandler);
             parser.setErrorHandler(fErrorReporter.getSAXErrorHandler());
-                try {
-                parser.parse(inputSource);
-                }
-                catch (SAXException se) {
-                        return null;
-                }
-                schemaRootDoc = fXSContentHandler.getDocument();
+        	try {
+            	parser.parse(inputSource);	
+        	}
+        	catch (SAXException se) {
+        		return null;
+        	}
+        	schemaRootDoc = fXSContentHandler.getDocument();
             if (schemaRootDoc == null) {
                 // something went wrong right off the hop
                 return null;
             }
-                schemaRoot = DOMUtil.getRoot(schemaRootDoc);
-        }
+        	schemaRoot = DOMUtil.getRoot(schemaRootDoc);          
+        }            
         else {
-                schemaRoot = getSchemaDocument(schemaNamespace, is,
+        	schemaRoot = getSchemaDocument(schemaNamespace, is,
                   referType == XSDDescription.CONTEXT_PREPARSE,
                   referType, null);
-
+             
         }//is instanceof XMLInputSource
 
         if(schemaRoot == null){
             // something went wrong right off the hop
             return null;
-        }
-
+        }      
+        
         if ( referType == XSDDescription.CONTEXT_PREPARSE) {
-                Element schemaElem = schemaRoot;
+        	Element schemaElem = schemaRoot;
             schemaNamespace = DOMUtil.getAttrValue(schemaElem, SchemaSymbols.ATT_TARGETNAMESPACE);
             if(schemaNamespace != null && schemaNamespace.length() > 0) {
                 // Since now we've discovered a namespace, we need to update xsd key
@@ -561,36 +562,36 @@
             XSDKey key = new XSDKey(schemaId, referType, schemaNamespace);
             fTraversed.put(key, schemaRoot);
             if (schemaId != null) {
-                fDoc2SystemId.put(schemaRoot, schemaId);
+            	fDoc2SystemId.put(schemaRoot, schemaId);
             }
         }
-
+        
         // before constructing trees and traversing a schema, need to reset
         // all traversers and clear all registries
         prepareForTraverse();
-
+        
         fRoot = constructTrees(schemaRoot, is.getSystemId(), desc);
         if (fRoot == null) {
             return null;
         }
-
+        
         // second phase:  fill global registries.
         buildGlobalNameRegistries();
-
+        
         // third phase:  call traversers
         ArrayList annotationInfo = fValidateAnnotations ? new ArrayList() : null;
         traverseSchemas(annotationInfo);
-
+        
         // fourth phase: handle local element decls
         traverseLocalElements();
-
+        
         // fifth phase:  handle Keyrefs
         resolveKeyRefs();
-
+        
         // sixth phase:  validate attribute of non-schema namespaces
         // REVISIT: skip this for now. we really don't want to do it.
         //fAttributeChecker.checkNonSchemaAttributes(fGrammarBucket);
-
+        
         // seventh phase:  store imported grammars
         // for all grammars with <import>s
         for (int i = fAllTNSs.size() - 1; i >= 0; i--) {
@@ -616,7 +617,7 @@
             // set the imported grammars
             sg.setImportedGrammars(ins);
         }
-
+        
         /** validate annotations **/
         if (fValidateAnnotations && annotationInfo.size() > 0) {
             validateAnnotations(annotationInfo);
@@ -625,7 +626,7 @@
         // and return.
         return fGrammarBucket.getGrammar(fRoot.fTargetNamespace);
     } // end parseSchema
-
+    
     private void validateAnnotations(ArrayList annotationInfo) {
         if (fAnnotationValidator == null) {
             createAnnotationValidator();
@@ -646,7 +647,7 @@
             }
         }
     }
-
+    
     private void createAnnotationValidator() {
         fAnnotationValidator = new XML11Configuration();
         fGrammarBucketAdapter = new XSAnnotationGrammarPool();
@@ -665,7 +666,7 @@
     SchemaGrammar getGrammar(String tns) {
         return fGrammarBucket.getGrammar(tns);
     }
-
+    
     /**
      * First try to find a grammar in the bucket, if failed, consult the
      * grammar pool. If a grammar is found in the pool, then add it (and all
@@ -690,10 +691,10 @@
         }
         return sg;
     }
-
+    
     // may wish to have setter methods for ErrorHandler,
     // EntityResolver...
-
+    
     private static final String[][] NS_ERROR_CODES = {
             {"src-include.2.1", "src-include.2.1"},
             {"src-redefine.3.1", "src-redefine.3.1"},
@@ -704,12 +705,12 @@
             {"TargetNamespace.1", "TargetNamespace.2"},
             {"TargetNamespace.1", "TargetNamespace.2"}
     };
-
+    
     private static final String[] ELE_ERROR_CODES = {
             "src-include.1", "src-redefine.2", "src-import.2", "schema_reference.4",
             "schema_reference.4", "schema_reference.4", "schema_reference.4", "schema_reference.4"
     };
-
+    
     // This method does several things:
     // It constructs an instance of an XSDocumentInfo object using the
     // schemaRoot node.  Then, for each <include>,
@@ -724,7 +725,7 @@
         if (schemaRoot == null) return null;
         String callerTNS = desc.getTargetNamespace();
         short referType = desc.getContextType();
-
+        
         XSDocumentInfo currSchemaInfo = null;
         try {
             // note that attributes are freed at end of traverseSchemas()
@@ -732,7 +733,7 @@
         } catch (XMLSchemaException se) {
             reportSchemaError(ELE_ERROR_CODES[referType],
                     new Object[]{locationHint},
-                                          schemaRoot);
+					  schemaRoot);
             return null;
         }
         // targetNamespace="" is not valid, issue a warning, and ignore it
@@ -740,10 +741,10 @@
                 currSchemaInfo.fTargetNamespace.length() == 0) {
             reportSchemaWarning("EmptyTargetNamespace",
                     new Object[]{locationHint},
-                                        schemaRoot);
+					schemaRoot);
             currSchemaInfo.fTargetNamespace = null;
         }
-
+        
         if (callerTNS != null) {
             // the second index to the NS_ERROR_CODES array
             // if the caller/expected NS is not absent, we use the first column
@@ -762,7 +763,7 @@
                 else if (callerTNS != currSchemaInfo.fTargetNamespace) {
                     reportSchemaError(NS_ERROR_CODES[referType][secondIdx],
                             new Object [] {callerTNS, currSchemaInfo.fTargetNamespace},
-                                                        schemaRoot);
+							schemaRoot);
                     return null;
                 }
             }
@@ -770,7 +771,7 @@
             else if (referType != XSDDescription.CONTEXT_PREPARSE && callerTNS != currSchemaInfo.fTargetNamespace) {
                 reportSchemaError(NS_ERROR_CODES[referType][secondIdx],
                         new Object [] {callerTNS, currSchemaInfo.fTargetNamespace},
-                                                schemaRoot);
+						schemaRoot);
                 return null;
             }
         }
@@ -788,18 +789,18 @@
                 int secondIdx = 1;
                 reportSchemaError(NS_ERROR_CODES[referType][secondIdx],
                         new Object [] {callerTNS, currSchemaInfo.fTargetNamespace},
-                                                schemaRoot);
+						schemaRoot);
                 return null;
             }
         }
         // the other cases (callerTNS == currSchemaInfo.fTargetNamespce == null)
         // are valid
-
+        
         // a schema document can always access it's own target namespace
         currSchemaInfo.addAllowedNS(currSchemaInfo.fTargetNamespace);
-
+        
         SchemaGrammar sg = null;
-
+        
         if (referType == XSDDescription.CONTEXT_INCLUDE ||
                 referType == XSDDescription.CONTEXT_REDEFINE) {
             sg = fGrammarBucket.getGrammar(currSchemaInfo.fTargetNamespace);
@@ -815,15 +816,15 @@
             sg = new SchemaGrammar(currSchemaInfo.fTargetNamespace, desc.makeClone(), fSymbolTable);
             fGrammarBucket.putGrammar(sg);
         }
-
+        
         // store the document and its location
         // REVISIT: don't expose the DOM tree
         sg.addDocument(null, (String)fDoc2SystemId.get(currSchemaInfo.fSchemaElement));
-
+        
         fDoc2XSDocumentMap.put(schemaRoot, currSchemaInfo);
         Vector dependencies = new Vector();
         Element rootNode = schemaRoot;
-
+        
         Element newSchemaRoot = null;
         for (Element child = DOMUtil.getFirstChildElement(rootNode);
         child != null;
@@ -831,9 +832,9 @@
             String schemaNamespace=null;
             String schemaHint=null;
             String localName = DOMUtil.getLocalName(child);
-
+            
             short refType = -1;
-
+            
             if (localName.equals(SchemaSymbols.ELT_ANNOTATION))
                 continue;
             else if (localName.equals(SchemaSymbols.ELT_IMPORT)) {
@@ -849,7 +850,7 @@
                 if (schemaNamespace == currSchemaInfo.fTargetNamespace) {
                     reportSchemaError("src-import.1.1", new Object [] {schemaNamespace}, child);
                 }
-
+                
                 // check contents and process optional annotations
                 Element importChild = DOMUtil.getFirstChildElement(child);
                 if(importChild != null ) {
@@ -872,7 +873,7 @@
                     }
                 }
                 fAttributeChecker.returnAttrArray(importAttrs, currSchemaInfo);
-
+                
                 // if this namespace has not been imported by this document,
                 //  then import if multiple imports support is enabled.
                 if(currSchemaInfo.isAllowedNS(schemaNamespace)) {
@@ -898,13 +899,13 @@
                 else if (!ins.contains(schemaNamespace)){
                     ins.addElement(schemaNamespace);
                 }
-
+                
                 fSchemaGrammarDescription.reset();
                 fSchemaGrammarDescription.setContextType(XSDDescription.CONTEXT_IMPORT);
                 fSchemaGrammarDescription.setBaseSystemId(doc2SystemId(schemaRoot));
                 fSchemaGrammarDescription.setLocationHints(new String[]{schemaHint});
                 fSchemaGrammarDescription.setTargetNamespace(schemaNamespace);
-
+                
                 // if a grammar with the same namespace and location exists (or being
                 // built), ignore this one (don't traverse it).
                 if ((!fHonourAllSchemaLocations && findGrammar(fSchemaGrammarDescription) != null) || isExistingGrammar(fSchemaGrammarDescription))
@@ -922,7 +923,7 @@
                 if (localName.equals(SchemaSymbols.ELT_REDEFINE)) {
                     fRedefine2NSSupport.put(child, new SchemaNamespaceSupport(currSchemaInfo.fNamespaceSupport));
                 }
-
+                
                 // check annotations.  Must do this here to avoid having to
                 // re-parse attributes later
                 if(localName.equals(SchemaSymbols.ELT_INCLUDE)) {
@@ -994,7 +995,7 @@
                 // schema...
                 break;
             }
-
+            
             // If the schema is duplicate, we needn't call constructTrees() again.
             // To handle mutual <include>s
             XSDocumentInfo newSchemaInfo = null;
@@ -1002,9 +1003,9 @@
                 newSchemaInfo = newSchemaRoot == null ? null : (XSDocumentInfo)fDoc2XSDocumentMap.get(newSchemaRoot);
             }
             else {
-                newSchemaInfo = constructTrees(newSchemaRoot, schemaHint, fSchemaGrammarDescription);
+               	newSchemaInfo = constructTrees(newSchemaRoot, schemaHint, fSchemaGrammarDescription);
             }
-
+            
             if (localName.equals(SchemaSymbols.ELT_REDEFINE) &&
                     newSchemaInfo != null) {
                 // must record which schema we're redefining so that we can
@@ -1017,11 +1018,11 @@
                 newSchemaRoot = null;
             }
         }
-
+        
         fDependencyMap.put(currSchemaInfo, dependencies);
         return currSchemaInfo;
     } // end constructTrees
-
+    
     private boolean isExistingGrammar(XSDDescription desc) {
         SchemaGrammar sg = fGrammarBucket.getGrammar(desc.getTargetNamespace());
         if(sg == null) {
@@ -1035,14 +1036,14 @@
             }
         }
     }
-
+    
     // This method builds registries for all globally-referenceable
     // names.  A registry will be built for each symbol space defined
     // by the spec.  It is also this method's job to rename redefined
     // components, and to record which components redefine others (so
     // that implicit redefinitions of groups and attributeGroups can be handled).
     protected void buildGlobalNameRegistries() {
-
+        
 
         // Starting with fRoot, we examine each child of the schema
         // element.  Skipping all imports and includes, we record the names
@@ -1053,14 +1054,14 @@
         // it again; then we look to its Dependency map entry.  We keep a
         // stack of schemas that we haven't yet finished processing; this
         // is a depth-first traversal.
-
+            
         Stack schemasToProcess = new Stack();
         schemasToProcess.push(fRoot);
-
-        while (!schemasToProcess.empty()) {
+       
+        while (!schemasToProcess.empty()) {            
             XSDocumentInfo currSchemaDoc =
                 (XSDocumentInfo)schemasToProcess.pop();
-            Element currDoc = currSchemaDoc.fSchemaElement;
+            Element currDoc = currSchemaDoc.fSchemaElement; 
             if(DOMUtil.isHidden(currDoc, fHiddenNodes)){
                 // must have processed this already!
                 continue;
@@ -1165,9 +1166,9 @@
                     }
                 }
             } // end for
-
+            
             // now we're done with this one!
-                DOMUtil.setHidden(currDoc, fHiddenNodes);
+           	DOMUtil.setHidden(currDoc, fHiddenNodes);
             // now add the schemas this guy depends on
             Vector currSchemaDepends = (Vector)fDependencyMap.get(currSchemaDoc);
             for (int i = 0; i < currSchemaDepends.size(); i++) {
@@ -1176,7 +1177,7 @@
         } // while
 
     } // end buildGlobalNameRegistries
-
+    
     // Beginning at the first schema processing was requested for
     // (fRoot), this method
     // examines each child (global schema information item) of each
@@ -1200,7 +1201,7 @@
             XSDocumentInfo currSchemaDoc =
                 (XSDocumentInfo)schemasToProcess.pop();
             Element currDoc = currSchemaDoc.fSchemaElement;
-
+       
             SchemaGrammar currSG = fGrammarBucket.getGrammar(currSchemaDoc.fTargetNamespace);
 
             if(DOMUtil.isHidden(currDoc, fHiddenNodes)) {
@@ -1214,7 +1215,7 @@
                 DOMUtil.getFirstVisibleChildElement(currRoot, fHiddenNodes);
             globalComp != null;
             globalComp = DOMUtil.getNextVisibleSiblingElement(globalComp, fHiddenNodes)) {
-                DOMUtil.setHidden(globalComp, fHiddenNodes);
+                DOMUtil.setHidden(globalComp, fHiddenNodes); 
                 String componentType = DOMUtil.getLocalName(globalComp);
                 // includes and imports will not show up here!
                 if (DOMUtil.getLocalName(globalComp).equals(SchemaSymbols.ELT_REDEFINE)) {
@@ -1277,14 +1278,14 @@
                     reportSchemaError("s4s-elt-invalid-content.1", new Object [] {SchemaSymbols.ELT_SCHEMA, DOMUtil.getLocalName(globalComp)}, globalComp);
                 }
             } // end for
-
+            
             if (!sawAnnotation) {
                 String text = DOMUtil.getSyntheticAnnotation(currRoot);
                 if (text != null) {
                     currSG.addAnnotation(fElementTraverser.traverseSyntheticAnnotation(currRoot, text, currSchemaDoc.getSchemaAttrs(), true, currSchemaDoc));
                 }
             }
-
+            
             /** Collect annotation information for validation. **/
             if (annotationInfo != null) {
                 XSAnnotationInfo info = currSchemaDoc.getAnnotations();
@@ -1305,7 +1306,7 @@
             }
         } // while
     } // end traverseSchemas
-
+    
     // store whether we have reported an error about that no grammar
     // is found for the given namespace uri
     private Vector fReportedTNS = null;
@@ -1320,7 +1321,7 @@
         fReportedTNS.addElement(uri);
         return true;
     }
-
+    
     private static final String[] COMP_TYPE = {
             null,               // index 0
             "attribute declaration",
@@ -1331,7 +1332,7 @@
             "notation",
             "type definition",
     };
-
+    
     private static final String[] CIRCULAR_CODES = {
             "Internal-Error",
             "Internal-Error",
@@ -1342,7 +1343,7 @@
             "Internal-Error",
             "st-props-correct.2",       //or ct-props-correct.3
     };
-
+    
     // since it is forbidden for traversers to talk to each other
     // directly (except wen a traverser encounters a local declaration),
     // this provides a generic means for a traverser to call
@@ -1364,7 +1365,7 @@
             int declType,
             QName declToTraverse,
             Element elmNode) {
-
+        
         if (DEBUG_NODE_POOL) {
             System.out.println("TRAVERSE_GL: "+declToTraverse.toString());
         }
@@ -1381,7 +1382,7 @@
                     return retObj;
             }
         }
-
+        
         // now check whether this document can access the requsted namespace
         if (!currSchema.isAllowedNS(declToTraverse.uri)) {
             // cannot get to this schema from the one containing the requesting decl
@@ -1391,7 +1392,7 @@
             }
             return null;
         }
-
+        
         // check whether there is grammar for the requested namespace
         SchemaGrammar sGrammar = fGrammarBucket.getGrammar(declToTraverse.uri);
         if (sGrammar == null) {
@@ -1399,7 +1400,7 @@
                 reportSchemaError("src-resolve", new Object[]{declToTraverse.rawname, COMP_TYPE[declType]}, elmNode);
             return null;
         }
-
+        
         // if there is such grammar, check whether the requested component is in the grammar
         Object retObj = null;
         switch (declType) {
@@ -1425,15 +1426,15 @@
             retObj = sGrammar.getGlobalTypeDecl(declToTraverse.localpart);
             break;
         }
-
+        
         // if the component is parsed, return it
         if (retObj != null)
             return retObj;
-
+        
         XSDocumentInfo schemaWithDecl = null;
         Element decl = null;
         XSDocumentInfo declDoc = null;
-
+        
         // the component is not parsed, try to find a DOM element for it
         String declKey = declToTraverse.uri == null? ","+declToTraverse.localpart:
             declToTraverse.uri+","+declToTraverse.localpart;
@@ -1469,13 +1470,13 @@
         default:
             reportSchemaError("Internal-Error", new Object [] {"XSDHandler asked to locate component of type " + declType + "; it does not recognize this type!"}, elmNode);
         }
-
+        
         // no DOM element found, so the component can't be located
         if (decl == null) {
             reportSchemaError("src-resolve", new Object[]{declToTraverse.rawname, COMP_TYPE[declType]}, elmNode);
             return null;
         }
-
+        
         // get the schema doc containing the component to be parsed
         // it should always return non-null value, but since null-checking
         // comes for free, let's be safe and check again
@@ -1499,7 +1500,7 @@
             reportSchemaError(code, new Object [] {declToTraverse.prefix+":"+declToTraverse.localpart}, elmNode);
             return null;
         }
-
+        
         DOMUtil.setHidden(decl, fHiddenNodes);
         SchemaNamespaceSupport nsSupport = null;
         // if the parent is <redefine> use the namespace delcs for it.
@@ -1509,7 +1510,7 @@
         // back up the current SchemaNamespaceSupport, because we need to provide
         // a fresh one to the traverseGlobal methods.
         schemaWithDecl.backupNSSupport(nsSupport);
-
+        
         // traverse the referenced global component
         switch (declType) {
         case ATTRIBUTE_TYPE :
@@ -1538,14 +1539,14 @@
             else
                 retObj = fSimpleTypeTraverser.traverseGlobal(decl, schemaWithDecl, sGrammar);
         }
-
+        
         // restore the previous SchemaNamespaceSupport, so that the caller can get
         // proper namespace binding.
         schemaWithDecl.restoreNSSupport();
-
+        
         return retObj;
     } // getGlobalDecl(XSDocumentInfo, int, QName):  Object
-
+    
     // This method determines whether there is a group
     // (attributeGroup) which the given one has redefined by
     // restriction.  If so, it returns it; else it returns null.
@@ -1587,7 +1588,7 @@
         }
         return retObj;
     } // getGrpOrAttrGrpRedefinedByRestriction(int, QName, XSDocumentInfo):  Object
-
+    
     // Since ID constraints can occur in local elements, unless we
     // wish to completely traverse all our DOM trees looking for ID
     // constraints while we're building our global name registries,
@@ -1605,23 +1606,23 @@
             SchemaGrammar keyrefGrammar = fGrammarBucket.getGrammar(keyrefSchemaDoc.fTargetNamespace);
             // need to set <keyref> to hidden before traversing it,
             // because it has global scope
-                DOMUtil.setHidden(fKeyrefs[i], fHiddenNodes);
+           	DOMUtil.setHidden(fKeyrefs[i], fHiddenNodes);
             fKeyrefTraverser.traverse(fKeyrefs[i], fKeyrefElems[i], keyrefSchemaDoc, keyrefGrammar);
         }
     } // end resolveKeyRefs
-
+    
     // an accessor method.  Just makes sure callers
     // who want the Identity constraint registry vaguely know what they're about.
     protected Hashtable getIDRegistry() {
         return fUnparsedIdentityConstraintRegistry;
     }
-    // an accessor method.
+    // an accessor method.  
     protected Hashtable getIDRegistry_sub() {
         return fUnparsedIdentityConstraintRegistrySub;
     }
-
-
-
+    
+   
+    
     // This method squirrels away <keyref> declarations--along with the element
     // decls and namespace bindings they might find handy.
     protected void storeKeyRef (Element keyrefToStore, XSDocumentInfo schemaDoc,
@@ -1633,7 +1634,7 @@
             checkForDuplicateNames(keyrefQName, fUnparsedIdentityConstraintRegistry, fUnparsedIdentityConstraintRegistrySub, keyrefToStore, schemaDoc);
         }
         // now set up all the registries we'll need...
-
+        
         // check array sizes
         if (fKeyrefStackPos == fKeyrefs.length) {
             Element [] elemArray = new Element [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
@@ -1645,20 +1646,20 @@
             String[][] stringArray = new String [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT][];
             System.arraycopy(fKeyrefNamespaceContext, 0, stringArray, 0, fKeyrefStackPos);
             fKeyrefNamespaceContext = stringArray;
-
+            
             XSDocumentInfo [] xsDocumentInfo = new XSDocumentInfo [fKeyrefStackPos + INC_KEYREF_STACK_AMOUNT];
             System.arraycopy(fKeyrefsMapXSDocumentInfo, 0, xsDocumentInfo, 0, fKeyrefStackPos);
             fKeyrefsMapXSDocumentInfo = xsDocumentInfo;
-
+            
         }
         fKeyrefs[fKeyrefStackPos] = keyrefToStore;
         fKeyrefElems[fKeyrefStackPos] = currElemDecl;
         fKeyrefNamespaceContext[fKeyrefStackPos] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
-
-        fKeyrefsMapXSDocumentInfo[fKeyrefStackPos++] = schemaDoc;
+        
+        fKeyrefsMapXSDocumentInfo[fKeyrefStackPos++] = schemaDoc; 
     } // storeKeyref (Element, XSDocumentInfo, XSElementDecl): void
-
-
+    
+    
     /**
      * resolveSchema method is responsible for resolving location of the schema (using XMLEntityResolver),
      * and if it was succefully resolved getting the schema Document.
@@ -1688,7 +1689,7 @@
         if (schemaSource instanceof DOMInputSource) {
             fHiddenNodes.clear();
             Node node = ((DOMInputSource)schemaSource).getNode();
-
+ 
             if (node instanceof Document) {
                 return DOMUtil.getRoot((Document) node);
             }
@@ -1701,7 +1702,7 @@
         } // DOMInputSource
         else if (schemaSource instanceof SAXInputSource) {
             XMLReader parser = ((SAXInputSource)schemaSource).getXMLReader();
-            InputSource inputSource = ((SAXInputSource)schemaSource).getInputSource();
+            InputSource inputSource = ((SAXInputSource)schemaSource).getInputSource(); 
             boolean namespacePrefixes = false;
             if (parser != null) {
                 try {
@@ -1737,12 +1738,12 @@
             if (fXSContentHandler == null) {
                 fXSContentHandler = new SchemaContentHandler();
             }
-            fXSContentHandler.reset(fSchemaParser, fSymbolTable,
+            fXSContentHandler.reset(fSchemaParser, fSymbolTable, 
                     namespacePrefixes, stringsInternalized);
             parser.setContentHandler(fXSContentHandler);
             parser.setErrorHandler(fErrorReporter.getSAXErrorHandler());
             try {
-                parser.parse(inputSource);
+                parser.parse(inputSource);  
             }
             catch (SAXException se) {
                 return null;
@@ -1755,11 +1756,11 @@
                 // something went wrong right off the hop
                 return null;
             }
-            return DOMUtil.getRoot(root);
-        }
+            return DOMUtil.getRoot(root);          
+        }       
         return getSchemaDocument(desc.getTargetNamespace(), schemaSource, mustResolve, desc.getContextType(), referElement);
     } // getSchema(String, String, String, boolean, short):  Document
-
+    
     /**
      * getSchemaDocument method uses XMLInputSource to parse a schema document.
      * @param schemaNamespace
@@ -1771,7 +1772,7 @@
      */
     private Element getSchemaDocument(String schemaNamespace, XMLInputSource schemaSource,
             boolean mustResolve, short referType, Element referElement) {
-
+        
         boolean hasInput = true;
         // contents of this method will depend on the system we adopt for entity resolution--i.e., XMLEntityHandler, EntityHandler, etc.
         Element schemaElement = null;
@@ -1786,7 +1787,7 @@
                     (schemaSource.getSystemId() != null ||
                             schemaSource.getByteStream() != null ||
                             schemaSource.getCharacterStream() != null)) {
-
+                
                 // When the system id of the input source is used, first try to
                 // expand it, and check whether the same document has been
                 // parsed before. If so, return the document corresponding to
@@ -1801,10 +1802,10 @@
                         return schemaElement;
                     }
                 }
-
+                
                 fSchemaParser.parse(schemaSource);
                 schemaElement = fSchemaParser.getDocument2() == null ? null: DOMUtil.getRoot(fSchemaParser.getDocument2());
-
+                
                 // now we need to store the mapping information from system id
                 // to the document. also from the document to the system id.
                 if (key != null)
@@ -1820,7 +1821,7 @@
         }
         catch (IOException ex) {
         }
-
+        
         // either an error occured (exception), or empty input source was
         // returned, we need to report an error or a warning
         if (mustResolve) {
@@ -1840,15 +1841,15 @@
                     new Object[]{schemaSource.getSystemId()},
                     referElement);
         }
-
+        
         fLastSchemaWasDuplicate = false;
         return null;
     } // getSchema(String, XMLInputSource, boolean, boolean): Document
-
+    
     // initialize all the traversers.
     // this should only need to be called once during the construction
     // of this object; it creates the traversers that will be used to
-
+    
     // construct schemaGrammars.
     private void createTraversers() {
         fAttributeChecker = new XSAttributeChecker(this);
@@ -1863,7 +1864,7 @@
         fUniqueOrKeyTraverser = new XSDUniqueOrKeyTraverser(this, fAttributeChecker);
         fWildCardTraverser = new XSDWildcardTraverser(this, fAttributeChecker);
     } // createTraversers()
-
+    
     // before parsing a schema, need to clear registries associated with
     // parsing schemas
     void prepareForParse() {
@@ -1872,7 +1873,7 @@
         fHiddenNodes.clear();
         fLastSchemaWasDuplicate = false;
     }
-
+    
     // before traversing a schema's parse tree, need to reset all traversers and
     // clear all registries
     void prepareForTraverse() {
@@ -1883,7 +1884,7 @@
         fUnparsedIdentityConstraintRegistry.clear();
         fUnparsedNotationRegistry.clear();
         fUnparsedTypeRegistry.clear();
-
+        
         fUnparsedAttributeRegistrySub.clear();
         fUnparsedAttributeGroupRegistrySub.clear();
         fUnparsedElementRegistrySub.clear();
@@ -1891,7 +1892,7 @@
         fUnparsedIdentityConstraintRegistrySub.clear();
         fUnparsedNotationRegistrySub.clear();
         fUnparsedTypeRegistrySub.clear();
-
+        
         fXSDocumentInfoRegistry.clear();
         fDependencyMap.clear();
         fDoc2XSDocumentMap.clear();
@@ -1900,7 +1901,7 @@
         fAllTNSs.removeAllElements();
         fImportMap.clear();
         fRoot = null;
-
+        
         // clear local element stack
         for (int i = 0; i < fLocalElemStackPos; i++) {
             fParticle[i] = null;
@@ -1909,7 +1910,7 @@
             fLocalElemNamespaceContext[i] = null;
         }
         fLocalElemStackPos = 0;
-
+        
         // and do same for keyrefs.
         for (int i = 0; i < fKeyrefStackPos; i++) {
             fKeyrefs[i] = null;
@@ -1918,12 +1919,12 @@
             fKeyrefsMapXSDocumentInfo[i] = null;
         }
         fKeyrefStackPos = 0;
-
+        
         // create traversers if necessary
         if (fAttributeChecker == null) {
             createTraversers();
         }
-
+        
         // reset traversers
         fAttributeChecker.reset(fSymbolTable);
         fAttributeGroupTraverser.reset(fSymbolTable, fValidateAnnotations);
@@ -1936,19 +1937,19 @@
         fSimpleTypeTraverser.reset(fSymbolTable, fValidateAnnotations);
         fUniqueOrKeyTraverser.reset(fSymbolTable, fValidateAnnotations);
         fWildCardTraverser.reset(fSymbolTable, fValidateAnnotations);
-
+        
         fRedefinedRestrictedAttributeGroupRegistry.clear();
         fRedefinedRestrictedGroupRegistry.clear();
     }
     public void setDeclPool (XSDeclarationPool declPool){
         fDeclPool = declPool;
     }
-
+    
     public void reset(XMLComponentManager componentManager) {
-
+        
         // set symbol table
         fSymbolTable = (SymbolTable) componentManager.getProperty(SYMBOL_TABLE);
-
+        
         fSecureProcessing = null;
         if( componentManager!=null ) {
             try {
@@ -1957,13 +1958,13 @@
                 ;
             }
         }
-
+        
         //set entity resolver
         fEntityResolver = (XMLEntityResolver) componentManager.getProperty(ENTITY_MANAGER);
         XMLEntityResolver er = (XMLEntityResolver)componentManager.getProperty(ENTITY_RESOLVER);
         if (er != null)
             fSchemaParser.setEntityResolver(er);
-
+        
         // set error reporter
         fErrorReporter =
             (XMLErrorReporter) componentManager.getProperty(ERROR_REPORTER);
@@ -1976,17 +1977,17 @@
                 fSchemaParser.setProperty(ERROR_HANDLER, (currErrorHandler != null) ? currErrorHandler : new DefaultErrorHandler());
                 if (fAnnotationValidator != null) {
                     fAnnotationValidator.setProperty(ERROR_HANDLER, (currErrorHandler != null) ? currErrorHandler : new DefaultErrorHandler());
-                }
+            	}
             }
         } catch (XMLConfigurationException e) {
         }
-
+        
         try {
             fValidateAnnotations = componentManager.getFeature(VALIDATE_ANNOTATIONS);
         } catch (XMLConfigurationException e) {
             fValidateAnnotations = false;
         }
-
+        
         try {
             fHonourAllSchemaLocations = componentManager.getFeature(HONOUR_ALL_SCHEMALOCATIONS);
         } catch (XMLConfigurationException e) {
@@ -1999,7 +2000,7 @@
                     fErrorReporter.getFeature(CONTINUE_AFTER_FATAL_ERROR));
         } catch (XMLConfigurationException e) {
         }
-
+        
         try {
             fSchemaParser.setFeature(
                     ALLOW_JAVA_ENCODINGS,
@@ -2012,7 +2013,7 @@
                     componentManager.getFeature(STANDARD_URI_CONFORMANT_FEATURE));
         } catch (XMLConfigurationException e) {
         }
-
+        
         try {
             fGrammarPool =
                 (XMLGrammarPool) componentManager.getProperty(XMLGRAMMAR_POOL);
@@ -2032,17 +2033,17 @@
             }
         } catch (XMLConfigurationException e) {
         }
-
+        
     } // reset(XMLComponentManager)
-
-
+    
+    
     /**
      * Traverse all the deferred local elements. This method should be called
      * by traverseSchemas after we've done with all the global declarations.
      */
     void traverseLocalElements() {
         fElementTraverser.fDeferTraversingLocalElements = false;
-
+        
         for (int i = 0; i < fLocalElemStackPos; i++) {
             Element currElem = fLocalElementDecl[i];
             //XSDocumentInfo currSchema = (XSDocumentInfo)fDoc2XSDocumentMap.get(DOMUtil.getDocument(currElem));
@@ -2066,7 +2067,7 @@
             }
         }
     }
-
+    
     private boolean removeParticle(XSModelGroupImpl group, XSParticleDecl particle) {
         XSParticleDecl member;
         for (int i = 0; i < group.fParticleCount; i++) {
@@ -2084,7 +2085,7 @@
         }
         return false;
     }
-
+    
     // the purpose of this method is to keep up-to-date structures
     // we'll need for the feferred traversal of local elements.
     void fillInLocalElemInfo(Element elmDecl,
@@ -2092,7 +2093,7 @@
             int allContextFlags,
             XSObject parent,
             XSParticleDecl particle) {
-
+        
         // if the stack is full, increase the size
         if (fParticle.length == fLocalElemStackPos) {
             // increase size
@@ -2115,7 +2116,7 @@
             System.arraycopy(fLocalElemNamespaceContext, 0, newStackN, 0, fLocalElemStackPos);
             fLocalElemNamespaceContext = newStackN;
         }
-
+        
         fParticle[fLocalElemStackPos] = particle;
         fLocalElementDecl[fLocalElemStackPos] = elmDecl;
         fLocalElementDecl_schema[fLocalElemStackPos] = schemaDoc;
@@ -2123,7 +2124,7 @@
         fParent[fLocalElemStackPos] = parent;
         fLocalElemNamespaceContext[fLocalElemStackPos++] = schemaDoc.fNamespaceSupport.getEffectiveLocalContext();
     } // end fillInLocalElemInfo(...)
-
+    
     /** This method makes sure that
      * if this component is being redefined that it lives in the
      * right schema.  It then renames the component correctly.  If it
@@ -2133,8 +2134,8 @@
      * or because we've found the thing we're redefining.
      */
     void checkForDuplicateNames(String qName,
-                Hashtable registry, Hashtable registry_sub, Element currComp,
-                        XSDocumentInfo currSchema) {
+    		Hashtable registry, Hashtable registry_sub, Element currComp,
+			XSDocumentInfo currSchema) {
         Object objElem = null;
         // REVISIT:  when we add derivation checking, we'll have to make
         // sure that ID constraint collisions don't necessarily result in error messages.
@@ -2142,7 +2143,7 @@
             // just add it in!
             registry.put(qName, currComp);
             registry_sub.put(qName, currSchema);
-
+            
         }
         else {
             Element collidingElem = (Element)objElem;
@@ -2168,7 +2169,7 @@
                     reportSchemaError("sch-props-correct.2", new Object[]{qName}, currComp);
                     return;
                 }
-
+                
                 String newName = qName.substring(qName.lastIndexOf(',')+1)+REDEF_IDENTIFIER;
                 if (redefinedSchema == currSchema) { // object comp. okay here
                     // now have to do some renaming...
@@ -2183,9 +2184,9 @@
                     }
                     // and take care of nested redefines by calling recursively:
                     if (currSchema.fTargetNamespace == null)
-                        checkForDuplicateNames(","+newName, registry, registry_sub, currComp, currSchema);
+                    	checkForDuplicateNames(","+newName, registry, registry_sub, currComp, currSchema);
                     else
-                        checkForDuplicateNames(currSchema.fTargetNamespace+","+newName, registry, registry_sub, currComp, currSchema);
+                    	checkForDuplicateNames(currSchema.fTargetNamespace+","+newName, registry, registry_sub, currComp, currSchema);
                 }
                 else { // we may be redefining the wrong schema
                     if (collidedWithRedefine) {
@@ -2206,7 +2207,7 @@
             }
         }
     } // checkForDuplicateNames(String, Hashtable, Element, XSDocumentInfo):void
-
+    
     // the purpose of this method is to take the component of the
     // specified type and rename references to itself so that they
     // refer to the object being redefined.  It takes special care of
@@ -2359,7 +2360,7 @@
         // if we get here then we must have reported an error and failed somewhere...
         //        return false;
     } // renameRedefiningComponents(XSDocumentInfo, Element, String, String, String):void
-
+    
     // this method takes a name of the form a:b, determines the URI mapped
     // to by a in the current SchemaNamespaceSupport object, and returns this
     // information in the form (nsURI,b) suitable for lookups in the global
@@ -2385,7 +2386,7 @@
             return ","+localpart;
         return uri+","+localpart;
     } // findQName(String, XSDocumentInfo):  String
-
+    
     // This function looks among the children of curr for an element of type elementSought.
     // If it finds one, it evaluates whether its ref attribute contains a reference
     // to originalQName.  If it does, it returns 1 + the value returned by
@@ -2429,7 +2430,7 @@
         }
         return result;
     } // changeRedefineGroup
-
+    
     // this method returns the XSDocumentInfo object that contains the
     // component corresponding to decl.  If components from this
     // document cannot be referred to from those of currSchema, this
@@ -2440,7 +2441,7 @@
     // this method is superficial now. ---Jack
     private XSDocumentInfo findXSDocumentForDecl(XSDocumentInfo currSchema,
             Element decl, XSDocumentInfo decl_Doc) {
-
+        
         if (DEBUG_NODE_POOL) {
             System.out.println("DOCUMENT NS:"+ currSchema.fTargetNamespace+" hashcode:"+ ((Object)currSchema.fSchemaElement).hashCode());
         }
@@ -2465,7 +2466,7 @@
             return null;
             **********/
     } // findXSDocumentForDecl(XSDocumentInfo, Element):  XSDocumentInfo
-
+    
     // returns whether more than <annotation>s occur in children of elem
     private boolean nonAnnotationContent(Element elem) {
         for(Element child = DOMUtil.getFirstChildElement(elem); child != null; child = DOMUtil.getNextSiblingElement(child)) {
@@ -2473,11 +2474,11 @@
         }
         return false;
     } // nonAnnotationContent(Element):  boolean
-
+    
     private void setSchemasVisible(XSDocumentInfo startSchema) {
         if (DOMUtil.isHidden(startSchema.fSchemaElement, fHiddenNodes)) {
             // make it visible
-            DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes);
+            DOMUtil.setVisible(startSchema.fSchemaElement, fHiddenNodes);           
             Vector dependingSchemas = (Vector)fDependencyMap.get(startSchema);
             for (int i = 0; i < dependingSchemas.size(); i++) {
                 setSchemasVisible((XSDocumentInfo)dependingSchemas.elementAt(i));
@@ -2485,9 +2486,9 @@
         }
         // if it's visible already than so must be its children
     } // setSchemasVisible(XSDocumentInfo): void
-
+    
     private SimpleLocator xl = new SimpleLocator();
-
+    
     /**
      * Extract location information from an Element node, and create a
      * new SimpleLocator object from such information. Returning null means
@@ -2496,11 +2497,11 @@
     public SimpleLocator element2Locator(Element e) {
         if (!( e instanceof ElementImpl))
             return null;
-
+        
         SimpleLocator l = new SimpleLocator();
         return element2Locator(e, l) ? l : null;
     }
-
+    
     /**
      * Extract location information from an Element node, store such
      * information in the passed-in SimpleLocator object, then return
@@ -2522,7 +2523,7 @@
         }
         return false;
     }
-
+    
     void reportSchemaFatalError(String key, Object[] args, Element ele) {
         reportSchemaErr(key, args, ele, XMLErrorReporter.SEVERITY_FATAL_ERROR);
     }
@@ -2530,7 +2531,7 @@
     void reportSchemaError(String key, Object[] args, Element ele) {
         reportSchemaErr(key, args, ele, XMLErrorReporter.SEVERITY_ERROR);
     }
-
+    
     void reportSchemaWarning(String key, Object[] args, Element ele) {
         reportSchemaErr(key, args, ele, XMLErrorReporter.SEVERITY_WARNING);
     }
@@ -2545,7 +2546,7 @@
                     key, args, type);
         }
     }
-
+    
     /**
      * Grammar pool used for validating annotations. This will return all of the
      * grammars from the grammar bucket. It will also return an object for the
@@ -2553,10 +2554,10 @@
      * for annotations.
      */
     private static class XSAnnotationGrammarPool implements XMLGrammarPool {
-
+        
         private XSGrammarBucket fGrammarBucket;
         private Grammar [] fInitialGrammarSet;
-
+        
         public Grammar[] retrieveInitialGrammarSet(String grammarType) {
             if (grammarType == XMLGrammarDescription.XML_SCHEMA) {
                 if (fInitialGrammarSet == null) {
@@ -2565,7 +2566,7 @@
                     }
                     else {
                         SchemaGrammar [] schemaGrammars = fGrammarBucket.getGrammars();
-                        /**
+                        /** 
                          * If the grammar bucket already contains the schema for schemas
                          * then we already have the definitions for the parts relevant
                          * to annotations.
@@ -2588,7 +2589,7 @@
         }
 
         public void cacheGrammars(String grammarType, Grammar[] grammars) {
-
+            
         }
 
         public Grammar retrieveGrammar(XMLGrammarDescription desc) {
@@ -2606,7 +2607,7 @@
             }
             return null;
         }
-
+        
         public void refreshGrammars(XSGrammarBucket gBucket) {
             fGrammarBucket = gBucket;
             fInitialGrammarSet = null;
@@ -2662,50 +2663,50 @@
         // for inclue/redefine, this is the enclosing namespace
         // for import/preparse/instance, this is the target namespace
         String referNS;
-
+        
         XSDKey(String systemId, short referType, String referNS) {
             this.systemId = systemId;
             this.referType = referType;
             this.referNS = referNS;
         }
-
+        
         public int hashCode() {
             // according to the description at the beginning of this class,
             // we use the hashcode of the namespace as the hashcoe of this key.
             return referNS == null ? 0 : referNS.hashCode();
         }
-
+        
         public boolean equals(Object obj) {
             if (!(obj instanceof XSDKey)) {
                 return false;
             }
             XSDKey key = (XSDKey)obj;
-
+            
             // condition 1: both are redefine
             if (referType == XSDDescription.CONTEXT_REDEFINE ||
                     key.referType == XSDDescription.CONTEXT_REDEFINE) {
                 if (referType != key.referType)
                     return false;
             }
-
+            
             // condition 2: same namespace
             if (referNS != key.referNS)
                 return false;
-
+            
             // condition 3: same non-null locatoin
             if (systemId == null || !systemId.equals(key.systemId)) {
                 return false;
             }
-
+            
             return true;
         }
     }
-
+    
     /**
      * @param state
      */
     public void setGenerateSyntheticAnnotations(boolean state) {
         fSchemaParser.setFeature(GENERATE_SYNTHETIC_ANNOTATIONS, state);
     }
-
+    
 } // XSDHandler
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDocumentInfo.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/impl/xs/traversers/XSDocumentInfo.java	Wed Sep 28 16:49:43 2011 +0100
@@ -30,6 +30,9 @@
 import com.sun.org.apache.xerces.internal.impl.xs.util.XInt;
 import com.sun.org.apache.xerces.internal.util.SymbolTable;
 import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.Attr;
+import org.w3c.dom.NamedNodeMap;
 
 /**
  * Objects of this class hold all information pecular to a
@@ -37,9 +40,10 @@
  * namespace bindings and other settings on the <schema/> element
  * affect the contents of that schema document alone.
  *
- * @xerces.internal
+ * @xerces.internal 
  *
  * @author Neil Graham, IBM
+ * @version $Id: XSDocumentInfo.java,v 1.5 2007/10/15 22:27:48 spericas Exp $
  */
 class XSDocumentInfo {
 
@@ -69,19 +73,19 @@
 
     // all namespaces that this document can refer to
     Vector fImportedNS = new Vector();
-
+    
     protected ValidationState fValidationContext = new ValidationState();
 
     SymbolTable fSymbolTable = null;
 
-    // attribute checker to which we'll return the attributes
+    // attribute checker to which we'll return the attributes 
     // once we've been told that we're done with them
     protected XSAttributeChecker fAttrChecker;
 
     // array of objects on the schema's root element.  This is null
     // once returnSchemaAttrs has been called.
     protected Object [] fSchemaAttrs;
-
+    
     // list of annotations contained in the schema document. This is null
     // once removeAnnotations has been called.
     protected XSAnnotationInfo fAnnotations = null;
@@ -91,8 +95,7 @@
     XSDocumentInfo (Element schemaRoot, XSAttributeChecker attrChecker, SymbolTable symbolTable)
                     throws XMLSchemaException {
         fSchemaElement = schemaRoot;
-        fNamespaceSupport = new SchemaNamespaceSupport();
-        fNamespaceSupport.reset();
+        initNamespaceSupport(schemaRoot);
         fIsChameleonSchema = false;
 
         fSymbolTable = symbolTable;
@@ -133,6 +136,46 @@
         }
     }
 
+    /**
+     * Initialize namespace support by collecting all of the namespace
+     * declarations in the root's ancestors. This is necessary to
+     * support schemas fragments, i.e. schemas embedded in other 
+     * documents. See,
+     * 
+     * https://jaxp.dev.java.net/issues/show_bug.cgi?id=43
+     * 
+     * Requires the DOM to be created with namespace support enabled.
+     */
+    private void initNamespaceSupport(Element schemaRoot) {
+        fNamespaceSupport = new SchemaNamespaceSupport();
+        fNamespaceSupport.reset();
+        
+        Node parent = schemaRoot.getParentNode();
+        while (parent != null && parent.getNodeType() == Node.ELEMENT_NODE
+                && !parent.getNodeName().equals("DOCUMENT_NODE")) 
+        {
+            Element eparent = (Element) parent;
+            NamedNodeMap map = eparent.getAttributes();
+            int length = (map != null) ? map.getLength() : 0;                
+            for (int i = 0; i < length; i++) {
+                Attr attr = (Attr) map.item(i);
+                String uri = attr.getNamespaceURI();
+
+                // Check if attribute is an ns decl -- requires ns support
+                if (uri != null && uri.equals("http://www.w3.org/2000/xmlns/")) {
+                    String prefix = attr.getLocalName().intern();
+                    if (prefix == "xmlns") prefix = "";
+                    // Declare prefix if not set -- moving upwards
+                    if (fNamespaceSupport.getURI(prefix) == null) {
+                        fNamespaceSupport.declarePrefix(prefix, 
+                                attr.getValue().intern());
+                    }
+                }
+            }
+            parent = parent.getParentNode();
+        }
+    }
+
     // backup the current ns support, and use the one passed-in.
     // if no ns support is passed-in, use the one for <schema> element
     void backupNSSupport(SchemaNamespaceSupport nsSupport) {
@@ -157,11 +200,11 @@
     public void addAllowedNS(String namespace) {
         fImportedNS.addElement(namespace == null ? "" : namespace);
     }
-
+    
     public boolean isAllowedNS(String namespace) {
         return fImportedNS.contains(namespace == null ? "" : namespace);
     }
-
+    
     // store whether we have reported an error about that this document
     // can't access components from the given namespace
     private Vector fReportedTNS = null;
@@ -188,22 +231,22 @@
         fAttrChecker.returnAttrArray (fSchemaAttrs, null);
         fSchemaAttrs = null;
     }
-
+    
     // adds an annotation to the list of annotations
     void addAnnotation(XSAnnotationInfo info) {
         info.next = fAnnotations;
         fAnnotations = info;
     }
-
+    
     // returns the list of annotations conatined in the
     // schema document or null if the document contained no annotations.
     XSAnnotationInfo getAnnotations() {
         return fAnnotations;
     }
-
+    
     // removes reference to annotation list
     void removeAnnotations() {
         fAnnotations = null;
     }
-
+    
 } // XSDocumentInfo
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderFactoryImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -37,6 +37,7 @@
 /**
  * @author Rajiv Mordani
  * @author Edwin Goei
+ * @version $Id: DocumentBuilderFactoryImpl.java,v 1.6 2009/07/28 23:48:32 joehw Exp $
  */
 public class DocumentBuilderFactoryImpl extends DocumentBuilderFactory {
     /** These are DocumentBuilderFactory attributes not DOM attributes */
@@ -44,7 +45,7 @@
     private Hashtable features;
     private Schema grammar;
     private boolean isXIncludeAware;
-
+    
     /**
      * State of the secure processing feature, initially <code>false</code>
      */
@@ -55,22 +56,22 @@
      * using the currently configured parameters.
      */
     public DocumentBuilder newDocumentBuilder()
-        throws ParserConfigurationException
+        throws ParserConfigurationException 
     {
         /** Check that if a Schema has been specified that neither of the schema properties have been set. */
         if (grammar != null && attributes != null) {
             if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_LANGUAGE)) {
                 throw new ParserConfigurationException(
-                        SAXMessageFormatter.formatMessage(null,
+                        SAXMessageFormatter.formatMessage(null, 
                         "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_LANGUAGE}));
             }
             else if (attributes.containsKey(JAXPConstants.JAXP_SCHEMA_SOURCE)) {
                 throw new ParserConfigurationException(
-                        SAXMessageFormatter.formatMessage(null,
-                        "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_SOURCE}));
+                        SAXMessageFormatter.formatMessage(null, 
+                        "schema-already-specified", new Object[] {JAXPConstants.JAXP_SCHEMA_SOURCE}));                
             }
         }
-
+        
         try {
             return new DocumentBuilderImpl(this, attributes, features, fSecureProcess);
         } catch (SAXException se) {
@@ -80,7 +81,7 @@
     }
 
     /**
-     * Allows the user to set specific attributes on the underlying
+     * Allows the user to set specific attributes on the underlying 
      * implementation.
      * @param name    name of attribute
      * @param value   null means to remove attribute
@@ -96,7 +97,7 @@
             // Unrecognized attributes do not cause an exception
             return;
         }
-
+        
         // This is ugly.  We have to collect the attributes and then
         // later create a DocumentBuilderImpl to verify the attributes.
 
@@ -117,7 +118,7 @@
     }
 
     /**
-     * Allows the user to retrieve specific attributes on the underlying
+     * Allows the user to retrieve specific attributes on the underlying 
      * implementation.
      */
     public Object getAttribute(String name)
@@ -150,24 +151,24 @@
             }
         }
     }
-
+    
     public Schema getSchema() {
         return grammar;
     }
-
+    
     public void setSchema(Schema grammar) {
         this.grammar = grammar;
     }
-
+    
     public boolean isXIncludeAware() {
         return this.isXIncludeAware;
     }
-
+    
     public void setXIncludeAware(boolean state) {
         this.isXIncludeAware = state;
     }
-
-    public boolean getFeature(String name)
+    
+    public boolean getFeature(String name) 
         throws ParserConfigurationException {
         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
             return fSecureProcess;
@@ -187,11 +188,16 @@
             throw new ParserConfigurationException(e.getMessage());
         }
     }
-
-    public void setFeature(String name, boolean value)
+    
+    public void setFeature(String name, boolean value) 
         throws ParserConfigurationException {
         // If this is the secure processing feature, save it then return.
         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+            if (System.getSecurityManager() != null && (!value)) {
+                throw new ParserConfigurationException(
+                        SAXMessageFormatter.formatMessage(null, 
+                        "jaxp-secureprocessing-feature", null));
+            }
             fSecureProcess = value;
             return;
         }
@@ -202,11 +208,11 @@
         // Test the feature by possibly throwing SAX exceptions
         try {
             new DocumentBuilderImpl(this, attributes, features);
-        }
+        } 
         catch (SAXNotSupportedException e) {
             features.remove(name);
             throw new ParserConfigurationException(e.getMessage());
-        }
+        } 
         catch (SAXNotRecognizedException e) {
             features.remove(name);
             throw new ParserConfigurationException(e.getMessage());
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/DocumentBuilderImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -54,6 +54,7 @@
 /**
  * @author Rajiv Mordani
  * @author Edwin Goei
+ * @version $Id: DocumentBuilderImpl.java,v 1.5 2007/07/20 14:11:20 spericas Exp $
  */
 public class DocumentBuilderImpl extends DocumentBuilder
         implements JAXPConstants
@@ -61,52 +62,52 @@
     /** Feature identifier: namespaces. */
     private static final String NAMESPACES_FEATURE =
         Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
-
+    
     /** Feature identifier: include ignorable white space. */
     private static final String INCLUDE_IGNORABLE_WHITESPACE =
         Constants.XERCES_FEATURE_PREFIX + Constants.INCLUDE_IGNORABLE_WHITESPACE;
-
+    
     /** Feature identifier: create entiry ref nodes feature. */
     private static final String CREATE_ENTITY_REF_NODES_FEATURE =
         Constants.XERCES_FEATURE_PREFIX + Constants.CREATE_ENTITY_REF_NODES_FEATURE;
-
+    
     /** Feature identifier: include comments feature. */
     private static final String INCLUDE_COMMENTS_FEATURE =
         Constants.XERCES_FEATURE_PREFIX + Constants.INCLUDE_COMMENTS_FEATURE;
-
+    
     /** Feature identifier: create cdata nodes feature. */
     private static final String CREATE_CDATA_NODES_FEATURE =
         Constants.XERCES_FEATURE_PREFIX + Constants.CREATE_CDATA_NODES_FEATURE;
-
+    
     /** Feature identifier: XInclude processing */
-    private static final String XINCLUDE_FEATURE =
+    private static final String XINCLUDE_FEATURE = 
         Constants.XERCES_FEATURE_PREFIX + Constants.XINCLUDE_FEATURE;
 
     /** feature identifier: XML Schema validation */
     private static final String XMLSCHEMA_VALIDATION_FEATURE =
         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE;
-
+    
     /** Feature identifier: validation */
     private static final String VALIDATION_FEATURE =
         Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
-
+    
     /** Property identifier: security manager. */
     private static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
-
+    
     private DOMParser domParser = null;
     private final Schema grammar;
-
+    
     private XMLComponent fSchemaValidator;
     private XMLComponentManager fSchemaValidatorComponentManager;
     private ValidationManager fSchemaValidationManager;
-
+    
     /** Initial ErrorHandler */
     private final ErrorHandler fInitErrorHandler;
-
+    
     /** Initial EntityResolver */
     private final EntityResolver fInitEntityResolver;
-
+    
     DocumentBuilderImpl(DocumentBuilderFactoryImpl dbf, Hashtable dbfAttrs, Hashtable features)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         this(dbf, dbfAttrs, features, false);
@@ -134,7 +135,7 @@
         domParser.setFeature(NAMESPACES_FEATURE, dbf.isNamespaceAware());
 
         // Set various parameters obtained from DocumentBuilderFactory
-        domParser.setFeature(INCLUDE_IGNORABLE_WHITESPACE,
+        domParser.setFeature(INCLUDE_IGNORABLE_WHITESPACE, 
                 !dbf.isIgnoringElementContentWhitespace());
         domParser.setFeature(CREATE_ENTITY_REF_NODES_FEATURE,
                 !dbf.isExpandEntityReferences());
@@ -142,19 +143,19 @@
                 !dbf.isIgnoringComments());
         domParser.setFeature(CREATE_CDATA_NODES_FEATURE,
                 !dbf.isCoalescing());
-
+        
         // Avoid setting the XInclude processing feature if the value is false.
         // This will keep the configuration from throwing an exception if it
         // does not support XInclude.
         if (dbf.isXIncludeAware()) {
             domParser.setFeature(XINCLUDE_FEATURE, true);
         }
-
+        
         // If the secure processing feature is on set a security manager.
         if (secureProcessing) {
             domParser.setProperty(SECURITY_MANAGER, new SecurityManager());
         }
-
+        
         this.grammar = dbf.getSchema();
         if (grammar != null) {
             XMLParserConfiguration config = domParser.getXMLParserConfiguration();
@@ -167,7 +168,7 @@
                 config.setDTDHandler(entityHandler);
                 entityHandler.setDTDHandler(domParser);
                 domParser.setDTDSource(entityHandler);
-                fSchemaValidatorComponentManager = new SchemaValidatorConfiguration(config,
+                fSchemaValidatorComponentManager = new SchemaValidatorConfiguration(config, 
                         (XSGrammarPoolContainer) grammar, fSchemaValidationManager);
             }
             /** For third party grammars, use the JAXP validator component. **/
@@ -177,22 +178,23 @@
             }
             config.addRecognizedFeatures(validatorComponent.getRecognizedFeatures());
             config.addRecognizedProperties(validatorComponent.getRecognizedProperties());
+            setFeatures(features);      // Must set before calling setDocumentHandler()
             config.setDocumentHandler((XMLDocumentHandler) validatorComponent);
             ((XMLDocumentSource)validatorComponent).setDocumentHandler(domParser);
             domParser.setDocumentSource((XMLDocumentSource) validatorComponent);
             fSchemaValidator = validatorComponent;
         }
-
-        // Set features
+        else {
         setFeatures(features);
-
+        }
+        
         // Set attributes
         setDocumentBuilderFactoryAttributes(dbfAttrs);
-
+        
         // Initial EntityResolver
         fInitEntityResolver = domParser.getEntityResolver();
     }
-
+    
     private void setFeatures(Hashtable features)
         throws SAXNotSupportedException, SAXNotRecognizedException {
         if (features != null) {
@@ -229,34 +231,34 @@
                 // Assume property
                 if (JAXP_SCHEMA_LANGUAGE.equals(name)) {
                     // JAXP 1.2 support
-                    //None of the properties will take effect till the setValidating(true) has been called
+                    //None of the properties will take effect till the setValidating(true) has been called                                        
                     if ( W3C_XML_SCHEMA.equals(val) ) {
                         if( isValidating() ) {
                             domParser.setFeature(XMLSCHEMA_VALIDATION_FEATURE, true);
-                            // this should allow us not to emit DTD errors, as expected by the
+                            // this should allow us not to emit DTD errors, as expected by the 
                             // spec when schema validation is enabled
                             domParser.setProperty(JAXP_SCHEMA_LANGUAGE, W3C_XML_SCHEMA);
                         }
                     }
-                        } else if(JAXP_SCHEMA_SOURCE.equals(name)){
-                        if( isValidating() ) {
-                                                String value=(String)dbfAttrs.get(JAXP_SCHEMA_LANGUAGE);
-                                                if(value !=null && W3C_XML_SCHEMA.equals(value)){
-                                        domParser.setProperty(name, val);
-                                                }else{
+        		} else if(JAXP_SCHEMA_SOURCE.equals(name)){
+               		if( isValidating() ) {
+						String value=(String)dbfAttrs.get(JAXP_SCHEMA_LANGUAGE);
+						if(value !=null && W3C_XML_SCHEMA.equals(value)){
+            				domParser.setProperty(name, val);
+						}else{
                             throw new IllegalArgumentException(
-                                DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
+                                DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 
                                 "jaxp-order-not-supported",
                                 new Object[] {JAXP_SCHEMA_LANGUAGE, JAXP_SCHEMA_SOURCE}));
-                                                }
-                                        }
-                } else {
+						}
+					}
+            	} else {
                     // Let Xerces code handle the property
                     domParser.setProperty(name, val);
-                                }
-                        }
-                }
-        }
+				}
+			}
+		}
+	}
 
     /**
      * Non-preferred: use the getDOMImplementation() method instead of this
@@ -274,7 +276,7 @@
     public Document parse(InputSource is) throws SAXException, IOException {
         if (is == null) {
             throw new IllegalArgumentException(
-                DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN,
+                DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, 
                 "jaxp-null-input-source", null));
         }
         if (fSchemaValidator != null) {
@@ -290,7 +292,7 @@
     public boolean isNamespaceAware() {
         try {
             return domParser.getFeature(NAMESPACES_FEATURE);
-        }
+        } 
         catch (SAXException x) {
             throw new IllegalStateException(x.getMessage());
         }
@@ -299,12 +301,12 @@
     public boolean isValidating() {
         try {
             return domParser.getFeature(VALIDATION_FEATURE);
-        }
+        } 
         catch (SAXException x) {
             throw new IllegalStateException(x.getMessage());
         }
     }
-
+    
     /**
      * Gets the XInclude processing mode for this parser
      * @return the state of XInclude processing mode
@@ -325,11 +327,11 @@
     public void setErrorHandler(ErrorHandler eh) {
         domParser.setErrorHandler(eh);
     }
-
+    
     public Schema getSchema() {
         return grammar;
     }
-
+    
     public void reset() {
         /** Restore the initial error handler. **/
         if (domParser.getErrorHandler() != fInitErrorHandler) {
@@ -345,7 +347,7 @@
     DOMParser getDOMParser() {
         return domParser;
     }
-
+    
     private void resetSchemaValidator() throws SAXException {
         try {
             fSchemaValidator.reset(fSchemaValidatorComponentManager);
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/SAXParserFactoryImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -33,34 +33,36 @@
 import org.xml.sax.SAXNotSupportedException;
 
 import com.sun.org.apache.xerces.internal.impl.Constants;
+import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
 
 /**
  * This is the implementation specific class for the
  * <code>javax.xml.parsers.SAXParserFactory</code>. This is the platform
  * default implementation for the platform.
- *
+ * 
  * @author Rajiv Mordani
  * @author Edwin Goei
- *
+ * 
+ * @version $Id: SAXParserFactoryImpl.java,v 1.7 2009/07/28 23:48:32 joehw Exp $
  */
 public class SAXParserFactoryImpl extends SAXParserFactory {
-
+    
     /** Feature identifier: validation. */
     private static final String VALIDATION_FEATURE =
         Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
-
+    
     /** Feature identifier: namespaces. */
     private static final String NAMESPACES_FEATURE =
         Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
-
+    
     /** Feature identifier: XInclude processing */
-    private static final String XINCLUDE_FEATURE =
+    private static final String XINCLUDE_FEATURE = 
         Constants.XERCES_FEATURE_PREFIX + Constants.XINCLUDE_FEATURE;
-
+    
     private Hashtable features;
     private Schema grammar;
     private boolean isXIncludeAware;
-
+    
     /**
      * State of the secure processing feature, initially <code>false</code>
      */
@@ -81,14 +83,14 @@
             // Translate to ParserConfigurationException
             throw new ParserConfigurationException(se.getMessage());
         }
-        return saxParserImpl;
+	return saxParserImpl;
     }
 
     /**
      * Common code for translating exceptions
      */
     private SAXParserImpl newSAXParserImpl()
-        throws ParserConfigurationException, SAXNotRecognizedException,
+        throws ParserConfigurationException, SAXNotRecognizedException, 
         SAXNotSupportedException
     {
         SAXParserImpl saxParserImpl;
@@ -105,21 +107,26 @@
     }
 
     /**
-     * Sets the particular feature in the underlying implementation of
+     * Sets the particular feature in the underlying implementation of 
      * org.xml.sax.XMLReader.
      */
     public void setFeature(String name, boolean value)
-        throws ParserConfigurationException, SAXNotRecognizedException,
-                SAXNotSupportedException {
+        throws ParserConfigurationException, SAXNotRecognizedException, 
+		SAXNotSupportedException {
         if (name == null) {
             throw new NullPointerException();
         }
         // If this is the secure processing feature, save it then return.
         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+            if (System.getSecurityManager() != null && (!value)) {
+                throw new ParserConfigurationException(
+                        SAXMessageFormatter.formatMessage(null, 
+                        "jaxp-secureprocessing-feature", null));
+            }
             fSecureProcess = value;
             return;
         }
-
+        
         // XXX This is ugly.  We have to collect the features and then
         // later create an XMLReader to verify the features.
         putInFeatures(name, value);
@@ -136,12 +143,12 @@
     }
 
     /**
-     * returns the particular property requested for in the underlying
+     * returns the particular property requested for in the underlying 
      * implementation of org.xml.sax.XMLReader.
      */
     public boolean getFeature(String name)
         throws ParserConfigurationException, SAXNotRecognizedException,
-                SAXNotSupportedException {
+		SAXNotSupportedException {
         if (name == null) {
             throw new NullPointerException();
         }
@@ -152,7 +159,7 @@
         // feature value
         return newSAXParserImpl().getXMLReader().getFeature(name);
     }
-
+    
     public Schema getSchema() {
         return grammar;
     }
@@ -168,23 +175,23 @@
     public void setXIncludeAware(boolean state) {
         putInFeatures(XINCLUDE_FEATURE, state);
     }
-
-
+    
+    
     public void setValidating(boolean validating) {
         putInFeatures(VALIDATION_FEATURE, validating);
     }
-
+    
     public boolean isValidating() {
          return getFromFeatures(VALIDATION_FEATURE);
     }
-
+     
     private void putInFeatures(String name, boolean value){
          if (features == null) {
             features = new Hashtable();
         }
         features.put(name, value ? Boolean.TRUE : Boolean.FALSE);
     }
-
+     
     private boolean getFromFeatures(String name){
          if (features == null){
             return false;
@@ -194,11 +201,11 @@
              return (value == null) ? false : Boolean.valueOf(value.toString()).booleanValue();
          }
     }
-
+   
     public boolean isNamespaceAware() {
         return getFromFeatures(NAMESPACES_FEATURE);
     }
-
+     
     public void setNamespaceAware(boolean awareness) {
        putInFeatures(NAMESPACES_FEATURE, awareness);
     }
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/DOMValidatorHelper.java	Wed Sep 28 16:49:43 2011 +0100
@@ -61,112 +61,113 @@
 
 /**
  * <p>A validator helper for <code>DOMSource</code>s.</p>
- *
+ * 
  * @author Michael Glavassevich, IBM
+ * @version $Id: DOMValidatorHelper.java,v 1.6 2008/03/22 02:53:49 joehw Exp $
  */
 final class DOMValidatorHelper implements ValidatorHelper, EntityState {
-
+    
     //
     // Constants
     //
 
     /** Chunk size (1024). */
     private static final int CHUNK_SIZE = (1 << 10);
-
+    
     /** Chunk mask (CHUNK_SIZE - 1). */
     private static final int CHUNK_MASK = CHUNK_SIZE - 1;
-
+    
     // property identifiers
-
+    
     /** Property identifier: error reporter. */
     private static final String ERROR_REPORTER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
+    
     /** Property identifier: namespace context. */
     private static final String NAMESPACE_CONTEXT =
         Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
-
+    
     /** Property identifier: XML Schema validator. */
     private static final String SCHEMA_VALIDATOR =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_VALIDATOR_PROPERTY;
-
+    
     /** Property identifier: symbol table. */
     private static final String SYMBOL_TABLE =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
-
+    
     /** Property identifier: validation manager. */
     private static final String VALIDATION_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
-
+    
     //
     // Data
     //
-
+    
     /** Error reporter. */
     private XMLErrorReporter fErrorReporter;
-
+    
     /** The namespace context of this document: stores namespaces in scope. **/
     private NamespaceSupport fNamespaceContext;
-
+    
     /** The namespace context of the DOMSource, includes context from ancestor nodes. **/
     private DOMNamespaceContext fDOMNamespaceContext = new DOMNamespaceContext();
-
+    
     /** Schema validator. **/
     private XMLSchemaValidator fSchemaValidator;
-
+    
     /** Symbol table **/
     private SymbolTable fSymbolTable;
-
+    
     /** Validation manager. **/
     private ValidationManager fValidationManager;
-
+    
     /** Component manager. **/
     private XMLSchemaValidatorComponentManager fComponentManager;
-
+    
     /** Simple Locator. **/
     private final SimpleLocator fXMLLocator = new SimpleLocator(null, null, -1, -1, -1);
-
+    
     /** DOM document handler. **/
     private DOMDocumentHandler fDOMValidatorHandler;
-
+    
     /** DOM result augmentor. **/
     private final DOMResultAugmentor fDOMResultAugmentor = new DOMResultAugmentor(this);
-
+    
     /** DOM result builder. **/
     private final DOMResultBuilder fDOMResultBuilder = new DOMResultBuilder();
-
+    
     /** Map for tracking unparsed entities. **/
     private NamedNodeMap fEntities = null;
-
+    
     /** Array for holding character data. **/
     private char [] fCharBuffer = new char[CHUNK_SIZE];
-
+    
     /** Root node. **/
     private Node fRoot;
-
+    
     /** Current element. **/
     private Node fCurrentElement;
-
+    
     /** Fields for start element, end element and characters. **/
     final QName fElementQName = new QName();
     final QName fAttributeQName = new QName();
-    final XMLAttributesImpl fAttributes = new XMLAttributesImpl();
+    final XMLAttributesImpl fAttributes = new XMLAttributesImpl(); 
     final XMLString fTempString = new XMLString();
-
+    
     public DOMValidatorHelper(XMLSchemaValidatorComponentManager componentManager) {
         fComponentManager = componentManager;
         fErrorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
         fNamespaceContext = (NamespaceSupport) fComponentManager.getProperty(NAMESPACE_CONTEXT);
         fSchemaValidator = (XMLSchemaValidator) fComponentManager.getProperty(SCHEMA_VALIDATOR);
-        fSymbolTable = (SymbolTable) fComponentManager.getProperty(SYMBOL_TABLE);
+        fSymbolTable = (SymbolTable) fComponentManager.getProperty(SYMBOL_TABLE);        
         fValidationManager = (ValidationManager) fComponentManager.getProperty(VALIDATION_MANAGER);
     }
-
+    
     /*
      * ValidatorHelper methods
      */
-
-    public void validate(Source source, Result result)
+    
+    public void validate(Source source, Result result) 
         throws SAXException, IOException {
         if (result instanceof DOMResult || result == null) {
             final DOMSource domSource = (DOMSource) source;
@@ -198,7 +199,7 @@
                 finally {
                     // Release references to application objects
                     fRoot = null;
-                    fCurrentElement = null;
+                    //fCurrentElement = null; -- keep the reference to support current-element-node property
                     fEntities = null;
                     if (fDOMValidatorHandler != null) {
                         fDOMValidatorHandler.setDOMResult(null);
@@ -207,19 +208,19 @@
             }
             return;
         }
-        throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
-                "SourceResultMismatch",
+        throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
+                "SourceResultMismatch", 
                 new Object [] {source.getClass().getName(), result.getClass().getName()}));
     }
-
+    
     /*
      * EntityState methods
      */
-
+    
     public boolean isEntityDeclared(String name) {
         return false;
     }
-
+    
     public boolean isEntityUnparsed(String name) {
         if (fEntities != null) {
             Entity entity = (Entity) fEntities.getNamedItem(name);
@@ -229,11 +230,11 @@
         }
         return false;
     }
-
+    
     /*
      * Other methods
      */
-
+    
     /** Traverse the DOM and fire events to the schema validator. */
     private void validate(Node node) {
         final Node top = node;
@@ -243,7 +244,7 @@
             beginNode(node);
             Node next = node.getFirstChild();
             while (next == null) {
-                finishNode(node);
+                finishNode(node);           
                 if (top == node) {
                     break;
                 }
@@ -262,7 +263,7 @@
             node = next;
         }
     }
-
+    
     /** Do processing for the start of a node. */
     private void beginNode(Node node) {
         switch (node.getNodeType()) {
@@ -298,11 +299,11 @@
                 else {
                     fSchemaValidator.startCDATA(null);
                     sendCharactersToValidator(node.getNodeValue());
-                    fSchemaValidator.endCDATA(null);
+                    fSchemaValidator.endCDATA(null); 
                 }
                 break;
             case Node.PROCESSING_INSTRUCTION_NODE:
-                /**
+                /** 
                  * The validator does nothing with processing instructions so bypass it.
                  * Send the ProcessingInstruction node directly to the result builder.
                  */
@@ -311,7 +312,7 @@
                 }
                 break;
             case Node.COMMENT_NODE:
-                /**
+                /** 
                  * The validator does nothing with comments so bypass it.
                  * Send the Comment node directly to the result builder.
                  */
@@ -320,7 +321,7 @@
                 }
                 break;
             case Node.DOCUMENT_TYPE_NODE:
-                /**
+                /** 
                  * Send the DocumentType node directly to the result builder.
                  */
                 if (fDOMValidatorHandler != null) {
@@ -331,7 +332,7 @@
                 break;
         }
     }
-
+    
     /** Do processing for the end of a node. */
     private void finishNode(Node node) {
         if (node.getNodeType() == Node.ELEMENT_NODE) {
@@ -343,10 +344,10 @@
             fNamespaceContext.popContext();
         }
     }
-
+    
     /**
      * Extracts NamedNodeMap of entities. We need this to validate
-     * elements and attributes of type xs:ENTITY, xs:ENTITIES or
+     * elements and attributes of type xs:ENTITY, xs:ENTITIES or 
      * types dervied from them.
      */
     private void setupEntityMap(Document doc) {
@@ -359,7 +360,7 @@
         }
         fEntities = null;
     }
-
+    
     /**
      * Sets up handler for <code>DOMResult</code>.
      */
@@ -394,34 +395,34 @@
         fDOMResultBuilder.setDOMResult(result);
         fSchemaValidator.setDocumentHandler(fDOMResultBuilder);
     }
-
+    
     private void fillQName(QName toFill, Node node) {
         final String prefix = node.getPrefix();
         final String localName = node.getLocalName();
         final String rawName = node.getNodeName();
         final String namespace = node.getNamespaceURI();
-
+        
         toFill.uri = (namespace != null && namespace.length() > 0) ? fSymbolTable.addSymbol(namespace) : null;
-        toFill.rawname = (rawName != null) ? fSymbolTable.addSymbol(rawName) : XMLSymbols.EMPTY_STRING;
-
+        toFill.rawname = (rawName != null) ? fSymbolTable.addSymbol(rawName) : XMLSymbols.EMPTY_STRING;  
+        
         // Is this a DOM level1 document?
         if (localName == null) {
             int k = rawName.indexOf(':');
             if (k > 0) {
                 toFill.prefix = fSymbolTable.addSymbol(rawName.substring(0, k));
-                toFill.localpart = fSymbolTable.addSymbol(rawName.substring(k + 1));
+                toFill.localpart = fSymbolTable.addSymbol(rawName.substring(k + 1));                
             }
             else {
                 toFill.prefix = XMLSymbols.EMPTY_STRING;
                 toFill.localpart = toFill.rawname;
-            }
+            }            
         }
         else {
             toFill.prefix = (prefix != null) ? fSymbolTable.addSymbol(prefix) : XMLSymbols.EMPTY_STRING;
             toFill.localpart = (localName != null) ? fSymbolTable.addSymbol(localName) : XMLSymbols.EMPTY_STRING;
         }
     }
-
+    
     private void processAttributes(NamedNodeMap attrMap) {
         final int attrCount = attrMap.getLength();
         fAttributes.removeAllAttributes();
@@ -449,7 +450,7 @@
             }
         }
     }
-
+    
     private void sendCharactersToValidator(String str) {
         if (str != null) {
             final int length = str.length();
@@ -467,21 +468,21 @@
             }
         }
     }
-
+    
     Node getCurrentElement() {
         return fCurrentElement;
     }
-
+    
     /**
      * NamespaceContext for the DOMSource, includes context for ancestor nodes.
      */
     final class DOMNamespaceContext implements NamespaceContext {
-
+        
         //
         // Data
         //
 
-        /**
+        /** 
          * Namespace binding information. This array is composed of a
          * series of tuples containing the namespace binding information:
          * &lt;prefix, uri&gt;.
@@ -490,13 +491,13 @@
 
         /** The size of the namespace information array. */
         protected int fNamespaceSize = 0;
-
-        /**
-         * Flag indicating whether the namespace context
+        
+        /** 
+         * Flag indicating whether the namespace context 
          * has been from the root node's ancestors.
          */
         protected boolean fDOMContextBuilt = false;
-
+        
         //
         // Methods
         //
@@ -520,7 +521,7 @@
                     fillNamespaceContext();
                     fDOMContextBuilt = true;
                 }
-                if (fNamespaceSize > 0 &&
+                if (fNamespaceSize > 0 && 
                     !fNamespaceContext.containsPrefix(prefix)) {
                     uri = getURI0(prefix);
                 }
@@ -546,9 +547,9 @@
 
         public void reset() {
             fDOMContextBuilt = false;
-            fNamespaceSize = 0;
+            fNamespaceSize = 0; 
         }
-
+        
         private void fillNamespaceContext() {
             if (fRoot != null) {
                 Node currentNode = fRoot.getParentNode();
@@ -576,14 +577,14 @@
                                 }
                             }
                         }
-
+                        
                     }
                     currentNode = currentNode.getParentNode();
                 }
             }
         }
-
-        private void declarePrefix0(String prefix, String uri) {
+        
+        private void declarePrefix0(String prefix, String uri) {           
             // resize array, if needed
             if (fNamespaceSize == fNamespace.length) {
                 String[] namespacearray = new String[fNamespaceSize * 2];
@@ -595,7 +596,7 @@
             fNamespace[fNamespaceSize++] = prefix;
             fNamespace[fNamespaceSize++] = uri;
         }
-
+        
         private String getURI0(String prefix) {
             // find prefix in the DOM context
             for (int i = 0; i < fNamespaceSize; i += 2) {
@@ -607,5 +608,5 @@
             return null;
         }
     }
-
+    
 } // DOMValidatorHelper
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/StAXValidatorHelper.java	Wed Sep 28 16:49:43 2011 +0100
@@ -48,24 +48,24 @@
  * @author <a href="mailto:Sunitha.Reddy@Sun.com">Sunitha Reddy</a>
  */
 public final class StAXValidatorHelper implements ValidatorHelper {
-
+    
     /** Component manager. **/
     private XMLSchemaValidatorComponentManager fComponentManager;
-
+    
     private Transformer identityTransformer1 = null;
     private TransformerHandler identityTransformer2 = null;
     private ValidatorHandlerImpl handler = null;
-
+    
     /** Creates a new instance of StaxValidatorHelper */
     public StAXValidatorHelper(XMLSchemaValidatorComponentManager componentManager) {
         fComponentManager = componentManager;
     }
-
-    public void validate(Source source, Result result)
+    
+    public void validate(Source source, Result result) 
         throws SAXException, IOException {
-
+        
         if (result == null || result instanceof StAXResult) {
-
+         
             if( identityTransformer1==null ) {
                 try {
                     SAXTransformerFactory tf = (SAXTransformerFactory)SAXTransformerFactory.newInstance();
@@ -77,8 +77,8 @@
                 }
             }
 
+            handler = new ValidatorHandlerImpl(fComponentManager);
             if( result!=null ) {
-                handler = new ValidatorHandlerImpl(fComponentManager);
                 handler.setContentHandler(identityTransformer2);
                 identityTransformer2.setResult(result);
             }
@@ -94,8 +94,8 @@
             }
             return;
         }
-        throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
-                "SourceResultMismatch",
+        throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
+                "SourceResultMismatch", 
                 new Object [] {source.getClass().getName(), result.getClass().getName()}));
     }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorHandlerImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -27,6 +27,7 @@
 import java.util.HashMap;
 import java.util.Locale;
 
+import javax.xml.XMLConstants;
 import javax.xml.parsers.FactoryConfigurationError;
 import javax.xml.parsers.SAXParserFactory;
 import javax.xml.transform.Result;
@@ -89,39 +90,40 @@
  *
  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
  * @author Michael Glavassevich, IBM
- *
+ * 
+ * @version $Id: ValidatorHandlerImpl.java,v 1.6 2009/07/28 23:48:30 joehw Exp $
  */
 final class ValidatorHandlerImpl extends ValidatorHandler implements
     DTDHandler, EntityState, PSVIProvider, ValidatorHelper, XMLDocumentHandler {
-
+    
     // feature identifiers
-
+    
     /** Feature identifier: namespace prefixes. */
     private static final String NAMESPACE_PREFIXES =
         Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACE_PREFIXES_FEATURE;
-
+    
     /** Feature identifier: string interning. */
     protected static final String STRING_INTERNING =
         Constants.SAX_FEATURE_PREFIX + Constants.STRING_INTERNING_FEATURE;
-
+    
     // property identifiers
-
+    
     /** Property identifier: error reporter. */
     private static final String ERROR_REPORTER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
+    
     /** Property identifier: namespace context. */
     private static final String NAMESPACE_CONTEXT =
         Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
-
+    
     /** Property identifier: XML Schema validator. */
     private static final String SCHEMA_VALIDATOR =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_VALIDATOR_PROPERTY;
-
+    
     /** Property identifier: security manager. */
     private static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
-
+    
     /** Property identifier: symbol table. */
     private static final String SYMBOL_TABLE =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
@@ -129,58 +131,58 @@
     /** Property identifier: validation manager. */
     private static final String VALIDATION_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
-
+ 
     //
     // Data
     //
-
+    
     /** Error reporter. */
     private XMLErrorReporter fErrorReporter;
-
+    
     /** The namespace context of this document: stores namespaces in scope */
     private NamespaceContext fNamespaceContext;
-
+    
     /** Schema validator. **/
     private XMLSchemaValidator fSchemaValidator;
-
+    
     /** Symbol table **/
     private SymbolTable fSymbolTable;
-
+    
     /** Validation manager. */
     private ValidationManager fValidationManager;
-
+    
     /** Component manager. **/
     private XMLSchemaValidatorComponentManager fComponentManager;
 
     /** XML Locator wrapper for SAX. **/
     private final SAXLocatorWrapper fSAXLocatorWrapper = new SAXLocatorWrapper();
-
+    
     /** Flag used to track whether the namespace context needs to be pushed. */
     private boolean fNeedPushNSContext = true;
-
+    
     /** Map for tracking unparsed entities. */
     private HashMap fUnparsedEntities = null;
-
+    
     /** Flag used to track whether XML names and Namespace URIs have been internalized. */
     private boolean fStringsInternalized = false;
-
+    
     /** Fields for start element, end element and characters. */
     private final QName fElementQName = new QName();
     private final QName fAttributeQName = new QName();
     private final XMLAttributesImpl fAttributes = new XMLAttributesImpl();
-    private final AttributesProxy fAttrAdapter = new AttributesProxy(fAttributes);
+    private final AttributesProxy fAttrAdapter = new AttributesProxy(fAttributes); 
     private final XMLString fTempString = new XMLString();
-
+    
     //
     // User Objects
     //
-
+    
     private ContentHandler fContentHandler = null;
-
+    
     /*
      * Constructors
      */
-
+    
     public ValidatorHandlerImpl(XSGrammarPoolContainer grammarContainer) {
         this(new XMLSchemaValidatorComponentManager(grammarContainer));
         fComponentManager.addRecognizedFeatures(new String [] {NAMESPACE_PREFIXES});
@@ -188,7 +190,7 @@
         setErrorHandler(null);
         setResourceResolver(null);
     }
-
+    
     public ValidatorHandlerImpl(XMLSchemaValidatorComponentManager componentManager) {
         fComponentManager = componentManager;
         fErrorReporter = (XMLErrorReporter) fComponentManager.getProperty(ERROR_REPORTER);
@@ -201,11 +203,11 @@
     /*
      * ValidatorHandler methods
      */
-
+    
     public void setContentHandler(ContentHandler receiver) {
         fContentHandler = receiver;
     }
-
+    
     public ContentHandler getContentHandler() {
         return fContentHandler;
     }
@@ -229,8 +231,8 @@
     public TypeInfoProvider getTypeInfoProvider() {
         return fTypeInfoProvider;
     }
-
-    public boolean getFeature(String name)
+    
+    public boolean getFeature(String name) 
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
             throw new NullPointerException();
@@ -243,11 +245,11 @@
             final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
                     "feature-not-recognized" : "feature-not-supported";
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     key, new Object [] {identifier}));
         }
     }
-
+    
     public void setFeature(String name, boolean value)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -258,14 +260,24 @@
         }
         catch (XMLConfigurationException e) {
             final String identifier = e.getIdentifier();
-            final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
-                    "feature-not-recognized" : "feature-not-supported";
+            final short type = e.getType();
+            final String key;
+            if (type == XMLConfigurationException.NOT_ALLOWED) {
+                //for now, the identifier can only be (XMLConstants.FEATURE_SECURE_PROCESSING)
+                throw new SAXNotSupportedException(
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
+                    "jaxp-secureprocessing-feature", null));                    
+            } else if (type == XMLConfigurationException.NOT_RECOGNIZED) {
+                key = "feature-not-recognized";
+            } else {
+                key = "feature-not-supported";
+            }
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
-                    key, new Object [] {identifier}));
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
+                    key, new Object [] {identifier}));    
         }
     }
-
+    
     public Object getProperty(String name)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -279,11 +291,11 @@
             final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
                     "property-not-recognized" : "property-not-supported";
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     key, new Object [] {identifier}));
         }
     }
-
+    
     public void setProperty(String name, Object object)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -297,15 +309,15 @@
             final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
                     "property-not-recognized" : "property-not-supported";
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     key, new Object [] {identifier}));
         }
     }
-
+    
     /*
      * EntityState methods
      */
-
+    
     public boolean isEntityDeclared(String name) {
         return false;
     }
@@ -316,7 +328,7 @@
         }
         return false;
     }
-
+    
     /*
      * XMLDocumentHandler methods
      */
@@ -359,7 +371,7 @@
         if (fContentHandler != null) {
             try {
                 fTypeInfoProvider.beginStartElement(augs, attributes);
-                fContentHandler.startElement((element.uri != null) ? element.uri : XMLSymbols.EMPTY_STRING,
+                fContentHandler.startElement((element.uri != null) ? element.uri : XMLSymbols.EMPTY_STRING, 
                         element.localpart, element.rawname, fAttrAdapter);
             }
             catch (SAXException e) {
@@ -455,7 +467,7 @@
     public XMLDocumentSource getDocumentSource() {
         return fSchemaValidator;
     }
-
+    
     /*
      * ContentHandler methods
      */
@@ -536,10 +548,10 @@
             fNamespaceContext.pushContext();
         }
         fNeedPushNSContext = true;
-
+        
         // Fill element QName
         fillQName(fElementQName, uri, localName, qName);
-
+        
         // Fill XMLAttributes
         if (atts instanceof Attributes2) {
             fillXMLAttributes2((Attributes2) atts);
@@ -547,7 +559,7 @@
         else {
             fillXMLAttributes(atts);
         }
-
+        
         try {
             fSchemaValidator.startElement(fElementQName, fAttributes, null);
         }
@@ -606,10 +618,10 @@
 
     public void processingInstruction(String target, String data)
             throws SAXException {
-        /**
+        /** 
          * Processing instructions do not participate in schema validation,
          * so just forward the event to the application's content
-         * handler.
+         * handler. 
          */
         if (fContentHandler != null) {
             fContentHandler.processingInstruction(target, data);
@@ -623,36 +635,36 @@
             fContentHandler.skippedEntity(name);
         }
     }
-
+    
     /*
      * DTDHandler methods
      */
-
-    public void notationDecl(String name, String publicId,
+    
+    public void notationDecl(String name, String publicId, 
             String systemId) throws SAXException {}
 
-    public void unparsedEntityDecl(String name, String publicId,
+    public void unparsedEntityDecl(String name, String publicId, 
             String systemId, String notationName) throws SAXException {
         if (fUnparsedEntities == null) {
             fUnparsedEntities = new HashMap();
         }
         fUnparsedEntities.put(name, name);
     }
-
+    
     /*
      * ValidatorHelper methods
      */
-
-    public void validate(Source source, Result result)
+    
+    public void validate(Source source, Result result) 
         throws SAXException, IOException {
         if (result instanceof SAXResult || result == null) {
             final SAXSource saxSource = (SAXSource) source;
             final SAXResult saxResult = (SAXResult) result;
-
+            
             if (result != null) {
                 setContentHandler(saxResult.getHandler());
             }
-
+            
             try {
                 XMLReader reader = saxSource.getXMLReader();
                 if( reader==null ) {
@@ -677,7 +689,7 @@
                         throw new FactoryConfigurationError(e);
                     }
                 }
-
+                
                 // If XML names and Namespace URIs are already internalized we
                 // can avoid running them through the SymbolTable.
                 try {
@@ -688,50 +700,50 @@
                     // In either case, assume that strings are not internalized.
                     fStringsInternalized = false;
                 }
-
+                
                 ErrorHandler errorHandler = fComponentManager.getErrorHandler();
                 reader.setErrorHandler(errorHandler != null ? errorHandler : DraconianErrorHandler.getInstance());
                 reader.setEntityResolver(fResolutionForwarder);
                 fResolutionForwarder.setEntityResolver(fComponentManager.getResourceResolver());
                 reader.setContentHandler(this);
                 reader.setDTDHandler(this);
-
+                
                 InputSource is = saxSource.getInputSource();
                 reader.parse(is);
-            }
+            } 
             finally {
                 // release the reference to user's handler ASAP
                 setContentHandler(null);
             }
             return;
         }
-        throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
-                "SourceResultMismatch",
+        throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
+                "SourceResultMismatch", 
                 new Object [] {source.getClass().getName(), result.getClass().getName()}));
     }
-
+    
     /*
      * PSVIProvider methods
      */
-
+    
     public ElementPSVI getElementPSVI() {
         return fTypeInfoProvider.getElementPSVI();
     }
-
+    
     public AttributePSVI getAttributePSVI(int index) {
         return fTypeInfoProvider.getAttributePSVI(index);
     }
-
+    
     public AttributePSVI getAttributePSVIByName(String uri, String localname) {
         return fTypeInfoProvider.getAttributePSVIByName(uri, localname);
     }
-
+ 
     //
     //
     // helper methods
     //
     //
-
+    
     /** Fills in a QName object. */
     private void fillQName(QName toFill, String uri, String localpart, String raw) {
         if (!fStringsInternalized) {
@@ -757,7 +769,7 @@
         }
         toFill.setValues(prefix, localpart, raw, uri);
     }
-
+    
     /** Fills in the XMLAttributes object. */
     private void fillXMLAttributes(Attributes att) {
         fAttributes.removeAllAttributes();
@@ -767,7 +779,7 @@
             fAttributes.setSpecified(i, true);
         }
     }
-
+    
     /** Fills in the XMLAttributes object. */
     private void fillXMLAttributes2(Attributes2 att) {
         fAttributes.removeAllAttributes();
@@ -780,14 +792,14 @@
             }
         }
     }
-
+    
     /** Adds an attribute to the XMLAttributes object. */
     private void fillXMLAttribute(Attributes att, int index) {
         fillQName(fAttributeQName, att.getURI(index), att.getLocalName(index), att.getQName(index));
         String type = att.getType(index);
         fAttributes.addAttributeNS(fAttributeQName, (type != null) ? type : XMLSymbols.fCDATASymbol, att.getValue(index));
     }
-
+    
     /**
      * {@link TypeInfoProvider} implementation.
      *
@@ -795,45 +807,45 @@
      */
     private final XMLSchemaTypeInfoProvider fTypeInfoProvider = new XMLSchemaTypeInfoProvider();
     private static class XMLSchemaTypeInfoProvider extends TypeInfoProvider {
-
+        
         /** Element augmentations: contains ElementPSVI. **/
         private Augmentations fElementAugs;
-
+        
         /** Attributes: augmentations for each attribute contain AttributePSVI. **/
         private XMLAttributes fAttributes;
-
+        
         /** In start element. **/
         private boolean fInStartElement = false;
-
+        
         /** In end element. **/
         private boolean fInEndElement = false;
-
+        
         /** Initializes the TypeInfoProvider with type information for the current element. **/
         void beginStartElement(Augmentations elementAugs, XMLAttributes attributes) {
             fInStartElement = true;
             fElementAugs = elementAugs;
             fAttributes = attributes;
         }
-
+        
         /** Cleanup at the end of start element. **/
         void finishStartElement() {
             fInStartElement = false;
             fElementAugs = null;
             fAttributes = null;
         }
-
+        
         /** Initializes the TypeInfoProvider with type information for the current element. **/
         void beginEndElement(Augmentations elementAugs) {
             fInEndElement = true;
             fElementAugs = elementAugs;
         }
-
+        
         /** Cleanup at the end of end element. **/
         void finishEndElement() {
             fInEndElement = false;
             fElementAugs = null;
         }
-
+        
         /**
          * Throws a {@link IllegalStateException} if we are not in
          * the startElement callback. the JAXP API requires this
@@ -841,16 +853,16 @@
          */
         private void checkState(boolean forElementInfo) {
             if (! (fInStartElement || (fInEndElement && forElementInfo))) {
-                throw new IllegalStateException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                throw new IllegalStateException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                         "TypeInfoProviderIllegalState", null));
             }
         }
-
+        
         public TypeInfo getAttributeTypeInfo(int index) {
             checkState(false);
             return getAttributeType(index);
         }
-
+        
         private TypeInfo getAttributeType( int index ) {
             checkState(false);
             if( index<0 || fAttributes.getLength()<=index )
@@ -860,27 +872,27 @@
             AttributePSVI psvi = (AttributePSVI)augs.getItem(Constants.ATTRIBUTE_PSVI);
             return getTypeInfoFromPSVI(psvi);
         }
-
+        
         public TypeInfo getAttributeTypeInfo(String attributeUri, String attributeLocalName) {
             checkState(false);
             return getAttributeTypeInfo(fAttributes.getIndex(attributeUri,attributeLocalName));
         }
-
+        
         public TypeInfo getAttributeTypeInfo(String attributeQName) {
             checkState(false);
             return getAttributeTypeInfo(fAttributes.getIndex(attributeQName));
         }
-
+        
         public TypeInfo getElementTypeInfo() {
             checkState(true);
             if (fElementAugs == null) return null;
             ElementPSVI psvi = (ElementPSVI)fElementAugs.getItem(Constants.ELEMENT_PSVI);
             return getTypeInfoFromPSVI(psvi);
         }
-
+        
         private TypeInfo getTypeInfoFromPSVI( ItemPSVI psvi ) {
             if(psvi==null)  return null;
-
+            
             // TODO: make sure if this is correct.
             // TODO: since the number of types in a schema is quite limited,
             // TypeInfoImpl should be pooled. Even better, it should be a part
@@ -891,36 +903,36 @@
                     return (t instanceof TypeInfo) ? (TypeInfo) t : null;
                 }
             }
-
+            
             XSTypeDefinition t = psvi.getTypeDefinition();
             // TODO: can t be null?
             if (t != null) {
-                return (t instanceof TypeInfo) ? (TypeInfo) t : null;
+                return (t instanceof TypeInfo) ? (TypeInfo) t : null; 
             }
             return null;
         }
-
+        
         public boolean isIdAttribute(int index) {
             checkState(false);
             XSSimpleType type = (XSSimpleType)getAttributeType(index);
             if(type==null)  return false;
             return type.isIDType();
         }
-
+        
         public boolean isSpecified(int index) {
             checkState(false);
             return fAttributes.isSpecified(index);
         }
-
+        
         /*
          * Other methods
          */
-
+        
         // PSVIProvider support
         ElementPSVI getElementPSVI() {
             return (fElementAugs != null) ? (ElementPSVI) fElementAugs.getItem(Constants.ELEMENT_PSVI) : null;
         }
-
+        
         AttributePSVI getAttributePSVI(int index) {
             if (fAttributes != null) {
                 Augmentations augs = fAttributes.getAugmentations(index);
@@ -930,7 +942,7 @@
             }
             return null;
         }
-
+        
         AttributePSVI getAttributePSVIByName(String uri, String localname) {
             if (fAttributes != null) {
                 Augmentations augs = fAttributes.getAugmentations(uri, localname);
@@ -941,12 +953,12 @@
             return null;
         }
     }
-
+    
     /** SAX adapter for an LSResourceResolver. */
     private final ResolutionForwarder fResolutionForwarder = new ResolutionForwarder(null);
-    static final class ResolutionForwarder
+    static final class ResolutionForwarder 
         implements EntityResolver2 {
-
+        
         //
         // Data
         //
@@ -968,7 +980,7 @@
         public ResolutionForwarder(LSResourceResolver entityResolver) {
             setEntityResolver(entityResolver);
         }
-
+        
         //
         // Public methods
         //
@@ -995,7 +1007,7 @@
          * Resolves the given resource and adapts the <code>LSInput</code>
          * returned into an <code>InputSource</code>.
          */
-        public InputSource resolveEntity(String name, String publicId,
+        public InputSource resolveEntity(String name, String publicId, 
                 String baseURI, String systemId) throws SAXException, IOException {
             if (fEntityResolver != null) {
                 LSInput lsInput = fEntityResolver.resolveResource(XML_TYPE, null, publicId, systemId, baseURI);
@@ -1018,7 +1030,7 @@
                     InputSource inputSource = new InputSource();
                     inputSource.setPublicId(pubId);
                     inputSource.setSystemId((baseSystemId != null) ? resolveSystemId(systemId, baseSystemId) : systemId);
-
+                    
                     if (charStream != null) {
                         inputSource.setCharacterStream(charStream);
                     }
@@ -1034,13 +1046,13 @@
             }
             return null;
         }
-
+        
         /** Delegates to EntityResolver2.resolveEntity(String, String, String, String). */
         public InputSource resolveEntity(String publicId, String systemId)
                 throws SAXException, IOException {
             return resolveEntity(null, publicId, null, systemId);
         }
-
+        
         /** Resolves a system identifier against a base URI. */
         private String resolveSystemId(String systemId, String baseURI) {
             try {
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/ValidatorImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,6 +23,7 @@
 import java.io.IOException;
 import java.util.Locale;
 
+import javax.xml.XMLConstants;
 import javax.xml.transform.Result;
 import javax.xml.transform.Source;
 import javax.xml.transform.dom.DOMSource;
@@ -32,6 +33,7 @@
 import javax.xml.transform.stream.StreamSource;
 import javax.xml.validation.Validator;
 
+import com.sun.org.apache.xerces.internal.impl.Constants;
 import com.sun.org.apache.xerces.internal.util.SAXMessageFormatter;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException;
 import com.sun.org.apache.xerces.internal.xs.AttributePSVI;
@@ -49,37 +51,41 @@
  * @author <a href="mailto:Kohsuke.Kawaguchi@Sun.com">Kohsuke Kawaguchi</a>
  * @author Michael Glavassevich, IBM
  * @author <a href="mailto:Sunitha.Reddy@Sun.com">Sunitha Reddy</a>
+ * @version $Id: ValidatorImpl.java,v 1.7 2009/07/28 23:48:30 joehw Exp $
  */
 final class ValidatorImpl extends Validator implements PSVIProvider {
-
+    
     //
     // Data
     //
-
+    
     /** Component manager. **/
     private XMLSchemaValidatorComponentManager fComponentManager;
-
+    
     /** SAX validator helper. **/
     private ValidatorHandlerImpl fSAXValidatorHelper;
-
+    
     /** DOM validator helper. **/
     private DOMValidatorHelper fDOMValidatorHelper;
-
+    
     /** Stream validator helper. **/
     private StreamValidatorHelper fStreamValidatorHelper;
-
+    
     /** StAX validator helper. **/
     private StAXValidatorHelper fStaxValidatorHelper;
-
+    
     /** Flag for tracking whether features/properties changed since last reset. */
     private boolean fConfigurationChanged = false;
-
+    
     /** Flag for tracking whether the error handler changed since last reset. */
     private boolean fErrorHandlerChanged = false;
-
+    
     /** Flag for tracking whether the resource resolver changed since last reset. */
     private boolean fResourceResolverChanged = false;
-
+    
+    /** Support current-element-node property */
+    private static final String CURRENT_ELEMENT_NODE = Constants.XERCES_PROPERTY_PREFIX + Constants.CURRENT_ELEMENT_NODE_PROPERTY;
+    
     public ValidatorImpl(XSGrammarPoolContainer grammarContainer) {
         fComponentManager = new XMLSchemaValidatorComponentManager(grammarContainer);
         setErrorHandler(null);
@@ -118,12 +124,12 @@
         }
         // Source parameter cannot be null.
         else if (source == null) {
-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "SourceParameterNull", null));
         }
         // Source parameter must be a SAXSource, DOMSource or StreamSource
         else {
-            throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "SourceNotAccepted", new Object [] {source.getClass().getName()}));
         }
     }
@@ -145,8 +151,8 @@
     public LSResourceResolver getResourceResolver() {
         return fComponentManager.getResourceResolver();
     }
-
-    public boolean getFeature(String name)
+    
+    public boolean getFeature(String name) 
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
             throw new NullPointerException();
@@ -159,11 +165,11 @@
             final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
                     "feature-not-recognized" : "feature-not-supported";
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     key, new Object [] {identifier}));
         }
     }
-
+    
     public void setFeature(String name, boolean value)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -174,20 +180,34 @@
         }
         catch (XMLConfigurationException e) {
             final String identifier = e.getIdentifier();
-            final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
-                    "feature-not-recognized" : "feature-not-supported";
+            final short type = e.getType();
+            final String key;
+            if (type == XMLConfigurationException.NOT_ALLOWED) {
+                //for now, the identifier can only be (XMLConstants.FEATURE_SECURE_PROCESSING)
+                throw new SAXNotSupportedException(
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
+                    "jaxp-secureprocessing-feature", null));                    
+            } else if (type == XMLConfigurationException.NOT_RECOGNIZED) {
+                key = "feature-not-recognized";
+            } else {
+                key = "feature-not-supported";
+            }
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
-                    key, new Object [] {identifier}));
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
+                    key, new Object [] {identifier}));            
         }
         fConfigurationChanged = true;
     }
-
+    
     public Object getProperty(String name)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
             throw new NullPointerException();
         }
+        //Support current-element-node; return current node if DOMSource is used.
+        if (CURRENT_ELEMENT_NODE.equals(name)) { 
+            return (fDOMValidatorHelper != null) ? fDOMValidatorHelper.getCurrentElement() : null; 
+        } 
         try {
             return fComponentManager.getProperty(name);
         }
@@ -196,11 +216,11 @@
             final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
                     "property-not-recognized" : "property-not-supported";
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     key, new Object [] {identifier}));
         }
     }
-
+    
     public void setProperty(String name, Object object)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
@@ -214,12 +234,12 @@
             final String key = e.getType() == XMLConfigurationException.NOT_RECOGNIZED ?
                     "property-not-recognized" : "property-not-supported";
             throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     key, new Object [] {identifier}));
         }
         fConfigurationChanged = true;
     }
-
+    
     public void reset() {
         // avoid resetting features and properties if the state the validator
         // is currently in, is the same as it will be after reset.
@@ -242,21 +262,21 @@
             }
         }
     }
-
+    
     /*
      * PSVIProvider methods
      */
-
+    
     public ElementPSVI getElementPSVI() {
         return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getElementPSVI() : null;
     }
-
+    
     public AttributePSVI getAttributePSVI(int index) {
         return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getAttributePSVI(index) : null;
     }
-
+    
     public AttributePSVI getAttributePSVIByName(String uri, String localname) {
         return (fSAXValidatorHelper != null) ? fSAXValidatorHelper.getAttributePSVIByName(uri, localname) : null;
     }
-
+    
 } // ValidatorImpl
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -61,48 +61,49 @@
  * {@link SchemaFactory} for XML Schema.
  *
  * @author Kohsuke Kawaguchi (kohsuke.kawaguchi@sun.com)
+ * @version $Id: XMLSchemaFactory.java,v 1.5 2009/07/28 23:48:30 joehw Exp $
  */
 public final class XMLSchemaFactory extends SchemaFactory {
-
+    
     // property identifiers
-
+    
     /** Feature identifier: schema full checking. */
     private static final String SCHEMA_FULL_CHECKING =
         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING;
-
+    
     /** Property identifier: grammar pool. */
     private static final String XMLGRAMMAR_POOL =
         Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
-
+    
     /** Property identifier: SecurityManager. */
     private static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
-
+    
     //
     // Data
     //
-
+    
     /** The XMLSchemaLoader */
     private final XMLSchemaLoader fXMLSchemaLoader = new XMLSchemaLoader();
-
+    
     /** User-specified ErrorHandler; can be null. */
     private ErrorHandler fErrorHandler;
-
+    
     /** The LSResrouceResolver */
     private LSResourceResolver fLSResourceResolver;
-
+    
     /** The DOMEntityResolverWrapper */
     private final DOMEntityResolverWrapper fDOMEntityResolverWrapper;
-
+    
     /** The ErrorHandlerWrapper */
     private ErrorHandlerWrapper fErrorHandlerWrapper;
-
+    
     /** The SecurityManager. */
     private SecurityManager fSecurityManager;
-
-    /** The container for the real grammar pool. */
+    
+    /** The container for the real grammar pool. */ 
     private XMLGrammarPoolWrapper fXMLGrammarPoolWrapper;
-
+    
     public XMLSchemaFactory() {
         fErrorHandlerWrapper = new ErrorHandlerWrapper(DraconianErrorHandler.getInstance());
         fDOMEntityResolverWrapper = new DOMEntityResolverWrapper();
@@ -116,7 +117,7 @@
         fSecurityManager = new SecurityManager();
         fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
     }
-
+    
     /**
      * <p>Is specified schema supported by this <code>SchemaFactory</code>?</p>
      *
@@ -131,43 +132,43 @@
      */
     public boolean isSchemaLanguageSupported(String schemaLanguage) {
         if (schemaLanguage == null) {
-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "SchemaLanguageNull", null));
         }
         if (schemaLanguage.length() == 0) {
-            throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "SchemaLanguageLengthZero", null));
         }
-        // only W3C XML Schema 1.0 is supported
+        // only W3C XML Schema 1.0 is supported 
         return schemaLanguage.equals(XMLConstants.W3C_XML_SCHEMA_NS_URI);
     }
-
+    
     public LSResourceResolver getResourceResolver() {
         return fLSResourceResolver;
     }
-
+    
     public void setResourceResolver(LSResourceResolver resourceResolver) {
         fLSResourceResolver = resourceResolver;
         fDOMEntityResolverWrapper.setEntityResolver(resourceResolver);
         fXMLSchemaLoader.setEntityResolver(fDOMEntityResolverWrapper);
     }
-
+    
     public ErrorHandler getErrorHandler() {
         return fErrorHandler;
     }
-
+    
     public void setErrorHandler(ErrorHandler errorHandler) {
         fErrorHandler = errorHandler;
         fErrorHandlerWrapper.setErrorHandler(errorHandler != null ? errorHandler : DraconianErrorHandler.getInstance());
         fXMLSchemaLoader.setErrorHandler(fErrorHandlerWrapper);
-    }
-
+    }  
+    
     public Schema newSchema( Source[] schemas ) throws SAXException {
-
+        
         // this will let the loader store parsed Grammars into the pool.
         XMLGrammarPoolImplExtension pool = new XMLGrammarPoolImplExtension();
         fXMLGrammarPoolWrapper.setGrammarPool(pool);
-
+        
         XMLInputSource[] xmlInputSources = new XMLInputSource[schemas.length];
         InputStream inputStream;
         Reader reader;
@@ -187,7 +188,7 @@
                 SAXSource saxSource = (SAXSource) source;
                 InputSource inputSource = saxSource.getInputSource();
                 if (inputSource == null) {
-                    throw new SAXException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                    throw new SAXException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                             "SAXSourceNullInputSource", null));
                 }
                 xmlInputSources[i] = new SAXInputSource(saxSource.getXMLReader(), inputSource);
@@ -195,37 +196,37 @@
             else if (source instanceof DOMSource) {
                 DOMSource domSource = (DOMSource) source;
                 Node node = domSource.getNode();
-                String systemID = domSource.getSystemId();
+                String systemID = domSource.getSystemId();          
                 xmlInputSources[i] = new DOMInputSource(node, systemID);
             }
             else if (source == null) {
-                throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+                throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                         "SchemaSourceArrayMemberNull", null));
             }
             else {
-                throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
-                        "SchemaFactorySourceUnrecognized",
+                throw new IllegalArgumentException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
+                        "SchemaFactorySourceUnrecognized", 
                         new Object [] {source.getClass().getName()}));
             }
         }
-
+        
         try {
             fXMLSchemaLoader.loadGrammar(xmlInputSources);
-        }
+        } 
         catch (XNIException e) {
             // this should have been reported to users already.
             throw Util.toSAXException(e);
-        }
+        } 
         catch (IOException e) {
             // this hasn't been reported, so do so now.
             SAXParseException se = new SAXParseException(e.getMessage(),null,e);
             fErrorHandler.error(se);
             throw se; // and we must throw it.
         }
-
+        
         // Clear reference to grammar pool.
         fXMLGrammarPoolWrapper.setGrammarPool(null);
-
+        
         // Select Schema implementation based on grammar count.
         final int grammarCount = pool.getGrammarCount();
         if (grammarCount > 1) {
@@ -239,16 +240,16 @@
             return EmptyXMLSchema.getInstance();
         }
     }
-
+    
     public Schema newSchema() throws SAXException {
         // Use a Schema that uses the system id as the equality source.
         return new WeakReferenceXMLSchema();
     }
-
-    public boolean getFeature(String name)
+    
+    public boolean getFeature(String name) 
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "FeatureNameNull", null));
         }
         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
@@ -261,21 +262,21 @@
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "feature-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "feature-not-supported", new Object [] {identifier}));
             }
         }
     }
-
-    public Object getProperty(String name)
+    
+    public Object getProperty(String name) 
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "ProperyNameNull", null));
         }
         if (name.equals(SECURITY_MANAGER)) {
@@ -283,7 +284,7 @@
         }
         else if (name.equals(XMLGRAMMAR_POOL)) {
             throw new SAXNotSupportedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     "property-not-supported", new Object [] {name}));
         }
         try {
@@ -293,24 +294,29 @@
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "property-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "property-not-supported", new Object [] {identifier}));
             }
         }
     }
-
+    
     public void setFeature(String name, boolean value)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "FeatureNameNull", null));
         }
         if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+            if (System.getSecurityManager() != null && (!value)) {
+                throw new SAXNotSupportedException(
+                        SAXMessageFormatter.formatMessage(null, 
+                        "jaxp-secureprocessing-feature", null));
+            }
             fSecurityManager = value ? new SecurityManager() : null;
             fXMLSchemaLoader.setProperty(SECURITY_MANAGER, fSecurityManager);
             return;
@@ -322,21 +328,21 @@
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "feature-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "feature-not-supported", new Object [] {identifier}));
             }
         }
     }
-
+    
     public void setProperty(String name, Object object)
         throws SAXNotRecognizedException, SAXNotSupportedException {
         if (name == null) {
-            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(),
+            throw new NullPointerException(JAXPValidationMessageFormatter.formatMessage(Locale.getDefault(), 
                     "ProperyNameNull", null));
         }
         if (name.equals(SECURITY_MANAGER)) {
@@ -346,7 +352,7 @@
         }
         else if (name.equals(XMLGRAMMAR_POOL)) {
             throw new SAXNotSupportedException(
-                    SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                    SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                     "property-not-supported", new Object [] {name}));
         }
         try {
@@ -356,23 +362,23 @@
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "property-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                        SAXMessageFormatter.formatMessage(Locale.getDefault(),
+                        SAXMessageFormatter.formatMessage(Locale.getDefault(), 
                         "property-not-supported", new Object [] {identifier}));
             }
         }
     }
-
-    /**
+    
+    /** 
      * Extension of XMLGrammarPoolImpl which exposes the number of
      * grammars stored in the grammar pool.
      */
     static class XMLGrammarPoolImplExtension extends XMLGrammarPoolImpl {
-
+        
         /** Constructs a grammar pool with a default number of buckets. */
         public XMLGrammarPoolImplExtension() {
             super();
@@ -382,25 +388,25 @@
         public XMLGrammarPoolImplExtension(int initialCapacity) {
             super(initialCapacity);
         }
-
+        
         /** Returns the number of grammars contained in this pool. */
         int getGrammarCount() {
             return fGrammarCount;
         }
-
+        
     } // XMLSchemaFactory.XMLGrammarPoolImplExtension
-
+    
     /**
      * A grammar pool which wraps another.
      */
     static class XMLGrammarPoolWrapper implements XMLGrammarPool {
 
         private XMLGrammarPool fGrammarPool;
-
+        
         /*
          * XMLGrammarPool methods
          */
-
+        
         public Grammar[] retrieveInitialGrammarSet(String grammarType) {
             return fGrammarPool.retrieveInitialGrammarSet(grammarType);
         }
@@ -424,19 +430,19 @@
         public void clear() {
             fGrammarPool.clear();
         }
-
+        
         /*
          * Other methods
          */
-
+        
         void setGrammarPool(XMLGrammarPool grammarPool) {
             fGrammarPool = grammarPool;
         }
-
+        
         XMLGrammarPool getGrammarPool() {
             return fGrammarPool;
         }
-
+        
     } // XMLSchemaFactory.XMLGrammarPoolWrapper
-
+    
 } // XMLSchemaFactory
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/jaxp/validation/XMLSchemaValidatorComponentManager.java	Wed Sep 28 16:49:43 2011 +0100
@@ -46,159 +46,174 @@
 
 /**
  * <p>An implementation of XMLComponentManager for a schema validator.</p>
- *
+ * 
  * @author Michael Glavassevich, IBM
+ * @version $Id: XMLSchemaValidatorComponentManager.java,v 1.5 2009/07/28 23:48:30 joehw Exp $
  */
 final class XMLSchemaValidatorComponentManager extends ParserConfigurationSettings implements
         XMLComponentManager {
-
+    
     // feature identifiers
-
+    
     /** Feature identifier: schema validation. */
     private static final String SCHEMA_VALIDATION =
         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_VALIDATION_FEATURE;
-
+    
     /** Feature identifier: validation. */
     private static final String VALIDATION =
         Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
 
+    /** Feature identifier: send element default value via characters() */
+    private static final String SCHEMA_ELEMENT_DEFAULT =
+        Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_ELEMENT_DEFAULT;
+    
     /** Feature identifier: use grammar pool only. */
     private static final String USE_GRAMMAR_POOL_ONLY =
         Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
-
+    
     // property identifiers
 
     /** Property identifier: entity manager. */
     private static final String ENTITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_MANAGER_PROPERTY;
-
+    
     /** Property identifier: entity resolver. */
     private static final String ENTITY_RESOLVER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
-
+    
     /** Property identifier: error handler. */
-    private static final String ERROR_HANDLER =
+    private static final String ERROR_HANDLER = 
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
-
+    
     /** Property identifier: error reporter. */
     private static final String ERROR_REPORTER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_REPORTER_PROPERTY;
-
+    
     /** Property identifier: namespace context. */
     private static final String NAMESPACE_CONTEXT =
         Constants.XERCES_PROPERTY_PREFIX + Constants.NAMESPACE_CONTEXT_PROPERTY;
-
+    
     /** Property identifier: XML Schema validator. */
     private static final String SCHEMA_VALIDATOR =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SCHEMA_VALIDATOR_PROPERTY;
-
+    
     /** Property identifier: security manager. */
     private static final String SECURITY_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SECURITY_MANAGER_PROPERTY;
-
+    
     /** Property identifier: symbol table. */
     private static final String SYMBOL_TABLE =
         Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
-
+    
     /** Property identifier: validation manager. */
     private static final String VALIDATION_MANAGER =
         Constants.XERCES_PROPERTY_PREFIX + Constants.VALIDATION_MANAGER_PROPERTY;
-
+    
     /** Property identifier: grammar pool. */
     private static final String XMLGRAMMAR_POOL =
         Constants.XERCES_PROPERTY_PREFIX + Constants.XMLGRAMMAR_POOL_PROPERTY;
-
+    
     //
     // Data
     //
-
     /**
-     * fConfigUpdated is set to true if there has been any change to the configuration settings,
+     * <p>State of secure mode.</p>
+     */
+    private boolean _isSecureMode = false;
+    
+    /** 
+     * fConfigUpdated is set to true if there has been any change to the configuration settings, 
      * i.e a feature or a property was changed.
      */
     private boolean fConfigUpdated = true;
-
-    /**
-     * Tracks whether the validator should use components from
+    
+    /** 
+     * Tracks whether the validator should use components from 
      * the grammar pool to the exclusion of all others.
      */
     private boolean fUseGrammarPoolOnly;
-
+    
     /** Lookup map for components required for validation. **/
     private final HashMap fComponents = new HashMap();
-
+    
     //
     // Components
     //
-
+    
     /** Entity manager. */
     private XMLEntityManager fEntityManager;
-
+    
     /** Error reporter. */
     private XMLErrorReporter fErrorReporter;
-
+    
     /** Namespace context. */
     private NamespaceContext fNamespaceContext;
-
+    
     /** XML Schema validator. */
     private XMLSchemaValidator fSchemaValidator;
-
+       
     /** Validation manager. */
     private ValidationManager fValidationManager;
-
+    
     //
     // User Objects
     //
-
+    
     /** Application's ErrorHandler. **/
     private ErrorHandler fErrorHandler = null;
-
+    
     /** Application's LSResourceResolver. */
     private LSResourceResolver fResourceResolver = null;
-
+    
     /** Constructs a component manager suitable for Xerces' schema validator. */
     public XMLSchemaValidatorComponentManager(XSGrammarPoolContainer grammarContainer) {
-        // setup components
+        // setup components 
         fEntityManager = new XMLEntityManager();
         fComponents.put(ENTITY_MANAGER, fEntityManager);
-
+        
         fErrorReporter = new XMLErrorReporter();
         fComponents.put(ERROR_REPORTER, fErrorReporter);
-
+        
         fNamespaceContext = new NamespaceSupport();
         fComponents.put(NAMESPACE_CONTEXT, fNamespaceContext);
-
+        
         fSchemaValidator = new XMLSchemaValidator();
         fComponents.put(SCHEMA_VALIDATOR, fSchemaValidator);
-
+        
         fValidationManager = new ValidationManager();
         fComponents.put(VALIDATION_MANAGER, fValidationManager);
-
+        
         // setup other properties
         fComponents.put(ENTITY_RESOLVER, null);
         fComponents.put(ERROR_HANDLER, null);
-        fComponents.put(SECURITY_MANAGER, null);
+
+        if (System.getSecurityManager() != null) {
+            _isSecureMode = true;
+            setProperty(SECURITY_MANAGER, new SecurityManager());
+        } else {        
+            fComponents.put(SECURITY_MANAGER, null);
+        }
         fComponents.put(SYMBOL_TABLE, new SymbolTable());
-
+        
         // setup grammar pool
         fComponents.put(XMLGRAMMAR_POOL, grammarContainer.getGrammarPool());
         fUseGrammarPoolOnly = grammarContainer.isFullyComposed();
-
+        
         // add schema message formatter to error reporter
         fErrorReporter.putMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN, new XSMessageFormatter());
-
+        
         // add all recognized features and properties and apply their defaults
         addRecognizedParamsAndSetDefaults(fEntityManager);
         addRecognizedParamsAndSetDefaults(fErrorReporter);
-        addRecognizedParamsAndSetDefaults(fSchemaValidator);
+        addRecognizedParamsAndSetDefaults(fSchemaValidator); 
     }
 
     /**
      * Returns the state of a feature.
-     *
+     * 
      * @param featureId The feature identifier.
      * @return true if the feature is supported
-     *
+     * 
      * @throws XMLConfigurationException Thrown for configuration error.
      *                                   In general, components should
      *                                   only throw this exception if
@@ -219,9 +234,12 @@
         else if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
             return getProperty(SECURITY_MANAGER) != null;
         }
+        else if (SCHEMA_ELEMENT_DEFAULT.equals(featureId)) {
+            return true; //pre-condition: VALIDATION and SCHEMA_VALIDATION are always true
+        }
         return super.getFeature(featureId);
     }
-
+    
     /**
      * Set the state of a feature.
      *
@@ -242,6 +260,9 @@
         }
         fConfigUpdated = true;
         if (XMLConstants.FEATURE_SECURE_PROCESSING.equals(featureId)) {
+            if (_isSecureMode && !value) {
+                throw new XMLConfigurationException(XMLConfigurationException.NOT_ALLOWED, XMLConstants.FEATURE_SECURE_PROCESSING);
+            }
             setProperty(SECURITY_MANAGER, value ? new SecurityManager() : null);
             return;
         }
@@ -250,13 +271,13 @@
         fSchemaValidator.setFeature(featureId, value);
         super.setFeature(featureId, value);
     }
-
+    
     /**
      * Returns the value of a property.
-     *
+     * 
      * @param propertyId The property identifier.
      * @return the value of the property
-     *
+     * 
      * @throws XMLConfigurationException Thrown for configuration error.
      *                                   In general, components should
      *                                   only throw this exception if
@@ -274,13 +295,13 @@
         }
         return super.getProperty(propertyId);
     }
-
+    
     /**
      * Sets the state of a property.
-     *
+     * 
      * @param propertyId The unique identifier (URI) of the property.
      * @param value The requested state of the property.
-     *
+     * 
      * @exception XMLConfigurationException If the requested property is not known.
      */
     public void setProperty(String propertyId, Object value) throws XMLConfigurationException {
@@ -294,14 +315,14 @@
         fEntityManager.setProperty(propertyId, value);
         fErrorReporter.setProperty(propertyId, value);
         fSchemaValidator.setProperty(propertyId, value);
-        if (ENTITY_RESOLVER.equals(propertyId) || ERROR_HANDLER.equals(propertyId) ||
+        if (ENTITY_RESOLVER.equals(propertyId) || ERROR_HANDLER.equals(propertyId) || 
                 SECURITY_MANAGER.equals(propertyId)) {
             fComponents.put(propertyId, value);
             return;
         }
         super.setProperty(propertyId, value);
     }
-
+    
     /**
      * Adds all of the component's recognized features and properties
      * to the list of default recognized features and properties, and
@@ -312,11 +333,11 @@
      * and properties will be added to the configuration
      */
     public void addRecognizedParamsAndSetDefaults(XMLComponent component) {
-
+        
         // register component's recognized features
         final String[] recognizedFeatures = component.getRecognizedFeatures();
         addRecognizedFeatures(recognizedFeatures);
-
+        
         // register component's recognized properties
         final String[] recognizedProperties = component.getRecognizedProperties();
         addRecognizedProperties(recognizedProperties);
@@ -325,7 +346,7 @@
         setFeatureDefaults(component, recognizedFeatures);
         setPropertyDefaults(component, recognizedProperties);
     }
-
+    
     /** Calls reset on each of the components owned by this component manager. **/
     public void reset() throws XNIException {
         fNamespaceContext.reset();
@@ -336,38 +357,38 @@
         // Mark configuration as fixed.
         fConfigUpdated = false;
     }
-
+    
     void setErrorHandler(ErrorHandler errorHandler) {
         fErrorHandler = errorHandler;
-        setProperty(ERROR_HANDLER, (errorHandler != null) ? new ErrorHandlerWrapper(errorHandler) :
+        setProperty(ERROR_HANDLER, (errorHandler != null) ? new ErrorHandlerWrapper(errorHandler) : 
                 new ErrorHandlerWrapper(DraconianErrorHandler.getInstance()));
     }
-
+    
     ErrorHandler getErrorHandler() {
         return fErrorHandler;
     }
-
+    
     void setResourceResolver(LSResourceResolver resourceResolver) {
         fResourceResolver = resourceResolver;
         setProperty(ENTITY_RESOLVER, new DOMEntityResolverWrapper(resourceResolver));
     }
-
+    
     public LSResourceResolver getResourceResolver() {
         return fResourceResolver;
     }
-
+    
     /** Cleans out configuration, restoring it to its initial state. */
     void restoreInitialState() {
         fConfigUpdated = true;
-
+        
         // Clear feature and property tables.
         fFeatures.clear();
         fProperties.clear();
-
+        
         // Remove error resolver and error handler
         fComponents.put(ENTITY_RESOLVER, null);
         fComponents.put(ERROR_HANDLER, null);
-
+        
         // Restore component defaults.
         setFeatureDefaults(fEntityManager, fEntityManager.getRecognizedFeatures());
         setPropertyDefaults(fEntityManager, fEntityManager.getRecognizedProperties());
@@ -376,7 +397,7 @@
         setFeatureDefaults(fSchemaValidator, fSchemaValidator.getRecognizedFeatures());
         setPropertyDefaults(fSchemaValidator, fSchemaValidator.getRecognizedProperties());
     }
-
+    
     /** Sets feature defaults for the given component on this configuration. */
     private void setFeatureDefaults(final XMLComponent component, final String [] recognizedFeatures) {
         if (recognizedFeatures != null) {
@@ -397,7 +418,7 @@
             }
         }
     }
-
+    
     /** Sets property defaults for the given component on this configuration. */
     private void setPropertyDefaults(final XMLComponent component, final String [] recognizedProperties) {
         if (recognizedProperties != null) {
@@ -418,5 +439,6 @@
             }
         }
     }
-
+    
 } // XMLSchemaValidatorComponentManager
+ 
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/DOMParser.java	Wed Sep 28 16:49:43 2011 +0100
@@ -55,6 +55,7 @@
  * @author Arnaud  Le Hors, IBM
  * @author Andy Clark, IBM
  *
+ * @version $Id: DOMParser.java,v 1.5 2007/07/19 04:38:54 ofung Exp $
  */
 public class DOMParser
     extends AbstractDOMParser {
@@ -62,13 +63,21 @@
     //
     // Constants
     //
-
+    
     // features
-
+    
     /** Feature identifier: EntityResolver2. */
     protected static final String USE_ENTITY_RESOLVER2 =
         Constants.SAX_FEATURE_PREFIX + Constants.USE_ENTITY_RESOLVER2_FEATURE;
 
+    protected static final String REPORT_WHITESPACE =
+            Constants.SUN_SCHEMA_FEATURE_PREFIX + Constants.SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE;
+
+    // recognized features:
+    private static final String[] RECOGNIZED_FEATURES = {
+        REPORT_WHITESPACE
+    };
+    
     // properties
 
     /** Property identifier: symbol table. */
@@ -84,13 +93,13 @@
         SYMBOL_TABLE,
         XMLGRAMMAR_POOL,
     };
-
+    
     //
     // Data
     //
-
+    
     // features
-
+    
     /** Use EntityResolver2. */
     protected boolean fUseEntityResolver2 = true;
 
@@ -139,6 +148,8 @@
             fConfiguration.setProperty(XMLGRAMMAR_POOL, grammarPool);
         }
 
+        fConfiguration.addRecognizedFeatures(RECOGNIZED_FEATURES);
+
     } // <init>(SymbolTable,XMLGrammarPool)
 
     //
@@ -323,7 +334,7 @@
                         ((EntityResolverWrapper) xmlEntityResolver).getEntityResolver();
                 }
                 else if (xmlEntityResolver instanceof EntityResolver2Wrapper) {
-                    entityResolver =
+                    entityResolver = 
                         ((EntityResolver2Wrapper) xmlEntityResolver).getEntityResolver();
                 }
             }
@@ -415,7 +426,7 @@
         throws SAXNotRecognizedException, SAXNotSupportedException {
 
         try {
-
+            
             // http://xml.org/sax/features/use-entity-resolver2
             //   controls whether the methods of an object implementing
             //   org.xml.sax.ext.EntityResolver2 will be used by the parser.
@@ -428,23 +439,23 @@
                 }
                 return;
             }
-
+            
             //
             // Default handling
             //
-
+            
             fConfiguration.setFeature(featureId, state);
         }
         catch (XMLConfigurationException e) {
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "feature-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "feature-not-supported", new Object [] {identifier}));
             }
         }
@@ -477,23 +488,23 @@
             if (featureId.equals(USE_ENTITY_RESOLVER2)) {
                 return fUseEntityResolver2;
             }
-
+            
             //
             // Default handling
             //
-
+            
             return fConfiguration.getFeature(featureId);
         }
         catch (XMLConfigurationException e) {
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "feature-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "feature-not-supported", new Object [] {identifier}));
             }
         }
@@ -525,12 +536,12 @@
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "property-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "property-not-supported", new Object [] {identifier}));
             }
         }
@@ -576,19 +587,19 @@
             String identifier = e.getIdentifier();
             if (e.getType() == XMLConfigurationException.NOT_RECOGNIZED) {
                 throw new SAXNotRecognizedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "property-not-recognized", new Object [] {identifier}));
             }
             else {
                 throw new SAXNotSupportedException(
-                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(),
+                    SAXMessageFormatter.formatMessage(fConfiguration.getLocale(), 
                     "property-not-supported", new Object [] {identifier}));
             }
         }
 
     } // getProperty(String):Object
-
-    /**
+    
+    /** 
      * Returns this parser's XMLParserConfiguration.
      */
     public XMLParserConfiguration getXMLParserConfiguration() {
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/SAXParser.java	Wed Sep 28 16:49:43 2011 +0100
@@ -33,6 +33,7 @@
  * @author Arnaud  Le Hors, IBM
  * @author Andy Clark, IBM
  *
+ * @version $Id: SAXParser.java,v 1.5 2007/07/19 04:38:54 ofung Exp $
  */
 public class SAXParser
     extends AbstractSAXParser {
@@ -47,9 +48,13 @@
     protected static final String NOTIFY_BUILTIN_REFS =
         Constants.XERCES_FEATURE_PREFIX + Constants.NOTIFY_BUILTIN_REFS_FEATURE;
 
+    protected static final String REPORT_WHITESPACE =
+            Constants.SUN_SCHEMA_FEATURE_PREFIX + Constants.SUN_REPORT_IGNORED_ELEMENT_CONTENT_WHITESPACE;
+    
     /** Recognized features. */
     private static final String[] RECOGNIZED_FEATURES = {
         NOTIFY_BUILTIN_REFS,
+        REPORT_WHITESPACE
     };
 
     // properties
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/XML11Configuration.java	Wed Sep 28 16:49:43 2011 +0100
@@ -73,6 +73,7 @@
  * @author Neil Graham, IBM
  * @author Michael Glavassevich, IBM
  *
+ * @version $Id: XML11Configuration.java,v 1.5 2008/08/29 06:17:02 joehw Exp $
  */
 public class XML11Configuration extends ParserConfigurationSettings
     implements XMLPullParserConfiguration, XML11Configurable {
@@ -136,61 +137,61 @@
     /** feature identifier: XML Schema validation -- full checking */
     protected static final String XMLSCHEMA_FULL_CHECKING =
         Constants.XERCES_FEATURE_PREFIX + Constants.SCHEMA_FULL_CHECKING;
-
+    
     /** Feature: generate synthetic annotations */
-    protected static final String GENERATE_SYNTHETIC_ANNOTATIONS =
+    protected static final String GENERATE_SYNTHETIC_ANNOTATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.GENERATE_SYNTHETIC_ANNOTATIONS_FEATURE;
-
+    
     /** Feature identifier: validate annotations */
     protected static final String VALIDATE_ANNOTATIONS =
         Constants.XERCES_FEATURE_PREFIX + Constants.VALIDATE_ANNOTATIONS_FEATURE;
-
+    
     /** Feature identifier: honour all schemaLocations */
-    protected static final String HONOUR_ALL_SCHEMALOCATIONS =
+    protected static final String HONOUR_ALL_SCHEMALOCATIONS = 
         Constants.XERCES_FEATURE_PREFIX + Constants.HONOUR_ALL_SCHEMALOCATIONS_FEATURE;
-
+    
     /** Feature identifier: use grammar pool only */
     protected static final String USE_GRAMMAR_POOL_ONLY =
         Constants.XERCES_FEATURE_PREFIX + Constants.USE_GRAMMAR_POOL_ONLY_FEATURE;
-
-        // feature identifiers
-
-        /** Feature identifier: validation. */
-        protected static final String VALIDATION =
-                Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
+        
+	// feature identifiers
 
-        /** Feature identifier: namespaces. */
-        protected static final String NAMESPACES =
-                Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
-
-        /** Feature identifier: external general entities. */
-        protected static final String EXTERNAL_GENERAL_ENTITIES =
-                Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
-
-        /** Feature identifier: external parameter entities. */
-        protected static final String EXTERNAL_PARAMETER_ENTITIES =
-                Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
-
-
+	/** Feature identifier: validation. */
+	protected static final String VALIDATION =
+		Constants.SAX_FEATURE_PREFIX + Constants.VALIDATION_FEATURE;
+    
+	/** Feature identifier: namespaces. */
+	protected static final String NAMESPACES =
+		Constants.SAX_FEATURE_PREFIX + Constants.NAMESPACES_FEATURE;
+    
+	/** Feature identifier: external general entities. */
+	protected static final String EXTERNAL_GENERAL_ENTITIES =
+		Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_GENERAL_ENTITIES_FEATURE;
+    
+	/** Feature identifier: external parameter entities. */
+	protected static final String EXTERNAL_PARAMETER_ENTITIES =
+		Constants.SAX_FEATURE_PREFIX + Constants.EXTERNAL_PARAMETER_ENTITIES_FEATURE;
+		
+    
 
     // property identifiers
-
+   
 
-        /** Property identifier: xml string. */
-        protected static final String XML_STRING =
-                Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY;
+	/** Property identifier: xml string. */
+	protected static final String XML_STRING = 
+		Constants.SAX_PROPERTY_PREFIX + Constants.XML_STRING_PROPERTY;
 
-        /** Property identifier: symbol table. */
-        protected static final String SYMBOL_TABLE =
-                Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
+	/** Property identifier: symbol table. */
+	protected static final String SYMBOL_TABLE = 
+		Constants.XERCES_PROPERTY_PREFIX + Constants.SYMBOL_TABLE_PROPERTY;
 
-        /** Property identifier: error handler. */
-        protected static final String ERROR_HANDLER =
-                Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
+	/** Property identifier: error handler. */
+	protected static final String ERROR_HANDLER = 
+		Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
 
-        /** Property identifier: entity resolver. */
-        protected static final String ENTITY_RESOLVER =
-                Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
+	/** Property identifier: entity resolver. */
+	protected static final String ENTITY_RESOLVER = 
+		Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
 
 
     /** Property identifier: XML Schema validator. */
@@ -259,49 +260,49 @@
     /** Set to true and recompile to print exception stack trace. */
     protected static final boolean PRINT_EXCEPTION_STACK_TRACE = false;
 
-    //
+    // 
     // Data
     //
 
-        protected SymbolTable fSymbolTable;
+	protected SymbolTable fSymbolTable;
     protected XMLInputSource fInputSource;
     protected ValidationManager fValidationManager;
-        protected XMLVersionDetector fVersionDetector;
+	protected XMLVersionDetector fVersionDetector;
     protected XMLLocator fLocator;
-        protected Locale fLocale;
+	protected Locale fLocale;
 
-        /** XML 1.0 Components. */
-        protected ArrayList fComponents;
-
-        /** XML 1.1. Components. */
-        protected ArrayList fXML11Components = null;
-
-        /** Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator */
-        protected ArrayList fCommonComponents = null;
+	/** XML 1.0 Components. */
+	protected ArrayList fComponents;
+    
+	/** XML 1.1. Components. */
+	protected ArrayList fXML11Components = null;
+	
+	/** Common components: XMLEntityManager, XMLErrorReporter, XMLSchemaValidator */
+	protected ArrayList fCommonComponents = null;
 
-        /** The document handler. */
-        protected XMLDocumentHandler fDocumentHandler;
+	/** The document handler. */
+	protected XMLDocumentHandler fDocumentHandler;
 
-        /** The DTD handler. */
-        protected XMLDTDHandler fDTDHandler;
+	/** The DTD handler. */
+	protected XMLDTDHandler fDTDHandler;
 
-        /** The DTD content model handler. */
-        protected XMLDTDContentModelHandler fDTDContentModelHandler;
+	/** The DTD content model handler. */
+	protected XMLDTDContentModelHandler fDTDContentModelHandler;
 
-        /** Last component in the document pipeline */
-        protected XMLDocumentSource fLastComponent;
+	/** Last component in the document pipeline */     
+	protected XMLDocumentSource fLastComponent;
 
-    /**
+    /** 
      * True if a parse is in progress. This state is needed because
      * some features/properties cannot be set while parsing (e.g.
      * validation and namespaces).
      */
     protected boolean fParseInProgress = false;
-
-    /** fConfigUpdated is set to true if there has been any change to the configuration settings,
+    
+    /** fConfigUpdated is set to true if there has been any change to the configuration settings, 
      * i.e a feature or a property was changed.
      */
-        protected boolean fConfigUpdated = false;
+	protected boolean fConfigUpdated = false;
 
     //
     // XML 1.0 components
@@ -382,8 +383,8 @@
         this(null, null, null);
     } // <init>()
 
-    /**
-     * Constructs a parser configuration using the specified symbol table.
+    /** 
+     * Constructs a parser configuration using the specified symbol table. 
      *
      * @param symbolTable The symbol table to use.
      */
@@ -395,7 +396,7 @@
      * Constructs a parser configuration using the specified symbol table and
      * grammar pool.
      * <p>
-     * <strong>REVISIT:</strong>
+     * <strong>REVISIT:</strong> 
      * Grammar pool will be updated when the new validation engine is
      * implemented.
      *
@@ -410,7 +411,7 @@
      * Constructs a parser configuration using the specified symbol table,
      * grammar pool, and parent settings.
      * <p>
-     * <strong>REVISIT:</strong>
+     * <strong>REVISIT:</strong> 
      * Grammar pool will be updated when the new validation engine is
      * implemented.
      *
@@ -422,130 +423,130 @@
         SymbolTable symbolTable,
         XMLGrammarPool grammarPool,
         XMLComponentManager parentSettings) {
-
-                super(parentSettings);
+		
+		super(parentSettings);
 
-                // create a vector to hold all the components in use
-                // XML 1.0 specialized components
-                fComponents = new ArrayList();
-                // XML 1.1 specialized components
-                fXML11Components = new ArrayList();
-                // Common components for XML 1.1. and XML 1.0
-                fCommonComponents = new ArrayList();
+		// create a vector to hold all the components in use
+		// XML 1.0 specialized components
+		fComponents = new ArrayList();
+		// XML 1.1 specialized components
+		fXML11Components = new ArrayList();
+		// Common components for XML 1.1. and XML 1.0
+		fCommonComponents = new ArrayList();
 
-                // create storage for recognized features and properties
-                fRecognizedFeatures = new ArrayList();
-                fRecognizedProperties = new ArrayList();
+		// create storage for recognized features and properties
+		fRecognizedFeatures = new ArrayList();
+		fRecognizedProperties = new ArrayList();
 
-                // create table for features and properties
-                fFeatures = new HashMap();
-                fProperties = new HashMap();
+		// create table for features and properties
+		fFeatures = new HashMap();
+		fProperties = new HashMap();
 
         // add default recognized features
         final String[] recognizedFeatures =
-            {
-                CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl
-                                VALIDATION,
-                                NAMESPACES,
+            {   
+            	CONTINUE_AFTER_FATAL_ERROR, LOAD_EXTERNAL_DTD, // from XMLDTDScannerImpl
+				VALIDATION,                 
+				NAMESPACES,
                 NORMALIZE_DATA, SCHEMA_ELEMENT_DEFAULT, SCHEMA_AUGMENT_PSVI,
                 GENERATE_SYNTHETIC_ANNOTATIONS, VALIDATE_ANNOTATIONS,
                 HONOUR_ALL_SCHEMALOCATIONS, USE_GRAMMAR_POOL_ONLY,
-                // NOTE: These shouldn't really be here but since the XML Schema
-                //       validator is constructed dynamically, its recognized
-                //       features might not have been set and it would cause a
-                //       not-recognized exception to be thrown. -Ac
-                XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING,
-                                EXTERNAL_GENERAL_ENTITIES,
-                                EXTERNAL_PARAMETER_ENTITIES,
-                                PARSER_SETTINGS
-                        };
+            	// NOTE: These shouldn't really be here but since the XML Schema
+            	//       validator is constructed dynamically, its recognized
+            	//       features might not have been set and it would cause a
+            	//       not-recognized exception to be thrown. -Ac
+            	XMLSCHEMA_VALIDATION, XMLSCHEMA_FULL_CHECKING, 			
+				EXTERNAL_GENERAL_ENTITIES,  
+				EXTERNAL_PARAMETER_ENTITIES,
+				PARSER_SETTINGS
+			};
         addRecognizedFeatures(recognizedFeatures);
-                // set state for default features
-                fFeatures.put(VALIDATION, Boolean.FALSE);
-                fFeatures.put(NAMESPACES, Boolean.TRUE);
-                fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
-                fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
-                fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
-                fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
-                fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE);
-                fFeatures.put(NORMALIZE_DATA, Boolean.TRUE);
-                fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
+		// set state for default features
+		fFeatures.put(VALIDATION, Boolean.FALSE);
+		fFeatures.put(NAMESPACES, Boolean.TRUE);
+		fFeatures.put(EXTERNAL_GENERAL_ENTITIES, Boolean.TRUE);
+		fFeatures.put(EXTERNAL_PARAMETER_ENTITIES, Boolean.TRUE);
+		fFeatures.put(CONTINUE_AFTER_FATAL_ERROR, Boolean.FALSE);
+		fFeatures.put(LOAD_EXTERNAL_DTD, Boolean.TRUE);
+		fFeatures.put(SCHEMA_ELEMENT_DEFAULT, Boolean.TRUE);
+		fFeatures.put(NORMALIZE_DATA, Boolean.TRUE);
+		fFeatures.put(SCHEMA_AUGMENT_PSVI, Boolean.TRUE);
         fFeatures.put(GENERATE_SYNTHETIC_ANNOTATIONS, Boolean.FALSE);
         fFeatures.put(VALIDATE_ANNOTATIONS, Boolean.FALSE);
         fFeatures.put(HONOUR_ALL_SCHEMALOCATIONS, Boolean.FALSE);
         fFeatures.put(USE_GRAMMAR_POOL_ONLY, Boolean.FALSE);
-                fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
+		fFeatures.put(PARSER_SETTINGS, Boolean.TRUE);
 
         // add default recognized properties
         final String[] recognizedProperties =
-            {
-                                SYMBOL_TABLE,
-                                ERROR_HANDLER,
-                                ENTITY_RESOLVER,
+            {				     
+				SYMBOL_TABLE,
+				ERROR_HANDLER,  
+				ENTITY_RESOLVER,
                 ERROR_REPORTER,
                 ENTITY_MANAGER,
                 DOCUMENT_SCANNER,
                 DTD_SCANNER,
                 DTD_PROCESSOR,
                 DTD_VALIDATOR,
-                                DATATYPE_VALIDATOR_FACTORY,
-                                VALIDATION_MANAGER,
-                                SCHEMA_VALIDATOR,
-                                XML_STRING,
-                XMLGRAMMAR_POOL,
+				DATATYPE_VALIDATOR_FACTORY,
+				VALIDATION_MANAGER,
+				SCHEMA_VALIDATOR,
+				XML_STRING,
+                XMLGRAMMAR_POOL, 
                 JAXP_SCHEMA_SOURCE,
-                JAXP_SCHEMA_LANGUAGE,
-                // NOTE: These shouldn't really be here but since the XML Schema
-                //       validator is constructed dynamically, its recognized
-                //       properties might not have been set and it would cause a
-                //       not-recognized exception to be thrown. -Ac
-                SCHEMA_LOCATION, SCHEMA_NONS_LOCATION, };
+                JAXP_SCHEMA_LANGUAGE,                
+            	// NOTE: These shouldn't really be here but since the XML Schema
+            	//       validator is constructed dynamically, its recognized
+            	//       properties might not have been set and it would cause a
+            	//       not-recognized exception to be thrown. -Ac
+            	SCHEMA_LOCATION, SCHEMA_NONS_LOCATION, };
         addRecognizedProperties(recognizedProperties);
-
-                if (symbolTable == null) {
-                        symbolTable = new SymbolTable();
-                }
-                fSymbolTable = symbolTable;
-                fProperties.put(SYMBOL_TABLE, fSymbolTable);
-
+		
+		if (symbolTable == null) {
+			symbolTable = new SymbolTable();
+		}
+		fSymbolTable = symbolTable;
+		fProperties.put(SYMBOL_TABLE, fSymbolTable);
+		
         fGrammarPool = grammarPool;
         if (fGrammarPool != null) {
-                        fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
+			fProperties.put(XMLGRAMMAR_POOL, fGrammarPool);
         }
 
         fEntityManager = new XMLEntityManager();
-                fProperties.put(ENTITY_MANAGER, fEntityManager);
+		fProperties.put(ENTITY_MANAGER, fEntityManager);
         addCommonComponent(fEntityManager);
 
         fErrorReporter = new XMLErrorReporter();
         fErrorReporter.setDocumentLocator(fEntityManager.getEntityScanner());
-                fProperties.put(ERROR_REPORTER, fErrorReporter);
+		fProperties.put(ERROR_REPORTER, fErrorReporter);
         addCommonComponent(fErrorReporter);
 
         fNamespaceScanner = new XMLNSDocumentScannerImpl();
-                fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
+		fProperties.put(DOCUMENT_SCANNER, fNamespaceScanner);
         addComponent((XMLComponent) fNamespaceScanner);
 
         fDTDScanner = new XMLDTDScannerImpl();
-                fProperties.put(DTD_SCANNER, fDTDScanner);
+		fProperties.put(DTD_SCANNER, fDTDScanner);
         addComponent((XMLComponent) fDTDScanner);
 
         fDTDProcessor = new XMLDTDProcessor();
-                fProperties.put(DTD_PROCESSOR, fDTDProcessor);
+		fProperties.put(DTD_PROCESSOR, fDTDProcessor);
         addComponent((XMLComponent) fDTDProcessor);
 
         fDTDValidator = new XMLNSDTDValidator();
-                fProperties.put(DTD_VALIDATOR, fDTDValidator);
+		fProperties.put(DTD_VALIDATOR, fDTDValidator);
         addComponent(fDTDValidator);
 
         fDatatypeValidatorFactory = DTDDVFactory.getInstance();
-                fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory);
+		fProperties.put(DATATYPE_VALIDATOR_FACTORY, fDatatypeValidatorFactory);
 
         fValidationManager = new ValidationManager();
-                fProperties.put(VALIDATION_MANAGER, fValidationManager);
-
+		fProperties.put(VALIDATION_MANAGER, fValidationManager);
+        
         fVersionDetector = new XMLVersionDetector();
-
+        
         // add message formatters
         if (fErrorReporter.getMessageFormatter(XMLMessageFormatter.XML_DOMAIN) == null) {
             XMLMessageFormatter xmft = new XMLMessageFormatter();
@@ -560,8 +561,8 @@
             // do nothing
             // REVISIT: What is the right thing to do? -Ac
         }
-
-                fConfigUpdated = false;
+        
+		fConfigUpdated = false;
 
     } // <init>(SymbolTable,XMLGrammarPool)
 
@@ -573,7 +574,7 @@
      *
      * @param inputSource The document's input source.
      *
-     * @exception XMLConfigurationException Thrown if there is a
+     * @exception XMLConfigurationException Thrown if there is a 
      *                        configuration error when initializing the
      *                        parser.
      * @exception IOException Thrown on I/O error.
@@ -604,110 +605,110 @@
         fLocale = locale;
         fErrorReporter.setLocale(locale);
     } // setLocale(Locale)
-        /**
-         * Sets the document handler on the last component in the pipeline
-         * to receive information about the document.
-         *
-         * @param documentHandler   The document handler.
-         */
-        public void setDocumentHandler(XMLDocumentHandler documentHandler) {
-                fDocumentHandler = documentHandler;
-                if (fLastComponent != null) {
-                        fLastComponent.setDocumentHandler(fDocumentHandler);
-                        if (fDocumentHandler !=null){
-                                fDocumentHandler.setDocumentSource(fLastComponent);
-                        }
-                }
-        } // setDocumentHandler(XMLDocumentHandler)
+	/**
+	 * Sets the document handler on the last component in the pipeline
+	 * to receive information about the document.
+	 * 
+	 * @param documentHandler   The document handler.
+	 */
+	public void setDocumentHandler(XMLDocumentHandler documentHandler) {
+		fDocumentHandler = documentHandler;
+		if (fLastComponent != null) {
+			fLastComponent.setDocumentHandler(fDocumentHandler);
+			if (fDocumentHandler !=null){
+				fDocumentHandler.setDocumentSource(fLastComponent);
+			}
+		}
+	} // setDocumentHandler(XMLDocumentHandler)
 
-        /** Returns the registered document handler. */
-        public XMLDocumentHandler getDocumentHandler() {
-                return fDocumentHandler;
-        } // getDocumentHandler():XMLDocumentHandler
+	/** Returns the registered document handler. */
+	public XMLDocumentHandler getDocumentHandler() {
+		return fDocumentHandler;
+	} // getDocumentHandler():XMLDocumentHandler
 
-        /**
-         * Sets the DTD handler.
-         *
-         * @param dtdHandler The DTD handler.
-         */
-        public void setDTDHandler(XMLDTDHandler dtdHandler) {
-                fDTDHandler = dtdHandler;
-        } // setDTDHandler(XMLDTDHandler)
+	/**
+	 * Sets the DTD handler.
+	 * 
+	 * @param dtdHandler The DTD handler.
+	 */
+	public void setDTDHandler(XMLDTDHandler dtdHandler) {
+		fDTDHandler = dtdHandler;
+	} // setDTDHandler(XMLDTDHandler)
 
-        /** Returns the registered DTD handler. */
-        public XMLDTDHandler getDTDHandler() {
-                return fDTDHandler;
-        } // getDTDHandler():XMLDTDHandler
+	/** Returns the registered DTD handler. */
+	public XMLDTDHandler getDTDHandler() {
+		return fDTDHandler;
+	} // getDTDHandler():XMLDTDHandler
 
-        /**
-         * Sets the DTD content model handler.
-         *
-         * @param handler The DTD content model handler.
-         */
-        public void setDTDContentModelHandler(XMLDTDContentModelHandler handler) {
-                fDTDContentModelHandler = handler;
-        } // setDTDContentModelHandler(XMLDTDContentModelHandler)
+	/**
+	 * Sets the DTD content model handler.
+	 * 
+	 * @param handler The DTD content model handler.
+	 */
+	public void setDTDContentModelHandler(XMLDTDContentModelHandler handler) {
+		fDTDContentModelHandler = handler;
+	} // setDTDContentModelHandler(XMLDTDContentModelHandler)
 
-        /** Returns the registered DTD content model handler. */
-        public XMLDTDContentModelHandler getDTDContentModelHandler() {
-                return fDTDContentModelHandler;
-        } // getDTDContentModelHandler():XMLDTDContentModelHandler
+	/** Returns the registered DTD content model handler. */
+	public XMLDTDContentModelHandler getDTDContentModelHandler() {
+		return fDTDContentModelHandler;
+	} // getDTDContentModelHandler():XMLDTDContentModelHandler
 
-        /**
-         * Sets the resolver used to resolve external entities. The EntityResolver
-         * interface supports resolution of public and system identifiers.
-         *
-         * @param resolver The new entity resolver. Passing a null value will
-         *                 uninstall the currently installed resolver.
-         */
-        public void setEntityResolver(XMLEntityResolver resolver) {
-                fProperties.put(ENTITY_RESOLVER, resolver);
-        } // setEntityResolver(XMLEntityResolver)
-
-        /**
-         * Return the current entity resolver.
-         *
-         * @return The current entity resolver, or null if none
-         *         has been registered.
-         * @see #setEntityResolver
-         */
-        public XMLEntityResolver getEntityResolver() {
-                return (XMLEntityResolver)fProperties.get(ENTITY_RESOLVER);
-        } // getEntityResolver():XMLEntityResolver
+	/**
+	 * Sets the resolver used to resolve external entities. The EntityResolver
+	 * interface supports resolution of public and system identifiers.
+	 *
+	 * @param resolver The new entity resolver. Passing a null value will
+	 *                 uninstall the currently installed resolver.
+	 */
+	public void setEntityResolver(XMLEntityResolver resolver) {
+		fProperties.put(ENTITY_RESOLVER, resolver);
+	} // setEntityResolver(XMLEntityResolver)
 
-        /**
-         * Allow an application to register an error event handler.
-         *
-         * <p>If the application does not register an error handler, all
-         * error events reported by the SAX parser will be silently
-         * ignored; however, normal processing may not continue.  It is
-         * highly recommended that all SAX applications implement an
-         * error handler to avoid unexpected bugs.</p>
-         *
-         * <p>Applications may register a new or different handler in the
-         * middle of a parse, and the SAX parser must begin using the new
-         * handler immediately.</p>
-         *
-         * @param errorHandler The error handler.
-         * @exception java.lang.NullPointerException If the handler
-         *            argument is null.
-         * @see #getErrorHandler
-         */
-        public void setErrorHandler(XMLErrorHandler errorHandler) {
-                fProperties.put(ERROR_HANDLER, errorHandler);
-        } // setErrorHandler(XMLErrorHandler)
+	/**
+	 * Return the current entity resolver.
+	 *
+	 * @return The current entity resolver, or null if none
+	 *         has been registered.
+	 * @see #setEntityResolver
+	 */
+	public XMLEntityResolver getEntityResolver() {
+		return (XMLEntityResolver)fProperties.get(ENTITY_RESOLVER);
+	} // getEntityResolver():XMLEntityResolver
+	
+	/**
+	 * Allow an application to register an error event handler.
+	 *
+	 * <p>If the application does not register an error handler, all
+	 * error events reported by the SAX parser will be silently
+	 * ignored; however, normal processing may not continue.  It is
+	 * highly recommended that all SAX applications implement an
+	 * error handler to avoid unexpected bugs.</p>
+	 *
+	 * <p>Applications may register a new or different handler in the
+	 * middle of a parse, and the SAX parser must begin using the new
+	 * handler immediately.</p>
+	 *
+	 * @param errorHandler The error handler.
+	 * @exception java.lang.NullPointerException If the handler 
+	 *            argument is null.
+	 * @see #getErrorHandler
+	 */
+	public void setErrorHandler(XMLErrorHandler errorHandler) {
+		fProperties.put(ERROR_HANDLER, errorHandler);
+	} // setErrorHandler(XMLErrorHandler)
 
-        /**
-         * Return the current error handler.
-         *
-         * @return The current error handler, or null if none
-         *         has been registered.
-         * @see #setErrorHandler
-         */
-        public XMLErrorHandler getErrorHandler() {
-                // REVISIT: Should this be a property?
-                return (XMLErrorHandler)fProperties.get(ERROR_HANDLER);
-        } // getErrorHandler():XMLErrorHandler
+	/**
+	 * Return the current error handler.
+	 *
+	 * @return The current error handler, or null if none
+	 *         has been registered.
+	 * @see #setErrorHandler
+	 */
+	public XMLErrorHandler getErrorHandler() {
+		// REVISIT: Should this be a property?
+		return (XMLErrorHandler)fProperties.get(ERROR_HANDLER);
+	} // getErrorHandler():XMLErrorHandler
 
 
     /**
@@ -767,8 +768,9 @@
         // reset and configure pipeline and set InputSource.
         if (fInputSource != null) {
             try {
-                                fValidationManager.reset();
+		fValidationManager.reset();
                 fVersionDetector.reset(this);
+                fConfigUpdated = true;
                 resetCommon();
 
                 short version = fVersionDetector.determineDocVersion(fInputSource);
@@ -780,7 +782,7 @@
                     configurePipeline();
                     reset();
                 }
-
+                
                 // mark configuration as fixed
                 fConfigUpdated = false;
 
@@ -827,160 +829,160 @@
         }
 
     } // parse(boolean):boolean
-
-        /**
-         * Returns the state of a feature.
-         *
-         * @param featureId The feature identifier.
-                 * @return true if the feature is supported
-         *
-         * @throws XMLConfigurationException Thrown for configuration error.
-         *                                   In general, components should
-         *                                   only throw this exception if
-         *                                   it is <strong>really</strong>
-         *                                   a critical error.
-         */
-        public boolean getFeature(String featureId)
-                throws XMLConfigurationException {
-                        // make this feature special
+    
+	/**
+	 * Returns the state of a feature.
+	 * 
+	 * @param featureId The feature identifier.
+		 * @return true if the feature is supported
+	 * 
+	 * @throws XMLConfigurationException Thrown for configuration error.
+	 *                                   In general, components should
+	 *                                   only throw this exception if
+	 *                                   it is <strong>really</strong>
+	 *                                   a critical error.
+	 */
+	public boolean getFeature(String featureId)
+		throws XMLConfigurationException {
+			// make this feature special
         if (featureId.equals(PARSER_SETTINGS)){
-                return fConfigUpdated;
+        	return fConfigUpdated;
         }
         return super.getFeature(featureId);
 
-        } // getFeature(String):boolean
-
-        /**
-         * Set the state of a feature.
-         *
-         * Set the state of any feature in a SAX2 parser.  The parser
-         * might not recognize the feature, and if it does recognize
-         * it, it might not be able to fulfill the request.
-         *
-         * @param featureId The unique identifier (URI) of the feature.
-         * @param state The requested state of the feature (true or false).
-         *
-         * @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
-         *            requested feature is not known.
-         */
-        public void setFeature(String featureId, boolean state)
-                throws XMLConfigurationException {
-                fConfigUpdated = true;
-                // forward to every XML 1.0 component
-                int count = fComponents.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fComponents.get(i);
-                        c.setFeature(featureId, state);
-                }
-                // forward it to common components
-                count = fCommonComponents.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fCommonComponents.get(i);
-                        c.setFeature(featureId, state);
-                }
-
-                // forward to every XML 1.1 component
-                count = fXML11Components.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fXML11Components.get(i);
-                        try{
-                                c.setFeature(featureId, state);
-                        }
-                        catch (Exception e){
-                                // no op
-                        }
-                }
-                // save state if noone "objects"
-                super.setFeature(featureId, state);
-
-        } // setFeature(String,boolean)
+	} // getFeature(String):boolean
+    
+	/**
+	 * Set the state of a feature.
+	 *
+	 * Set the state of any feature in a SAX2 parser.  The parser
+	 * might not recognize the feature, and if it does recognize
+	 * it, it might not be able to fulfill the request.
+	 *
+	 * @param featureId The unique identifier (URI) of the feature.
+	 * @param state The requested state of the feature (true or false).
+	 *
+	 * @exception com.sun.org.apache.xerces.internal.xni.parser.XMLConfigurationException If the
+	 *            requested feature is not known.
+	 */
+	public void setFeature(String featureId, boolean state)
+		throws XMLConfigurationException {
+		fConfigUpdated = true;
+		// forward to every XML 1.0 component
+		int count = fComponents.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fComponents.get(i);
+			c.setFeature(featureId, state);
+		}
+		// forward it to common components
+		count = fCommonComponents.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
+			c.setFeature(featureId, state);
+		}
+				
+		// forward to every XML 1.1 component
+		count = fXML11Components.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fXML11Components.get(i);
+			try{            
+				c.setFeature(featureId, state);
+			}
+			catch (Exception e){
+				// no op
+			}
+		}
+		// save state if noone "objects"
+		super.setFeature(featureId, state);
 
-        /**
-         * setProperty
-         *
-         * @param propertyId
-         * @param value
-         */
-        public void setProperty(String propertyId, Object value)
-                throws XMLConfigurationException {
-                fConfigUpdated = true;
-                // forward to every XML 1.0 component
-                int count = fComponents.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fComponents.get(i);
-                        c.setProperty(propertyId, value);
-                }
-                // forward it to every common Component
-                count = fCommonComponents.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fCommonComponents.get(i);
-                        c.setProperty(propertyId, value);
-                }
-                // forward it to every XML 1.1 component
-                count = fXML11Components.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fXML11Components.get(i);
-                        try{
-                                c.setProperty(propertyId, value);
-                        }
-                        catch (Exception e){
-                                // ignore it
-                        }
-                }
+	} // setFeature(String,boolean)
+	
+	/**
+	 * setProperty
+	 * 
+	 * @param propertyId 
+	 * @param value 
+	 */
+	public void setProperty(String propertyId, Object value)
+		throws XMLConfigurationException {
+		fConfigUpdated = true;
+		// forward to every XML 1.0 component
+		int count = fComponents.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fComponents.get(i);
+			c.setProperty(propertyId, value);
+		}
+		// forward it to every common Component
+		count = fCommonComponents.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
+			c.setProperty(propertyId, value);
+		}
+		// forward it to every XML 1.1 component
+		count = fXML11Components.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fXML11Components.get(i);
+			try{			
+				c.setProperty(propertyId, value);
+			}
+			catch (Exception e){
+				// ignore it
+			}
+		}
 
-                // store value if noone "objects"
-                super.setProperty(propertyId, value);
+		// store value if noone "objects"
+		super.setProperty(propertyId, value);
 
-        } // setProperty(String,Object)
-
+	} // setProperty(String,Object)
+    
 
-        /** Returns the locale. */
-        public Locale getLocale() {
-                return fLocale;
-        } // getLocale():Locale
-
-        /**
-         * reset all XML 1.0 components before parsing and namespace context
-         */
-        protected void reset() throws XNIException {
-                int count = fComponents.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fComponents.get(i);
-                        c.reset(this);
-                }
-
-        } // reset()
+	/** Returns the locale. */
+	public Locale getLocale() {
+		return fLocale;
+	} // getLocale():Locale
+	
+	/**
+	 * reset all XML 1.0 components before parsing and namespace context
+	 */
+	protected void reset() throws XNIException {
+		int count = fComponents.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fComponents.get(i);
+			c.reset(this);
+		}
 
-        /**
-         * reset all common components before parsing
-         */
-        protected void resetCommon() throws XNIException {
-                // reset common components
-                int count = fCommonComponents.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fCommonComponents.get(i);
-                        c.reset(this);
-                }
-
-        } // resetCommon()
+	} // reset()
+    
+	/**
+	 * reset all common components before parsing
+	 */
+	protected void resetCommon() throws XNIException {
+		// reset common components
+		int count = fCommonComponents.size();
+		for (int i = 0; i < count; i++) {
+			XMLComponent c = (XMLComponent) fCommonComponents.get(i);
+			c.reset(this);
+		}
 
+	} // resetCommon()
+    
+    
+	/**
+	 * reset all components before parsing and namespace context
+	 */
+	protected void resetXML11() throws XNIException {
+		// reset every component
+		int count = fXML11Components.size();
+		for (int i = 0; i < count; i++) {			
+			XMLComponent c = (XMLComponent) fXML11Components.get(i);
+			c.reset(this);
+		}
 
-        /**
-         * reset all components before parsing and namespace context
-         */
-        protected void resetXML11() throws XNIException {
-                // reset every component
-                int count = fXML11Components.size();
-                for (int i = 0; i < count; i++) {
-                        XMLComponent c = (XMLComponent) fXML11Components.get(i);
-                        c.reset(this);
-                }
-
-        } // resetXML11()
+	} // resetXML11()
 
 
     /**
-     *  Configures the XML 1.1 pipeline.
+     *  Configures the XML 1.1 pipeline. 
      *  Note: this method also resets the new XML11 components.
      */
     protected void configureXML11Pipeline() {
@@ -991,7 +993,7 @@
         if (fCurrentDTDScanner != fXML11DTDScanner) {
             fCurrentDTDScanner = fXML11DTDScanner;
             setProperty(DTD_SCANNER, fCurrentDTDScanner);
-                        setProperty(DTD_PROCESSOR, fXML11DTDProcessor);
+			setProperty(DTD_PROCESSOR, fXML11DTDProcessor);
         }
 
         fXML11DTDScanner.setDTDHandler(fXML11DTDProcessor);
@@ -1027,14 +1029,14 @@
             fLastComponent = fXML11NSDTDValidator;
 
         } else {
-                        // create components
-                          if (fXML11DocScanner == null) {
-                                        // non namespace document pipeline
-                                        fXML11DocScanner = new XML11DocumentScannerImpl();
-                                        addXML11Component(fXML11DocScanner);
-                                        fXML11DTDValidator = new XML11DTDValidator();
-                                        addXML11Component(fXML11DTDValidator);
-                          }
+			// create components
+			  if (fXML11DocScanner == null) {
+					// non namespace document pipeline
+					fXML11DocScanner = new XML11DocumentScannerImpl();
+					addXML11Component(fXML11DocScanner);
+					fXML11DTDValidator = new XML11DTDValidator();
+					addXML11Component(fXML11DTDValidator);
+			  }
             if (fCurrentScanner != fXML11DocScanner) {
                 fCurrentScanner = fXML11DocScanner;
                 setProperty(DOCUMENT_SCANNER, fXML11DocScanner);
@@ -1057,8 +1059,8 @@
                 fSchemaValidator = new XMLSchemaValidator();
                 // add schema component
                 setProperty(SCHEMA_VALIDATOR, fSchemaValidator);
-                                addCommonComponent(fSchemaValidator);
-                                fSchemaValidator.reset(this);
+				addCommonComponent(fSchemaValidator);
+				fSchemaValidator.reset(this);
                 // add schema message formatter
                 if (fErrorReporter.getMessageFormatter(XSMessageFormatter.SCHEMA_DOMAIN) == null) {
                     XSMessageFormatter xmft = new XSMessageFormatter();
@@ -1193,14 +1195,14 @@
 
         if (featureId.startsWith(Constants.XERCES_FEATURE_PREFIX)) {
             final int suffixLength = featureId.length() - Constants.XERCES_FEATURE_PREFIX.length();
-
+            
             //
             // http://apache.org/xml/features/validation/dynamic
             //   Allows the parser to validate a document only when it
             //   contains a grammar. Validation is turned on/off based
             //   on each document instance, automatically.
             //
-            if (suffixLength == Constants.DYNAMIC_VALIDATION_FEATURE.length() &&
+            if (suffixLength == Constants.DYNAMIC_VALIDATION_FEATURE.length() && 
                 featureId.endsWith(Constants.DYNAMIC_VALIDATION_FEATURE)) {
                 return;
             }
@@ -1217,7 +1219,7 @@
             //
             // http://apache.org/xml/features/validation/default-attribute-values
             //
-            if (suffixLength == Constants.VALIDATE_CONTENT_MODELS_FEATURE.length() &&
+            if (suffixLength == Constants.VALIDATE_CONTENT_MODELS_FEATURE.length() && 
                 featureId.endsWith(Constants.VALIDATE_CONTENT_MODELS_FEATURE)) {
                 // REVISIT
                 short type = XMLConfigurationException.NOT_SUPPORTED;
@@ -1226,14 +1228,14 @@
             //
             // http://apache.org/xml/features/validation/nonvalidating/load-dtd-grammar
             //
-            if (suffixLength == Constants.LOAD_DTD_GRAMMAR_FEATURE.length() &&
+            if (suffixLength == Constants.LOAD_DTD_GRAMMAR_FEATURE.length() && 
                 featureId.endsWith(Constants.LOAD_DTD_GRAMMAR_FEATURE)) {
                 return;
             }
             //
             // http://apache.org/xml/features/validation/nonvalidating/load-external-dtd
             //
-            if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() &&
+            if (suffixLength == Constants.LOAD_EXTERNAL_DTD_FEATURE.length() && 
                 featureId.endsWith(Constants.LOAD_EXTERNAL_DTD_FEATURE)) {
                 return;
             }
@@ -1241,40 +1243,40 @@
             //
             // http://apache.org/xml/features/validation/default-attribute-values
             //
-            if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() &&
+            if (suffixLength == Constants.VALIDATE_DATATYPES_FEATURE.length() && 
                 featureId.endsWith(Constants.VALIDATE_DATATYPES_FEATURE)) {
                 short type = XMLConfigurationException.NOT_SUPPORTED;
                 throw new XMLConfigurationException(type, featureId);
             }
-
+            
             //
             // http://apache.org/xml/features/validation/schema
             //   Lets the user turn Schema validation support on/off.
             //
-            if (suffixLength == Constants.SCHEMA_VALIDATION_FEATURE.length() &&
+            if (suffixLength == Constants.SCHEMA_VALIDATION_FEATURE.length() && 
                 featureId.endsWith(Constants.SCHEMA_VALIDATION_FEATURE)) {
                 return;
             }
             // activate full schema checking
-            if (suffixLength == Constants.SCHEMA_FULL_CHECKING.length() &&
+            if (suffixLength == Constants.SCHEMA_FULL_CHECKING.length() && 
                 featureId.endsWith(Constants.SCHEMA_FULL_CHECKING)) {
                 return;
             }
-            // Feature identifier: expose schema normalized value
+            // Feature identifier: expose schema normalized value 
             //  http://apache.org/xml/features/validation/schema/normalized-value
-            if (suffixLength == Constants.SCHEMA_NORMALIZED_VALUE.length() &&
+            if (suffixLength == Constants.SCHEMA_NORMALIZED_VALUE.length() && 
                 featureId.endsWith(Constants.SCHEMA_NORMALIZED_VALUE)) {
                 return;
-            }
-            // Feature identifier: send element default value via characters()
+            } 
+            // Feature identifier: send element default value via characters() 
             // http://apache.org/xml/features/validation/schema/element-default
-            if (suffixLength == Constants.SCHEMA_ELEMENT_DEFAULT.length() &&
+            if (suffixLength == Constants.SCHEMA_ELEMENT_DEFAULT.length() && 
                 featureId.endsWith(Constants.SCHEMA_ELEMENT_DEFAULT)) {
                 return;
             }
-
-            // special performance feature: only component manager is allowed to set it.
-            if (suffixLength == Constants.PARSER_SETTINGS.length() &&
+			 
+            // special performance feature: only component manager is allowed to set it.			 
+            if (suffixLength == Constants.PARSER_SETTINGS.length() && 
                 featureId.endsWith(Constants.PARSER_SETTINGS)) {
                 short type = XMLConfigurationException.NOT_SUPPORTED;
                 throw new XMLConfigurationException(type, featureId);
@@ -1312,33 +1314,33 @@
         if (propertyId.startsWith(Constants.XERCES_PROPERTY_PREFIX)) {
             final int suffixLength = propertyId.length() - Constants.XERCES_PROPERTY_PREFIX.length();
 
-            if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length() &&
+            if (suffixLength == Constants.DTD_SCANNER_PROPERTY.length() && 
                 propertyId.endsWith(Constants.DTD_SCANNER_PROPERTY)) {
                 return;
             }
-            if (suffixLength == Constants.SCHEMA_LOCATION.length() &&
+            if (suffixLength == Constants.SCHEMA_LOCATION.length() && 
                 propertyId.endsWith(Constants.SCHEMA_LOCATION)) {
                 return;
             }
-            if (suffixLength == Constants.SCHEMA_NONS_LOCATION.length() &&
+            if (suffixLength == Constants.SCHEMA_NONS_LOCATION.length() && 
                 propertyId.endsWith(Constants.SCHEMA_NONS_LOCATION)) {
                 return;
             }
         }
-
+        
         if (propertyId.startsWith(Constants.JAXP_PROPERTY_PREFIX)) {
             final int suffixLength = propertyId.length() - Constants.JAXP_PROPERTY_PREFIX.length();
 
-            if (suffixLength == Constants.SCHEMA_SOURCE.length() &&
+            if (suffixLength == Constants.SCHEMA_SOURCE.length() && 
                 propertyId.endsWith(Constants.SCHEMA_SOURCE)) {
                 return;
             }
         }
-
+		
         // special cases
         if (propertyId.startsWith(Constants.SAX_PROPERTY_PREFIX)) {
             final int suffixLength = propertyId.length() - Constants.SAX_PROPERTY_PREFIX.length();
-
+			
             //
             // http://xml.org/sax/properties/xml-string
             // Value type: String
@@ -1349,7 +1351,7 @@
             //   null (this is a good way to check for availability before the
             //   parse begins).
             //
-            if (suffixLength == Constants.XML_STRING_PROPERTY.length() &&
+            if (suffixLength == Constants.XML_STRING_PROPERTY.length() && 
                 propertyId.endsWith(Constants.XML_STRING_PROPERTY)) {
                 // REVISIT - we should probably ask xml-dev for a precise
                 // definition of what this is actually supposed to return, and
@@ -1368,7 +1370,7 @@
     } // checkProperty(String)
 
 
-    /**
+    /** 
      * Adds a component to the parser configuration. This method will
      * also add all of the component's recognized features and properties
      * to the list of default recognized features and properties.
@@ -1383,10 +1385,10 @@
         }
         fComponents.add(component);
         addRecognizedParamsAndSetDefaults(component);
-
+	
     } // addComponent(XMLComponent)
-
-    /**
+    
+    /** 
      * Adds common component to the parser configuration. This method will
      * also add all of the component's recognized features and properties
      * to the list of default recognized features and properties.
@@ -1403,8 +1405,8 @@
         addRecognizedParamsAndSetDefaults(component);
 
     } // addCommonComponent(XMLComponent)
-
-    /**
+	
+    /** 
      * Adds an XML 1.1 component to the parser configuration. This method will
      * also add all of the component's recognized features and properties
      * to the list of default recognized features and properties.
@@ -1419,9 +1421,9 @@
         }
         fXML11Components.add(component);
         addRecognizedParamsAndSetDefaults(component);
-
+        
     } // addXML11Component(XMLComponent)
-
+    
     /**
      * Adds all of the component's recognized features and properties
      * to the list of default recognized features and properties, and
@@ -1432,11 +1434,11 @@
      * and properties will be added to the configuration
      */
     protected void addRecognizedParamsAndSetDefaults(XMLComponent component) {
-
+        
         // register component's recognized features
         String[] recognizedFeatures = component.getRecognizedFeatures();
         addRecognizedFeatures(recognizedFeatures);
-
+        
         // register component's recognized properties
         String[] recognizedProperties = component.getRecognizedProperties();
         addRecognizedProperties(recognizedProperties);
@@ -1476,7 +1478,7 @@
                 }
             }
         }
-    }
+    } 
 
     private void initXML11Components() {
         if (!f11Initialized) {
@@ -1495,12 +1497,12 @@
             addXML11Component(fXML11NSDocScanner);
             fXML11NSDTDValidator = new XML11NSDTDValidator();
             addXML11Component(fXML11NSDTDValidator);
-
+				
             f11Initialized = true;
         }
     }
-
-    /**
+    
+    /** 
      * Returns the state of a feature. This method calls getFeature()
      * on ParserConfigurationSettings, bypassing getFeature() on this
      * class.
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/parsers/XMLParser.java	Wed Sep 28 16:49:43 2011 +0100
@@ -27,6 +27,9 @@
 import com.sun.org.apache.xerces.internal.xni.parser.XMLInputSource;
 import com.sun.org.apache.xerces.internal.xni.parser.XMLParserConfiguration;
 
+import org.xml.sax.SAXNotSupportedException;
+import org.xml.sax.SAXNotRecognizedException;
+
 /**
  * Base class of all XML-related parsers.
  * <p>
@@ -44,6 +47,7 @@
  * @author Arnaud  Le Hors, IBM
  * @author Andy Clark, IBM
  *
+ * @version $Id: XMLParser.java,v 1.5 2007/07/20 14:11:21 spericas Exp $
  */
 public abstract class XMLParser {
 
@@ -54,11 +58,11 @@
     // properties
 
     /** Property identifier: entity resolver. */
-    protected static final String ENTITY_RESOLVER =
+    protected static final String ENTITY_RESOLVER = 
         Constants.XERCES_PROPERTY_PREFIX + Constants.ENTITY_RESOLVER_PROPERTY;
 
     /** Property identifier: error handler. */
-    protected static final String ERROR_HANDLER =
+    protected static final String ERROR_HANDLER = 
         Constants.XERCES_PROPERTY_PREFIX + Constants.ERROR_HANDLER_PROPERTY;
 
     /** Recognized properties. */
@@ -79,6 +83,15 @@
     //
 
     /**
+     * Query the state of a feature.
+     */
+    public boolean getFeature(String featureId) 
+            throws SAXNotSupportedException, SAXNotRecognizedException {
+        return fConfiguration.getFeature(featureId);
+
+    }
+    
+    /**
      * Default Constructor.
      */
     protected XMLParser(XMLParserConfiguration config) {
@@ -103,13 +116,13 @@
      * @exception XNIException
      * @exception java.io.IOException
      */
-    public void parse(XMLInputSource inputSource)
+    public void parse(XMLInputSource inputSource) 
         throws XNIException, IOException {
 
         reset();
         fConfiguration.parse(inputSource);
 
-    } // parse(XMLInputSource)
+    } // parse(XMLInputSource) 
 
     //
     // Protected methods
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/util/XMLAttributesImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/util/XMLAttributesImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -68,8 +68,8 @@
 import com.sun.org.apache.xerces.internal.xni.XMLString;
 /**
  * The XMLAttributesImpl class is an implementation of the XMLAttributes
- * interface which defines a collection of attributes for an element.
- * In the parser, the document source would scan the entire start element
+ * interface which defines a collection of attributes for an element. 
+ * In the parser, the document source would scan the entire start element 
  * and collect the attributes. The attributes are communicated to the
  * document handler in the startElement method.
  * <p>
@@ -79,10 +79,11 @@
  *
  * @see com.sun.org.apache.xerces.internal.xni.XMLDocumentHandler#startElement
  *
- * @author Andy Clark, IBM
+ * @author Andy Clark, IBM 
  * @author Elena Litani, IBM
  * @author Michael Glavassevich, IBM
  *
+ * @version $Id: XMLAttributesImpl.java,v 1.6 2009/05/13 18:13:21 spericas Exp $
  */
 public class XMLAttributesImpl
 implements XMLAttributes, XMLBufferListener {
@@ -90,16 +91,16 @@
     //
     // Constants
     //
-
+    
     /** Default table size. */
     protected static final int TABLE_SIZE = 101;
-
-    /**
+    
+    /** 
      * Threshold at which an instance is treated
      * as a large attribute list.
      */
     protected static final int SIZE_LIMIT = 20;
-
+    
     //
     // Data
     //
@@ -111,25 +112,25 @@
 
     // data
 
-    /**
-     * Usage count for the attribute table view.
+    /** 
+     * Usage count for the attribute table view. 
      * Incremented each time all attributes are removed
      * when the attribute table view is in use.
      */
     protected int fLargeCount = 1;
-
+    
     /** Attribute count. */
     protected int fLength;
 
     /** Attribute information. */
     protected Attribute[] fAttributes = new Attribute[4];
 
-    /**
-     * Hashtable of attribute information.
-     * Provides an alternate view of the attribute specification.
+    /** 
+     * Hashtable of attribute information. 
+     * Provides an alternate view of the attribute specification. 
      */
     protected Attribute[] fAttributeTableView;
-
+    
     /**
      * Tracks whether each chain in the hash table is stale
      * with respect to the current state of this object.
@@ -137,12 +138,12 @@
      * of times the attribute table view has been used.
      */
     protected int[] fAttributeTableViewChainState;
-
+    
     /**
      * Actual number of buckets in the table view.
      */
     protected int fTableViewBuckets;
-
+    
     /**
      * Indicates whether the table view contains consistent data.
      */
@@ -156,7 +157,7 @@
     public XMLAttributesImpl() {
         this(TABLE_SIZE);
     }
-
+    
     /**
      * @param tableSize initial size of table view
      */
@@ -171,7 +172,7 @@
     // Public methods
     //
 
-    /**
+    /** 
      * Sets whether namespace processing is being performed. This state
      * is needed to return the correct value from the getLocalName method.
      *
@@ -198,18 +199,18 @@
      * <strong>Note:</strong> If an attribute of the same name already
      * exists, the old values for the attribute are replaced by the new
      * values.
-     *
+     * 
      * @param name  The attribute name.
      * @param type  The attribute type. The type name is determined by
      *                  the type specified for this attribute in the DTD.
      *                  For example: "CDATA", "ID", "NMTOKEN", etc. However,
      *                  attributes of type enumeration will have the type
      *                  value specified as the pipe ('|') separated list of
-     *                  the enumeration values prefixed by an open
+     *                  the enumeration values prefixed by an open 
      *                  parenthesis and suffixed by a close parenthesis.
      *                  For example: "(true|false)".
      * @param value The attribute value.
-     *
+     * 
      * @return Returns the attribute index.
      *
      * @see #setNonNormalizedValue
@@ -222,10 +223,10 @@
 
         int index;
         if (fLength < SIZE_LIMIT) {
-            index = name.uri != null && !name.uri.equals("")
+            index = name.uri != null && !name.uri.equals("") 
                 ? getIndexFast(name.uri, name.localpart)
                 : getIndexFast(name.rawname);
-
+    
             if (index == -1) {
                 index = fLength;
                 if (fLength++ == fAttributes.length) {
@@ -238,14 +239,14 @@
                 }
             }
         }
-        else if (name.uri == null ||
-            name.uri.length() == 0 ||
+        else if (name.uri == null || 
+            name.uri.length() == 0 || 
             (index = getIndexFast(name.uri, name.localpart)) == -1) {
-
+            
             /**
              * If attributes were removed from the list after the table
              * becomes in use this isn't reflected in the table view. It's
-             * assumed that once a user starts removing attributes they're
+             * assumed that once a user starts removing attributes they're 
              * not likely to add more. We only make the view consistent if
              * the user of this class adds attributes, removes them, and
              * then adds more.
@@ -255,9 +256,9 @@
                 fIsTableViewConsistent = true;
             }
 
-            int bucket = getTableViewBucket(name.rawname);
-
-            // The chain is stale.
+            int bucket = getTableViewBucket(name.rawname); 
+        
+            // The chain is stale. 
             // This must be a unique attribute.
             if (fAttributeTableViewChainState[bucket] != fLargeCount) {
                 index = fLength;
@@ -269,13 +270,13 @@
                     }
                     fAttributes = attributes;
                 }
-
+            
                 // Update table view.
                 fAttributeTableViewChainState[bucket] = fLargeCount;
                 fAttributes[index].next = null;
                 fAttributeTableView[bucket] = fAttributes[index];
             }
-            // This chain is active.
+            // This chain is active. 
             // We need to check if any of the attributes has the same rawname.
             else {
                 // Search the table.
@@ -297,7 +298,7 @@
                         }
                         fAttributes = attributes;
                     }
-
+                 
                     // Update table view
                     fAttributes[index].next = fAttributeTableView[bucket];
                     fAttributeTableView[bucket] = fAttributes[index];
@@ -307,7 +308,7 @@
                     index = getIndexFast(name.rawname);
                 }
             }
-        }
+        }          
 
         // set values
         Attribute attribute = fAttributes[index];
@@ -321,12 +322,12 @@
         // clear augmentations
         if(attribute.augs != null)
             attribute.augs.removeAllItems();
-
+        
         return index;
 
     } // addAttribute(QName,String,XMLString)
 
-    /**
+    /** 
      * Removes all of the attributes. This method will also remove all
      * entities associated to the attributes.
      */
@@ -339,7 +340,7 @@
      * <p>
      * <strong>Note:</strong> This operation changes the indexes of all
      * attributes following the attribute at the specified index.
-     *
+     * 
      * @param attrIndex The attribute index.
      */
     public void removeAttributeAt(int attrIndex) {
@@ -357,7 +358,7 @@
 
     /**
      * Sets the name of the attribute at the specified index.
-     *
+     * 
      * @param attrIndex The attribute index.
      * @param attrName  The new attribute name.
      */
@@ -368,7 +369,7 @@
     /**
      * Sets the fields in the given QName structure with the values
      * of the attribute name at the specified index.
-     *
+     * 
      * @param attrIndex The attribute index.
      * @param attrName  The attribute name structure to fill in.
      */
@@ -378,14 +379,14 @@
 
     /**
      * Sets the type of the attribute at the specified index.
-     *
+     * 
      * @param attrIndex The attribute index.
      * @param attrType  The attribute type. The type name is determined by
      *                  the type specified for this attribute in the DTD.
      *                  For example: "CDATA", "ID", "NMTOKEN", etc. However,
      *                  attributes of type enumeration will have the type
      *                  value specified as the pipe ('|') separated list of
-     *                  the enumeration values prefixed by an open
+     *                  the enumeration values prefixed by an open 
      *                  parenthesis and suffixed by a close parenthesis.
      *                  For example: "(true|false)".
      */
@@ -396,7 +397,7 @@
     /**
      * Sets the value of the attribute at the specified index. This
      * method will overwrite the non-normalized value of the attribute.
-     *
+     * 
      * @param attrIndex The attribute index.
      * @param attrValue The new attribute value.
      *
@@ -405,7 +406,7 @@
     public void setValue(int attrIndex, String attrValue) {
         setValue(attrIndex,attrValue,null);
     }
-
+    
     public void setValue(int attrIndex, String attrValue,XMLString value) {
         Attribute attribute = fAttributes[attrIndex];
         attribute.value = attrValue;
@@ -579,7 +580,7 @@
      * @param i The index of the attribute in the list (starting at 0).
      * @return The name of the indexed attribute, or null
      *         if the index is out of range.
-     * @see #getLength
+     * @see #getLength 
      */
     public String getName(int index) {
         if (index < 0 || index >= fLength) {
@@ -609,7 +610,7 @@
         }
         return -1;
     } // getIndex(String):int
-
+    
     /**
      * Look up the index of an attribute by Namespace name.
      *
@@ -633,6 +634,25 @@
     } // getIndex(String,String):int
 
     /**
+     * Look up the index of an attribute by local name only,
+     * ignoring its namespace.
+     *
+     * @param localName The attribute's local name.
+     * @return The index of the attribute, or -1 if it does not
+     *         appear in the list.
+     */
+    public int getIndexByLocalName(String localPart) {
+        for (int i = 0; i < fLength; i++) {
+            Attribute attribute = fAttributes[i];
+            if (attribute.name.localpart != null &&
+                attribute.name.localpart.equals(localPart)) {
+                return i;
+            }
+        }
+        return -1;
+    } // getIndex(String):int
+
+    /**
      * Look up an attribute's local name by index.
      *
      * @param index The attribute index (zero-based).
@@ -667,7 +687,7 @@
         String rawname = fAttributes[index].name.rawname;
         return rawname != null ? rawname : "";
     } // getQName(int):String
-
+    
     public QName getQualifiedName(int index){
         if (index < 0 || index >= fLength) {
             return null;
@@ -698,7 +718,7 @@
     /**
      * Look up the index of an attribute by XML 1.0 qualified name.
      * <p>
-     * <strong>Note:</strong>
+     * <strong>Note:</strong> 
      * This method uses reference comparison, and thus should
      * only be used internally. We cannot use this method in any
      * code exposed to users as they may not pass in unique strings.
@@ -716,7 +736,7 @@
         }
         return -1;
     } // getIndexFast(String):int
-
+    
     /**
      * Adds an attribute. The attribute's non-normalized value of the
      * attribute will have the same value as the attribute value until
@@ -735,11 +755,11 @@
      * <strong>Caution:</strong> If this method is called it should
      * not be mixed with calls to <code>addAttribute</code> unless
      * it has been determined that all the attribute names are unique.
-     *
+     * 
      * @param name the attribute name
      * @param type the attribute type
      * @param value the attribute value
-     *
+     * 
      * @see #setNonNormalizedValue
      * @see #setSpecified
      * @see #checkDuplicatesNS
@@ -760,7 +780,7 @@
             }
             fAttributes = attributes;
         }
-
+        
         // set values
         Attribute attribute = fAttributes[index];
         attribute.name.setValues(name);
@@ -768,11 +788,11 @@
         attribute.value = value;
         attribute.nonNormalizedValue = value;
         attribute.specified = false;
-
+            
         // clear augmentations
         attribute.augs.removeAllItems();
     }
-
+    
     /**
      * Checks for duplicate expanded names (local part and namespace name
      * pairs) in the attribute specification. If a duplicate is found its
@@ -781,7 +801,7 @@
      * This should be called once all the in-scope namespaces for the element
      * enclosing these attributes is known, and after all the attributes
      * have gone through namespace binding.
-     *
+     * 
      * @return the name of a duplicate attribute found in the search,
      * otherwise null.
      */
@@ -794,14 +814,14 @@
                     Attribute att2 = fAttributes[j];
                     if (att1.name.localpart == att2.name.localpart &&
                         att1.name.uri == att2.name.uri) {
-                        return att2.name;
+                        return att2.name;       
                     }
                 }
             }
         }
         // If the list is large check duplicates using a hash table.
         else {
-            // We don't want this table view to be read if someone calls
+            // We don't want this table view to be read if someone calls 
             // addAttribute so we invalidate it up front.
             fIsTableViewConsistent = false;
 
@@ -813,15 +833,15 @@
             for (int i = fLength - 1; i >= 0; --i) {
                 attr = fAttributes[i];
                 bucket = getTableViewBucket(attr.name.localpart, attr.name.uri);
-
-                // The chain is stale.
+                
+                // The chain is stale. 
                 // This must be a unique attribute.
                 if (fAttributeTableViewChainState[bucket] != fLargeCount) {
                     fAttributeTableViewChainState[bucket] = fLargeCount;
                     attr.next = null;
                     fAttributeTableView[bucket] = attr;
-                }
-                // This chain is active.
+                } 
+                // This chain is active. 
                 // We need to check if any of the attributes has the same name.
                 else {
                     // Search the table.
@@ -833,7 +853,7 @@
                         }
                         found = found.next;
                     }
-
+                    
                     // Update table view
                     attr.next = fAttributeTableView[bucket];
                     fAttributeTableView[bucket] = attr;
@@ -842,11 +862,11 @@
         }
         return null;
     }
-
+    
     /**
      * Look up the index of an attribute by Namespace name.
      * <p>
-     * <strong>Note:</strong>
+     * <strong>Note:</strong> 
      * This method uses reference comparison, and thus should
      * only be used internally. We cannot use this method in any
      * code exposed to users as they may not pass in unique strings.
@@ -860,7 +880,7 @@
     public int getIndexFast(String uri, String localPart) {
         for (int i = 0; i < fLength; ++i) {
             Attribute attribute = fAttributes[i];
-            if (attribute.name.localpart == localPart &&
+            if (attribute.name.localpart == localPart && 
                 attribute.name.uri == uri) {
                 return i;
             }
@@ -870,7 +890,7 @@
 
     /**
      * Returns the value passed in or NMTOKEN if it's an enumerated type.
-     *
+     * 
      * @param type attribute type
      * @return the value passed in or NMTOKEN if it's an enumerated type.
      */
@@ -881,11 +901,11 @@
         }
         return type;
     }
-
+    
     /**
-     * Returns the position in the table view
+     * Returns the position in the table view 
      * where the given attribute name would be hashed.
-     *
+     * 
      * @param qname the attribute name
      * @return the position in the table view where the given attribute
      * would be hashed
@@ -893,11 +913,11 @@
     protected int getTableViewBucket(String qname) {
         return (qname.hashCode() & 0x7FFFFFFF) % fTableViewBuckets;
     }
-
+    
     /**
      * Returns the position in the table view
      * where the given attribute name would be hashed.
-     *
+     * 
      * @param localpart the local part of the attribute
      * @param uri the namespace name of the attribute
      * @return the position in the table view where the given attribute
@@ -908,11 +928,11 @@
             return (localpart.hashCode() & 0x7FFFFFFF) % fTableViewBuckets;
         }
         else {
-            return ((localpart.hashCode() + uri.hashCode())
+            return ((localpart.hashCode() + uri.hashCode()) 
                & 0x7FFFFFFF) % fTableViewBuckets;
         }
     }
-
+    
     /**
      * Purges all elements from the table view.
      */
@@ -922,12 +942,12 @@
             if (fAttributeTableViewChainState != null) {
                 for (int i = fTableViewBuckets - 1; i >= 0; --i) {
                     fAttributeTableViewChainState[i] = 0;
-                }
+                } 
             }
             fLargeCount = 1;
         }
     }
-
+    
     /**
      * Prepares the table view of the attributes list for use.
      */
@@ -940,7 +960,7 @@
             cleanTableView();
         }
     }
-
+    
     /**
      * Prepares the table view of the attributes list for use,
      * and populates it with the attributes which have been
@@ -958,7 +978,7 @@
                 fAttributeTableViewChainState[bucket] = fLargeCount;
                 attr.next = null;
                 fAttributeTableView[bucket] = attr;
-            }
+            } 
             else {
                 // Update table view
                 attr.next = fAttributeTableView[bucket];
@@ -994,32 +1014,35 @@
             return null;
         }
         String uri = fAttributes[index].name.uri;
-        return uri;
+        return uri;                        
     } // getURI(int):String
 
     /**
-     * Look up an attribute's value by Namespace name.
+     * Look up an attribute's value by Namespace name and
+     * Local name. If Namespace is null, ignore namespace
+     * comparison. If Namespace is "", map it to null as
+     * required internally by this class.
      *
      * <p>See {@link #getValue(int) getValue(int)} for a description
      * of the possible values.</p>
      *
-     * @param uri The Namespace URI, or null if the
+     * @param uri The Namespace URI, or null namespaces are ignored.
      * @param localName The local name of the attribute.
      * @return The attribute value as a string, or null if the
      *         attribute is not in the list.
      */
     public String getValue(String uri, String localName) {
-        int index = getIndex(uri, localName);
+        int index = (uri == null) ? getIndexByLocalName(localName)
+                : getIndex(uri.length() == 0 ? null : uri, localName);
         return index != -1 ? getValue(index) : null;
     } // getValue(String,String):String
 
-
     /**
      * Look up an augmentations by Namespace name.
      *
      * @param uri The Namespace URI, or null if the
      * @param localName The local name of the attribute.
-     * @return Augmentations
+     * @return Augmentations     
      */
     public Augmentations getAugmentations (String uri, String localName) {
         int index = getIndex(uri, localName);
@@ -1044,7 +1067,7 @@
 
     /**
      * Look up an augmentations by attributes index.
-     *
+     * 
      * @param attributeIndex The attribute index.
      * @return Augmentations
      */
@@ -1057,7 +1080,7 @@
 
     /**
      * Sets the augmentations of the attribute at the specified index.
-     *
+     * 
      * @param attrIndex The attribute index.
      * @param augs      The augmentations.
      */
@@ -1067,31 +1090,31 @@
 
     /**
      * Sets the uri of the attribute at the specified index.
-     *
+     * 
      * @param attrIndex The attribute index.
      * @param uri       Namespace uri
      */
     public void setURI(int attrIndex, String uri) {
         fAttributes[attrIndex].name.uri = uri;
     } // getURI(int,QName)
-
+    
     // Implementation methods
     public void setSchemaId(int attrIndex, boolean schemaId) {
         fAttributes[attrIndex].schemaId = schemaId;
     }
-
+    
     public boolean getSchemaId(int index) {
         if (index < 0 || index >= fLength) {
             return false;
         }
         return fAttributes[index].schemaId;
     }
-
+    
     public boolean getSchemaId(String qname) {
         int index = getIndex(qname);
-        return index != -1 ? fAttributes[index].schemaId : false;
+        return index != -1 ? fAttributes[index].schemaId : false; 
     } // getType(String):String
-
+    
     public boolean getSchemaId(String uri, String localName) {
         if (!fNamespaces) {
             return false;
@@ -1099,7 +1122,7 @@
         int index = getIndex(uri, localName);
         return index != -1 ? fAttributes[index].schemaId : false;
     } // getType(String,String):String
-
+    
     //XMLBufferListener methods
     /**
      * This method will be invoked by XMLEntityReader before ScannedEntities buffer
@@ -1111,9 +1134,9 @@
                 getValue(i);
             }
         }
-    }
+    }  
     public void refresh(int pos) {
-        }
+	}
 
     //
     // Classes
@@ -1125,7 +1148,7 @@
      * @author Andy Clark, IBM
      */
     static class Attribute {
-
+        
         //
         // Data
         //
@@ -1143,28 +1166,28 @@
 
         /** This will point to the ScannedEntities buffer.*/
         public XMLString xmlValue;
-
+        
         /** Non-normalized value. */
         public String nonNormalizedValue;
 
         /** Specified. */
         public boolean specified;
-
+        
         /** Schema ID type. */
         public boolean schemaId;
-
-        /**
+        
+        /** 
          * Augmentations information for this attribute.
          * XMLAttributes has no knowledge if any augmentations
          * were attached to Augmentations.
          */
         public Augmentations augs = new AugmentationsImpl();
-
+        
         // Additional data for attribute table view
-
+        
         /** Pointer to the next attribute in the chain. **/
         public Attribute next;
-
+        
     } // class Attribute
 
 } // class XMLAttributesImpl
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/xni/parser/XMLConfigurationException.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/xni/parser/XMLConfigurationException.java	Wed Sep 28 16:49:43 2011 +0100
@@ -29,13 +29,14 @@
  *
  * @author Andy Clark, IBM
  *
+ * @version $Id: XMLConfigurationException.java,v 1.5 2009/07/28 23:48:32 joehw Exp $
  */
 public class XMLConfigurationException
     extends XNIException {
 
     /** Serialization version. */
     static final long serialVersionUID = -5437427404547669188L;
-
+    
     //
     // Constants
     //
@@ -46,6 +47,9 @@
     /** Exception type: identifier not supported. */
     public static final short NOT_SUPPORTED = 1;
 
+    /** Exception type: feature-change not allowed. */
+    public static final short NOT_ALLOWED = 2;
+    
     //
     // Data
     //
@@ -60,7 +64,7 @@
     // Constructors
     //
 
-    /**
+    /** 
      * Constructs a configuration exception with the specified type
      * and feature/property identifier.
      *
@@ -76,7 +80,7 @@
         fIdentifier = identifier;
     } // <init>(short,String)
 
-    /**
+    /** 
      * Constructs a configuration exception with the specified type,
      * feature/property identifier, and error message
      *
@@ -98,8 +102,8 @@
     // Public methods
     //
 
-    /**
-     * Returns the exception type.
+    /** 
+     * Returns the exception type. 
      *
      * @see #NOT_RECOGNIZED
      * @see #NOT_SUPPORTED
--- a/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xerces/internal/xpointer/ElementSchemePointer.java	Wed Sep 28 16:49:43 2011 +0100
@@ -36,7 +36,8 @@
  * </p>
  *
  * @xerces.internal
- *
+ * 
+ * @version $Id: ElementSchemePointer.java,v 1.4 2009/06/11 23:51:50 joehw Exp $
  *
  */
 class ElementSchemePointer implements XPointerPart {
@@ -52,17 +53,17 @@
     // The scheme Data & child sequence
     private String fShortHandPointerName;
 
-    // Should we attempt to resolve the ChildSequence from the
+    // Should we attempt to resolve the ChildSequence from the 
     // current element position. If a ShortHand Pointer is present
     // attempt to resolve relative to the short hand pointer.
     private boolean fIsResolveElement = false;
 
     // Has the element been found
     private boolean fIsElementFound = false;
-
+    
     // Was only an empty element found
     private boolean fWasOnlyEmptyElementFound = false;
-
+    
     // If a shorthand pointer is present and resolved
     boolean fIsShortHand = false;
 
@@ -116,10 +117,10 @@
     // XPointerPart implementation
     // ************************************************************************
 
-    /**
+    /** 
      * Parses the XPointer expression and tokenizes it into Strings
-     * delimited by whitespace.
-     *
+     * delimited by whitespace.   
+     *   
      * @see com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor#parseXPointer(java.lang.String)
      */
     public void parseXPointer(String xpointer) throws XNIException {
@@ -152,13 +153,13 @@
         if (!success) {
             reportError("InvalidElementSchemeXPointer",
                     new Object[] { xpointer });
-        }
+        }    
 
-        // Initialize a temp arrays to the size of token count which should
+        // Initialize a temp arrays to the size of token count which should 
         // be atleast twice the size of child sequence, to hold the ChildSequence.
         int tmpChildSequence[] = new int[tokens.getTokenCount() / 2 + 1];
 
-        // the element depth
+        // the element depth          
         int i = 0;
 
         // Traverse the scanned tokens
@@ -208,7 +209,7 @@
 
     /**
      * Returns the scheme data
-     *
+     * 
      * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#getSchemeData()
      */
     public String getSchemeData() {
@@ -217,7 +218,7 @@
 
     /**
      * Sets the scheme name
-     *
+     * 
      * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#setSchemeName(java.lang.String)
      */
     public void setSchemeName(String schemeName) {
@@ -227,7 +228,7 @@
 
     /**
      * Sets the scheme data
-     *
+     * 
      * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#setSchemeData(java.lang.String)
      */
     public void setSchemeData(String schemeData) {
@@ -238,7 +239,7 @@
      * Responsible for resolving the element() scheme XPointer.  If a ShortHand
      * Pointer is present and it is successfully resolved and if a child
      * sequence is present, the child sequence is resolved relative to it.
-     *
+     *   
      * @see com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor#resolveXPointer(com.sun.org.apache.xerces.internal.xni.QName, com.sun.org.apache.xerces.internal.xni.XMLAttributes, com.sun.org.apache.xerces.internal.xni.Augmentations, int event)
      */
     public boolean resolveXPointer(QName element, XMLAttributes attributes,
@@ -280,15 +281,15 @@
     /**
      * Matches the current element position in the document tree with the
      * element position specified in the element XPointer scheme.
-     *
+     *   
      * @param event
-     * @return boolean - true if the current element position in the document
-     * tree matches theelement position specified in the element XPointer
+     * @return boolean - true if the current element position in the document 
+     * tree matches theelement position specified in the element XPointer 
      * scheme.
      */
     protected boolean matchChildSequence(QName element, int event)
             throws XNIException {
-
+    	
         // need to resize fCurrentChildSequence
         if (fCurrentChildDepth >= fCurrentChildSequence.length) {
             int tmpCurrentChildSequence[] = new int[fCurrentChildSequence.length];
@@ -301,14 +302,15 @@
                     0, tmpCurrentChildSequence.length);
         }
 
-        //
+        //     
         if (fIsResolveElement) {
             // start
+            fWasOnlyEmptyElementFound = false;
             if (event == XPointerPart.EVENT_ELEMENT_START) {
                 fCurrentChildSequence[fCurrentChildDepth] = fCurrentChildPosition;
                 fCurrentChildDepth++;
 
-                // reset the current child position
+                // reset the current child position 
                 fCurrentChildPosition = 1;
 
                 //if (!fSchemeNameFound) {
@@ -336,14 +338,14 @@
 
                 fCurrentChildDepth--;
                 fCurrentChildPosition = fCurrentChildSequence[fCurrentChildDepth] + 1;
-
+                
             } else if (event == XPointerPart.EVENT_ELEMENT_EMPTY) {
 
                 fCurrentChildSequence[fCurrentChildDepth] = fCurrentChildPosition;
                 fCurrentChildPosition++;
 
-                // Donot check for empty elements if the empty element is
-                // a child of a found parent element
+                // Donot check for empty elements if the empty element is 
+                // a child of a found parent element 
                 //if (!fIsElementFound) {
                     if (checkMatch()) {
                         fIsElementFound = true;
@@ -351,8 +353,8 @@
                     } else {
                         fIsElementFound = false;
                     }
-                //}
-
+                //} 
+                
             }
         }
 
@@ -360,11 +362,11 @@
     }
 
     /**
-     * Matches the current position of the element being visited by checking
-     * its position and previous elements against the element XPointer expression.
+     * Matches the current position of the element being visited by checking 
+     * its position and previous elements against the element XPointer expression.  
      * If a match is found it return true else false.
-     *
-     * @return boolean
+     *  
+     * @return boolean 
      */
     protected boolean checkMatch() {
         // If the number of elements in the ChildSequence is greater than the
@@ -385,7 +387,7 @@
         } else {
             // If a shorthand pointer is present traverse the children
             // ignoring the first element of the CurrenChildSequence which
-            // contains the ShortHand pointer element and compare
+            // contains the ShortHand pointer element and compare            
             if (fChildSequence.length <= fCurrentChildDepth + 1) {
 
                 for (int i = 0; i < fChildSequence.length; i++) {
@@ -411,7 +413,7 @@
     /**
      * Returns true if the node matches or is a child of a matching element()
      * scheme XPointer.
-     *
+     *  
      * @see com.sun.org.apache.xerces.internal.xpointer.XPointerProcessor#isFragmentResolved()
      */
     public boolean isFragmentResolved() throws XNIException {
@@ -422,32 +424,32 @@
 
     /**
      * Returns true if the XPointer expression resolves to a non-element child
-     * of the current resource fragment.
-     *
+     * of the current resource fragment.       
+     * 
      * @see com.sun.org.apache.xerces.internal.xpointer.XPointerPart#isChildFragmentResolved()
-     *
-     */
+     *   
+     */    
     public boolean isChildFragmentResolved() {
-        // if only a shorthand pointer was present
-        if (fIsShortHand && fShortHandPointer != null && fChildSequence.length <= 0) {
-                return fShortHandPointer.isChildFragmentResolved();
-        } else {
-                return fWasOnlyEmptyElementFound ? !fWasOnlyEmptyElementFound
-                                : (fIsFragmentResolved && (fCurrentChildDepth >= fFoundDepth));
-        }
+    	// if only a shorthand pointer was present
+    	if (fIsShortHand && fShortHandPointer != null && fChildSequence.length <= 0) {
+    		return fShortHandPointer.isChildFragmentResolved();
+    	} else {
+    		return fWasOnlyEmptyElementFound ? !fWasOnlyEmptyElementFound
+    				: (fIsFragmentResolved && (fCurrentChildDepth >= fFoundDepth));
+    	}
     }
-
+    
     /**
-         * Reports an XPointer error
-         */
+	 * Reports an XPointer error
+	 */
     protected void reportError(String key, Object[] arguments)
             throws XNIException {
-        /*fErrorReporter.reportError(XPointerMessageFormatter.XPOINTER_DOMAIN,
-         key, arguments, XMLErrorReporter.SEVERITY_ERROR);
-         */
-        throw new XNIException((fErrorReporter
-                        .getMessageFormatter(XPointerMessageFormatter.XPOINTER_DOMAIN))
-                                .formatMessage(fErrorReporter.getLocale(), key, arguments));
+    	/*fErrorReporter.reportError(XPointerMessageFormatter.XPOINTER_DOMAIN,
+    	 key, arguments, XMLErrorReporter.SEVERITY_ERROR);
+    	 */        
+    	throw new XNIException((fErrorReporter
+    			.getMessageFormatter(XPointerMessageFormatter.XPOINTER_DOMAIN))
+				.formatMessage(fErrorReporter.getLocale(), key, arguments));
     }
 
     /**
@@ -480,7 +482,7 @@
         fCurrentChildDepth = 0;
         fIsFragmentResolved = false;
         fShortHandPointer = null;
-
+        
         initErrorReporter();
     }
 
@@ -490,18 +492,19 @@
 
     /**
      * List of XPointer Framework tokens.
-     *
+     * 
      * @xerces.internal
-     *
+     * 
      * @author Neil Delima, IBM
-     *
+     * @version $Id: ElementSchemePointer.java,v 1.4 2009/06/11 23:51:50 joehw Exp $
+     * 
      */
     private final class Tokens {
 
         /**
          * XPointer element() scheme
-         * [1]    ElementSchemeData    ::=    (NCName ChildSequence?) | ChildSequence
-         * [2]    ChildSequence    ::=    ('/' [1-9] [0-9]*)+
+         * [1]    ElementSchemeData    ::=    (NCName ChildSequence?) | ChildSequence  
+         * [2]    ChildSequence    ::=    ('/' [1-9] [0-9]*)+ 
          */
         private static final int XPTRTOKEN_ELEM_NCNAME = 0;
 
@@ -526,8 +529,8 @@
         private Hashtable fTokenNames = new Hashtable();
 
         /**
-         * Constructor
-         *
+         * Constructor 
+         * 
          * @param symbolTable SymbolTable
          */
         private Tokens(SymbolTable symbolTable) {
@@ -540,7 +543,7 @@
         }
 
         /*
-         * Returns the token String
+         * Returns the token String 
          * @param token The index of the token
          * @return String The token string
          */
@@ -549,7 +552,7 @@
         }
 
         /**
-         * Returns the token String
+         * Returns the token String 
          * @param token The index of the token
          * @return String The token string
          */
@@ -559,7 +562,7 @@
 
         /**
          * Add the specified string as a token
-         *
+         *  
          * @param token The token string
          */
         private void addToken(String tokenStr) {
@@ -573,7 +576,7 @@
 
         /**
          * Add the specified int token
-         *
+         *  
          * @param token The int specifying the token
          */
         private void addToken(int token) {
@@ -606,7 +609,7 @@
         /**
          * Obtains the token at the current position, then advance
          * the current position by one.
-         *
+         * 
          * If there's no such next token, this method throws
          * <tt>new XNIException("InvalidXPointerExpression");</tt>.
          */
@@ -619,7 +622,7 @@
         /**
          * Obtains the token at the current position, without advancing
          * the current position.
-         *
+         * 
          * If there's no such next token, this method throws
          * <tt>new XNIException("InvalidXPointerExpression");</tt>.
          */
@@ -631,9 +634,9 @@
 
         /**
          * Obtains the token at the current position as a String.
-         *
+         * 
          * If there's no current token or if the current token
-         * is not a string token, this method throws
+         * is not a string token, this method throws 
          * If there's no such next token, this method throws
          * <tt>new XNIException("InvalidXPointerExpression");</tt>.
          */
@@ -646,7 +649,7 @@
 
         /**
          * Returns the number of tokens.
-         *
+         * 
          */
         private int getTokenCount() {
             return fTokenCount;
@@ -654,11 +657,12 @@
     }
 
     /**
-     *
+     * 
      * The XPointer expression scanner.  Scans the XPointer framework expression.
-     *
+     * 
      * @xerces.internal
-     *
+     * 
+     * @version $Id: ElementSchemePointer.java,v 1.4 2009/06/11 23:51:50 joehw Exp $
      */
     private class Scanner {
 
@@ -707,10 +711,10 @@
         // Constructors
         //
 
-        /**
-         * Constructs an XPath expression scanner.
+        /** 
+         * Constructs an XPath expression scanner. 
          *
-         * @param symbolTable SymbolTable
+         * @param symbolTable SymbolTable  
          */
         private Scanner(SymbolTable symbolTable) {
             // save pool and tokens
@@ -720,7 +724,7 @@
 
         /**
          * Scans the XPointer Expression
-         *
+         * 
          */
         private boolean scanExpr(SymbolTable symbolTable, Tokens tokens,
                 String data, int currentOffset, int endOffset)
@@ -739,10 +743,10 @@
                 byte chartype = (ch >= 0x80) ? CHARTYPE_NONASCII
                         : fASCIICharMap[ch];
 
-                //
-                // [1]    ElementSchemeData    ::=    (NCName ChildSequence?) | ChildSequence
-                // [2]    ChildSequence    ::=    ('/' [1-9] [0-9]*)+
-                //
+                // 
+                // [1]    ElementSchemeData    ::=    (NCName ChildSequence?) | ChildSequence  
+                // [2]    ChildSequence    ::=    ('/' [1-9] [0-9]*)+ 
+                //  
 
                 switch (chartype) {
 
@@ -755,7 +759,7 @@
                     addToken(tokens, Tokens.XPTRTOKEN_ELEM_CHILD);
                     ch = data.charAt(currentOffset);
 
-                    // ChildSequence    ::=    ('/' [1-9] [0-9]*)+
+                    // ChildSequence    ::=    ('/' [1-9] [0-9]*)+                    
                     int child = 0;
                     while (ch >= '0' && ch <= '9') {
                         child = (child * 10) + (ch - '0');
@@ -783,7 +787,7 @@
                 case CHARTYPE_OTHER:
                 case CHARTYPE_PERIOD:
                 case CHARTYPE_UNDERSCORE:
-                    // Scan the ShortHand Pointer NCName
+                    // Scan the ShortHand Pointer NCName 
                     nameOffset = currentOffset;
                     currentOffset = scanNCName(data, endOffset, currentOffset);
 
@@ -811,14 +815,14 @@
             return true;
         }
 
-        /**
-         * Scans a NCName.
-         * From Namespaces in XML
+        /** 
+         * Scans a NCName.  
+         * From Namespaces in XML 
          * [5] NCName ::= (Letter | '_') (NCNameChar)*
          * [6] NCNameChar ::= Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
-         *
+         * 
          * @param data A String containing the XPointer expression
-         * @param endOffset The int XPointer expression length
+         * @param endOffset The int XPointer expression length  
          * @param currentOffset An int representing the current position of the XPointer expression pointer
          */
         private int scanNCName(String data, int endOffset, int currentOffset) {
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.7 2008/04/02 00:41:00 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = 5122054096615067992L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/ref/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/dtm/ref/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.7 2008/04/02 00:41:01 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = 7772782876036961354L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/resolver/Catalog.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/resolver/Catalog.java	Wed Sep 28 16:49:43 2011 +0100
@@ -188,6 +188,7 @@
  * @author Norman Walsh
  * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
  *
+ * @version 1.0
  *
  * <p>Derived from public domain code originally published by Arbortext,
  * Inc.</p>
@@ -405,11 +406,11 @@
     SAXCatalogReader saxReader = new SAXCatalogReader(spf);
 
     saxReader.setCatalogParser(null, "XMLCatalog",
-                               "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
+			       "com.sun.org.apache.xml.internal.resolver.readers.XCatalogReader");
 
     saxReader.setCatalogParser(OASISXMLCatalogReader.namespaceName,
-                               "catalog",
-                               "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
+			       "catalog",
+			       "com.sun.org.apache.xml.internal.resolver.readers.OASISXMLCatalogReader");
 
     addReader("application/xml", saxReader);
 
@@ -477,8 +478,8 @@
       String mimeType = (String) mapArr.get(count);
       Integer pos = (Integer) readerMap.get(mimeType);
       newCatalog.addReader(mimeType,
-                           (CatalogReader)
-                           readerArr.get(pos.intValue()));
+			   (CatalogReader)
+			   readerArr.get(pos.intValue()));
     }
   }
 
@@ -559,7 +560,7 @@
     Vector catalogs = catalogManager.getCatalogFiles();
     if (catalogs != null) {
       for (int count = 0; count < catalogs.size(); count++) {
-        catalogFiles.addElement(catalogs.elementAt(count));
+	catalogFiles.addElement(catalogs.elementAt(count));
       }
     }
 
@@ -673,7 +674,7 @@
       CatalogReader reader = (CatalogReader) readerArr.get(count);
 
       try {
-        inStream = new DataInputStream(aUrl.openStream());
+      	inStream = new DataInputStream(aUrl.openStream());
       } catch (FileNotFoundException fnfe) {
         // No catalog; give up!
         break;
@@ -692,9 +693,9 @@
       }
 
       try {
-        inStream.close();
+      	inStream.close();
       } catch (IOException e) {
-        //nop
+      	//nop
       }
     }
 
@@ -716,13 +717,13 @@
       Vector newQueue = new Vector();
       Enumeration q = localCatalogFiles.elements();
       while (q.hasMoreElements()) {
-        newQueue.addElement(q.nextElement());
+	newQueue.addElement(q.nextElement());
       }
 
       // Put the rest of the catalogs on the end of the new list
       for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
-        String catfile = (String) catalogFiles.elementAt(curCat);
-        newQueue.addElement(catfile);
+	String catfile = (String) catalogFiles.elementAt(curCat);
+	newQueue.addElement(catfile);
       }
 
       catalogFiles = newQueue;
@@ -735,7 +736,7 @@
     if (catalogFiles.isEmpty() && !localDelegate.isEmpty()) {
       Enumeration e = localDelegate.elements();
       while (e.hasMoreElements()) {
-        catalogEntries.addElement(e.nextElement());
+	catalogEntries.addElement(e.nextElement());
       }
       localDelegate.clear();
     }
@@ -746,50 +747,50 @@
     while (!catalogFiles.isEmpty()) {
       String catfile = (String) catalogFiles.elementAt(0);
       try {
-        catalogFiles.remove(0);
+	catalogFiles.remove(0);
       } catch (ArrayIndexOutOfBoundsException e) {
-        // can't happen
+	// can't happen
       }
 
       if (catalogEntries.size() == 0 && catalogs.size() == 0) {
-        // We haven't parsed any catalogs yet, let this
-        // catalog be the first...
-        try {
-          parseCatalogFile(catfile);
-        } catch (CatalogException ce) {
-          System.out.println("FIXME: " + ce.toString());
-        }
+	// We haven't parsed any catalogs yet, let this
+	// catalog be the first...
+	try {
+	  parseCatalogFile(catfile);
+	} catch (CatalogException ce) {
+	  System.out.println("FIXME: " + ce.toString());
+	}
       } else {
-        // This is a subordinate catalog. We save its name,
-        // but don't bother to load it unless it's necessary.
-        catalogs.addElement(catfile);
+	// This is a subordinate catalog. We save its name,
+	// but don't bother to load it unless it's necessary.
+	catalogs.addElement(catfile);
       }
 
       if (!localCatalogFiles.isEmpty()) {
-        // Move all the localCatalogFiles into the front of
-        // the catalogFiles queue
-        Vector newQueue = new Vector();
-        Enumeration q = localCatalogFiles.elements();
-        while (q.hasMoreElements()) {
-          newQueue.addElement(q.nextElement());
-        }
+	// Move all the localCatalogFiles into the front of
+	// the catalogFiles queue
+	Vector newQueue = new Vector();
+	Enumeration q = localCatalogFiles.elements();
+	while (q.hasMoreElements()) {
+	  newQueue.addElement(q.nextElement());
+	}
 
-        // Put the rest of the catalogs on the end of the new list
-        for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
-          catfile = (String) catalogFiles.elementAt(curCat);
-          newQueue.addElement(catfile);
-        }
+	// Put the rest of the catalogs on the end of the new list
+	for (int curCat = 0; curCat < catalogFiles.size(); curCat++) {
+	  catfile = (String) catalogFiles.elementAt(curCat);
+	  newQueue.addElement(catfile);
+	}
 
-        catalogFiles = newQueue;
-        localCatalogFiles.clear();
+	catalogFiles = newQueue;
+	localCatalogFiles.clear();
       }
 
       if (!localDelegate.isEmpty()) {
-        Enumeration e = localDelegate.elements();
-        while (e.hasMoreElements()) {
-          catalogEntries.addElement(e.nextElement());
-        }
-        localDelegate.clear();
+	Enumeration e = localDelegate.elements();
+	while (e.hasMoreElements()) {
+	  catalogEntries.addElement(e.nextElement());
+	}
+	localDelegate.clear();
       }
     }
 
@@ -829,11 +830,11 @@
       base = new URL(catalogCwd, fixSlashes(fileName));
     } catch (MalformedURLException e) {
       try {
-        base = new URL("file:" + fixSlashes(fileName));
+	base = new URL("file:" + fixSlashes(fileName));
       } catch (MalformedURLException e2) {
-        catalogManager.debug.message(1, "Malformed URL on catalog filename",
-                      fixSlashes(fileName));
-        base = null;
+	catalogManager.debug.message(1, "Malformed URL on catalog filename",
+		      fixSlashes(fileName));
+	base = null;
       }
     }
 
@@ -850,38 +851,38 @@
       CatalogReader reader = (CatalogReader) readerArr.get(count);
 
       try {
-        notFound = false;
-        inStream = new DataInputStream(base.openStream());
+	notFound = false;
+	inStream = new DataInputStream(base.openStream());
       } catch (FileNotFoundException fnfe) {
-        // No catalog; give up!
-        notFound = true;
-        break;
+	// No catalog; give up!
+	notFound = true;
+	break;
       }
 
       try {
-        reader.readCatalog(this, inStream);
-        parsed = true;
+	reader.readCatalog(this, inStream);
+	parsed = true;
       } catch (CatalogException ce) {
-        if (ce.getExceptionType() == CatalogException.PARSE_FAILED) {
-          // give up!
-          break;
-        } else {
-          // try again!
-        }
+	if (ce.getExceptionType() == CatalogException.PARSE_FAILED) {
+	  // give up!
+	  break;
+	} else {
+	  // try again!
+	}
       }
 
       try {
-        inStream.close();
+	inStream.close();
       } catch (IOException e) {
-        //nop
+	//nop
       }
     }
 
     if (!parsed) {
       if (notFound) {
-        catalogManager.debug.message(3, "Catalog does not exist", fileName);
+	catalogManager.debug.message(3, "Catalog does not exist", fileName);
       } else {
-        catalogManager.debug.message(1, "Failed to parse catalog", fileName);
+	catalogManager.debug.message(1, "Failed to parse catalog", fileName);
       }
     }
   }
@@ -904,26 +905,26 @@
       URL newbase = null;
 
       if (base == null) {
-        catalogManager.debug.message(5, "BASE CUR", "null");
+	catalogManager.debug.message(5, "BASE CUR", "null");
       } else {
-        catalogManager.debug.message(5, "BASE CUR", base.toString());
+	catalogManager.debug.message(5, "BASE CUR", base.toString());
       }
       catalogManager.debug.message(4, "BASE STR", value);
 
       try {
-        value = fixSlashes(value);
-        newbase = new URL(base, value);
+	value = fixSlashes(value);
+	newbase = new URL(base, value);
       } catch (MalformedURLException e) {
-        try {
-          newbase = new URL("file:" + value);
-        } catch (MalformedURLException e2) {
-          catalogManager.debug.message(1, "Malformed URL on base", value);
-          newbase = null;
-        }
+	try {
+	  newbase = new URL("file:" + value);
+	} catch (MalformedURLException e2) {
+	  catalogManager.debug.message(1, "Malformed URL on base", value);
+	  newbase = null;
+	}
       }
 
       if (newbase != null) {
-        base = newbase;
+	base = newbase;
       }
 
       catalogManager.debug.message(5, "BASE NEW", base.toString());
@@ -1144,14 +1145,14 @@
       Catalog c = null;
 
       try {
-        c = (Catalog) catalogs.elementAt(catPos);
+	c = (Catalog) catalogs.elementAt(catPos);
       } catch (ClassCastException e) {
-        String catfile = (String) catalogs.elementAt(catPos);
-        c = newCatalog();
+	String catfile = (String) catalogs.elementAt(catPos);
+	c = newCatalog();
 
-        c.parseCatalog(catfile);
-        catalogs.setElementAt(c, catPos);
-        c.parseAllCatalogs();
+	c.parseCatalog(catfile);
+	catalogs.setElementAt(c, catPos);
+	c.parseAllCatalogs();
       }
     }
 
@@ -1160,10 +1161,10 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == DELEGATE_PUBLIC
-          || e.getEntryType() == DELEGATE_SYSTEM
-          || e.getEntryType() == DELEGATE_URI) {
-        Catalog dcat = newCatalog();
-        dcat.parseCatalog(e.getEntryArg(1));
+	  || e.getEntryType() == DELEGATE_SYSTEM
+	  || e.getEntryType() == DELEGATE_URI) {
+	Catalog dcat = newCatalog();
+	dcat.parseCatalog(e.getEntryArg(1));
       }
     }
   }
@@ -1186,13 +1187,13 @@
    * @throws IOException Error reading subordinate catalog file.
    */
   public String resolveDoctype(String entityName,
-                               String publicId,
-                               String systemId)
+			       String publicId,
+			       String systemId)
     throws MalformedURLException, IOException {
     String resolved = null;
 
     catalogManager.debug.message(3, "resolveDoctype("
-                  +entityName+","+publicId+","+systemId+")");
+		  +entityName+","+publicId+","+systemId+")");
 
     systemId = normalizeURI(systemId);
 
@@ -1203,11 +1204,11 @@
     if (systemId != null && systemId.startsWith("urn:publicid:")) {
       systemId = PublicId.decodeURN(systemId);
       if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
+	catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
+	systemId = null;
       } else {
-        publicId = systemId;
-        systemId = null;
+	publicId = systemId;
+	systemId = null;
       }
     }
 
@@ -1215,18 +1216,18 @@
       // If there's a SYSTEM entry in this catalog, use it
       resolved = resolveLocalSystem(systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
     if (publicId != null) {
       // If there's a PUBLIC entry in this catalog, use it
       resolved = resolveLocalPublic(DOCTYPE,
-                                    entityName,
-                                    publicId,
-                                    systemId);
+				    entityName,
+				    publicId,
+				    systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
@@ -1236,23 +1237,23 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
+	over = e.getEntryArg(0).equalsIgnoreCase("YES");
+	continue;
       }
 
       if (e.getEntryType() == DOCTYPE
-          && e.getEntryArg(0).equals(entityName)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
+	  && e.getEntryArg(0).equals(entityName)) {
+	if (over || systemId == null) {
+	  return e.getEntryArg(1);
+	}
       }
     }
 
     // Otherwise, look in the subordinate catalogs
     return resolveSubordinateCatalogs(DOCTYPE,
-                                      entityName,
-                                      publicId,
-                                      systemId);
+				      entityName,
+				      publicId,
+				      systemId);
   }
 
   /**
@@ -1274,12 +1275,12 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == DOCUMENT) {
-        return e.getEntryArg(0);
+	return e.getEntryArg(0);
       }
     }
 
     return resolveSubordinateCatalogs(DOCUMENT,
-                                      null, null, null);
+				      null, null, null);
   }
 
   /**
@@ -1299,13 +1300,13 @@
    * @throws IOException Error reading subordinate catalog file.
    */
   public String resolveEntity(String entityName,
-                              String publicId,
-                              String systemId)
+			      String publicId,
+			      String systemId)
     throws MalformedURLException, IOException {
     String resolved = null;
 
     catalogManager.debug.message(3, "resolveEntity("
-                  +entityName+","+publicId+","+systemId+")");
+		  +entityName+","+publicId+","+systemId+")");
 
     systemId = normalizeURI(systemId);
 
@@ -1316,11 +1317,11 @@
     if (systemId != null && systemId.startsWith("urn:publicid:")) {
       systemId = PublicId.decodeURN(systemId);
       if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
+	catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
+	systemId = null;
       } else {
-        publicId = systemId;
-        systemId = null;
+	publicId = systemId;
+	systemId = null;
       }
     }
 
@@ -1328,18 +1329,18 @@
       // If there's a SYSTEM entry in this catalog, use it
       resolved = resolveLocalSystem(systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
     if (publicId != null) {
       // If there's a PUBLIC entry in this catalog, use it
       resolved = resolveLocalPublic(ENTITY,
-                                    entityName,
-                                    publicId,
-                                    systemId);
+				    entityName,
+				    publicId,
+				    systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
@@ -1349,23 +1350,23 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
+	over = e.getEntryArg(0).equalsIgnoreCase("YES");
+	continue;
       }
 
       if (e.getEntryType() == ENTITY
-          && e.getEntryArg(0).equals(entityName)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
+	  && e.getEntryArg(0).equals(entityName)) {
+	if (over || systemId == null) {
+	  return e.getEntryArg(1);
+	}
       }
     }
 
     // Otherwise, look in the subordinate catalogs
     return resolveSubordinateCatalogs(ENTITY,
-                                      entityName,
-                                      publicId,
-                                      systemId);
+				      entityName,
+				      publicId,
+				      systemId);
   }
 
   /**
@@ -1385,13 +1386,13 @@
    * @throws IOException Error reading subordinate catalog file.
    */
   public String resolveNotation(String notationName,
-                                String publicId,
-                                String systemId)
+				String publicId,
+				String systemId)
     throws MalformedURLException, IOException {
     String resolved = null;
 
     catalogManager.debug.message(3, "resolveNotation("
-                  +notationName+","+publicId+","+systemId+")");
+		  +notationName+","+publicId+","+systemId+")");
 
     systemId = normalizeURI(systemId);
 
@@ -1402,11 +1403,11 @@
     if (systemId != null && systemId.startsWith("urn:publicid:")) {
       systemId = PublicId.decodeURN(systemId);
       if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
+	catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
+	systemId = null;
       } else {
-        publicId = systemId;
-        systemId = null;
+	publicId = systemId;
+	systemId = null;
       }
     }
 
@@ -1414,18 +1415,18 @@
       // If there's a SYSTEM entry in this catalog, use it
       resolved = resolveLocalSystem(systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
     if (publicId != null) {
       // If there's a PUBLIC entry in this catalog, use it
       resolved = resolveLocalPublic(NOTATION,
-                                    notationName,
-                                    publicId,
-                                    systemId);
+				    notationName,
+				    publicId,
+				    systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
@@ -1435,23 +1436,23 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
+	over = e.getEntryArg(0).equalsIgnoreCase("YES");
+	continue;
       }
 
       if (e.getEntryType() == NOTATION
-          && e.getEntryArg(0).equals(notationName)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
+	  && e.getEntryArg(0).equals(notationName)) {
+	if (over || systemId == null) {
+	  return e.getEntryArg(1);
+	}
       }
     }
 
     // Otherwise, look in the subordinate catalogs
     return resolveSubordinateCatalogs(NOTATION,
-                                      notationName,
-                                      publicId,
-                                      systemId);
+				      notationName,
+				      publicId,
+				      systemId);
   }
 
   /**
@@ -1477,7 +1478,7 @@
    * match is not found in the catalog, instead null is returned
    * to indicate that no match was found.
    */
-  public String resolvePublic(String publicId, String systemId)
+  public String resolvePublic(String publicId, String systemId) 
     throws MalformedURLException, IOException {
 
     catalogManager.debug.message(3, "resolvePublic("+publicId+","+systemId+")");
@@ -1491,11 +1492,11 @@
     if (systemId != null && systemId.startsWith("urn:publicid:")) {
       systemId = PublicId.decodeURN(systemId);
       if (publicId != null && !publicId.equals(systemId)) {
-        catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
-        systemId = null;
+	catalogManager.debug.message(1, "urn:publicid: system identifier differs from public identifier; using public identifier");
+	systemId = null;
       } else {
-        publicId = systemId;
-        systemId = null;
+	publicId = systemId;
+	systemId = null;
       }
     }
 
@@ -1503,24 +1504,24 @@
     if (systemId != null) {
       String resolved = resolveLocalSystem(systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
     // If there's a PUBLIC entry in this catalog, use it
     String resolved = resolveLocalPublic(PUBLIC,
-                                         null,
-                                         publicId,
-                                         systemId);
+					 null,
+					 publicId,
+					 systemId);
     if (resolved != null) {
       return resolved;
     }
 
     // Otherwise, look in the subordinate catalogs
     return resolveSubordinateCatalogs(PUBLIC,
-                                      null,
-                                      publicId,
-                                      systemId);
+				      null,
+				      publicId,
+				      systemId);
   }
 
   /**
@@ -1572,9 +1573,9 @@
    * to indicate that no match was found.
    */
   protected synchronized String resolveLocalPublic(int entityType,
-                                                   String entityName,
-                                                   String publicId,
-                                                   String systemId)
+						   String entityName,
+						   String publicId,
+						   String systemId)
     throws MalformedURLException, IOException {
 
     // Always normalize the public identifier before attempting a match
@@ -1584,7 +1585,7 @@
     if (systemId != null) {
       String resolved = resolveLocalSystem(systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
@@ -1594,15 +1595,15 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
+	over = e.getEntryArg(0).equalsIgnoreCase("YES");
+	continue;
       }
 
       if (e.getEntryType() == PUBLIC
-          && e.getEntryArg(0).equals(publicId)) {
-        if (over || systemId == null) {
-          return e.getEntryArg(1);
-        }
+	  && e.getEntryArg(0).equals(publicId)) {
+	if (over || systemId == null) {
+	  return e.getEntryArg(1);
+	}
       }
     }
 
@@ -1613,19 +1614,19 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == OVERRIDE) {
-        over = e.getEntryArg(0).equalsIgnoreCase("YES");
-        continue;
+	over = e.getEntryArg(0).equalsIgnoreCase("YES");
+	continue;
       }
 
       if (e.getEntryType() == DELEGATE_PUBLIC
-          && (over || systemId == null)) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= publicId.length()
-            && p.equals(publicId.substring(0, p.length()))) {
-          // delegate this match to the other catalog
+	  && (over || systemId == null)) {
+	String p = (String) e.getEntryArg(0);
+	if (p.length() <= publicId.length()
+	    && p.equals(publicId.substring(0, p.length()))) {
+	  // delegate this match to the other catalog
 
-          delCats.addElement(e.getEntryArg(1));
-        }
+	  delCats.addElement(e.getEntryArg(1));
+	}
       }
     }
 
@@ -1633,19 +1634,19 @@
       Enumeration enCats = delCats.elements();
 
       if (catalogManager.debug.getDebug() > 1) {
-        catalogManager.debug.message(2, "Switching to delegated catalog(s):");
-        while (enCats.hasMoreElements()) {
-          String delegatedCatalog = (String) enCats.nextElement();
-          catalogManager.debug.message(2, "\t" + delegatedCatalog);
-        }
+	catalogManager.debug.message(2, "Switching to delegated catalog(s):");
+	while (enCats.hasMoreElements()) {
+	  String delegatedCatalog = (String) enCats.nextElement();
+	  catalogManager.debug.message(2, "\t" + delegatedCatalog);
+	}
       }
 
       Catalog dcat = newCatalog();
 
       enCats = delCats.elements();
       while (enCats.hasMoreElements()) {
-        String delegatedCatalog = (String) enCats.nextElement();
-        dcat.parseCatalog(delegatedCatalog);
+	String delegatedCatalog = (String) enCats.nextElement();
+	dcat.parseCatalog(delegatedCatalog);
       }
 
       return dcat.resolvePublic(publicId, null);
@@ -1689,15 +1690,15 @@
     if (systemId != null) {
       String resolved = resolveLocalSystem(systemId);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
     // Otherwise, look in the subordinate catalogs
     return resolveSubordinateCatalogs(SYSTEM,
-                                      null,
-                                      null,
-                                      systemId);
+				      null,
+				      null,
+				      systemId);
   }
 
   /**
@@ -1720,10 +1721,10 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == SYSTEM
-          && (e.getEntryArg(0).equals(systemId)
-              || (windows
-                  && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
-        return e.getEntryArg(1);
+	  && (e.getEntryArg(0).equals(systemId)
+	      || (windows
+		  && e.getEntryArg(0).equalsIgnoreCase(systemId)))) {
+	return e.getEntryArg(1);
       }
     }
 
@@ -1735,16 +1736,16 @@
       CatalogEntry e = (CatalogEntry) en.nextElement();
 
       if (e.getEntryType() == REWRITE_SYSTEM) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= systemId.length()
-            && p.equals(systemId.substring(0, p.length()))) {
-          // Is this the longest prefix?
-          if (startString == null
-              || p.length() > startString.length()) {
-            startString = p;
-            prefix = e.getEntryArg(1);
-          }
-        }
+	String p = (String) e.getEntryArg(0);
+	if (p.length() <= systemId.length()
+	    && p.equals(systemId.substring(0, p.length()))) {
+	  // Is this the longest prefix?
+	  if (startString == null
+	      || p.length() > startString.length()) {
+	    startString = p;
+	    prefix = e.getEntryArg(1);
+	  }
+	}
       }
     }
 
@@ -1761,16 +1762,16 @@
       CatalogEntry e = (CatalogEntry) en.nextElement();
 
       if (e.getEntryType() == SYSTEM_SUFFIX) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= systemId.length()
-            && systemId.endsWith(p)) {
-          // Is this the longest prefix?
-          if (suffixString == null
-              || p.length() > suffixString.length()) {
-            suffixString = p;
-            suffixURI = e.getEntryArg(1);
-          }
-        }
+	String p = (String) e.getEntryArg(0);
+	if (p.length() <= systemId.length()
+	    && systemId.endsWith(p)) {
+	  // Is this the longest prefix?
+	  if (suffixString == null
+	      || p.length() > suffixString.length()) {
+	    suffixString = p;
+	    suffixURI = e.getEntryArg(1);
+	  }
+	}
       }
     }
 
@@ -1786,13 +1787,13 @@
       CatalogEntry e = (CatalogEntry) en.nextElement();
 
       if (e.getEntryType() == DELEGATE_SYSTEM) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= systemId.length()
-            && p.equals(systemId.substring(0, p.length()))) {
-          // delegate this match to the other catalog
+	String p = (String) e.getEntryArg(0);
+	if (p.length() <= systemId.length()
+	    && p.equals(systemId.substring(0, p.length()))) {
+	  // delegate this match to the other catalog
 
-          delCats.addElement(e.getEntryArg(1));
-        }
+	  delCats.addElement(e.getEntryArg(1));
+	}
       }
     }
 
@@ -1800,19 +1801,19 @@
       Enumeration enCats = delCats.elements();
 
       if (catalogManager.debug.getDebug() > 1) {
-        catalogManager.debug.message(2, "Switching to delegated catalog(s):");
-        while (enCats.hasMoreElements()) {
-          String delegatedCatalog = (String) enCats.nextElement();
-          catalogManager.debug.message(2, "\t" + delegatedCatalog);
-        }
+	catalogManager.debug.message(2, "Switching to delegated catalog(s):");
+	while (enCats.hasMoreElements()) {
+	  String delegatedCatalog = (String) enCats.nextElement();
+	  catalogManager.debug.message(2, "\t" + delegatedCatalog);
+	}
       }
 
       Catalog dcat = newCatalog();
 
       enCats = delCats.elements();
       while (enCats.hasMoreElements()) {
-        String delegatedCatalog = (String) enCats.nextElement();
-        dcat.parseCatalog(delegatedCatalog);
+	String delegatedCatalog = (String) enCats.nextElement();
+	dcat.parseCatalog(delegatedCatalog);
       }
 
       return dcat.resolveSystem(systemId);
@@ -1853,15 +1854,15 @@
     if (uri != null) {
       String resolved = resolveLocalURI(uri);
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
     // Otherwise, look in the subordinate catalogs
     return resolveSubordinateCatalogs(URI,
-                                      null,
-                                      null,
-                                      uri);
+				      null,
+				      null,
+				      uri);
   }
 
   /**
@@ -1880,8 +1881,8 @@
     while (en.hasMoreElements()) {
       CatalogEntry e = (CatalogEntry) en.nextElement();
       if (e.getEntryType() == URI
-          && (e.getEntryArg(0).equals(uri))) {
-        return e.getEntryArg(1);
+	  && (e.getEntryArg(0).equals(uri))) {
+	return e.getEntryArg(1);
       }
     }
 
@@ -1893,16 +1894,16 @@
       CatalogEntry e = (CatalogEntry) en.nextElement();
 
       if (e.getEntryType() == REWRITE_URI) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= uri.length()
-            && p.equals(uri.substring(0, p.length()))) {
-          // Is this the longest prefix?
-          if (startString == null
-              || p.length() > startString.length()) {
-            startString = p;
-            prefix = e.getEntryArg(1);
-          }
-        }
+	String p = (String) e.getEntryArg(0);
+	if (p.length() <= uri.length()
+	    && p.equals(uri.substring(0, p.length()))) {
+	  // Is this the longest prefix?
+	  if (startString == null
+	      || p.length() > startString.length()) {
+	    startString = p;
+	    prefix = e.getEntryArg(1);
+	  }
+	}
       }
     }
 
@@ -1919,16 +1920,16 @@
       CatalogEntry e = (CatalogEntry) en.nextElement();
 
       if (e.getEntryType() == URI_SUFFIX) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= uri.length()
-            && uri.endsWith(p)) {
-          // Is this the longest prefix?
-          if (suffixString == null
-              || p.length() > suffixString.length()) {
-            suffixString = p;
-            suffixURI = e.getEntryArg(1);
-          }
-        }
+	String p = (String) e.getEntryArg(0);
+	if (p.length() <= uri.length()
+	    && uri.endsWith(p)) {
+	  // Is this the longest prefix?
+	  if (suffixString == null
+	      || p.length() > suffixString.length()) {
+	    suffixString = p;
+	    suffixURI = e.getEntryArg(1);
+	  }
+	}
       }
     }
 
@@ -1944,13 +1945,13 @@
       CatalogEntry e = (CatalogEntry) en.nextElement();
 
       if (e.getEntryType() == DELEGATE_URI) {
-        String p = (String) e.getEntryArg(0);
-        if (p.length() <= uri.length()
-            && p.equals(uri.substring(0, p.length()))) {
-          // delegate this match to the other catalog
+	String p = (String) e.getEntryArg(0);
+	if (p.length() <= uri.length()
+	    && p.equals(uri.substring(0, p.length()))) {
+	  // delegate this match to the other catalog
 
-          delCats.addElement(e.getEntryArg(1));
-        }
+	  delCats.addElement(e.getEntryArg(1));
+	}
       }
     }
 
@@ -1958,19 +1959,19 @@
       Enumeration enCats = delCats.elements();
 
       if (catalogManager.debug.getDebug() > 1) {
-        catalogManager.debug.message(2, "Switching to delegated catalog(s):");
-        while (enCats.hasMoreElements()) {
-          String delegatedCatalog = (String) enCats.nextElement();
-          catalogManager.debug.message(2, "\t" + delegatedCatalog);
-        }
+	catalogManager.debug.message(2, "Switching to delegated catalog(s):");
+	while (enCats.hasMoreElements()) {
+	  String delegatedCatalog = (String) enCats.nextElement();
+	  catalogManager.debug.message(2, "\t" + delegatedCatalog);
+	}
       }
 
       Catalog dcat = newCatalog();
 
       enCats = delCats.elements();
       while (enCats.hasMoreElements()) {
-        String delegatedCatalog = (String) enCats.nextElement();
-        dcat.parseCatalog(delegatedCatalog);
+	String delegatedCatalog = (String) enCats.nextElement();
+	dcat.parseCatalog(delegatedCatalog);
       }
 
       return dcat.resolveURI(uri);
@@ -2008,61 +2009,61 @@
    * to indicate that no match was found.
    */
   protected synchronized String resolveSubordinateCatalogs(int entityType,
-                                                           String entityName,
-                                                           String publicId,
-                                                           String systemId)
+							   String entityName,
+							   String publicId,
+							   String systemId)
     throws MalformedURLException, IOException {
 
     for (int catPos = 0; catPos < catalogs.size(); catPos++) {
       Catalog c = null;
 
       try {
-        c = (Catalog) catalogs.elementAt(catPos);
+	c = (Catalog) catalogs.elementAt(catPos);
       } catch (ClassCastException e) {
-        String catfile = (String) catalogs.elementAt(catPos);
-        c = newCatalog();
+	String catfile = (String) catalogs.elementAt(catPos);
+	c = newCatalog();
 
-        try {
-          c.parseCatalog(catfile);
-        } catch (MalformedURLException mue) {
-          catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
-        } catch (FileNotFoundException fnfe) {
-          catalogManager.debug.message(1, "Failed to load catalog, file not found",
-                        catfile);
-        } catch (IOException ioe) {
-          catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
-        }
+	try {
+	  c.parseCatalog(catfile);
+	} catch (MalformedURLException mue) {
+	  catalogManager.debug.message(1, "Malformed Catalog URL", catfile);
+	} catch (FileNotFoundException fnfe) {
+	  catalogManager.debug.message(1, "Failed to load catalog, file not found",
+			catfile);
+	} catch (IOException ioe) {
+	  catalogManager.debug.message(1, "Failed to load catalog, I/O error", catfile);
+	}
 
-        catalogs.setElementAt(c, catPos);
+	catalogs.setElementAt(c, catPos);
       }
 
       String resolved = null;
 
       // Ok, now what are we supposed to call here?
       if (entityType == DOCTYPE) {
-        resolved = c.resolveDoctype(entityName,
-                                    publicId,
-                                    systemId);
+	resolved = c.resolveDoctype(entityName,
+				    publicId,
+				    systemId);
       } else if (entityType == DOCUMENT) {
-        resolved = c.resolveDocument();
+	resolved = c.resolveDocument();
       } else if (entityType == ENTITY) {
-        resolved = c.resolveEntity(entityName,
-                                   publicId,
-                                   systemId);
+	resolved = c.resolveEntity(entityName,
+				   publicId,
+				   systemId);
       } else if (entityType == NOTATION) {
-        resolved = c.resolveNotation(entityName,
-                                     publicId,
-                                     systemId);
+	resolved = c.resolveNotation(entityName,
+				     publicId,
+				     systemId);
       } else if (entityType == PUBLIC) {
-        resolved = c.resolvePublic(publicId, systemId);
+	resolved = c.resolvePublic(publicId, systemId);
       } else if (entityType == SYSTEM) {
-        resolved = c.resolveSystem(systemId);
+	resolved = c.resolveSystem(systemId);
       } else if (entityType == URI) {
-        resolved = c.resolveURI(systemId);
+	resolved = c.resolveURI(systemId);
       }
 
       if (resolved != null) {
-        return resolved;
+	return resolved;
       }
     }
 
@@ -2116,13 +2117,11 @@
    * @return The normalized URI reference.
    */
   protected String normalizeURI(String uriref) {
-    String newRef = "";
-    byte[] bytes;
-
     if (uriref == null) {
       return null;
     }
 
+    byte[] bytes;
     try {
       bytes = uriref.getBytes("UTF-8");
     } catch (UnsupportedEncodingException uee) {
@@ -2131,28 +2130,29 @@
       return uriref;
     }
 
+    StringBuilder newRef = new StringBuilder(bytes.length);
     for (int count = 0; count < bytes.length; count++) {
       int ch = bytes[count] & 0xFF;
 
       if ((ch <= 0x20)    // ctrl
-          || (ch > 0x7F)  // high ascii
-          || (ch == 0x22) // "
-          || (ch == 0x3C) // <
-          || (ch == 0x3E) // >
-          || (ch == 0x5C) // \
-          || (ch == 0x5E) // ^
-          || (ch == 0x60) // `
-          || (ch == 0x7B) // {
-          || (ch == 0x7C) // |
-          || (ch == 0x7D) // }
-          || (ch == 0x7F)) {
-        newRef += encodedByte(ch);
+	  || (ch > 0x7F)  // high ascii
+	  || (ch == 0x22) // "
+	  || (ch == 0x3C) // <
+	  || (ch == 0x3E) // >
+	  || (ch == 0x5C) // \
+	  || (ch == 0x5E) // ^
+	  || (ch == 0x60) // `
+	  || (ch == 0x7B) // {
+	  || (ch == 0x7C) // |
+	  || (ch == 0x7D) // }
+	  || (ch == 0x7F)) {
+	newRef.append(encodedByte(ch));
       } else {
-        newRef += (char) bytes[count];
+        newRef.append((char) bytes[count]);
       }
     }
 
-    return newRef;
+    return newRef.toString();
   }
 
   /**
@@ -2191,14 +2191,14 @@
       CatalogEntry dpe = (CatalogEntry) local.nextElement();
       String dp = dpe.getEntryArg(0);
       if (dp.equals(partial)) {
-        // we already have this prefix
-        return;
+	// we already have this prefix
+	return;
       }
       if (dp.length() > partial.length()) {
-        pos++;
+	pos++;
       }
       if (dp.length() < partial.length()) {
-        break;
+	break;
       }
     }
 
@@ -2210,3 +2210,4 @@
     }
   }
 }
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/resolver/helpers/FileURL.java	Wed Sep 28 16:49:43 2011 +0100
@@ -41,6 +41,7 @@
  * @author Norman Walsh
  * <a href="mailto:Norman.Walsh@Sun.COM">Norman.Walsh@Sun.COM</a>
  *
+ * @version 1.0
  */
 public abstract class FileURL {
   protected FileURL() { }
@@ -76,10 +77,10 @@
     /*if (pathname.startsWith("/")) {
       return new URL("file://" + pathname);
     }
-
+     
     String userdir = System.getProperty("user.dir");
     userdir.replace('\\', '/');
-
+     
     if (userdir.endsWith("/")) {
       return new URL("file:///" + userdir + pathname);
     } else {
@@ -87,6 +88,6 @@
     }
      */
       File file = new File(pathname);
-      return file.toURL();
+      return file.toURI().toURL();
   }
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serialize/DOMSerializerImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -76,25 +76,26 @@
  * @author Gopal Sharma, Sun Microsystems
  * @author Arun Yadav, Sun Microsystems
  * @author Sunitha Reddy, Sun Microsystems
+ * @version $Id: DOMSerializerImpl.java,v 1.8 2009/09/03 18:56:50 joehw Exp $
  */
 public class DOMSerializerImpl implements LSSerializer, DOMConfiguration {
 
     // TODO: When DOM Level 3 goes to REC replace method calls using
     // reflection for: getXmlEncoding, getInputEncoding and getXmlEncoding
     // with regular static calls on the Document object.
-
+	
     // data
     // serializer
     private XMLSerializer serializer;
 
     // XML 1.1 serializer
     private XML11Serializer xml11Serializer;
-
+    
     //Recognized parameters
     private DOMStringList fRecognizedParameters;
-
+    
     /** REVISIT: Currently we handle 3 different configurations, would be nice just have one configuration
-     * that has different recognized parameters depending if it is used in Core/LS.
+     * that has different recognized parameters depending if it is used in Core/LS. 
      */
     protected short features = 0;
 
@@ -112,7 +113,7 @@
     protected final static short FORMAT_PRETTY_PRINT = 0x1<<11;
 
     // well-formness checking
-    private DOMErrorHandler fErrorHandler = null;
+    private DOMErrorHandler fErrorHandler = null;    
     private final DOMErrorImpl fError = new DOMErrorImpl();
     private final DOMLocatorImpl fLocator = new DOMLocatorImpl();
     private static final RuntimeException abort = new RuntimeException();
@@ -135,7 +136,7 @@
         features |= DOM_ELEMENT_CONTENT_WHITESPACE;
         features |= DISCARDDEFAULT;
         features |= XMLDECL;
-
+             
         serializer = new XMLSerializer();
         initSerializer(serializer);
     }
@@ -163,12 +164,12 @@
                     features |= NAMESPACES;
                     features |= NSDECL;
                     features |= WELLFORMED;
-                    features |= COMMENTS;
+                    features |= COMMENTS;                 
                 }
                 // false does not have any effect
             } else if (name.equalsIgnoreCase(Constants.DOM_XMLDECL)) {
                 features =
-                    (short) (state ? features | XMLDECL : features & ~XMLDECL);
+                    (short) (state ? features | XMLDECL : features & ~XMLDECL);                
             } else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACES)) {
                 features =
                     (short) (state
@@ -230,13 +231,13 @@
                     throw new DOMException(DOMException.NOT_SUPPORTED_ERR, msg);
                 }
             }else if (
-                        name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)) {
-                                //namespace-declaration has effect only if namespaces is true
-                                features =
-                                        (short) (state
-                                                ? features | NSDECL
-                                                : features & ~NSDECL);
-                                serializer.fNamespacePrefixes = state;
+			name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)) {
+				//namespace-declaration has effect only if namespaces is true
+				features =
+					(short) (state
+						? features | NSDECL
+						: features & ~NSDECL);
+				serializer.fNamespacePrefixes = state;							
             } else if (name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE)
                     || name.equalsIgnoreCase(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
                 // false is not supported
@@ -271,7 +272,7 @@
             name.equalsIgnoreCase(Constants.DOM_RESOURCE_RESOLVER)
                 || name.equalsIgnoreCase(Constants.DOM_SCHEMA_LOCATION)
                 || name.equalsIgnoreCase(Constants.DOM_SCHEMA_TYPE)
-                || name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS)
+                || name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS) 
                 && value != null) {
             String msg =
                 DOMMessageFormatter.formatMessage(
@@ -293,14 +294,14 @@
      * Check if parameter can be set
      */
     public boolean canSetParameter(String name, Object state) {
-
+        
         if (state == null) {
             return true;
         }
-
+        
         if (state instanceof Boolean) {
             boolean value = ((Boolean) state).booleanValue();
-
+            
             if (name.equalsIgnoreCase(Constants.DOM_NAMESPACES)
                 || name.equalsIgnoreCase(Constants.DOM_SPLIT_CDATA)
                 || name.equalsIgnoreCase(Constants.DOM_DISCARD_DEFAULT_CONTENT)
@@ -331,63 +332,63 @@
             state == null || state instanceof DOMErrorHandler) {
             return true;
         }
-
+        
         return false;
     }
 
     /**
      *  DOM Level 3 Core CR - Experimental.
-     *
-     *  The list of the parameters supported by this
-     * <code>DOMConfiguration</code> object and for which at least one value
-     * can be set by the application. Note that this list can also contain
-     * parameter names defined outside this specification.
+     * 
+     *  The list of the parameters supported by this 
+     * <code>DOMConfiguration</code> object and for which at least one value 
+     * can be set by the application. Note that this list can also contain 
+     * parameter names defined outside this specification. 
      */
     public DOMStringList getParameterNames() {
-
-        if (fRecognizedParameters == null){
-                        Vector parameters = new Vector();
+    	
+     	if (fRecognizedParameters == null){
+			Vector parameters = new Vector();
 
-                        //Add DOM recognized parameters
-                        //REVISIT: Would have been nice to have a list of
-                        //recognized parameters.
-                        parameters.add(Constants.DOM_NAMESPACES);
-                        parameters.add(Constants.DOM_SPLIT_CDATA);
-                        parameters.add(Constants.DOM_DISCARD_DEFAULT_CONTENT);
-                        parameters.add(Constants.DOM_XMLDECL);
-                        parameters.add(Constants.DOM_CANONICAL_FORM);
-                        parameters.add(Constants.DOM_VALIDATE_IF_SCHEMA);
-                        parameters.add(Constants.DOM_VALIDATE);
-                        parameters.add(Constants.DOM_CHECK_CHAR_NORMALIZATION);
-                        parameters.add(Constants.DOM_DATATYPE_NORMALIZATION);
-                        parameters.add(Constants.DOM_FORMAT_PRETTY_PRINT);
-                        //parameters.add(Constants.DOM_NORMALIZE_CHARACTERS);
-                        parameters.add(Constants.DOM_WELLFORMED);
-                        parameters.add(Constants.DOM_INFOSET);
-                        parameters.add(Constants.DOM_NAMESPACE_DECLARATIONS);
-                        parameters.add(Constants.DOM_ELEMENT_CONTENT_WHITESPACE);
-                        parameters.add(Constants.DOM_ENTITIES);
-                        parameters.add(Constants.DOM_CDATA_SECTIONS);
-                        parameters.add(Constants.DOM_COMMENTS);
-                        parameters.add(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS);
-                        parameters.add(Constants.DOM_ERROR_HANDLER);
-                        //parameters.add(Constants.DOM_SCHEMA_LOCATION);
-                        //parameters.add(Constants.DOM_SCHEMA_TYPE);
+			//Add DOM recognized parameters
+			//REVISIT: Would have been nice to have a list of 
+			//recognized parameters.
+			parameters.add(Constants.DOM_NAMESPACES);
+			parameters.add(Constants.DOM_SPLIT_CDATA);
+			parameters.add(Constants.DOM_DISCARD_DEFAULT_CONTENT);
+			parameters.add(Constants.DOM_XMLDECL);
+			parameters.add(Constants.DOM_CANONICAL_FORM);
+			parameters.add(Constants.DOM_VALIDATE_IF_SCHEMA);
+			parameters.add(Constants.DOM_VALIDATE);
+			parameters.add(Constants.DOM_CHECK_CHAR_NORMALIZATION); 
+			parameters.add(Constants.DOM_DATATYPE_NORMALIZATION);
+			parameters.add(Constants.DOM_FORMAT_PRETTY_PRINT);
+			//parameters.add(Constants.DOM_NORMALIZE_CHARACTERS); 
+			parameters.add(Constants.DOM_WELLFORMED);
+			parameters.add(Constants.DOM_INFOSET);
+			parameters.add(Constants.DOM_NAMESPACE_DECLARATIONS);
+			parameters.add(Constants.DOM_ELEMENT_CONTENT_WHITESPACE);
+			parameters.add(Constants.DOM_ENTITIES);
+			parameters.add(Constants.DOM_CDATA_SECTIONS);
+			parameters.add(Constants.DOM_COMMENTS);
+			parameters.add(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS);
+			parameters.add(Constants.DOM_ERROR_HANDLER);
+			//parameters.add(Constants.DOM_SCHEMA_LOCATION);
+			//parameters.add(Constants.DOM_SCHEMA_TYPE);
+			
+			//Add recognized xerces features and properties
+			
+			fRecognizedParameters = new DOMStringListImpl(parameters);		
+    		
+    	}
 
-                        //Add recognized xerces features and properties
-
-                        fRecognizedParameters = new DOMStringListImpl(parameters);
-
-        }
-
-        return fRecognizedParameters;
-    }
-
+    	return fRecognizedParameters; 	
+    }	
+    
     /** DOM L3-EXPERIMENTAL:
      * Getter for boolean and object parameters
      */
     public Object getParameter(String name) throws DOMException {
-
+        
         if(name.equalsIgnoreCase(Constants.DOM_NORMALIZE_CHARACTERS)){
                       return null;
         } else if (name.equalsIgnoreCase(Constants.DOM_COMMENTS)) {
@@ -405,9 +406,9 @@
         } else if (name.equalsIgnoreCase(Constants.DOM_WELLFORMED)) {
             return (features & WELLFORMED) != 0 ? Boolean.TRUE : Boolean.FALSE;
         } else if (name.equalsIgnoreCase(Constants.DOM_NAMESPACE_DECLARATIONS)) {
-            return (features & NSDECL) != 0 ? Boolean.TRUE : Boolean.FALSE;
+            return (features & NSDECL) != 0 ? Boolean.TRUE : Boolean.FALSE;            
         } else if (name.equalsIgnoreCase(Constants.DOM_FORMAT_PRETTY_PRINT)) {
-            return (features & FORMAT_PRETTY_PRINT) != 0 ? Boolean.TRUE : Boolean.FALSE;
+            return (features & FORMAT_PRETTY_PRINT) != 0 ? Boolean.TRUE : Boolean.FALSE;            
         } else if (name.equalsIgnoreCase(Constants.DOM_ELEMENT_CONTENT_WHITESPACE) ||
                    name.equalsIgnoreCase(Constants.DOM_IGNORE_UNKNOWN_CHARACTER_DENORMALIZATIONS)) {
             return Boolean.TRUE;
@@ -421,8 +422,8 @@
                  (features & WELLFORMED) != 0 &&
                  (features & COMMENTS) != 0) {
                      return Boolean.TRUE;
-                 }
-                 return Boolean.FALSE;
+                 }                 
+                 return Boolean.FALSE; 
         } else if (name.equalsIgnoreCase(Constants.DOM_CANONICAL_FORM)
                 || name.equalsIgnoreCase(Constants.DOM_VALIDATE_IF_SCHEMA)
                 || name.equalsIgnoreCase(Constants.DOM_CHECK_CHAR_NORMALIZATION)
@@ -469,7 +470,7 @@
      *   <code>DOMString</code>.
      * @exception LSException
      *    SERIALIZE_ERR: Unable to serialize the node.  DOM applications should
-     *    attach a <code>DOMErrorHandler</code> using the parameter
+     *    attach a <code>DOMErrorHandler</code> using the parameter 
      *    &quot;<i>error-handler</i>&quot; to get details on error.
      */
     public String writeToString(Node wnode) throws DOMException, LSException {
@@ -514,7 +515,7 @@
             else if (wnode.getNodeType() == Node.ELEMENT_NODE) {
                 ser.serialize((Element)wnode);
             }
-            else if (wnode.getNodeType() == Node.TEXT_NODE ||
+            else if (wnode.getNodeType() == Node.TEXT_NODE || 
                     wnode.getNodeType() == Node.COMMENT_NODE ||
                     wnode.getNodeType() == Node.ENTITY_REFERENCE_NODE ||
                     wnode.getNodeType() == Node.CDATA_SECTION_NODE ||
@@ -523,7 +524,7 @@
             }
             else {
                 String msg = DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.SERIALIZER_DOMAIN,
+                    DOMMessageFormatter.SERIALIZER_DOMAIN, 
                     "unable-to-serialize-node", null);
                 if (ser.fDOMErrorHandler != null) {
                     DOMErrorImpl error = new DOMErrorImpl();
@@ -542,7 +543,7 @@
                 // stopped at user request
                 return null;
             }
-            throw new LSException(LSException.SERIALIZE_ERR, e.toString());
+            throw (LSException) new LSException(LSException.SERIALIZE_ERR, e.toString()).initCause(e);
         } catch (IOException ioe) {
             // REVISIT: A generic IOException doesn't provide enough information
             // to determine that the serialized document is too large to fit
@@ -551,9 +552,9 @@
                 DOMMessageFormatter.DOM_DOMAIN,
                 "STRING_TOO_LONG",
                 new Object[] { ioe.getMessage()});
-            throw new DOMException(DOMException.DOMSTRING_SIZE_ERR,msg);
+            throw (DOMException) new DOMException(DOMException.DOMSTRING_SIZE_ERR, msg).initCause(ioe);
         }
-
+        
         return destination.toString();
     }
 
@@ -636,7 +637,7 @@
     private void initSerializer(XMLSerializer ser) {
         ser.fNSBinder = new NamespaceSupport();
         ser.fLocalNSBinder = new NamespaceSupport();
-        ser.fSymbolTable = new SymbolTable();
+        ser.fSymbolTable = new SymbolTable();	
     }
 
     // copies all settings that could have been modified
@@ -685,7 +686,7 @@
 
         if (node == null)
             return false;
-
+            
         Method getVersion = null;
         XMLSerializer ser = null;
         String ver = null;
@@ -751,7 +752,7 @@
                 if (outputStream == null) {
                     if (uri == null) {
                         String msg = DOMMessageFormatter.formatMessage(
-                            DOMMessageFormatter.SERIALIZER_DOMAIN,
+                            DOMMessageFormatter.SERIALIZER_DOMAIN, 
                             "no-output-specified", null);
                         if (ser.fDOMErrorHandler != null) {
                             DOMErrorImpl error = new DOMErrorImpl();
@@ -770,7 +771,7 @@
                         String protocol = url.getProtocol();
                         String host = url.getHost();
                         // Use FileOutputStream if this URI is for a local file.
-                        if (protocol.equals("file")
+                        if (protocol.equals("file") 
                             && (host == null || host.length() == 0 || host.equals("localhost"))) {
                             out = new FileOutputStream(getPathWithoutEscapes(url.getFile()));
                         }
@@ -783,7 +784,7 @@
                             urlCon.setUseCaches(false); // Enable tunneling.
                             if (urlCon instanceof HttpURLConnection) {
                                 // The DOM L3 LS CR says if we are writing to an HTTP URI
-                                // it is to be done with an HTTP PUT.
+                                // it is to be done with an HTTP PUT. 
                                 HttpURLConnection httpCon = (HttpURLConnection) urlCon;
                                 httpCon.setRequestMethod("PUT");
                             }
@@ -799,7 +800,7 @@
             }
             else {
                 // character stream is specified
-                ser.setOutputCharStream(writer);
+                ser.setOutputCharStream(writer); 
             }
 
             if (node.getNodeType() == Node.DOCUMENT_NODE)
@@ -808,7 +809,7 @@
                 ser.serialize((DocumentFragment) node);
             else if (node.getNodeType() == Node.ELEMENT_NODE)
                 ser.serialize((Element) node);
-            else if (node.getNodeType() == Node.TEXT_NODE ||
+            else if (node.getNodeType() == Node.TEXT_NODE || 
                     node.getNodeType() == Node.COMMENT_NODE ||
                     node.getNodeType() == Node.ENTITY_REFERENCE_NODE ||
                     node.getNodeType() == Node.CDATA_SECTION_NODE ||
@@ -821,16 +822,16 @@
             if (ser.fDOMErrorHandler != null) {
                 DOMErrorImpl error = new DOMErrorImpl();
                 error.fException = ue;
-                                error.fType = "unsupported-encoding";
+				error.fType = "unsupported-encoding";
                 error.fMessage = ue.getMessage();
-                                error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
+				error.fSeverity = DOMError.SEVERITY_FATAL_ERROR;
                 ser.fDOMErrorHandler.handleError(error);
-                        }
-            throw new LSException(LSException.SERIALIZE_ERR,
+			}
+            throw new LSException(LSException.SERIALIZE_ERR, 
                 DOMMessageFormatter.formatMessage(
-                    DOMMessageFormatter.SERIALIZER_DOMAIN,
-                    "unsupported-encoding", null));
-                        //return false;
+                    DOMMessageFormatter.SERIALIZER_DOMAIN, 
+                    "unsupported-encoding", null));			
+			//return false;
         } catch (LSException lse) {
             // Rethrow LSException.
             throw lse;
@@ -839,7 +840,7 @@
                 // stopped at user request
                 return false;
             }
-            throw new LSException(LSException.SERIALIZE_ERR, e.toString());
+            throw new LSException(LSException.SERIALIZE_ERR, e.toString());            
         } catch (Exception e) {
             if (ser.fDOMErrorHandler != null) {
                 DOMErrorImpl error = new DOMErrorImpl();
@@ -848,8 +849,8 @@
                 error.fSeverity = DOMError.SEVERITY_ERROR;
                 ser.fDOMErrorHandler.handleError(error);
 
-            }
-            e.printStackTrace();
+            }   
+            e.printStackTrace();       
             throw new LSException(LSException.SERIALIZE_ERR, e.toString());
         }
         return true;
@@ -915,7 +916,7 @@
             ser = xml11Serializer;
         } else {
             ser = serializer;
-        }
+        }        
 
         try {
             Method getEncoding =
@@ -944,7 +945,7 @@
         try {
             prepareForSerialization(ser, node);
             ser._format.setEncoding(encoding);
-
+            
             // URI was specified. Handle relative URIs.
             String expanded = XMLEntityManager.expandSystemId(URI, null, true);
             URL url = new URL(expanded != null ? expanded : URI);
@@ -952,9 +953,9 @@
             String protocol = url.getProtocol();
             String host = url.getHost();
             // Use FileOutputStream if this URI is for a local file.
-            if (protocol.equals("file")
+            if (protocol.equals("file") 
                 && (host == null || host.length() == 0 || host.equals("localhost"))) {
-                out = new FileOutputStream(getPathWithoutEscapes(url.getFile()));
+                out = new FileOutputStream(getPathWithoutEscapes(url.getFile()));            
             }
             // Try to write to some other kind of URI. Some protocols
             // won't support this, though HTTP should work.
@@ -965,7 +966,7 @@
                 urlCon.setUseCaches(false); // Enable tunneling.
                 if (urlCon instanceof HttpURLConnection) {
                     // The DOM L3 LS CR says if we are writing to an HTTP URI
-                    // it is to be done with an HTTP PUT.
+                    // it is to be done with an HTTP PUT. 
                     HttpURLConnection httpCon = (HttpURLConnection) urlCon;
                     httpCon.setRequestMethod("PUT");
                 }
@@ -979,7 +980,7 @@
                 ser.serialize((DocumentFragment) node);
             else if (node.getNodeType() == Node.ELEMENT_NODE)
                 ser.serialize((Element) node);
-            else if (node.getNodeType() == Node.TEXT_NODE ||
+            else if (node.getNodeType() == Node.TEXT_NODE || 
                     node.getNodeType() == Node.COMMENT_NODE ||
                     node.getNodeType() == Node.ENTITY_REFERENCE_NODE ||
                     node.getNodeType() == Node.CDATA_SECTION_NODE ||
@@ -996,7 +997,7 @@
                 // stopped at user request
                 return false;
             }
-            throw new LSException(LSException.SERIALIZE_ERR, e.toString());
+            throw new LSException(LSException.SERIALIZE_ERR, e.toString());            
         } catch (Exception e) {
             if (ser.fDOMErrorHandler != null) {
                 DOMErrorImpl error = new DOMErrorImpl();
@@ -1009,8 +1010,8 @@
         }
         return true;
     } //writeURI
-
-
+    
+    
     //
     //  Private methods
     //
@@ -1022,7 +1023,7 @@
         ser.fNamespaces = (features & NAMESPACES) != 0;
         ser.fNamespacePrefixes = (features & NSDECL) != 0;
         ser._format.setOmitComments((features & COMMENTS)==0);
-        ser._format.setOmitXMLDeclaration((features & XMLDECL) == 0);
+        ser._format.setOmitXMLDeclaration((features & XMLDECL) == 0);   
         ser._format.setIndenting((features & FORMAT_PRETTY_PRINT) != 0);
 
         if ((features & WELLFORMED) != 0) {
@@ -1057,7 +1058,7 @@
                           node = node.getParentNode();
                           if (root == node){
                               next = null;
-                              break;
+                              break;                   
                           }
                           next = node.getNextSibling();
                       }
@@ -1070,21 +1071,21 @@
             }
         }
     }
-
-
+    
+    
     private void verify (Node node, boolean verifyNames, boolean xml11Version){
 
         int type = node.getNodeType();
         fLocator.fRelatedNode = node;
         boolean wellformed;
-        switch (type) {
+        switch (type) { 
             case Node.DOCUMENT_NODE:{
                 break;
             }
             case Node.DOCUMENT_TYPE_NODE:{
                 break;
             }
-            case Node.ELEMENT_NODE:{
+            case Node.ELEMENT_NODE:{               
                 if (verifyNames){
                     if((features & NAMESPACES) != 0){
                         wellformed = CoreDocumentImpl.isValidQName(node.getPrefix() , node.getLocalName(), xml11Version) ;
@@ -1096,23 +1097,23 @@
                             if (!wellformed){
                                 if (fErrorHandler != null) {
                                     String msg = DOMMessageFormatter.formatMessage(
-                                        DOMMessageFormatter.DOM_DOMAIN,
-                                        "wf-invalid-character-in-node-name",
+                                        DOMMessageFormatter.DOM_DOMAIN, 
+                                        "wf-invalid-character-in-node-name", 
                                         new Object[]{"Element", node.getNodeName()});
-                                        DOMNormalizer.reportDOMError(fErrorHandler, fError, fLocator, msg, DOMError.SEVERITY_FATAL_ERROR,
+                                        DOMNormalizer.reportDOMError(fErrorHandler, fError, fLocator, msg, DOMError.SEVERITY_FATAL_ERROR, 
                                         "wf-invalid-character-in-node-name");
                                 }
-
-                            }
+                        
+                            }                       
                     }
                 }
-
-                NamedNodeMap attributes = (node.hasAttributes()) ? node.getAttributes() : null;
+                
+                NamedNodeMap attributes = (node.hasAttributes()) ? node.getAttributes() : null; 
                 if (attributes != null) {
                     for (int i = 0; i < attributes.getLength(); ++i) {
                         Attr attr = (Attr) attributes.item(i);
                         fLocator.fRelatedNode = attr;
-                        DOMNormalizer.isAttrValueWF( fErrorHandler, fError, fLocator,
+                        DOMNormalizer.isAttrValueWF( fErrorHandler, fError, fLocator, 
                                       attributes, attr, attr.getValue(), xml11Version);
                         if (verifyNames) {
                             wellformed = CoreDocumentImpl.isXMLName( attr.getNodeName(), xml11Version);
@@ -1129,10 +1130,10 @@
                     }
 
                 }
-
+                
                 break;
             }
-
+        
         case Node.COMMENT_NODE: {
             // only verify well-formness if comments included in the tree
             if ((features & COMMENTS) != 0)
@@ -1145,7 +1146,7 @@
                 CoreDocumentImpl.isXMLName(node.getNodeName() , xml11Version);
             }
             break;
-
+            
         }
         case Node.CDATA_SECTION_NODE: {
             // verify content
@@ -1181,14 +1182,14 @@
                         DOMError.SEVERITY_FATAL_ERROR,
                         "wf-invalid-character-in-node-name");
                 }
-            }
+            }              
             DOMNormalizer.isXMLCharWF(fErrorHandler, fError, fLocator, pinode.getData(), xml11Version);
             break;
-        }
+        }        
         }
-
+               
     }
-
+    
     private String getPathWithoutEscapes(String origPath) {
         if (origPath != null && origPath.length() != 0 && origPath.indexOf('%') != -1) {
             // Locate the escape characters
@@ -1208,3 +1209,7 @@
     }
 
 }//DOMSerializerImpl
+
+
+
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serialize/EncodingInfo.java	Wed Sep 28 16:49:43 2011 +0100
@@ -29,29 +29,30 @@
 /**
  * This class represents an encoding.
  *
+ * @version $Id: EncodingInfo.java,v 1.6 2007/10/18 03:39:08 joehw Exp $
  */
 public class EncodingInfo {
-
+    
     // An array to hold the argument for a method of Charset, CharsetEncoder or CharToByteConverter.
     private Object [] fArgsForMethod = null;
-
+    
     // name of encoding as registered with IANA;
     // preferably a MIME name, but aliases are fine too.
     String ianaName;
     String javaName;
     int lastPrintable;
-
+    
     // The CharsetEncoder with which we test unusual characters.
     Object fCharsetEncoder = null;
-
+    
     // The CharToByteConverter with which we test unusual characters.
     Object fCharToByteConverter = null;
-
+    
     // Is the converter null because it can't be instantiated
-    // for some reason (perhaps we're running with insufficient authority as
+    // for some reason (perhaps we're running with insufficient authority as 
     // an applet?
     boolean fHaveTriedCToB = false;
-
+    
     // Is the charset encoder usable or available.
     boolean fHaveTriedCharsetEncoder = false;
 
@@ -82,15 +83,15 @@
     public Writer getWriter(OutputStream output)
         throws UnsupportedEncodingException {
         // this should always be true!
-        if (javaName != null)
+        if (javaName != null) 
             return new OutputStreamWriter(output, javaName);
         javaName = EncodingMap.getIANA2JavaMapping(ianaName);
-        if(javaName == null)
+        if(javaName == null) 
             // use UTF-8 as preferred encoding
             return new OutputStreamWriter(output, "UTF8");
         return new OutputStreamWriter(output, javaName);
     }
-
+    
     /**
      * Checks whether the specified character is printable or not in this encoding.
      *
@@ -102,7 +103,7 @@
         }
         return isPrintable0(ch);
     }
-
+    
     /**
      * Checks whether the specified character is printable or not in this encoding.
      * This method accomplishes this using a java.nio.CharsetEncoder. If NIO isn't
@@ -111,7 +112,7 @@
      * @param ch a code point (0-0x10ffff)
      */
     private boolean isPrintable0(char ch) {
-
+        
         // Attempt to get a CharsetEncoder for this encoding.
         if (fCharsetEncoder == null && CharsetMethods.fgNIOCharsetAvailable && !fHaveTriedCharsetEncoder) {
             if (fArgsForMethod == null) {
@@ -127,9 +128,9 @@
                 // This charset cannot be used for encoding, don't try it again...
                 else {
                     fHaveTriedCharsetEncoder = true;
-                }
-            }
-            catch (Exception e) {
+                } 
+            } 
+            catch (Exception e) {   
                 // don't try it again...
                 fHaveTriedCharsetEncoder = true;
             }
@@ -139,14 +140,14 @@
             try {
                 fArgsForMethod[0] = new Character(ch);
                 return ((Boolean) CharsetMethods.fgCharsetEncoderCanEncodeMethod.invoke(fCharsetEncoder, fArgsForMethod)).booleanValue();
-            }
+            } 
             catch (Exception e) {
                 // obviously can't use this charset encoder; possibly a JDK bug
                 fCharsetEncoder = null;
                 fHaveTriedCharsetEncoder = false;
             }
         }
-
+        
         // As a last resort try to use a sun.io.CharToByteConverter to
         // determine whether this character is printable. We will always
         // reach here on JDK 1.3 or below.
@@ -162,8 +163,8 @@
             try {
                 fArgsForMethod[0] = javaName;
                 fCharToByteConverter = CharToByteConverterMethods.fgGetConverterMethod.invoke(null, fArgsForMethod);
-            }
-            catch (Exception e) {
+            } 
+            catch (Exception e) {   
                 // don't try it again...
                 fHaveTriedCToB = true;
                 return false;
@@ -172,7 +173,7 @@
         try {
             fArgsForMethod[0] = new Character(ch);
             return ((Boolean) CharToByteConverterMethods.fgCanConvertMethod.invoke(fCharToByteConverter, fArgsForMethod)).booleanValue();
-        }
+        } 
         catch (Exception e) {
             // obviously can't use this converter; probably some kind of
             // security restriction
@@ -188,29 +189,29 @@
         final byte [] bTest = {(byte)'v', (byte)'a', (byte)'l', (byte)'i', (byte)'d'};
         String s = new String(bTest, name);
     }
-
+    
     /**
      * Holder of methods from java.nio.charset.Charset and java.nio.charset.CharsetEncoder.
      */
     static class CharsetMethods {
-
+        
         // Method: java.nio.charset.Charset.forName(java.lang.String)
-        private static java.lang.reflect.Method fgCharsetForNameMethod = null;
-
+        private static java.lang.reflect.Method fgCharsetForNameMethod = null; 
+        
         // Method: java.nio.charset.Charset.canEncode()
         private static java.lang.reflect.Method fgCharsetCanEncodeMethod = null;
-
+        
         // Method: java.nio.charset.Charset.newEncoder()
         private static java.lang.reflect.Method fgCharsetNewEncoderMethod = null;
-
+        
         // Method: java.nio.charset.CharsetEncoder.canEncode(char)
         private static java.lang.reflect.Method fgCharsetEncoderCanEncodeMethod = null;
-
+        
         // Flag indicating whether or not java.nio.charset.* is available.
         private static boolean fgNIOCharsetAvailable = false;
-
+        
         private CharsetMethods() {}
-
+        
         // Attempt to get methods for Charset and CharsetEncoder on class initialization.
         static {
             try {
@@ -233,23 +234,23 @@
             }
         }
     }
-
+    
     /**
      * Holder of methods from sun.io.CharToByteConverter.
      */
     static class CharToByteConverterMethods {
-
+        
         // Method: sun.io.CharToByteConverter.getConverter(java.lang.String)
-        private static java.lang.reflect.Method fgGetConverterMethod = null;
-
+        private static java.lang.reflect.Method fgGetConverterMethod = null; 
+        
         // Method: sun.io.CharToByteConverter.canConvert(char)
         private static java.lang.reflect.Method fgCanConvertMethod = null;
-
+        
         // Flag indicating whether or not sun.io.CharToByteConverter is available.
         private static boolean fgConvertersAvailable = false;
-
+        
         private CharToByteConverterMethods() {}
-
+        
         // Attempt to get methods for char to byte converter on class initialization.
         static {
             try {
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/CharInfo.java	Wed Sep 28 16:49:43 2011 +0100
@@ -48,7 +48,7 @@
  * lookup.
  *
  * DEVELOPERS: See Known Issue in the constructor.
- *
+ * 
  * @xsl.usage internal
  */
 final class CharInfo
@@ -60,14 +60,14 @@
      * The name of the HTML entities file.
      * If specified, the file will be resource loaded with the default class loader.
      */
-    public static final String HTML_ENTITIES_RESOURCE =
+    public static final String HTML_ENTITIES_RESOURCE = 
                 "com.sun.org.apache.xml.internal.serializer.HTMLEntities";
 
     /**
      * The name of the XML entities file.
      * If specified, the file will be resource loaded with the default class loader.
      */
-    public static final String XML_ENTITIES_RESOURCE =
+    public static final String XML_ENTITIES_RESOURCE = 
                 "com.sun.org.apache.xml.internal.serializer.XMLEntities";
 
     /** The horizontal tab character, which the parser should always normalize. */
@@ -78,24 +78,24 @@
 
     /** The carriage return character, which the parser should always normalize. */
     public static final char S_CARRIAGERETURN = 0x0D;
-
-    /** This flag is an optimization for HTML entities. It false if entities
+    
+    /** This flag is an optimization for HTML entities. It false if entities 
      * other than quot (34), amp (38), lt (60) and gt (62) are defined
      * in the range 0 to 127.
      * @xsl.usage internal
-     */
+     */    
     final boolean onlyQuotAmpLtGt;
-
+    
     /** Copy the first 0,1 ... ASCII_MAX values into an array */
     private static final int ASCII_MAX = 128;
-
-    /** Array of values is faster access than a set of bits
-     * to quickly check ASCII characters in attribute values.
+    
+    /** Array of values is faster access than a set of bits 
+     * to quickly check ASCII characters in attribute values. 
      */
     private boolean[] isSpecialAttrASCII = new boolean[ASCII_MAX];
-
-    /** Array of values is faster access than a set of bits
-     * to quickly check ASCII characters in text nodes.
+    
+    /** Array of values is faster access than a set of bits 
+     * to quickly check ASCII characters in text nodes. 
      */
     private boolean[] isSpecialTextASCII = new boolean[ASCII_MAX];
 
@@ -105,10 +105,10 @@
      * Although information in this array is complete, the
      * isSpecialAttrASCII array is used first because access to its values
      * is common and faster.
-     */
+     */   
     private int array_of_bits[] = createEmptySetOfIntegers(65535);
-
-
+     
+    
     // 5 for 32 bit words,  6 for 64 bit words ...
     /*
      * This constant is used to shift an integer to quickly
@@ -116,18 +116,18 @@
      * 5 for 32 bit words (int) ,  6 for 64 bit words (long)
      */
     private static final int SHIFT_PER_WORD = 5;
-
+    
     /*
      * A mask to get the low order bits which are used to
      * calculate the value of the bit within a given word,
-     * that will represent the presence of the integer in the
+     * that will represent the presence of the integer in the 
      * set.
-     *
+     * 
      * 0x1F for 32 bit words (int),
-     * or 0x3F for 64 bit words (long)
+     * or 0x3F for 64 bit words (long) 
      */
     private static final int LOW_ORDER_BITMASK = 0x1f;
-
+    
     /*
      * This is used for optimizing the lookup of bits representing
      * the integers in the set. It is the index of the first element
@@ -152,7 +152,7 @@
      * quot 34
      * amp 38
      * </pre>
-     *
+     *    
      * @param entitiesResource Name of properties or resource file that should
      * be loaded, which describes that mapping of characters to entity
      * references.
@@ -175,7 +175,7 @@
         //      file
         //   3) try treating the resource a URI
 
-        if (internal) {
+        if (internal) { 
             try {
                 // Load entity property files by using PropertyResourceBundle,
                 // cause of security issure for applets
@@ -227,7 +227,7 @@
                 }
 
                 // Fix Bugzilla#4000: force reading in UTF-8
-                //  This creates the de facto standard that Xalan's resource
+                //  This creates the de facto standard that Xalan's resource 
                 //  files must be encoded in UTF-8. This should work in all
                 // JVMs.
                 //
@@ -306,7 +306,7 @@
                 }
             }
         }
-
+          
         /* initialize the array isCleanTextASCII[] with a cache of values
          * for use by ToStream.character(char[], int , int)
          * and the array isSpecialTextASCII[] with the opposite values
@@ -321,27 +321,27 @@
         }
         else {
             isCleanTextASCII[ch] = false;
-            isSpecialTextASCII[ch] = true;
-        }
-
+            isSpecialTextASCII[ch] = true;     
+        }       
+        
 
 
         onlyQuotAmpLtGt = noExtraEntities;
 
         // initialize the array with a cache of the BitSet values
         for (int i=0; i<ASCII_MAX; i++)
-            isSpecialAttrASCII[i] = get(i);
-
+            isSpecialAttrASCII[i] = get(i);   
+            
         /* Now that we've used get(ch) just above to initialize the
-         * two arrays we will change by adding a tab to the set of
+         * two arrays we will change by adding a tab to the set of 
          * special chars for XML (but not HTML!).
          * We do this because a tab is always a
-         * special character in an XML attribute,
-         * but only a special character in XML text
+         * special character in an XML attribute, 
+         * but only a special character in XML text 
          * if it has an entity defined for it.
          * This is the reason for this delay.
          */
-        if (Method.XML.equals(method))
+        if (Method.XML.equals(method)) 
         {
             isSpecialAttrASCII[S_HORIZONAL_TAB] = true;
         }
@@ -364,12 +364,10 @@
         sb.append(name);
         sb.append(';');
         String entityString = sb.toString();
-
+        
         defineChar2StringMapping(entityString, value);
     }
 
-    private CharKey m_charKey = new CharKey();
-
     /**
      * Map a character to a String. For example given
      * the character '>' this method would return the fully decorated
@@ -392,20 +390,20 @@
      * @return The String that the character is mapped to, or null if not found.
      * @xsl.usage internal
      */
-    synchronized String getOutputStringForChar(char value)
+    String getOutputStringForChar(char value)
     {
-        // CharKey m_charKey = new CharKey(); //Alternative to synchronized
-        m_charKey.setChar(value);
-        return (String) m_charToString.get(m_charKey);
+        CharKey charKey = new CharKey(); 
+        charKey.setChar(value);
+        return (String) m_charToString.get(charKey);
     }
-
+    
     /**
      * Tell if the character argument that is from
      * an attribute value should have special treatment.
-     *
+     * 
      * @param value the value of a character that is in an attribute value
-     * @return true if the character should have any special treatment,
-     * such as when writing out attribute values,
+     * @return true if the character should have any special treatment, 
+     * such as when writing out attribute values, 
      * or entity references.
      * @xsl.usage internal
      */
@@ -420,15 +418,15 @@
         // rather than java.util.BitSet, our private
         // implementation is faster (and less general).
         return get(value);
-    }
+    }    
 
     /**
-     * Tell if the character argument that is from a
+     * Tell if the character argument that is from a 
      * text node should have special treatment.
-     *
+     * 
      * @param value the value of a character that is in a text node
-     * @return true if the character should have any special treatment,
-     * such as when writing out attribute values,
+     * @return true if the character should have any special treatment, 
+     * such as when writing out attribute values, 
      * or entity references.
      * @xsl.usage internal
      */
@@ -444,7 +442,7 @@
         // implementation is faster (and less general).
         return get(value);
     }
-
+    
     /**
      * This method is used to determine if an ASCII character in
      * a text node (not an attribute value) is "clean".
@@ -456,27 +454,27 @@
     {
         return isCleanTextASCII[value];
     }
-
+    
 //  In the future one might want to use the array directly and avoid
 //  the method call, but I think the JIT alreay inlines this well enough
-//  so don't do it (for now) - bjm
+//  so don't do it (for now) - bjm    
 //    public final boolean[] getASCIIClean()
 //    {
 //        return isCleanTextASCII;
 //    }
 
-
+     
     private static CharInfo getCharInfoBasedOnPrivilege(
-        final String entitiesFileName, final String method,
+        final String entitiesFileName, final String method, 
         final boolean internal){
             return (CharInfo) AccessController.doPrivileged(
                 new PrivilegedAction() {
                         public Object run() {
-                            return new CharInfo(entitiesFileName,
+                            return new CharInfo(entitiesFileName, 
                               method, internal);}
-            });
+            });            
     }
-
+     
     /**
      * Factory that reads in a resource file that describes the mapping of
      * characters to entity references.
@@ -493,7 +491,7 @@
      * @param entitiesResource Name of entities resource file that should
      * be loaded, which describes that mapping of characters to entity references.
      * @param method the output method type, which should be one of "xml", "html", "text"...
-     *
+     * 
      * @xsl.usage internal
      */
     static CharInfo getCharInfo(String entitiesFileName, String method)
@@ -505,7 +503,7 @@
 
         // try to load it internally - cache
         try {
-            charInfo = getCharInfoBasedOnPrivilege(entitiesFileName,
+            charInfo = getCharInfoBasedOnPrivilege(entitiesFileName, 
                                         method, true);
             m_getCharInfoCache.put(entitiesFileName, charInfo);
             return charInfo;
@@ -513,7 +511,7 @@
 
         // try to load it externally - do not cache
         try {
-            return getCharInfoBasedOnPrivilege(entitiesFileName,
+            return getCharInfoBasedOnPrivilege(entitiesFileName, 
                                 method, false);
         } catch (Exception e) {}
 
@@ -531,7 +529,7 @@
             }
         }
 
-        return getCharInfoBasedOnPrivilege(entitiesFileName,
+        return getCharInfoBasedOnPrivilege(entitiesFileName, 
                                 method, false);
     }
 
@@ -542,7 +540,7 @@
      * Returns the array element holding the bit value for the
      * given integer
      * @param i the integer that might be in the set of integers
-     *
+     * 
      */
     private static int arrayIndex(int i) {
         return (i >> SHIFT_PER_WORD);
@@ -563,39 +561,39 @@
      * @param max the maximum integer to be in the set.
      */
     private int[] createEmptySetOfIntegers(int max) {
-        firstWordNotUsed = 0; // an optimization
+        firstWordNotUsed = 0; // an optimization 
 
         int[] arr = new int[arrayIndex(max - 1) + 1];
             return arr;
-
+ 
     }
 
     /**
      * Adds the integer (character) to the set of integers.
-     * @param i the integer to add to the set, valid values are
+     * @param i the integer to add to the set, valid values are 
      * 0, 1, 2 ... up to the maximum that was specified at
      * the creation of the set.
      */
-    private final void set(int i) {
+    private final void set(int i) {   
         setASCIIdirty(i);
-
+             
         int j = (i >> SHIFT_PER_WORD); // this word is used
-        int k = j + 1;
-
+        int k = j + 1;       
+        
         if(firstWordNotUsed < k) // for optimization purposes.
             firstWordNotUsed = k;
-
+            
         array_of_bits[j] |= (1 << (i & LOW_ORDER_BITMASK));
     }
 
 
     /**
      * Return true if the integer (character)is in the set of integers.
-     *
+     * 
      * This implementation uses an array of integers with 32 bits per
-     * integer.  If a bit is set to 1 the corresponding integer is
+     * integer.  If a bit is set to 1 the corresponding integer is 
      * in the set of integers.
-     *
+     * 
      * @param i an integer that is tested to see if it is the
      * set of integers, or not.
      */
@@ -606,16 +604,16 @@
         // an optimization here, ... a quick test to see
         // if this integer is beyond any of the words in use
         if(j < firstWordNotUsed)
-            in_the_set = (array_of_bits[j] &
+            in_the_set = (array_of_bits[j] & 
                           (1 << (i & LOW_ORDER_BITMASK))
             ) != 0;  // 0L for 64 bit words
         return in_the_set;
     }
-
+    
     // record if there are any entities other than
     // quot, amp, lt, gt  (probably user defined)
     /**
-     * @return true if the entity
+     * @return true if the entity 
      * @param code The value of the character that has an entity defined
      * for it.
      */
@@ -631,26 +629,26 @@
                 case 60 : // lt
                 case 62 : // gt
                     break;
-                default : // other entity in range 0 to 127
+                default : // other entity in range 0 to 127  
                     extra = true;
             }
         }
         return extra;
-    }
-
+    }    
+    
     /**
      * If the character is a printable ASCII character then
      * mark it as not clean and needing replacement with
      * a String on output.
      * @param ch
      */
-    private void setASCIIdirty(int j)
+    private void setASCIIdirty(int j) 
     {
-        if (0 <= j && j < ASCII_MAX)
+        if (0 <= j && j < ASCII_MAX) 
         {
             isCleanTextASCII[j] = false;
             isSpecialTextASCII[j] = true;
-        }
+        } 
     }
 
     /**
@@ -658,30 +656,30 @@
      * mark it as and not needing replacement with
      * a String on output.
      * @param ch
-     */
+     */    
     private void setASCIIclean(int j)
     {
-        if (0 <= j && j < ASCII_MAX)
-        {
+        if (0 <= j && j < ASCII_MAX) 
+        {        
             isCleanTextASCII[j] = true;
             isSpecialTextASCII[j] = false;
         }
     }
-
-    private void defineChar2StringMapping(String outputString, char inputChar)
+    
+    private void defineChar2StringMapping(String outputString, char inputChar) 
     {
         CharKey character = new CharKey(inputChar);
         m_charToString.put(character, outputString);
-        set(inputChar);
+        set(inputChar);        
     }
 
     /**
      * Simple class for fast lookup of char values, when used with
      * hashtables.  You can set the char, then use it as a key.
-     *
-     * This class is a copy of the one in com.sun.org.apache.xml.internal.utils.
+     * 
+     * This class is a copy of the one in com.sun.org.apache.xml.internal.utils. 
      * It exists to cut the serializers dependancy on that package.
-     *
+     *  
      * @xsl.usage internal
      */
     private static class CharKey extends Object
@@ -699,7 +697,7 @@
       {
         m_char = key;
       }
-
+  
       /**
        * Default constructor for a CharKey.
        *
@@ -708,9 +706,9 @@
       public CharKey()
       {
       }
-
+  
       /**
-       * Get the hash value of the character.
+       * Get the hash value of the character.  
        *
        * @return hash value of the character.
        */
@@ -722,7 +720,7 @@
 
 
       /**
-       * Get the hash value of the character.
+       * Get the hash value of the character.  
        *
        * @return hash value of the character.
        */
@@ -732,17 +730,17 @@
       }
 
       /**
-       * Override of equals() for this object
+       * Override of equals() for this object 
        *
        * @param obj to compare to
        *
-       * @return True if this object equals this string value
+       * @return True if this object equals this string value 
        */
       public final boolean equals(Object obj)
       {
         return ((CharKey)obj).m_char == m_char;
       }
     }
-
+   
 
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/EncodingInfo.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/EncodingInfo.java	Wed Sep 28 16:49:43 2011 +0100
@@ -46,17 +46,17 @@
  * explicitly (<code>m_explFirst</code> to <code>m_explLast</code>).
  * If the unicode point is before that explicit range, that is it
  * is in the range <code>m_first <= value < m_explFirst</code>, then it will delegate to another EncodingInfo object for The root
- * of such a tree, m_before.  Likewise for values in the range
+ * of such a tree, m_before.  Likewise for values in the range 
  * <code>m_explLast < value <= m_last</code>, but delgating to <code>m_after</code>
  * <p>
  * Actually figuring out if a code point is in the encoding is expensive. So the
  * purpose of this tree is to cache such determinations, and not to build the
- * entire tree of information at the start, but only build up as much of the
+ * entire tree of information at the start, but only build up as much of the 
  * tree as is used during the transformation.
  * <p>
  * This Class is not a public API, and should only be used internally within
  * the serializer.
- *
+ * 
  * @xsl.usage internal
  */
 public final class EncodingInfo extends Object
@@ -79,7 +79,7 @@
      * is in this encoding.
      */
     private InEncoding m_encoding;
-
+    
     /**
      * This is not a public API. It returns true if the
      * char in question is in the encoding.
@@ -89,15 +89,15 @@
     public boolean isInEncoding(char ch) {
         if (m_encoding == null) {
             m_encoding = new EncodingImpl();
-
+            
             // One could put alternate logic in here to
             // instantiate another object that implements the
             // InEncoding interface. For example if the JRE is 1.4 or up
             // we could have an object that uses JRE 1.4 methods
         }
-        return m_encoding.isInEncoding(ch);
+        return m_encoding.isInEncoding(ch); 
     }
-
+    
     /**
      * This is not a public API. It returns true if the
      * character formed by the high/low pair is in the encoding.
@@ -108,13 +108,13 @@
     public boolean isInEncoding(char high, char low) {
         if (m_encoding == null) {
             m_encoding = new EncodingImpl();
-
+            
             // One could put alternate logic in here to
             // instantiate another object that implements the
             // InEncoding interface. For example if the JRE is 1.4 or up
             // we could have an object that uses JRE 1.4 methods
         }
-        return m_encoding.isInEncoding(high, low);
+        return m_encoding.isInEncoding(high, low); 
     }
 
     /**
@@ -132,16 +132,16 @@
         this.name = name;
         this.javaName = javaName;
     }
-
-
-
+    
+    
+    
     /**
      * A simple interface to isolate the implementation.
      * We could also use some new JRE 1.4 methods in another implementation
      * provided we use reflection with them.
      * <p>
      * This interface is not a public API,
-     * and should only be used internally within the serializer.
+     * and should only be used internally within the serializer. 
      * @xsl.usage internal
      */
     private interface InEncoding {
@@ -157,10 +157,10 @@
     }
 
     /**
-     * This class implements the
+     * This class implements the 
      */
     private class EncodingImpl implements InEncoding {
-
+        
 
 
         public boolean isInEncoding(char ch1) {
@@ -169,7 +169,7 @@
             if (codePoint < m_explFirst) {
                 // The unicode value is before the range
                 // that we explictly manage, so we delegate the answer.
-
+                
                 // If we don't have an m_before object to delegate to, make one.
                 if (m_before == null)
                     m_before =
@@ -182,7 +182,7 @@
             } else if (m_explLast < codePoint) {
                 // The unicode value is after the range
                 // that we explictly manage, so we delegate the answer.
-
+                
                 // If we don't have an m_after object to delegate to, make one.
                 if (m_after == null)
                     m_after =
@@ -195,13 +195,13 @@
             } else {
                 // The unicode value is in the range we explitly handle
                 final int idx = codePoint - m_explFirst;
-
+                
                 // If we already know the answer, just return it.
                 if (m_alreadyKnown[idx])
                     ret = m_isInEncoding[idx];
                 else {
                     // We don't know the answer, so find out,
-                    // which may be expensive, then cache the answer
+                    // which may be expensive, then cache the answer 
                     ret = inEncoding(ch1, m_encoding);
                     m_alreadyKnown[idx] = true;
                     m_isInEncoding[idx] = ret;
@@ -216,7 +216,7 @@
             if (codePoint < m_explFirst) {
                 // The unicode value is before the range
                 // that we explictly manage, so we delegate the answer.
-
+                
                 // If we don't have an m_before object to delegate to, make one.
                 if (m_before == null)
                     m_before =
@@ -229,7 +229,7 @@
             } else if (m_explLast < codePoint) {
                 // The unicode value is after the range
                 // that we explictly manage, so we delegate the answer.
-
+                
                 // If we don't have an m_after object to delegate to, make one.
                 if (m_after == null)
                     m_after =
@@ -242,13 +242,13 @@
             } else {
                 // The unicode value is in the range we explitly handle
                 final int idx = codePoint - m_explFirst;
-
+                
                 // If we already know the answer, just return it.
                 if (m_alreadyKnown[idx])
                     ret = m_isInEncoding[idx];
                 else {
                     // We don't know the answer, so find out,
-                    // which may be expensive, then cache the answer
+                    // which may be expensive, then cache the answer 
                     ret = inEncoding(high, low, m_encoding);
                     m_alreadyKnown[idx] = true;
                     m_isInEncoding[idx] = ret;
@@ -268,7 +268,7 @@
          * range
          */
         final private int m_first;
-
+        
         /**
          * m_explFirst through m_explLast is the range of unicode
          * value that this object handles explicitly and does not
@@ -292,10 +292,10 @@
          * to which this object may delegate.
          */
         private InEncoding m_after;
-
+        
         /**
          * The number of unicode values explicitly handled
-         * by a single EncodingInfo object. This value is
+         * by a single EncodingInfo object. This value is 
          * tuneable, but is set to 128 because that covers the
          * entire low range of ASCII type chars within a single
          * object.
@@ -312,7 +312,7 @@
          * value is in the encoding.
          */
         final private boolean m_isInEncoding[] = new boolean[RANGE];
-
+        
         private EncodingImpl() {
             // This object will answer whether any unicode value
             // is in the encoding, it handles values 0 through Integer.MAX_VALUE
@@ -323,15 +323,17 @@
             // Set the range of unicode values that this object manages
             // either explicitly or implicitly.
             m_first = first;
-            m_last = last;
-
-            // Set the range of unicode values that this object
-            // explicitly manages
-            m_explFirst = codePoint;
-            m_explLast = codePoint + (RANGE-1);
-
+            m_last = last;  
+                      
+            // Set the range of unicode values that this object 
+            // explicitly manages. Align the explicitly managed values
+            // to RANGE so multiple EncodingImpl objects dont manage the same 
+            // values.
+            m_explFirst = codePoint / RANGE * RANGE;
+            m_explLast = m_explFirst + (RANGE-1);
+            
             m_encoding = encoding;
-
+            
             if (javaName != null)
             {
                 // Some optimization.
@@ -345,7 +347,7 @@
                         || "Unicode".equals(javaName)
                         || "UNICODE".equals(javaName)
                         || javaName.startsWith("ISO8859")) {
-
+                        
                         // Not only does this EncodingImpl object explicitly
                         // handle chracters in the low range, it is
                         // also one that we know something about, without
@@ -368,7 +370,7 @@
                 }
 
                 /* A little bit more than optimization.
-                 *
+                 * 
                  * We will say that any character is in the encoding if
                  * we don't have an encoding.
                  * This is meaningful when the serializer is being used
@@ -397,38 +399,38 @@
      * @param ch the char in question, that is not a high char of
      * a high/low surrogate pair.
      * @param encoding the Java name of the enocding.
-     *
+     * 
      * @xsl.usage internal
-     *
+     * 
      */
     private static boolean inEncoding(char ch, String encoding) {
         boolean isInEncoding;
         try {
             char cArray[] = new char[1];
             cArray[0] = ch;
-            // Construct a String from the char
+            // Construct a String from the char 
             String s = new String(cArray);
-            // Encode the String into a sequence of bytes
-            // using the given, named charset.
+            // Encode the String into a sequence of bytes 
+            // using the given, named charset. 
             byte[] bArray = s.getBytes(encoding);
             isInEncoding = inEncoding(ch, bArray);
 
         } catch (Exception e) {
             isInEncoding = false;
-
+            
             // If for some reason the encoding is null, e.g.
             // for a temporary result tree, we should just
             // say that every character is in the encoding.
             if (encoding == null)
-                isInEncoding = true;
+            	isInEncoding = true;
         }
         return isInEncoding;
     }
-
+    
     /**
      * This is heart of the code that determines if a given high/low
      * surrogate pair forms a character that is in the given encoding.
-     * This method is probably expensive, and the answer should be cached.
+     * This method is probably expensive, and the answer should be cached. 
      * <p>
      * This method is not a public API,
      * and should only be used internally within the serializer.
@@ -436,29 +438,29 @@
      * a high/low surrogate pair.
      * @param low the low char of a high/low surrogate pair.
      * @param encoding the Java name of the encoding.
-     *
+     * 
      * @xsl.usage internal
-     *
-     */
+     * 
+     */ 
     private static boolean inEncoding(char high, char low, String encoding) {
         boolean isInEncoding;
         try {
             char cArray[] = new char[2];
             cArray[0] = high;
             cArray[1] = low;
-            // Construct a String from the char
+            // Construct a String from the char 
             String s = new String(cArray);
-            // Encode the String into a sequence of bytes
-            // using the given, named charset.
+            // Encode the String into a sequence of bytes 
+            // using the given, named charset. 
             byte[] bArray = s.getBytes(encoding);
             isInEncoding = inEncoding(high,bArray);
         } catch (Exception e) {
             isInEncoding = false;
         }
-
+        
         return isInEncoding;
-    }
-
+    } 
+    
     /**
      * This method is the core of determining if character
      * is in the encoding. The method is not foolproof, because
@@ -475,7 +477,7 @@
         // If the string written out as data is not in the encoding,
         // the output is not specified according to the documentation
         // on the String.getBytes(encoding) method,
-        // but we do our best here.
+        // but we do our best here.        
         if (data==null || data.length == 0) {
             isInEncoding = false;
         }
@@ -486,11 +488,11 @@
                 isInEncoding = false;
             /*
              * else if (isJapanese) {
-             *   // isJapanese is really
-             *   //   (    "EUC-JP".equals(javaName)
+             *   // isJapanese is really 
+             *   //   (    "EUC-JP".equals(javaName) 
              *   //    ||  "EUC_JP".equals(javaName)
              *  //     ||  "SJIS".equals(javaName)   )
-             *
+             * 
              *   // Work around some bugs in JRE for Japanese
              *   if(data[0] == 0x21)
              *     isInEncoding = false;
@@ -499,11 +501,11 @@
              *   else
              *     isInEncoding = true;
              * }
-             */
-
+             */ 
+                
             else {
                 // We don't know for sure, but it looks like it is in the encoding
-                isInEncoding = true;
+                isInEncoding = true; 
             }
         }
         return isInEncoding;
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/Encodings.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/Encodings.java	Wed Sep 28 16:49:43 2011 +0100
@@ -27,6 +27,7 @@
 import java.io.OutputStreamWriter;
 import java.io.UnsupportedEncodingException;
 import java.io.Writer;
+import java.io.BufferedWriter;
 import java.lang.reflect.Method;
 import java.net.URL;
 import java.util.Enumeration;
@@ -43,6 +44,7 @@
  * to override encoding names and provide the last printable character
  * for each encoding.
  *
+ * @version $Revision: 1.8 $ $Date: 2007/10/12 04:14:45 $
  * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
  */
 
@@ -64,7 +66,7 @@
      */
     private static final String ENCODINGS_PROP = "com.sun.org.apache.xalan.internal.serialize.encodings";
 
-
+    
     /**
      * Returns a writer for the specified encoding based on
      * an output stream.
@@ -85,9 +87,9 @@
             {
                 try
                 {
-                    return new OutputStreamWriter(
+                    return new BufferedWriter(new OutputStreamWriter(
                         output,
-                        _encodings[i].javaName);
+                        _encodings[i].javaName));
                 }
                 catch (java.lang.IllegalArgumentException iae) // java 1.1.8
                 {
@@ -103,14 +105,14 @@
 
         try
         {
-            return new OutputStreamWriter(output, encoding);
+            return new BufferedWriter(new OutputStreamWriter(output, encoding));
         }
         catch (java.lang.IllegalArgumentException iae) // java 1.1.8
         {
             throw new UnsupportedEncodingException(encoding);
         }
     }
-
+    
 
     /**
      * Returns the last printable character for an unspecified
@@ -122,9 +124,9 @@
     {
         return m_defaultLastPrintable;
     }
-
-
-
+    
+    
+    
     /**
      * Returns the EncodingInfo object for the specified
      * encoding.
@@ -132,7 +134,7 @@
      * This is not a public API.
      *
      * @param encoding The encoding
-     * @return The object that is used to determine if
+     * @return The object that is used to determine if 
      * characters are in the given encoding.
      * @xsl.usage internal
      */
@@ -151,7 +153,7 @@
 
         return ei;
     }
-
+ 
     /**
      * A fast and cheap way to uppercase a String that is
      * only made of printable ASCII characters.
@@ -164,29 +166,29 @@
      */
     static private String toUpperCaseFast(final String s) {
 
-        boolean different = false;
-        final int mx = s.length();
-                char[] chars = new char[mx];
-        for (int i=0; i < mx; i++) {
-                char ch = s.charAt(i);
+    	boolean different = false;
+    	final int mx = s.length();
+		char[] chars = new char[mx];
+    	for (int i=0; i < mx; i++) {
+    		char ch = s.charAt(i);
             // is the character a lower case ASCII one?
-                if ('a' <= ch && ch <= 'z') {
+    		if ('a' <= ch && ch <= 'z') {
                 // a cheap and fast way to uppercase that is good enough
-                        ch = (char) (ch + ('A' - 'a'));
-                        different = true; // the uppercased String is different
-                }
-                chars[i] = ch;
-        }
-
-        // A little optimization, don't call String.valueOf() if
-        // the uppercased string is the same as the input string.
-        final String upper;
-        if (different)
-                upper = String.valueOf(chars);
-        else
-                upper = s;
-
-        return upper;
+    			ch = (char) (ch + ('A' - 'a'));
+    			different = true; // the uppercased String is different
+    		}
+    		chars[i] = ch;
+    	}
+    	
+    	// A little optimization, don't call String.valueOf() if
+    	// the uppercased string is the same as the input string.
+    	final String upper;
+    	if (different) 
+    		upper = String.valueOf(chars);
+    	else
+    		upper = s;
+    		
+    	return upper;
     }
 
     /** The default encoding, ISO style, ISO style.   */
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/serializer/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -38,12 +38,12 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
  * @xsl.usage internal
@@ -126,7 +126,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +142,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +173,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +220,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +265,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +322,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +338,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +364,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +393,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +449,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +458,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +473,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +487,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +558,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +583,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +600,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +625,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = 8859254254255146542L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.8 2008/04/02 00:41:01 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -168,7 +169,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -215,7 +216,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -260,7 +261,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -317,13 +318,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -333,7 +334,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -359,10 +360,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -388,7 +389,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -444,7 +445,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -453,7 +454,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -468,11 +469,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -482,11 +483,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -553,7 +554,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -578,7 +579,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -595,11 +596,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -620,7 +621,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = 2036619216663421552L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/ThreadControllerWrapper.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/ThreadControllerWrapper.java	Wed Sep 28 16:49:43 2011 +0100
@@ -28,23 +28,23 @@
  */
 public class ThreadControllerWrapper
 {
-
+  
   /** The ThreadController pool   */
   private static ThreadController m_tpool = new ThreadController();
-
+  
   public static Thread runThread(Runnable runnable, int priority)
   {
     return m_tpool.run(runnable, priority);
   }
-
+  
   public static void waitThread(Thread worker, Runnable task)
     throws InterruptedException
   {
     m_tpool.waitThread(worker, task);
   }
-
+  
   /**
-   * Thread controller utility class for incremental SAX source. Must
+   * Thread controller utility class for incremental SAX source. Must 
    * be overriden with a derived class to support thread pooling.
    *
    * All thread-related stuff is in this class.
@@ -53,35 +53,35 @@
   {
 
     /**
-      * This class was introduced as a fix for CR 6607339.
-      */
-     final class SafeThread extends Thread {
-          private volatile boolean ran = false;
-
-          public SafeThread(Runnable target) {
-              super(target);
-          }
+     * This class was introduced as a fix for CR 6607339.
+     */
+    final class SafeThread extends Thread {
+         private volatile boolean ran = false;
+         
+         public SafeThread(Runnable target) {
+             super(target);
+         }
+         
+         public final void run() {
+             if (Thread.currentThread() != this) {
+                 throw new IllegalStateException("The run() method in a"
+                     + " SafeThread cannot be called from another thread.");
+             }
+             synchronized (this) {
+                if (!ran) {
+                    ran = true;
+                }
+                else {
+                 throw new IllegalStateException("The run() method in a"
+                     + " SafeThread cannot be called more than once.");
+                 }                 
+             }             
+             super.run();
+         }
+    }
 
-          public final void run() {
-              if (Thread.currentThread() != this) {
-                  throw new IllegalStateException("The run() method in a"
-                      + " SafeThread cannot be called from another thread.");
-              }
-              synchronized (this) {
-                 if (!ran) {
-                     ran = true;
-                 }
-                 else {
-                  throw new IllegalStateException("The run() method in a"
-                      + " SafeThread cannot be called more than once.");
-                 }
-              }
-              super.run();
-          }
-     }
-
-     /**
-     *  Will get a thread from the pool, execute the task
+    /**
+     * Will get a thread from the pool, execute the task
      *  and return the thread to the pool.
      *
      *  The return value is used only to wait for completion
@@ -122,5 +122,5 @@
       worker.join();
     }
   }
-
+ 
 }
--- a/sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xml/internal/utils/XMLReaderManager.java	Wed Sep 28 16:49:43 2011 +0100
@@ -44,7 +44,7 @@
                              "http://xml.org/sax/features/namespace-prefixes";
     private static final XMLReaderManager m_singletonManager =
                                                      new XMLReaderManager();
-
+    private static final String property = "org.xml.sax.driver";
     /**
      * Parser factory to be used to construct XMLReader objects
      */
@@ -94,13 +94,15 @@
         }
 
         // If the cached reader for this thread is in use, construct a new
-        // one; otherwise, return the cached reader unless it isn't an
+        // one; otherwise, return the cached reader unless it isn't an 
         // instance of the class set in the 'org.xml.sax.driver' property
         reader = (XMLReader) m_readers.get();
         boolean threadHasReader = (reader != null);
-        String factory = SecuritySupport.getInstance().getSystemProperty("org.xml.sax.driver");
-        if (!threadHasReader || m_inUse.get(reader) == Boolean.TRUE ||
-                !reader.getClass().getName().equals(factory)) {
+        String factory = SecuritySupport.getInstance().getSystemProperty(property);
+        if (threadHasReader && m_inUse.get(reader) != Boolean.TRUE &&
+                ( factory == null || reader.getClass().getName().equals(factory))) {
+            m_inUse.put(reader, Boolean.TRUE);
+        } else {
             try {
                 try {
                     // According to JAXP 1.2 specification, if a SAXSource
@@ -108,6 +110,7 @@
                     // TransformerFactory creates a reader via the
                     // XMLReaderFactory if setXMLReader is not used
                     reader = XMLReaderFactory.createXMLReader();
+
                 } catch (Exception e) {
                    try {
                         // If unable to create an instance, let's try to use
@@ -143,9 +146,7 @@
                 m_readers.set(reader);
                 m_inUse.put(reader, Boolean.TRUE);
             }
-        } else {
-            m_inUse.put(reader, Boolean.TRUE);
-        }
+        } 
 
         return reader;
     }
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/compiler/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/compiler/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -47,6 +47,7 @@
  * class and modified to be used as a general utility for creating objects
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.6 2008/04/02 00:41:02 joehw Exp $
  */
 class ObjectFactory {
 
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -323,13 +324,13 @@
                         fXalanProperties.load(fis);
                         fis.close();
                     }
-                    } catch (Exception x) {
-                        fXalanProperties = null;
-                        fLastModified = -1;
+	            } catch (Exception x) {
+	                fXalanProperties = null;
+	                fLastModified = -1;
                         // assert(x instanceof FileNotFoundException
-                        //        || x instanceof SecurityException)
-                        // In both cases, ignore and continue w/ next location
-                    }
+	                //        || x instanceof SecurityException)
+	                // In both cases, ignore and continue w/ next location
+	            }
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -349,7 +350,7 @@
             }
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -440,7 +441,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -537,7 +538,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -576,7 +577,7 @@
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/functions/ObjectFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/functions/ObjectFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -39,14 +39,15 @@
  * <p>
  * This code is designed to implement the JAXP 1.1 spec pluggability
  * feature and is designed to run on JDK version 1.1 and
- * later, and to compile on JDK 1.2 and onward.
+ * later, and to compile on JDK 1.2 and onward.  
  * The code also runs both as part of an unbundled jar file and
  * when bundled as part of the JDK.
  * <p>
  * This class was moved from the <code>javax.xml.parsers.ObjectFactory</code>
- * class and modified to be used as a general utility for creating objects
+ * class and modified to be used as a general utility for creating objects 
  * dynamically.
  *
+ * @version $Id: ObjectFactory.java,v 1.7 2008/04/02 00:40:59 joehw Exp $
  */
 class ObjectFactory {
 
@@ -126,7 +127,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Object createObject(String factoryId,
+    static Object createObject(String factoryId, 
                                       String propertiesFilename,
                                       String fallbackClassName)
         throws ConfigurationError
@@ -142,7 +143,7 @@
 
         try{
             Object instance = factoryClass.newInstance();
-            debugPrintln("created new instance of factory " + factoryId);
+            if (DEBUG) debugPrintln("created new instance of factory " + factoryId);
             return instance;
         } catch (Exception x) {
             throw new ConfigurationError(
@@ -173,7 +174,7 @@
      *
      * @exception ObjectFactory.ConfigurationError
      */
-    static Class lookUpFactoryClass(String factoryId)
+    static Class lookUpFactoryClass(String factoryId) 
         throws ConfigurationError
     {
         return lookUpFactoryClass(factoryId, null, null);
@@ -220,7 +221,7 @@
             Class providerClass = findProviderClass(factoryClassName,
                                                     cl,
                                                     true);
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return providerClass;
         } catch (ClassNotFoundException x) {
@@ -265,7 +266,7 @@
         try {
             String systemProp = ss.getSystemProperty(factoryId);
             if (systemProp != null) {
-                debugPrintln("found system property, value=" + systemProp);
+                if (DEBUG) debugPrintln("found system property, value=" + systemProp);
                 return systemProp;
             }
         } catch (SecurityException se) {
@@ -322,13 +323,13 @@
                         fis = ss.getFileInputStream(propertiesFile);
                         fXalanProperties.load(fis);
                     }
-                } catch (Exception x) {
-                    fXalanProperties = null;
-                    fLastModified = -1;
+	        } catch (Exception x) {
+	            fXalanProperties = null;
+	            fLastModified = -1;
                     // assert(x instanceof FileNotFoundException
-                    //        || x instanceof SecurityException)
-                    // In both cases, ignore and continue w/ next location
-                }
+	            //        || x instanceof SecurityException)
+	            // In both cases, ignore and continue w/ next location
+	        }
                 finally {
                     // try to close the input stream if one was opened.
                     if (fis != null) {
@@ -338,7 +339,7 @@
                         // Ignore the exception.
                         catch (IOException exc) {}
                     }
-                }
+                }	            
             }
             if(fXalanProperties != null) {
                 factoryClassName = fXalanProperties.getProperty(factoryId);
@@ -364,10 +365,10 @@
                     // Ignore the exception.
                     catch (IOException exc) {}
                 }
-            }
+            }               
         }
         if (factoryClassName != null) {
-            debugPrintln("found in " + propertiesFilename + ", value="
+            if (DEBUG) debugPrintln("found in " + propertiesFilename + ", value="
                           + factoryClassName);
             return factoryClassName;
         }
@@ -393,7 +394,7 @@
      */
     static ClassLoader findClassLoader()
         throws ConfigurationError
-    {
+    { 
         SecuritySupport ss = SecuritySupport.getInstance();
 
         // Figure out which ClassLoader to use for loading the provider
@@ -449,7 +450,7 @@
 
     /**
      * Create an instance of a class using the specified ClassLoader
-     */
+     */ 
     static Object newInstance(String className, ClassLoader cl,
                                       boolean doFallback)
         throws ConfigurationError
@@ -458,7 +459,7 @@
         try{
             Class providerClass = findProviderClass(className, cl, doFallback);
             Object instance = providerClass.newInstance();
-            debugPrintln("created new instance of " + providerClass +
+            if (DEBUG) debugPrintln("created new instance of " + providerClass +
                    " using ClassLoader: " + cl);
             return instance;
         } catch (ClassNotFoundException x) {
@@ -473,11 +474,11 @@
 
     /**
      * Find a Class using the specified ClassLoader
-     */
+     */ 
     static Class findProviderClass(String className, ClassLoader cl,
                                            boolean doFallback)
         throws ClassNotFoundException, ConfigurationError
-    {
+    {   
         //throw security exception if the calling thread is not allowed to access the
         //class. Restrict the access to the package classes as specified in java.security policy.
         SecurityManager security = System.getSecurityManager();
@@ -487,11 +488,11 @@
                     String packageName = className;
                     if (lastDot != -1) packageName = className.substring(0, lastDot);
                     security.checkPackageAccess(packageName);
-                 }
+                 }   
         }catch(SecurityException e){
             throw e;
         }
-
+        
         Class providerClass;
         if (cl == null) {
             // XXX Use the bootstrap ClassLoader.  There is no way to
@@ -558,7 +559,7 @@
             return null;
         }
 
-        debugPrintln("found jar resource=" + serviceId +
+        if (DEBUG) debugPrintln("found jar resource=" + serviceId +
                " using ClassLoader: " + cl);
 
         // Read the service provider name in UTF-8 as specified in
@@ -583,7 +584,7 @@
         } catch (java.io.UnsupportedEncodingException e) {
             rd = new BufferedReader(new InputStreamReader(is));
         }
-
+        
         String factoryClassName = null;
         try {
             // XXX Does not handle all possible input as specified by the
@@ -600,11 +601,11 @@
             }
             // Ignore the exception.
             catch (IOException exc) {}
-        }
+        }          
 
         if (factoryClassName != null &&
             ! "".equals(factoryClassName)) {
-            debugPrintln("found in resource, value="
+            if (DEBUG) debugPrintln("found in resource, value="
                    + factoryClassName);
 
             // Note: here we do not want to fall back to the current
@@ -625,7 +626,7 @@
     /**
      * A configuration error.
      */
-    static class ConfigurationError
+    static class ConfigurationError 
         extends Error {
                 static final long serialVersionUID = -5782303800588797207L;
         //
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/jaxp/XPathFactoryImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -33,45 +33,59 @@
 /**
  * The XPathFactory builds XPaths.
  *
+ * @version $Revision: 1.8 $
  * @author  Ramesh Mandava
  */
 public  class XPathFactoryImpl extends XPathFactory {
+	
+	/**
+	 * <p>Name of class as a constant to use for debugging.</p>
+	 */
+	private static final String CLASS_NAME = "XPathFactoryImpl";
+	
+	/**
+	 *<p>XPathFunctionResolver for this XPathFactory and created XPaths.</p>
+	 */
+	private XPathFunctionResolver xPathFunctionResolver = null;
+	
+	/**
+	 * <p>XPathVariableResolver for this XPathFactory and created XPaths</p>
+	 */
+	private XPathVariableResolver xPathVariableResolver = null;
 
-        /**
-         * <p>Name of class as a constant to use for debugging.</p>
-         */
-        private static final String CLASS_NAME = "XPathFactoryImpl";
-
+	/**
+	 * <p>State of secure processing feature.</p>
+	 */
+	private boolean featureSecureProcessing = false;
         /**
-         *<p>XPathFunctionResolver for this XPathFactory and created XPaths.</p>
+         * <p>State of secure mode.</p>
          */
-        private XPathFunctionResolver xPathFunctionResolver = null;
-
-        /**
-         * <p>XPathVariableResolver for this XPathFactory and created XPaths</p>
-         */
-        private XPathVariableResolver xPathVariableResolver = null;
-
+        private boolean _isSecureMode = false;
         /**
-         * <p>State of secure processing feature.</p>
+         * javax.xml.xpath.XPathFactory implementation.
          */
-        private boolean featureSecureProcessing = false;
-
-        /**
-         * <p>Is specified object model supported by this
+        public XPathFactoryImpl() {
+            if (System.getSecurityManager() != null) {
+                _isSecureMode = true;
+                featureSecureProcessing = true;
+            }
+        }
+		
+	/**
+	 * <p>Is specified object model supported by this 
          * <code>XPathFactory</code>?</p>
-         *
-         * @param objectModel Specifies the object model which the returned
+	 * 
+	 * @param objectModel Specifies the object model which the returned
          * <code>XPathFactory</code> will understand.
-         *
-         * @return <code>true</code> if <code>XPathFactory</code> supports
+	 *  
+	 * @return <code>true</code> if <code>XPathFactory</code> supports 
          * <code>objectModel</code>, else <code>false</code>.
-         *
-         * @throws NullPointerException If <code>objectModel</code> is <code>null</code>.
-         * @throws IllegalArgumentException If <code>objectModel.length() == 0</code>.
-         */
-        public boolean isObjectModelSupported(String objectModel) {
-
+	 * 
+	 * @throws NullPointerException If <code>objectModel</code> is <code>null</code>.
+	 * @throws IllegalArgumentException If <code>objectModel.length() == 0</code>.
+	 */
+	public boolean isObjectModelSupported(String objectModel) {
+		
             if (objectModel == null) {
                 String fmsg = XSLMessages.createXPATHMessage(
                         XPATHErrorResources.ER_OBJECT_MODEL_NULL,
@@ -79,64 +93,64 @@
 
                 throw new NullPointerException( fmsg );
             }
-
+		
             if (objectModel.length() == 0) {
                 String fmsg = XSLMessages.createXPATHMessage(
                         XPATHErrorResources.ER_OBJECT_MODEL_EMPTY,
                         new Object[] { this.getClass().getName() } );
                 throw new IllegalArgumentException( fmsg );
             }
-
-            // know how to support default object model, W3C DOM
+		
+	    // know how to support default object model, W3C DOM
             if (objectModel.equals(XPathFactory.DEFAULT_OBJECT_MODEL_URI)) {
                 return true;
             }
-
+		
             // don't know how to support anything else
             return false;
-        }
+	}
 
         /**
          * <p>Returns a new <code>XPath</code> object using the underlying
          * object model determined when the factory was instantiated.</p>
-         *
-         * @return New <code>XPath</code>
-         */
-        public javax.xml.xpath.XPath newXPath() {
-            return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl(
+	 * 
+	 * @return New <code>XPath</code>
+	 */
+	public javax.xml.xpath.XPath newXPath() {
+	    return new com.sun.org.apache.xpath.internal.jaxp.XPathImpl(
                     xPathVariableResolver, xPathFunctionResolver,
                     featureSecureProcessing );
-        }
-
-        /**
-         * <p>Set a feature for this <code>XPathFactory</code> and
+	}
+	    
+	/**
+	 * <p>Set a feature for this <code>XPathFactory</code> and 
          * <code>XPath</code>s created by this factory.</p>
-         *
-         * <p>
-         * Feature names are fully qualified {@link java.net.URI}s.
-         * Implementations may define their own features.
-         * An {@link XPathFactoryConfigurationException} is thrown if this
+	 * 
+	 * <p>
+	 * Feature names are fully qualified {@link java.net.URI}s.
+	 * Implementations may define their own features.
+	 * An {@link XPathFactoryConfigurationException} is thrown if this
          * <code>XPathFactory</code> or the <code>XPath</code>s
-         *  it creates cannot support the feature.
-         * It is possible for an <code>XPathFactory</code> to expose a feature
+	 *  it creates cannot support the feature.
+	 * It is possible for an <code>XPathFactory</code> to expose a feature
          * value but be unable to change its state.
-         * </p>
-         *
-         * <p>See {@link javax.xml.xpath.XPathFactory} for full documentation
+	 * </p>
+	 * 
+	 * <p>See {@link javax.xml.xpath.XPathFactory} for full documentation
          * of specific features.</p>
-         *
-         * @param name Feature name.
-         * @param value Is feature state <code>true</code> or <code>false</code>.
-         *
-         * @throws XPathFactoryConfigurationException if this
+	 * 
+	 * @param name Feature name.
+	 * @param value Is feature state <code>true</code> or <code>false</code>.
+	 *  
+	 * @throws XPathFactoryConfigurationException if this 
          * <code>XPathFactory</code> or the <code>XPath</code>s
-         *   it creates cannot support this feature.
-         * @throws NullPointerException if <code>name</code> is
+	 *   it creates cannot support this feature.
+         * @throws NullPointerException if <code>name</code> is 
          * <code>null</code>.
-         */
-        public void setFeature(String name, boolean value)
-                throws XPathFactoryConfigurationException {
-
+	 */
+	public void setFeature(String name, boolean value)
+		throws XPathFactoryConfigurationException {
+			
             // feature name cannot be null
             if (name == null) {
                 String fmsg = XSLMessages.createXPATHMessage(
@@ -144,48 +158,54 @@
                         new Object[] { CLASS_NAME, new Boolean( value) } );
                 throw new NullPointerException( fmsg );
              }
-
+		
             // secure processing?
             if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
+                if ((_isSecureMode) && (!value)) {
+                    String fmsg = XSLMessages.createXPATHMessage(
+                            XPATHErrorResources.ER_SECUREPROCESSING_FEATURE,
+                            new Object[] { name, CLASS_NAME, new Boolean(value) } );
+                    throw new XPathFactoryConfigurationException( fmsg );
+                }
 
                 featureSecureProcessing = value;
-
+						
                 // all done processing feature
                 return;
             }
-
+		
             // unknown feature
             String fmsg = XSLMessages.createXPATHMessage(
                     XPATHErrorResources.ER_FEATURE_UNKNOWN,
                     new Object[] { name, CLASS_NAME, new Boolean(value) } );
             throw new XPathFactoryConfigurationException( fmsg );
-        }
+	}
 
-        /**
-         * <p>Get the state of the named feature.</p>
-         *
-         * <p>
-         * Feature names are fully qualified {@link java.net.URI}s.
-         * Implementations may define their own features.
-         * An {@link XPathFactoryConfigurationException} is thrown if this
+	/**
+	 * <p>Get the state of the named feature.</p>
+	 * 
+	 * <p>
+	 * Feature names are fully qualified {@link java.net.URI}s.
+	 * Implementations may define their own features.
+	 * An {@link XPathFactoryConfigurationException} is thrown if this
          * <code>XPathFactory</code> or the <code>XPath</code>s
-         * it creates cannot support the feature.
-         * It is possible for an <code>XPathFactory</code> to expose a feature
+	 * it creates cannot support the feature.
+	 * It is possible for an <code>XPathFactory</code> to expose a feature 
          * value but be unable to change its state.
-         * </p>
-         *
-         * @param name Feature name.
-         *
-         * @return State of the named feature.
-         *
-         * @throws XPathFactoryConfigurationException if this
+	 * </p>
+	 * 
+	 * @param name Feature name.
+	 * 
+	 * @return State of the named feature.
+	 * 
+	 * @throws XPathFactoryConfigurationException if this 
          * <code>XPathFactory</code> or the <code>XPath</code>s
-         *   it creates cannot support this feature.
-         * @throws NullPointerException if <code>name</code> is
+	 *   it creates cannot support this feature.
+         * @throws NullPointerException if <code>name</code> is 
          * <code>null</code>.
-         */
-        public boolean getFeature(String name)
-                throws XPathFactoryConfigurationException {
+	 */
+	public boolean getFeature(String name)
+		throws XPathFactoryConfigurationException {
 
             // feature name cannot be null
             if (name == null) {
@@ -194,12 +214,12 @@
                         new Object[] { CLASS_NAME } );
                 throw new NullPointerException( fmsg );
             }
-
+		
             // secure processing?
             if (name.equals(XMLConstants.FEATURE_SECURE_PROCESSING)) {
                 return featureSecureProcessing;
             }
-
+		
             // unknown feature
             String fmsg = XSLMessages.createXPATHMessage(
                     XPATHErrorResources.ER_GETTING_UNKNOWN_FEATURE,
@@ -207,23 +227,23 @@
 
             throw new XPathFactoryConfigurationException( fmsg );
         }
-
-        /**
+		
+	/**
          * <p>Establish a default function resolver.</p>
-         *
-         * <p>Any <code>XPath</code> objects constructed from this factory will use
-         * the specified resolver by default.</p>
-         *
-         * <p>A <code>NullPointerException</code> is thrown if
+         * 
+	 * <p>Any <code>XPath</code> objects constructed from this factory will use
+	 * the specified resolver by default.</p>
+	 *
+	 * <p>A <code>NullPointerException</code> is thrown if 
          * <code>resolver</code> is <code>null</code>.</p>
-         *
-         * @param resolver XPath function resolver.
-         *
-         * @throws NullPointerException If <code>resolver</code> is
+         * 
+	 * @param resolver XPath function resolver.
+	 * 
+	 * @throws NullPointerException If <code>resolver</code> is 
          * <code>null</code>.
-         */
+	 */
         public void setXPathFunctionResolver(XPathFunctionResolver resolver) {
-
+			
             // resolver cannot be null
             if (resolver == null) {
                 String fmsg = XSLMessages.createXPATHMessage(
@@ -231,33 +251,36 @@
                         new Object[] {  CLASS_NAME } );
                 throw new NullPointerException( fmsg );
             }
-
+			
             xPathFunctionResolver = resolver;
         }
+		
+	/**
+	 * <p>Establish a default variable resolver.</p>
+	 *
+	 * <p>Any <code>XPath</code> objects constructed from this factory will use
+	 * the specified resolver by default.</p>
+	 * 
+	 * <p>A <code>NullPointerException</code> is thrown if <code>resolver</code> is <code>null</code>.</p>
+	 * 
+	 * @param resolver Variable resolver.
+	 * 
+	 *  @throws NullPointerException If <code>resolver</code> is 
+         * <code>null</code>.
+	 */
+	public void setXPathVariableResolver(XPathVariableResolver resolver) {
 
-        /**
-         * <p>Establish a default variable resolver.</p>
-         *
-         * <p>Any <code>XPath</code> objects constructed from this factory will use
-         * the specified resolver by default.</p>
-         *
-         * <p>A <code>NullPointerException</code> is thrown if <code>resolver</code> is <code>null</code>.</p>
-         *
-         * @param resolver Variable resolver.
-         *
-         *  @throws NullPointerException If <code>resolver</code> is
-         * <code>null</code>.
-         */
-        public void setXPathVariableResolver(XPathVariableResolver resolver) {
-
-                // resolver cannot be null
-                if (resolver == null) {
+		// resolver cannot be null
+		if (resolver == null) {
                     String fmsg = XSLMessages.createXPATHMessage(
                             XPATHErrorResources.ER_NULL_XPATH_VARIABLE_RESOLVER,
                             new Object[] {  CLASS_NAME } );
-                    throw new NullPointerException( fmsg );
-                }
+		    throw new NullPointerException( fmsg );
+		}
+			
+		xPathVariableResolver = resolver;
+	}
+}
 
-                xPathVariableResolver = resolver;
-        }
-}
+
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources.java	Wed Sep 28 16:49:43 2011 +0100
@@ -87,182 +87,182 @@
  *  11) QName is an XML term meaning "qualified name".
  */
 
-  /*
+  /* 
    * static variables
    */
   public static final String ERROR0000 = "ERROR0000";
-  public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH =
-         "ER_CURRENT_NOT_ALLOWED_IN_MATCH";
-  public static final String ER_CURRENT_TAKES_NO_ARGS =
-         "ER_CURRENT_TAKES_NO_ARGS";
+  public static final String ER_CURRENT_NOT_ALLOWED_IN_MATCH = 
+	 "ER_CURRENT_NOT_ALLOWED_IN_MATCH";
+  public static final String ER_CURRENT_TAKES_NO_ARGS = 
+	 "ER_CURRENT_TAKES_NO_ARGS";
   public static final String ER_DOCUMENT_REPLACED = "ER_DOCUMENT_REPLACED";
-  public static final String ER_CONTEXT_HAS_NO_OWNERDOC =
-         "ER_CONTEXT_HAS_NO_OWNERDOC";
-  public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS =
-         "ER_LOCALNAME_HAS_TOO_MANY_ARGS";
-  public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS =
-         "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS";
-  public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS =
-         "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS";
-  public static final String ER_NUMBER_HAS_TOO_MANY_ARGS =
-         "ER_NUMBER_HAS_TOO_MANY_ARGS";
-  public static final String ER_NAME_HAS_TOO_MANY_ARGS =
-         "ER_NAME_HAS_TOO_MANY_ARGS";
-  public static final String ER_STRING_HAS_TOO_MANY_ARGS =
-         "ER_STRING_HAS_TOO_MANY_ARGS";
-  public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS =
-         "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS";
-  public static final String ER_TRANSLATE_TAKES_3_ARGS =
-         "ER_TRANSLATE_TAKES_3_ARGS";
-  public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG =
-         "ER_UNPARSEDENTITYURI_TAKES_1_ARG";
-  public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED =
-         "ER_NAMESPACEAXIS_NOT_IMPLEMENTED";
+  public static final String ER_CONTEXT_HAS_NO_OWNERDOC = 
+	 "ER_CONTEXT_HAS_NO_OWNERDOC";
+  public static final String ER_LOCALNAME_HAS_TOO_MANY_ARGS = 
+	 "ER_LOCALNAME_HAS_TOO_MANY_ARGS";
+  public static final String ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = 
+	 "ER_NAMESPACEURI_HAS_TOO_MANY_ARGS";
+  public static final String ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = 
+	 "ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS";
+  public static final String ER_NUMBER_HAS_TOO_MANY_ARGS = 
+	 "ER_NUMBER_HAS_TOO_MANY_ARGS";
+  public static final String ER_NAME_HAS_TOO_MANY_ARGS = 
+	 "ER_NAME_HAS_TOO_MANY_ARGS";
+  public static final String ER_STRING_HAS_TOO_MANY_ARGS = 
+	 "ER_STRING_HAS_TOO_MANY_ARGS";
+  public static final String ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = 
+	 "ER_STRINGLENGTH_HAS_TOO_MANY_ARGS";
+  public static final String ER_TRANSLATE_TAKES_3_ARGS = 
+	 "ER_TRANSLATE_TAKES_3_ARGS";
+  public static final String ER_UNPARSEDENTITYURI_TAKES_1_ARG = 
+	 "ER_UNPARSEDENTITYURI_TAKES_1_ARG";
+  public static final String ER_NAMESPACEAXIS_NOT_IMPLEMENTED = 
+	 "ER_NAMESPACEAXIS_NOT_IMPLEMENTED";
   public static final String ER_UNKNOWN_AXIS = "ER_UNKNOWN_AXIS";
-  public static final String ER_UNKNOWN_MATCH_OPERATION =
-         "ER_UNKNOWN_MATCH_OPERATION";
+  public static final String ER_UNKNOWN_MATCH_OPERATION = 
+	 "ER_UNKNOWN_MATCH_OPERATION";
   public static final String ER_INCORRECT_ARG_LENGTH ="ER_INCORRECT_ARG_LENGTH";
-  public static final String ER_CANT_CONVERT_TO_NUMBER =
-         "ER_CANT_CONVERT_TO_NUMBER";
-  public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER =
-           "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER";
-  public static final String ER_CANT_CONVERT_TO_NODELIST =
-         "ER_CANT_CONVERT_TO_NODELIST";
-  public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST =
-         "ER_CANT_CONVERT_TO_MUTABLENODELIST";
+  public static final String ER_CANT_CONVERT_TO_NUMBER = 
+	 "ER_CANT_CONVERT_TO_NUMBER";
+  public static final String ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER = 
+	   "ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER";	 
+  public static final String ER_CANT_CONVERT_TO_NODELIST = 
+	 "ER_CANT_CONVERT_TO_NODELIST";
+  public static final String ER_CANT_CONVERT_TO_MUTABLENODELIST = 
+	 "ER_CANT_CONVERT_TO_MUTABLENODELIST";
   public static final String ER_CANT_CONVERT_TO_TYPE ="ER_CANT_CONVERT_TO_TYPE";
-  public static final String ER_EXPECTED_MATCH_PATTERN =
-         "ER_EXPECTED_MATCH_PATTERN";
-  public static final String ER_COULDNOT_GET_VAR_NAMED =
-         "ER_COULDNOT_GET_VAR_NAMED";
+  public static final String ER_EXPECTED_MATCH_PATTERN = 
+	 "ER_EXPECTED_MATCH_PATTERN";
+  public static final String ER_COULDNOT_GET_VAR_NAMED = 
+	 "ER_COULDNOT_GET_VAR_NAMED";
   public static final String ER_UNKNOWN_OPCODE = "ER_UNKNOWN_OPCODE";
   public static final String ER_EXTRA_ILLEGAL_TOKENS ="ER_EXTRA_ILLEGAL_TOKENS";
-  public static final String ER_EXPECTED_DOUBLE_QUOTE =
-         "ER_EXPECTED_DOUBLE_QUOTE";
-  public static final String ER_EXPECTED_SINGLE_QUOTE =
-         "ER_EXPECTED_SINGLE_QUOTE";
+  public static final String ER_EXPECTED_DOUBLE_QUOTE = 
+	 "ER_EXPECTED_DOUBLE_QUOTE";
+  public static final String ER_EXPECTED_SINGLE_QUOTE = 
+	 "ER_EXPECTED_SINGLE_QUOTE";
   public static final String ER_EMPTY_EXPRESSION = "ER_EMPTY_EXPRESSION";
   public static final String ER_EXPECTED_BUT_FOUND = "ER_EXPECTED_BUT_FOUND";
-  public static final String ER_INCORRECT_PROGRAMMER_ASSERTION =
-         "ER_INCORRECT_PROGRAMMER_ASSERTION";
-  public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL =
-         "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL";
-  public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG =
-         "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG";
-  public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG =
-         "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG";
-  public static final String ER_PREDICATE_ILLEGAL_SYNTAX =
-         "ER_PREDICATE_ILLEGAL_SYNTAX";
+  public static final String ER_INCORRECT_PROGRAMMER_ASSERTION = 
+	 "ER_INCORRECT_PROGRAMMER_ASSERTION";
+  public static final String ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = 
+	 "ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL";
+  public static final String ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = 
+	 "ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG";
+  public static final String ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = 
+	 "ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG";
+  public static final String ER_PREDICATE_ILLEGAL_SYNTAX = 
+	 "ER_PREDICATE_ILLEGAL_SYNTAX";
   public static final String ER_ILLEGAL_AXIS_NAME = "ER_ILLEGAL_AXIS_NAME";
   public static final String ER_UNKNOWN_NODETYPE = "ER_UNKNOWN_NODETYPE";
-  public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED =
-         "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED";
-  public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER =
-         "ER_COULDNOT_BE_FORMATTED_TO_NUMBER";
-  public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON =
-         "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON";
-  public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP =
-         "ER_DIDNOT_FIND_XPATH_SELECT_EXP";
-  public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH =
-         "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH";
+  public static final String ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = 
+	 "ER_PATTERN_LITERAL_NEEDS_BE_QUOTED";
+  public static final String ER_COULDNOT_BE_FORMATTED_TO_NUMBER = 
+	 "ER_COULDNOT_BE_FORMATTED_TO_NUMBER";
+  public static final String ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = 
+	 "ER_COULDNOT_CREATE_XMLPROCESSORLIAISON";
+  public static final String ER_DIDNOT_FIND_XPATH_SELECT_EXP = 
+	 "ER_DIDNOT_FIND_XPATH_SELECT_EXP";
+  public static final String ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = 
+	 "ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH";
   public static final String ER_ERROR_OCCURED = "ER_ERROR_OCCURED";
-  public static final String ER_ILLEGAL_VARIABLE_REFERENCE =
-         "ER_ILLEGAL_VARIABLE_REFERENCE";
+  public static final String ER_ILLEGAL_VARIABLE_REFERENCE = 
+	 "ER_ILLEGAL_VARIABLE_REFERENCE";
   public static final String ER_AXES_NOT_ALLOWED = "ER_AXES_NOT_ALLOWED";
-  public static final String ER_KEY_HAS_TOO_MANY_ARGS =
-         "ER_KEY_HAS_TOO_MANY_ARGS";
+  public static final String ER_KEY_HAS_TOO_MANY_ARGS = 
+	 "ER_KEY_HAS_TOO_MANY_ARGS";
   public static final String ER_COUNT_TAKES_1_ARG = "ER_COUNT_TAKES_1_ARG";
-  public static final String ER_COULDNOT_FIND_FUNCTION =
-         "ER_COULDNOT_FIND_FUNCTION";
+  public static final String ER_COULDNOT_FIND_FUNCTION = 
+	 "ER_COULDNOT_FIND_FUNCTION";
   public static final String ER_UNSUPPORTED_ENCODING ="ER_UNSUPPORTED_ENCODING";
-  public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING =
-         "ER_PROBLEM_IN_DTM_NEXTSIBLING";
-  public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL =
-         "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL";
-  public static final String ER_SETDOMFACTORY_NOT_SUPPORTED =
-         "ER_SETDOMFACTORY_NOT_SUPPORTED";
+  public static final String ER_PROBLEM_IN_DTM_NEXTSIBLING = 
+	 "ER_PROBLEM_IN_DTM_NEXTSIBLING";
+  public static final String ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = 
+	 "ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL";
+  public static final String ER_SETDOMFACTORY_NOT_SUPPORTED = 
+	 "ER_SETDOMFACTORY_NOT_SUPPORTED";
   public static final String ER_PREFIX_MUST_RESOLVE = "ER_PREFIX_MUST_RESOLVE";
   public static final String ER_PARSE_NOT_SUPPORTED = "ER_PARSE_NOT_SUPPORTED";
   public static final String ER_SAX_API_NOT_HANDLED = "ER_SAX_API_NOT_HANDLED";
-public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED =
-         "ER_IGNORABLE_WHITESPACE_NOT_HANDLED";
-  public static final String ER_DTM_CANNOT_HANDLE_NODES =
-         "ER_DTM_CANNOT_HANDLE_NODES";
-  public static final String ER_XERCES_CANNOT_HANDLE_NODES =
-         "ER_XERCES_CANNOT_HANDLE_NODES";
-  public static final String ER_XERCES_PARSE_ERROR_DETAILS =
-         "ER_XERCES_PARSE_ERROR_DETAILS";
+public static final String ER_IGNORABLE_WHITESPACE_NOT_HANDLED = 
+	 "ER_IGNORABLE_WHITESPACE_NOT_HANDLED";
+  public static final String ER_DTM_CANNOT_HANDLE_NODES = 
+	 "ER_DTM_CANNOT_HANDLE_NODES";
+  public static final String ER_XERCES_CANNOT_HANDLE_NODES = 
+	 "ER_XERCES_CANNOT_HANDLE_NODES";
+  public static final String ER_XERCES_PARSE_ERROR_DETAILS = 
+	 "ER_XERCES_PARSE_ERROR_DETAILS";
   public static final String ER_XERCES_PARSE_ERROR = "ER_XERCES_PARSE_ERROR";
-  public static final String ER_INVALID_UTF16_SURROGATE =
-         "ER_INVALID_UTF16_SURROGATE";
+  public static final String ER_INVALID_UTF16_SURROGATE = 
+	 "ER_INVALID_UTF16_SURROGATE";
   public static final String ER_OIERROR = "ER_OIERROR";
   public static final String ER_CANNOT_CREATE_URL = "ER_CANNOT_CREATE_URL";
   public static final String ER_XPATH_READOBJECT = "ER_XPATH_READOBJECT";
- public static final String ER_FUNCTION_TOKEN_NOT_FOUND =
-         "ER_FUNCTION_TOKEN_NOT_FOUND";
-  public static final String ER_CANNOT_DEAL_XPATH_TYPE =
-         "ER_CANNOT_DEAL_XPATH_TYPE";
+ public static final String ER_FUNCTION_TOKEN_NOT_FOUND = 
+	 "ER_FUNCTION_TOKEN_NOT_FOUND";
+  public static final String ER_CANNOT_DEAL_XPATH_TYPE = 
+	 "ER_CANNOT_DEAL_XPATH_TYPE";
   public static final String ER_NODESET_NOT_MUTABLE = "ER_NODESET_NOT_MUTABLE";
-  public static final String ER_NODESETDTM_NOT_MUTABLE =
-         "ER_NODESETDTM_NOT_MUTABLE";
+  public static final String ER_NODESETDTM_NOT_MUTABLE = 
+	 "ER_NODESETDTM_NOT_MUTABLE";
    /**  Variable not resolvable:   */
   public static final String ER_VAR_NOT_RESOLVABLE = "ER_VAR_NOT_RESOLVABLE";
    /** Null error handler  */
  public static final String ER_NULL_ERROR_HANDLER = "ER_NULL_ERROR_HANDLER";
    /**  Programmer's assertion: unknown opcode  */
-  public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE =
-         "ER_PROG_ASSERT_UNKNOWN_OPCODE";
+  public static final String ER_PROG_ASSERT_UNKNOWN_OPCODE = 
+	 "ER_PROG_ASSERT_UNKNOWN_OPCODE";
    /**  0 or 1   */
   public static final String ER_ZERO_OR_ONE = "ER_ZERO_OR_ONE";
    /**  rtf() not supported by XRTreeFragSelectWrapper   */
-  public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER =
-         "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
+  public static final String ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = 
+	 "ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
    /**  asNodeIterator() not supported by XRTreeFragSelectWrapper   */
   public static final String ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = "ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
    /**  fsb() not supported for XStringForChars   */
-  public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS =
-         "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS";
+  public static final String ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = 
+	 "ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS";
    /**  Could not find variable with the name of   */
  public static final String ER_COULD_NOT_FIND_VAR = "ER_COULD_NOT_FIND_VAR";
    /**  XStringForChars can not take a string for an argument   */
- public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING =
-         "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING";
+ public static final String ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = 
+	 "ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING";
    /**  The FastStringBuffer argument can not be null   */
- public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL =
-         "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL";
+ public static final String ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = 
+	 "ER_FASTSTRINGBUFFER_CANNOT_BE_NULL";
    /**  2 or 3   */
   public static final String ER_TWO_OR_THREE = "ER_TWO_OR_THREE";
    /** Variable accessed before it is bound! */
-  public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND =
-         "ER_VARIABLE_ACCESSED_BEFORE_BIND";
+  public static final String ER_VARIABLE_ACCESSED_BEFORE_BIND = 
+	 "ER_VARIABLE_ACCESSED_BEFORE_BIND";
    /** XStringForFSB can not take a string for an argument! */
- public static final String ER_FSB_CANNOT_TAKE_STRING =
-         "ER_FSB_CANNOT_TAKE_STRING";
+ public static final String ER_FSB_CANNOT_TAKE_STRING = 
+	 "ER_FSB_CANNOT_TAKE_STRING";
    /** Error! Setting the root of a walker to null! */
-  public static final String ER_SETTING_WALKER_ROOT_TO_NULL =
-         "ER_SETTING_WALKER_ROOT_TO_NULL";
+  public static final String ER_SETTING_WALKER_ROOT_TO_NULL = 
+	 "ER_SETTING_WALKER_ROOT_TO_NULL";
    /** This NodeSetDTM can not iterate to a previous node! */
-  public static final String ER_NODESETDTM_CANNOT_ITERATE =
-         "ER_NODESETDTM_CANNOT_ITERATE";
+  public static final String ER_NODESETDTM_CANNOT_ITERATE = 
+	 "ER_NODESETDTM_CANNOT_ITERATE";
   /** This NodeSet can not iterate to a previous node! */
- public static final String ER_NODESET_CANNOT_ITERATE =
-         "ER_NODESET_CANNOT_ITERATE";
+ public static final String ER_NODESET_CANNOT_ITERATE = 
+	 "ER_NODESET_CANNOT_ITERATE";
   /** This NodeSetDTM can not do indexing or counting functions! */
-  public static final String ER_NODESETDTM_CANNOT_INDEX =
-         "ER_NODESETDTM_CANNOT_INDEX";
+  public static final String ER_NODESETDTM_CANNOT_INDEX = 
+	 "ER_NODESETDTM_CANNOT_INDEX";
   /** This NodeSet can not do indexing or counting functions! */
-  public static final String ER_NODESET_CANNOT_INDEX =
-         "ER_NODESET_CANNOT_INDEX";
+  public static final String ER_NODESET_CANNOT_INDEX = 
+	 "ER_NODESET_CANNOT_INDEX";
   /** Can not call setShouldCacheNodes after nextNode has been called! */
-  public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE =
-         "ER_CANNOT_CALL_SETSHOULDCACHENODE";
+  public static final String ER_CANNOT_CALL_SETSHOULDCACHENODE = 
+	 "ER_CANNOT_CALL_SETSHOULDCACHENODE";
   /** {0} only allows {1} arguments */
  public static final String ER_ONLY_ALLOWS = "ER_ONLY_ALLOWS";
   /** Programmer's assertion in getNextStepPos: unknown stepType: {0} */
   public static final String ER_UNKNOWN_STEP = "ER_UNKNOWN_STEP";
   /** Problem with RelativeLocationPath */
-  public static final String ER_EXPECTED_REL_LOC_PATH =
-         "ER_EXPECTED_REL_LOC_PATH";
+  public static final String ER_EXPECTED_REL_LOC_PATH = 
+	 "ER_EXPECTED_REL_LOC_PATH";
   /** Problem with LocationPath */
   public static final String ER_EXPECTED_LOC_PATH = "ER_EXPECTED_LOC_PATH";
   public static final String ER_EXPECTED_LOC_PATH_AT_END_EXPR =
@@ -272,20 +272,20 @@
   /** Problem with NodeTest */
   public static final String ER_EXPECTED_NODE_TEST = "ER_EXPECTED_NODE_TEST";
   /** Expected step pattern */
-  public static final String ER_EXPECTED_STEP_PATTERN =
-        "ER_EXPECTED_STEP_PATTERN";
+  public static final String ER_EXPECTED_STEP_PATTERN = 
+	"ER_EXPECTED_STEP_PATTERN";
   /** Expected relative path pattern */
-  public static final String ER_EXPECTED_REL_PATH_PATTERN =
-         "ER_EXPECTED_REL_PATH_PATTERN";
+  public static final String ER_EXPECTED_REL_PATH_PATTERN = 
+	 "ER_EXPECTED_REL_PATH_PATTERN";
   /** ER_CANT_CONVERT_XPATHRESULTTYPE_TO_BOOLEAN          */
-  public static final String ER_CANT_CONVERT_TO_BOOLEAN =
-         "ER_CANT_CONVERT_TO_BOOLEAN";
+  public static final String ER_CANT_CONVERT_TO_BOOLEAN = 
+	 "ER_CANT_CONVERT_TO_BOOLEAN";
   /** Field ER_CANT_CONVERT_TO_SINGLENODE       */
-  public static final String ER_CANT_CONVERT_TO_SINGLENODE =
-         "ER_CANT_CONVERT_TO_SINGLENODE";
+  public static final String ER_CANT_CONVERT_TO_SINGLENODE = 
+	 "ER_CANT_CONVERT_TO_SINGLENODE";
   /** Field ER_CANT_GET_SNAPSHOT_LENGTH         */
-  public static final String ER_CANT_GET_SNAPSHOT_LENGTH =
-         "ER_CANT_GET_SNAPSHOT_LENGTH";
+  public static final String ER_CANT_GET_SNAPSHOT_LENGTH = 
+	 "ER_CANT_GET_SNAPSHOT_LENGTH";
   /** Field ER_NON_ITERATOR_TYPE                */
   public static final String ER_NON_ITERATOR_TYPE = "ER_NON_ITERATOR_TYPE";
   /** Field ER_DOC_MUTATED                      */
@@ -294,8 +294,8 @@
   public static final String ER_EMPTY_XPATH_RESULT = "ER_EMPTY_XPATH_RESULT";
   public static final String ER_INCOMPATIBLE_TYPES = "ER_INCOMPATIBLE_TYPES";
   public static final String ER_NULL_RESOLVER = "ER_NULL_RESOLVER";
-  public static final String ER_CANT_CONVERT_TO_STRING =
-         "ER_CANT_CONVERT_TO_STRING";
+  public static final String ER_CANT_CONVERT_TO_STRING = 
+	 "ER_CANT_CONVERT_TO_STRING";
   public static final String ER_NON_SNAPSHOT_TYPE = "ER_NON_SNAPSHOT_TYPE";
   public static final String ER_WRONG_DOCUMENT = "ER_WRONG_DOCUMENT";
   /* Note to translators:  The XPath expression cannot be evaluated with respect
@@ -318,44 +318,45 @@
   public static final String ER_FEATURE_UNKNOWN = "ER_FEATURE_UNKNOWN";
   public static final String ER_GETTING_NULL_FEATURE = "ER_GETTING_NULL_FEATURE";
   public static final String ER_GETTING_UNKNOWN_FEATURE = "ER_GETTING_UNKNOWN_FEATURE";
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
   public static final String ER_NULL_XPATH_FUNCTION_RESOLVER = "ER_NULL_XPATH_FUNCTION_RESOLVER";
   public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER";
-  //END: Keys needed for exception messages of  JAXP 1.3 XPath API implementation
+  //END: Keys needed for exception messages of  JAXP 1.3 XPath API implementation 
 
-  public static final String WG_LOCALE_NAME_NOT_HANDLED =
-         "WG_LOCALE_NAME_NOT_HANDLED";
-  public static final String WG_PROPERTY_NOT_SUPPORTED =
-         "WG_PROPERTY_NOT_SUPPORTED";
-  public static final String WG_DONT_DO_ANYTHING_WITH_NS =
-         "WG_DONT_DO_ANYTHING_WITH_NS";
+  public static final String WG_LOCALE_NAME_NOT_HANDLED = 
+	 "WG_LOCALE_NAME_NOT_HANDLED";
+  public static final String WG_PROPERTY_NOT_SUPPORTED = 
+	 "WG_PROPERTY_NOT_SUPPORTED";
+  public static final String WG_DONT_DO_ANYTHING_WITH_NS = 
+	 "WG_DONT_DO_ANYTHING_WITH_NS";
   public static final String WG_SECURITY_EXCEPTION = "WG_SECURITY_EXCEPTION";
-  public static final String WG_QUO_NO_LONGER_DEFINED =
-         "WG_QUO_NO_LONGER_DEFINED";
-  public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST =
-         "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST";
-  public static final String WG_FUNCTION_TOKEN_NOT_FOUND =
-         "WG_FUNCTION_TOKEN_NOT_FOUND";
-  public static final String WG_COULDNOT_FIND_FUNCTION =
-         "WG_COULDNOT_FIND_FUNCTION";
+  public static final String WG_QUO_NO_LONGER_DEFINED = 
+	 "WG_QUO_NO_LONGER_DEFINED";
+  public static final String WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = 
+	 "WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST";
+  public static final String WG_FUNCTION_TOKEN_NOT_FOUND = 
+	 "WG_FUNCTION_TOKEN_NOT_FOUND";
+  public static final String WG_COULDNOT_FIND_FUNCTION = 
+	 "WG_COULDNOT_FIND_FUNCTION";
   public static final String WG_CANNOT_MAKE_URL_FROM ="WG_CANNOT_MAKE_URL_FROM";
-  public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED =
-         "WG_EXPAND_ENTITIES_NOT_SUPPORTED";
-  public static final String WG_ILLEGAL_VARIABLE_REFERENCE =
-         "WG_ILLEGAL_VARIABLE_REFERENCE";
+  public static final String WG_EXPAND_ENTITIES_NOT_SUPPORTED = 
+	 "WG_EXPAND_ENTITIES_NOT_SUPPORTED";
+  public static final String WG_ILLEGAL_VARIABLE_REFERENCE = 
+	 "WG_ILLEGAL_VARIABLE_REFERENCE";
   public static final String WG_UNSUPPORTED_ENCODING ="WG_UNSUPPORTED_ENCODING";
 
   /**  detach() not supported by XRTreeFragSelectWrapper   */
   public static final String ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER =
-         "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
+	 "ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
   /**  num() not supported by XRTreeFragSelectWrapper   */
   public static final String ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER =
-         "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
+	 "ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
   /**  xstr() not supported by XRTreeFragSelectWrapper   */
   public static final String ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER =
-         "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
+	 "ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
   /**  str() not supported by XRTreeFragSelectWrapper   */
   public static final String ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER =
-         "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
+	 "ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER";
 
   // Error messages...
 
@@ -587,22 +588,22 @@
 
   { ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
        "asNodeIterator() not supported by XRTreeFragSelectWrapper"},
-
-        /**  detach() not supported by XRTreeFragSelectWrapper   */
+       
+	/**  detach() not supported by XRTreeFragSelectWrapper   */
    { ER_DETACH_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
-                "detach() not supported by XRTreeFragSelectWrapper"},
-
-        /**  num() not supported by XRTreeFragSelectWrapper   */
+		"detach() not supported by XRTreeFragSelectWrapper"},
+		
+	/**  num() not supported by XRTreeFragSelectWrapper   */
    { ER_NUM_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
-                "num() not supported by XRTreeFragSelectWrapper"},
-
-        /**  xstr() not supported by XRTreeFragSelectWrapper   */
+		"num() not supported by XRTreeFragSelectWrapper"},
+		
+	/**  xstr() not supported by XRTreeFragSelectWrapper   */
    { ER_XSTR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
-                "xstr() not supported by XRTreeFragSelectWrapper"},
-
-        /**  str() not supported by XRTreeFragSelectWrapper   */
+		"xstr() not supported by XRTreeFragSelectWrapper"},
+		
+	/**  str() not supported by XRTreeFragSelectWrapper   */
    { ER_STR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
-                "str() not supported by XRTreeFragSelectWrapper"},
+		"str() not supported by XRTreeFragSelectWrapper"},
 
   { ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS,
        "fsb() not supported for XStringForChars"},
@@ -698,7 +699,7 @@
   { ER_CANT_CONVERT_TO_BOOLEAN,
        "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a boolean."},
 
-  // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and
+  // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and 
   // FIRST_ORDERED_NODE_TYPE.
   { ER_CANT_CONVERT_TO_SINGLENODE,
        "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a single node. The method getSingleNodeValue applies only to types ANY_UNORDERED_NODE_TYPE and FIRST_ORDERED_NODE_TYPE."},
@@ -756,7 +757,7 @@
        "Unknown error in XPath."},
 
   { ER_CANT_CONVERT_XPATHRESULTTYPE_TO_NUMBER,
-        "The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a number"},
+	"The XPathResult of XPath expression ''{0}'' has an XPathResultType of {1} which cannot be converted to a number"},       
 
   //BEGIN:  Definitions of error keys used  in exception messages of  JAXP 1.3 XPath API implementation
 
@@ -820,6 +821,9 @@
   { ER_GETTING_UNKNOWN_FEATURE,
        "Trying to get the unknown feature \"{0}\":{1}#getFeature({0})"},
 
+  {ER_SECUREPROCESSING_FEATURE,
+        "FEATURE_SECURE_PROCESSING: Cannot set the feature to false when security manager is present: {1}#setFeature({0},{2})"},
+               
   /** Field ER_NULL_XPATH_FUNCTION_RESOLVER                       */
 
   { ER_NULL_XPATH_FUNCTION_RESOLVER,
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_de.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,8 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1127,6 +1129,8 @@
   { ER_XPATH_ERROR,
        "Unbekannter Fehler in XPath."},
 
+  {ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: Diese Funktion kann nicht auf \"false\" gesetzt werden, wenn der Security Manager pr\u00e4sent ist: {1}#setFeature({0},{2})"}, 
 
   // Warnings...
 
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_es.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,11 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+  public static final String ER_NULL_XPATH_VARIABLE_RESOLVER = "ER_NULL_XPATH_VARIABLE_RESOLVER";
+
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1128,6 +1133,9 @@
        "Error desconocido en XPath."},
 
 
+{ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: No se puede cambiar la funci\u00f3n a falso cuando el administrador de seguridad est\u00e1 presente: {1}#setFeature({0},{2})"}, 
+
   // Warnings...
 
   /** Field WG_LOCALE_NAME_NOT_HANDLED          */
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_fr.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,8 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1128,6 +1130,9 @@
        "Erreur inconnue d\u00e9tect\u00e9e dans XPath."},
 
 
+{ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: Impossible de d\u00e9finir la valeur False pour la fonction lorsque le gestionnaire de s\u00e9curit\u00e9 est pr\u00e9sent : {1}#setFeature({0},{2})"}, 
+
   // Warnings...
 
   /** Field WG_LOCALE_NAME_NOT_HANDLED          */
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_it.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,10 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1128,6 +1132,9 @@
        "Errore sconosciuto in XPath."},
 
 
+{ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: Impossibile impostare la funzionalit\u00e0 su False in presenza di strumenti di gestione della protezione: {1}#setFeature({0},{2})"}, 
+
   // Warnings...
 
   /** Field WG_LOCALE_NAME_NOT_HANDLED          */
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ja.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,8 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1127,6 +1129,8 @@
   { ER_XPATH_ERROR,
        "XPath \u306b\u4e0d\u660e\u306a\u30a8\u30e9\u30fc\u304c\u3042\u308a\u307e\u3059\u3002"},
 
+{ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: \u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30fc\u30de\u30cd\u30fc\u30b8\u30e3\u30fc\u304c\u5b58\u5728\u3059\u308b\u5834\u5408\u306b\u306f\u3001\u3053\u306e\u6a5f\u80fd\u3092 false \u306b\u8a2d\u5b9a\u3067\u304d\u307e\u305b\u3093: {1}#setFeature({0},{2})"}, 
 
   // Warnings...
 
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_ko.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,8 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1127,6 +1129,8 @@
   { ER_XPATH_ERROR,
        "XPath\uc758 \uc54c \uc218 \uc5c6\ub294 \uc624\ub958."},
 
+  {ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: \ubcf4\uc548 \uad00\ub9ac\uc790\uac00 \uc788\uc73c\uba74 \uc774 \uae30\ub2a5\uc744 False\ub85c \uc124\uc815\ud560 \uc218 \uc5c6\uc2b5\ub2c8\ub2e4. {1}#setFeature({0},{2})"}, 
 
   // Warnings...
 
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_sv.java	Wed Sep 28 16:49:43 2011 +0100
@@ -617,7 +617,7 @@
   {
     ER_XPATH_READOBJECT, "I XPath.readObject: {0}"},
 
-
+  
   /** Field ER_XPATH_READOBJECT         */
   //public static final int ER_FUNCTION_TOKEN_NOT_FOUND = 69;
 
@@ -626,7 +626,7 @@
     ER_FUNCTION_TOKEN_NOT_FOUND,
       "funktionstecken saknas."},
 
-
+  
    /**  Can not deal with XPath type:   */
   //public static final int ER_CANNOT_DEAL_XPATH_TYPE = 71;
 
@@ -635,7 +635,7 @@
     ER_CANNOT_DEAL_XPATH_TYPE,
        "Kan inte hantera XPath-typ: {0}"},
 
-
+  
    /**  This NodeSet is not mutable  */
   //public static final int ER_NODESET_NOT_MUTABLE = 72;
 
@@ -644,7 +644,7 @@
     ER_NODESET_NOT_MUTABLE,
        "NodeSet \u00e4r of\u00f6r\u00e4nderlig"},
 
-
+  
    /**  This NodeSetDTM is not mutable  */
   //public static final int ER_NODESETDTM_NOT_MUTABLE = 73;
 
@@ -653,7 +653,7 @@
     ER_NODESETDTM_NOT_MUTABLE,
        "NodeSetDTM \u00e4r of\u00f6r\u00e4nderlig"},
 
-
+  
    /**  Variable not resolvable:   */
   //public static final int ER_VAR_NOT_RESOLVABLE = 74;
 
@@ -662,7 +662,7 @@
     ER_VAR_NOT_RESOLVABLE,
         "Variabel ej l\u00f6sbar: {0}"},
 
-
+  
    /** Null error handler  */
   //public static final int ER_NULL_ERROR_HANDLER = 75;
 
@@ -671,7 +671,7 @@
     ER_NULL_ERROR_HANDLER,
         "Null error handler"},
 
-
+  
    /**  Programmer's assertion: unknown opcode  */
   //public static final int ER_PROG_ASSERT_UNKNOWN_OPCODE = 76;
 
@@ -680,7 +680,7 @@
     ER_PROG_ASSERT_UNKNOWN_OPCODE,
        "Programmerares f\u00f6rs\u00e4kran: ok\u00e4nd op-kod: {0}"},
 
-
+  
    /**  0 or 1   */
   //public static final int ER_ZERO_OR_ONE = 77;
 
@@ -689,8 +689,8 @@
     ER_ZERO_OR_ONE,
        "0 eller 1"},
 
-
-
+  
+  
    /**  rtf() not supported by XRTreeFragSelectWrapper   */
   //public static final int ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = 78;
 
@@ -699,7 +699,7 @@
     ER_RTF_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
        "rtf() underst\u00f6ds inte av XRTreeFragSelectWrapper!"},
 
-
+  
    /**  asNodeIterator() not supported by XRTreeFragSelectWrapper   */
   //public static final int ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER = 79;
 
@@ -708,7 +708,7 @@
     ER_ASNODEITERATOR_NOT_SUPPORTED_XRTREEFRAGSELECTWRAPPER,
        "asNodeIterator() underst\u00f6ds inte av XRTreeFragSelectWrapper!"},
 
-
+  
    /**  fsb() not supported for XStringForChars   */
   //public static final int ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS = 80;
 
@@ -717,7 +717,7 @@
     ER_FSB_NOT_SUPPORTED_XSTRINGFORCHARS,
        "fsb() underst\u00f6ds inte av XRStringForChars!"},
 
-
+  
    /**  Could not find variable with the name of   */
   //public static final int ER_COULD_NOT_FIND_VAR = 81;
 
@@ -726,7 +726,7 @@
     ER_COULD_NOT_FIND_VAR,
       "Hittade inte variabeln med namn {0}"},
 
-
+  
    /**  XStringForChars can not take a string for an argument   */
   //public static final int ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING = 82;
 
@@ -735,7 +735,7 @@
     ER_XSTRINGFORCHARS_CANNOT_TAKE_STRING,
       "XStringForChars kan inte ta en str\u00e4ng som argument"},
 
-
+  
    /**  The FastStringBuffer argument can not be null   */
   //public static final int ER_FASTSTRINGBUFFER_CANNOT_BE_NULL = 83;
 
@@ -743,8 +743,8 @@
   {
     ER_FASTSTRINGBUFFER_CANNOT_BE_NULL,
       "FastStringBuffer-argumentet f\u00e5r inte vara null"},
-
-/* MANTIS_XALAN CHANGE: BEGIN */
+    
+/* MANTIS_XALAN CHANGE: BEGIN */ 
    /**  2 or 3   */
   //public static final int ER_TWO_OR_THREE = 84;
 
@@ -913,7 +913,7 @@
   // Note to translators: A relative path pattern is part of an XPath expression.
   // The message indicates that syntactically such an expression was expected,
   // but was not found.
-
+ 
   /** Expected relative path pattern */
   //public static final int ER_EXPECTED_REL_PATH_PATTERN = 100;
 
@@ -936,7 +936,7 @@
        "Det g\u00e5r inte att konvertera {0} till ett Booleskt v\u00e4rde."},
 
 
-  // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and
+  // Note to translators: Do not translate ANY_UNORDERED_NODE_TYPE and 
   // FIRST_ORDERED_NODE_TYPE.
 
   /** Field ER_CANT_CONVERT_TO_SINGLENODE       */
@@ -1077,6 +1077,8 @@
        "Ok\u00e4nt fel i XPath."},
 
 
+  {ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: Det g\u00e5r inte att st\u00e4lla in funktionen n\u00e4r s\u00e4kerhetshanteraren anv\u00e4nds: {1}#setFeature({0},{2})"}, 
 
   // Warnings...
 
@@ -1249,3 +1251,5 @@
   public static final String QUERY_HEADER = "M\u00d6NSTER ";
 
 }
+
+
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_CN.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,8 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1127,6 +1129,9 @@
   { ER_XPATH_ERROR,
        "XPath \u672a\u77e5\u9519\u8bef"},
 
+{ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING\uff1a\u5982\u679c\u6709\u5b89\u5168\u7ba1\u7406\u5668\uff0c\u5219\u65e0\u6cd5\u5c06\u8be5\u529f\u80fd\u8bbe\u7f6e\u4e3a false: {1}#setFeature({0},{2})"}, 
+
 
   // Warnings...
 
--- a/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/org/apache/xpath/internal/res/XPATHErrorResources_zh_TW.java	Wed Sep 28 16:49:43 2011 +0100
@@ -330,6 +330,8 @@
   public static final String ER_WRONG_NODETYPE = "ER_WRONG_NODETYPE";
   public static final String ER_XPATH_ERROR = "ER_XPATH_ERROR";
 
+  public static final String ER_SECUREPROCESSING_FEATURE = "ER_SECUREPROCESSING_FEATURE";
+
   public static final String WG_LOCALE_NAME_NOT_HANDLED =
          "WG_LOCALE_NAME_NOT_HANDLED";
   public static final String WG_PROPERTY_NOT_SUPPORTED =
@@ -1127,6 +1129,9 @@
   { ER_XPATH_ERROR,
        "XPath \u767c\u751f\u4e0d\u660e\u932f\u8aa4\u3002"},
 
+{ER_SECUREPROCESSING_FEATURE,
+      "FEATURE_SECURE_PROCESSING: \u4f7f\u7528\u5b89\u5168\u6027\u7ba1\u7406\u54e1\u6642\uff0c\u4e0d\u53ef\u5c07\u6b64\u529f\u80fd\u8a2d\u70ba false: {1}#setFeature({0},{2})"}, 
+
 
   // Warnings...
 
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/XMLEventReaderImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -41,10 +41,10 @@
  */
 
 public class XMLEventReaderImpl implements javax.xml.stream.XMLEventReader{
-
+    
     protected XMLStreamReader fXMLReader ;
     protected XMLEventAllocator fXMLEventAllocator;
-
+    
     //only constructor will do because we delegate everything to underlying XMLStreamReader
     public XMLEventReaderImpl(XMLStreamReader reader) throws  XMLStreamException {
         fXMLReader = reader ;
@@ -52,10 +52,10 @@
         if(fXMLEventAllocator == null){
             fXMLEventAllocator = new XMLEventAllocatorImpl();
         }
-        fPeekedEvent = fXMLEventAllocator.allocate(fXMLReader);
+        fPeekedEvent = fXMLEventAllocator.allocate(fXMLReader);        
     }
-
-
+    
+    
     public boolean hasNext() {
         //if we have the peeked event return 'true'
         if(fPeekedEvent != null)return true;
@@ -69,8 +69,8 @@
         }
         return next ;
     }
-
-
+    
+    
     public XMLEvent nextEvent() throws XMLStreamException {
         //if application peeked return the peeked event
         if(fPeekedEvent != null){
@@ -88,17 +88,17 @@
             throw new NoSuchElementException();
         }
     }
-
+    
     public void remove(){
         //remove of the event is not supported.
         throw new java.lang.UnsupportedOperationException();
     }
-
-
+    
+    
     public void close() throws XMLStreamException {
         fXMLReader.close();
     }
-
+    
     /** Reads the content of a text-only element. Precondition:
      * the current event is START_ELEMENT. Postcondition:
      * The current event is the corresponding END_ELEMENT.
@@ -112,21 +112,20 @@
             throw new XMLStreamException(
             "parser must be on START_ELEMENT to read next text", fLastEvent.getLocation());
         }
-
+        
         // STag content ETag
         //[43]   content   ::=   CharData? ((element | Reference | CDSect | PI | Comment) CharData?)*
-
+        
         //<foo>....some long text say in KB and underlying parser reports multiple character
         // but getElementText() events....</foo>
-
+        
+        String data = null;
         //having a peeked event makes things really worse -- we have to test the first event
         if(fPeekedEvent != null){
             XMLEvent event = fPeekedEvent ;
             fPeekedEvent = null;
             int type = event.getEventType();
-
-
-            String data = null;
+            
             if(  type == XMLEvent.CHARACTERS || type == XMLEvent.SPACE ||
             type == XMLEvent.CDATA){
                 data = event.asCharacters().getData();
@@ -142,7 +141,7 @@
             }else if(type == XMLEvent.END_ELEMENT){
                 return "";
             }
-
+            
             //create the string buffer and add initial data
             StringBuffer buffer = new StringBuffer();
             if(data != null && data.length() > 0 ) {
@@ -177,14 +176,18 @@
                 if(data != null && data.length() > 0 ) {
                     buffer.append(data);
                 }
+                event = nextEvent();
             }
             return buffer.toString();
         }//if (fPeekedEvent != null)
-
-        //if there was no peeked event simply delegate everything to fXMLReader
-        return fXMLReader.getElementText();
+        
+        //if there was no peeked, delegate everything to fXMLReader
+        //update the last event before returning the text
+        data = fXMLReader.getElementText();
+        fLastEvent = fXMLEventAllocator.allocate(fXMLReader);
+        return data;
     }
-
+    
     /** Get the value of a feature/property from the underlying implementation
      * @param name The name of the property
      * @return The value of the property
@@ -193,7 +196,7 @@
     public Object getProperty(java.lang.String name) throws java.lang.IllegalArgumentException {
         return fXMLReader.getProperty(name) ;
     }
-
+    
     /** Skips any insignificant space events until a START_ELEMENT or
      * END_ELEMENT is reached. If anything other than space characters are
      * encountered, an exception is thrown. This method should
@@ -213,31 +216,32 @@
             //if peeked event is PI or COMMENT move to the next event
             if( (event.isCharacters() && event.asCharacters().isWhiteSpace())
             || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
-            || eventType == XMLStreamConstants.COMMENT){
+            || eventType == XMLStreamConstants.COMMENT
+            || eventType == XMLStreamConstants.START_DOCUMENT){
                 event = nextEvent();
                 eventType = event.getEventType();
             }
-
+            
             //we have to have the while loop because there can be many PI or comment event in sucession
             while((event.isCharacters() && event.asCharacters().isWhiteSpace())
             || eventType == XMLStreamConstants.PROCESSING_INSTRUCTION
             || eventType == XMLStreamConstants.COMMENT){
-
+                
                 event = nextEvent();
                 eventType = event.getEventType();
             }
-
+            
             if (eventType != XMLStreamConstants.START_ELEMENT && eventType != XMLStreamConstants.END_ELEMENT) {
                 throw new XMLStreamException("expected start or end tag", event.getLocation());
             }
             return event;
         }
-
+        
         //if there is no peeked event -- delegate the work of getting next event to fXMLReader
         fXMLReader.nextTag();
-        return fXMLEventAllocator.allocate(fXMLReader);
+        return (fLastEvent = fXMLEventAllocator.allocate(fXMLReader));
     }
-
+    
     public Object next() {
         Object object = null;
         try{
@@ -249,18 +253,18 @@
         }
         return object;
     }
-
+    
     public XMLEvent peek() throws XMLStreamException{
         //if someone call peek() two times we should just return the peeked event
         //this is reset if we call next() or nextEvent()
         if(fPeekedEvent != null) return fPeekedEvent;
-
+        
         if(hasNext()){
             //revisit: we can implement peek() by calling underlying reader to advance
             // the stream and returning the event without the knowledge of the user
             // that the stream was advanced but the point is we are advancing the stream
             //here. -- nb.
-
+            
             // Is there any application that relies on this behavior ?
             //Can it be an application knows that there is particularly very large 'comment' section
             //or character data which it doesn't want to read or to be returned as event
@@ -273,8 +277,8 @@
             return null;
         }
     }//peek()
-
+    
     private XMLEvent fPeekedEvent;
     private XMLEvent fLastEvent;
-
+    
 }//XMLEventReaderImpl
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/XMLInputFactoryImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/XMLInputFactoryImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -45,28 +45,28 @@
 
 //xxx: Should we be reusing the XMLInputSource object
 public class XMLInputFactoryImpl extends javax.xml.stream.XMLInputFactory {
-
-
+        
+    
     //List of supported properties and default values.
     private PropertyManager fPropertyManager = new PropertyManager(PropertyManager.CONTEXT_READER) ;
     private static final boolean DEBUG = false;
-
+    
     //Maintain a reference to last reader instantiated.
     private XMLStreamReaderImpl fTempReader = null ;
-
+    
     boolean fPropertyChanged = false;
-    //default value is true
-    boolean fReuseInstance = true;
+    //no reader reuse by default
+    boolean fReuseInstance = false;
 
     /** Creates a new instance of ZephryParserFactory */
     public XMLInputFactoryImpl() {
-
+        
     }
-
+    
     void initEventReader(){
         fPropertyChanged = true;
     }
-
+    
     /**
      * @param inputstream
      * @throws XMLStreamException
@@ -77,37 +77,37 @@
         //delegate everything to XMLStreamReader
         return new XMLEventReaderImpl(createXMLStreamReader(inputstream));
     }
-
+    
     public XMLEventReader createXMLEventReader(Reader reader) throws XMLStreamException {
         initEventReader();
         //delegate everything to XMLStreamReader
         return new XMLEventReaderImpl(createXMLStreamReader(reader));
     }
-
+    
     public XMLEventReader createXMLEventReader(Source source) throws XMLStreamException {
         initEventReader();
         //delegate everything to XMLStreamReader
         return new XMLEventReaderImpl(createXMLStreamReader(source));
     }
-
+    
     public XMLEventReader createXMLEventReader(String systemId, InputStream inputstream) throws XMLStreamException {
         initEventReader();
         //delegate everything to XMLStreamReader
         return new XMLEventReaderImpl(createXMLStreamReader(systemId, inputstream));
     }
-
+    
     public XMLEventReader createXMLEventReader(java.io.InputStream stream, String encoding) throws XMLStreamException {
         initEventReader();
         //delegate everything to XMLStreamReader
         return new XMLEventReaderImpl(createXMLStreamReader(stream, encoding));
     }
-
+    
     public XMLEventReader createXMLEventReader(String systemId, Reader reader) throws XMLStreamException {
         initEventReader();
         //delegate everything to XMLStreamReader
         return new XMLEventReaderImpl(createXMLStreamReader(systemId, reader));
     }
-
+    
     /** Create a new XMLEventReader from an XMLStreamReader.  After being used
      * to construct the XMLEventReader instance returned from this method
      * the XMLStreamReader must not be used.
@@ -116,67 +116,67 @@
      * @throws XMLStreamException
      */
     public XMLEventReader createXMLEventReader(XMLStreamReader reader) throws XMLStreamException {
-
+        
         //xxx: what do we do now -- instance is passed from the application
         //probably we should check if the state is at the start document,
         //eventreader call to next() should return START_DOCUMENT and
         //then delegate every call to underlying streamReader
         return new XMLEventReaderImpl(reader) ;
     }
-
+    
     public XMLStreamReader createXMLStreamReader(InputStream inputstream) throws XMLStreamException {
         XMLInputSource inputSource = new XMLInputSource(null, null, null, inputstream, null);
         return getXMLStreamReaderImpl(inputSource);
     }
-
+    
     public XMLStreamReader createXMLStreamReader(Reader reader) throws XMLStreamException {
         XMLInputSource inputSource = new XMLInputSource(null, null, null, reader, null);
         return getXMLStreamReaderImpl(inputSource);
     }
-
+    
     public XMLStreamReader createXMLStreamReader(String systemId, Reader reader) throws XMLStreamException {
         XMLInputSource inputSource = new XMLInputSource(null,systemId,null,reader,null);
         return getXMLStreamReaderImpl(inputSource);
     }
-
+    
     public XMLStreamReader createXMLStreamReader(Source source) throws XMLStreamException {
-        return new XMLStreamReaderImpl(jaxpSourcetoXMLInputSource(source),
+        return new XMLStreamReaderImpl(jaxpSourcetoXMLInputSource(source), 
                 new PropertyManager(fPropertyManager));
     }
-
+    
     public XMLStreamReader createXMLStreamReader(String systemId, InputStream inputstream) throws XMLStreamException {
         XMLInputSource inputSource = new XMLInputSource(null,systemId,null,inputstream,null);
         return getXMLStreamReaderImpl(inputSource);
     }
-
-
+    
+    
     public XMLStreamReader createXMLStreamReader(InputStream inputstream, String encoding) throws XMLStreamException {
         XMLInputSource inputSource = new XMLInputSource(null,null,null,inputstream,encoding);
         return getXMLStreamReaderImpl(inputSource);
     }
-
+    
     public XMLEventAllocator getEventAllocator() {
         return (XMLEventAllocator)getProperty(XMLInputFactory.ALLOCATOR);
     }
-
+    
     public XMLReporter getXMLReporter() {
         return (XMLReporter)fPropertyManager.getProperty(XMLInputFactory.REPORTER);
     }
-
+    
     public XMLResolver getXMLResolver() {
         Object object = fPropertyManager.getProperty(XMLInputFactory.RESOLVER);
         return (XMLResolver)object;
         //return (XMLResolver)fPropertyManager.getProperty(XMLInputFactory.RESOLVER);
     }
-
+    
     public void setXMLReporter(XMLReporter xmlreporter) {
         fPropertyManager.setProperty(XMLInputFactory.REPORTER, xmlreporter);
     }
-
+    
     public void setXMLResolver(XMLResolver xmlresolver) {
         fPropertyManager.setProperty(XMLInputFactory.RESOLVER, xmlresolver);
     }
-
+    
     /** Create a filtered event reader that wraps the filter around the event reader
      * @param reader the event reader to wrap
      * @param filter the filter to apply to the event reader
@@ -185,7 +185,7 @@
     public XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) throws XMLStreamException {
         return new EventFilterSupport(reader, filter);
     }
-
+    
     /** Create a filtered reader that wraps the filter around the reader
      * @param reader the reader to filter
      * @param filter the filter to apply to the reader
@@ -194,12 +194,12 @@
     public XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) throws XMLStreamException {
         if( reader != null && filter != null )
             return new XMLStreamFilterImpl(reader,filter);
-
+        
         return null;
     }
-
-
-
+    
+    
+    
     /** Get the value of a feature/property from the underlying implementation
      * @param name The name of the property (may not be null)
      * @return The value of the property
@@ -213,7 +213,7 @@
             return fPropertyManager.getProperty(name);
         throw new IllegalArgumentException("Property not supported");
     }
-
+    
     /** Query the set of fProperties that this factory supports.
      *
      * @param name The name of the property (may not be null)
@@ -225,14 +225,14 @@
         else
             return fPropertyManager.containsProperty(name);
     }
-
+    
     /** Set a user defined event allocator for events
      * @param allocator the user defined allocator
      */
     public void setEventAllocator(XMLEventAllocator allocator) {
         fPropertyManager.setProperty(XMLInputFactory.ALLOCATOR, allocator);
     }
-
+    
     /** Allows the user to set specific feature/property on the underlying implementation. The underlying implementation
      * is not required to support every setting of every property in the specification and may use IllegalArgumentException
      * to signal that an unsupported property may not be set with the specified value.
@@ -241,7 +241,7 @@
      * @throws java.lang.IllegalArgumentException if the property is not supported
      */
     public void setProperty(java.lang.String name, Object value) throws java.lang.IllegalArgumentException {
-
+        
         if(name == null || value == null || !fPropertyManager.containsProperty(name) ){
             throw new IllegalArgumentException("Property "+name+" is not supported");
         }
@@ -254,15 +254,15 @@
         }
         fPropertyManager.setProperty(name,value);
     }
-
+    
     XMLStreamReader getXMLStreamReaderImpl(XMLInputSource inputSource) throws javax.xml.stream.XMLStreamException{
         //1. if the temp reader is null -- create the instance and return
         if(fTempReader == null){
             fPropertyChanged = false;
-            return fTempReader = new XMLStreamReaderImpl(inputSource,
+            return fTempReader = new XMLStreamReaderImpl(inputSource, 
                     new PropertyManager(fPropertyManager));
         }
-        //if factory is configured to reuse the instance & this instance can be reused
+        //if factory is configured to reuse the instance & this instance can be reused 
         //& the setProperty() hasn't been called
         if(fReuseInstance && fTempReader.canReuse() && !fPropertyChanged){
             if(DEBUG)System.out.println("Reusing the instance");
@@ -274,30 +274,15 @@
         }else{
             fPropertyChanged = false;
             //just return the new instance.. note that we are not setting  fTempReader to the newly created instance
-            return fTempReader = new XMLStreamReaderImpl(inputSource,
+            return fTempReader = new XMLStreamReaderImpl(inputSource, 
                     new PropertyManager(fPropertyManager));
         }
     }
-
+    
     XMLInputSource jaxpSourcetoXMLInputSource(Source source){
-
-        if(source instanceof StreamSource){
-            StreamSource stSource = (StreamSource)source;
-            String systemId = stSource.getSystemId();
-            String publicId = stSource.getPublicId();
-            InputStream istream = stSource.getInputStream();
-            Reader reader = stSource.getReader();
-
-            if(istream != null){
-                return new XMLInputSource(publicId, systemId, null, istream, null);
-            }
-            else if(reader != null){
-                return new XMLInputSource(publicId, systemId,null, reader, null);
-            }else{
-                return new XMLInputSource(publicId, systemId, null);
-            }
-        }
-
-        return new XMLInputSource(null, source.getSystemId(), null);
+        throw new UnsupportedOperationException("Cannot create " +
+                "XMLStreamReader or XMLEventReader from a " +
+                source.getClass().getName());
     }
+    
 }//XMLInputFactoryImpl
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/XMLOutputFactoryImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/XMLOutputFactoryImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -51,22 +51,22 @@
  * @author k.venugopal@sun.com
  */
 public class XMLOutputFactoryImpl extends XMLOutputFactory {
-
+    
     //List of supported properties and default values.
     private PropertyManager fPropertyManager = new PropertyManager(PropertyManager.CONTEXT_WRITER);
-
+    
     //cache the instance of XMLStreamWriterImpl
     private XMLStreamWriterImpl fStreamWriter = null;
-
+    
     /**
      * TODO: at the current time, XMLStreamWriters are not Thread safe.
      */
     boolean fReuseInstance = false;
-
+    
     /** Creates a new instance of XMLOutputFactory */
     public XMLOutputFactoryImpl() {
     }
-
+    
     public javax.xml.stream.XMLEventWriter createXMLEventWriter(java.io.OutputStream outputStream) throws javax.xml.stream.XMLStreamException {
         return createXMLEventWriter(outputStream,  null);
     }
@@ -76,21 +76,21 @@
     }
 
     public javax.xml.stream.XMLEventWriter createXMLEventWriter(javax.xml.transform.Result result) throws javax.xml.stream.XMLStreamException {
-
+        
         if (result instanceof StAXResult && ((StAXResult)result).getXMLEventWriter() != null)
             return ((StAXResult)result).getXMLEventWriter();
-
+        
         return new XMLEventWriterImpl(createXMLStreamWriter(result));
     }
-
+    
     public javax.xml.stream.XMLEventWriter createXMLEventWriter(java.io.Writer writer) throws javax.xml.stream.XMLStreamException {
         return new XMLEventWriterImpl(createXMLStreamWriter(writer));
     }
-
+            
     public javax.xml.stream.XMLStreamWriter createXMLStreamWriter(javax.xml.transform.Result result) throws javax.xml.stream.XMLStreamException {
 
         if (result instanceof StreamResult) {
-            return createXMLStreamWriter((StreamResult) result, null);
+            return createXMLStreamWriter((StreamResult) result, null); 
         } else if (result instanceof DOMResult) {
             return new XMLDOMWriterImpl((DOMResult) result);
         } else if (result instanceof StAXResult) {
@@ -99,23 +99,30 @@
             } else {
                 throw new java.lang.UnsupportedOperationException("Result of type " + result + " is not supported");
             }
-        }
-
-        return createXMLStreamWriter(new StreamResult(result.getSystemId()));
+        } else {
+            if (result.getSystemId() !=null) {
+                //this is not correct impl of SAXResult. Keep it for now for compatibility
+                return createXMLStreamWriter(new StreamResult(result.getSystemId()));
+            } else {
+                throw new java.lang.UnsupportedOperationException("Result of type " + result + " is not supported. " +
+                        "Supported result types are: DOMResult, StAXResult and StreamResult.");
+            }
+        }        
+        
     }
-
+    
     public javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.Writer writer) throws javax.xml.stream.XMLStreamException {
         return createXMLStreamWriter(toStreamResult(null, writer, null) , null);
     }
-
+    
     public javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.OutputStream outputStream) throws javax.xml.stream.XMLStreamException {
         return createXMLStreamWriter(outputStream, null);
     }
-
+    
     public javax.xml.stream.XMLStreamWriter createXMLStreamWriter(java.io.OutputStream outputStream, String encoding) throws javax.xml.stream.XMLStreamException {
         return createXMLStreamWriter(toStreamResult(outputStream, null, null) , encoding);
     }
-
+    
     public Object getProperty(String name) throws java.lang.IllegalArgumentException {
         if(name == null){
             throw new IllegalArgumentException("Property not supported");
@@ -124,7 +131,7 @@
             return fPropertyManager.getProperty(name);
         throw new IllegalArgumentException("Property not supported");
     }
-
+    
     public boolean isPropertySupported(String name) {
         if(name == null){
             return false ;
@@ -133,7 +140,7 @@
             return fPropertyManager.containsProperty(name);
         }
     }
-
+    
     public void setProperty(String name, Object value) throws java.lang.IllegalArgumentException {
         if(name == null || value == null || !fPropertyManager.containsProperty(name) ){
             throw new IllegalArgumentException("Property "+name+"is not supported");
@@ -141,7 +148,7 @@
         if(name == Constants.REUSE_INSTANCE || name.equals(Constants.REUSE_INSTANCE)){
             fReuseInstance = ((Boolean)value).booleanValue();
             if(DEBUG)System.out.println("fReuseInstance is set to " + fReuseInstance);
-
+            
             // TODO: XMLStreamWriters are not Thread safe,
             // don't let application think it is optimizing
             if (fReuseInstance) {
@@ -168,7 +175,7 @@
     }
 
     javax.xml.stream.XMLStreamWriter createXMLStreamWriter(javax.xml.transform.stream.StreamResult sr, String encoding) throws javax.xml.stream.XMLStreamException {
-        //if factory is configured to reuse the instance & this instance can be reused
+        //if factory is configured to reuse the instance & this instance can be reused 
         //& the setProperty() hasn't been called
         try{
             if(fReuseInstance && fStreamWriter != null && fStreamWriter.canReuse() && !fPropertyChanged){
@@ -184,9 +191,9 @@
     }//createXMLStreamWriter(StreamResult,String)
 
     private static final boolean DEBUG = false;
-
+    
     /** This flag indicates the change of property. If true,
-     * <code>PropertyManager</code> should be passed when creating
+     * <code>PropertyManager</code> should be passed when creating 
      * <code>XMLStreamWriterImpl</code> */
     private boolean fPropertyChanged ;
 }//XMLOutputFactory
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/AttributeImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/AttributeImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -48,17 +48,17 @@
     //attribute value
     private String fValue;
     private String fNonNormalizedvalue;
-
+    
     //name of the attribute
     private QName fQName;
     //attribute type
     private String fAttributeType = "CDATA";
-
-
+    
+    
     //A flag indicating whether this attribute was actually specified in the start-tag
     //of its element or was defaulted from the schema.
     private boolean fIsSpecified;
-
+    
     public AttributeImpl(){
         init();
     }
@@ -67,122 +67,96 @@
         fQName = new QName(name);
         fValue = value;
     }
-
+    
     public AttributeImpl(String prefix, String name, String value) {
         this(prefix, null,name, value, null,null,false );
     }
-
+    
     public AttributeImpl(String prefix, String uri, String localPart, String value, String type) {
         this(prefix, uri, localPart, value, null, type, false);
     }
-
+    
     public AttributeImpl(String prefix, String uri, String localPart, String value, String nonNormalizedvalue, String type, boolean isSpecified) {
         this(new QName(uri, localPart, prefix), value, nonNormalizedvalue, type, isSpecified);
     }
-
-
+    
+    
     public AttributeImpl(QName qname, String value, String nonNormalizedvalue, String type, boolean isSpecified) {
         init();
         fQName = qname ;
         fValue = value ;
         if(type != null && !type.equals(""))
             fAttributeType = type;
-
+        
         fNonNormalizedvalue = nonNormalizedvalue;
         fIsSpecified = isSpecified ;
-
+        
     }
-
+    
     public String toString() {
         if( fQName.getPrefix() != null && fQName.getPrefix().length() > 0 )
             return fQName.getPrefix() + ":" + fQName.getLocalPart() + "='" + fValue + "'";
         else
             return fQName.getLocalPart() + "='" + fValue + "'";
     }
-
+    
     public void setName(QName name){
         fQName = name ;
     }
-
+    
     public QName getName() {
         return fQName;
     }
-
+    
     public void setValue(String value){
         fValue = value;
     }
-
+    
     public String getValue() {
         return fValue;
     }
-
+    
     public void setNonNormalizedValue(String nonNormalizedvalue){
         fNonNormalizedvalue = nonNormalizedvalue;
     }
-
+    
     public String getNonNormalizedValue(){
         return fNonNormalizedvalue ;
     }
-
+    
     public void setAttributeType(String attributeType){
         fAttributeType = attributeType ;
     }
-
+    
     /** Gets the type of this attribute, default is "CDATA   */
     // We dont need to take care of default value.. implementation takes care of it.
     public String getDTDType() {
         return fAttributeType;
     }
-
+    
     /** is this attribute is specified in the instance document */
-
+    
     public void setSpecified(boolean isSpecified){
         fIsSpecified = isSpecified ;
     }
-
+    
     public boolean isSpecified() {
         return fIsSpecified ;
     }
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write(toString());
+     }
 
-    /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-     *
-     * No indentation or whitespace should be outputted.
-     *
-     *
-     *
-     * Any user defined event type SHALL have this method
-     *
-     * called when being written to on an output stream.
-     *
-     * Built in Event types MUST implement this method,
-     *
-     * but implementations MAY choose not call these methods
-     *
-     * for optimizations reasons when writing out built in
-     *
-     * Events to an output stream.
-     *
-     * The output generated MUST be equivalent in terms of the
-     *
-     * infoset expressed.
-     *
-     *
-     *
-     * @param writer The writer that will output the data
-     *
-     * @throws XMLStreamException if there is a fatal error writing the event
-     *
-     */
-
-    public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException {
-
-    }
-
+    
     protected void init(){
         setEventType(XMLEvent.ATTRIBUTE);
     }
-
-
+    
+    
+    
+    
+}//AttributeImpl
 
-
-}//AttributeImpl
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/CharacterEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/CharacterEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -27,6 +27,7 @@
 
 import javax.xml.stream.events.Characters;
 import java.io.Writer;
+import java.io.IOException;
 import javax.xml.stream.events.XMLEvent;
 import com.sun.org.apache.xerces.internal.util.XMLChar;
 
@@ -49,12 +50,12 @@
     private boolean fIsSpace = false;
     /*used to prevent scanning of  data multiple times */
     private boolean fCheckIfSpaceNeeded = true;
-
+    
     public CharacterEvent() {
         fIsCData = false;
         init();
     }
-
+    
     /**
      *
      * @param data Character Data.
@@ -64,7 +65,7 @@
         init();
         fData = data;
     }
-
+    
     /**
      *
      * @param data Character Data.
@@ -75,7 +76,7 @@
         fData = data;
         fIsCData = flag;
     }
-
+    
     /**
      *
      * @param data Character Data.
@@ -88,11 +89,11 @@
         fIsCData = flag;
         fIsIgnorableWhitespace = isIgnorableWhiteSpace ;
     }
-
+    
     protected void init() {
         setEventType(XMLEvent.CHARACTERS);
     }
-
+    
     /**
      *
      * @return return data.
@@ -100,7 +101,7 @@
     public String getData() {
         return fData;
     }
-
+    
     /**
      *
      * @param String data
@@ -109,7 +110,7 @@
         fData = data;
         fCheckIfSpaceNeeded = true;
     }
-
+    
     /**
      *
      * @return boolean returns true if the data is CData
@@ -117,7 +118,7 @@
     public boolean isCData() {
         return fIsCData;
     }
-
+    
     /**
      *
      * @return String return the String representation of this event.
@@ -128,7 +129,7 @@
         else
             return fData;
     }
-
+    
     /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
      * No indentation or whitespace should be outputted.
      *
@@ -144,9 +145,15 @@
      * @param writer The writer that will output the data
      * @throws XMLStreamException if there is a fatal error writing the event
      */
-    public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException {
-    }
-
+    protected void writeAsEncodedUnicodeEx(Writer writer) throws IOException
+    {
+        if (fIsCData) {
+            writer.write("<![CDATA[" + getData() + "]]>");
+        } else {
+            charEncode(writer, fData);         
+        }
+     }
+    
     /**
      * Return true if this is ignorableWhiteSpace.  If
      * this event is ignorableWhiteSpace its event type will
@@ -156,7 +163,7 @@
     public boolean isIgnorableWhiteSpace() {
         return fIsIgnorableWhitespace;
     }
-
+    
     /**
      * Returns true if this set of Characters
      * is all whitespace.  Whitspace inside a document
@@ -173,7 +180,7 @@
         }
         return fIsSpace;
     }
-
+    
     private void checkWhiteSpace(){
         //for now - remove dependancy of XMLChar
         if(fData != null && fData.length() >0 ){
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/CommentEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/CommentEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -34,31 +34,31 @@
  * @author Neeraj Bajaj, Sun Microsystems.
  */
 public class CommentEvent extends DummyEvent implements Comment {
-
+    
     /* String data for this event */
     private String fText ;
-
+    
     public CommentEvent() {
         init();
     }
-
+    
     public CommentEvent(String text) {
         init();
         fText = text;
     }
-
+    
     protected void init() {
         setEventType(XMLEvent.COMMENT);
     }
-
+    
     /**
      * @return String String representation of this event
      */
     public String toString() {
         return "<!--" + getText() + "-->";
     }
-
-
+    
+    
     /** Return the string data of the comment, returns empty string if it
      * does not exist
      * @return String
@@ -67,4 +67,10 @@
         return fText ;
     }
 
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write("<!--" + getText() + "-->");
+    }    
+    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/DTDEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/DTDEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -34,51 +34,51 @@
  *
  */
 public class DTDEvent extends DummyEvent implements DTD{
-
+    
     private String fDoctypeDeclaration;
     private java.util.List fNotations;
     private java.util.List fEntities;
-
+    
     /** Creates a new instance of DTDEvent */
     public DTDEvent() {
         init();
     }
-
+    
     public DTDEvent(String doctypeDeclaration){
         init();
         fDoctypeDeclaration = doctypeDeclaration;
     }
-
+    
     public void setDocumentTypeDeclaration(String doctypeDeclaration){
         fDoctypeDeclaration = doctypeDeclaration;
     }
-
+    
     public String getDocumentTypeDeclaration() {
         return fDoctypeDeclaration;
     }
-
+    
     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
     //and then convert that DT to list format here. That way callee dont need to bother about conversion
-
+    
     public void setEntities(java.util.List entites){
         fEntities = entites;
     }
-
+    
     public java.util.List getEntities() {
         return fEntities;
     }
-
+    
     //xxx: we can change the signature if the implementation doesn't store the entities in List Datatype.
     //and then convert that DT to list format here. That way callee dont need to bother about conversion
-
+    
     public void setNotations(java.util.List notations){
         fNotations = notations;
     }
-
+    
     public java.util.List getNotations() {
         return fNotations;
     }
-
+    
     /**
      *Returns an implementation defined representation of the DTD.
      * This method may return null if no representation is available.
@@ -87,12 +87,18 @@
     public Object getProcessedDTD() {
         return null;
     }
-
+    
     protected void init(){
         setEventType(XMLEvent.DTD);
     }
-
+    
     public String toString(){
         return fDoctypeDeclaration ;
     }
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write(fDoctypeDeclaration);
+    }    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/DummyEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/DummyEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -25,14 +25,15 @@
 
 package com.sun.xml.internal.stream.events ;
 
-
+import java.io.IOException;
+import java.io.Writer;
 import javax.xml.stream.events.XMLEvent;
 import javax.xml.stream.events.Characters;
 import javax.xml.stream.events.EndElement;
 import javax.xml.stream.events.StartElement;
 import javax.xml.namespace.QName;
-import java.io.Writer;
 import javax.xml.stream.Location;
+import javax.xml.stream.XMLStreamException;
 
 /** DummyEvent is an abstract class. It provides functionality for most of the
  * function of XMLEvent.
@@ -46,59 +47,59 @@
     // Make sure that getLocation() never returns null. Instead, return this dummy location
     // that indicates "nowhere" as effectively as possible.
     private static DummyLocation nowhere = new DummyLocation();
-
+    
     /* Event type this event corresponds to */
     private int fEventType;
     protected Location fLocation = (Location) nowhere;
-
+    
     public DummyEvent() {
     }
-
+    
     public DummyEvent(int i) {
         fEventType = i;
     }
-
+    
     public int getEventType() {
         return fEventType;
     }
-
+    
     protected void setEventType(int eventType){
         fEventType = eventType;
     }
-
-
+    
+    
     public boolean isStartElement() {
         return fEventType == XMLEvent.START_ELEMENT;
     }
-
+    
     public boolean isEndElement() {
         return fEventType == XMLEvent.END_ELEMENT;
     }
-
+    
     public boolean isEntityReference() {
         return fEventType == XMLEvent.ENTITY_REFERENCE;
     }
-
+    
     public boolean isProcessingInstruction() {
         return fEventType == XMLEvent.PROCESSING_INSTRUCTION;
     }
-
+    
     public boolean isCharacterData() {
         return fEventType == XMLEvent.CHARACTERS;
     }
-
+    
     public boolean isStartDocument() {
         return fEventType == XMLEvent.START_DOCUMENT;
     }
-
+    
     public boolean isEndDocument() {
         return fEventType == XMLEvent.END_DOCUMENT;
     }
-
+    
     public Location getLocation(){
         return fLocation;
     }
-
+    
     void setLocation(Location loc){
         if (loc == null) {
             fLocation = nowhere;
@@ -106,28 +107,28 @@
             fLocation = loc;
         }
     }
-
+    
     /** Returns this event as Characters, may result in
      * a class cast exception if this event is not Characters.
      */
     public Characters asCharacters() {
         return (Characters)this;
     }
-
+    
     /** Returns this event as an end  element event, may result in
      * a class cast exception if this event is not a end element.
      */
     public EndElement asEndElement() {
         return (EndElement)this;
     }
-
+    
     /** Returns this event as a start element event, may result in
      * a class cast exception if this event is not a start element.
      */
     public StartElement asStartElement() {
         return (StartElement)this;
     }
-
+    
     /** This method is provided for implementations to provide
      * optional type information about the associated event.
      * It is optional and will return null if no information
@@ -137,28 +138,28 @@
         //Base class will take care of providing extra information about this event.
         return null;
     }
-
+    
     /** A utility function to check if this event is an Attribute.
      * @see Attribute
      */
     public boolean isAttribute() {
         return fEventType == XMLEvent.ATTRIBUTE;
     }
-
+    
     /** A utility function to check if this event is Characters.
      * @see Characters
      */
     public boolean isCharacters() {
         return fEventType == XMLEvent.CHARACTERS;
     }
-
+    
     /** A utility function to check if this event is a Namespace.
      * @see Namespace
      */
     public boolean isNamespace() {
         return fEventType == XMLEvent.NAMESPACE;
     }
-
+    
     /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
      * No indentation or whitespace should be outputted.
      *
@@ -174,13 +175,66 @@
      * @param writer The writer that will output the data
      * @throws XMLStreamException if there is a fatal error writing the event
      */
-    public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException {
+    public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException {
+        try {
+            writeAsEncodedUnicodeEx(writer);
+        } catch (IOException e) {
+            throw new XMLStreamException(e);
+        }
     }
+    /** Helper method in order to expose IOException.
+     * @param writer The writer that will output the data
+     * @throws XMLStreamException if there is a fatal error writing the event
+     * @throws IOException if there is an IO error
+     */
+    protected abstract void writeAsEncodedUnicodeEx(Writer writer) 
+        throws IOException, XMLStreamException;
 
+    /** Helper method to escape < > & for characters event and
+     *  quotes, lt and amps for Entity
+     */
+    protected void charEncode(Writer writer, String data) 
+        throws IOException
+    {
+        if (data == null || data == "") return;
+        int i = 0, start = 0;
+        int len = data.length();
+
+        loop:
+        for (; i < len; ++i) {
+            switch (data.charAt(i)) {
+            case '<':
+                writer.write(data, start, i - start);
+                writer.write("&lt;");
+                start = i + 1;
+                break;
+
+            case '&':
+                writer.write(data, start, i - start);
+                writer.write("&amp;");
+                start = i + 1;
+                break;
+
+            case '>':
+                writer.write(data, start, i - start);
+                writer.write("&gt;");
+                start = i + 1;
+                break;
+            case '"':
+                writer.write(data, start, i - start);
+                writer.write("&quot;");
+                start = i + 1;
+                break;
+            }
+        }
+        // Write any pending data
+        writer.write(data, start, len - start);                  
+    }
+    
     static class DummyLocation implements Location {
         public DummyLocation() {
         }
-
+        
         public int getCharacterOffset() {
             return -1;
         }
@@ -188,15 +242,15 @@
         public int getColumnNumber() {
             return -1;
         }
-
+        
         public int getLineNumber() {
             return -1;
         }
-
+        
         public String getPublicId() {
             return null;
         }
-
+        
         public String getSystemId() {
             return null;
         }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EndDocumentEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EndDocumentEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -38,36 +38,24 @@
 
 public class EndDocumentEvent extends DummyEvent
 implements EndDocument {
-
+    
     public EndDocumentEvent() {
         init();
     }
-
+    
     protected void init() {
         setEventType(XMLStreamConstants.END_DOCUMENT);
     }
-
+    
     public String toString() {
         return "ENDDOCUMENT";
     }
-
-    /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-     * No indentation or whitespace should be outputted.
-     *
-     * Any user defined event type SHALL have this method
-     * called when being written to on an output stream.
-     * Built in Event types MUST implement this method,
-     * but implementations MAY choose not call these methods
-     * for optimizations reasons when writing out built in
-     * Events to an output stream.
-     * The output generated MUST be equivalent in terms of the
-     * infoset expressed.
-     *
-     * @param writer The writer that will output the data
-     * @throws XMLStreamException if there is a fatal error writing the event
-     */
-    public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException {
-    }
-
-
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        //end document
+    }    
+    
+    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EndElementEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EndElementEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -44,56 +44,50 @@
 
 public class EndElementEvent extends DummyEvent
 implements EndElement {
-
+    
     List fNamespaces = null;
     QName fQName ;
-
+    
     public EndElementEvent() {
         init();
     }
-
+    
     protected void init() {
         setEventType(XMLEvent.END_ELEMENT);
         fNamespaces = new ArrayList();
     }
-
-
+    
+    
     public EndElementEvent(String prefix,  String uri, String localpart) {
         this(new QName(uri,localpart,prefix));
     }
-
+    
     public EndElementEvent(QName qname) {
         this.fQName = qname;
         init();
     }
-
+    
     public QName getName() {
         return fQName;
     }
-
+    
     public void setName(QName qname) {
         this.fQName = qname;
     }
-
-
-    /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-     * No indentation or whitespace should be outputted.
-     *
-     * Any user defined event type SHALL have this method
-     * called when being written to on an output stream.
-     * Built in Event types MUST implement this method,
-     * but implementations MAY choose not call these methods
-     * for optimizations reasons when writing out built in
-     * Events to an output stream.
-     * The output generated MUST be equivalent in terms of the
-     * infoset expressed.
-     *
-     * @param writer The writer that will output the data
-     * @throws XMLStreamException if there is a fatal error writing the event
-     */
-    public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException {
-    }
-
+        
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write("</");
+        String prefix = fQName.getPrefix();
+        if (prefix != null && prefix.length() > 0) {
+            writer.write(prefix);
+            writer.write(':');
+     }
+        writer.write(fQName.getLocalPart());
+        writer.write('>');
+    }    
+    
     /** Returns an Iterator of namespaces that have gone out
      * of scope.  Returns an empty iterator if no namespaces have gone
      * out of scope.
@@ -105,19 +99,19 @@
             fNamespaces.iterator();
         return new ReadOnlyIterator();
     }
-
+    
     void addNamespace(Namespace attr){
         if(attr != null){
             fNamespaces.add(attr);
         }
     }
-
+    
     public String toString() {
         String s = "</" + nameAsString();
         s = s + ">";
         return s;
     }
-
+    
     public String nameAsString() {
         if("".equals(fQName.getNamespaceURI()))
             return fQName.getLocalPart();
@@ -126,5 +120,5 @@
         else
             return "['" + fQName.getNamespaceURI() + "']:" + fQName.getLocalPart();
     }
-
+    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EntityDeclarationImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EntityDeclarationImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -37,85 +37,114 @@
  * @author  Neeraj Bajaj, Sun Microsystems.
  */
 public class EntityDeclarationImpl extends DummyEvent implements EntityDeclaration {
-
+    
     private XMLResourceIdentifier fXMLResourceIdentifier ;
     private String fEntityName;
     private String fReplacementText;
     private String fNotationName;
-
+    
     /** Creates a new instance of EntityDeclarationImpl */
     public EntityDeclarationImpl() {
         init();
     }
-
+    
     public EntityDeclarationImpl(String entityName , String replacementText){
         this(entityName,replacementText,null);
-
+        
     }
-
+    
     public EntityDeclarationImpl(String entityName, String replacementText, XMLResourceIdentifier resourceIdentifier){
         init();
         fEntityName = entityName;
         fReplacementText = replacementText;
         fXMLResourceIdentifier = resourceIdentifier;
     }
-
+    
     public void setEntityName(String entityName){
         fEntityName = entityName;
     }
-
+    
     public String getEntityName(){
         return fEntityName;
     }
-
+    
     public void setEntityReplacementText(String replacementText){
         fReplacementText = replacementText;
     }
-
+    
     public void setXMLResourceIdentifier(XMLResourceIdentifier resourceIdentifier){
         fXMLResourceIdentifier = resourceIdentifier ;
     }
-
+    
     public XMLResourceIdentifier getXMLResourceIdentifier(){
         return fXMLResourceIdentifier;
     }
-
+    
     public String getSystemId(){
         if(fXMLResourceIdentifier != null)
             return fXMLResourceIdentifier.getLiteralSystemId();
         return null;
     }
-
+    
     public String getPublicId(){
         if(fXMLResourceIdentifier != null)
             return fXMLResourceIdentifier.getPublicId();
-
+        
         return null;
     }
-
+    
     public String getBaseURI() {
         if(fXMLResourceIdentifier != null)
             return fXMLResourceIdentifier.getBaseSystemId();
         return null;
     }
-
+    
     public String getName(){
         return fEntityName;
     }
-
+    
     public String getNotationName() {
         return fNotationName;
     }
-
+    
     public void setNotationName(String notationName){
         fNotationName = notationName;
     }
-
+    
     public String getReplacementText() {
         return fReplacementText;
     }
-
+    
     protected void init(){
         setEventType(XMLEvent.ENTITY_DECLARATION);
     }
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write("<!ENTITY ");
+        writer.write(fEntityName);
+        if (fReplacementText != null) {
+            //internal entity
+            //escape quotes, lt and amps
+            writer.write(" \"");
+            charEncode(writer, fReplacementText);             
+        } else {
+            //external entity
+            String pubId = getPublicId();
+            if (pubId != null) {
+                writer.write(" PUBLIC \"");
+                writer.write(pubId);
+            } else {
+                writer.write(" SYSTEM \"");
+                writer.write(getSystemId());
+            }
+        }
+        writer.write("\"");
+        if (fNotationName != null) {
+            writer.write(" NDATA ");
+            writer.write(fNotationName);
+        }
+        writer.write(">");
+    }        
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EntityReferenceEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/EntityReferenceEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -38,53 +38,43 @@
 implements EntityReference {
     private EntityDeclaration fEntityDeclaration ;
     private String fEntityName;
-
+    
     public EntityReferenceEvent() {
         init();
     }
-
+    
     public EntityReferenceEvent(String entityName , EntityDeclaration entityDeclaration) {
         init();
         fEntityName = entityName;
         fEntityDeclaration = entityDeclaration ;
     }
-
+    
     public String getName() {
         return fEntityName;
     }
-
+    
     public String toString() {
         String text = fEntityDeclaration.getReplacementText();
         if(text == null)
             text = "";
         return "&" + getName() + ";='" + text + "'";
     }
-
-    /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-     * No indentation or whitespace should be outputted.
-     *
-     * Any user defined event type SHALL have this method
-     * called when being written to on an output stream.
-     * Built in Event types MUST implement this method,
-     * but implementations MAY choose not call these methods
-     * for optimizations reasons when writing out built in
-     * Events to an output stream.
-     * The output generated MUST be equivalent in terms of the
-     * infoset expressed.
-     *
-     * @param writer The writer that will output the data
-     * @throws XMLStreamException if there is a fatal error writing the event
-     */
-    public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException {
-    }
-
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write('&');
+        writer.write(getName());
+        writer.write(';');
+    }    
+    
     public EntityDeclaration getDeclaration(){
         return fEntityDeclaration ;
     }
-
+    
     protected void init() {
         setEventType(XMLEvent.ENTITY_REFERENCE);
     }
-
-
+    
+    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/NamedEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/NamedEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -32,35 +32,35 @@
  *
  */
 public class NamedEvent extends DummyEvent {
-
+    
     private QName name;
-
+    
     public NamedEvent() {
     }
-
-
+    
+    
     public NamedEvent(QName qname) {
         this.name = qname;
     }
-
-
+    
+    
     public NamedEvent(String prefix, String uri, String localpart) {
         this.name = new QName(uri, localpart, prefix);
     }
-
+    
     public String getPrefix() {
         return this.name.getPrefix();
     }
-
-
+    
+    
     public QName getName() {
         return name;
     }
-
+    
     public void setName(QName qname) {
         this.name = qname;
     }
-
+    
     public String nameAsString() {
         if("".equals(name.getNamespaceURI()))
             return name.getLocalPart();
@@ -69,9 +69,15 @@
         else
             return "['" + name.getNamespaceURI() + "']:" + name.getLocalPart();
     }
-
+    
     public String getNamespace(){
         return name.getNamespaceURI();
     }
 
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write(nameAsString());
+    }    
+    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/NotationDeclarationImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/NotationDeclarationImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -35,51 +35,69 @@
  * @author k.venugopal@sun.com
  */
 public class NotationDeclarationImpl extends DummyEvent implements NotationDeclaration {
-
+    
     String fName = null;
     String fPublicId = null;
     String fSystemId = null;
-
+    
     /** Creates a new instance of NotationDeclarationImpl */
     public NotationDeclarationImpl() {
         setEventType(XMLEvent.NOTATION_DECLARATION);
     }
-
+    
     public NotationDeclarationImpl(String name,String publicId,String systemId){
         this.fName = name;
         this.fPublicId = publicId;
         this.fSystemId = systemId;
         setEventType(XMLEvent.NOTATION_DECLARATION);
     }
-
+    
     public NotationDeclarationImpl(XMLNotationDecl notation){
         this.fName = notation.name;
         this.fPublicId = notation.publicId;
         this.fSystemId = notation.systemId;
         setEventType(XMLEvent.NOTATION_DECLARATION);
     }
-
+    
     public String getName() {
         return fName;
     }
-
+    
     public String getPublicId() {
         return fPublicId;
     }
-
+    
     public String getSystemId() {
         return fSystemId;
     }
-
+    
     void setPublicId(String publicId){
         this.fPublicId = publicId;
     }
-
+    
     void setSystemId(String systemId){
         this.fSystemId = systemId;
     }
-
+    
     void setName(String name){
         this.fName = name;
     }
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write("<!NOTATION ");
+        writer.write(getName());
+        if (fPublicId != null) {
+            writer.write(" PUBLIC \"");
+            writer.write(fPublicId);
+            writer.write("\"");
+        } else if (fSystemId != null) {
+            writer.write(" SYSTEM");
+            writer.write(" \"");
+            writer.write(fSystemId);
+            writer.write("\"");
+        }
+        writer.write('>');
+    }
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/ProcessingInstructionEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/ProcessingInstructionEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -40,50 +40,50 @@
 
 public class ProcessingInstructionEvent extends DummyEvent
 implements ProcessingInstruction {
-
+    
     /** Processing Instruction Name */
     private String fName;
     /** Processsing instruction content */
     private String fContent;
-
+    
     public ProcessingInstructionEvent() {
         init();
     }
-
+    
     public ProcessingInstructionEvent(String targetName, String data) {
         this(targetName,data,null);
     }
-
+    
     public ProcessingInstructionEvent(String targetName, String data,Location loc) {
         init();
         this.fName = targetName;
         fContent = data;
         setLocation(loc);
     }
-
+    
     protected void init() {
         setEventType(XMLStreamConstants.PROCESSING_INSTRUCTION);
     }
-
+    
     public String getTarget() {
         return fName;
     }
-
+    
     public void setTarget(String targetName) {
         fName = targetName;
     }
-
+    
     public void setData(String data) {
         fContent = data;
     }
-
+    
     public String getData() {
         return fContent;
     }
-
+    
     public String toString() {
         if(fContent != null && fName != null)
-            return "<?" + fName + fContent + "?>";
+            return "<?" + fName + " " + fContent + "?>";
         if(fName != null)
             return "<?" + fName + "?>";
         if(fContent != null)
@@ -91,23 +91,11 @@
         else
             return "<??>";
     }
-
-    /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-     * No indentation or whitespace should be outputted.
-     *
-     * Any user defined event type SHALL have this method
-     * called when being written to on an output stream.
-     * Built in Event types MUST implement this method,
-     * but implementations MAY choose not call these methods
-     * for optimizations reasons when writing out built in
-     * Events to an output stream.
-     * The output generated MUST be equivalent in terms of the
-     * infoset expressed.
-     *
-     * @param writer The writer that will output the data
-     * @throws XMLStreamException if there is a fatal error writing the event
-     */
-    public void writeAsEncodedUnicode(Writer writer) throws XMLStreamException {
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write(toString());
     }
-
+    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/StartDocumentEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/StartDocumentEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -38,30 +38,30 @@
 
 public class StartDocumentEvent extends DummyEvent
 implements StartDocument {
-
+    
     protected String fSystemId;
     protected String fEncodingScheam;
     protected boolean fStandalone;
     protected String fVersion;
     private boolean fEncodingSchemeSet;
     private boolean fStandaloneSet;
-
+    
     public StartDocumentEvent() {
         this("UTF-8","1.0",true,null);
     }
-
+    
     public StartDocumentEvent(String encoding){
         this(encoding,"1.0",true,null);
     }
-
+    
     public StartDocumentEvent(String encoding, String version){
         this(encoding,version,true,null);
     }
-
+    
     public StartDocumentEvent(String encoding, String version, boolean standalone){
         this(encoding,version,standalone,null);
     }
-
+    
     public StartDocumentEvent(String encoding, String version, boolean standalone,Location loc){
         init();
         this.fEncodingScheam = encoding;
@@ -76,32 +76,32 @@
     protected void init() {
         setEventType(XMLStreamConstants.START_DOCUMENT);
     }
-
+    
     public String getSystemId() {
         if(fLocation == null )
             return "";
         else
             return fLocation.getSystemId();
     }
-
-
+    
+    
     public String getCharacterEncodingScheme() {
         return fEncodingScheam;
     }
-
+    
     public boolean isStandalone() {
         return fStandalone;
     }
-
+    
     public String getVersion() {
         return fVersion;
     }
-
+    
     public void setStandalone(boolean flag) {
         fStandaloneSet = true;
         fStandalone = flag;
     }
-
+    
     public void setStandalone(String s) {
         fStandaloneSet = true;
         if(s == null) {
@@ -113,27 +113,27 @@
         else
             fStandalone = false;
     }
-
+    
     public boolean encodingSet() {
         return fEncodingSchemeSet;
     }
-
+    
     public boolean standaloneSet() {
         return fStandaloneSet;
     }
-
+    
     public void setEncoding(String encoding) {
         fEncodingScheam = encoding;
     }
-
+    
     void setDeclaredEncoding(boolean value){
         fEncodingSchemeSet = value;
     }
-
+    
     public void setVersion(String s) {
         fVersion = s;
     }
-
+    
     void clear() {
         fEncodingScheam = "UTF-8";
         fStandalone = true;
@@ -141,7 +141,7 @@
         fEncodingSchemeSet = false;
         fStandaloneSet = false;
     }
-
+    
     public String toString() {
         String s = "<?xml version=\"" + fVersion + "\"";
         s = s + " encoding='" + fEncodingScheam + "'";
@@ -155,8 +155,14 @@
         }
         return s;
     }
-
+    
     public boolean isStartDocument() {
         return true;
     }
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write(toString());
+    }
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/StartElementEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/StartElementEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -49,41 +49,41 @@
 
 public class StartElementEvent extends DummyEvent
 implements StartElement {
-
+    
     private Map fAttributes;
     private List fNamespaces;
     private NamespaceContext fNamespaceContext = null;
     private QName fQName;
-
+        
     public StartElementEvent(String prefix, String uri, String localpart) {
         this(new QName(uri, localpart, prefix));
     }
-
+    
     public StartElementEvent(QName qname) {
         fQName = qname;
         init();
     }
-
+    
     public StartElementEvent(StartElement startelement) {
         this(startelement.getName());
         addAttributes(startelement.getAttributes());
         addNamespaceAttributes(startelement.getNamespaces());
     }
-
+    
     protected void init() {
         setEventType(XMLStreamConstants.START_ELEMENT);
         fAttributes = new HashMap();
         fNamespaces = new ArrayList();
     }
-
+    
     public QName getName() {
         return fQName;
     }
-
+    
     public void setName(QName qname) {
         this.fQName = qname;
     }
-
+    
     public Iterator getAttributes() {
         if(fAttributes != null){
             Collection coll = fAttributes.values();
@@ -91,26 +91,26 @@
         }
         return new ReadOnlyIterator();
     }
-
+    
     public Iterator getNamespaces() {
         if(fNamespaces != null){
             return new ReadOnlyIterator(fNamespaces.iterator());
         }
         return new ReadOnlyIterator();
     }
-
+    
     public Attribute getAttributeByName(QName qname) {
         if(qname == null)
             return null;
         return (Attribute)fAttributes.get(qname);
     }
-
+    
     public String getNamespace(){
         return fQName.getNamespaceURI();
     }
-
+    
     public String getNamespaceURI(String prefix) {
-        //check that URI was supplied when creating this startElement event and prefix matches
+        //check that URI was supplied when creating this startElement event and prefix matches 
         if( getNamespace() != null && fQName.getPrefix().equals(prefix)) return getNamespace();
         //else check the namespace context
         if(fNamespaceContext != null)
@@ -173,8 +173,8 @@
         else
             return "['" + fQName.getNamespaceURI() + "']:" + fQName.getLocalPart();
     }
-
-
+    
+    
     /** Gets a read-only namespace context. If no context is
      * available this method will return an empty namespace context.
      * The NamespaceContext contains information about all namespaces
@@ -185,29 +185,17 @@
     public NamespaceContext getNamespaceContext() {
         return fNamespaceContext;
     }
-
+    
     public void setNamespaceContext(NamespaceContext nc) {
         fNamespaceContext = nc;
     }
-
-    /** This method will write the XMLEvent as per the XML 1.0 specification as Unicode characters.
-     * No indentation or whitespace should be outputted.
-     *
-     * Any user defined event type SHALL have this method
-     * called when being written to on an output stream.
-     * Built in Event types MUST implement this method,
-     * but implementations MAY choose not call these methods
-     * for optimizations reasons when writing out built in
-     * Events to an output stream.
-     * The output generated MUST be equivalent in terms of the
-     * infoset expressed.
-     *
-     * @param writer The writer that will output the data
-     * @throws XMLStreamException if there is a fatal error writing the event
-     */
-    public void writeAsEncodedUnicode(Writer writer) throws javax.xml.stream.XMLStreamException {
+    
+    protected void writeAsEncodedUnicodeEx(java.io.Writer writer) 
+    throws java.io.IOException
+    {
+        writer.write(toString());
     }
-
+    
     void addAttribute(Attribute attr){
         if(attr.isNamespace()){
             fNamespaces.add(attr);
@@ -215,7 +203,7 @@
             fAttributes.put(attr.getName(),attr);
         }
     }
-
+    
     void addAttributes(Iterator attrs){
         if(attrs == null)
             return;
@@ -224,13 +212,13 @@
             fAttributes.put(attr.getName(),attr);
         }
     }
-
+    
     void addNamespaceAttribute(Namespace attr){
         if(attr == null)
             return;
         fNamespaces.add(attr);
     }
-
+    
     void addNamespaceAttributes(Iterator attrs){
         if(attrs == null)
             return;
@@ -239,5 +227,5 @@
             fNamespaces.add(attr);
         }
     }
-
+    
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/events/XMLEventAllocatorImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -1,5 +1,5 @@
 /*
- * Copyright 2005-2009 Sun Microsystems, Inc.  All Rights Reserved.
+ * Copyright 2005-2006 Sun Microsystems, Inc.  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
@@ -40,11 +40,11 @@
  * @author Neeraj.bajaj@sun.com, k.venugopal@sun.com
  */
 public class XMLEventAllocatorImpl implements XMLEventAllocator {
-
+    
     /** Creates a new instance of XMLEventAllocator */
     public XMLEventAllocatorImpl() {
     }
-
+    
     public javax.xml.stream.events.XMLEvent allocate(javax.xml.stream.XMLStreamReader xMLStreamReader) throws javax.xml.stream.XMLStreamException {
         if(xMLStreamReader == null )
             throw new XMLStreamException("Reader cannot be null");
@@ -52,26 +52,26 @@
         //        return getNextEvent(xMLStreamReader);
         return getXMLEvent(xMLStreamReader);
     }
-
+    
     public void allocate(javax.xml.stream.XMLStreamReader xMLStreamReader, javax.xml.stream.util.XMLEventConsumer xMLEventConsumer) throws javax.xml.stream.XMLStreamException {
         XMLEvent currentEvent = getXMLEvent(xMLStreamReader);
         if(currentEvent != null )
             xMLEventConsumer.add(currentEvent);
-
+        
         return;
     }
-
+    
     public javax.xml.stream.util.XMLEventAllocator newInstance() {
         return new XMLEventAllocatorImpl();
     }
-
+    
     //REVISIT: shouldn't we be using XMLEventFactory to create events.
     XMLEvent getXMLEvent(XMLStreamReader streamReader){
         XMLEvent event = null;
         //returns the current event
         int eventType = streamReader.getEventType();
         switch(eventType){
-
+            
             case XMLEvent.START_ELEMENT:{
                 StartElementEvent startElementEvent = new StartElementEvent(getQName(streamReader));
                 fillAttributes(startElementEvent,streamReader);
@@ -81,7 +81,7 @@
                     fillNamespaceAttributes(startElementEvent, streamReader);
                     setNamespaceContext(startElementEvent,streamReader);
                 }
-
+                
                 startElementEvent.setLocation(streamReader.getLocation());
                 event = startElementEvent ;
                 break;
@@ -89,7 +89,7 @@
             case XMLEvent.END_ELEMENT:{
                 EndElementEvent endElementEvent = new EndElementEvent(getQName(streamReader));
                 endElementEvent.setLocation(streamReader.getLocation());
-
+                
                 if( ((Boolean)streamReader.getProperty(XMLInputFactory.IS_NAMESPACE_AWARE)).booleanValue() ){
                     fillNamespaceAttributes(endElementEvent,streamReader);
                 }
@@ -139,7 +139,7 @@
                 entityEvent.setLocation(streamReader.getLocation());
                 event = entityEvent;
                 break;
-
+                
             }
             case XMLEvent.ATTRIBUTE:{
                 event = null ;
@@ -151,7 +151,7 @@
                 List entities = (List)streamReader.getProperty(PropertyManager.STAX_ENTITIES);
                 if (entities != null && entities.size() != 0) dtdEvent.setEntities(entities);
                 List notations = (List)streamReader.getProperty(PropertyManager.STAX_NOTATIONS);
-                if (notations != null && notations.size() != 0) dtdEvent.setNotations(notations);
+                if (notations != null && notations.size() != 0) dtdEvent.setNotations(notations);                
                 event = dtdEvent;
                 break;
             }
@@ -170,16 +170,16 @@
         }
         return event ;
     }
-
+    
     //this function is not used..
     protected XMLEvent getNextEvent(XMLStreamReader streamReader) throws XMLStreamException{
         //advance the reader to next event.
         streamReader.next();
         return getXMLEvent(streamReader);
     }
-
+    
     protected void fillAttributes(StartElementEvent event,XMLStreamReader xmlr){
-
+        
         int len = xmlr.getAttributeCount();
         QName qname = null;
         AttributeImpl attr = null;
@@ -209,7 +209,7 @@
             event.addAttribute(attr);
         }
     }
-
+    
     protected void fillNamespaceAttributes(StartElementEvent event,XMLStreamReader xmlr){
         int count = xmlr.getNamespaceCount();
         String uri = null;
@@ -225,7 +225,7 @@
             event.addNamespaceAttribute(attr);
         }
     }
-
+    
     protected void fillNamespaceAttributes(EndElementEvent event,XMLStreamReader xmlr){
         int count = xmlr.getNamespaceCount();
         String uri = null;
@@ -241,7 +241,7 @@
             event.addNamespace(attr);
         }
     }
-
+    
     //Revisit : Creating a new Namespacecontext for now.
     //see if we can do better job.
     private void setNamespaceContext(StartElementEvent event , XMLStreamReader xmlr){
@@ -249,9 +249,9 @@
         NamespaceSupport ns = new NamespaceSupport(contextWrapper.getNamespaceContext());
         event.setNamespaceContext(new NamespaceContextWrapper(ns));
     }
-
+    
     private QName getQName(XMLStreamReader xmlr) {
-        return new QName(xmlr.getNamespaceURI(), xmlr.getLocalName(),
+        return new QName(xmlr.getNamespaceURI(), xmlr.getLocalName(), 
                 xmlr.getPrefix());
     }
 }
--- a/sources/jaxp_src/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/com/sun/xml/internal/stream/writers/XMLStreamWriterImpl.java	Wed Sep 28 16:49:43 2011 +0100
@@ -56,12 +56,12 @@
 import com.sun.xml.internal.stream.util.ReadOnlyIterator;
 
 /**
- * This class implements a StAX XMLStreamWriter. It extends
- * <code>AbstractMap</code> in order to support a getter for
- * implementation-specific properties. For example, you can get
- * the underlying <code>OutputStream</code> by casting an instance
- * of this class to <code>Map</code> and calling
- * <code>getProperty(OUTPUTSTREAM_PROPERTY)</code>.
+ * This class implements a StAX XMLStreamWriter. It extends 
+ * <code>AbstractMap</code> in order to support a getter for 
+ * implementation-specific properties. For example, you can get 
+ * the underlying <code>OutputStream</code> by casting an instance 
+ * of this class to <code>Map</code> and calling 
+ * <code>getProperty(OUTPUTSTREAM_PROPERTY)</code>. 
  *
  * @author Neeraj Bajaj
  * @author K.Venugopal
@@ -94,7 +94,7 @@
     boolean fEscapeCharacters = true;
 
     /**
-     * Flag for the value of repairNamespace property
+     * Flag for the value of repairNamespace property 
      */
     private boolean fIsRepairingNamespace = false;
 
@@ -119,39 +119,39 @@
      */
     private ArrayList fNamespaceDecls;
 
-    /**
+    /** 
      * Namespace context encapsulating user specified context
-     * and context built by the writer
+     * and context built by the writer  
      */
     private NamespaceContextImpl fNamespaceContext = null;
-
+    
     private NamespaceSupport fInternalNamespaceContext = null;
-
+    
     private Random fPrefixGen = null;
 
-    /**
-     * Reference to PropertyManager
+    /** 
+     * Reference to PropertyManager 
      */
     private PropertyManager fPropertyManager = null;
 
-    /**
-     * Flag to track if start tag is opened
+    /** 
+     * Flag to track if start tag is opened 
      */
     private boolean fStartTagOpened = false;
 
     /**
-     * Boolean flag  to indicate, if instance can be reused
+     * Boolean flag  to indicate, if instance can be reused 
      */
     private boolean fReuse;
-
+    
     private SymbolTable fSymbolTable = new SymbolTable();
-
+    
     private ElementStack fElementStack = new ElementStack(); //Change this .-Venu
-
+    
     final private String DEFAULT_PREFIX = fSymbolTable.addSymbol("");
-
+    
     private final ReadOnlyIterator fReadOnlyIterator = new ReadOnlyIterator();
-
+    
     /**
      * In some cases, this charset encoder is used to determine if a char is
      * encodable by underlying writer. For example, an 8-bit char from the
@@ -172,7 +172,7 @@
 
         // cannot call this(outputStream, null, props); for constructor,
         // OutputStreamWriter charsetName cannot be null
-
+        
         // use default encoding
         this(new OutputStreamWriter(outputStream), props);
     }
@@ -283,13 +283,13 @@
      */
     public void setOutput(StreamResult sr, String encoding)
         throws IOException {
-
+        
         if (sr.getOutputStream() != null) {
             setOutputUsingStream(sr.getOutputStream(), encoding);
-        }
+        } 
         else if (sr.getWriter() != null) {
             setOutputUsingWriter(sr.getWriter());
-        }
+        } 
         else if (sr.getSystemId() != null) {
             setOutputUsingStream(new FileOutputStream(sr.getSystemId()),
                 encoding);
@@ -297,10 +297,10 @@
     }
 
      private void setOutputUsingWriter(Writer writer)
-        throws IOException
+        throws IOException 
      {
          fWriter = writer;
-
+         
          if (writer instanceof OutputStreamWriter) {
              String charset = ((OutputStreamWriter) writer).getEncoding();
              if (charset != null && !charset.equalsIgnoreCase("utf-8")) {
@@ -311,7 +311,7 @@
 
     /**
      * Utility method to create a writer when passed an OutputStream. Make
-     * sure to wrap an <code>OutputStreamWriter</code> using an
+     * sure to wrap an <code>OutputStreamWriter</code> using an 
      * <code>XMLWriter</code> for performance reasons.
      *
      * @param os        Underlying OutputStream
@@ -320,7 +320,7 @@
     private void setOutputUsingStream(OutputStream os, String encoding)
         throws IOException {
         fOutputStream = os;
-
+        
         if (encoding != null) {
             if (encoding.equalsIgnoreCase("utf-8")) {
                 fWriter = new UTF8OutputStreamWriter(os);
@@ -499,7 +499,7 @@
             if ((tmpURI != null) && (tmpURI == uri)) {
                 return;
             }
-
+            
             if(checkUserNamespaceContext(prefix,uri))
                 return;
             QName qname = new QName();
@@ -615,16 +615,16 @@
                         return;
                     }
                 }
-
+                
                 if (!prefix.equals(XMLConstants.XML_NS_PREFIX) || !namespaceURI.equals(XMLConstants.XML_NS_URI)) {
-
+                    
                     prefix = fSymbolTable.addSymbol(prefix);
                     namespaceURI = fSymbolTable.addSymbol(namespaceURI);
-
+                    
                     if (fInternalNamespaceContext.containsPrefixInCurrentContext(prefix)){
-
+                        
                         String tmpURI = fInternalNamespaceContext.getURI(prefix);
-
+                        
                         if (tmpURI != null && tmpURI != namespaceURI){
                             throw new XMLStreamException("Prefix "+prefix+" is " +
                                     "already bound to "+tmpURI+
@@ -764,11 +764,11 @@
             }
 
             namespaceURINormalized = fSymbolTable.addSymbol(namespaceURINormalized);
-
+            
             if (fInternalNamespaceContext.containsPrefixInCurrentContext("")){
-
+                
                 String tmp = fInternalNamespaceContext.getURI("");
-
+                
                 if (tmp != null && tmp != namespaceURINormalized) {
                         throw new XMLStreamException(
                                 "xmlns has been already bound to " +tmp +
@@ -973,7 +973,7 @@
 
         try {
             QName qname = null;
-
+            
             if (!fStartTagOpened) {
                 throw new IllegalStateException(
                         "Invalid state: start tag is not opened at writeNamespace("
@@ -982,7 +982,7 @@
                         + namespaceURINormalized
                         + ")");
             }
-
+            
             // is this the default Namespace?
             if (prefix == null
                     || prefix.equals(XMLConstants.DEFAULT_NS_PREFIX)
@@ -996,7 +996,7 @@
 
             prefix = fSymbolTable.addSymbol(prefix);
             namespaceURINormalized = fSymbolTable.addSymbol(namespaceURINormalized);
-
+            
             if (fIsRepairingNamespace) {
                 String tmpURI = fInternalNamespaceContext.getURI(prefix);
 
@@ -1012,23 +1012,23 @@
                 return;
             }
 
-
+            
             if (fInternalNamespaceContext.containsPrefixInCurrentContext(prefix)){
-
+                
                 String tmp = fInternalNamespaceContext.getURI(prefix);
-
+                
                 if (tmp != null && tmp != namespaceURINormalized) {
-
+                    
                        throw new XMLStreamException("prefix "+prefix+
                             " has been already bound to " +tmp +
                             ". Rebinding it to "+ namespaceURINormalized+
                             " is an error");
                 }
             }
-
+            
             fInternalNamespaceContext.declarePrefix(prefix, namespaceURINormalized);
             writenamespace(prefix, namespaceURINormalized);
-
+            
         } catch (IOException e) {
             throw new XMLStreamException(e);
         }
@@ -1152,14 +1152,14 @@
 
                 return;
             }
-
+            
             String streamEncoding = null;
             if (fWriter instanceof OutputStreamWriter) {
-                streamEncoding = ((OutputStreamWriter) fWriter).getEncoding();
-            }
+                streamEncoding = ((OutputStreamWriter) fWriter).getEncoding();            
+            } 
             else if (fWriter instanceof UTF8OutputStreamWriter) {
-                streamEncoding = ((UTF8OutputStreamWriter) fWriter).getEncoding();
-            }
+                streamEncoding = ((UTF8OutputStreamWriter) fWriter).getEncoding();            
+            } 
             else if (fWriter instanceof XMLWriter) {
                 streamEncoding = ((OutputStreamWriter) ((XMLWriter)fWriter).getWriter()).getEncoding();
             }
@@ -1175,14 +1175,14 @@
                 }
                 // If no alias matches the encoding name, then report error
                 if (!foundAlias) {
-                    throw new XMLStreamException("Underlying stream encoding '"
-                            + streamEncoding
+                    throw new XMLStreamException("Underlying stream encoding '"  
+                            + streamEncoding  
                             + "' and input paramter for writeStartDocument() method '"
                             + encoding + "' do not match.");
                 }
-            }
-
-
+            } 
+            
+            
             fWriter.write("<?xml version=\"");
 
             if ((version == null) || version.equals("")) {
@@ -1299,11 +1299,11 @@
 
             String tmpPrefix = fNamespaceContext.getPrefix(namespaceURI);
 
-
+                       
             if ((prefix != null) &&
                     ((tmpPrefix == null) || !prefix.equals(tmpPrefix))) {
                 fInternalNamespaceContext.declarePrefix(prefix, namespaceURI);
-
+      
             }
 
             if (fIsRepairingNamespace) {
@@ -1326,7 +1326,7 @@
             }
 
             fWriter.write(localName);
-
+            
         } catch (IOException ex) {
             throw new XMLStreamException(ex);
         }
@@ -1351,18 +1351,18 @@
 
         for (int index = start; index < end; index++) {
             char ch = content[index];
-
+            
             if (fEncoder != null && !fEncoder.canEncode(ch)){
                 fWriter.write(content, startWritePos, index - startWritePos );
 
                 // Escape this char as underlying encoder cannot handle it
                 fWriter.write( "&#x" );
                 fWriter.write(Integer.toHexString(ch));
-                fWriter.write( ';' );
+                fWriter.write( ';' );                    
                 startWritePos = index + 1;
                 continue;
             }
-
+            
             switch (ch) {
             case '<':
                 fWriter.write(content, startWritePos, index - startWritePos);
@@ -1422,18 +1422,18 @@
 
         for (int index = 0; index < end; index++) {
             char ch = content.charAt(index);
-
+            
             if (fEncoder != null && !fEncoder.canEncode(ch)){
                 fWriter.write(content, startWritePos, index - startWritePos );
 
                 // Escape this char as underlying encoder cannot handle it
                 fWriter.write( "&#x" );
                 fWriter.write(Integer.toHexString(ch));
-                fWriter.write( ';' );
+                fWriter.write( ';' );                    
                 startWritePos = index + 1;
                 continue;
             }
-
+            
             switch (ch) {
             case '<':
                 fWriter.write(content, startWritePos, index - startWritePos);
@@ -1472,7 +1472,7 @@
         // Write any pending data
         fWriter.write(content, startWritePos, end - startWritePos);
     }
-
+    
     /**
      * marks close of start tag and writes the same into the writer.
      */
@@ -1575,7 +1575,7 @@
 
             if (prefix == XMLConstants.DEFAULT_NS_PREFIX && uri == XMLConstants.DEFAULT_NS_PREFIX)
                 return;
-
+            
             uri = fSymbolTable.addSymbol(uri);
 
             QName decl = null;
@@ -1676,7 +1676,7 @@
                 }
             }
         }
-
+        
         for(int i=0 ; i< fAttributeCache.size();i++){
             attr = (Attribute)fAttributeCache.get(i);
             for(int j=i+1;j<fAttributeCache.size();j++){
@@ -1693,7 +1693,7 @@
 
         for (i = 0; i < fAttributeCache.size(); i++) {
             attr = (Attribute) fAttributeCache.get(i);
-            /* If 'attr' is an attribute and it is in no namespace(which means that prefix="", uri=""), attr's
+            /* If 'attr' is an attribute and it is in no namespace(which means that prefix="", uri=""), attr's 
                namespace should not be redinded. See [http://www.w3.org/TR/REC-xml-names/#defaulting].
              */
             if (attr.prefix != null && attr.prefix.equals("") && attr.uri != null && attr.uri.equals("")){
@@ -1728,12 +1728,12 @@
         String tmpPrefix = null;
         QName decl = null;
         boolean done = false;
-
+        
         checkForNull(attr1);
         checkForNull(attr2);
-
+        
         if(attr1.prefix.equals(attr2.prefix) && !(attr1.uri.equals(attr2.uri))){
-
+            
             tmpPrefix = fNamespaceContext.getPrefix(attr2.uri);
 
             if (tmpPrefix != null) {
@@ -1772,7 +1772,7 @@
         if (attr.prefix == null) attr.prefix = XMLConstants.DEFAULT_NS_PREFIX;
         if (attr.uri == null) attr.uri = XMLConstants.DEFAULT_NS_PREFIX;
     }
-
+    
     void removeDuplicateDecls(){
         QName decl1,decl2;
         for(int i =0;i<fNamespaceDecls.size();i++){
@@ -2086,9 +2086,9 @@
             return fReadOnlyIterator;
         }
     }
-
+    
     // -- Map Interface --------------------------------------------------
-
+    
     public int size() {
         return 1;
     }
@@ -2103,7 +2103,7 @@
 
     /**
      * Returns the value associated to an implementation-specific
-     * property.
+     * property. 
      */
     public Object get(Object key) {
         if (key.equals(OUTPUTSTREAM_PROPERTY)) {
@@ -2115,4 +2115,29 @@
     public java.util.Set entrySet() {
         throw new UnsupportedOperationException();
     }
+    
+    /**
+     * Overrides the method defined in AbstractMap which is 
+     * not completely implemented. Calling toString() in
+     * AbstractMap would cause an unsupported exection to 
+     * be thrown.
+     */
+    public String toString() {
+        return getClass().getName() + "@" + Integer.toHexString(hashCode());
+    }
+    
+    /**
+     * Overrides the method defined in AbstractMap
+     * This is required by the toString() method
+     */
+    public int hashCode() {
+        return fElementStack.hashCode();   
+    }
+    /**
+     * Overrides the method defined in AbstractMap
+     * This is required to satisfy the contract for hashCode.
+     */
+    public boolean equals(Object obj) {
+        return (this == obj);
+    }
 }
--- a/sources/jaxp_src/src/javax/xml/stream/EventFilter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/EventFilter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,15 +23,18 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
+
 import javax.xml.stream.events.XMLEvent;
+
 /**
  * This interface declares a simple filter interface that one can
  * create to filter XMLEventReaders
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface EventFilter {
--- a/sources/jaxp_src/src/javax/xml/stream/FactoryConfigurationError.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/FactoryConfigurationError.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -31,7 +31,8 @@
 /**
  * An error class for reporting factory configuration errors.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public class FactoryConfigurationError extends Error {
--- a/sources/jaxp_src/src/javax/xml/stream/Location.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/Location.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -34,7 +34,8 @@
  * All the information provided by a Location is optional.  For example
  * an application may only report line numbers.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface Location {
@@ -74,3 +75,4 @@
    */
   public String getSystemId();
 }
+
--- a/sources/jaxp_src/src/javax/xml/stream/StreamFilter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/StreamFilter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,14 +23,16 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
+
 /**
  * This interface declares a simple filter interface that one can
  * create to filter XMLStreamReaders
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface StreamFilter {
--- a/sources/jaxp_src/src/javax/xml/stream/XMLEventFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLEventFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -34,7 +34,8 @@
 /**
  * This interface defines a utility class for creating instances of
  * XMLEvents
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.2
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see javax.xml.stream.events.StartElement
  * @see javax.xml.stream.events.EndElement
  * @see javax.xml.stream.events.ProcessingInstruction
@@ -49,10 +50,10 @@
   protected XMLEventFactory(){}
 
   /**
-   * Create a new instance of the factory
+   * Create a new instance of the factory 
    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
    */
-  public static XMLEventFactory newInstance()
+  public static XMLEventFactory newInstance() 
     throws FactoryConfigurationError
   {
     return (XMLEventFactory) FactoryFinder.find(
@@ -61,13 +62,52 @@
   }
 
   /**
-   * Create a new instance of the factory
+   * Create a new instance of the factory. 
+   * This static method creates a new factory instance. 
+   * This method uses the following ordered lookup procedure to determine 
+   * the XMLEventFactory implementation class to load: 
+   *   Use the javax.xml.stream.XMLEventFactory system property. 
+   *   Use the properties file "lib/stax.properties" in the JRE directory. 
+   *     This configuration file is in standard java.util.Properties format 
+   *     and contains the fully qualified name of the implementation class 
+   *     with the key being the system property defined above. 
+   *   Use the Services API (as detailed in the JAR specification), if available, 
+   *     to determine the classname. The Services API will look for a classname 
+   *     in the file META-INF/services/javax.xml.stream.XMLEventFactory in jars 
+   *     available to the runtime. 
+   *   Platform default XMLEventFactory instance. 
+   *   
+   *   Once an application has obtained a reference to a XMLEventFactory it 
+   *   can use the factory to configure and obtain stream instances.   
+   *   
+   *   Note that this is a new method that replaces the deprecated newInstance() method.  
+   *     No changes in behavior are defined by this replacement method relative to 
+   *     the deprecated method.
+   *     
+   * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   */
+  public static XMLEventFactory newFactory()
+    throws FactoryConfigurationError
+  {
+    return (XMLEventFactory) FactoryFinder.find(
+      "javax.xml.stream.XMLEventFactory",
+      "com.sun.xml.internal.stream.events.XMLEventFactoryImpl");
+  }
+
+  /**
+   * Create a new instance of the factory 
    *
    * @param factoryId             Name of the factory to find, same as
    *                              a property name
    * @param classLoader           classLoader to use
    * @return the factory implementation
    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   * 
+   * @deprecated  This method has been deprecated to maintain API consistency.
+   *              All newInstance methods have been replaced with corresponding
+   *              newFactory methods. The replacement {@link
+   *              #newFactory(java.lang.String, java.lang.ClassLoader)}
+   *              method defines no changes in behavior.
    */
   public static XMLEventFactory newInstance(String factoryId,
           ClassLoader classLoader)
@@ -81,10 +121,37 @@
       }
   }
 
+  /**
+   * Create a new instance of the factory.  
+   * If the classLoader argument is null, then the ContextClassLoader is used.   
+   * 
+   * Note that this is a new method that replaces the deprecated 
+   *   newInstance(String factoryId, ClassLoader classLoader) method.  
+   * No changes in behavior are defined by this replacement method relative 
+   * to the deprecated method.
+   *              
+   * @param factoryId             Name of the factory to find, same as
+   *                              a property name
+   * @param classLoader           classLoader to use
+   * @return the factory implementation
+   * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   */
+  public static XMLEventFactory newFactory(String factoryId,
+          ClassLoader classLoader)
+          throws FactoryConfigurationError {
+      try {
+          //do not fallback if given classloader can't find the class, throw exception
+          return (XMLEventFactory) FactoryFinder.newInstance(factoryId, classLoader, false);
+      } catch (FactoryFinder.ConfigurationError e) {
+          throw new FactoryConfigurationError(e.getException(),
+                  e.getMessage());
+      }
+  }
+
  /**
    * This method allows setting of the Location on each event that
    * is created by this factory.  The values are copied by value into
-   * the events created by this factory.  To reset the location
+   * the events created by this factory.  To reset the location 
    * information set the location to null.
    * @param location the location to set on each event created
    */
@@ -134,13 +201,13 @@
   /**
    * Create a new StartElement.  Namespaces can be added to this StartElement
    * by passing in an Iterator that walks over a set of Namespace interfaces.
-   * Attributes can be added to this StartElement by passing an iterator
+   * Attributes can be added to this StartElement by passing an iterator 
    * that walks over a set of Attribute interfaces.
    *
    * @param name the qualified name of the attribute, may not be null
-   * @param attributes an optional unordered set of objects that
+   * @param attributes an optional unordered set of objects that 
    * implement Attribute to add to the new StartElement, may be null
-   * @param namespaces an optional unordered set of objects that
+   * @param namespaces an optional unordered set of objects that 
    * implement Namespace to add to the new StartElement, may be null
    * @return an instance of the requested StartElement
    */
@@ -164,15 +231,15 @@
   /**
    * Create a new StartElement.  Namespaces can be added to this StartElement
    * by passing in an Iterator that walks over a set of Namespace interfaces.
-   * Attributes can be added to this StartElement by passing an iterator
+   * Attributes can be added to this StartElement by passing an iterator 
    * that walks over a set of Attribute interfaces.
    *
    * @param namespaceUri the uri of the QName of the new StartElement
    * @param localName the local name of the QName of the new StartElement
    * @param prefix the prefix of the QName of the new StartElement
-   * @param attributes an unordered set of objects that implement
+   * @param attributes an unordered set of objects that implement 
    * Attribute to add to the new StartElement
-   * @param namespaces an unordered set of objects that implement
+   * @param namespaces an unordered set of objects that implement 
    * Namespace to add to the new StartElement
    * @return an instance of the requested StartElement
    */
@@ -185,15 +252,15 @@
   /**
    * Create a new StartElement.  Namespaces can be added to this StartElement
    * by passing in an Iterator that walks over a set of Namespace interfaces.
-   * Attributes can be added to this StartElement by passing an iterator
+   * Attributes can be added to this StartElement by passing an iterator 
    * that walks over a set of Attribute interfaces.
    *
    * @param namespaceUri the uri of the QName of the new StartElement
    * @param localName the local name of the QName of the new StartElement
    * @param prefix the prefix of the QName of the new StartElement
-   * @param attributes an unordered set of objects that implement
+   * @param attributes an unordered set of objects that implement 
    * Attribute to add to the new StartElement, may be null
-   * @param namespaces an unordered set of objects that implement
+   * @param namespaces an unordered set of objects that implement 
    * Namespace to add to the new StartElement, may be null
    * @param context the namespace context of this element
    * @return an instance of the requested StartElement
@@ -209,11 +276,11 @@
   /**
    * Create a new EndElement
    * @param name the qualified name of the EndElement
-   * @param namespaces an optional unordered set of objects that
+   * @param namespaces an optional unordered set of objects that 
    * implement Namespace that have gone out of scope, may be null
    * @return an instance of the requested EndElement
    */
-  public abstract EndElement createEndElement(QName name,
+  public abstract EndElement createEndElement(QName name, 
                                               Iterator namespaces);
 
   /**
@@ -223,7 +290,7 @@
    * @param prefix the prefix of the QName of the new StartElement
    * @return an instance of the requested EndElement
    */
-  public abstract EndElement createEndElement(String prefix,
+  public abstract EndElement createEndElement(String prefix, 
                                               String namespaceUri,
                                               String localName);
   /**
@@ -231,11 +298,11 @@
    * @param namespaceUri the uri of the QName of the new StartElement
    * @param localName the local name of the QName of the new StartElement
    * @param prefix the prefix of the QName of the new StartElement
-   * @param namespaces an unordered set of objects that implement
+   * @param namespaces an unordered set of objects that implement 
    * Namespace that have gone out of scope, may be null
    * @return an instance of the requested EndElement
    */
-  public abstract EndElement createEndElement(String prefix,
+  public abstract EndElement createEndElement(String prefix, 
                                               String namespaceUri,
                                               String localName,
                                               Iterator namespaces);
@@ -268,13 +335,13 @@
    */
   public abstract Characters createIgnorableSpace(String content);
 
-  /**
+  /** 
    * Creates a new instance of a StartDocument event
    * @return a StartDocument event
    */
   public abstract StartDocument createStartDocument();
 
-  /**
+  /** 
    * Creates a new instance of a StartDocument event
    *
    * @param encoding the encoding style
@@ -286,7 +353,7 @@
                                                   String version,
                                                   boolean standalone);
 
-  /**
+  /** 
    * Creates a new instance of a StartDocument event
    *
    * @param encoding the encoding style
@@ -296,7 +363,7 @@
   public abstract StartDocument createStartDocument(String encoding,
                                                   String version);
 
-  /**
+  /** 
    * Creates a new instance of a StartDocument event
    *
    * @param encoding the encoding style
@@ -343,3 +410,7 @@
    */
   public abstract DTD createDTD(String dtd);
 }
+
+
+
+
--- a/sources/jaxp_src/src/javax/xml/stream/XMLEventReader.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLEventReader.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,19 +23,23 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
+
 import javax.xml.stream.events.XMLEvent;
+
 import java.util.Iterator;
+
 /**
  *
  * This is the top level interface for parsing XML Events.  It provides
- * the ability to peek at the next event and returns configuration
+ * the ability to peek at the next event and returns configuration 
  * information through the property interface.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see XMLInputFactory
  * @see XMLEventWriter
  * @since 1.6
--- a/sources/jaxp_src/src/javax/xml/stream/XMLEventWriter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLEventWriter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -39,7 +39,8 @@
  * Instances of this interface are not required to validate the
  * form of the XML.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see XMLEventReader
  * @see javax.xml.stream.events.XMLEvent
  * @see javax.xml.stream.events.Characters
--- a/sources/jaxp_src/src/javax/xml/stream/XMLInputFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLInputFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -33,8 +33,8 @@
 
 /**
  * Defines an abstract implementation of a factory for getting streams.
- *
- * The following table defines the standard properties of this specification.
+ * 
+ * The following table defines the standard properties of this specification.  
  * Each property varies in the level of support required by each implementation.
  * The level of support required is described in the 'Required' column.
  *
@@ -67,7 +67,8 @@
  *  </table>
  *
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.2
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see XMLOutputFactory
  * @see XMLEventReader
  * @see XMLStreamReader
@@ -79,41 +80,41 @@
  */
 
 public abstract class XMLInputFactory {
-  /**
-   * The property used to turn on/off namespace support,
+  /** 
+   * The property used to turn on/off namespace support, 
    * this is to support XML 1.0 documents,
    * only the true setting must be supported
    */
   public static final String IS_NAMESPACE_AWARE=
     "javax.xml.stream.isNamespaceAware";
 
-  /**
-   * The property used to turn on/off implementation specific validation
+  /** 
+   * The property used to turn on/off implementation specific validation 
    */
   public static final String IS_VALIDATING=
     "javax.xml.stream.isValidating";
-
-  /**
-   * The property that requires the parser to coalesce adjacent character data sections
+  
+  /** 
+   * The property that requires the parser to coalesce adjacent character data sections 
    */
   public static final String IS_COALESCING=
     "javax.xml.stream.isCoalescing";
-
-  /**
-   * Requires the parser to replace internal
-   * entity references with their replacement
+  
+  /** 
+   * Requires the parser to replace internal 
+   * entity references with their replacement 
    * text and report them as characters
    */
   public static final String IS_REPLACING_ENTITY_REFERENCES=
     "javax.xml.stream.isReplacingEntityReferences";
-
-  /**
+  
+  /** 
    *  The property that requires the parser to resolve external parsed entities
    */
   public static final String IS_SUPPORTING_EXTERNAL_ENTITIES=
     "javax.xml.stream.isSupportingExternalEntities";
 
-  /**
+  /** 
    *  The property that requires the parser to support DTDs
    */
   public static final String SUPPORT_DTD=
@@ -121,7 +122,7 @@
 
   /**
    * The property used to
-   * set/get the implementation of the XMLReporter interface
+   * set/get the implementation of the XMLReporter interface 
    */
   public static final String REPORTER=
     "javax.xml.stream.reporter";
@@ -131,7 +132,7 @@
    */
   public static final String RESOLVER=
     "javax.xml.stream.resolver";
-
+  
   /**
    * The property used to set/get the implementation of the allocator
    */
@@ -142,20 +143,6 @@
 
   /**
    * Create a new instance of the factory.
-   * This static method creates a new factory instance.
-   * This method uses the following ordered lookup procedure to determine
-   * the XMLInputFactory implementation class to load:
-   * Use the javax.xml.stream.XMLInputFactory system property.
-   * Use the properties file "lib/stax.properties" in the JRE directory.
-   * This configuration file is in standard java.util.Properties format and contains
-   * the fully qualified name of the implementation class with the key being the system property defined above.
-   * Use the Services API (as detailed in the JAR specification), if available, to determine the classname.
-   * The Services API will look for a classname in the file META-INF/services/javax.xml.stream.XMLInputFactory
-   * in jars available to the runtime.
-   * Platform default XMLInputFactory instance.
-   * Once an application has obtained a reference to a XMLInputFactory
-   * it can use the factory to configure and obtain stream instances.
-   *
    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
    */
   public static XMLInputFactory newInstance()
@@ -167,13 +154,52 @@
   }
 
   /**
-   * Create a new instance of the factory
+   * Create a new instance of the factory. 
+   * This static method creates a new factory instance. 
+   * This method uses the following ordered lookup procedure to determine 
+   * the XMLInputFactory implementation class to load: 
+   *   Use the javax.xml.stream.XMLInputFactory system property. 
+   *   Use the properties file "lib/stax.properties" in the JRE directory. 
+   *     This configuration file is in standard java.util.Properties format 
+   *     and contains the fully qualified name of the implementation class 
+   *     with the key being the system property defined above. 
+   *   Use the Services API (as detailed in the JAR specification), if available, 
+   *     to determine the classname. The Services API will look for a classname 
+   *     in the file META-INF/services/javax.xml.stream.XMLInputFactory in jars 
+   *     available to the runtime. 
+   *   Platform default XMLInputFactory instance. 
+   *   
+   *   Once an application has obtained a reference to a XMLInputFactory it 
+   *   can use the factory to configure and obtain stream instances.   
+   *   
+   *   Note that this is a new method that replaces the deprecated newInstance() method.  
+   *     No changes in behavior are defined by this replacement method relative to 
+   *     the deprecated method.
+   *     
+   * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   */
+  public static XMLInputFactory newFactory()
+    throws FactoryConfigurationError
+  {
+    return (XMLInputFactory) FactoryFinder.find(
+      "javax.xml.stream.XMLInputFactory",
+      "com.sun.xml.internal.stream.XMLInputFactoryImpl");
+  }
+
+  /**
+   * Create a new instance of the factory 
    *
    * @param factoryId             Name of the factory to find, same as
    *                              a property name
    * @param classLoader           classLoader to use
    * @return the factory implementation
    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   *
+   * @deprecated  This method has been deprecated to maintain API consistency.
+   *              All newInstance methods have been replaced with corresponding
+   *              newFactory methods. The replacement {@link
+   *              #newFactory(java.lang.String, java.lang.ClassLoader)} method
+   *              defines no changes in behavior.
    */
   public static XMLInputFactory newInstance(String factoryId,
           ClassLoader classLoader)
@@ -188,36 +214,63 @@
   }
 
   /**
+   * Create a new instance of the factory.  
+   * If the classLoader argument is null, then the ContextClassLoader is used.   
+   * 
+   * Note that this is a new method that replaces the deprecated 
+   *   newInstance(String factoryId, ClassLoader classLoader) method.  
+   * No changes in behavior are defined by this replacement method relative 
+   * to the deprecated method.
+   *              
+   * @param factoryId             Name of the factory to find, same as
+   *                              a property name
+   * @param classLoader           classLoader to use
+   * @return the factory implementation
+   * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   */
+  public static XMLInputFactory newFactory(String factoryId,
+          ClassLoader classLoader)
+          throws FactoryConfigurationError {
+      try {
+          //do not fallback if given classloader can't find the class, throw exception
+          return (XMLInputFactory) FactoryFinder.newInstance(factoryId, classLoader, false);
+      } catch (FactoryFinder.ConfigurationError e) {
+          throw new FactoryConfigurationError(e.getException(),
+                  e.getMessage());
+      }
+  }
+
+  /**
    * Create a new XMLStreamReader from a reader
    * @param reader the XML data to read from
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLStreamReader createXMLStreamReader(java.io.Reader reader)
+  public abstract XMLStreamReader createXMLStreamReader(java.io.Reader reader) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLStreamReader from a JAXP source.  This method is optional.
    * @param source the source to read from
-   * @throws UnsupportedOperationException if this method is not
+   * @throws UnsupportedOperationException if this method is not 
    * supported by this XMLInputFactory
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLStreamReader createXMLStreamReader(Source source)
+  public abstract XMLStreamReader createXMLStreamReader(Source source) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLStreamReader from a java.io.InputStream
    * @param stream the InputStream to read from
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream)
+  public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLStreamReader from a java.io.InputStream
    * @param stream the InputStream to read from
    * @param encoding the character encoding of the stream
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
   public abstract XMLStreamReader createXMLStreamReader(java.io.InputStream stream, String encoding)
     throws XMLStreamException;
@@ -241,16 +294,16 @@
   /**
    * Create a new XMLEventReader from a reader
    * @param reader the XML data to read from
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLEventReader createXMLEventReader(java.io.Reader reader)
+  public abstract XMLEventReader createXMLEventReader(java.io.Reader reader) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLEventReader from a reader
-   * @param systemId the system ID of the input
+   * @param systemId the system ID of the input 
    * @param reader the XML data to read from
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
   public abstract XMLEventReader createXMLEventReader(String systemId, java.io.Reader reader)
     throws XMLStreamException;
@@ -258,46 +311,46 @@
   /**
    * Create a new XMLEventReader from an XMLStreamReader.  After being used
    * to construct the XMLEventReader instance returned from this method
-   * the XMLStreamReader must not be used.
+   * the XMLStreamReader must not be used.  
    * @param reader the XMLStreamReader to read from (may not be modified)
    * @return a new XMLEventReader
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader)
+  public abstract XMLEventReader createXMLEventReader(XMLStreamReader reader) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLEventReader from a JAXP source.
    * Support of this method is optional.
    * @param source the source to read from
-   * @throws UnsupportedOperationException if this method is not
+   * @throws UnsupportedOperationException if this method is not 
    * supported by this XMLInputFactory
    */
-  public abstract XMLEventReader createXMLEventReader(Source source)
+  public abstract XMLEventReader createXMLEventReader(Source source) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLEventReader from a java.io.InputStream
    * @param stream the InputStream to read from
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream)
+  public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLEventReader from a java.io.InputStream
    * @param stream the InputStream to read from
    * @param encoding the character encoding of the stream
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream, String encoding)
+  public abstract XMLEventReader createXMLEventReader(java.io.InputStream stream, String encoding) 
     throws XMLStreamException;
 
   /**
    * Create a new XMLEventReader from a java.io.InputStream
    * @param systemId the system ID of the stream
    * @param stream the InputStream to read from
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
   public abstract XMLEventReader createXMLEventReader(String systemId, java.io.InputStream stream)
     throws XMLStreamException;
@@ -306,41 +359,41 @@
    * Create a filtered reader that wraps the filter around the reader
    * @param reader the reader to filter
    * @param filter the filter to apply to the reader
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter)
+  public abstract XMLStreamReader createFilteredReader(XMLStreamReader reader, StreamFilter filter) 
     throws XMLStreamException;
 
   /**
    * Create a filtered event reader that wraps the filter around the event reader
    * @param reader the event reader to wrap
    * @param filter the filter to apply to the event reader
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
-  public abstract XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter)
+  public abstract XMLEventReader createFilteredReader(XMLEventReader reader, EventFilter filter) 
     throws XMLStreamException;
 
   /**
-   * The resolver that will be set on any XMLStreamReader or XMLEventReader created
+   * The resolver that will be set on any XMLStreamReader or XMLEventReader created 
    * by this factory instance.
    */
   public abstract XMLResolver getXMLResolver();
 
   /**
-   * The resolver that will be set on any XMLStreamReader or XMLEventReader created
+   * The resolver that will be set on any XMLStreamReader or XMLEventReader created 
    * by this factory instance.
    * @param resolver the resolver to use to resolve references
    */
   public abstract void  setXMLResolver(XMLResolver resolver);
 
   /**
-   * The reporter that will be set on any XMLStreamReader or XMLEventReader created
+   * The reporter that will be set on any XMLStreamReader or XMLEventReader created 
    * by this factory instance.
    */
   public abstract XMLReporter getXMLReporter();
 
   /**
-   * The reporter that will be set on any XMLStreamReader or XMLEventReader created
+   * The reporter that will be set on any XMLStreamReader or XMLEventReader created 
    * by this factory instance.
    * @param reporter the resolver to use to report non fatal errors
    */
@@ -354,8 +407,8 @@
    * @param value The value of the property
    * @throws java.lang.IllegalArgumentException if the property is not supported
    */
-  public abstract void setProperty(java.lang.String name, Object value)
-    throws java.lang.IllegalArgumentException;
+  public abstract void setProperty(java.lang.String name, Object value) 
+    throws java.lang.IllegalArgumentException;  
 
   /**
    * Get the value of a feature/property from the underlying implementation
@@ -363,8 +416,8 @@
    * @return The value of the property
    * @throws IllegalArgumentException if the property is not supported
    */
-  public abstract Object getProperty(java.lang.String name)
-    throws java.lang.IllegalArgumentException;
+  public abstract Object getProperty(java.lang.String name) 
+    throws java.lang.IllegalArgumentException;  
 
 
   /**
@@ -387,3 +440,4 @@
   public abstract XMLEventAllocator getEventAllocator();
 
 }
+
--- a/sources/jaxp_src/src/javax/xml/stream/XMLOutputFactory.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLOutputFactory.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -31,10 +31,10 @@
 import javax.xml.transform.Result;
 
 /**
- * Defines an abstract implementation of a factory for
+ * Defines an abstract implementation of a factory for 
  * getting XMLEventWriters and XMLStreamWriters.
  *
- * The following table defines the standard properties of this specification.
+ * The following table defines the standard properties of this specification.  
  * Each property varies in the level of support required by each implementation.
  * The level of support required is described in the 'Required' column.
  *
@@ -62,13 +62,13 @@
  *
  * <p>The property can be set with the following code line:
  * <code>setProperty("javax.xml.stream.isRepairingNamespaces",new Boolean(true|false));</code></p>
- *
- * <p>This property specifies that the writer default namespace prefix declarations.
+ * 
+ * <p>This property specifies that the writer default namespace prefix declarations. 
  * The default value is false. </p>
  *
  * <p>If a writer isRepairingNamespaces it will create a namespace declaration
  * on the current StartElement for
- * any attribute that does not
+ * any attribute that does not 
  * currently have a namespace declaration in scope.  If the StartElement
  * has a uri but no prefix specified a prefix will be assigned, if the prefix
  * has not been declared in a parent of the current StartElement it will be declared
@@ -76,40 +76,41 @@
  * and the default namespace matches the URI of the attribute or StartElement
  * QName no prefix will be assigned.</p>
  *
- * <p>If an element or attribute name has a prefix, but is not
- * bound to any namespace URI, then the prefix will be removed
- * during serialization.</p>
+ * <p>If an element or attribute name has a prefix, but is not 
+ * bound to any namespace URI, then the prefix will be removed 
+ * during serialization.</p> 
  *
- * <p>If element and/or attribute names in the same start or
- * empty-element tag are bound to different namespace URIs and
- * are using the same prefix then the element or the first
- * occurring attribute retains the original prefix and the
- * following attributes have their prefixes replaced with a
- * new prefix that is bound to the namespace URIs of those
+ * <p>If element and/or attribute names in the same start or 
+ * empty-element tag are bound to different namespace URIs and 
+ * are using the same prefix then the element or the first 
+ * occurring attribute retains the original prefix and the 
+ * following attributes have their prefixes replaced with a 
+ * new prefix that is bound to the namespace URIs of those 
  * attributes. </p>
  *
- * <p>If an element or attribute name uses a prefix that is
- * bound to a different URI than that inherited from the
- * namespace context of the parent of that element and there
- * is no namespace declaration in the context of the current
+ * <p>If an element or attribute name uses a prefix that is 
+ * bound to a different URI than that inherited from the 
+ * namespace context of the parent of that element and there 
+ * is no namespace declaration in the context of the current 
  * element then such a namespace declaration is added. </p>
  *
- * <p>If an element or attribute name is bound to a prefix and
- * there is a namespace declaration that binds that prefix
- * to a different URI then that namespace declaration is
- * either removed if the correct mapping is inherited from
- * the parent context of that element, or changed to the
- * namespace URI of the element or attribute using that prefix.</p>
+ * <p>If an element or attribute name is bound to a prefix and 
+ * there is a namespace declaration that binds that prefix 
+ * to a different URI then that namespace declaration is 
+ * either removed if the correct mapping is inherited from 
+ * the parent context of that element, or changed to the 
+ * namespace URI of the element or attribute using that prefix.</p> 
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.2
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see XMLInputFactory
  * @see XMLEventWriter
  * @see XMLStreamWriter
  * @since 1.6
  */
 public abstract class XMLOutputFactory {
-  /**
-   * Property used to set prefix defaulting on the output side
+  /** 
+   * Property used to set prefix defaulting on the output side 
    */
   public static final String IS_REPAIRING_NAMESPACES=
     "javax.xml.stream.isRepairingNamespaces";
@@ -120,7 +121,39 @@
    * Create a new instance of the factory.
    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
    */
-  public static XMLOutputFactory newInstance()
+  public static XMLOutputFactory newInstance() 
+    throws FactoryConfigurationError
+  {
+    return (XMLOutputFactory) FactoryFinder.find("javax.xml.stream.XMLOutputFactory",
+                                                 "com.sun.xml.internal.stream.XMLOutputFactoryImpl");
+  }
+
+  /**
+   * Create a new instance of the factory. 
+   * This static method creates a new factory instance. This method uses the 
+   * following ordered lookup procedure to determine the XMLOutputFactory 
+   * implementation class to load: 
+   *   Use the javax.xml.stream.XMLOutputFactory system property. 
+   *   Use the properties file "lib/stax.properties" in the JRE directory. 
+   *     This configuration file is in standard java.util.Properties format 
+   *     and contains the fully qualified name of the implementation class 
+   *     with the key being the system property defined above. 
+   *   Use the Services API (as detailed in the JAR specification), if available, 
+   *     to determine the classname. The Services API will look for a classname 
+   *     in the file META-INF/services/javax.xml.stream.XMLOutputFactory in jars 
+   *     available to the runtime. 
+   *   Platform default XMLOutputFactory instance. 
+   *   
+   * Once an application has obtained a reference to a XMLOutputFactory it 
+   * can use the factory to configure and obtain stream instances.  
+   * 
+   * Note that this is a new method that replaces the deprecated newInstance() method.  
+   *   No changes in behavior are defined by this replacement method relative to the 
+   *   deprecated method.
+   * 
+   * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   */
+  public static XMLOutputFactory newFactory()
     throws FactoryConfigurationError
   {
     return (XMLOutputFactory) FactoryFinder.find("javax.xml.stream.XMLOutputFactory",
@@ -128,13 +161,18 @@
   }
 
   /**
-   * Create a new instance of the factory.
+   * Create a new instance of the factory. 
    *
    * @param factoryId             Name of the factory to find, same as
    *                              a property name
    * @param classLoader           classLoader to use
    * @return the factory implementation
    * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   *
+   * @deprecated  This method has been deprecated because it returns an
+   *              instance of XMLInputFactory, which is of the wrong class.
+   *              Use the new method {@link #newFactory(java.lang.String,
+   *              java.lang.ClassLoader)} instead.
    */
   public static XMLInputFactory newInstance(String factoryId,
           ClassLoader classLoader)
@@ -149,6 +187,35 @@
   }
 
   /**
+   * Create a new instance of the factory.  
+   * If the classLoader argument is null, then the ContextClassLoader is used.  
+   *  
+   * Note that this is a new method that replaces the deprecated 
+   *   newInstance(String factoryId, ClassLoader classLoader) method.  
+   *   
+   *   No changes in behavior are defined by this replacement method relative 
+   *   to the deprecated method.
+   *
+   * 
+   * @param factoryId             Name of the factory to find, same as
+   *                              a property name
+   * @param classLoader           classLoader to use
+   * @return the factory implementation
+   * @throws FactoryConfigurationError if an instance of this factory cannot be loaded
+   */
+  public static XMLOutputFactory newFactory(String factoryId,
+          ClassLoader classLoader)
+          throws FactoryConfigurationError {
+      try {
+          //do not fallback if given classloader can't find the class, throw exception
+          return (XMLOutputFactory) FactoryFinder.newInstance(factoryId, classLoader, false);
+      } catch (FactoryFinder.ConfigurationError e) {
+          throw new FactoryConfigurationError(e.getException(),
+                  e.getMessage());
+      }
+  }
+
+  /**
    * Create a new XMLStreamWriter that writes to a writer
    * @param stream the writer to write to
    * @throws XMLStreamException
@@ -174,9 +241,9 @@
   /**
    * Create a new XMLStreamWriter that writes to a JAXP result.  This method is optional.
    * @param result the result to write to
-   * @throws UnsupportedOperationException if this method is not
+   * @throws UnsupportedOperationException if this method is not 
    * supported by this XMLOutputFactory
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
   public abstract XMLStreamWriter createXMLStreamWriter(Result result) throws XMLStreamException;
 
@@ -184,9 +251,9 @@
   /**
    * Create a new XMLEventWriter that writes to a JAXP result.  This method is optional.
    * @param result the result to write to
-   * @throws UnsupportedOperationException if this method is not
+   * @throws UnsupportedOperationException if this method is not 
    * supported by this XMLOutputFactory
-   * @throws XMLStreamException
+   * @throws XMLStreamException 
    */
   public abstract XMLEventWriter createXMLEventWriter(Result result) throws XMLStreamException;
 
@@ -216,13 +283,13 @@
   public abstract XMLEventWriter createXMLEventWriter(java.io.Writer stream) throws XMLStreamException;
 
   /**
-   * Allows the user to set specific features/properties on the underlying implementation.
+   * Allows the user to set specific features/properties on the underlying implementation. 
    * @param name The name of the property
    * @param value The value of the property
    * @throws java.lang.IllegalArgumentException if the property is not supported
    */
-  public abstract void setProperty(java.lang.String name,
-                                    Object value)
+  public abstract void setProperty(java.lang.String name, 
+                                    Object value) 
     throws IllegalArgumentException;
 
   /**
@@ -242,3 +309,11 @@
    */
   public abstract boolean isPropertySupported(String name);
 }
+
+
+
+
+
+
+
+
--- a/sources/jaxp_src/src/javax/xml/stream/XMLReporter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLReporter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -31,23 +31,36 @@
 /**
  * This interface is used to report non-fatal errors.
  * Only warnings should be echoed through this interface.
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface XMLReporter {
 
-  /**
-   * Report the desired message in an application specific format.
-   * Only warnings and non-fatal errors should be reported through
-   * this interface.
-   * Fatal errors should be thrown as XMLStreamException.
-   *
-   * @param message the error message
-   * @param errorType an implementation defined error type
-   * @param relatedInformation information related to the error, if available
-   * @param location the location of the error, if available
-   * @throws XMLStreamException
-   */
-  public void report(String message, String errorType, Object relatedInformation, Location location)
-    throws XMLStreamException;
+    /**
+
+     * Report the desired message in an application specific format.
+
+     * Only warnings and non-fatal errors should be reported through
+
+     * this interface.
+
+     * Fatal errors should be thrown as XMLStreamException.
+
+     *
+
+     * @param message the error message
+
+     * @param errorType an implementation defined error type
+
+     * @param relatedInformation information related to the error, if available
+
+     * @param location the location of the error, if available
+
+     * @throws XMLStreamException
+
+     */
+    public void report(String message, String errorType, Object relatedInformation, Location location)
+            throws XMLStreamException;
 }
+
--- a/sources/jaxp_src/src/javax/xml/stream/XMLResolver.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLResolver.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,17 +23,18 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
 
 /**
- * This interface is used to resolve resources during an XML parse.  If an application wishes to
+ * This interface is used to resolve resources during an XML parse.  If an application wishes to 
  * perform custom entity resolution it must register an instance of this interface with
- * the XMLInputFactory using the setXMLResolver method.
+ * the XMLInputFactory using the setXMLResolver method.  
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface XMLResolver {
@@ -57,3 +58,4 @@
                               String namespace)
     throws XMLStreamException;
 }
+
--- a/sources/jaxp_src/src/javax/xml/stream/XMLStreamConstants.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLStreamConstants.java	Wed Sep 28 16:49:43 2011 +0100
@@ -125,3 +125,6 @@
    */
   public static final int ENTITY_DECLARATION=15;
 }
+
+
+
--- a/sources/jaxp_src/src/javax/xml/stream/XMLStreamException.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLStreamException.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -32,9 +32,11 @@
  * The base exception for unexpected processing errors.  This Exception
  * class is used to report well-formedness errors as well as unexpected
  * processing conditions.
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
+
 public class XMLStreamException extends Exception {
 
   protected Throwable nested;
--- a/sources/jaxp_src/src/javax/xml/stream/XMLStreamReader.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLStreamReader.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -154,7 +154,8 @@
  *   </tbody>
  *  </table>
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see javax.xml.stream.events.XMLEvent
  * @see XMLInputFactory
  * @see XMLStreamWriter
--- a/sources/jaxp_src/src/javax/xml/stream/XMLStreamWriter.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/XMLStreamWriter.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream;
@@ -185,7 +185,8 @@
  *     </tfoot>
  * </table>
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see XMLOutputFactory
  * @see XMLStreamReader
  * @since 1.6
--- a/sources/jaxp_src/src/javax/xml/stream/events/Attribute.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/Attribute.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -35,7 +35,8 @@
  * as a set of events accessible from a StartElement.  Other applications may report
  * Attributes as first-order events, for example as the results of an XPath expression.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see StartElement
  * @since 1.6
  */
--- a/sources/jaxp_src/src/javax/xml/stream/events/Characters.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/Characters.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -36,7 +36,8 @@
  * will be set to false unless an element declaration of element
  * content is present for the current element.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface Characters extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/Comment.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/Comment.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -31,7 +31,8 @@
 /**
  * An interface for comment events
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface Comment extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/DTD.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/DTD.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -33,7 +33,8 @@
 /**
  * This is the top level interface for events dealing with DTDs
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface DTD extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/EndDocument.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/EndDocument.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -31,7 +31,8 @@
 /**
  * A marker interface for the end of the document
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface EndDocument extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/EndElement.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/EndElement.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -34,7 +34,8 @@
  * An interface for the end element event.  An EndElement is reported
  * for each End Tag in the document.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see XMLEvent
  * @since 1.6
  */
--- a/sources/jaxp_src/src/javax/xml/stream/events/EntityDeclaration.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/EntityDeclaration.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -32,7 +32,8 @@
  *
  * This interface is used to record and report unparsed entity declarations.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface EntityDeclaration extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/EntityReference.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/EntityReference.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -43,7 +43,8 @@
  * (2) If javax.xml.stream.isReplacingEntityReferences is set to false
  * Entity references are reported as an EntityReference Event.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface EntityReference extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/Namespace.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/Namespace.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -34,7 +34,8 @@
  * An interface that contains information about a namespace.
  * Namespaces are accessed from a StartElement.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see StartElement
  * @since 1.6
  */
--- a/sources/jaxp_src/src/javax/xml/stream/events/NotationDeclaration.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/NotationDeclaration.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -36,7 +36,8 @@
  * There is no guarantee that the notation declaration
  * will be reported before any unparsed entities that use it.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface NotationDeclaration extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/ProcessingInstruction.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/ProcessingInstruction.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,14 +23,15 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
 /**
  * An interface that describes the data found in processing instructions
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface ProcessingInstruction extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/StartDocument.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/StartDocument.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,14 +23,15 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
 /**
  * An interface for the start document event
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface StartDocument extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/StartElement.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/StartElement.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -39,7 +39,8 @@
  * start elements.  A StartElement is reported for each Start Tag
  * in the document.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface StartElement extends XMLEvent {
--- a/sources/jaxp_src/src/javax/xml/stream/events/XMLEvent.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/events/XMLEvent.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.events;
@@ -36,7 +36,8 @@
  * XML 1.0 InfoSet to the Application.  Events may be cached
  * and referenced after the parse has completed.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see javax.xml.stream.XMLEventReader
  * @see Characters
  * @see ProcessingInstruction
--- a/sources/jaxp_src/src/javax/xml/stream/util/EventReaderDelegate.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/util/EventReaderDelegate.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.util;
@@ -44,7 +44,8 @@
  * does nothing but call the corresponding method on the
  * parent interface.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see javax.xml.stream.XMLEventReader
  * @see StreamReaderDelegate
  * @since 1.6
--- a/sources/jaxp_src/src/javax/xml/stream/util/StreamReaderDelegate.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/util/StreamReaderDelegate.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.util;
@@ -43,7 +43,8 @@
  * does nothing but call the corresponding method on the
  * parent interface.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see javax.xml.stream.XMLStreamReader
  * @see EventReaderDelegate
  * @since 1.6
--- a/sources/jaxp_src/src/javax/xml/stream/util/XMLEventAllocator.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/util/XMLEventAllocator.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.util;
@@ -39,7 +39,8 @@
  * is recommended.  The XMLEventAllocator can be set on an XMLInputFactory
  * using the property "javax.xml.stream.allocator"
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @see javax.xml.stream.XMLInputFactory
  * @see javax.xml.stream.XMLEventFactory
  * @since 1.6
--- a/sources/jaxp_src/src/javax/xml/stream/util/XMLEventConsumer.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/javax/xml/stream/util/XMLEventConsumer.java	Wed Sep 28 16:49:43 2011 +0100
@@ -23,7 +23,7 @@
  */
 
 /*
- * Copyright (c) 2003 by BEA Systems, Inc. All Rights Reserved.
+ * Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  */
 
 package javax.xml.stream.util;
@@ -38,7 +38,8 @@
  * times in immediate succession so a consumer must be able to cache
  * events it hasn't processed yet.
  *
- * @author Copyright (c) 2003 by BEA Systems. All Rights Reserved.
+ * @version 1.0
+ * @author Copyright (c) 2009 by Oracle Corporation. All Rights Reserved.
  * @since 1.6
  */
 public interface XMLEventConsumer {
--- a/sources/jaxp_src/src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/org/w3c/dom/bootstrap/DOMImplementationRegistry.java	Wed Sep 28 16:49:43 2011 +0100
@@ -87,31 +87,31 @@
      * DOMImplementationSource class names.
      */
     public static final String PROPERTY =
-        "org.w3c.dom.DOMImplementationSourceList";
-
+	"org.w3c.dom.DOMImplementationSourceList";
+    
     /**
      * Default columns per line.
      */
     private static final int DEFAULT_LINE_LENGTH = 80;
-
+    
     /**
      * The list of DOMImplementationSources.
      */
     private Vector sources;
-
+    
     /**
      * Default class name.
      */
-    private static final String FALLBACK_CLASS =
+    private static final String FALLBACK_CLASS = 
             "com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl";
     /**
      * Private constructor.
      * @param srcs Vector List of DOMImplementationSources
      */
     private DOMImplementationRegistry(final Vector srcs) {
-        sources = srcs;
+	sources = srcs;
     }
-
+    
     /**
      * Obtain a new instance of a <code>DOMImplementationRegistry</code>.
      *
@@ -120,8 +120,8 @@
      * application or the implementation, depending on the context, by
      * first checking the value of the Java system property
      * <code>org.w3c.dom.DOMImplementationSourceList</code> and
-     * the the service provider whose contents are at
-     * "<code>META_INF/services/org.w3c.dom.DOMImplementationSourceList</code>"
+     * the service provider whose contents are at
+     * "<code>META_INF/services/org.w3c.dom.DOMImplementationSourceList</code>". 
      * The value of this property is a white-space separated list of
      * names of availables classes implementing the
      * <code>DOMImplementationSource</code> interface. Each class listed
@@ -140,50 +140,50 @@
      * <code>DOMImplementationSource</code>
      */
     public static DOMImplementationRegistry newInstance()
-        throws
-        ClassNotFoundException,
-        InstantiationException,
-        IllegalAccessException,
-        ClassCastException {
-        Vector sources = new Vector();
-
-        ClassLoader classLoader = getClassLoader();
-        // fetch system property:
-        String p = getSystemProperty(PROPERTY);
-
-        //
-        // if property is not specified then use contents of
+	throws
+	ClassNotFoundException,
+	InstantiationException,
+	IllegalAccessException,
+	ClassCastException {
+	Vector sources = new Vector();
+	
+	ClassLoader classLoader = getClassLoader();
+	// fetch system property:
+	String p = getSystemProperty(PROPERTY);
+	
+	//
+	// if property is not specified then use contents of
         // META_INF/org.w3c.dom.DOMImplementationSourceList from classpath
-        if (p == null) {
-            p = getServiceValue(classLoader);
-        }
+	if (p == null) {
+	    p = getServiceValue(classLoader);
+	} 
         if (p == null) {
-            //
-            // DOM Implementations can modify here to add *additional* fallback
-            // mechanisms to access a list of default DOMImplementationSources.
+	    //
+	    // DOM Implementations can modify here to add *additional* fallback
+	    // mechanisms to access a list of default DOMImplementationSources.
             //fall back to JAXP implementation class com.sun.org.apache.xerces.internal.dom.DOMXSImplementationSourceImpl
             p = FALLBACK_CLASS;
         }
-        if (p != null) {
-            StringTokenizer st = new StringTokenizer(p);
-            while (st.hasMoreTokens()) {
-                String sourceName = st.nextToken();
-                // Use context class loader, falling back to Class.forName
-                // if and only if this fails...
-                Class sourceClass = null;
-                if (classLoader != null) {
-                    sourceClass = classLoader.loadClass(sourceName);
-                } else {
-                    sourceClass = Class.forName(sourceName);
-                }
-                DOMImplementationSource source =
-                    (DOMImplementationSource) sourceClass.newInstance();
-                sources.addElement(source);
-            }
-        }
-        return new DOMImplementationRegistry(sources);
+	if (p != null) {
+	    StringTokenizer st = new StringTokenizer(p);
+	    while (st.hasMoreTokens()) {
+		String sourceName = st.nextToken();
+		// Use context class loader, falling back to Class.forName
+		// if and only if this fails...
+		Class sourceClass = null;
+		if (classLoader != null) {
+		    sourceClass = classLoader.loadClass(sourceName);
+		} else {
+		    sourceClass = Class.forName(sourceName);
+		}
+		DOMImplementationSource source =
+		    (DOMImplementationSource) sourceClass.newInstance();
+		sources.addElement(source);
+	    }
+	}
+	return new DOMImplementationRegistry(sources);
     }
-
+    
     /**
      * Return the first implementation that has the desired
      * features, or <code>null</code> if none is found.
@@ -197,19 +197,19 @@
      *         or <code>null</code> if none found.
      */
     public DOMImplementation getDOMImplementation(final String features) {
-        int size = sources.size();
-        String name = null;
-        for (int i = 0; i < size; i++) {
-            DOMImplementationSource source =
-                (DOMImplementationSource) sources.elementAt(i);
-            DOMImplementation impl = source.getDOMImplementation(features);
-            if (impl != null) {
-                return impl;
-            }
-        }
-        return null;
+	int size = sources.size();
+	String name = null;
+	for (int i = 0; i < size; i++) {
+	    DOMImplementationSource source =
+		(DOMImplementationSource) sources.elementAt(i);
+	    DOMImplementation impl = source.getDOMImplementation(features);
+	    if (impl != null) {
+		return impl;
+	    }
+	}
+	return null;
     }
-
+    
     /**
      * Return a list of implementations that support the
      * desired features.
@@ -222,51 +222,51 @@
      * @return A list of DOMImplementations that support the desired features.
      */
     public DOMImplementationList getDOMImplementationList(final String features) {
-        final Vector implementations = new Vector();
-        int size = sources.size();
-        for (int i = 0; i < size; i++) {
-            DOMImplementationSource source =
-                (DOMImplementationSource) sources.elementAt(i);
-            DOMImplementationList impls =
-                source.getDOMImplementationList(features);
-            for (int j = 0; j < impls.getLength(); j++) {
-                DOMImplementation impl = impls.item(j);
-                implementations.addElement(impl);
-            }
-        }
-        return new DOMImplementationList() {
-                public DOMImplementation item(final int index) {
-                    if (index >= 0 && index < implementations.size()) {
-                        try {
-                            return (DOMImplementation)
-                                implementations.elementAt(index);
-                        } catch (ArrayIndexOutOfBoundsException e) {
-                            return null;
-                        }
-                    }
-                    return null;
-                }
-
-                public int getLength() {
-                    return implementations.size();
-                }
-            };
+	final Vector implementations = new Vector();
+	int size = sources.size();
+	for (int i = 0; i < size; i++) {
+	    DOMImplementationSource source =
+		(DOMImplementationSource) sources.elementAt(i);
+	    DOMImplementationList impls =
+		source.getDOMImplementationList(features);
+	    for (int j = 0; j < impls.getLength(); j++) {
+		DOMImplementation impl = impls.item(j);
+		implementations.addElement(impl);
+	    }
+	}
+	return new DOMImplementationList() {
+		public DOMImplementation item(final int index) {
+		    if (index >= 0 && index < implementations.size()) {
+			try {
+			    return (DOMImplementation)
+				implementations.elementAt(index);
+			} catch (ArrayIndexOutOfBoundsException e) {
+			    return null;
+			}
+		    }
+		    return null;
+		}
+		
+		public int getLength() {
+		    return implementations.size();
+		}
+	    };
     }
-
+    
     /**
      * Register an implementation.
      *
      * @param s The source to be registered, may not be <code>null</code>
      */
     public void addSource(final DOMImplementationSource s) {
-        if (s == null) {
-            throw new NullPointerException();
-        }
-        if (!sources.contains(s)) {
-            sources.addElement(s);
-        }
+	if (s == null) {
+	    throw new NullPointerException();
+	}
+	if (!sources.contains(s)) {
+	    sources.addElement(s);
+	}
     }
-
+    
     /**
      *
      * Gets a class loader.
@@ -274,20 +274,20 @@
      * @return A class loader, possibly <code>null</code>
      */
     private static ClassLoader getClassLoader() {
-        try {
-            ClassLoader contextClassLoader = getContextClassLoader();
-
-            if (contextClassLoader != null) {
-                return contextClassLoader;
-            }
-        } catch (Exception e) {
-            // Assume that the DOM application is in a JRE 1.1, use the
-            // current ClassLoader
-            return DOMImplementationRegistry.class.getClassLoader();
-        }
-        return DOMImplementationRegistry.class.getClassLoader();
+	try {
+	    ClassLoader contextClassLoader = getContextClassLoader();
+	    
+	    if (contextClassLoader != null) {
+		return contextClassLoader;
+	    }
+	} catch (Exception e) {
+	    // Assume that the DOM application is in a JRE 1.1, use the
+	    // current ClassLoader
+	    return DOMImplementationRegistry.class.getClassLoader();
+	}
+	return DOMImplementationRegistry.class.getClassLoader();
     }
-
+    
     /**
      * This method attempts to return the first line of the resource
      * META_INF/services/org.w3c.dom.DOMImplementationSourceList
@@ -297,52 +297,52 @@
      * @return first line of resource, or <code>null</code>
      */
     private static String getServiceValue(final ClassLoader classLoader) {
-        String serviceId = "META-INF/services/" + PROPERTY;
-        // try to find services in CLASSPATH
-        try {
-            InputStream is = getResourceAsStream(classLoader, serviceId);
-
-            if (is != null) {
-                BufferedReader rd;
-                try {
-                    rd =
-                        new BufferedReader(new InputStreamReader(is, "UTF-8"),
-                                           DEFAULT_LINE_LENGTH);
-                } catch (java.io.UnsupportedEncodingException e) {
-                    rd =
-                        new BufferedReader(new InputStreamReader(is),
-                                           DEFAULT_LINE_LENGTH);
-                }
-                String serviceValue = rd.readLine();
-                rd.close();
-                if (serviceValue != null && serviceValue.length() > 0) {
-                    return serviceValue;
-                }
-            }
-        } catch (Exception ex) {
-            return null;
-        }
-        return null;
+	String serviceId = "META-INF/services/" + PROPERTY;
+	// try to find services in CLASSPATH
+	try {
+	    InputStream is = getResourceAsStream(classLoader, serviceId);
+	    
+	    if (is != null) {
+		BufferedReader rd;
+		try {
+		    rd =
+			new BufferedReader(new InputStreamReader(is, "UTF-8"),
+					   DEFAULT_LINE_LENGTH);
+		} catch (java.io.UnsupportedEncodingException e) {
+		    rd =
+			new BufferedReader(new InputStreamReader(is),
+					   DEFAULT_LINE_LENGTH);
+		}		
+		String serviceValue = rd.readLine();
+		rd.close();
+		if (serviceValue != null && serviceValue.length() > 0) {
+		    return serviceValue;
+		}
+	    }
+	} catch (Exception ex) {
+	    return null;
+	}
+	return null;
     }
-
+    
     /**
      * A simple JRE (Java Runtime Environment) 1.1 test
      *
-     * @return <code>true</code> if JRE 1.1
+     * @return <code>true</code> if JRE 1.1 
      */
     private static boolean isJRE11() {
-        try {
-            Class c = Class.forName("java.security.AccessController");
-            // java.security.AccessController existed since 1.2 so, if no
-            // exception was thrown, the DOM application is running in a JRE
-            // 1.2 or higher
-            return false;
-        } catch (Exception ex) {
-            // ignore
-        }
-        return true;
+	try {
+	    Class c = Class.forName("java.security.AccessController");
+	    // java.security.AccessController existed since 1.2 so, if no
+	    // exception was thrown, the DOM application is running in a JRE
+	    // 1.2 or higher
+	    return false;
+	} catch (Exception ex) {
+	    // ignore 
+	}
+	return true;
     }
-
+    
     /**
      * This method returns the ContextClassLoader or <code>null</code> if
      * running in a JRE 1.1
@@ -350,73 +350,73 @@
      * @return The Context Classloader
      */
     private static ClassLoader getContextClassLoader() {
-        return isJRE11()
-            ? null
-            : (ClassLoader)
-              AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        ClassLoader classLoader = null;
-                        try {
-                            classLoader =
-                                Thread.currentThread().getContextClassLoader();
-                        } catch (SecurityException ex) {
-                        }
-                        return classLoader;
-                    }
-                });
+	return isJRE11()
+	    ? null
+	    : (ClassLoader)
+ 	      AccessController.doPrivileged(new PrivilegedAction() {
+		    public Object run() {
+			ClassLoader classLoader = null;
+			try {
+			    classLoader =
+				Thread.currentThread().getContextClassLoader();
+			} catch (SecurityException ex) {
+			}
+			return classLoader;
+		    }
+		});
     }
-
+    
     /**
      * This method returns the system property indicated by the specified name
      * after checking access control privileges. For a JRE 1.1, this check is
      * not done.
-     *
-     * @param name the name of the system property
+     * 	 
+     * @param name the name of the system property	 
      * @return the system property
      */
     private static String getSystemProperty(final String name) {
-        return isJRE11()
-            ? (String) System.getProperty(name)
-            : (String) AccessController.doPrivileged(new PrivilegedAction() {
-                    public Object run() {
-                        return System.getProperty(name);
-                    }
-                });
+	return isJRE11()
+	    ? (String) System.getProperty(name)
+	    : (String) AccessController.doPrivileged(new PrivilegedAction() {
+		    public Object run() {
+			return System.getProperty(name);
+		    }
+		});
     }
-
+    
     /**
      * This method returns an Inputstream for the reading resource
      * META_INF/services/org.w3c.dom.DOMImplementationSourceList after checking
      * access control privileges. For a JRE 1.1, this check is not done.
      *
-     * @param classLoader classLoader
-     * @param name the resource
+     * @param classLoader classLoader	 
+     * @param name the resource 	 
      * @return an Inputstream for the resource specified
      */
     private static InputStream getResourceAsStream(final ClassLoader classLoader,
-                                                   final String name) {
-        if (isJRE11()) {
-            InputStream ris;
-            if (classLoader == null) {
-                ris = ClassLoader.getSystemResourceAsStream(name);
-            } else {
-                ris = classLoader.getResourceAsStream(name);
-            }
-            return ris;
-        } else {
-            return (InputStream)
-                AccessController.doPrivileged(new PrivilegedAction() {
-                        public Object run() {
-                            InputStream ris;
-                            if (classLoader == null) {
-                                ris =
-                                    ClassLoader.getSystemResourceAsStream(name);
-                            } else {
-                                ris = classLoader.getResourceAsStream(name);
-                            }
-                            return ris;
-                        }
-                    });
-        }
+						   final String name) {
+	if (isJRE11()) {
+	    InputStream ris;
+	    if (classLoader == null) {
+		ris = ClassLoader.getSystemResourceAsStream(name);
+	    } else {
+		ris = classLoader.getResourceAsStream(name);
+	    }    
+	    return ris;
+	} else {
+	    return (InputStream)
+		AccessController.doPrivileged(new PrivilegedAction() {
+			public Object run() {
+			    InputStream ris;
+			    if (classLoader == null) {
+				ris =
+				    ClassLoader.getSystemResourceAsStream(name);
+			    } else {
+				ris = classLoader.getResourceAsStream(name);
+			    }
+			    return ris;
+			}
+		    });
+	}
     }
 }
--- a/sources/jaxp_src/src/org/xml/sax/SAXException.java	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/org/xml/sax/SAXException.java	Wed Sep 28 16:49:43 2011 +0100
@@ -56,6 +56,7 @@
  *
  * @since SAX 1.0
  * @author David Megginson
+ * @version 2.0.1 (sax2r2)
  * @see org.xml.sax.SAXParseException
  */
 public class SAXException extends Exception {
@@ -66,22 +67,22 @@
      */
     public SAXException ()
     {
-        super();
-        this.exception = null;
+	super();
+	this.exception = null;
     }
-
-
+    
+    
     /**
      * Create a new SAXException.
      *
      * @param message The error or warning message.
      */
     public SAXException (String message) {
-        super(message);
-        this.exception = null;
+	super(message);
+	this.exception = null;
     }
-
-
+    
+    
     /**
      * Create a new SAXException wrapping an existing exception.
      *
@@ -93,11 +94,11 @@
      */
     public SAXException (Exception e)
     {
-        super();
-        this.exception = e;
+	super();
+	this.exception = e;
     }
-
-
+    
+    
     /**
      * Create a new SAXException from an existing exception.
      *
@@ -109,11 +110,11 @@
      */
     public SAXException (String message, Exception e)
     {
-        super(message);
-        this.exception = e;
+	super(message);
+	this.exception = e;
     }
-
-
+    
+    
     /**
      * Return a detail message for this exception.
      *
@@ -125,16 +126,16 @@
      */
     public String getMessage ()
     {
-        String message = super.getMessage();
-
-        if (message == null && exception != null) {
-            return exception.getMessage();
-        } else {
-            return message;
-        }
+	String message = super.getMessage();
+	
+	if (message == null && exception != null) {
+	    return exception.getMessage();
+	} else {
+	    return message;
+	}
     }
-
-
+    
+    
     /**
      * Return the embedded exception, if any.
      *
@@ -142,10 +143,18 @@
      */
     public Exception getException ()
     {
+	return exception;
+    }
+
+    /**
+     * Return the cause of the exception
+     *
+     * @return Return the cause of the exception
+     */
+    public Throwable getCause() {
         return exception;
     }
 
-
     /**
      * Override toString to pick up any embedded exception.
      *
@@ -153,15 +162,15 @@
      */
     public String toString ()
     {
-        if (exception != null) {
-            return exception.toString();
-        } else {
-            return super.toString();
-        }
+	if (exception != null) {
+	    return exception.toString();
+	} else {
+	    return super.toString();
+	}
     }
-
-
-
+    
+    
+    
     //////////////////////////////////////////////////////////////////////
     // Internal state.
     //////////////////////////////////////////////////////////////////////
@@ -169,10 +178,10 @@
 
     /**
      * @serial The embedded exception if tunnelling, or null.
-     */
+     */    
     private Exception exception;
-
-    // Added serialVersionUID to preserve binary compatibility
+    
+    // Added serialVersionUID to preserve binary compatibility 
     static final long serialVersionUID = 583241635256073760L;
 }
 
--- a/sources/jaxp_src/src/org/xml/sax/ext/package.html	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/org/xml/sax/ext/package.html	Wed Sep 28 16:49:43 2011 +0100
@@ -1,12 +1,12 @@
 <HTML><HEAD>
-<!-- $Id: package.html,v 1.2 2004/11/03 22:49:09 jsuttor Exp $ -->
+<!-- $Id: package.html,v 1.3 2007/10/02 19:32:24 ndw Exp $ -->
 </HEAD><BODY>
 
 <p>
 This package contains interfaces to SAX2 facilities that
 conformant SAX drivers won't necessarily support.
 
-<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+<p>See <a target='_top' href='http://www.saxproject.org'>http://www.saxproject.org</a>
 for more information about SAX.</p>
 
 <p> This package is independent of the SAX2 core, though the functionality
--- a/sources/jaxp_src/src/org/xml/sax/helpers/package.html	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/org/xml/sax/helpers/package.html	Wed Sep 28 16:49:43 2011 +0100
@@ -1,11 +1,11 @@
 <HTML><HEAD>
-<!-- $Id: package.html,v 1.2 2004/11/03 22:53:09 jsuttor Exp $ -->
+<!-- $Id: package.html,v 1.3 2007/10/02 19:32:24 ndw Exp $ -->
 </HEAD><BODY>
 
 <p>This package contains "helper" classes, including
 support for bootstrapping SAX-based applications.
 
-<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+<p>See <a target='_top' href='http://www.saxproject.org'>http://www.saxproject.org</a>
 for more information about SAX.</p>
 
 </BODY></HTML>
--- a/sources/jaxp_src/src/org/xml/sax/package.html	Wed Sep 28 15:53:32 2011 +0100
+++ b/sources/jaxp_src/src/org/xml/sax/package.html	Wed Sep 28 16:49:43 2011 +0100
@@ -1,5 +1,5 @@
 <html><head>
-<!-- $Id: package.html,v 1.3 2005/05/18 22:30:54 jsuttor Exp $ -->
+<!-- $Id: package.html,v 1.3 2007/10/02 19:32:24 ndw Exp $ -->
 </head><body>
 
 <p> This package provides the core SAX APIs.
@@ -7,7 +7,7 @@
 namespace-awareness into designs of new applications
 and into maintenance of existing infrastructure. </p>
 
-<p>See <a href='http://www.saxproject.org'>http://www.saxproject.org</a>
+<p>See <a target='_top' href='http://www.saxproject.org'>http://www.saxproject.org</a>
 for more information about SAX.</p>