You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by sb...@locus.apache.org on 2000/10/30 20:01:07 UTC

cvs commit: xml-xalan/java/src/org/apache/xpath/res XPATHErrorResourceBundle.java XPATHErrorResources.java XPATHErrorResources_en.java

sboag       00/10/30 11:01:00

  Modified:    java     Makefile make.include
               java/samples/AppletXMLtoHTML lts3611beac.jpg rabbitwhorn.jpg
               java/src makexpath4j makexslt4j
               java/src/javax/xml/parsers SAXParserFactory.java
               java/src/org/apache/serialize DOMSerializer.java Method.java
                        OutputFormat.java Serializer.java
                        SerializerFactory.java SerializerHandler.java
                        serializer.properties
               java/src/org/apache/serialize/helpers HTMLOutputFormat.java
                        TextOutputFormat.java XHTMLOutputFormat.java
                        XMLOutputFormat.java
               java/src/org/apache/trax Examples.java Processor.java
                        ProcessorException.java
                        ProcessorFactoryException.java Result.java
                        Templates.java TemplatesBuilder.java
                        TransformException.java Transformer.java
                        URIResolver.java
               java/src/org/apache/xalan/client XSLTProcessorApplet.java
               java/src/org/apache/xalan/extensions ExpressionContext.java
                        ExtensionHandler.java ExtensionHandlerGeneral.java
                        ExtensionHandlerJava.java ExtensionsTable.java
                        XSLProcessorContext.java
               java/src/org/apache/xalan/lib/sql Column.java
                        ColumnAttribute.java ColumnData.java
                        ColumnHeader.java Row.java RowSet.java
                        StreamableNode.java XConnection.java
                        XStatement.java
               java/src/org/apache/xalan/res XSLMessages.java
                        XSLResourceBundle.java XSLTErrorResources.java
                        XSLTErrorResources_en.java XSLTResourceBundle.java
                        XSLTResources_cy.java XSLTResources_el.java
                        XSLTResources_en.java XSLTResources_he.java
                        XSLTResources_hy.java XSLTResources_ja_JP_A.java
                        XSLTResources_ja_JP_HA.java
                        XSLTResources_ja_JP_HI.java
                        XSLTResources_ja_JP_I.java XSLTResources_ka.java
                        XSLTResources_zh_CN.java XSLTResources_zh_TW.java
               java/src/org/apache/xalan/trace GenerateEvent.java
                        PrintTraceListener.java SelectionEvent.java
                        TraceListener.java TraceManager.java
                        TracerEvent.java
               java/src/org/apache/xalan/transformer
                        ClonerToResultTree.java Counter.java
                        CountersTable.java DecimalToRoman.java
                        KeyIterator.java KeyManager.java KeyTable.java
                        KeyWalker.java MsgMgr.java NodeSortKey.java
                        NodeSorter.java NumeratorFormatter.java
                        QueuedEvents.java QueuedSAXEvent.java
                        QueuedStartDocument.java QueuedStartElement.java
                        ResultNameSpace.java ResultTreeFrag.java
                        ResultTreeHandler.java SerializerSwitcher.java
                        StackGuard.java TransformState.java
                        TransformerClient.java TransformerImpl.java
                        TreeWalker2Result.java
                        XSLInfiniteLoopException.java
               java/src/org/apache/xalan/utils AttList.java BoolStack.java
                        DOMBuilder.java DefaultErrorHandler.java
                        ElemDesc.java FastStringBuffer.java Heap.java
                        HeapObject.java IntStack.java IntVector.java
                        MutableAttrListImpl.java NSInfo.java NameSpace.java
                        NodeConsumer.java NodeVector.java ObjectPool.java
                        PrefixResolver.java PrefixResolverDefault.java
                        QName.java RawCharacterHandler.java
                        StringBufferPool.java StringKey.java
                        StringToIntTable.java StringToStringTable.java
                        StringToStringTableVector.java StringVector.java
                        SystemIDResolver.java TreeWalker.java Trie.java
                        URI.java UnImplNode.java
                        WrappedRuntimeException.java
                        WrongParserException.java
                        XMLCharacterRecognizer.java
               java/src/org/apache/xalan/utils/synthetic Class.java
                        SynthesisException.java TestDriver.java
               java/src/org/apache/xalan/utils/synthetic/reflection
                        Constructor.java EntryPoint.java Field.java
                        Member.java Method.java
               java/src/org/apache/xalan/xslt Process.java
               java/src/org/apache/xpath Arg.java DOM2Helper.java
                        DOMHelper.java DOMOrder.java Expression.java
                        FoundIndex.java NodeSet.java SourceTree.java
                        SourceTreeManager.java VariableStack.java
                        XPath.java XPathAPI.java XPathContext.java
                        XPathException.java XPathFactory.java
                        XPathProcessorException.java
               java/src/org/apache/xpath/axes AncestorOrSelfWalker.java
                        AncestorWalker.java AttributeWalker.java
                        AttributeWalkerOneStep.java AxesWalker.java
                        ChildWalker.java ChildWalkerMultiStep.java
                        ChildWalkerOneStep.java ContextNodeList.java
                        DescendantOrSelfWalker.java DescendantWalker.java
                        FilterExprWalker.java FollowingSiblingWalker.java
                        FollowingWalker.java LocPathIterator.java
                        NamespaceWalker.java ParentWalker.java
                        PrecedingSiblingWalker.java PrecedingWalker.java
                        ReverseAxesWalker.java RootWalker.java
                        SelfWalker.java SelfWalkerOneStep.java
                        SubContextList.java UnionPathIterator.java
                        WalkerFactory.java
               java/src/org/apache/xpath/compiler Compiler.java
                        FuncLoader.java FunctionTable.java Keywords.java
                        Lexer.java OpCodes.java OpMap.java PsuedoNames.java
                        XPathDumper.java XPathParser.java
               java/src/org/apache/xpath/functions FuncBoolean.java
                        FuncCeiling.java FuncConcat.java FuncContains.java
                        FuncCount.java FuncCurrent.java
                        FuncDoclocation.java FuncExtElementAvailable.java
                        FuncExtFunction.java FuncExtFunctionAvailable.java
                        FuncFalse.java FuncFloor.java FuncFormatNumber.java
                        FuncGenerateId.java FuncId.java FuncLang.java
                        FuncLast.java FuncLocalPart.java FuncNamespace.java
                        FuncNormalizeSpace.java FuncNot.java
                        FuncNumber.java FuncPosition.java FuncQname.java
                        FuncRound.java FuncStartsWith.java FuncString.java
                        FuncStringLength.java FuncSubstring.java
                        FuncSubstringAfter.java FuncSubstringBefore.java
                        FuncSum.java FuncSystemProperty.java
                        FuncTranslate.java FuncTrue.java
                        FuncUnparsedEntityURI.java Function.java
                        Function2Args.java Function3Args.java
                        FunctionDef1Arg.java FunctionMultiArgs.java
                        FunctionOneArg.java WrongNumberArgsException.java
               java/src/org/apache/xpath/objects XBoolean.java
                        XBooleanStatic.java XNodeSet.java XNull.java
                        XNumber.java XObject.java XRTreeFrag.java
                        XString.java
               java/src/org/apache/xpath/operations And.java Bool.java
                        Div.java Equals.java Gt.java Gte.java Lt.java
                        Lte.java Minus.java Mod.java Mult.java Neg.java
                        NotEquals.java Number.java Operation.java Or.java
                        Plus.java Quo.java String.java UnaryOperation.java
                        Variable.java
               java/src/org/apache/xpath/patterns AncestorStepPattern.java
                        FunctionPattern.java NodeTest.java
                        NodeTestFilter.java StepPattern.java
                        UnionPattern.java
               java/src/org/apache/xpath/res XPATHErrorResourceBundle.java
                        XPATHErrorResources.java
                        XPATHErrorResources_en.java
  Added:       java/src xalanj2.jin
               java/src/org/apache/xalan/serialize ElemDesc.java
                        EncodingInfo.java Encodings.java
                        FormatterToHTML.java FormatterToText.java
                        FormatterToXML.java
  Removed:     java/src/org/apache/xml/serialize/transition
                        BaseMarkupSerializer.java ElementState.java
                        Encodings.java FastStringBuffer.java
                        HTMLEntities.res HTMLSerializer.java HTMLdtd.java
                        IndentPrinter.java LineSeparator.java Method.java
                        Printer.java SerializerFactoryImpl.java
                        TextSerializer.java XHTMLSerializer.java
                        XMLSerializer.java package.html
  Log:
  Major checkin that includes JIndent formatting.   See my note titled
  "Optimizations, changes" on the xalan-dev list 10/30/2000 03:55 PM.
  
  Revision  Changes    Path
  1.6       +0 -1      xml-xalan/java/Makefile
  
  Index: Makefile
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/Makefile,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- Makefile	2000/10/13 02:33:02	1.5
  +++ Makefile	2000/10/30 18:56:01	1.6
  @@ -53,7 +53,6 @@
   $(JARNAME)::
   	$(CP) src/$(PROPPATH)/*.properties src/$(CLASS_DIR)/$(PROPPATH)/.; \
   	$(CP) src/org/apache/serialize/*.properties src/$(CLASS_DIR)/org/apache/serialize/.; \
  -	$(CP) src/org/apache/xml/serialize/transition/*.res src/$(CLASS_DIR)/org/apache/xml/serialize/transition/.; \
   	$(CP) src/org/apache/trax/*.properties src/$(CLASS_DIR)/org/apache/trax/.; \
   	echo -n "Jarring ../bin/$@ .. "; \
   	cd src/$(CLASS_DIR); $(JAR) $(JARFLAGS) ../../bin/$@ org; \
  
  
  
  1.3       +1 -0      xml-xalan/java/make.include
  
  Index: make.include
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/make.include,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- make.include	2000/07/25 16:05:36	1.2
  +++ make.include	2000/10/30 18:56:01	1.3
  @@ -60,6 +60,7 @@
   # You can override these on the make command line as well
   #    Call us like 'make -f Makefile JAVADEBUG=-g:none ...'
   JAVADEBUG   = -g
  +# JAVADEBUG   = -g:none -O
   JAVADESTDIR = -d $(CLASS_DIR)
   JAVACFLAGS  = $(JAVADEBUG) $(JAVADESTDIR)
   JARFLAGS    = cf0
  
  
  
  1.2       +1 -28     xml-xalan/java/samples/AppletXMLtoHTML/lts3611beac.jpg
  
  	<<Binary file>>
  
  
  1.2       +1 -10     xml-xalan/java/samples/AppletXMLtoHTML/rabbitwhorn.jpg
  
  	<<Binary file>>
  
  
  1.6       +1 -0      xml-xalan/java/src/makexpath4j
  
  Index: makexpath4j
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/makexpath4j,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- makexpath4j	2000/10/17 19:51:27	1.5
  +++ makexpath4j	2000/10/30 18:56:04	1.6
  @@ -57,6 +57,7 @@
       org$(PATHSEP)apache$(PATHSEP)xpath$(PATHSEP)axes$(PATHSEP)FollowingSiblingWalker.java \
       org$(PATHSEP)apache$(PATHSEP)xpath$(PATHSEP)axes$(PATHSEP)FollowingWalker.java \
       org$(PATHSEP)apache$(PATHSEP)xpath$(PATHSEP)axes$(PATHSEP)LocPathIterator.java \
  +    org$(PATHSEP)apache$(PATHSEP)xpath$(PATHSEP)axes$(PATHSEP)ChildIterator.java \
       org$(PATHSEP)apache$(PATHSEP)xpath$(PATHSEP)axes$(PATHSEP)NamespaceWalker.java \
       org$(PATHSEP)apache$(PATHSEP)xpath$(PATHSEP)axes$(PATHSEP)ParentWalker.java \
       org$(PATHSEP)apache$(PATHSEP)xpath$(PATHSEP)axes$(PATHSEP)PrecedingSiblingWalker.java \
  
  
  
  1.25      +7 -23     xml-xalan/java/src/makexslt4j
  
  Index: makexslt4j
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/makexslt4j,v
  retrieving revision 1.24
  retrieving revision 1.25
  diff -u -r1.24 -r1.25
  --- makexslt4j	2000/10/18 04:36:42	1.24
  +++ makexslt4j	2000/10/30 18:56:05	1.25
  @@ -96,6 +96,12 @@
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)res$(PATHSEP)XSLTResources_ka.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)res$(PATHSEP)XSLTResources_zh_CN.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)res$(PATHSEP)XSLTResources_zh_TW.java \
  +  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)serialize$(PATHSEP)ElemDesc.java \
  +  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)serialize$(PATHSEP)Encodings.java \
  +  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)serialize$(PATHSEP)EncodingInfo.java \
  +  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)serialize$(PATHSEP)FormatterToHTML.java \
  +  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)serialize$(PATHSEP)FormatterToText.java \
  +  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)serialize$(PATHSEP)FormatterToXML.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)NameSpaceDecl.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)AttrImpl.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)AttrImplNS.java \
  @@ -108,14 +114,6 @@
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)DOMImplementationImpl.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)ElementImpl.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)ElementImplWithNS.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)IndexedDocImpl.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)IndexedElem.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)IndexedElemImpl.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)IndexedElemWithNS.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)IndexedLocPathIterator.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)IndexedUnionPathIterator.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)LevelIndexer.java \
  -  org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)LevelIndexIterator.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)NotationImpl.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)Parent.java \
     org$(PATHSEP)apache$(PATHSEP)xalan$(PATHSEP)stree$(PATHSEP)ProcessingInstructionImpl.java \
  @@ -325,21 +323,7 @@
     org$(PATHSEP)xml$(PATHSEP)sax$(PATHSEP)helpers$(PATHSEP)ParserFactory.java \
     org$(PATHSEP)xml$(PATHSEP)sax$(PATHSEP)helpers$(PATHSEP)XMLFilterImpl.java \
     org$(PATHSEP)xml$(PATHSEP)sax$(PATHSEP)helpers$(PATHSEP)XMLReaderAdapter.java \
  -  org$(PATHSEP)xml$(PATHSEP)sax$(PATHSEP)helpers$(PATHSEP)XMLReaderFactory.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)FastStringBuffer.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)BaseMarkupSerializer.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)ElementState.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)Encodings.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)HTMLdtd.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)HTMLSerializer.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)IndentPrinter.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)LineSeparator.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)Method.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)Printer.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)SerializerFactoryImpl.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)TextSerializer.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)XHTMLSerializer.java \
  -  org$(PATHSEP)apache$(PATHSEP)xml$(PATHSEP)serialize$(PATHSEP)transition$(PATHSEP)XMLSerializer.java
  +  org$(PATHSEP)xml$(PATHSEP)sax$(PATHSEP)helpers$(PATHSEP)XMLReaderFactory.java
       
   OBJS = $($(subst /,\\,$(SRCS)):%.java=classes/%.class)
   
  
  
  
  1.1                  xml-xalan/java/src/xalanj2.jin
  
  Index: xalanj2.jin
  ===================================================================
  ###
  ### Jindent 3.23 property file -- http://www.jindent.de
  ###
  
  
  
  
  ### General -- Convention
  
  conventionName                            = "xalanj2"
  conventionString                          = "'Formatted in $conventionName$ Style on' EEE, MMM d, ''yy"
  conventionNotePosition                    = "none"
  blankLinesToSeparateConventionNote        = 2
  
  
  ### General -- Jindent Note
  
  jindentNotePosition                       = "none"
  blankLinesToSeparateJindentNote           = 2
  
  
  
  ### Header/Footer -- Header Template
  
  headerSmartMode                           = infinite
  
  headerIdentifyKey                         = "The Apache Software License, Version 1.1"
  
  blankLinesBeforeHeader                    = 0
  header[00]                                = "/*"
  header[01]                                = " * The Apache Software License, Version 1.1"
  header[02]                                = " *"
  header[03]                                = " *"
  header[04]                                = " * Copyright (c) 1999 The Apache Software Foundation.  All rights "
  header[05]                                = " * reserved."
  header[06]                                = " *"
  header[07]                                = " * Redistribution and use in source and binary forms, with or without"
  header[08]                                = " * modification, are permitted provided that the following conditions"
  header[09]                                = " * are met:"
  header[10]                                = " *"
  header[11]                                = " * 1. Redistributions of source code must retain the above copyright"
  header[12]                                = " *    notice, this list of conditions and the following disclaimer. "
  header[13]                                = " *"
  header[14]                                = " * 2. Redistributions in binary form must reproduce the above copyright"
  header[15]                                = " *    notice, this list of conditions and the following disclaimer in"
  header[16]                                = " *    the documentation and/or other materials provided with the"
  header[17]                                = " *    distribution."
  header[18]                                = " *"
  header[19]                                = " * 3. The end-user documentation included with the redistribution,"
  header[20]                                = " *    if any, must include the following acknowledgment:  "
  header[21]                                = " *       "This product includes software developed by the"
  header[22]                                = " *        Apache Software Foundation (http://www.apache.org/).""
  header[23]                                = " *    Alternately, this acknowledgment may appear in the software itself,"
  header[24]                                = " *    if and wherever such third-party acknowledgments normally appear."
  header[25]                                = " *"
  header[26]                                = " * 4. The names "Xalan" and "Apache Software Foundation" must"
  header[27]                                = " *    not be used to endorse or promote products derived from this"
  header[28]                                = " *    software without prior written permission. For written "
  header[29]                                = " *    permission, please contact apache@apache.org."
  header[30]                                = " *"
  header[31]                                = " * 5. Products derived from this software may not be called "Apache","
  header[32]                                = " *    nor may "Apache" appear in their name, without prior written"
  header[33]                                = " *    permission of the Apache Software Foundation."
  header[34]                                = " *"
  header[35]                                = " * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED"
  header[36]                                = " * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES"
  header[37]                                = " * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE"
  header[38]                                = " * DISCLAIMED.  IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR"
  header[39]                                = " * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,"
  header[40]                                = " * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT"
  header[41]                                = " * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF"
  header[42]                                = " * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND"
  header[43]                                = " * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,"
  header[44]                                = " * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT"
  header[45]                                = " * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF"
  header[46]                                = " * SUCH DAMAGE."
  header[47]                                = " * ===================================================================="
  header[48]                                = " *"
  header[49]                                = " * This software consists of voluntary contributions made by many"
  header[50]                                = " * individuals on behalf of the Apache Software Foundation and was"
  header[51]                                = " * originally based on software copyright (c) 1999, Lotus"
  header[52]                                = " * Development Corporation., http://www.lotus.com.  For more"
  header[53]                                = " * information on the Apache Software Foundation, please see"
  header[54]                                = " * <http://www.apache.org/>."
  header[55]                                = " */"
  blankLinesAfterHeader                     = 0
  
  
  ### Header/Footer -- Footer Template
  
  footerSmartMode                           = infinite
  
  footerIdentifyKey                         = ""
  
  blankLinesBeforeFooter                    = 0
  footer[00]                                = ""
  blankLinesAfterFooter                     = 0
  
  
  
  ### Indentation -- Misc
  
  tabulatorSize                             = 2
  indentSize                                = 2
  firstLevelIndent                          = 0
  indentCaseFromSwitch                      = false
  labelNewLine                              = true
  indentLabels                              = true
  
  minimumCommentIndent                      = 2
  
  indentLeadingsByTabs                      = false
  indentCommentsByTabs                      = false
  indentDeclarationsByTabs                  = false
  indentAssignmentsByTabs                   = false
  
  
  ### Indentation -- Alignment
  
  alignComments                             = false
  alignDeclarations                         = false
  alignAssignments                          = false
  alignTernaryConditions                    = false
  alignTernaryExpressions                   = false
  alignTooLongComments                      = false
  
  
  
  ### Braces -- Style
  
  leftBraceNewLineGeneral                   = true
  rightBraceNewLineGeneral                  = true
  indentLeftBraceGeneral                    = 0
  indentRightBraceGeneral                   = 0
  indentAfterRightBraceGeneral              = 0
  
  cuddleEmptyBracesGeneral                  = true
  indentCuddledBracesGeneral                = 0
  
  
  leftBraceNewLineClassInterface            = true
  rightBraceNewLineClassInterface           = true
  indentLeftBraceClassInterface             = 0
  indentRightBraceClassInterface            = 0
  indentAfterRightBraceClassInterface       = 0
  
  cuddleEmptyBracesClassInterface           = false
  indentCuddledBracesClassInterface         = 1
  
  
  leftBraceNewLineMethod                    = true
  rightBraceNewLineMethod                   = true
  indentLeftBraceMethod                     = 0
  indentRightBraceMethod                    = 0
  indentAfterRightBraceMethod               = 0
  
  cuddleEmptyBracesMethod                   = true
  indentCuddledBracesMethod                 = 0
  
  
  leftBraceNewLineTryCatch                  = true
  rightBraceNewLineTryCatch                 = true
  indentLeftBraceTryCatch                   = 0
  indentRightBraceTryCatch                  = 0
  indentAfterRightBraceTryCatch             = 0
  
  cuddleEmptyBracesTryCatch                 = true
  indentCuddledBracesTryCatch               = 0
  
  
  ### Braces -- Insert At
  
  insertBracesAtIfElse                      = false
  insertBracesAtFor                         = true
  insertBracesAtWhile                       = true
  insertBracesAtDoWhile                     = true
  
  insertParenthesisAtConditions             = false
  
  
  ### Braces -- If-Else
  
  singleIfStatementInOneLine                = false
  singleElseStatementInOneLine              = false
  specialElseIfTreatment                    = true
  
  
  
  ### JavaDoc -- Misc
  
  deleteJavaDocComments                     = false
  formatJavaDocComments                     = true
  
  insertMissingJavaDocTags                  = true
  deleteObsoleteJavaDocTags                 = false
  
  createPublicClassInterfaceJavaDocs        = true
  createFriendlyClassInterfaceJavaDocs      = true
  createPrivateClassInterfaceJavaDocs       = true
  createProtectedClassInterfaceJavaDocs     = true
  
  createPublicMethodJavaDocs                = true
  createFriendlyMethodJavaDocs              = true
  createPrivateMethodJavaDocs               = true
  createProtectedMethodJavaDocs             = true
  
  createPublicFieldJavaDocs                 = true
  createFriendlyFieldJavaDocs               = true
  createPrivateFieldJavaDocs                = true
  createProtectedFieldJavaDocs              = true
  
  
  ### JavaDoc -- Templates
  
  sortExceptionsInTemplates                 = true
  
  javaDocMethodTop[00]                      = "/**"
  javaDocMethodTop[01]                      = " * NEEDSDOC Method $objectName$ "
  javaDocMethodTop[02]                      = " *"
  javaDocMethodParamSeparator[00]           = " *"
  javaDocMethodParam[00]                    = " * NEEDSDOC @param $paramName$"
  javaDocMethodReturn[00]                   = " *"
  javaDocMethodReturn[01]                   = " * NEEDSDOC ($objectName$) @return"
  javaDocMethodExceptionSeparator[00]       = " *"
  javaDocMethodException[00]                = " * @throws $exceptionName$"
  javaDocMethodBottom[00]                   = " */"
  
  javaDocConstructorTop[00]                 = "/**"
  javaDocConstructorTop[01]                 = " * Constructor $objectName$"
  javaDocConstructorTop[02]                 = " *"
  javaDocConstructorParamSeparator[00]      = " *"
  javaDocConstructorParam[00]               = " * NEEDSDOC @param $paramName$"
  javaDocConstructorExceptionSeparator[00]  = " *"
  javaDocConstructorException[00]           = " * @throws $exceptionName$"
  javaDocConstructorBottom[00]              = " */"
  
  javaDocClass[00]                          = "/**"
  javaDocClass[01]                          = " * <meta name="usage" content="internal"/>"
  javaDocClass[02]                          = " * NEEDSDOC Class $objectName$ <needs-comment/>"
  javaDocClass[03]                          = " */"
  
  javaDocInterface[00]                      = "/**"
  javaDocInterface[01]                      = " * <meta name="usage" content="internal"/>"
  javaDocInterface[02]                      = " * NEEDSDOC Interface $objectName$"
  javaDocInterface[03]                      = " */"
  
  javaDocField[00]                          = "/** NEEDSDOC Field $objectName$          */"
  
  
  
  ### Comments -- Format/Delete
  
  deleteBlockComments                       = false
  deleteSingleLineComments                  = false
  deleteTrailingComments                    = false
  deleteEndOfLineComments                   = false
  
  formatBlockComments                       = false
  formatSingleLineComments                  = false
  formatTrailingComments                    = false
  formatEndOfLineComments                   = false
  
  
  ### Comments -- Exceptions
  
  neverIndentFirstColumnComments            = false
  neverFormatFirstColumnComments            = false
  
  neverFormatHeader                         = false
  neverFormatFooter                         = false
  
  
  
  ### Separation -- Misc
  
  keepBlankLines                            = 0
  
  minLinesToInsertBlankLineInClasses        = 3
  minLinesToInsertBlankLineInMethods        = 3
  
  
  ### Separation -- Separate
  
  separateChunksByComments                  = true
  allowBreakSeparatedFromCaseBlock          = false
  blankLinesBetweenCaseBlocks               = 0
  blankLinesBetweenChunks                   = 1
  
  comparableImportDepth                     = 2
  blankLinesToSeparateImports               = 1
  
  blankLinesBetweenClassInterface           = 0
  
  
  ### Separation -- Insert Blank Lines
  
  blankLinesAfterDeclarations               = 1
  blankLinesAfterMethods                    = 1
  blankLinesAfterClasses                    = 0
  blankLinesAfterInterfaces                 = 0
  
  blankLinesBeforeJavaDocComments           = 1
  blankLinesAfterJavaDocComments            = 0
  
  blankLinesBeforeBlockComments             = 1
  blankLinesAfterBlockComments              = 0
  
  blankLinesBeforeSingleLineComments        = 1
  blankLinesAfterSingleLineComments         = 0
  
  blankLinesBeforeEndOfLineComments         = 1
  blankLinesAfterEndOfLineComments          = 0
  
  blankLinesAfterSwitch                     = 0
  blankLinesAfterPackage                    = 1
  blankLinesAfterLastImport                 = 1
  
  
  
  ### Whitespaces -- Padding
  
  separateAssignmentOperators               = true
  separateConditionalOperators              = true
  separateComparisonOperators               = true
  separateNumericalOperators                = true
  
  paddingCastParenthesis                    = false
  paddingParenthesis                        = false
  paddingBrackets                           = false
  paddingBraces                             = true
  
  
  ### Whitespaces -- Space Before
  
  spaceBeforeMethodDeclarationParenthesis   = false
  spaceBeforeMethodCallParenthesis          = false
  spaceBeforeBrackets                       = false
  spaceBeforeBracketsInTypes                = false
  spaceBeforeStatementParenthesis           = true
  spaceBeforeConditionBang                  = false
  spaceBeforeCaseColon                      = true
  
  
  ### Whitespaces -- Space After
  
  spaceAfterComma                           = true
  spaceAfterSemicolon                       = true
  spaceAfterCasting                         = true
  
  
  ### Whitespaces -- No Spaces
  
  noSpacesInEmptyForExpressions             = true
  
  
  
  ### Line Wrapping -- Misc
  
  maxFieldElementsPerLine                   = infinite
  
  wrapLines                                 = true
  wrapBecauseOfComments                     = false
  wrapLongMethodNames                       = false
  maxLineLength                             = 78
  deepIndent                                = 45
  forceIndent                               = 8
  forceIndentTolerance                      = 4
  
  allowWrappingAfterAssignments             = true
  allowWrappingAfterParenthesis             = true
  preferWrappingAfterThrows                 = true
  
  
  alwaysWrapThrows                          = false
  alwaysWrapExtends                         = false
  alwaysWrapImplements                      = false
  
  indentWrappedThrows                       = 0
  indentWrappedExtends                      = 0
  indentWrappedImplements                   = 0
  
  
  
  1.2       +3 -2      xml-xalan/java/src/javax/xml/parsers/SAXParserFactory.java
  
  Index: SAXParserFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/javax/xml/parsers/SAXParserFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SAXParserFactory.java	2000/10/02 02:43:03	1.1
  +++ SAXParserFactory.java	2000/10/30 18:56:07	1.2
  @@ -90,7 +90,7 @@
    *
    * @author <a href="pier@betaversion.org">Pierpaolo Fumagalli</a>
    * @author Copyright &copy; 2000 The Apache Software Foundation.
  - * @version 1.0 CVS $Revision: 1.1 $ $Date: 2000/10/02 02:43:03 $
  + * @version 1.0 CVS $Revision: 1.2 $ $Date: 2000/10/30 18:56:07 $
    */
   public abstract class SAXParserFactory {
   
  @@ -131,7 +131,8 @@
        *                because the application is not expected to handle or
        *                recover from such events.
        */
  -    public static SAXParserFactory newInstance() {
  +    public static SAXParserFactory newInstance() 
  +    {
   
           // Retrieve the javax.xml.parsers.SAXParserFactory system property
           String n=factory;
  
  
  
  1.2       +28 -40    xml-xalan/java/src/org/apache/serialize/DOMSerializer.java
  
  Index: DOMSerializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/DOMSerializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMSerializer.java	2000/10/13 02:33:06	1.1
  +++ DOMSerializer.java	2000/10/30 18:56:09	1.2
  @@ -56,13 +56,12 @@
    */
   package org.apache.serialize;
   
  -
   import java.io.IOException;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.Document;
   import org.w3c.dom.DocumentFragment;
   
  -
   /**
    * Interface for a DOM serializer implementation.
    * <p>
  @@ -78,7 +77,7 @@
    * ser.setOutputStream( os );
    * ser.asDOMSerializer( doc );
    * </pre>
  - * 
  + *
    *
    * @version Alpha
    * @author <a href="mailto:Scott_Boag/CAM/Lotus@lotus.com">Scott Boag</a>
  @@ -86,42 +85,31 @@
    */
   public interface DOMSerializer
   {
  -    
  -    
  -    /**
  -     * Serializes the DOM element. Throws an exception only if an I/O
  -     * exception occured while serializing.
  -     *
  -     * @param elem The element to serialize
  -     * @throws IOException An I/O exception occured while serializing
  -     */
  -    public void serialize( Element elem )
  -        throws IOException;
  -    
  -    
  -    /**
  -     * Serializes the DOM document. Throws an exception only if an I/O
  -     * exception occured while serializing.
  -     *
  -     * @param doc The document to serialize
  -     * @throws IOException An I/O exception occured while serializing
  -     */
  -    public void serialize( Document doc )
  -        throws IOException;
  -    
  -    
  -    /**
  -     * Serializes the DOM document fragment. Throws an exception only
  -     * if an I/O exception occured while serializing.
  -     *
  -     * @param frag The document fragment to serialize
  -     * @throws IOException An I/O exception occured while serializing
  -     */
  -    public void serialize( DocumentFragment frag )
  -        throws IOException;
  -    
   
  +  /**
  +   * Serializes the DOM element. Throws an exception only if an I/O
  +   * exception occured while serializing.
  +   *
  +   * @param elem The element to serialize
  +   * @throws IOException An I/O exception occured while serializing
  +   */
  +  public void serialize(Element elem) throws IOException;
  +
  +  /**
  +   * Serializes the DOM document. Throws an exception only if an I/O
  +   * exception occured while serializing.
  +   *
  +   * @param doc The document to serialize
  +   * @throws IOException An I/O exception occured while serializing
  +   */
  +  public void serialize(Document doc) throws IOException;
  +
  +  /**
  +   * Serializes the DOM document fragment. Throws an exception only
  +   * if an I/O exception occured while serializing.
  +   *
  +   * @param frag The document fragment to serialize
  +   * @throws IOException An I/O exception occured while serializing
  +   */
  +  public void serialize(DocumentFragment frag) throws IOException;
   }
  -
  -
  -
  
  
  
  1.2       +19 -28    xml-xalan/java/src/org/apache/serialize/Method.java
  
  Index: Method.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/Method.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Method.java	2000/10/13 02:33:06	1.1
  +++ Method.java	2000/10/30 18:56:09	1.2
  @@ -56,7 +56,6 @@
    */
   package org.apache.serialize;
   
  -
   /**
    * Names of the four default output methods.
    * <p>
  @@ -70,32 +69,24 @@
    */
   public final class Method
   {
  -    
  -    
  -    /**
  -     * The output method for XML documents: <tt>xml</tt>.
  -     */
  -    public static final String XML = "xml";
  -    
  -    
  -    /**
  -     * The output method for HTML documents: <tt>html</tt>.
  -     */
  -    public static final String HTML = "html";
  -    
  -    
  -    /**
  -     * The output method for XHTML documents: <tt>xhtml</tt>.
  -     */
  -    public static final String XHTML = "xhtml";
  -    
  -    
  -    /**
  -     * The output method for text documents: <tt>text</tt>.
  -     */
  -    public static final String Text = "text";
  -    
  -    
  -}
   
  +  /**
  +   * The output method for XML documents: <tt>xml</tt>.
  +   */
  +  public static final String XML = "xml";
  +
  +  /**
  +   * The output method for HTML documents: <tt>html</tt>.
  +   */
  +  public static final String HTML = "html";
   
  +  /**
  +   * The output method for XHTML documents: <tt>xhtml</tt>.
  +   */
  +  public static final String XHTML = "xhtml";
  +
  +  /**
  +   * The output method for text documents: <tt>text</tt>.
  +   */
  +  public static final String Text = "text";
  +}
  
  
  
  1.3       +391 -420  xml-xalan/java/src/org/apache/serialize/OutputFormat.java
  
  Index: OutputFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/OutputFormat.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- OutputFormat.java	2000/10/17 18:44:31	1.2
  +++ OutputFormat.java	2000/10/30 18:56:09	1.3
  @@ -56,7 +56,6 @@
    */
   package org.apache.serialize;
   
  -
   /**
    * The output format affects the manner in which a document is
    * serialized. The output format determines the output method,
  @@ -99,424 +98,396 @@
    */
   public class OutputFormat
   {
  -
  -
  -    /**
  -     * Holds the output method specified for this document,
  -     * or null if no method was specified.
  -     *
  -     * @see Method
  -     */
  -    private String _method = Method.XML;
  -
  -
  -    /**
  -     * Specifies the version of the output method, null for the
  -     * default.
  -     */
  -    private String _version = null;
  -
  -
  -    /**
  -     * True if indentation is requested, false for no indentation.
  -     */
  -    private boolean _indent = false;
  -    
  -    /**
  -     * The amount to indent a line, when indent is set to true.
  -     */
  -    private int _indentAmount = 0;
  -
  -    /**
  -     * The encoding to use, if an input stream is used, UTF-8 for
  -     * the default.
  -     */
  -    private String _encoding = "UTF-8";
  -
  -
  -    /**
  -     * The specified media type or null.
  -     */
  -    private String _mediaType = null;
  -
  -
  -    /**
  -     * The specified document type system identifier, or null.
  -     */
  -    private String _doctypeSystemId = null;
  -
  -
  -    /**
  -     * The specified document type public identifier, or null.
  -     */
  -    private String _doctypePublicId = null;
  -
  -
  -    /**
  -     * Ture if the XML declaration should be ommited;
  -     */
  -    private boolean _omitXmlDeclaration = false;
  -
  -
  -    /**
  -     * List of element tag names whose text node children must
  -     * be output as CDATA.
  -     */
  -    private QName[] _cdataElements = new QName[ 0 ];
  -
  -
  -    /**
  -     * List of element tag names whose text node children must
  -     * be output unescaped.
  -     */
  -    private QName[] _nonEscapingElements = new QName[ 0 ];
  -
  -
  -    /**
  -     * True if spaces should be preserved in elements that do not
  -     * specify otherwise, or specify the default behavior.
  -     */
  -    private boolean _preserve = false;
  -
  -    /**
  -     * True if the document type should be marked as standalone.
  -     */
  -    private boolean _standalone = false;
  -
  -
  -    /**
  -     * Constructs a new output format with the default values.
  -     */
  -    public OutputFormat()
  -    {
  -    }
  -
  -
  -    /**
  -     * Returns the method specified for this output format. See {@link
  -     * Method} for a list of the default methods. Other methods should
  -     * be of the format <tt>namespace:local</tt>. The default is
  -     * {@link Method#XML}.
  -     *
  -     * @return The specified output method
  -     */
  -    public String getMethod()
  -    {
  -        return _method;
  -    }
  -    
  -    
  -    /**
  -     * Sets the method for this output format. See {@link Method} for
  -     * a list of the default methods. Other methods should be of the
  -     * format <tt>namespace:local</tt>.
  -     *
  -     * @param method The output method, or null
  -     */
  -    public void setMethod( String method )
  -    {
  -        _method = method;
  -    }
  -
  -
  -    /**
  -     * Returns the version for this output method. If no version was
  -     * specified, will return null and the default version number will
  -     * be used. If the serializer does not support that particular
  -     * version, it should default to a supported version.
  -     *
  -     * @return The specified method version, or null
  -     */
  -    public String getVersion()
  -    {
  -        return _version;
  -    }
  -
  -
  -    /**
  -     * Sets the version for this output method.
  -     *
  -     * @param version The output method version, or null
  -     */
  -    public void setVersion( String version )
  -    {
  -        _version = version;
  -    }
  -
  -
  -    /**
  -     * Returns true if indentation was specified. If no indentation
  -     * was specified, returns false. A derived class may support
  -     * additional properties, e.g. indentation level, line width to
  -     * wrap at, tab/spaces, etc.
  -     *
  -     * @return True if indentation was specified
  -     */
  -    public boolean getIndent()
  -    {
  -        return _indent;
  -    }
  -
  -
  -    /**
  -     * Sets the indentation on and off. A derived class may support
  -     * additional properties, e.g. indentation level, line width to
  -     * wrap at, tab/spaces, etc. A serializer need not support
  -     * indentation.
  -     *
  -     * @param ident True specifies identiation
  -     */
  -    public void setIndent( boolean indent )
  -    {
  -        _indent = indent;
  -    }
  -    
  -    /**
  -     * Returns the amount to indent if indentation was specified.
  -     *
  -     * @return True if indentation was specified
  -     */
  -    public int getIndentAmount()
  -    {
  -        return _indentAmount;
  -    }
  -
  -
  -    /**
  -     * Sets how much to indent, if indentation was specified.
  -     *
  -     * @param amount Number of spaces to indent.
  -     */
  -    public void setIndentAmount( int amount )
  -    {
  -        _indentAmount = amount;
  -    }
  -
  -
  -
  -    /**
  -     * Returns the specified encoding. If no encoding was specified,
  -     * the default is used. For XML and HTML the default would be
  -     * "UTF-8". For other output methods, the default encoding is
  -     * unspecified.
  -     *
  -     * @return The encoding
  -     */
  -    public String getEncoding()
  -    {
  -        return _encoding;
  -    }
  -
  -
  -    /**
  -     * Sets the encoding for this output method. Null means the
  -     * default encoding for the selected output method. For XML and
  -     * HTML the default would be "UTF-8". For other output methods,
  -     * the default encoding is unspecified.
  -     *
  -     * @param encoding The encoding, or null
  -     */
  -    public void setEncoding( String encoding )
  -    {
  -        _encoding = encoding;
  -    }
  -
  -
  -    /**
  -     * Returns the specified media type. For each output method a
  -     * default media type will be used if one was not specified.
  -     *
  -     * @return The specified media type, or null
  -     */
  -    public String getMediaType()
  -    {
  -        return _mediaType;
  -    }
  -
  -
  -    /**
  -     * Sets the media type. For each output method a default media
  -     * type will be used if one was not specified.
  -     *
  -     * @param mediaType The specified media type
  -     */
  -    public void setMediaType( String mediaType )
  -    {
  -        _mediaType = mediaType;
  -    }
  -
  -
  -    /**
  -     * Sets the document type public identifiers. If not specified the
  -     * document type will depend on the output method (e.g. HTML, XHTML)
  -     * or from some other mechanism (e.g. SAX events, DOM DocumentType).
  -     *
  -     * @param publicId The public identifier
  -     */
  -    public void setDoctypePublicId( String publicId )
  -    {
  -        _doctypePublicId = publicId;
  -    }
  -
  -
  -    /**
  -     * Returns the specified document type public identifier,
  -     * or null.
  -     */
  -    public String getDoctypePublicId()
  -    {
  -        return _doctypePublicId;
  -    }
  -    
  -    
  -    /**
  -     * Sets the document type system identifiers. If not specified the
  -     * document type will depend on the output method (e.g. HTML, XHTML)
  -     * or from some other mechanism (e.g. SAX events, DOM DocumentType).
  -     *
  -     * @param systemId The system identifier
  -     */
  -    public void setDoctypeSystemId( String systemId )
  -    {
  -        _doctypeSystemId = systemId;
  -    }
  -
  -
  -    /**
  -     * Returns the specified document type system identifier,
  -     * or null.
  -     */
  -    public String getDoctypeSystemId()
  -    {
  -        return _doctypeSystemId;
  -    }
  -    
  -    /**
  -     * Returns true if the document type is standalone.
  -     * The default is false.
  -     */
  -    public boolean getStandalone()
  -    {
  -        return _standalone;
  -    }
  -
  -
  -    /**
  -     * Sets document DTD standalone. The public and system
  -     * identifiers must be null for the document to be
  -     * serialized as standalone.
  -     *
  -     * @param standalone True if document DTD is standalone
  -     */
  -    public void setStandalone( boolean standalone )
  -    {
  -        _standalone = standalone;
  -    }
  -
  -
  -    /**
  -     * Returns true if the XML document declaration should
  -     * be ommited. The default is false.
  -     */
  -    public boolean getOmitXMLDeclaration()
  -    {
  -        return _omitXmlDeclaration;
  -    }
  -    
  -    
  -    /**
  -     * Sets XML declaration omitting on and off.
  -     *
  -     * @param omit True if XML declaration should be ommited
  -     */
  -    public void setOmitXMLDeclaration( boolean omit )
  -    {
  -        _omitXmlDeclaration = omit;
  -    }
  -    
  -    
  -    /**
  -     * Returns a list of all the elements whose text node children
  -     * should be output as CDATA. Returns an empty array if no such
  -     * elements were specified.
  -     *
  -     * @return List of all CDATA elements
  -     */
  -    public QName[] getCDataElements()
  -    {
  -        return _cdataElements;
  -    }
  -    
  -    
  -    /**
  -     * Sets the list of elements for which text node children
  -     * should be output as CDATA.
  -     *
  -     * @param cdataElements List of all CDATA elements
  -     */
  -    public void setCDataElements( QName[] cdataElements )
  -    {
  -        if ( cdataElements == null )
  -            _cdataElements = new QName[ 0 ];
  -        else
  -            _cdataElements = cdataElements;
  -    }
  -    
  -    
  -    /**
  -     * Returns a list of all the elements whose text node children
  -     * should be output unescaped (no character references). Returns
  -     * an empty array if no such elements were specified.
  -     *
  -     * @return List of all non escaping elements
  -     */
  -    public QName[] getNonEscapingElements()
  -    {
  -        return _nonEscapingElements;
  -    }
  -    
  -    
  -    /**
  -     * Sets the list of elements for which text node children
  -     * should be output unescaped (no character references).
  -     *
  -     * @param nonEscapingElements List of all non-escaping elements
  -     */
  -    public void setNonEscapingElements( QName[] nonEscapingElements )
  -    {
  -        if ( nonEscapingElements == null )
  -            _nonEscapingElements = new QName[ 0 ];
  -        else
  -            _nonEscapingElements = nonEscapingElements;
  -    }
  -    
  -    
  -    
  -    /**
  -     * Returns true if the default behavior for this format is to
  -     * preserve spaces. All elements that do not specify otherwise
  -     * or specify the default behavior will be formatted based on
  -     * this rule. All elements that specify space preserving will
  -     * always preserve space.
  -     */
  -    public boolean getPreserveSpace()
  -    {
  -        return _preserve;
  -    }
  -    
  -    
  -    /**
  -     * Sets space preserving as the default behavior. The default is
  -     * space stripping and all elements that do not specify otherwise
  -     * or use the default value will not preserve spaces.
  -     *
  -     * @param preserve True if spaces should be preserved
  -     */
  -    public void setPreserveSpace( boolean preserve )
  -    {
  -        _preserve = preserve;
  -    }
   
  -
  +  /**
  +   * Holds the output method specified for this document,
  +   * or null if no method was specified.
  +   *
  +   * @see Method
  +   */
  +  private String _method = Method.XML;
  +
  +  /**
  +   * Specifies the version of the output method, null for the
  +   * default.
  +   */
  +  private String _version = null;
  +
  +  /**
  +   * True if indentation is requested, false for no indentation.
  +   */
  +  private boolean _indent = false;
  +
  +  /**
  +   * The amount to indent a line, when indent is set to true.
  +   */
  +  private int _indentAmount = 0;
  +
  +  /**
  +   * The encoding to use, if an input stream is used, UTF-8 for
  +   * the default.
  +   */
  +  private String _encoding = "UTF-8";
  +
  +  /**
  +   * The specified media type or null.
  +   */
  +  private String _mediaType = null;
  +
  +  /**
  +   * The specified document type system identifier, or null.
  +   */
  +  private String _doctypeSystemId = null;
  +
  +  /**
  +   * The specified document type public identifier, or null.
  +   */
  +  private String _doctypePublicId = null;
  +
  +  /**
  +   * Ture if the XML declaration should be ommited;
  +   */
  +  private boolean _omitXmlDeclaration = false;
  +
  +  /**
  +   * List of element tag names whose text node children must
  +   * be output as CDATA.
  +   */
  +  private QName[] _cdataElements = new QName[0];
  +
  +  /**
  +   * List of element tag names whose text node children must
  +   * be output unescaped.
  +   */
  +  private QName[] _nonEscapingElements = new QName[0];
  +
  +  /**
  +   * True if spaces should be preserved in elements that do not
  +   * specify otherwise, or specify the default behavior.
  +   */
  +  private boolean _preserve = false;
  +
  +  /**
  +   * True if the document type should be marked as standalone.
  +   */
  +  private boolean _standalone = false;
  +
  +  /**
  +   * Constructs a new output format with the default values.
  +   */
  +  public OutputFormat(){}
  +
  +  /**
  +   * Returns the method specified for this output format. See {@link
  +   * Method} for a list of the default methods. Other methods should
  +   * be of the format <tt>namespace:local</tt>. The default is
  +   * {@link Method#XML}.
  +   *
  +   * @return The specified output method
  +   */
  +  public String getMethod()
  +  {
  +    return _method;
  +  }
  +
  +  /**
  +   * Sets the method for this output format. See {@link Method} for
  +   * a list of the default methods. Other methods should be of the
  +   * format <tt>namespace:local</tt>.
  +   *
  +   * @param method The output method, or null
  +   */
  +  public void setMethod(String method)
  +  {
  +    _method = method;
  +  }
  +
  +  /**
  +   * Returns the version for this output method. If no version was
  +   * specified, will return null and the default version number will
  +   * be used. If the serializer does not support that particular
  +   * version, it should default to a supported version.
  +   *
  +   * @return The specified method version, or null
  +   */
  +  public String getVersion()
  +  {
  +    return _version;
  +  }
  +
  +  /**
  +   * Sets the version for this output method.
  +   *
  +   * @param version The output method version, or null
  +   */
  +  public void setVersion(String version)
  +  {
  +    _version = version;
  +  }
  +
  +  /**
  +   * Returns true if indentation was specified. If no indentation
  +   * was specified, returns false. A derived class may support
  +   * additional properties, e.g. indentation level, line width to
  +   * wrap at, tab/spaces, etc.
  +   *
  +   * @return True if indentation was specified
  +   */
  +  public boolean getIndent()
  +  {
  +    return _indent;
  +  }
  +
  +  /**
  +   * Sets the indentation on and off. A derived class may support
  +   * additional properties, e.g. indentation level, line width to
  +   * wrap at, tab/spaces, etc. A serializer need not support
  +   * indentation.
  +   *
  +   * @param ident True specifies identiation
  +   *
  +   * NEEDSDOC @param indent
  +   */
  +  public void setIndent(boolean indent)
  +  {
  +    _indent = indent;
  +  }
  +
  +  /**
  +   * Returns the amount to indent if indentation was specified.
  +   *
  +   * @return True if indentation was specified
  +   */
  +  public int getIndentAmount()
  +  {
  +    return _indentAmount;
  +  }
  +
  +  /**
  +   * Sets how much to indent, if indentation was specified.
  +   *
  +   * @param amount Number of spaces to indent.
  +   */
  +  public void setIndentAmount(int amount)
  +  {
  +    _indentAmount = amount;
  +  }
  +
  +  /**
  +   * Returns the specified encoding. If no encoding was specified,
  +   * the default is used. For XML and HTML the default would be
  +   * "UTF-8". For other output methods, the default encoding is
  +   * unspecified.
  +   *
  +   * @return The encoding
  +   */
  +  public String getEncoding()
  +  {
  +    return _encoding;
  +  }
  +
  +  /**
  +   * Sets the encoding for this output method. Null means the
  +   * default encoding for the selected output method. For XML and
  +   * HTML the default would be "UTF-8". For other output methods,
  +   * the default encoding is unspecified.
  +   *
  +   * @param encoding The encoding, or null
  +   */
  +  public void setEncoding(String encoding)
  +  {
  +    _encoding = encoding;
  +  }
  +
  +  /**
  +   * Returns the specified media type. For each output method a
  +   * default media type will be used if one was not specified.
  +   *
  +   * @return The specified media type, or null
  +   */
  +  public String getMediaType()
  +  {
  +    return _mediaType;
  +  }
  +
  +  /**
  +   * Sets the media type. For each output method a default media
  +   * type will be used if one was not specified.
  +   *
  +   * @param mediaType The specified media type
  +   */
  +  public void setMediaType(String mediaType)
  +  {
  +    _mediaType = mediaType;
  +  }
  +
  +  /**
  +   * Sets the document type public identifiers. If not specified the
  +   * document type will depend on the output method (e.g. HTML, XHTML)
  +   * or from some other mechanism (e.g. SAX events, DOM DocumentType).
  +   *
  +   * @param publicId The public identifier
  +   */
  +  public void setDoctypePublicId(String publicId)
  +  {
  +    _doctypePublicId = publicId;
  +  }
  +
  +  /**
  +   * Returns the specified document type public identifier,
  +   * or null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getDoctypePublicId()
  +  {
  +    return _doctypePublicId;
  +  }
  +
  +  /**
  +   * Sets the document type system identifiers. If not specified the
  +   * document type will depend on the output method (e.g. HTML, XHTML)
  +   * or from some other mechanism (e.g. SAX events, DOM DocumentType).
  +   *
  +   * @param systemId The system identifier
  +   */
  +  public void setDoctypeSystemId(String systemId)
  +  {
  +    _doctypeSystemId = systemId;
  +  }
  +
  +  /**
  +   * Returns the specified document type system identifier,
  +   * or null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getDoctypeSystemId()
  +  {
  +    return _doctypeSystemId;
  +  }
  +
  +  /**
  +   * Returns true if the document type is standalone.
  +   * The default is false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public boolean getStandalone()
  +  {
  +    return _standalone;
  +  }
  +
  +  /**
  +   * Sets document DTD standalone. The public and system
  +   * identifiers must be null for the document to be
  +   * serialized as standalone.
  +   *
  +   * @param standalone True if document DTD is standalone
  +   */
  +  public void setStandalone(boolean standalone)
  +  {
  +    _standalone = standalone;
  +  }
  +
  +  /**
  +   * Returns true if the XML document declaration should
  +   * be ommited. The default is false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public boolean getOmitXMLDeclaration()
  +  {
  +    return _omitXmlDeclaration;
  +  }
  +
  +  /**
  +   * Sets XML declaration omitting on and off.
  +   *
  +   * @param omit True if XML declaration should be ommited
  +   */
  +  public void setOmitXMLDeclaration(boolean omit)
  +  {
  +    _omitXmlDeclaration = omit;
  +  }
  +
  +  /**
  +   * Returns a list of all the elements whose text node children
  +   * should be output as CDATA. Returns an empty array if no such
  +   * elements were specified.
  +   *
  +   * @return List of all CDATA elements
  +   */
  +  public QName[] getCDataElements()
  +  {
  +    return _cdataElements;
  +  }
  +
  +  /**
  +   * Sets the list of elements for which text node children
  +   * should be output as CDATA.
  +   *
  +   * @param cdataElements List of all CDATA elements
  +   */
  +  public void setCDataElements(QName[] cdataElements)
  +  {
  +
  +    if (cdataElements == null)
  +      _cdataElements = new QName[0];
  +    else
  +      _cdataElements = cdataElements;
  +  }
  +
  +  /**
  +   * Returns a list of all the elements whose text node children
  +   * should be output unescaped (no character references). Returns
  +   * an empty array if no such elements were specified.
  +   *
  +   * @return List of all non escaping elements
  +   */
  +  public QName[] getNonEscapingElements()
  +  {
  +    return _nonEscapingElements;
  +  }
  +
  +  /**
  +   * Sets the list of elements for which text node children
  +   * should be output unescaped (no character references).
  +   *
  +   * @param nonEscapingElements List of all non-escaping elements
  +   */
  +  public void setNonEscapingElements(QName[] nonEscapingElements)
  +  {
  +
  +    if (nonEscapingElements == null)
  +      _nonEscapingElements = new QName[0];
  +    else
  +      _nonEscapingElements = nonEscapingElements;
  +  }
  +
  +  /**
  +   * Returns true if the default behavior for this format is to
  +   * preserve spaces. All elements that do not specify otherwise
  +   * or specify the default behavior will be formatted based on
  +   * this rule. All elements that specify space preserving will
  +   * always preserve space.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public boolean getPreserveSpace()
  +  {
  +    return _preserve;
  +  }
  +
  +  /**
  +   * Sets space preserving as the default behavior. The default is
  +   * space stripping and all elements that do not specify otherwise
  +   * or use the default value will not preserve spaces.
  +   *
  +   * @param preserve True if spaces should be preserved
  +   */
  +  public void setPreserveSpace(boolean preserve)
  +  {
  +    _preserve = preserve;
  +  }
   }
  -
  
  
  
  1.2       +104 -108  xml-xalan/java/src/org/apache/serialize/Serializer.java
  
  Index: Serializer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/Serializer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Serializer.java	2000/10/13 02:33:06	1.1
  +++ Serializer.java	2000/10/30 18:56:09	1.2
  @@ -56,14 +56,13 @@
    */
   package org.apache.serialize;
   
  -
   import java.io.Writer;
   import java.io.OutputStream;
   import java.io.IOException;
  +
   import org.xml.sax.DocumentHandler;
   import org.xml.sax.ContentHandler;
   
  -
   /**
    * A serializer is used for serializing a document with a given output
    * method. The {@link Serializer} object serves as an anchor point for
  @@ -96,7 +95,7 @@
    * ser = SerializerFactory.getSerializer( Method.XML );
    * emptyDoc( ser, System.out );
    * emptyDoc( ser, System.err );
  - * . . . 
  + * . . .
    *
    * void emptyDoc( Serializer ser, OutputStream os )
    * {
  @@ -115,110 +114,107 @@
    */
   public interface Serializer
   {
  -
  -
  -    /**
  -     * Specifies an output stream to which the document should be
  -     * serialized. This method should not be called while the
  -     * serializer is in the process of serializing a document.
  -     * <p>
  -     * The encoding specified in the {@link OutputFormat} is used, or
  -     * if no encoding was specified, the default for the selected
  -     * output method.
  -     *
  -     * @param output The output stream
  -     */
  -    public void setOutputStream( OutputStream output );
  -    public OutputStream getOutputStream();
  -
  -
  -    /**
  -     * Specifies a writer to which the document should be serialized.
  -     * This method should not be called while the serializer is in
  -     * the process of serializing a document.
  -     * <p>
  -     * The encoding specified for the {@link OutputFormat} must be
  -     * identical to the output format used with the writer.
  -     *
  -     * @param writer The output writer stream
  -     */
  -    public void setWriter( Writer writer );
  -    public Writer getWriter();
  -
  -    /**
  -     * Specifies an output format for this serializer. It the
  -     * serializer has already been associated with an output format,
  -     * it will switch to the new format. This method should not be
  -     * called while the serializer is in the process of serializing
  -     * a document.
  -     *
  -     * @param format The output format to use
  -     */
  -    public void setOutputFormat( OutputFormat format );
  -
  -
  -    /**
  -     * Returns the output format for this serializer.
  -     *
  -     * @return The output format in use
  -     */
  -    public OutputFormat getOutputFormat();
  -
  -
  -    /**
  -     * Return a {@link DocumentHandler} interface into this serializer.
  -     * If the serializer does not support the {@link DocumentHandler}
  -     * interface, it should return null.
  -     *
  -     * @return A {@link DocumentHandler} interface into this serializer,
  -     *  or null if the serializer is not SAX 1 capable
  -     * @throws IOException An I/O exception occured
  -     */
  -    public DocumentHandler asDocumentHandler()
  -        throws IOException;
  -
  -
  -    /**
  -     * Return a {@link ContentHandler} interface into this serializer.
  -     * If the serializer does not support the {@link ContentHandler}
  -     * interface, it should return null.
  -     *
  -     * @return A {@link ContentHandler} interface into this serializer,
  -     *  or null if the serializer is not SAX 2 capable
  -     * @throws IOException An I/O exception occured
  -     */
  -    public ContentHandler asContentHandler()
  -        throws IOException;
  -
  -
  -    /**
  -     * Return a {@link DOMSerializer} interface into this serializer.
  -     * If the serializer does not support the {@link DOMSerializer}
  -     * interface, it should return null.
  -     *
  -     * @return A {@link DOMSerializer} interface into this serializer,
  -     *  or null if the serializer is not DOM capable
  -     * @throws IOException An I/O exception occured
  -     */
  -    public DOMSerializer asDOMSerializer()
  -        throws IOException;
  -
  -
  -    /**
  -     * Resets the serializer. If this method returns true, the
  -     * serializer may be used for subsequent serialization of new
  -     * documents. It is possible to change the output format and
  -     * output stream prior to serializing, or to use the existing
  -     * output format and output stream.
  -     *
  -     * @return True if serializer has been reset and can be reused
  -     */
  -    public boolean reset();
  -
   
  +  /**
  +   * Specifies an output stream to which the document should be
  +   * serialized. This method should not be called while the
  +   * serializer is in the process of serializing a document.
  +   * <p>
  +   * The encoding specified in the {@link OutputFormat} is used, or
  +   * if no encoding was specified, the default for the selected
  +   * output method.
  +   *
  +   * @param output The output stream
  +   */
  +  public void setOutputStream(OutputStream output);
  +
  +  /**
  +   * NEEDSDOC Method getOutputStream 
  +   *
  +   *
  +   * NEEDSDOC (getOutputStream) @return
  +   */
  +  public OutputStream getOutputStream();
  +
  +  /**
  +   * Specifies a writer to which the document should be serialized.
  +   * This method should not be called while the serializer is in
  +   * the process of serializing a document.
  +   * <p>
  +   * The encoding specified for the {@link OutputFormat} must be
  +   * identical to the output format used with the writer.
  +   *
  +   * @param writer The output writer stream
  +   */
  +  public void setWriter(Writer writer);
  +
  +  /**
  +   * NEEDSDOC Method getWriter 
  +   *
  +   *
  +   * NEEDSDOC (getWriter) @return
  +   */
  +  public Writer getWriter();
  +
  +  /**
  +   * Specifies an output format for this serializer. It the
  +   * serializer has already been associated with an output format,
  +   * it will switch to the new format. This method should not be
  +   * called while the serializer is in the process of serializing
  +   * a document.
  +   *
  +   * @param format The output format to use
  +   */
  +  public void setOutputFormat(OutputFormat format);
  +
  +  /**
  +   * Returns the output format for this serializer.
  +   *
  +   * @return The output format in use
  +   */
  +  public OutputFormat getOutputFormat();
  +
  +  /**
  +   * Return a {@link DocumentHandler} interface into this serializer.
  +   * If the serializer does not support the {@link DocumentHandler}
  +   * interface, it should return null.
  +   *
  +   * @return A {@link DocumentHandler} interface into this serializer,
  +   *  or null if the serializer is not SAX 1 capable
  +   * @throws IOException An I/O exception occured
  +   */
  +  public DocumentHandler asDocumentHandler() throws IOException;
  +
  +  /**
  +   * Return a {@link ContentHandler} interface into this serializer.
  +   * If the serializer does not support the {@link ContentHandler}
  +   * interface, it should return null.
  +   *
  +   * @return A {@link ContentHandler} interface into this serializer,
  +   *  or null if the serializer is not SAX 2 capable
  +   * @throws IOException An I/O exception occured
  +   */
  +  public ContentHandler asContentHandler() throws IOException;
  +
  +  /**
  +   * Return a {@link DOMSerializer} interface into this serializer.
  +   * If the serializer does not support the {@link DOMSerializer}
  +   * interface, it should return null.
  +   *
  +   * @return A {@link DOMSerializer} interface into this serializer,
  +   *  or null if the serializer is not DOM capable
  +   * @throws IOException An I/O exception occured
  +   */
  +  public DOMSerializer asDOMSerializer() throws IOException;
  +
  +  /**
  +   * Resets the serializer. If this method returns true, the
  +   * serializer may be used for subsequent serialization of new
  +   * documents. It is possible to change the output format and
  +   * output stream prior to serializing, or to use the existing
  +   * output format and output stream.
  +   *
  +   * @return True if serializer has been reset and can be reused
  +   */
  +  public boolean reset();
   }
  -
  -
  -
  -
  -
  
  
  
  1.2       +116 -81   xml-xalan/java/src/org/apache/serialize/SerializerFactory.java
  
  Index: SerializerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/SerializerFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SerializerFactory.java	2000/10/13 02:33:06	1.1
  +++ SerializerFactory.java	2000/10/30 18:56:09	1.2
  @@ -56,15 +56,14 @@
    */
   package org.apache.serialize;
   
  -
   import java.util.Enumeration;
   import java.util.Hashtable;
   import java.util.Properties;
   import java.util.StringTokenizer;
  +
   import java.io.IOException;
   import java.io.InputStream;
   
  -
   /**
    * Factory for creating default serializers. An implementation need
    * only support the default output methods (XML, HTML and Text).
  @@ -89,16 +88,15 @@
    * ser = SerializerFactory.getSerializer( format );
    * </pre>
    * <p>
  - * 
  - * 
    *
  + *
  + *
    * @version Alpha
    * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
    */
   public abstract class SerializerFactory
   {
   
  -
     /**
      * The name of the properties file listing all the supported
      * serializers. (<tt>/org/xml/serilize/serializer.properties</tt>).
  @@ -112,7 +110,6 @@
      */
     public static final String PropertyMethods = "serialize.methods";
   
  -
     /**
      * The prefix of a property supplying the class name for a
      * serializer implementing a specific method.
  @@ -120,27 +117,22 @@
      */
     public static final String PropertySerializerPrefix = "serialize.";
   
  -
     /**
      * The prefix of a property supplying the class name for an
      * output format implementing a specific method.
      * (<tt>serialize.format.</tt>).
      */
  -  public static final String PropertyFormatPrefix =
  -                                                   "serialize.format.";
  +  public static final String PropertyFormatPrefix = "serialize.format.";
   
  -
     /**
      * Associates output methods to serializer classes.
      */
  -  private static Hashtable  _serializers = new Hashtable();
  -  
  +  private static Hashtable _serializers = new Hashtable();
   
     /**
      * Associates output methods to default output formats.
      */
  -  private static Hashtable  _formats = new Hashtable();
  -
  +  private static Hashtable _formats = new Hashtable();
   
     /**
      * Returns a serializer for the specified output method. Returns
  @@ -151,23 +143,29 @@
      * @param method The output method
      * @return A suitable serializer, or null
      */
  -  public static Serializer getSerializer( String method )
  +  public static Serializer getSerializer(String method)
     {
  +
       Serializer ser;
  -    Class      cls;
  +    Class cls;
  +
  +    cls = (Class) _serializers.get(method);
   
  -    cls = (Class) _serializers.get( method );
  -    if ( cls == null )
  +    if (cls == null)
         return null;
  -    try {
  +
  +    try
  +    {
         ser = (Serializer) cls.newInstance();
  -    } catch ( Exception except ) {
  +    }
  +    catch (Exception except)
  +    {
         return null;
       }
  +
       return ser;
     }
   
  -
     /**
      * Returns a serializer for the specified output method. Returns
      * null if no implementation exists that supports the specified
  @@ -177,26 +175,35 @@
      * @param format The output format
      * @return A suitable serializer, or null
      */
  -  public static Serializer getSerializer( OutputFormat format )
  +  public static Serializer getSerializer(OutputFormat format)
     {
  +
       Serializer ser;
  -    Class      cls;
  +    Class cls;
  +
  +    if (format.getMethod() == null)
  +      throw new IllegalArgumentException(
  +        "The output format has not method name");
  +
  +    cls = (Class) _serializers.get(format.getMethod());
   
  -    if ( format.getMethod() == null )
  -      throw new IllegalArgumentException( "The output format has not method name" );
  -    cls = (Class) _serializers.get( format.getMethod() );
  -    if ( cls == null )
  +    if (cls == null)
         return null;
  -    try {
  +
  +    try
  +    {
         ser = (Serializer) cls.newInstance();
  -    } catch ( Exception except ) {
  +    }
  +    catch (Exception except)
  +    {
         return null;
       }
  -    ser.setOutputFormat( format );
  +
  +    ser.setOutputFormat(format);
  +
       return ser;
     }
   
  -
     /**
      * Returns an output format for the specified output method.
      * An implementation may extend {@link OutputFormat} to provide
  @@ -205,24 +212,32 @@
      * @param method The output method
      * @return A suitable output format
      */
  -  public static OutputFormat getOutputFormat( String method )
  +  public static OutputFormat getOutputFormat(String method)
     {
  +
       OutputFormat format;
  -    Class        cls;
  +    Class cls;
  +
  +    cls = (Class) _formats.get(method);
   
  -    cls = (Class) _formats.get( method );
  -    if ( cls != null ) {
  -      try {
  +    if (cls != null)
  +    {
  +      try
  +      {
           format = (OutputFormat) cls.newInstance();
  +
           return format;
  -      } catch ( Exception except ) { }
  +      }
  +      catch (Exception except){}
       }
  +
       format = new OutputFormat();
  -    format.setMethod( method );
  +
  +    format.setMethod(method);
  +
       return format;
     }
   
  -
     /**
      * Returns an enumeration of all the output methods supported by this
      * implementation. The enumeration contains the names of all the output
  @@ -235,81 +250,101 @@
       return _serializers.keys();
     }
   
  -
     /**
      * Static constructor loads serializers and output formats
      * from properties file.
      */
  -  static {
  -    Properties      props;
  +  static
  +  {
  +    Properties props;
       StringTokenizer token;
   
  -    try {
  +    try
  +    {
         props = new Properties();
  -      InputStream is = SerializerFactory.class.getResourceAsStream( PropertiesResource );
  -      if(null == is)
  -        System.err.println( "Can't get serializer property file: " + PropertiesResource );
  -      props.load( is );
  -      if ( props.getProperty ( PropertyMethods ) == null )
  -        System.err.println( "Serializer property file has no " + PropertyMethods + " property" );
  -      else {
  -        token = new StringTokenizer( props.getProperty ( PropertyMethods ), ", " );
  -        while ( token.hasMoreElements() ) 
  +
  +      InputStream is =
  +        SerializerFactory.class.getResourceAsStream(PropertiesResource);
  +
  +      if (null == is)
  +        System.err.println("Can't get serializer property file: "
  +                           + PropertiesResource);
  +
  +      props.load(is);
  +
  +      if (props.getProperty(PropertyMethods) == null)
  +        System.err.println("Serializer property file has no "
  +                           + PropertyMethods + " property");
  +      else
  +      {
  +        token = new StringTokenizer(props.getProperty(PropertyMethods), ", ");
  +
  +        while (token.hasMoreElements())
           {
             String method;
             String clsName;
  -          Class  cls;
  -          
  +          Class cls;
  +
             method = token.nextToken();
  +
             // Get the serializer class that matches this output method
  -          clsName = props.getProperty( PropertySerializerPrefix + method );
  -          if ( clsName == null ) 
  +          clsName = props.getProperty(PropertySerializerPrefix + method);
  +
  +          if (clsName == null)
             {
  -            System.err.println( "Could not find property for serializer implementing output method " + method );
  -          } 
  -          else 
  +            System.err.println(
  +              "Could not find property for serializer implementing output method "
  +              + method);
  +          }
  +          else
             {
  -            try {
  +            try
  +            {
                 cls = Class.forName(clsName);
  +
                 // Breaks in jview -sb
                 // cls = SerializerFactory.class.getClassLoader().loadClass( clsName );
  -              _serializers.put( method, cls );
  -            } 
  -            catch ( ClassNotFoundException except ) 
  +              _serializers.put(method, cls);
  +            }
  +            catch (ClassNotFoundException except)
               {
  -              System.err.println( "Could not locate serializer class " + clsName );
  +              System.err.println("Could not locate serializer class "
  +                                 + clsName);
               }
             }
  +
             // Get the output format class that matches this output method
  -          clsName = props.getProperty( PropertyFormatPrefix + method );
  -          if ( clsName == null ) 
  +          clsName = props.getProperty(PropertyFormatPrefix + method);
  +
  +          if (clsName == null)
             {
  +
               // Don't complain in this case.  -sb
               // System.err.println( "Could not find property for output format implementing output method " + method );
  -          } 
  -          else 
  +          }
  +          else
             {
  -            try {
  +            try
  +            {
                 cls = Class.forName(clsName);
  +
                 // Breaks in jview -sb
                 // cls = SerializerFactory.class.getClassLoader().loadClass( clsName );
  -              _formats.put( method, cls );
  -            } 
  -            catch ( ClassNotFoundException except ) 
  +              _formats.put(method, cls);
  +            }
  +            catch (ClassNotFoundException except)
               {
  -              System.err.println( "Could not locate output format class " + clsName );
  +              System.err.println("Could not locate output format class "
  +                                 + clsName);
               }
             }
           }
         }
  -    } catch ( IOException except ) {
  -      System.err.println( "Error loading " + PropertiesResource + ": " +
  -                          except.toString() );
  +    }
  +    catch (IOException except)
  +    {
  +      System.err.println("Error loading " + PropertiesResource + ": "
  +                         + except.toString());
       }
     }
  -
  -
   }
  -
  -
  -
  
  
  
  1.2       +44 -49    xml-xalan/java/src/org/apache/serialize/SerializerHandler.java
  
  Index: SerializerHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/SerializerHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SerializerHandler.java	2000/10/13 02:33:06	1.1
  +++ SerializerHandler.java	2000/10/30 18:56:10	1.2
  @@ -69,54 +69,49 @@
    */
   public interface SerializerHandler
   {
  -    /**
  -     * Starts an un-escaping section. All characters printed within an
  -     * un-escaping section are printed as is, without escaping special
  -     * characters into entity references. Only XML and HTML serializers
  -     * need to support this method.
  -     * <p>
  -     * The contents of the un-escaping section will be delivered through
  -     * the regular <tt>characters</tt> event.
  -     */
  -    public void startNonEscaping()    
  -      throws SAXException;
   
  -
  -    /**
  -     * Ends an un-escaping section.
  -     *
  -     * @see #startNonEscaping
  -     */
  -    public void endNonEscaping()    
  -      throws SAXException;
  -
  -
  -    /**
  -     * Starts a whitespace preserving section. All characters printed
  -     * within a preserving section are printed without indentation and
  -     * without consolidating multiple spaces. This is equivalent to
  -     * the <tt>xml:space=&quot;preserve&quot;</tt> attribute. Only XML
  -     * and HTML serializers need to support this method.
  -     * <p>
  -     * The contents of the whitespace preserving section will be delivered
  -     * through the regular <tt>characters</tt> event.
  -     */
  -    public void startPreserving()    
  -      throws SAXException;
  -
  -
  -    /**
  -     * Ends a whitespace preserving section.
  -     *
  -     * @see #startPreserving
  -     */
  -    public void endPreserving()    
  -      throws SAXException;
  -
  -
  +  /**
  +   * Starts an un-escaping section. All characters printed within an
  +   * un-escaping section are printed as is, without escaping special
  +   * characters into entity references. Only XML and HTML serializers
  +   * need to support this method.
  +   * <p>
  +   * The contents of the un-escaping section will be delivered through
  +   * the regular <tt>characters</tt> event.
  +   *
  +   * @throws SAXException
  +   */
  +  public void startNonEscaping() throws SAXException;
  +
  +  /**
  +   * Ends an un-escaping section.
  +   *
  +   * @see #startNonEscaping
  +   *
  +   * @throws SAXException
  +   */
  +  public void endNonEscaping() throws SAXException;
  +
  +  /**
  +   * Starts a whitespace preserving section. All characters printed
  +   * within a preserving section are printed without indentation and
  +   * without consolidating multiple spaces. This is equivalent to
  +   * the <tt>xml:space=&quot;preserve&quot;</tt> attribute. Only XML
  +   * and HTML serializers need to support this method.
  +   * <p>
  +   * The contents of the whitespace preserving section will be delivered
  +   * through the regular <tt>characters</tt> event.
  +   *
  +   * @throws SAXException
  +   */
  +  public void startPreserving() throws SAXException;
  +
  +  /**
  +   * Ends a whitespace preserving section.
  +   *
  +   * @see #startPreserving
  +   *
  +   * @throws SAXException
  +   */
  +  public void endPreserving() throws SAXException;
   }
  -
  -
  -
  -
  -
  
  
  
  1.2       +5 -5      xml-xalan/java/src/org/apache/serialize/serializer.properties
  
  Index: serializer.properties
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/serializer.properties,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- serializer.properties	2000/10/13 02:33:06	1.1
  +++ serializer.properties	2000/10/30 18:56:10	1.2
  @@ -1,5 +1,5 @@
   #
  -# $Revision: 1.1 $ $Date: 2000/10/13 02:33:06 $
  +# $Revision: 1.2 $ $Date: 2000/10/30 18:56:10 $
   #
   # Note: This properties file is provided for illustrative purposes
   #       only and is not part of the interface definition.
  @@ -16,10 +16,10 @@
   #
   # Use the transition serializer implementations for the default methods
   #
  -serialize.xml=org.apache.xml.serialize.transition.XMLSerializer
  -serialize.html=org.apache.xml.serialize.transition.HTMLSerializer
  -serialize.xhtml=org.apache.xml.serialize.transition.XHTMLSerializer
  -serialize.text=org.apache.xml.serialize.transition.TextSerializer
  +serialize.xml=org.apache.xalan.serialize.FormatterToXML
  +serialize.html=org.apache.xalan.serialize.FormatterToHTML
  +serialize.text=org.apache.xalan.serialize.FormatterToText
  +serialize.xhtml=org.apache.xalan.serialize.FormatterToXML
   # serialize.wml:wml=org.apache.xml.serialize.transition.WMLSerializer
   
   #
  
  
  
  1.2       +42 -29    xml-xalan/java/src/org/apache/serialize/helpers/HTMLOutputFormat.java
  
  Index: HTMLOutputFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/helpers/HTMLOutputFormat.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HTMLOutputFormat.java	2000/10/13 02:33:07	1.1
  +++ HTMLOutputFormat.java	2000/10/30 18:56:14	1.2
  @@ -56,11 +56,9 @@
    */
   package org.apache.serialize.helpers;
   
  -
   import org.apache.serialize.OutputFormat;
   import org.apache.serialize.Method;
   
  -
   /**
    * Output format for HTML documents.
    * <p>
  @@ -72,35 +70,50 @@
    * @version Alpha
    * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
    */
  -public class HTMLOutputFormat
  -    extends OutputFormat
  +public class HTMLOutputFormat extends OutputFormat
   {
   
  +  /**
  +   * Constructor HTMLOutputFormat
  +   *
  +   */
  +  public HTMLOutputFormat()
  +  {
  +
  +    setMethod(Method.HTML);
  +    setMediaType("text/html");
  +    setOmitXMLDeclaration(true);
  +    setPreserveSpace(false);
  +    setDoctypePublicId("-//W3C//DTD HTML 4.0//EN");
  +    setDoctypeSystemId(
  +      "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd");
  +  }
  +
  +  /**
  +   * Constructor HTMLOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param encoding
  +   */
  +  public HTMLOutputFormat(String encoding)
  +  {
  +
  +    this();
  +
  +    setEncoding(encoding);
  +  }
  +
  +  /**
  +   * Constructor HTMLOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param indenting
  +   */
  +  public HTMLOutputFormat(boolean indenting)
  +  {
   
  -    public HTMLOutputFormat()
  -    {
  -        setMethod( Method.HTML );
  -        setMediaType( "text/html" );
  -        setOmitXMLDeclaration( true );
  -        setPreserveSpace( false );
  -        setDoctypePublicId( "-//W3C//DTD HTML 4.0//EN" );
  -        setDoctypeSystemId( "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd" );
  -    }
  -
  -
  -    public HTMLOutputFormat( String encoding )
  -    {
  -        this();
  -        setEncoding( encoding );
  -    }
  -
  -
  -    public HTMLOutputFormat( boolean indenting )
  -    {
  -        this();
  -        setIndent( indenting );
  -    }
  +    this();
   
  -
  +    setIndent(indenting);
  +  }
   }
  -
  
  
  
  1.2       +41 -29    xml-xalan/java/src/org/apache/serialize/helpers/TextOutputFormat.java
  
  Index: TextOutputFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/helpers/TextOutputFormat.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TextOutputFormat.java	2000/10/13 02:33:07	1.1
  +++ TextOutputFormat.java	2000/10/30 18:56:14	1.2
  @@ -56,11 +56,9 @@
    */
   package org.apache.serialize.helpers;
   
  -
   import org.apache.serialize.OutputFormat;
   import org.apache.serialize.Method;
   
  -
   /**
    * Output format for text documents.
    * <p>
  @@ -72,33 +70,47 @@
    * @version Alpha
    * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
    */
  -public class TextOutputFormat
  -    extends OutputFormat
  +public class TextOutputFormat extends OutputFormat
   {
  -
   
  -    public TextOutputFormat()
  -    {
  -        setMethod( Method.Text );
  -        setMediaType( "text/plain" );
  -        setPreserveSpace( true );
  -    }
  -
  -
  -    public TextOutputFormat( String encoding )
  -    {
  -        this();
  -        setEncoding( encoding );
  -    }
  -
  -
  -    public TextOutputFormat( boolean indenting )
  -    {
  -        this();
  -        setIndent( indenting );
  -        setPreserveSpace( false );
  -    }
  -
  -
  +  /**
  +   * Constructor TextOutputFormat
  +   *
  +   */
  +  public TextOutputFormat()
  +  {
  +
  +    setMethod(Method.Text);
  +    setMediaType("text/plain");
  +    setPreserveSpace(true);
  +  }
  +
  +  /**
  +   * Constructor TextOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param encoding
  +   */
  +  public TextOutputFormat(String encoding)
  +  {
  +
  +    this();
  +
  +    setEncoding(encoding);
  +  }
  +
  +  /**
  +   * Constructor TextOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param indenting
  +   */
  +  public TextOutputFormat(boolean indenting)
  +  {
  +
  +    this();
  +
  +    setIndent(indenting);
  +    setPreserveSpace(false);
  +  }
   }
  -
  
  
  
  1.2       +42 -29    xml-xalan/java/src/org/apache/serialize/helpers/XHTMLOutputFormat.java
  
  Index: XHTMLOutputFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/helpers/XHTMLOutputFormat.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XHTMLOutputFormat.java	2000/10/13 02:33:07	1.1
  +++ XHTMLOutputFormat.java	2000/10/30 18:56:14	1.2
  @@ -56,11 +56,9 @@
    */
   package org.apache.serialize.helpers;
   
  -
   import org.apache.serialize.OutputFormat;
   import org.apache.serialize.Method;
   
  -
   /**
    * Output format for XHTML documents.
    * <p>
  @@ -72,35 +70,50 @@
    * @version Alpha
    * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
    */
  -public class XHTMLOutputFormat
  -    extends OutputFormat
  +public class XHTMLOutputFormat extends OutputFormat
   {
   
  +  /**
  +   * Constructor XHTMLOutputFormat
  +   *
  +   */
  +  public XHTMLOutputFormat()
  +  {
  +
  +    setMethod(Method.XHTML);
  +    setMediaType("text/html");
  +    setOmitXMLDeclaration(true);
  +    setPreserveSpace(false);
  +    setDoctypePublicId("-//W3C//DTD XHTML 1.0 Strict//EN");
  +    setDoctypeSystemId(
  +      "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd");
  +  }
  +
  +  /**
  +   * Constructor XHTMLOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param encoding
  +   */
  +  public XHTMLOutputFormat(String encoding)
  +  {
  +
  +    this();
  +
  +    setEncoding(encoding);
  +  }
  +
  +  /**
  +   * Constructor XHTMLOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param indenting
  +   */
  +  public XHTMLOutputFormat(boolean indenting)
  +  {
   
  -    public XHTMLOutputFormat()
  -    {
  -        setMethod( Method.XHTML );
  -        setMediaType( "text/html" );
  -        setOmitXMLDeclaration( true );
  -        setPreserveSpace( false );
  -        setDoctypePublicId( "-//W3C//DTD XHTML 1.0 Strict//EN" );
  -        setDoctypeSystemId( "http://www.w3.org/TR/WD-html-in-xml/DTD/xhtml1-strict.dtd" );
  -    }
  -
  -
  -    public XHTMLOutputFormat( String encoding )
  -    {
  -        this();
  -        setEncoding( encoding );
  -    }
  -
  -
  -    public XHTMLOutputFormat( boolean indenting )
  -    {
  -        this();
  -        setIndent( indenting );
  -    }
  +    this();
   
  -
  +    setIndent(indenting);
  +  }
   }
  -
  
  
  
  1.2       +41 -29    xml-xalan/java/src/org/apache/serialize/helpers/XMLOutputFormat.java
  
  Index: XMLOutputFormat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/serialize/helpers/XMLOutputFormat.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XMLOutputFormat.java	2000/10/13 02:33:07	1.1
  +++ XMLOutputFormat.java	2000/10/30 18:56:14	1.2
  @@ -56,11 +56,9 @@
    */
   package org.apache.serialize.helpers;
   
  -
   import org.apache.serialize.OutputFormat;
   import org.apache.serialize.Method;
   
  -
   /**
    * Output format for XML documents.
    * <p>
  @@ -72,33 +70,47 @@
    * @version Alpha
    * @author <a href="mailto:arkin@exoffice.com">Assaf Arkin</a>
    */
  -public class XMLOutputFormat
  -    extends OutputFormat
  +public class XMLOutputFormat extends OutputFormat
   {
  -
   
  -    public XMLOutputFormat()
  -    {
  -        setMethod( Method.XML );
  -        setMediaType( "text/xml" );
  -        setPreserveSpace( true );
  -    }
  -
  -
  -    public XMLOutputFormat( String encoding )
  -    {
  -        this();
  -        setEncoding( encoding );
  -    }
  -
  -
  -    public XMLOutputFormat( boolean indenting )
  -    {
  -        this();
  -        setIndent( indenting );
  -        setPreserveSpace( false );
  -    }
  -
  -
  +  /**
  +   * Constructor XMLOutputFormat
  +   *
  +   */
  +  public XMLOutputFormat()
  +  {
  +
  +    setMethod(Method.XML);
  +    setMediaType("text/xml");
  +    setPreserveSpace(true);
  +  }
  +
  +  /**
  +   * Constructor XMLOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param encoding
  +   */
  +  public XMLOutputFormat(String encoding)
  +  {
  +
  +    this();
  +
  +    setEncoding(encoding);
  +  }
  +
  +  /**
  +   * Constructor XMLOutputFormat
  +   *
  +   *
  +   * NEEDSDOC @param indenting
  +   */
  +  public XMLOutputFormat(boolean indenting)
  +  {
  +
  +    this();
  +
  +    setIndent(indenting);
  +    setPreserveSpace(false);
  +  }
   }
  -
  
  
  
  1.2       +192 -92   xml-xalan/java/src/org/apache/trax/Examples.java
  
  Index: Examples.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/Examples.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Examples.java	2000/10/13 02:33:07	1.1
  +++ Examples.java	2000/10/30 18:56:17	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -84,11 +85,12 @@
   
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  -import javax.xml.parsers.ParserConfigurationException; 
  -import java.io.BufferedInputStream; // dml
  +import javax.xml.parsers.ParserConfigurationException;
  +
  +import java.io.BufferedInputStream;  // dml
   
   /**
  - * Some examples to show how the Simple API for Transformations 
  + * Some examples to show how the Simple API for Transformations
    * could be used.
    *
    * @version Alpha
  @@ -96,12 +98,27 @@
    */
   public class Examples
   {
  -  public static void main( String argv[] )
  -    throws ProcessorException, ProcessorFactoryException, 
  -           TransformException, SAXException, IOException, 
  -           ParserConfigurationException
  +
  +  /**
  +   * NEEDSDOC Method main 
  +   *
  +   *
  +   * NEEDSDOC @param argv
  +   *
  +   * @throws IOException
  +   * @throws ParserConfigurationException
  +   * @throws ProcessorException
  +   * @throws ProcessorFactoryException
  +   * @throws SAXException
  +   * @throws TransformException
  +   */
  +  public static void main(String argv[])
  +          throws ProcessorException, ProcessorFactoryException,
  +                 TransformException, SAXException, IOException,
  +                 ParserConfigurationException
     {
  -  	System.out.println("==== exampleSimple ====");
  +
  +    System.out.println("==== exampleSimple ====");
       exampleSimple("foo.xml", "foo.xsl");
       System.out.println("\n==== exampleSAX2SAX ====");
       exampleSAX2SAX("foo.xml", "foo.xsl");
  @@ -117,121 +134,163 @@
       exampleOutputFormat("foo.xml", "foo.xsl");
       System.out.println("==== exampleUseAssociated ====");
     }
  -  
  +
     /**
      * Show the simplest possible transformation from system id to output stream.
  +   *
  +   * NEEDSDOC @param sourceID
  +   * NEEDSDOC @param xslID
  +   *
  +   * @throws IOException
  +   * @throws ProcessorException
  +   * @throws ProcessorFactoryException
  +   * @throws SAXException
  +   * @throws TransformException
      */
     public static void exampleSimple(String sourceID, String xslID)
  -    throws ProcessorException, ProcessorFactoryException, 
  -           TransformException, SAXException, IOException
  -  {  
  -    Processor processor = Processor.newInstance("xslt");
  +          throws ProcessorException, ProcessorFactoryException,
  +                 TransformException, SAXException, IOException
  +  {
   
  +    Processor processor = Processor.newInstance("xslt");
       Templates templates = processor.process(new InputSource(xslID));
       Transformer transformer = templates.newTransformer();
   
       transformer.transform(new InputSource(sourceID), new Result(System.out));
     }
  -  
  +
     /**
      * Show the Transformer using SAX events in and SAX events out.
  +   *
  +   * NEEDSDOC @param sourceID
  +   * NEEDSDOC @param xslID
  +   *
  +   * @throws IOException
  +   * @throws SAXException
      */
     public static void exampleSAX2SAX(String sourceID, String xslID)
  -    throws SAXException, IOException // , ParserConfigurationException
  -  {  
  -    Processor processor = Processor.newInstance("xslt");
  +          throws SAXException, IOException  // , ParserConfigurationException
  +  {
   
  +    Processor processor = Processor.newInstance("xslt");
       XMLReader reader = XMLReaderFactory.createXMLReader();
   
       // Have a Templates builder handle the parse events from the SAXParser's 
       // parse of an xslt file.
       TemplatesBuilder templatesBuilder = processor.getTemplatesBuilder();
  +
       reader.setContentHandler(templatesBuilder);
  -    if(templatesBuilder instanceof org.xml.sax.ext.LexicalHandler)
  -      reader.setProperty("http://xml.org/sax/properties/lexical-handler", templatesBuilder);
  +
  +    if (templatesBuilder instanceof org.xml.sax.ext.LexicalHandler)
  +      reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +                         templatesBuilder);
  +
       reader.parse(xslID);
  +
       Templates templates = templatesBuilder.getTemplates();
  -    
  +
       // Get a transformer instance for the templates.
       Transformer transformer = templates.newTransformer();
  -    
  +
       // Set the result handling to be a serialization to System.out.
       Serializer serializer = SerializerFactory.getSerializer("xml");
  +
       serializer.setOutputStream(System.out);
       transformer.setContentHandler(serializer.asContentHandler());
  -    
  +
       // Cause the transformation to occur by asking the parser to send 
       // the parse events from "foo.xsl" to the transformer.
       ContentHandler chandler = transformer.getInputContentHandler();
  +
       reader.setContentHandler(chandler);
  -    if(chandler instanceof org.xml.sax.ext.LexicalHandler)
  -      reader.setProperty("http://xml.org/sax/properties/lexical-handler", chandler);
  +
  +    if (chandler instanceof org.xml.sax.ext.LexicalHandler)
  +      reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +                         chandler);
       else
  -      reader.setProperty("http://xml.org/sax/properties/lexical-handler", null);
  +      reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +                         null);
  +
       reader.parse(sourceID);
     }
  -  
  +
     /**
  -   * Show the Transformer as a SAX2 XMLFilter/XMLReader.  In this case 
  -   * the Transformer acts like a parser, and can in fact be polymorphicaly 
  +   * Show the Transformer as a SAX2 XMLFilter/XMLReader.  In this case
  +   * the Transformer acts like a parser, and can in fact be polymorphicaly
      * used in places where a SAX parser would be used.
  +   *
  +   * NEEDSDOC @param sourceID
  +   * NEEDSDOC @param xslID
  +   *
  +   * @throws IOException
  +   * @throws SAXException
      */
     public static void exampleXMLFilter(String sourceID, String xslID)
  -    throws SAXException, IOException// , ParserConfigurationException
  -  {  
  -    Processor processor = Processor.newInstance("xslt");
  +          throws SAXException, IOException  // , ParserConfigurationException
  +  {
   
  +    Processor processor = Processor.newInstance("xslt");
       Templates templates = processor.process(new InputSource(xslID));
       Transformer transformer = templates.newTransformer();
   
       // Set the result handling to be a serialization to System.out.
  -    Serializer serializer = SerializerFactory.getSerializer(new OutputFormat());
  +    Serializer serializer =
  +      SerializerFactory.getSerializer(new OutputFormat());
  +
       serializer.setOutputStream(System.out);
       transformer.setContentHandler(serializer.asContentHandler());
   
       // The transformer will use a SAX parser as it's reader.    
       XMLReader reader = XMLReaderFactory.createXMLReader();
  +
       transformer.setParent(reader);
  -    
  +
       // Now, when you call transformer.parse, it will set itself as 
       // the content handler for the parser object (it's "parent"), and 
       // will then call the parse method on the parser.
       transformer.parse(new InputSource(sourceID));
     }
  -  
  +
     /**
  -   * This example shows how to chain events from one Transformer 
  -   * to another transformer, using the Transformer as a 
  +   * This example shows how to chain events from one Transformer
  +   * to another transformer, using the Transformer as a
      * SAX2 XMLFilter/XMLReader.
  +   *
  +   * NEEDSDOC @param sourceID
  +   * NEEDSDOC @param xslID_1
  +   * NEEDSDOC @param xslID_2
  +   * NEEDSDOC @param xslID_3
  +   *
  +   * @throws IOException
  +   * @throws SAXException
      */
  -  public static void exampleXMLFilterChain(String sourceID, String xslID_1, 
  -                                           String xslID_2, String xslID_3)
  -    throws SAXException, IOException// , ParserConfigurationException
  -  {  
  -    Processor processor = Processor.newInstance("xslt");
  +  public static void exampleXMLFilterChain(
  +          String sourceID, String xslID_1, String xslID_2, String xslID_3)
  +            throws SAXException, IOException  // , ParserConfigurationException
  +  {
   
  +    Processor processor = Processor.newInstance("xslt");
       Templates stylesheet1 = processor.process(new InputSource(xslID_1));
       Transformer transformer1 = stylesheet1.newTransformer();
  -
  -    Templates stylesheet2= processor.process(new InputSource(xslID_2));
  +    Templates stylesheet2 = processor.process(new InputSource(xslID_2));
       Transformer transformer2 = stylesheet2.newTransformer();
  -
  -    Templates  stylesheet3 = processor.process(new InputSource(xslID_3));
  -    Transformer transformer3= stylesheet3.newTransformer();
  -    
  +    Templates stylesheet3 = processor.process(new InputSource(xslID_3));
  +    Transformer transformer3 = stylesheet3.newTransformer();
       XMLReader reader = XMLReaderFactory.createXMLReader();
  -    
  +
       // transformer1 will use a SAX parser as it's reader.    
       transformer1.setParent(reader);
  -    
  +
       // transformer2 will use transformer1 as it's reader.
       transformer2.setParent(transformer1);
  -    
  +
       // transform3 will use transform2 as it's reader.
       transformer3.setParent(transformer2);
  -    
  +
       // transform3 will output the events to the serializer.
  -    Serializer serializer = SerializerFactory.getSerializer(new OutputFormat());
  +    Serializer serializer =
  +      SerializerFactory.getSerializer(new OutputFormat());
  +
       serializer.setOutputStream(System.out);
       transformer3.setContentHandler(serializer.asContentHandler());
   
  @@ -243,105 +302,146 @@
       // SAX parser, and call parser.parse(new InputSource("foo.xml")).
       transformer3.parse(new InputSource(sourceID));
     }
  -  
  +
     /**
  -   * Show how to transform a DOM tree into another DOM tree.  
  -   * This uses the javax.xml.parsers to parse an XML file into a 
  +   * Show how to transform a DOM tree into another DOM tree.
  +   * This uses the javax.xml.parsers to parse an XML file into a
      * DOM, and create an output DOM.
  +   *
  +   * NEEDSDOC @param sourceID
  +   * NEEDSDOC @param xslID
  +   *
  +   * @throws IOException
  +   * @throws ParserConfigurationException
  +   * @throws SAXException
      */
     public static void exampleDOM2DOM(String sourceID, String xslID)
  -    throws SAXException, IOException, ParserConfigurationException
  -  {  
  +          throws SAXException, IOException, ParserConfigurationException
  +  {
  +
       Processor processor = Processor.newInstance("xslt");
   
  -    if(processor.getFeature("http://xml.org/trax/features/dom/input"))
  +    if (processor.getFeature("http://xml.org/trax/features/dom/input"))
       {
         Templates templates;
  +
         {
  -        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
  +        DocumentBuilderFactory dfactory =
  +          DocumentBuilderFactory.newInstance();
  +
           dfactory.setNamespaceAware(true);
           dfactory.setValidating(true);
  +
           DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
  -        org.w3c.dom.Document outNode = docBuilder.newDocument();
  +
  +        // org.w3c.dom.Document outNode = docBuilder.newDocument();
           Node doc = docBuilder.parse(new InputSource(xslID));
   
           templates = processor.processFromNode(doc);
         }
  -      Transformer transformer = templates.newTransformer();
   
  +      Transformer transformer = templates.newTransformer();
         DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
         DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
         org.w3c.dom.Document outNode = docBuilder.newDocument();
         Node doc = docBuilder.parse(new InputSource(sourceID));
   
         transformer.transformNode(doc, new Result(outNode));
  -      
  -      Serializer serializer = SerializerFactory.getSerializer(new OutputFormat());
  +
  +      Serializer serializer =
  +        SerializerFactory.getSerializer(new OutputFormat());
  +
         serializer.setOutputStream(System.out);
         serializer.asDOMSerializer().serialize(outNode);
       }
       else
       {
  -      throw new org.xml.sax.SAXNotSupportedException("DOM node processing not supported!");
  +      throw new org.xml.sax.SAXNotSupportedException(
  +        "DOM node processing not supported!");
       }
     }
   
     /**
      * This shows how to set a parameter for use by the templates.
  +   *
  +   * NEEDSDOC @param sourceID
  +   * NEEDSDOC @param xslID
  +   *
  +   * @throws IOException
  +   * @throws ProcessorException
  +   * @throws ProcessorFactoryException
  +   * @throws SAXException
  +   * @throws TransformException
      */
     public static void exampleParam(String sourceID, String xslID)
  -    throws ProcessorException, ProcessorFactoryException, 
  -           TransformException, SAXException, IOException
  -  {  
  -    Processor processor = Processor.newInstance("xslt");
  +          throws ProcessorException, ProcessorFactoryException,
  +                 TransformException, SAXException, IOException
  +  {
   
  +    Processor processor = Processor.newInstance("xslt");
       Templates templates = processor.process(new InputSource(xslID));
       Transformer transformer = templates.newTransformer();
  -    transformer.setParameter("my-param", null /* namespace */, "hello to you!");
  -    
  +
  +    transformer.setParameter("my-param", null /* namespace */,
  +                             "hello to you!");
       transformer.transform(new InputSource(sourceID), new Result(System.out));
     }
  -    
  +
     /**
      * Show how to override output properties.
  +   *
  +   * NEEDSDOC @param sourceID
  +   * NEEDSDOC @param xslID
  +   *
  +   * @throws IOException
  +   * @throws ProcessorException
  +   * @throws ProcessorFactoryException
  +   * @throws SAXException
  +   * @throws TransformException
      */
     public static void exampleOutputFormat(String sourceID, String xslID)
  -    throws ProcessorException, ProcessorFactoryException, 
  -           TransformException, SAXException, IOException
  -  {  
  -    Processor processor = Processor.newInstance("xslt");
  +          throws ProcessorException, ProcessorFactoryException,
  +                 TransformException, SAXException, IOException
  +  {
   
  +    Processor processor = Processor.newInstance("xslt");
       Templates templates = processor.process(new InputSource(xslID));
       OutputFormat oprops = templates.getOutputFormat();
  -    oprops.setIndent( true );
  +
  +    oprops.setIndent(true);
  +
       Transformer transformer = templates.newTransformer();
  +
       transformer.setOutputFormat(oprops);
  -    
       transformer.transform(new InputSource(sourceID), new Result(System.out));
     }
  -    
  +
     /**
  -   * Show how to get stylesheets that are associated with a given 
  +   * Show how to get stylesheets that are associated with a given
      * xml document via the xml-stylesheet PI (see http://www.w3.org/TR/xml-stylesheet/).
  +   *
  +   * @throws IOException
  +   * @throws ProcessorException
  +   * @throws ProcessorFactoryException
  +   * @throws SAXException
  +   * @throws TransformException
      */
     public static void exampleUseAssociated()
  -    throws ProcessorException, ProcessorFactoryException, 
  -           TransformException, SAXException, IOException
  -  {  
  -    Processor processor = Processor.newInstance("xslt");
  +          throws ProcessorException, ProcessorFactoryException,
  +                 TransformException, SAXException, IOException
  +  {
   
  +    Processor processor = Processor.newInstance("xslt");
       InputSource docSouce = new InputSource("foo.xml");
  -    InputSource[] sources 
  -      = processor.getAssociatedStylesheets(docSouce, "text/xslt", null, null);
  -    // Processor may remember it read the given document...
  -    
  -    Templates templates = (null != sources) ?
  -                            processor.processMultiple(sources) :
  -                            processor.process(new InputSource("default.xsl"));
  +    InputSource[] sources = processor.getAssociatedStylesheets(docSouce,
  +                              "text/xslt", null, null);
   
  +    // Processor may remember it read the given document...
  +    Templates templates = (null != sources)
  +                          ? processor.processMultiple(sources)
  +                          : processor.process(new InputSource("default.xsl"));
       Transformer transformer = templates.newTransformer();
  -    
  +
       transformer.transform(docSouce, new Result(System.out));
     }
  -    
   }
  
  
  
  1.2       +215 -141  xml-xalan/java/src/org/apache/trax/Processor.java
  
  Index: Processor.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/Processor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Processor.java	2000/10/13 02:33:07	1.1
  +++ Processor.java	2000/10/30 18:56:17	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -63,8 +64,10 @@
   import java.io.IOException;
   import java.io.InputStream;
   import java.io.BufferedInputStream;
  +
   import java.util.Properties;
   import java.util.Enumeration;
  +
   import org.xml.sax.InputSource;
   import org.xml.sax.SAXException;
   import org.xml.sax.SAXNotSupportedException;
  @@ -72,103 +75,126 @@
   import org.xml.sax.XMLReader;
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.EntityResolver;
  +
   import org.w3c.dom.Node;
   
   /**
  - * A particular transformation Processor is "plugged" into the platform via 
  - * Processor in one of two ways: 1) as a platform default, 
  - * and 2) through external specification by a system property named 
  - * "org.xml.org.apache.trax.Processor.[type]" obtained using 
  - * java.lang.System.getProperty().  The [type] part of the property specifies 
  - * the processing language to be used, for instance, "org.apache.trax.processor.xslt" would 
  - * specify an XSLT processor.  This property (or platform default) 
  + * A particular transformation Processor is "plugged" into the platform via
  + * Processor in one of two ways: 1) as a platform default,
  + * and 2) through external specification by a system property named
  + * "org.xml.org.apache.trax.Processor.[type]" obtained using
  + * java.lang.System.getProperty().  The [type] part of the property specifies
  + * the processing language to be used, for instance, "org.apache.trax.processor.xslt" would
  + * specify an XSLT processor.  This property (or platform default)
    * names a class that is a concrete subclass of org.xml.org.apache.trax.Processor.
  - * The subclass shall implement a public no-args constructor used by 
  - * the base abstract class to create an instance of the factory using 
  + * The subclass shall implement a public no-args constructor used by
  + * the base abstract class to create an instance of the factory using
    * the newInstance() method.
  - * 
  - * <p>The platform default is only used if no external implementation is 
  + *
  + * <p>The platform default is only used if no external implementation is
    * available.</p>
  - * 
  + *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>Separate Factory?</h4></dt>
  - *    <dd>Should there be a separate ProcessorFactory class, to be 
  - *        more consistent with javax.xml.parsers.SAXParserFactory? Doing this 
  + * <dl> *    <dt><h4>Separate Factory?</h4></dt>
  + *    <dd>Should there be a separate ProcessorFactory class, to be
  + *        more consistent with javax.xml.parsers.SAXParserFactory? Doing this
    *        would allow this class to be an interface instead of an abstract class.</dd>
    *    <dt><h4>Separate DOM Interface?</h4></dt>
  - *    <dd>Should there be a separate DOMProcessor class, instead of 
  + *    <dd>Should there be a separate DOMProcessor class, instead of
    *        having the processFromNode method?</dd>
    *    <dt><h4>XMLReader vs. Parser vs. SAXParser/DocumentBuilder</h4></dt>
  - *    <dd>Currently the interfaces support XMLReader.  Should this be 
  + *    <dd>Currently the interfaces support XMLReader.  Should this be
    *        javax.xml.parsers.SAXParser/javax.xml.parsers.DocumentBuilder?
    *        Or, perhaps just org.xml.sax.Parser?</dd>
    *    <dt><h4>XMLReader derivation?</h4></dt>
  - *    <dd>Should this derive from XMLReader (in a similar way that Transformer 
  + *    <dd>Should this derive from XMLReader (in a similar way that Transformer
    *        derives from XMLFilter)?</dd>
  - * </dl>
 *
  + * </dl> 
    * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
   public abstract class Processor
  -{ 
  +{
  +
     /**
      * Set the name of the default concrete class to be used.
      */
     private static String platformDefaultFactoryName = null;
  -  
  +
     /**
      * The name of the properties file used to get the org.apache.trax.processor.xslt
      * property via getResourceAsStream.
      */
     public static String PropertiesResource = "trax.properties";
  -    
  +
     /**
      * Set the name of the default concrete class to be used.
  -   * @param classname Full classname of concrete implementation 
  +   * @param classname Full classname of concrete implementation
      * of org.xml.org.apache.trax.Processor.
      */
     public static void setPlatformDefaultProcessor(String classname)
     {
       platformDefaultFactoryName = classname;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getFactoryNameFromResourceStream 
  +   *
  +   *
  +   * NEEDSDOC @param factoryKey
  +   *
  +   * NEEDSDOC (getFactoryNameFromResourceStream) @return
  +   */
     private static String getFactoryNameFromResourceStream(String factoryKey)
     {
  +
       try
       {
         Properties props = new Properties();
  -      InputStream is = Processor.class.getResourceAsStream( PropertiesResource );
  -      if(null == is)
  +      InputStream is =
  +        Processor.class.getResourceAsStream(PropertiesResource);
  +
  +      if (null == is)
           return null;
  -      props.load( is );
  -      return props.getProperty ( factoryKey );
  +
  +      props.load(is);
  +
  +      return props.getProperty(factoryKey);
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
         return null;
       }
     }
  -    
  +
     /**
      * Obtain a new instance of a Processor object.
  +   *
  +   * NEEDSDOC @param type
      * @return Concrete instance of an Processor object.
  +   *
  +   * @throws ProcessorFactoryException
      */
     public static Processor newInstance(String type)
  -    throws ProcessorFactoryException
  +          throws ProcessorFactoryException
     {
  +
       Processor factory = null;
       String factoryName;
  +
       try
       {
  -      String factoryKey = "trax.processor."+type;
  +      String factoryKey = "trax.processor." + type;
  +
         factoryName = null;
  -      try 
  +
  +      try
         {
           factoryName = System.getProperty(factoryKey);
         }
         catch (SecurityException e){}
  -      
  -      if(null == factoryName)
  +
  +      if (null == factoryName)
         {
           try
           {
  @@ -177,147 +203,177 @@
           catch (SecurityException e){}
         }
   
  -      if(null == factoryName)
  +      if (null == factoryName)
           factoryName = platformDefaultFactoryName;
  -      
  -      if(null == factoryName)
  -        throw new ProcessorFactoryException("Can't find trax property: "+factoryKey, null);
  -      
  +
  +      if (null == factoryName)
  +        throw new ProcessorFactoryException("Can't find trax property: "
  +                                            + factoryKey, null);
  +
         Class factoryClass = Class.forName(factoryName);
  -      factory = (Processor)factoryClass.newInstance();
  +
  +      factory = (Processor) factoryClass.newInstance();
       }
  -    catch(java.lang.IllegalAccessException iae)
  +    catch (java.lang.IllegalAccessException iae)
       {
  -      throw new ProcessorFactoryException("Transformation Processor can not be accessed!", iae);
  +      throw new ProcessorFactoryException(
  +        "Transformation Processor can not be accessed!", iae);
       }
  -    catch(java.lang.InstantiationException ie)
  +    catch (java.lang.InstantiationException ie)
       {
  -      throw new ProcessorFactoryException("Not able to create Transformation Processor!", ie);
  +      throw new ProcessorFactoryException(
  +        "Not able to create Transformation Processor!", ie);
       }
  -    catch(java.lang.ClassNotFoundException cnfe)
  +    catch (java.lang.ClassNotFoundException cnfe)
       {
  -      throw new ProcessorFactoryException("Transformation Processor not found!", cnfe);
  +      throw new ProcessorFactoryException(
  +        "Transformation Processor not found!", cnfe);
       }
  -    
  +
       return factory;
     }
  -      
  +
     /**
      * Process the source into a templates object.
  -   * 
  +   *
      * @param source An object that holds a URL, input stream, etc.
      * @returns A Templates object capable of being used for transformation purposes.
  -   * @exception SAXException May throw this if it needs to create a XMLReader, 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws IOException
  +   * @exception SAXException May throw this if it needs to create a XMLReader,
      *            and XMLReaderFactory.createXMLReader() fails.
      * @exception java.io.IOException An IO exception from the parser,
      *            possibly from a byte stream or character stream
      *            supplied by the application.
  -   * @exception ProcessorException May throw this during the parse when it 
  +   * @exception ProcessorException May throw this during the parse when it
      *            is constructing the Templates object and fails.
      */
     public abstract Templates process(InputSource source)
       throws ProcessorException, SAXException, IOException;
   
     /**
  -   * Process the stylesheet from a DOM tree, if the 
  -   * processor supports the "http://xml.org/trax/features/dom/input" 
  -   * feature.    
  -   * 
  -   * @param node A DOM tree which must contain 
  +   * Process the stylesheet from a DOM tree, if the
  +   * processor supports the "http://xml.org/trax/features/dom/input"
  +   * feature.
  +   *
  +   * @param node A DOM tree which must contain
      * valid transform instructions that this processor understands.
      * @returns A Templates object capable of being used for transformation purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws ProcessorException
      */
     public abstract Templates processFromNode(Node node)
       throws ProcessorException;
   
     /**
  -   * Process the stylesheet from a DOM tree, if the 
  -   * processor supports the "http://xml.org/trax/features/dom/input" 
  -   * feature.    
  -   * 
  -   * @param node A DOM tree which must contain 
  +   * Process the stylesheet from a DOM tree, if the
  +   * processor supports the "http://xml.org/trax/features/dom/input"
  +   * feature.
  +   *
  +   * @param node A DOM tree which must contain
      * valid transform instructions that this processor understands.
  -   * @param systemID The systemID from where xsl:includes and xsl:imports 
  +   * @param systemID The systemID from where xsl:includes and xsl:imports
      * should be resolved from.
      * @returns A Templates object capable of being used for transformation purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws ProcessorException
      */
     public abstract Templates processFromNode(Node node, String systemID)
       throws ProcessorException;
   
     /**
  -   * Process a series of inputs, treating them in import or cascade 
  +   * Process a series of inputs, treating them in import or cascade
      * order.  This is mainly for support of the getAssociatedStylesheets
      * method, but may be useful for other purposes.
  -   * 
  +   *
      * @param sources An array of SAX InputSource objects.
      * @returns A Templates object capable of being used for transformation purposes.
  +   *
  +   * NEEDSDOC @param source
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws ProcessorException
      */
     public abstract Templates processMultiple(InputSource[] source)
       throws ProcessorException;
   
     /**
  -   * Get InputSource specification(s) that are associated with the 
  +   * Get InputSource specification(s) that are associated with the
      * given document specified in the source param,
  -   * via the xml-stylesheet processing instruction 
  -   * (see http://www.w3.org/TR/xml-stylesheet/), and that matches 
  -   * the given criteria.  Note that it is possible to return several stylesheets 
  -   * that match the criteria, in which case they are applied as if they were 
  +   * via the xml-stylesheet processing instruction
  +   * (see http://www.w3.org/TR/xml-stylesheet/), and that matches
  +   * the given criteria.  Note that it is possible to return several stylesheets
  +   * that match the criteria, in which case they are applied as if they were
      * a list of imports or cascades.
  -   * <p>Note that DOM2 has it's own mechanism for discovering stylesheets. 
  +   * <p>Note that DOM2 has it's own mechanism for discovering stylesheets.
      * Therefore, there isn't a DOM version of this method.</p>
  -   * 
  +   *
      * <h3>Open issues:</h3>
  -   * <dl>
   *    <dt><h4>Does the xml-stylesheet recommendation really support multiple stylesheets?</h4></dt>
  +   * <dl>   *    <dt><h4>Does the xml-stylesheet recommendation really support multiple stylesheets?</h4></dt>
      *    <dd>Mike Kay wrote:  I don't see any support in the
      *        xml-stylesheet recommendation for this interpretation of what you should do
  -   *        if there's more than one match. Scott Boag replies: It's in the HTML references.  
  -   *        But it's a bit subtle.  We talked about this at the last XSL WG F2F, and people 
  -   *        agreed to the multiple stylesheet stuff.  I'll try and work out the specific 
  -   *        references.  Probably the xml-stylesheet recommendation needs to have a note 
  +   *        if there's more than one match. Scott Boag replies: It's in the HTML references.
  +   *        But it's a bit subtle.  We talked about this at the last XSL WG F2F, and people
  +   *        agreed to the multiple stylesheet stuff.  I'll try and work out the specific
  +   *        references.  Probably the xml-stylesheet recommendation needs to have a note
      *        added to it.</dd>
  -   * </dl>
   * 
  -   * @param media The media attribute to be matched.  May be null, in which 
  +   * </dl>   
  +   *
  +   * NEEDSDOC @param source
  +   * @param media The media attribute to be matched.  May be null, in which
      *              case the prefered templates will be used (i.e. alternate = no).
      * @param title The value of the title attribute to match.  May be null.
      * @param charset The value of the charset attribute to match.  May be null.
      * @returns An array of InputSources that can be passed to processMultiple method.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws ProcessorException
      */
  -  public abstract InputSource[] getAssociatedStylesheets(InputSource source,
  -                                                      String media, 
  -                                                      String title,
  -                                                      String charset)
  -    throws ProcessorException;
  -  
  +  public abstract InputSource[] getAssociatedStylesheets(
  +    InputSource source, String media, String title, String charset)
  +      throws ProcessorException;
  +
     /**
  -   * Get a TemplatesBuilder object that can process SAX 
  -   * events into a Templates object, if the processor supports the 
  +   * Get a TemplatesBuilder object that can process SAX
  +   * events into a Templates object, if the processor supports the
      * "http://xml.org/trax/features/sax/input" feature.
  -   * 
  +   *
      * <h3>Open issues:</h3>
  -   * <dl>
   *    <dt><h4>Should Processor derive from org.xml.sax.ContentHandler?</h4></dt>
  -   *    <dd>Instead of requesting an object from the Processor class, should 
  +   * <dl>   *    <dt><h4>Should Processor derive from org.xml.sax.ContentHandler?</h4></dt>
  +   *    <dd>Instead of requesting an object from the Processor class, should
      *        the Processor class simply derive from org.xml.sax.ContentHandler?</dd>
  -   * </dl>
   * @return A TemplatesBuilder object, or null if not supported.
  -   * @exception May throw a ProcessorException if a TemplatesBuilder 
  +   * </dl>   * @return A TemplatesBuilder object, or null if not supported.
  +   * @exception May throw a ProcessorException if a TemplatesBuilder
      * can not be constructed for some reason.
  +   *
  +   * @throws ProcessorException
      */
     public abstract TemplatesBuilder getTemplatesBuilder()
       throws ProcessorException;
  -  
  -  
  +
     //======= CONFIGURATION METHODS =======
  -  
  +
     /**
  -   * The XML reader to be used for the templates, 
  +   * The XML reader to be used for the templates,
      * and for the source documents if it is not set.
      */
     private XMLReader reader;
  -  
  +
     /**
  -   * Set an XML parser for the templates.  This may also 
  -   * be used for the XML input for the source tree, if 
  -   * the setXMLReader method on the Transformation 
  +   * Set an XML parser for the templates.  This may also
  +   * be used for the XML input for the source tree, if
  +   * the setXMLReader method on the Transformation
      * method is not set.
  +   *
  +   * NEEDSDOC @param reader
      */
     public void setXMLReader(XMLReader reader)
     {
  @@ -325,9 +381,9 @@
     }
   
     /**
  -   * Get the XML parser used for the templates.  This may also 
  -   * be used for the XML input for the source tree, if 
  -   * the setXMLReader method on the Transformation 
  +   * Get the XML parser used for the templates.  This may also
  +   * be used for the XML input for the source tree, if
  +   * the setXMLReader method on the Transformation
      * method is not set.
      * @return Valid XMLReader object, or null if none has been set.
      */
  @@ -344,27 +400,32 @@
      * to be unable to return its value; this is especially true
      * in the case of an adapter for a SAX1 Parser, which has
      * no way of knowing whether the underlying parser is
  -   * validating, for example.</p>
   * 
   * <h3>Open issues:</h3>
  -   * <dl>
   *    <dt><h4>Should getFeature be changed to hasFeature?</h4></dt>
  -   *    <dd>Keith Visco writes: Should getFeature be changed to hasFeature? 
  -   *        It returns a boolean which indicated whether the "state" 
  -   *        of feature is "true or false". I assume this means whether 
  -   *        or not a feature is supported? I know SAX is using "getFeature", 
  +   * validating, for example.</p>   *    * <h3>Open issues:</h3>
  +   * <dl>   *    <dt><h4>Should getFeature be changed to hasFeature?</h4></dt>
  +   *    <dd>Keith Visco writes: Should getFeature be changed to hasFeature?
  +   *        It returns a boolean which indicated whether the "state"
  +   *        of feature is "true or false". I assume this means whether
  +   *        or not a feature is supported? I know SAX is using "getFeature",
      *        but to me "hasFeature" is cleaner.</dd>
  -   * </dl>
   *
  +   * </dl>   
      * @param name The feature name, which is a fully-qualified
      *        URI.
      * @return The current state of the feature (true or false).
      * @exception org.xml.sax.SAXNotRecognizedException When the
      *            Processor does not recognize the feature name.
      * @exception org.xml.sax.SAXNotSupportedException When the
  -   *            Processor recognizes the feature name but 
  +   *            Processor recognizes the feature name but
      *            cannot determine its value at this time.
  +   *
  +   * @throws SAXNotRecognizedException
  +   * @throws SAXNotSupportedException
      */
  -  public boolean getFeature (String name)
  -    throws SAXNotRecognizedException, SAXNotSupportedException
  {
    throw new SAXNotRecognizedException(name);
  +  public boolean getFeature(String name)
  +          throws SAXNotRecognizedException, SAXNotSupportedException
  +  {
  +    throw new SAXNotRecognizedException(name);
     }
  -  
  +
     /**
      * Set the state of a feature.
      *
  @@ -378,43 +439,55 @@
      * @param name The feature name, which is a fully-qualified
      *        URI.
      * @param state The requested state of the feature (true or false).
  +   * NEEDSDOC @param value
      * @exception org.xml.sax.SAXNotRecognizedException When the
      *            Processor does not recognize the feature name.
      * @exception org.xml.sax.SAXNotSupportedException When the
  -   *            Processor recognizes the feature name but 
  +   *            Processor recognizes the feature name but
      *            cannot set the requested value.
  +   *
  +   * @throws SAXNotRecognizedException
  +   * @throws SAXNotSupportedException
      */
  -  public void setFeature (String name, boolean value)
  -    throws SAXNotRecognizedException, SAXNotSupportedException
  -  {
    throw new SAXNotRecognizedException(name);
  -  }
  -  
  -  private URIResolver resolver;
  
  /**
  -   * Set an object that will be used to resolve URIs used in 
  -   * xsl:import, etc.  This will be used as the default for the 
  +  public void setFeature(String name, boolean value)
  +          throws SAXNotRecognizedException, SAXNotSupportedException
  +  {
  +    throw new SAXNotRecognizedException(name);
  +  }
  +
  +  /** NEEDSDOC Field resolver          */
  +  private URIResolver resolver;
  +
  +  /**
  +   * Set an object that will be used to resolve URIs used in
  +   * xsl:import, etc.  This will be used as the default for the
      * transformation.
  -   * @param resolver An object that implements the URIResolver interface, 
  +   * @param resolver An object that implements the URIResolver interface,
      * or null.
      */
  +
     public void setURIResolver(URIResolver resolver)
     {
       this.resolver = resolver;
     }
   
     /**
  -   * Set an object that will be used to resolve URIs used in 
  -   * xsl:import, etc.  This will be used as the default for the 
  +   * Set an object that will be used to resolve URIs used in
  +   * xsl:import, etc.  This will be used as the default for the
      * transformation.
  -   * @param resolver An object that implements the URIResolver interface, 
  +   * @param resolver An object that implements the URIResolver interface,
      * or null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public URIResolver getURIResolver()
     {
       return resolver;
     }
  -  
  +
  +  /** NEEDSDOC Field errorHandler          */
     ErrorHandler errorHandler;
  -  
  +
     /**
      * Allow an application to register an error event handler.
      *
  @@ -429,15 +502,18 @@
      * handler immediately.</p>
      *
      * @param handler The error handler.
  -   * @exception java.lang.NullPointerException If the handler 
  +   * @exception java.lang.NullPointerException If the handler
      *            argument is null.
      * @see #getErrorHandler
      */
  -  public void setErrorHandler (ErrorHandler handler)
  +  public void setErrorHandler(ErrorHandler handler)
     {
  -    if (handler == null) {
  +
  +    if (handler == null)
  +    {
         throw new NullPointerException("Null error handler");
       }
  +
       errorHandler = handler;
     }
   
  @@ -448,13 +524,14 @@
      *         has been registered.
      * @see #setErrorHandler
      */
  -  public ErrorHandler getErrorHandler ()
  +  public ErrorHandler getErrorHandler()
     {
       return errorHandler;
     }
  -  
  +
  +  /** NEEDSDOC Field entityResolver          */
     private EntityResolver entityResolver;
  -  
  +
     /**
      * Allow an application to register an entity resolver.
      *
  @@ -466,16 +543,15 @@
      * resolver immediately.</p>
      *
      * @param resolver The entity resolver.
  -   * @exception java.lang.NullPointerException If the resolver 
  +   * @exception java.lang.NullPointerException If the resolver
      *            argument is null.
      * @see #getEntityResolver
      */
  -  public void setEntityResolver (EntityResolver resolver)
  +  public void setEntityResolver(EntityResolver resolver)
     {
       entityResolver = resolver;
     }
   
  -
     /**
      * Return the current entity resolver.
      *
  @@ -483,10 +559,8 @@
      *         has been registered.
      * @see #setEntityResolver
      */
  -  public EntityResolver getEntityResolver ()
  +  public EntityResolver getEntityResolver()
     {
       return entityResolver;
     }
  -
  -
   }
  
  
  
  1.2       +93 -68    xml-xalan/java/src/org/apache/trax/ProcessorException.java
  
  Index: ProcessorException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/ProcessorException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProcessorException.java	2000/10/13 02:33:07	1.1
  +++ ProcessorException.java	2000/10/30 18:56:17	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -66,22 +67,23 @@
   import org.xml.sax.helpers.LocatorImpl;
   
   /**
  - * This exception serves as a root exception of TRaX exception, and 
  - * is thrown in raw form when an exceptional condition occurs in the 
  + * This exception serves as a root exception of TRaX exception, and
  + * is thrown in raw form when an exceptional condition occurs in the
    * Processor object.
    *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>Abstract exception root?</h4></dt>
  + * <dl> *    <dt><h4>Abstract exception root?</h4></dt>
    *    <dd>Should the root TRaX exception be abstract?</dd>
    *    <dt><h4>Derive from SAXException?</h4></dt>
  - *    <dd>Keith Visco writes: I don't think these exceptions should extend  
  + *    <dd>Keith Visco writes: I don't think these exceptions should extend
    *        SAXException, but could nest a SAXException if necessary.</dd>
  - * </dl>
 * 
  + * </dl> 
    * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
   public class ProcessorException extends SAXParseException
   {
  +
     //////////////////////////////////////////////////////////////////////
     // Constructors.
     //////////////////////////////////////////////////////////////////////
  @@ -95,9 +97,9 @@
      *
      * @param message The error or warning message.
      * @see org.xml.sax.Locator
  -   * @see org.xml.sax.Parser#setLocale 
  +   * @see org.xml.sax.Parser#setLocale
      */
  -  public ProcessorException (String message) 
  +  public ProcessorException(String message)
     {
       super(message, null);
     }
  @@ -112,14 +114,13 @@
      * @param message The error or warning message.
      * @param locator The locator object for the error or warning.
      * @see org.xml.sax.Locator
  -   * @see org.xml.sax.Parser#setLocale 
  +   * @see org.xml.sax.Parser#setLocale
      */
  -  public ProcessorException (String message, Locator locator) 
  +  public ProcessorException(String message, Locator locator)
     {
       super(message, locator);
     }
  -  
  -  
  +
     /**
      * Wrap an existing exception in a ProcessorException.
      *
  @@ -135,16 +136,15 @@
      * @see org.xml.sax.Locator
      * @see org.xml.sax.Parser#setLocale
      */
  -  public ProcessorException (String message, Locator locator,
  -                             Exception e) 
  +  public ProcessorException(String message, Locator locator, Exception e)
     {
  -    super( message, locator, e);
  +    super(message, locator, e);
     }
  -  
  +
     /**
      * Wrap an existing exception in a ProcessorException.
      *
  -   * <p>This is used for throwing processor exceptions before 
  +   * <p>This is used for throwing processor exceptions before
      * the processing has started.</p>
      *
      * @param message The error or warning message, or null to
  @@ -153,11 +153,11 @@
      * @see org.xml.sax.Locator
      * @see org.xml.sax.Parser#setLocale
      */
  -  public ProcessorException (String message, Exception e) 
  +  public ProcessorException(String message, Exception e)
     {
  -    super( "TRaX Processor Exception", new LocatorImpl(), e);
  +    super("TRaX Processor Exception", new LocatorImpl(), e);
     }
  -  
  +
     /**
      * Create a new ProcessorException.
      *
  @@ -177,13 +177,12 @@
      *                     cause the error or warning.
      * @see org.xml.sax.Parser#setLocale
      */
  -  public ProcessorException (String message, String publicId, String systemId,
  -                             int lineNumber, int columnNumber)
  +  public ProcessorException(String message, String publicId, String systemId,
  +                            int lineNumber, int columnNumber)
     {
       super(message, publicId, systemId, lineNumber, columnNumber);
     }
  -  
  -  
  +
     /**
      * Create a new ProcessorException with an embedded exception.
      *
  @@ -207,39 +206,45 @@
      * @param e Another exception to embed in this one.
      * @see org.xml.sax.Parser#setLocale
      */
  -  public ProcessorException (String message, String publicId, String systemId,
  -                             int lineNumber, int columnNumber, Exception e)
  +  public ProcessorException(String message, String publicId, String systemId,
  +                            int lineNumber, int columnNumber, Exception e)
     {
       super(message, publicId, systemId, lineNumber, columnNumber, e);
     }
  -  
  -  
  +
     /**
  -   * Print the the trace of methods from where the error 
  -   * originated.  This will trace all nested exception 
  +   * Print the the trace of methods from where the error
  +   * originated.  This will trace all nested exception
      * objects, as well as this object.
      * @param s The stream where the dump will be sent to.
      */
  -  public void printStackTrace(java.io.PrintStream s) 
  +  public void printStackTrace(java.io.PrintStream s)
     {
  -    if(s == null)
  +
  +    if (s == null)
         s = System.err;
  +
       try
       {
         super.printStackTrace(s);
       }
  -    catch(Exception e){}
  +    catch (Exception e){}
  +
       Exception exception = getException();
  -    for(int i = 0; (i < 10) && (null != exception); i++)
  +
  +    for (int i = 0; (i < 10) && (null != exception); i++)
       {
         s.println("---------");
         exception.printStackTrace(s);
  -      if(exception instanceof SAXException)
  +
  +      if (exception instanceof SAXException)
         {
  -        SAXException se = (SAXException)exception;
  +        SAXException se = (SAXException) exception;
           Exception prev = exception;
  +
           exception = se.getException();
  -        if(prev == exception)
  +
  +        if (prev == exception)
             break;
         }
         else
  @@ -248,70 +253,81 @@
         }
       }
     }
  -  
  +
     /**
      * Find the most contained message.
      * @returns The error message of the originating exception.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String getMessage() 
  +  public String getMessage()
     {
  +
       StringBuffer sbuffer = new StringBuffer();
  -    
  -    if(null != super.getMessage())
  +
  +    if (null != super.getMessage())
       {
         sbuffer.append(super.getMessage());
       }
  -    if(null != getSystemId())
  +
  +    if (null != getSystemId())
       {
         sbuffer.append("; SystemID: ");
         sbuffer.append(getSystemId());
       }
  -    if(0 != getLineNumber())
  +
  +    if (0 != getLineNumber())
       {
         sbuffer.append("; Line#: ");
         sbuffer.append(getLineNumber());
       }
  -    if(0 != getColumnNumber())
  +
  +    if (0 != getColumnNumber())
       {
         sbuffer.append("; Column#: ");
         sbuffer.append(getColumnNumber());
       }
   
       Exception exception = getException();
  -    while(null != exception)
  +
  +    while (null != exception)
       {
  -      if(null != exception.getMessage())
  +      if (null != exception.getMessage())
         {
           sbuffer.append("\n (");
  -        sbuffer.append( exception.getClass().getName());
  -        sbuffer.append( "): ");
  +        sbuffer.append(exception.getClass().getName());
  +        sbuffer.append("): ");
           sbuffer.append(exception.getMessage());
         }
  -      
  -      if((!((exception instanceof TransformException) || 
  -           (exception instanceof ProcessorException))) &&
  -         (exception instanceof SAXException))
  +
  +      if ((!((exception instanceof TransformException) || (exception instanceof ProcessorException)))
  +              && (exception instanceof SAXException))
         {
  -        if(exception instanceof SAXParseException)
  +        if (exception instanceof SAXParseException)
           {
  -          SAXParseException spe = (SAXParseException)exception;
  -          if(null != spe.getSystemId())
  +          SAXParseException spe = (SAXParseException) exception;
  +
  +          if (null != spe.getSystemId())
             {
               sbuffer.append("; SystemID: ");
               sbuffer.append(spe.getSystemId());
             }
  -          if(0 != spe.getLineNumber())
  +
  +          if (0 != spe.getLineNumber())
             {
               sbuffer.append("; Line#: ");
               sbuffer.append(spe.getLineNumber());
             }
  -          if(0 != spe.getColumnNumber())
  +
  +          if (0 != spe.getColumnNumber())
             {
               sbuffer.append("; Column#: ");
               sbuffer.append(spe.getColumnNumber());
             }
           }
  -        SAXException se = (SAXException)exception;
  +
  +        SAXException se = (SAXException) exception;
  +
           exception = se.getException();
         }
         else
  @@ -319,45 +335,54 @@
           exception = null;
         }
       }
  +
       return sbuffer.toString();
     }
   
     /**
  -   * Print the the trace of methods from where the error 
  -   * originated.  This will trace all nested exception 
  +   * Print the the trace of methods from where the error
  +   * originated.  This will trace all nested exception
      * objects, as well as this object.
      * @param s The writer where the dump will be sent to.
      */
  -  public void printStackTrace(java.io.PrintWriter s) 
  +  public void printStackTrace(java.io.PrintWriter s)
     {
  -    if(s == null)
  +
  +    if (s == null)
         s = new java.io.PrintWriter(System.err);
  +
       try
       {
         super.printStackTrace(s);
       }
  -    catch(Exception e){}
  +    catch (Exception e){}
  +
       Exception exception = getException();
  -    
  -    for(int i = 0; (i < 10) && (null != exception); i++)
  +
  +    for (int i = 0; (i < 10) && (null != exception); i++)
       {
         s.println("---------");
  +
         try
         {
           exception.printStackTrace(s);
         }
  -      catch(Exception e)
  +      catch (Exception e)
         {
           s.println("Could not print stack trace...");
         }
  -      if(exception instanceof SAXException)
  +
  +      if (exception instanceof SAXException)
         {
  -        SAXException se = (SAXException)exception;
  +        SAXException se = (SAXException) exception;
           Exception prev = exception;
  +
           exception = se.getException();
  -        if(prev == exception)
  +
  +        if (prev == exception)
           {
             exception = null;
  +
             break;
           }
         }
  
  
  
  1.2       +7 -5      xml-xalan/java/src/org/apache/trax/ProcessorFactoryException.java
  
  Index: ProcessorFactoryException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/ProcessorFactoryException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ProcessorFactoryException.java	2000/10/13 02:33:07	1.1
  +++ ProcessorFactoryException.java	2000/10/30 18:56:17	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -63,19 +64,20 @@
   import org.xml.sax.SAXException;
   
   /**
  - * The ProcessorFactoryException is a type of ProcessorException that 
  - * is thrown when a configurable factory object can not 
  + * The ProcessorFactoryException is a type of ProcessorException that
  + * is thrown when a configurable factory object can not
    * be created.
    *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>No open issues are known for this class</h4></dt>
  + * <dl> *    <dt><h4>No open issues are known for this class</h4></dt>
    *    <dd></dd>
  - * </dl>
 * 
  + * </dl> 
    * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
   public class ProcessorFactoryException extends SAXException
   {
  +
     /**
      * Create a new ProcessorFactoryException from an existing exception.
      *
  @@ -86,7 +88,7 @@
      * @version Alpha
      * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
      */
  -  public ProcessorFactoryException (String message, Exception e)
  +  public ProcessorFactoryException(String message, Exception e)
     {
       super(message, e);
     }
  
  
  
  1.2       +31 -21    xml-xalan/java/src/org/apache/trax/Result.java
  
  Index: Result.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/Result.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Result.java	2000/10/13 02:33:07	1.1
  +++ Result.java	2000/10/30 18:56:17	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -61,8 +62,10 @@
   package org.apache.trax;
   
   import java.lang.String;
  +
   import java.io.OutputStream;
   import java.io.Writer;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -72,40 +75,38 @@
    * it also can specify a DOM node to which nodes will be appended.</p>
    *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>Should this be an interface?</h4></dt>
  - *    <dd>Should this be an interface instead of a concrete class?  The justification 
  - *        for it being a class is that it is just a bag of data, and contains no 
  + * <dl> *    <dt><h4>Should this be an interface?</h4></dt>
  + *    <dd>Should this be an interface instead of a concrete class?  The justification
  + *        for it being a class is that it is just a bag of data, and contains no
    *        behavior of its own.</dd>
  - * </dl>
 * 
  + * </dl> 
    * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
   public class Result
   {
  +
     /**
      * Zero-argument default constructor.
      */
  -  public Result ()
  -  {
  -  }
  +  public Result(){}
   
     /**
      * Create a new output target with a byte stream.
      *
      * @param byteStream The raw byte stream that will contain the document.
      */
  -  public Result (OutputStream byteStream)
  +  public Result(OutputStream byteStream)
     {
       setByteStream(byteStream);
     }
   
  -
     /**
      * Create a new output target with a character stream.
      *
      * @param characterStream The character stream where the result will be written.
  -   */ 
  -  public Result (Writer characterStream)
  +   */
  +  public Result(Writer characterStream)
     {
       setCharacterStream(characterStream);
     }
  @@ -115,17 +116,17 @@
      *
      * @param n The DOM node that will contain the result tree.
      */
  -  public Result (Node n)
  +  public Result(Node n)
     {
       setNode(n);
     }
  -  
  +
     /**
      * Set the byte stream for this output target.
      *
      * @param byteStream A byte stream that will contain the result document.
      */
  -  public void setByteStream (OutputStream byteStream)
  +  public void setByteStream(OutputStream byteStream)
     {
       this.byteStream = byteStream;
     }
  @@ -135,7 +136,7 @@
      *
      * @return The byte stream, or null if none was supplied.
      */
  -  public OutputStream getByteStream ()
  +  public OutputStream getByteStream()
     {
       return byteStream;
     }
  @@ -143,10 +144,10 @@
     /**
      * Set the character stream for this output target.
      *
  -   * @param characterStream The character stream that will contain 
  +   * @param characterStream The character stream that will contain
      *                     the result document.
      */
  -  public void setCharacterStream (Writer characterStream)
  +  public void setCharacterStream(Writer characterStream)
     {
       this.characterStream = characterStream;
     }
  @@ -156,32 +157,41 @@
      *
      * @return The character stream, or null if none was supplied.
      */
  -  public Writer getCharacterStream ()
  +  public Writer getCharacterStream()
     {
       return characterStream;
     }
   
     /**
      * Set the node that will contain the result DOM tree.
  +   *
  +   * NEEDSDOC @param node
      */
  -  public void setNode (Node node)
  +  public void setNode(Node node)
     {
       this.node = node;
     }
   
     /**
      * Get the node that will contain the result tree.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node getNode ()
  +  public Node getNode()
     {
       return node;
     }
  -  
  +
     //////////////////////////////////////////////////////////////////////
     // Internal state.
     //////////////////////////////////////////////////////////////////////
   
  +  /** NEEDSDOC Field byteStream          */
     protected OutputStream byteStream;
  +
  +  /** NEEDSDOC Field characterStream          */
     protected Writer characterStream;
  +
  +  /** NEEDSDOC Field node          */
     protected Node node;
   }
  
  
  
  1.2       +16 -12    xml-xalan/java/src/org/apache/trax/Templates.java
  
  Index: Templates.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/Templates.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Templates.java	2000/10/13 02:33:07	1.1
  +++ Templates.java	2000/10/30 18:56:19	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -63,34 +64,37 @@
   import org.apache.serialize.OutputFormat;
   
   /**
  - * The Templates object is the runtime representation of compiled 
  - * transformation instructions.  Templatess must be threadsafe for a given instance 
  - * over multiple threads concurrently, and are generally meant to 
  + * The Templates object is the runtime representation of compiled
  + * transformation instructions.  Templatess must be threadsafe for a given instance
  + * over multiple threads concurrently, and are generally meant to
    * be used multiple times in a given session.
    *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>newTransformer</h4></dt>
  - *    <dd>Is newTransformer the right way to create a transformer?  The alternative might 
  - *        be to have a factory method in the Transformer class that takes as an argument 
  + * <dl> *    <dt><h4>newTransformer</h4></dt>
  + *    <dd>Is newTransformer the right way to create a transformer?  The alternative might
  + *        be to have a factory method in the Transformer class that takes as an argument
    *        a Templates object.</dd>
  - * </dl>
 * 
  + * </dl> 
    * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
   public interface Templates
   {
  +
     /**
      * Create a new transformation context for this Templates object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     Transformer newTransformer();
  -  
  +
     /**
  -   * Get the properties for xsl:output.  The object returned will 
  -   * be a clone of the internal values, and thus it can be mutated 
  -   * without mutating the Templates object, and then handed in to 
  +   * Get the properties for xsl:output.  The object returned will
  +   * be a clone of the internal values, and thus it can be mutated
  +   * without mutating the Templates object, and then handed in to
      * the process method.
      * @return A OutputProperties object that may be mutated.
  -   * 
  +   *
      * @see org.xml.org.apache.serialize.OutputFormat
      */
     OutputFormat getOutputFormat();
  
  
  
  1.2       +21 -17    xml-xalan/java/src/org/apache/trax/TemplatesBuilder.java
  
  Index: TemplatesBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/TemplatesBuilder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TemplatesBuilder.java	2000/10/13 02:33:07	1.1
  +++ TemplatesBuilder.java	2000/10/30 18:56:20	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -61,38 +62,41 @@
   package org.apache.trax;
   
   /**
  - * This is a SAX ContentHandler that may be used to process SAX 
  - * events into an Templates objects.  This is an abstract class 
  - * instead of an interface, so it can be a ContentHandler object, 
  + * This is a SAX ContentHandler that may be used to process SAX
  + * events into an Templates objects.  This is an abstract class
  + * instead of an interface, so it can be a ContentHandler object,
    * for passing into the JAXP SAXParser interface.
  - * 
  + *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>Should Processor derive from org.xml.sax.ContentHandler?</h4></dt>
  - *    <dd>Instead of requesting an object from the Processor class, should 
  + * <dl> *    <dt><h4>Should Processor derive from org.xml.sax.ContentHandler?</h4></dt>
  + *    <dd>Instead of requesting an object from the Processor class, should
    *        the Processor class simply derive from org.xml.sax.ContentHandler?</dd>
    *    <dt><h4>ContentHandler vs. ContentHandler</h4></dt>
  - *    <dd>I don't think I would use ContentHandler at all, except that JAXP uses it.  
  + *    <dd>I don't think I would use ContentHandler at all, except that JAXP uses it.
    *        Maybe we should go back to using ContentHandler?</dd>
  - * </dl>
 */
  + * </dl> 
  + */
   public interface TemplatesBuilder extends org.xml.sax.ContentHandler
   {
  +
     /**
  -   * When this object is used as a ContentHandler or DocumentHandler, it  
  -   * creates a Templates object, which the caller can get once 
  +   * When this object is used as a ContentHandler or DocumentHandler, it
  +   * creates a Templates object, which the caller can get once
      * the SAX events have been completed.
  -   * @return The stylesheet object that was created during 
  -   * the SAX event process, or null if no stylesheet has 
  +   * @return The stylesheet object that was created during
  +   * the SAX event process, or null if no stylesheet has
      * been created.
      *
      * @version Alpha
      * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
  +   *
  +   * @throws TransformException
      */
  -  public Templates getTemplates() 
  -    throws TransformException;
  -  
  +  public Templates getTemplates() throws TransformException;
  +
     /**
  -   * Set the base ID (URL or system ID) for the stylesheet 
  -   * created by this builder.  This must be set in order to 
  +   * Set the base ID (URL or system ID) for the stylesheet
  +   * created by this builder.  This must be set in order to
      * resolve relative URLs in the stylesheet.
      * @param baseID Base URL for this stylesheet.
      */
  
  
  
  1.2       +140 -97   xml-xalan/java/src/org/apache/trax/TransformException.java
  
  Index: TransformException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/TransformException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransformException.java	2000/10/13 02:33:07	1.1
  +++ TransformException.java	2000/10/30 18:56:20	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -66,25 +67,26 @@
   import org.xml.sax.helpers.LocatorImpl;
   
   /**
  - * This simply subclasses the TransformException for the purposes 
  + * This simply subclasses the TransformException for the purposes
    * of being able to be caught in a catch clause.
    *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>No open issues are known for this class</h4></dt>
  + * <dl> *    <dt><h4>No open issues are known for this class</h4></dt>
    *    <dd></dd>
  - * </dl>
 * 
  + * </dl> 
    * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
   public class TransformException extends SAXParseException
   {
  +
     /**
      * Create a new TransformException.
      *
      * @param message The error or warning message.
      * @see org.xml.sax.SAXException
      */
  -  public TransformException (String message) 
  +  public TransformException(String message)
     {
       super(message, new LocatorImpl());
     }
  @@ -95,18 +97,19 @@
      * @param e The exception to be wrapped in a SAXException.
      * @see org.xml.sax.SAXException
      */
  -  public TransformException (Exception e)
  +  public TransformException(Exception e)
     {
       super(e.getMessage(), new LocatorImpl(), e);
     }
  -  
  +
     /**
      * Create a new TransformException wrapping an existing exception.
      *
      * @param e The exception to be wrapped in a SAXException.
      * @see org.xml.sax.SAXException
  +   * NEEDSDOC @param locator
      */
  -  public TransformException (Exception e, Locator locator)
  +  public TransformException(Exception e, Locator locator)
     {
       super(e.getMessage(), locator, e);
     }
  @@ -114,7 +117,7 @@
     /**
      * Wrap an existing exception in a TransformException.
      *
  -   * <p>This is used for throwing processor exceptions before 
  +   * <p>This is used for throwing processor exceptions before
      * the processing has started.</p>
      *
      * @param message The error or warning message, or null to
  @@ -123,11 +126,11 @@
      * @see org.xml.sax.Locator
      * @see org.xml.sax.Parser#setLocale
      */
  -  public TransformException (String message, Exception e) 
  +  public TransformException(String message, Exception e)
     {
  -    super( message, new LocatorImpl(), e);
  +    super(message, new LocatorImpl(), e);
     }
  -  
  +
     /**
      * Create a new TransformException from a message and a Locator.
      *
  @@ -138,13 +141,13 @@
      * @param message The error or warning message.
      * @param locator The locator object for the error or warning.
      * @see org.xml.sax.Locator
  -   * @see org.xml.sax.Parser#setLocale 
  +   * @see org.xml.sax.Parser#setLocale
      */
  -  public TransformException (String message, Locator locator) 
  +  public TransformException(String message, Locator locator)
     {
       super(message, locator);
     }
  -  
  +
     /**
      * Wrap an existing exception in a TransformException.
      *
  @@ -160,12 +163,11 @@
      * @see org.xml.sax.Locator
      * @see org.xml.sax.Parser#setLocale
      */
  -  public TransformException (String message, Locator locator,
  -                             Exception e) 
  +  public TransformException(String message, Locator locator, Exception e)
     {
  -    super( message, locator, e);
  +    super(message, locator, e);
     }
  -  
  +
     /**
      * Create a new TransformException.
      *
  @@ -185,14 +187,12 @@
      *                     cause the error or warning.
      * @see org.xml.sax.Parser#setLocale
      */
  -  public TransformException (String message, 
  -                             String publicId, String systemId,
  -                             int lineNumber, int columnNumber)
  +  public TransformException(String message, String publicId, String systemId,
  +                            int lineNumber, int columnNumber)
     {
       super(message, publicId, systemId, lineNumber, columnNumber);
     }
  -  
  -  
  +
     /**
      * Create a new TransformException with an embedded exception.
      *
  @@ -216,39 +216,45 @@
      * @param e Another exception to embed in this one.
      * @see org.xml.sax.Parser#setLocale
      */
  -  public TransformException (String message, String publicId, String systemId,
  -                             int lineNumber, int columnNumber, Exception e)
  +  public TransformException(String message, String publicId, String systemId,
  +                            int lineNumber, int columnNumber, Exception e)
     {
       super(message, publicId, systemId, lineNumber, columnNumber, e);
     }
  -  
  -  
  +
     /**
  -   * Print the the trace of methods from where the error 
  -   * originated.  This will trace all nested exception 
  +   * Print the the trace of methods from where the error
  +   * originated.  This will trace all nested exception
      * objects, as well as this object.
      * @param s The stream where the dump will be sent to.
      */
  -  public void printStackTrace(java.io.PrintStream s) 
  +  public void printStackTrace(java.io.PrintStream s)
     {
  -    if(s == null)
  +
  +    if (s == null)
         s = System.err;
  +
       try
       {
         super.printStackTrace(s);
       }
  -    catch(Exception e){}
  +    catch (Exception e){}
  +
       Exception exception = getException();
  -    for(int i = 0; (i < 10) && (null != exception); i++)
  +
  +    for (int i = 0; (i < 10) && (null != exception); i++)
       {
         s.println("---------");
         exception.printStackTrace(s);
  -      if(exception instanceof SAXException)
  +
  +      if (exception instanceof SAXException)
         {
  -        SAXException se = (SAXException)exception;
  +        SAXException se = (SAXException) exception;
           Exception prev = exception;
  +
           exception = se.getException();
  -        if(prev == exception)
  +
  +        if (prev == exception)
             break;
         }
         else
  @@ -257,182 +263,221 @@
         }
       }
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method isSimilar 
  +   *
  +   *
  +   * NEEDSDOC @param e1
  +   * NEEDSDOC @param e2
  +   *
  +   * NEEDSDOC (isSimilar) @return
  +   */
     private boolean isSimilar(Exception e1, Exception e2)
     {
  +
       boolean isSimilar = false;
  -    if((e1 instanceof SAXParseException) && 
  -       (e2 instanceof SAXParseException))
  +
  +    if ((e1 instanceof SAXParseException)
  +            && (e2 instanceof SAXParseException))
       {
  +
         // If the file and line number are the same, then only 
         // report the top-level error.
  -      SAXParseException spe1 = (SAXParseException)e1;
  +      SAXParseException spe1 = (SAXParseException) e1;
         String oldSystemID = spe1.getSystemId();
         int oldLine = spe1.getLineNumber();
         int oldColumn = spe1.getColumnNumber();
  -
  -      SAXParseException spe2 = (SAXParseException)e2;
  +      SAXParseException spe2 = (SAXParseException) e2;
         String newSystemID = spe2.getSystemId();
         int newLine = spe2.getLineNumber();
         int newColumn = spe2.getColumnNumber();
  -      
  -      if(oldSystemID == null)
  +
  +      if (oldSystemID == null)
           oldSystemID = "";
  -      if(newSystemID == null)
  +
  +      if (newSystemID == null)
           newSystemID = "";
   
  -      isSimilar = (oldSystemID.equals(newSystemID) 
  -                   && (oldLine == newLine)
  -                   && (oldColumn == newColumn));  
  +      isSimilar = (oldSystemID.equals(newSystemID) && (oldLine == newLine)
  +                   && (oldColumn == newColumn));
       }
  +
       return isSimilar;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method appendMessageAndInfo 
  +   *
  +   *
  +   * NEEDSDOC @param sbuffer
  +   */
     private void appendMessageAndInfo(StringBuffer sbuffer)
     {
  +
       String message = super.getMessage();
       String systemID = getSystemId();
       int line = getLineNumber();
       int column = getColumnNumber();
  -    
  -    if(null != message)
  +
  +    if (null != message)
       {
         sbuffer.append(message);
       }
  -    if(null != systemID)
  +
  +    if (null != systemID)
       {
         sbuffer.append("; SystemID: ");
         sbuffer.append(systemID);
       }
  -    if(0 != line)
  +
  +    if (0 != line)
       {
         sbuffer.append("; Line#: ");
         sbuffer.append(line);
       }
  -    if(0 != column)
  +
  +    if (0 != column)
       {
         sbuffer.append("; Column#: ");
         sbuffer.append(column);
       }
     }
  -  
  +
     /**
      * Find the most contained message.
      * @returns The error message of the originating exception.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String getMessage() 
  +  public String getMessage()
     {
  +
       StringBuffer sbuffer = new StringBuffer();
  -    
  +
       appendMessageAndInfo(sbuffer);
  -    
  -    Exception prev = this;
   
  +    Exception prev = this;
       Exception exception = getException();
  -    while(null != exception)
  -    {      
  -      if((!((exception instanceof TransformException) || 
  -           (exception instanceof ProcessorException))) &&
  -         (exception instanceof SAXException))
  +
  +    while (null != exception)
  +    {
  +      if ((!((exception instanceof TransformException) || (exception instanceof ProcessorException)))
  +              && (exception instanceof SAXException))
         {
  -        if(exception instanceof SAXParseException)
  -        {          
  -          if(!isSimilar(prev, exception))
  +        if (exception instanceof SAXParseException)
  +        {
  +          if (!isSimilar(prev, exception))
             {
  -            SAXParseException spe = (SAXParseException)exception;
  +            SAXParseException spe = (SAXParseException) exception;
               String message = spe.getMessage();
  -            if(null != message)
  +
  +            if (null != message)
               {
                 sbuffer.append("\n (");
  -              sbuffer.append( spe.getClass().getName());
  -              sbuffer.append( "): ");
  +              sbuffer.append(spe.getClass().getName());
  +              sbuffer.append("): ");
                 sbuffer.append(message);
               }
   
  -            if(null != spe.getSystemId())
  +            if (null != spe.getSystemId())
               {
                 sbuffer.append("; SystemID: ");
                 sbuffer.append(spe.getSystemId());
               }
  -            if(0 != spe.getLineNumber())
  +
  +            if (0 != spe.getLineNumber())
               {
                 sbuffer.append("; Line#: ");
                 sbuffer.append(spe.getLineNumber());
               }
  -            if(0 != spe.getColumnNumber())
  +
  +            if (0 != spe.getColumnNumber())
               {
                 sbuffer.append("; Column#: ");
                 sbuffer.append(spe.getColumnNumber());
               }
             }
           }
  -        else if(!isSimilar(prev, exception))
  +        else if (!isSimilar(prev, exception))
           {
             String message = exception.getMessage();
  -          if(null != message)
  +
  +          if (null != message)
             {
               sbuffer.append("\n (");
  -            sbuffer.append( exception.getClass().getName());
  -            sbuffer.append( "): ");
  +            sbuffer.append(exception.getClass().getName());
  +            sbuffer.append("): ");
               sbuffer.append(message);
             }
           }
  -        
  +
           prev = exception;
  -        exception = ((SAXException)exception).getException();
  +        exception = ((SAXException) exception).getException();
         }
  -      else if(!isSimilar(prev, exception))
  +      else if (!isSimilar(prev, exception))
         {
           String message = exception.getMessage();
  -        if(null != message)
  +
  +        if (null != message)
           {
             sbuffer.append("\n (");
  -          sbuffer.append( exception.getClass().getName());
  -          sbuffer.append( "): ");
  +          sbuffer.append(exception.getClass().getName());
  +          sbuffer.append("): ");
             sbuffer.append(message);
           }
  +
           exception = null;
         }
       }
  +
       return sbuffer.toString();
     }
   
     /**
  -   * Print the the trace of methods from where the error 
  -   * originated.  This will trace all nested exception 
  +   * Print the the trace of methods from where the error
  +   * originated.  This will trace all nested exception
      * objects, as well as this object.
      * @param s The writer where the dump will be sent to.
      */
  -  public void printStackTrace(java.io.PrintWriter s) 
  +  public void printStackTrace(java.io.PrintWriter s)
     {
  -    if(s == null)
  +
  +    if (s == null)
         s = new java.io.PrintWriter(System.err);
  +
       try
       {
         super.printStackTrace(s);
       }
  -    catch(Exception e){}
  +    catch (Exception e){}
  +
       Exception exception = getException();
  -    
  -    for(int i = 0; (i < 10) && (null != exception); i++)
  +
  +    for (int i = 0; (i < 10) && (null != exception); i++)
       {
         s.println("---------");
  +
         try
         {
           exception.printStackTrace(s);
         }
  -      catch(Exception e)
  +      catch (Exception e)
         {
           s.println("Could not print stack trace...");
         }
  -      if(exception instanceof SAXException)
  +
  +      if (exception instanceof SAXException)
         {
  -        SAXException se = (SAXException)exception;
  +        SAXException se = (SAXException) exception;
           Exception prev = exception;
  +
           exception = se.getException();
  -        if(prev == exception)
  +
  +        if (prev == exception)
           {
             exception = null;
  +
             break;
           }
         }
  @@ -442,6 +487,4 @@
         }
       }
     }
  -
  -
   }
  
  
  
  1.2       +56 -43    xml-xalan/java/src/org/apache/trax/Transformer.java
  
  Index: Transformer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/Transformer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Transformer.java	2000/10/13 02:33:07	1.1
  +++ Transformer.java	2000/10/30 18:56:20	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -70,22 +71,24 @@
   import org.xml.sax.ContentHandler;
   import org.xml.sax.ext.LexicalHandler;
   import org.xml.sax.ext.DeclHandler;
  +
   import org.apache.serialize.OutputFormat;
  +
   import org.w3c.dom.Node;
   
   /**
  - * This object represents a Transformer, which is a SAX2 XMLFilter.  
  + * This object represents a Transformer, which is a SAX2 XMLFilter.
    * An object of this class can not be used concurrently over multiple threads.
  - * 
  + *
    * <h3>Open issues:</h3>
  - * <dl>
 *    <dt><h4>Separate DOM Interface?</h4></dt>
  - *    <dd>Should there be a separate DOMTransformer class, instead of 
  + * <dl> *    <dt><h4>Separate DOM Interface?</h4></dt>
  + *    <dd>Should there be a separate DOMTransformer class, instead of
    *        having the transformNode method?</dd>
    *    <dt><h4>XMLFilter derivation?</h4></dt>
  - *    <dd>There is some question in some people's mind whether or not 
  + *    <dd>There is some question in some people's mind whether or not
    *        the Transformer interface should extend XMLFilter.</dd>
    *    <dt><h4>XMLReader vs. Parser vs. SAXParser/DocumentBuilder</h4></dt>
  - *    <dd>Currently the interfaces support XMLReader.  Should this be 
  + *    <dd>Currently the interfaces support XMLReader.  Should this be
    *        javax.xml.parsers.SAXParser/javax.xml.parsers.DocumentBuilder?
    *        Or, perhaps just org.xml.sax.Parser?</dd>
    *    <dt><h4>ContentHandler is entitled to expect a well-formed tree</h4></dt>
  @@ -103,104 +106,114 @@
    *        declare that it is prepared to accept well-balanced (but ill-formed) input.
    *    </dd>
    * </dl>
  - * 
 * @version Alpha
  + *  * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
   public interface Transformer extends XMLFilter
   {
  +
     /**
      * Process the source tree to SAX parse events.
      * @param xmlSource  The input for the source tree.
  +   *
  +   * @throws TransformException
      */
  -  public void transform( InputSource xmlSource)
  -    throws TransformException;
  +  public void transform(InputSource xmlSource) throws TransformException;
   
     /**
      * Process the source tree to the output result.
      * @param xmlSource  The input for the source tree.
      * @param outputTarget The output source target.
  +   *
  +   * @throws TransformException
      */
  -  public void transform( InputSource xmlSource, Result outputTarget)
  +  public void transform(InputSource xmlSource, Result outputTarget)
       throws TransformException;
   
     /**
  -   * Process the source node to the output result, if the 
  -   * processor supports the "http://xml.org/trax/features/dom/input" 
  +   * Process the source node to the output result, if the
  +   * processor supports the "http://xml.org/trax/features/dom/input"
      * feature.
      * @param node  The input source node, which can be any valid DOM node.
      * @param outputTarget The output source target.
  +   *
  +   * @throws TransformException
      */
  -  public void transformNode( Node node, Result outputTarget)
  +  public void transformNode(Node node, Result outputTarget)
       throws TransformException;
   
     /**
  -   * Process the source node to to SAX parse events, if the 
  -   * processor supports the "http://xml.org/trax/features/dom/input" 
  +   * Process the source node to to SAX parse events, if the
  +   * processor supports the "http://xml.org/trax/features/dom/input"
      * feature.
      * @param node  The input source node, which can be any valid DOM node.
  +   *
  +   * @throws TransformException
      */
  -  public void transformNode( Node node )
  -    throws TransformException;
  +  public void transformNode(Node node) throws TransformException;
   
     /**
      * Get a SAX2 ContentHandler for the input.
  -   * @return A valid ContentHandler, which should never be null, as 
  -   * long as getFeature("http://xml.org/trax/features/sax/input") 
  +   * @return A valid ContentHandler, which should never be null, as
  +   * long as getFeature("http://xml.org/trax/features/sax/input")
      * returns true.
      * <h3>Open issues:</h3>
  -   * <dl>
   *    <dt><h4>ContentHandler vs. ContentHandler</h4></dt>
  -   *    <dd>I don't think I would use ContentHandler at all, except that JAXP uses it.  
  +   * <dl>   *    <dt><h4>ContentHandler vs. ContentHandler</h4></dt>
  +   *    <dd>I don't think I would use ContentHandler at all, except that JAXP uses it.
      *        Maybe we should go back to using ContentHandler?</dd>
  -   * </dl>
   */
  +   * </dl>   
  +   */
     ContentHandler getInputContentHandler();
  -  
  -   /**
  +
  +  /**
      * Get a SAX2 DeclHandler for the input.
  -   * @return A valid DeclHandler, which should never be null, as 
  -   * long as getFeature("http://xml.org/trax/features/sax/input") 
  +   * @return A valid DeclHandler, which should never be null, as
  +   * long as getFeature("http://xml.org/trax/features/sax/input")
      * returns true.
      */
     DeclHandler getInputDeclHandler();
  - 
  -   /**
  +
  +  /**
      * Get a SAX2 LexicalHandler for the input.
  -   * @return A valid LexicalHandler, which should never be null, as 
  -   * long as getFeature("http://xml.org/trax/features/sax/input") 
  +   * @return A valid LexicalHandler, which should never be null, as
  +   * long as getFeature("http://xml.org/trax/features/sax/input")
      * returns true.
      */
     LexicalHandler getInputLexicalHandler();
   
     /**
  -   * Set the output properties for the transformation.  These 
  -   * properties will override properties set in the templates 
  +   * Set the output properties for the transformation.  These
  +   * properties will override properties set in the templates
      * with xsl:output.
  -   * 
  +   *
      * @see org.xml.org.apache.serialize.OutputFormat
  +   *
  +   * NEEDSDOC @param oformat
      */
     void setOutputFormat(OutputFormat oformat);
  -    
  +
     /**
      * Set a parameter for the templates.
      * @param name The name of the parameter.
      * @param namespace The namespace of the parameter.
  -   * @value The value object.  This can be any valid Java object 
  -   * -- it's up to the processor to provide the proper 
  -   * coersion to the object, or simply pass it on for use 
  +   * @value The value object.  This can be any valid Java object
  +   * -- it's up to the processor to provide the proper
  +   * coersion to the object, or simply pass it on for use
      * in extensions.
  +   * NEEDSDOC @param value
      */
     void setParameter(String name, String namespace, Object value);
  -  
  +
     /**
  -   * Reset the parameters to a null list.  
  +   * Reset the parameters to a null list.
      */
     void resetParameters();
  -  
  +
     /**
  -   * Set an object that will be used to resolve URIs used in 
  +   * Set an object that will be used to resolve URIs used in
      * document(), etc.
  -   * @param resolver An object that implements the URIResolver interface, 
  +   * @param resolver An object that implements the URIResolver interface,
      * or null.
      */
     void setURIResolver(URIResolver resolver);
  -  
   }
  
  
  
  1.2       +23 -16    xml-xalan/java/src/org/apache/trax/URIResolver.java
  
  Index: URIResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/trax/URIResolver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- URIResolver.java	2000/10/13 02:33:07	1.1
  +++ URIResolver.java	2000/10/30 18:56:20	1.2
  @@ -54,6 +54,7 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  +
   // Transformations for XML (TRaX)
   // Copyright �2000 Lotus Development Corporation, Exoffice Technologies,
   // Oracle Corporation, Michael Kay of International Computers Limited, Apache
  @@ -63,54 +64,60 @@
   //import java.io.IOException;
   import org.xml.sax.InputSource;
   import org.xml.sax.XMLReader;
  -import org.w3c.dom.Node;
   
  -
  +import org.w3c.dom.Node;
   
   /**
    * <p><i>This version of URIResolver reflects the proposal made by Michael Kay to revise
    * the interface as defined in TRAX 0.6.</i></p>
    *
    * <p>An interface that can be called by the processor to for turning the
  - * URIs used in document() and xsl:import etc into an InputSource or a 
  + * URIs used in document() and xsl:import etc into an InputSource or a
    * Node if the processor supports the "http://xml.org/trax/features/dom/input" feature.</p>
    *
    * Node that the URIResolver is stateful (it remembers the most recent URI) so separate
    * instances must be used in each thread.
  - * 
  - * 
  + *
  + *
    * @version Alpha
    * @author <a href="mailto:scott_boag@lotus.com">Scott Boag</a>
    */
  - 
   public interface URIResolver
   {
  +
     /**
  -   * This will be called by the processor when it encounters 
  -   * an xsl:include, xsl:import, or document() function, if it needs 
  +   * This will be called by the processor when it encounters
  +   * an xsl:include, xsl:import, or document() function, if it needs
      * a DOM tree. The URIResolver must be prepared to return either a
      * DOM tree, or a SAX InputSource, or both. This method must not be called
      * unless setURI() has been called first.
  -   * 
  +   *
      * @param inputSource The value returned from the EntityResolver.
  -   * @returns a DOM node that represents the resolution of the URI 
  +   * @returns a DOM node that represents the resolution of the URI
      * to a tree, if the
      * URI resolver is capable of returning a DOM Node; or null otherwise.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
      */
  -  public Node getDOMNode (InputSource inputSource) 
  -    throws TransformException;
  +  public Node getDOMNode(InputSource inputSource) throws TransformException;
   
     /**
  -   * This method returns the SAX2 parser to use with the InputSource 
  +   * This method returns the SAX2 parser to use with the InputSource
      * obtained from this URI.
      * It may return null if any SAX2-conformant XML parser can be used,
  -   * or if getInputSource() will also return null. The parser must 
  +   * or if getInputSource() will also return null. The parser must
      * be free for use (i.e.
      * not currently in use for another parse().
  -   * 
  +   *
      * @param inputSource The value returned from the EntityResolver.
      * @returns a SAX2 parser to use with the InputSource.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
      */
  -  public XMLReader getXMLReader(InputSource inputSource) 
  +  public XMLReader getXMLReader(InputSource inputSource)
       throws TransformException;
   }
  
  
  
  1.6       +328 -176  xml-xalan/java/src/org/apache/xalan/client/XSLTProcessorApplet.java
  
  Index: XSLTProcessorApplet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/client/XSLTProcessorApplet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSLTProcessorApplet.java	2000/10/13 02:33:08	1.5
  +++ XSLTProcessorApplet.java	2000/10/30 18:56:26	1.6
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -119,10 +119,14 @@
      * The stylesheet processor
      */
     Processor m_processor = null;
  -  String m_processorName="org.apache.xalan.processor.StylesheetProcessor";
  -  
  +
  +  /** NEEDSDOC Field m_processorName          */
  +  String m_processorName = "org.apache.xalan.processor.StylesheetProcessor";
  +
  +  /** NEEDSDOC Field m_reader          */
     XMLReader m_reader = null;
  -  
  +
  +  /** NEEDSDOC Field m_templatesBuilder          */
     TemplatesBuilder m_templatesBuilder = null;
   
     /**
  @@ -138,6 +142,7 @@
     // Parameter names.  To change a name of a parameter, you need only make
     // a single change.  Simply modify the value of the parameter string below.
     //--------------------------------------------------------------------------
  +
     /**
      * @serial
      */
  @@ -148,7 +153,6 @@
      */
     private final String PARAM_documentURL = "documentURL";
   
  -
     /**
      * @serial
      */
  @@ -161,6 +165,7 @@
   
     // We'll keep the DOM trees around, so tell which trees
     // are cached.
  +
     /**
      * @serial
      */
  @@ -176,8 +181,11 @@
      * @serial
      */
     private URL m_codeBase = null;
  +
  +  /** NEEDSDOC Field m_documentBase          */
     private URL m_documentBase = null;
   
  +  /** NEEDSDOC Field m_styleTree          */
     private Templates m_styleTree = null;
   
     /**
  @@ -218,9 +226,7 @@
     /**
      * The XSLTProcessorApplet constructor takes no arguments.
      */
  -  public XSLTProcessorApplet()
  -  {
  -  }
  +  public XSLTProcessorApplet(){}
   
     /**
      * Get basic information about the applet
  @@ -228,8 +234,7 @@
      */
     public String getAppletInfo()
     {
  -    return "Name: XSLTProcessorApplet\r\n" +
  -      "Author: Scott Boag";
  +    return "Name: XSLTProcessorApplet\r\n" + "Author: Scott Boag";
     }
   
     /**
  @@ -239,12 +244,14 @@
      */
     public String[][] getParameterInfo()
     {
  +
       String[][] info =
       {
         { PARAM_styleURL, "String", "URL to a XSL style sheet" },
         { PARAM_documentURL, "String", "URL to a XML document" },
         { PARAM_parser, "String", "Which parser to use: Xerces or ANY" },
       };
  +
       return info;
     }
   
  @@ -253,25 +260,31 @@
      */
     public void init()
     {
  +
       // PARAMETER SUPPORT
  -    //		The following code retrieves the value of each parameter
  +    //          The following code retrieves the value of each parameter
       // specified with the <PARAM> tag and stores it in a member
       // variable.
       //----------------------------------------------------------------------
       String param;
  +
       param = getParameter(PARAM_parser);
       whichParser = (param != null) ? param : "ANY";
   
       // styleURL: Parameter description
       //----------------------------------------------------------------------
       param = getParameter(PARAM_styleURL);
  +
       if (param != null)
         setStyleURL(param);
  +
       // documentURL: Parameter description
       //----------------------------------------------------------------------
       param = getParameter(PARAM_documentURL);
  +
       if (param != null)
         setDocumentURL(param);
  +
       m_codeBase = this.getCodeBase();
       m_documentBase = this.getDocumentBase();
   
  @@ -282,160 +295,196 @@
       // CreateControls() does its own resizing.
       //----------------------------------------------------------------------
       resize(320, 240);
  -
     }
   
     /**
      * Try to init the XML liaison object: currently not implemented.
      */
  -   
  -  protected void initLiaison()
  +  protected void initLiaison(){}
  +
  +  /**
  +   *  Obtain a new instance of a Stysheet Processor object
  +   *  as specified by m_processorName.
  +   *  Workaround for Processor.newInstance() which an
  +   *  applet cannot use because it reads a system property.
  +   *  @return Concrete instance of an Processor object.
  +   *
  +   * @throws ProcessorFactoryException
  +   */
  +  Processor newProcessorInstance() throws ProcessorFactoryException
     {
  +
  +    Processor m_processor = null;
  +
  +    try
  +    {
  +      Class factoryClass = Class.forName(m_processorName);
  +
  +      m_processor = (Processor) factoryClass.newInstance();
  +    }
  +    catch (java.lang.IllegalAccessException iae)
  +    {
  +      throw new ProcessorFactoryException(
  +        "Transformation Processor can not be accessed!", iae);
  +    }
  +    catch (java.lang.InstantiationException ie)
  +    {
  +      throw new ProcessorFactoryException(
  +        "Not able to create Transformation Processor!", ie);
  +    }
  +    catch (java.lang.ClassNotFoundException cnfe)
  +    {
  +      throw new ProcessorFactoryException(
  +        "Transformation Processor not found!", cnfe);
  +    }
  +
  +    return m_processor;
     }
  -  
  - /**
  -   * Obtain a new instance of a Stysheet Processor object
  -   * as specified by m_processorName.
  -   * Workaround for Processor.newInstance() which an
  -   * applet cannot use because it reads a system property.
  -   * @return Concrete instance of an Processor object.
  -   */
  -   Processor newProcessorInstance()
  -	  throws ProcessorFactoryException
  -   {
  -	 Processor m_processor = null;
  -	 try
  -	 {  
  -	  Class factoryClass = Class.forName(m_processorName);
  -      m_processor = (Processor)factoryClass.newInstance();
  -     }
  -     catch(java.lang.IllegalAccessException iae)
  -     {
  -      throw new ProcessorFactoryException("Transformation Processor can not be accessed!", iae);
  -     }
  -     catch(java.lang.InstantiationException ie)
  -     {
  -      throw new ProcessorFactoryException("Not able to create Transformation Processor!", ie);
  -     }
  -     catch(java.lang.ClassNotFoundException cnfe)
  -     {
  -      throw new ProcessorFactoryException("Transformation Processor not found!", cnfe);
  -     }
  -	 return m_processor;
  -   }
  -   
  -    /**
  +
  +  /**
      * Process the source tree to SAX parse events.
      * @param transformer Concrete Transformer
      * @param xmlSource  The input for the source tree.
      * Workaround for TransformerImpl.transform() which an
      * applet cannot use because it reads a system property.
  +   *
  +   * @throws IOException
  +   * @throws SAXException
  +   * @throws TransformException
      */
  -   
  -   void transform(TransformerImpl transformer, InputSource xmlSource)
  -    throws SAXException, TransformException, IOException
  -  {
  -      try
  -      {
  -        m_reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
  -      }
  -      catch(SAXException se)
  -      {
  -        // What can we do?
  -        // TODO: User diagnostics.
  -      }
  -      try
  -	  {
  -        // Get the input content handler, which will handle the 
  -        // parse events and create the source tree.
  -        ContentHandler inputHandler = new SourceTreeHandler(transformer);
  -        m_reader.setContentHandler(inputHandler);
  -        m_reader.setProperty("http://xml.org/sax/properties/lexical-handler", inputHandler);
  -        
  -        // Set the reader for cloning purposes.
  -        transformer.getXPathContext().setPrimaryReader(m_reader);
  -          
  -        // Kick off the parse.  When the ContentHandler gets 
  -        // the startDocument event, it will call transformNode( node ).
  -        m_reader.parse( xmlSource );
  -      }
  -      catch(SAXException se)
  -      {
  -        se.printStackTrace();
  -        throw new TransformException(se);
  -      }
  -      catch(IOException ioe)
  -      {
  +  void transform(TransformerImpl transformer, InputSource xmlSource)
  +          throws SAXException, TransformException, IOException
  +  {
  +
  +    try
  +    {
  +      m_reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
  +                          true);
  +    }
  +    catch (SAXException se)
  +    {
  +
  +      // What can we do?
  +      // TODO: User diagnostics.
  +    }
  +
  +    try
  +    {
  +
  +      // Get the input content handler, which will handle the 
  +      // parse events and create the source tree.
  +      ContentHandler inputHandler = new SourceTreeHandler(transformer);
  +
  +      m_reader.setContentHandler(inputHandler);
  +      m_reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +                           inputHandler);
  +
  +      // Set the reader for cloning purposes.
  +      transformer.getXPathContext().setPrimaryReader(m_reader);
  +
  +      // Kick off the parse.  When the ContentHandler gets 
  +      // the startDocument event, it will call transformNode( node ).
  +      m_reader.parse(xmlSource);
  +    }
  +    catch (SAXException se)
  +    {
  +      se.printStackTrace();
  +
  +      throw new TransformException(se);
  +    }
  +    catch (IOException ioe)
  +    {
         throw new TransformException(ioe);
  -      }
  -    }	   
  +    }
  +  }
   
     /**
      * Cleanup; called when applet is terminated and unloaded.
      */
     public void destroy()
     {
  -    if(null != m_trustedWorker)
  +
  +    if (null != m_trustedWorker)
       {
         m_trustedWorker.stop();
  +
         // m_trustedWorker.destroy();
         m_trustedWorker = null;
       }
  +
       m_styleURLOfCached = null;
       m_documentURLOfCached = null;
     }
   
     /**
      * Do not call; this applet contains no UI or visual components.
  +   *
  +   * NEEDSDOC @param g
      */
  +  public void paint(Graphics g){}
   
  -  public void paint(Graphics g)
  -  {
  -  }
  - 
     /**
      *  Automatically called when the HTML client containing the applet loads.
      *  This method starts execution of the applet thread.
      */
     public void start()
     {
  +
       m_trustedAgent = new TrustedAgent();
  +
       Thread currentThread = Thread.currentThread();
  -    m_trustedWorker = new Thread(currentThread.getThreadGroup(), m_trustedAgent);
  +
  +    m_trustedWorker = new Thread(currentThread.getThreadGroup(),
  +                                 m_trustedAgent);
  +
       m_trustedWorker.start();
  +
       try
       {
         this.showStatus("Causing Xalan and Xerces to Load and JIT...");
  +
         // Prime the pump so that subsequent transforms don't look so slow.
         StringReader xmlbuf = new StringReader("<?xml version='1.0'?><foo/>");
  -      StringReader xslbuf = new StringReader("<?xml version='1.0'?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:template match='foo'><out/></xsl:template></xsl:stylesheet>");
  +      StringReader xslbuf = new StringReader(
  +        "<?xml version='1.0'?><xsl:stylesheet xmlns:xsl='http://www.w3.org/1999/XSL/Transform' version='1.0'><xsl:template match='foo'><out/></xsl:template></xsl:stylesheet>");
         PrintWriter pw = new PrintWriter(new StringWriter());
  -	  
  +
         m_processor = newProcessorInstance();
  -	  m_reader = XMLReaderFactory.createXMLReader("org.apache.xerces.parsers.SAXParser");
  -	  m_templatesBuilder = m_processor.getTemplatesBuilder();
  -	  m_reader.setContentHandler(m_templatesBuilder);
  +      m_reader = XMLReaderFactory.createXMLReader(
  +        "org.apache.xerces.parsers.SAXParser");
  +      m_templatesBuilder = m_processor.getTemplatesBuilder();
  +
  +      m_reader.setContentHandler(m_templatesBuilder);
   
  -      synchronized(m_processor)
  +      synchronized (m_processor)
         {
           m_reader.parse(new InputSource(xslbuf));
  -	    Templates templates = m_templatesBuilder.getTemplates();
  -	    TransformerImpl transformer = (TransformerImpl)templates.newTransformer();
  -		// Result result = new Result(pw);
  -        org.apache.serialize.Serializer serializer = new org.apache.xml.serialize.transition.HTMLSerializer();
  +
  +        Templates templates = m_templatesBuilder.getTemplates();
  +        TransformerImpl transformer =
  +          (TransformerImpl) templates.newTransformer();
  +
  +        // Result result = new Result(pw);
  +        Serializer serializer =
  +          SerializerFactory.getSerializer(templates.getOutputFormat());
  +
  +        // org.apache.serialize.Serializer serializer = new org.apache.xml.serialize.transition.HTMLSerializer();
           // org.apache.serialize.Serializer serializer = org.apache.serialize.SerializerFactory.getSerializer( "HTML" );
  -      serializer.setWriter(pw);
  -      org.xml.sax.ContentHandler handler = serializer.asContentHandler();
  -       // new org.apache.xml.org.apache.serialize.HTMLSerializer(pw, new OutputFormat()).asContentHandler();
  +        serializer.setWriter(pw);
  +
  +        org.xml.sax.ContentHandler handler = serializer.asContentHandler();
  +
  +        // new org.apache.xml.org.apache.serialize.HTMLSerializer(pw, new OutputFormat()).asContentHandler();
           transformer.setContentHandler(handler);
  -	    transformer.setParent(m_reader);
  +        transformer.setParent(m_reader);
           transform(transformer, new InputSource(xmlbuf));
           this.showStatus("PRIMED the pump!");
         }
  +
         System.out.println("Primed the pump!");
  -      this.showStatus("Ready to click!"); 
  +      this.showStatus("Ready to click!");
       }
  -    catch(Exception e)
  +    catch (Exception e)
       {
         this.showStatus("Could not prime the pump!");
         System.out.println("Could not prime the pump!");
  @@ -449,12 +498,15 @@
      */
     public void stop()
     {
  -    if(null != m_trustedWorker)
  +
  +    if (null != m_trustedWorker)
       {
         m_trustedWorker.stop();
  +
         // m_trustedWorker.destroy();
         m_trustedWorker = null;
       }
  +
       m_styleURLOfCached = null;
       m_documentURLOfCached = null;
     }
  @@ -463,16 +515,20 @@
      * Set the URL to the XSL stylesheet that will be used
      * to transform the input XML.  No processing is done yet.
      * @param valid URL string.
  +   *
  +   * NEEDSDOC @param urlString
      */
     public void setStyleURL(String urlString)
     {
  -    m_styleURL =urlString;
  +    m_styleURL = urlString;
     }
   
     /**
      * Set the URL to the XML document that will be transformed
      * with the XSL stylesheet.  No processing is done yet.
      * @param valid URL string.
  +   *
  +   * NEEDSDOC @param urlString
      */
     public void setDocumentURL(String urlString)
     {
  @@ -499,21 +555,26 @@
      * @param value The value to set the attribute to.
      */
     public void setStyleSheetAttribute(String nameOfIDAttrOfElemToModify,
  -                                     String elemId,
  -                                     String attrName,
  +                                     String elemId, String attrName,
                                        String value)
     {
  +
       m_nameOfIDAttrOfElemToModify = nameOfIDAttrOfElemToModify;
       m_elemIdToModify = elemId;
       m_attrNameToSet = attrName;
       m_attrValueToSet = value;
     }
   
  +  /** NEEDSDOC Field m_key          */
     transient String m_key;
  +
  +  /** NEEDSDOC Field m_expression          */
     transient String m_expression;
   
     /**
      * Submit a stylesheet parameter.
  +   *
  +   * NEEDSDOC @param key
      * @param expr The parameter expression to be submitted.
      * @see org.apache.xalan.xslt.Processor#setStylesheetParam(String, String)
      */
  @@ -526,15 +587,21 @@
     /**
      * Given a String containing markup, escape the markup so it
      * can be displayed in the browser.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String escapeString(String s)
     {
  +
       StringBuffer sb = new StringBuffer();
       int length = s.length();
   
  -    for (int i = 0;  i < length;  i ++)
  +    for (int i = 0; i < length; i++)
       {
         char ch = s.charAt(i);
  +
         if ('<' == ch)
         {
           sb.append("&lt;");
  @@ -549,21 +616,35 @@
         }
         else if (0xd800 <= ch && ch < 0xdc00)
         {
  +
           // UTF-16 surrogate
           int next;
  -        if (i+1 >= length)
  +
  +        if (i + 1 >= length)
           {
  -          throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[]{Integer.toHexString(ch)}));//"Invalid UTF-16 surrogate detected: "
  -            //+Integer.toHexString(ch)+ " ?");
  +          throw new RuntimeException(
  +            XSLMessages.createMessage(
  +              XSLTErrorResources.ER_INVALID_UTF16_SURROGATE,
  +              new Object[]{ Integer.toHexString(ch) }));  //"Invalid UTF-16 surrogate detected: "
  +
  +          //+Integer.toHexString(ch)+ " ?");
           }
           else
           {
             next = s.charAt(++i);
  +
             if (!(0xdc00 <= next && next < 0xe000))
  -            throw new RuntimeException(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_UTF16_SURROGATE, new Object[]{Integer.toHexString(ch)+" "+Integer.toHexString(next)}));//"Invalid UTF-16 surrogate detected: "
  -              //+Integer.toHexString(ch)+" "+Integer.toHexString(next));
  -          next = ((ch-0xd800)<<10)+next-0xdc00+0x00010000;
  +            throw new RuntimeException(
  +              XSLMessages.createMessage(
  +                XSLTErrorResources.ER_INVALID_UTF16_SURROGATE,
  +                new Object[]{
  +                  Integer.toHexString(ch) + " "
  +                  + Integer.toHexString(next) }));  //"Invalid UTF-16 surrogate detected: "
  +
  +          //+Integer.toHexString(ch)+" "+Integer.toHexString(next));
  +          next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
           }
  +
           sb.append("&#x");
           sb.append(Integer.toHexString(next));
           sb.append(";");
  @@ -573,56 +654,71 @@
           sb.append(ch);
         }
       }
  +
       return sb.toString();
     }
   
  -
     /**
      * Assuming the stylesheet URL and the input XML URL have been set,
      * perform the transformation and return the result as a String.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getHtmlText()
     {
  +
       m_trustedAgent.m_getData = true;
       m_callThread = Thread.currentThread();
  +
       try
       {
  -      synchronized(m_callThread)
  +      synchronized (m_callThread)
         {
           m_callThread.wait();
         }
       }
  -    catch(InterruptedException ie)
  +    catch (InterruptedException ie)
       {
         System.out.println(ie.getMessage());
       }
  +
       return m_htmlText;
     }
   
     /**
      * Get a DOM tree as escaped text, suitable for display
      * in the browser.
  +   *
  +   * NEEDSDOC @param treeURL
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws IOException
      */
  -  public String getTreeAsText(String treeURL)
  -    throws IOException
  +  public String getTreeAsText(String treeURL) throws IOException
     {
  +
       String text = "";
       byte[] buffer = new byte[50000];
   
       try
  -		{
  +    {
         URL docURL = new URL(m_documentBase, treeURL);
         InputStream in = docURL.openStream();
  +      int nun_chars;
  +
  +      while ((nun_chars = in.read(buffer, 0, buffer.length)) != -1)
  +      {
  +        text = text + new String(buffer, 0, nun_chars);
  +      }
  +
  +      in.close();
  +    }
  +    catch (Exception any_error)
  +    {
  +      any_error.printStackTrace();
  +    }
   
  -			int nun_chars;
  -			while ( ( nun_chars = in.read( buffer, 0, buffer.length ) ) != -1 )
  -			{
  -				text = text + new String( buffer, 0, nun_chars );
  -			}
  -			in.close();
  -		}
  -		catch ( Exception any_error )
  -    {any_error.printStackTrace();}
       return text;
     }
   
  @@ -630,10 +726,11 @@
      * Get the XML source Tree as a text string suitable
      * for display in a browser.  Note that this is for display of the
      * XML itself, not for rendering of HTML by the browser.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception Exception thrown if tree can not be converted.
      */
  -  public String getSourceTreeAsText()
  -    throws Exception
  +  public String getSourceTreeAsText() throws Exception
     {
       return getTreeAsText(m_documentURL);
     }
  @@ -642,10 +739,11 @@
      * Get the XSL style Tree as a text string suitable
      * for display in a browser.  Note that this is for display of the
      * XML itself, not for rendering of HTML by the browser.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception Exception thrown if tree can not be converted.
      */
  -  public String getStyleTreeAsText()
  -    throws Exception
  +  public String getStyleTreeAsText() throws Exception
     {
       return getTreeAsText(m_styleURL);
     }
  @@ -654,10 +752,11 @@
      * Get the HTML result Tree as a text string suitable
      * for display in a browser.  Note that this is for display of the
      * XML itself, not for rendering of HTML by the browser.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception Exception thrown if tree can not be converted.
      */
  -  public String getResultTreeAsText()
  -    throws Exception
  +  public String getResultTreeAsText() throws Exception
     {
       return escapeString(getHtmlText());
     }
  @@ -666,17 +765,25 @@
      * Process a document and a stylesheet and return
      * the transformation result.  If one of these is null, the
      * existing value (of a previous transformation) is not affected.
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param style
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String transformToHtml(String doc, String style)
     {
  -    if(null != doc)
  +
  +    if (null != doc)
       {
         m_documentURL = doc;
       }
  -    if(null != style)
  +
  +    if (null != style)
       {
         m_styleURL = style;
       }
  +
       return getHtmlText();
     }
   
  @@ -684,67 +791,92 @@
      * Process a document and a stylesheet and return
      * the transformation result. Use the xsl:stylesheet PI to find the
      * document, if one exists.
  +   *
  +   * NEEDSDOC @param doc
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String transformToHtml(String doc)
     {
  -    if(null != doc)
  +
  +    if (null != doc)
       {
         m_documentURL = doc;
       }
  +
       m_styleURL = null;
  +
       return getHtmlText();
     }
   
     /**
      * Do the real transformation after the right XML processor
      * liason has been found.
  +   *
  +   * NEEDSDOC @param processor
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws SAXException
      */
  -  private String doTransformation(Processor processor)
  -    throws SAXException
  +  private String doTransformation(Processor processor) throws SAXException
     {
  +
       URL documentURL = null;
       URL styleURL = null;
       StringWriter osw = new StringWriter();
       PrintWriter pw = new PrintWriter(osw, false);
   
       this.showStatus("Begin Transformation...");
  +
       try
       {
  -	  m_templatesBuilder = m_processor.getTemplatesBuilder();
  -	  m_reader.setContentHandler(m_templatesBuilder);
  -		
  +      m_templatesBuilder = m_processor.getTemplatesBuilder();
  +
  +      m_reader.setContentHandler(m_templatesBuilder);
  +
         documentURL = new URL(m_codeBase, m_documentURL);
  +
         InputSource xmlSource = new InputSource(documentURL.toString());
   
         styleURL = new URL(m_codeBase, m_styleURL);
  +
         InputSource xslSource = new InputSource(styleURL.toString());
  -	  
  -	  m_reader.parse(xslSource);
  -	  Templates templates = m_templatesBuilder.getTemplates();
  -	  TransformerImpl transformer = (TransformerImpl)templates.newTransformer();
  -      
  -      if(null != m_key)
  +
  +      m_reader.parse(xslSource);
  +
  +      Templates templates = m_templatesBuilder.getTemplates();
  +      TransformerImpl transformer =
  +        (TransformerImpl) templates.newTransformer();
  +
  +      if (null != m_key)
           transformer.setParameter(m_key, null, m_expression);
  +
         // Result result = new Result(pw);
  -      org.apache.serialize.Serializer serializer = new org.apache.xml.serialize.transition.HTMLSerializer(); this.showStatus("serializer is "+ serializer);
  +      // org.apache.serialize.Serializer serializer = new org.apache.xml.serialize.transition.HTMLSerializer(); this.showStatus("serializer is "+ serializer);
         //org.apache.serialize.Serializer serializer = org.apache.serialize.SerializerFactory.getSerializer( "HTML" );
  +      Serializer serializer =
  +        SerializerFactory.getSerializer(templates.getOutputFormat());
  +
         serializer.setWriter(pw);
  +
         org.xml.sax.ContentHandler handler = serializer.asContentHandler();
  -	  
  +
         transformer.setContentHandler(handler);
  -	  transformer.setParent(m_reader);
  -      transform(transformer, xmlSource );
  -	}
  -    catch(MalformedURLException e)
  +      transformer.setParent(m_reader);
  +      transform(transformer, xmlSource);
  +    }
  +    catch (MalformedURLException e)
       {
         e.printStackTrace();
         System.exit(-1);
       }
  -    catch(IOException e)
  +    catch (IOException e)
       {
         e.printStackTrace();
         System.exit(-1);
       }
  +
       this.showStatus("Transformation Done!");
   
       String htmlData = osw.toString();
  @@ -754,28 +886,41 @@
   
     /**
      * Process the transformation.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws SAXException
      */
  -  private String processTransformation()
  -    throws SAXException
  {
    String htmlData = null;
    try
  +  private String processTransformation() throws SAXException
  +  {
  +
  +    String htmlData = null;
  +
  +    try
       {
  -      if(whichParser.trim().equals("Xerces") || whichParser.trim().equals("ANY"))
  +      if (whichParser.trim().equals("Xerces")
  +              || whichParser.trim().equals("ANY"))
         {
  -        this.showStatus("Waiting for Xalan and Xerces to finish loading and JITing...");
  -        synchronized(m_processor)
  +        this.showStatus(
  +          "Waiting for Xalan and Xerces to finish loading and JITing...");
  +
  +        synchronized (m_processor)
           {
  +
             // TransformerImpl processor = new XSLProcessor(m_liaison);
             htmlData = doTransformation(m_processor);
           }
         }
         else
         {
  -          System.out.println("Problem with XML parser!");
  +        System.out.println("Problem with XML parser!");
         }
       }
  -    catch(NoClassDefFoundError e)
  +    catch (NoClassDefFoundError e)
       {
  -      System.out.println("Can not find "+whichParser+" XML Processor!!");
  +      System.out.println("Can not find " + whichParser + " XML Processor!!");
       }
  +
       return htmlData;
     }
   
  @@ -787,13 +932,22 @@
      */
     class TrustedAgent implements Runnable
     {
  +
  +    /** NEEDSDOC Field m_getData          */
       public boolean m_getData = false;
  +
  +    /**
  +     * NEEDSDOC Method run 
  +     *
  +     */
       public void run()
       {
  -      while(true)
  +
  +      while (true)
         {
           m_trustedWorker.yield();
  -        if(m_getData)
  +
  +        if (m_getData)
           {
             try
             {
  @@ -801,17 +955,16 @@
               m_htmlText = null;
               m_htmlText = processTransformation();
             }
  -          catch(Exception e)
  +          catch (Exception e)
             {
               e.printStackTrace();
             }
             finally
             {
  -            synchronized(m_callThread)
  +            synchronized (m_callThread)
               {
                 m_callThread.notify();
               }
  -
             }
           }
           else
  @@ -829,4 +982,3 @@
       }
     }
   }
  -
  
  
  
  1.2       +4 -5      xml-xalan/java/src/org/apache/xalan/extensions/ExpressionContext.java
  
  Index: ExpressionContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExpressionContext.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExpressionContext.java	2000/10/16 19:29:28	1.1
  +++ ExpressionContext.java	2000/10/30 18:56:27	1.2
  @@ -54,27 +54,27 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -
   package org.apache.xalan.extensions;
   
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.Node;
   
   /**
  - * An object that implements this interface can supply 
  + * An object that implements this interface can supply
    * information about the current XPath expression context.
    */
   public interface ExpressionContext
   {
  +
     /**
      * Get the current context node.
      * @return The current context node.
      */
     public Node getContextNode();
  -  
  +
     /**
      * Get the current context node list.
  -   * @return An iterator for the current context list, as 
  +   * @return An iterator for the current context list, as
      * defined in XSLT.
      */
     public NodeIterator getContextNodes();
  @@ -92,5 +92,4 @@
      * @return value of n as a string, or an empty string if n is null.
      */
     public String toString(Node n);
  -
   }
  
  
  
  1.5       +25 -36    xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandler.java
  
  Index: ExtensionHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandler.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- ExtensionHandler.java	2000/10/16 19:29:28	1.4
  +++ ExtensionHandler.java	2000/10/30 18:56:27	1.5
  @@ -57,19 +57,20 @@
   package org.apache.xalan.extensions;
   
   import java.util.Vector;
  +
   import java.io.IOException;
   
   import org.xml.sax.SAXException;
   
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +
   import org.apache.xalan.templates.Stylesheet;
   import org.apache.xalan.utils.QName;
   
   // Temp??
   import org.apache.xalan.transformer.TransformerImpl;
   
  -
   /**
    * <meta name="usage" content="internal"/>
    * Abstract base class for handling an extension namespace for XPath.
  @@ -79,65 +80,60 @@
    *
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
    */
  -
  -public abstract class ExtensionHandler 
  +public abstract class ExtensionHandler
   {
  -  protected String m_namespaceUri;  // uri of the extension namespace
  -  protected String m_scriptLang;    // scripting language of implementation
   
  +  /** uri of the extension namespace          */
  +  protected String m_namespaceUri; 
  +
  +  /** scripting language of implementation          */
  +  protected String m_scriptLang;
   
     /**
      * Construct a new extension namespace handler given all the information
      * needed.
  -   * 
  +   *
      * @param namespaceUri the extension namespace URI that I'm implementing
      * @param scriptLang   language of code implementing the extension
      */
  -
  -  protected ExtensionHandler (String namespaceUri,
  -                              String scriptLang)
  +  protected ExtensionHandler(String namespaceUri, String scriptLang)
     {
       m_namespaceUri = namespaceUri;
  -    m_scriptLang   = scriptLang;
  +    m_scriptLang = scriptLang;
     }
   
  -
     /**
      * Tests whether a certain function name is known within this namespace.
      * @param function name of the function being tested
      * @return true if its known, false if not.
      */
  +  public abstract boolean isFunctionAvailable(String function);
   
  -  public abstract boolean isFunctionAvailable (String function);
  -
  -  
     /**
      * Tests whether a certain element name is known within this namespace.
      * @param function name of the function being tested
  +   *
  +   * NEEDSDOC @param element
      * @return true if its known, false if not.
      */
  +  public abstract boolean isElementAvailable(String element);
   
  -  public abstract boolean isElementAvailable (String element);
  -
  -
     /**
      * Process a call to a function.
      *
      * @param funcName Function name.
      * @param args     The arguments of the function call.
  +   * NEEDSDOC @param methodKey
  +   * NEEDSDOC @param exprContext
      *
      * @return the return value of the function evaluation.
      *
      * @exception SAXException          if parsing trouble
      */
  +  public abstract Object callFunction(
  +    String funcName, Vector args, Object methodKey,
  +      ExpressionContext exprContext) throws SAXException;
   
  -  public abstract Object callFunction (String funcName, 
  -                                       Vector args, 
  -                                       Object methodKey, 
  -                                       ExpressionContext exprContext)
  -    throws SAXException;
  -
  -
     /**
      * Process a call to this extension namespace via an element. As a side
      * effect, the results are sent to the TransformerImpl's result tree.
  @@ -150,6 +146,7 @@
      * @param sourceTree     The root of the source tree (but don't assume
      *                       it's a Document).
      * @param sourceNode     The current context node.
  +   * NEEDSDOC @param methodKey
      *
      * @exception XSLProcessorException thrown if something goes wrong
      *            while running the extension handler.
  @@ -158,16 +155,8 @@
      * @exception IOException           if loading trouble
      * @exception SAXException          if parsing trouble
      */
  -
  -  public abstract void processElement(String localPart,
  -                                      Element element,
  -                                      TransformerImpl transformer,
  -                                      Stylesheet stylesheetTree,
  -                                      Node sourceTree,
  -                                      Node sourceNode,
  -                                      QName mode,
  -                                      Object methodKey)
  -    throws SAXException, IOException;
  -
  +  public abstract void processElement(
  +    String localPart, Element element, TransformerImpl transformer,
  +      Stylesheet stylesheetTree, Node sourceTree, Node sourceNode,
  +        QName mode, Object methodKey) throws SAXException, IOException;
   }
  -
  
  
  
  1.6       +122 -90   xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerGeneral.java
  
  Index: ExtensionHandlerGeneral.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerGeneral.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ExtensionHandlerGeneral.java	2000/10/16 19:29:29	1.5
  +++ ExtensionHandlerGeneral.java	2000/10/30 18:56:27	1.6
  @@ -54,15 +54,16 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -
   package org.apache.xalan.extensions;
   
   import java.util.Hashtable;
   import java.util.Vector;
  +
   import java.io.IOException;
   
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.templates.Stylesheet;
   import org.apache.xalan.utils.QName;
  @@ -71,15 +72,12 @@
   
   // Temp??
   import org.apache.xalan.transformer.TransformerImpl;
  -
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.XPathProcessorException;
  -
   import org.apache.xalan.utils.StringVector;
   
   import java.lang.reflect.Method;
   
  -
   /**
    * <meta name="usage" content="internal"/>
    * Class handling an extension namespace for XPath. Provides functions
  @@ -87,42 +85,71 @@
    *
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
    */
  -
   public class ExtensionHandlerGeneral extends ExtensionHandler
   {
  -  private String m_scriptSrc;          // script source to run (if any)
  -  private String m_scriptSrcURL;       // URL of source of script (if any)
  -  private Hashtable m_functions = new Hashtable ();      // functions of namespace
  -  private Hashtable m_elements = new Hashtable ();       // elements of namespace
   
  +  /** NEEDSDOC Field m_scriptSrc          */
  +  private String m_scriptSrc;  // script source to run (if any)
  +
  +  /** NEEDSDOC Field m_scriptSrcURL          */
  +  private String m_scriptSrcURL;  // URL of source of script (if any)
  +
  +  /** NEEDSDOC Field m_functions          */
  +  private Hashtable m_functions = new Hashtable();  // functions of namespace
  +
  +  /** NEEDSDOC Field m_elements          */
  +  private Hashtable m_elements = new Hashtable();  // elements of namespace
  +
     // BSF objects used to invoke BSF by reflection.  Do not import the BSF classes
     // since we don't want a compile dependency on BSF.
  +
  +  /** NEEDSDOC Field m_mgr          */
  +  private Object m_mgr;  // BSF manager used to run scripts
   
  -  private Object m_mgr;                          // BSF manager used to run scripts
  -  private Object m_engine;                       // BSF engine used to run scripts
  +  /** NEEDSDOC Field m_engine          */
  +  private Object m_engine;  // BSF engine used to run scripts
   
     // static fields
   
  +  /** NEEDSDOC Field BSF_MANAGER          */
     private static final String BSF_MANAGER = "com.ibm.bsf.BSFManager";
  +
  +  /** NEEDSDOC Field managerClass          */
     private static Class managerClass;
  +
  +  /** NEEDSDOC Field mgrLoadScriptingEngine          */
     private static Method mgrLoadScriptingEngine;
  +
  +  /** NEEDSDOC Field BSF_ENGINE          */
     private static final String BSF_ENGINE = "com.ibm.bsf.BSFEngine";
  -  private static Method engineExec;             // Engine call to "compile" scripts
  -  private static Method engineCall;             // Engine call to invoke scripts
  +
  +  /** NEEDSDOC Field engineExec          */
  +  private static Method engineExec;  // Engine call to "compile" scripts
  +
  +  /** NEEDSDOC Field engineCall          */
  +  private static Method engineCall;  // Engine call to invoke scripts
  +
  +  /** NEEDSDOC Field NEG1INT          */
     private static final Integer NEG1INT = new Integer(-1);
   
  -  static {
  +  static
  +  {
       try
       {
         managerClass = Class.forName(BSF_MANAGER);
         mgrLoadScriptingEngine = managerClass.getMethod("loadScriptingEngine",
  -                                                             new Class[] {String.class});
  +              new Class[]{ String.class });
  +
         Class engineClass = Class.forName(BSF_ENGINE);
  -      engineExec = engineClass.getMethod("exec",
  -                         new Class[] {String.class, Integer.TYPE, Integer.TYPE, Object.class});
  -      engineCall = engineClass.getMethod("call",
  -                         new Class[] {Object.class, String.class,
  -                                                       Class.forName("[Ljava.lang.Object;")});
  +
  +      engineExec = engineClass.getMethod("exec", new Class[]{ String.class,
  +                                                              Integer.TYPE,
  +                                                              Integer.TYPE,
  +                                                              Object.class });
  +      engineCall = engineClass.getMethod("call", new Class[]{ Object.class,
  +                                                              String.class,
  +                                                              Class.forName(
  +                                                                "[Ljava.lang.Object;") });
       }
       catch (Exception e)
       {
  @@ -130,41 +157,45 @@
         mgrLoadScriptingEngine = null;
         engineExec = null;
         engineCall = null;
  +
         e.printStackTrace();
       }
     }
   
  -
     /**
      * Construct a new extension namespace handler given all the information
  -   * needed. 
  -   * 
  +   * needed.
  +   *
      * @param namespaceUri the extension namespace URI that I'm implementing
  +   * NEEDSDOC @param elemNames
      * @param funcNames    string containing list of functions of extension NS
      * @param lang         language of code implementing the extension
      * @param srcURL       value of src attribute (if any) - treated as a URL
      *                     or a classname depending on the value of lang. If
      *                     srcURL is not null, then scriptSrc is ignored.
  +   * NEEDSDOC @param scriptLang
  +   * NEEDSDOC @param scriptSrcURL
      * @param scriptSrc    the actual script code (if any)
  +   *
  +   * @throws SAXException
      */
  -  public ExtensionHandlerGeneral(String namespaceUri,
  -                                 StringVector elemNames,
  -                                 StringVector funcNames, 
  -                                 String scriptLang,
  -                                 String scriptSrcURL,
  -                                 String scriptSrc)
  -    throws SAXException
  +  public ExtensionHandlerGeneral(
  +          String namespaceUri, StringVector elemNames, StringVector funcNames, String scriptLang, String scriptSrcURL, String scriptSrc)
  +            throws SAXException
     {
  +
       super(namespaceUri, scriptLang);
   
       if (elemNames != null)
       {
         Object junk = new Object();
         int n = elemNames.size();
  -      for(int i = 0; i < n; i++)
  +
  +      for (int i = 0; i < n; i++)
         {
           String tok = elemNames.elementAt(i);
  -        m_elements.put(tok, junk); // just stick it in there basically
  +
  +        m_elements.put(tok, junk);  // just stick it in there basically
         }
       }
   
  @@ -172,10 +203,12 @@
       {
         Object junk = new Object();
         int n = funcNames.size();
  -      for(int i = 0; i < n; i++)
  +
  +      for (int i = 0; i < n; i++)
         {
           String tok = funcNames.elementAt(i);
  -        m_functions.put(tok, junk); // just stick it in there basically
  +
  +        m_functions.put(tok, junk);  // just stick it in there basically
         }
       }
   
  @@ -184,7 +217,8 @@
   
       if (m_scriptSrcURL != null)
       {
  -      throw new SAXException("src attribute not yet supported for " + scriptLang);
  +      throw new SAXException("src attribute not yet supported for "
  +                             + scriptLang);
       }
   
       if (null == managerClass)
  @@ -193,100 +227,107 @@
       try
       {
         m_mgr = managerClass.newInstance();
  -      m_engine = mgrLoadScriptingEngine.invoke(m_mgr, new Object[] {scriptLang});
  +      m_engine = mgrLoadScriptingEngine.invoke(m_mgr,
  +                                               new Object[]{ scriptLang });
  +
         // "Compile" the program
  -      engineExec.invoke(m_engine, new Object[] {"XalanScript", NEG1INT, NEG1INT, m_scriptSrc});
  +      engineExec.invoke(m_engine, new Object[]{ "XalanScript", NEG1INT,
  +                                                NEG1INT, m_scriptSrc });
       }
       catch (Exception e)
       {
         e.printStackTrace();
  +
         throw new SAXException("Could not compile extension", e);
       }
     }
   
  -
     /**
      * Tests whether a certain function name is known within this namespace.
      * @param function name of the function being tested
      * @return true if its known, false if not.
      */
  -
  -  public boolean isFunctionAvailable (String function) 
  +  public boolean isFunctionAvailable(String function)
     {
  -    return(m_functions.get(function) != null);
  +    return (m_functions.get(function) != null);
     }
   
  -  
     /**
      * Tests whether a certain element name is known within this namespace.
      * @param function name of the function being tested
  +   *
  +   * NEEDSDOC @param element
      * @return true if its known, false if not.
      */
  -
  -  public boolean isElementAvailable (String element) 
  +  public boolean isElementAvailable(String element)
     {
  -    return(m_elements.get(element) != null);
  +    return (m_elements.get(element) != null);
     }
   
  -
     /**
      * Process a call to a function.
      *
      * @param funcName Function name.
      * @param args     The arguments of the function call.
  +   * NEEDSDOC @param methodKey
  +   * NEEDSDOC @param exprContext
      *
      * @return the return value of the function evaluation.
      *
  -   * @exception XSLProcessorException thrown if something goes wrong 
  +   * @exception XSLProcessorException thrown if something goes wrong
      *            while running the extension handler.
      * @exception MalformedURLException if loading trouble
      * @exception FileNotFoundException if loading trouble
      * @exception IOException           if loading trouble
      * @exception SAXException          if parsing trouble
      */
  -
  -  public Object callFunction (String funcName, 
  -                              Vector args, 
  -                              Object methodKey, 
  -                              ExpressionContext exprContext)
  -    throws SAXException 
  +  public Object callFunction(
  +          String funcName, Vector args, Object methodKey, ExpressionContext exprContext)
  +            throws SAXException
     {
   
       Object[] argArray;
   
  -    try 
  +    try
       {
  -       argArray = new Object[args.size()];
  +      argArray = new Object[args.size()];
  +
  +      for (int i = 0; i < argArray.length; i++)
  +      {
  +        Object o = args.elementAt(i);
  +
  +        argArray[i] = (o instanceof XObject) ? ((XObject) o).object() : o;
  +      }
   
  -       for (int i = 0; i < argArray.length; i++) 
  -       {
  -          Object o = args.elementAt(i);
  -          argArray[i] = (o instanceof XObject) ? ((XObject)o).object() : o;
  -       }
  -       return engineCall.invoke(m_engine, new Object[] {null, funcName, argArray});
  +      return engineCall.invoke(m_engine, new Object[]{ null, funcName,
  +                                                       argArray });
       }
  -    catch (Exception e) 
  +    catch (Exception e)
       {
         e.printStackTrace();
  +
         String msg = e.getMessage();
  -      if(null != msg)
  +
  +      if (null != msg)
         {
  -        if(msg.startsWith("Stopping after fatal error:"))
  +        if (msg.startsWith("Stopping after fatal error:"))
           {
             msg = msg.substring("Stopping after fatal error:".length());
           }
  +
           // System.out.println("Call to extension function failed: "+msg);
  -        throw new SAXException (e);
  +        throw new SAXException(e);
         }
         else
         {
  +
           // Should probably make a TRaX Extension Exception.
  -        throw new SAXException ("Could not create extension: "+funcName+" because of: "+e);
  +        throw new SAXException("Could not create extension: " + funcName
  +                               + " because of: " + e);
         }
       }
     }
   
  -
     /**
      * Process a call to this extension namespace via an element. As a side
      * effect, the results are sent to the TransformerImpl's result tree.
  @@ -299,6 +340,7 @@
      * @param sourceTree     The root of the source tree (but don't assume
      *                       it's a Document).
      * @param sourceNode     The current context node.
  +   * NEEDSDOC @param methodKey
      *
      * @exception XSLProcessorException thrown if something goes wrong
      *            while running the extension handler.
  @@ -307,45 +349,35 @@
      * @exception IOException           if loading trouble
      * @exception SAXException          if parsing trouble
      */
  -
  -  public void processElement(String localPart,
  -                             Element element,
  -                             TransformerImpl transformer,
  -                             Stylesheet stylesheetTree,
  -                             Node sourceTree,
  -                             Node sourceNode,
  -                             QName mode,
  -                             Object methodKey)
  -    throws SAXException, IOException
  +  public void processElement(
  +          String localPart, Element element, TransformerImpl transformer, Stylesheet stylesheetTree, Node sourceTree, Node sourceNode, QName mode, Object methodKey)
  +            throws SAXException, IOException
     {
   
       Object result = null;
  -    XSLProcessorContext xpc = new XSLProcessorContext (transformer, 
  -                                                       stylesheetTree,
  -                                                       sourceTree, 
  -                                                       sourceNode, 
  -                                                       mode);
  +    XSLProcessorContext xpc = new XSLProcessorContext(transformer,
  +                                stylesheetTree, sourceTree, sourceNode, mode);
  +
       try
       {
         Vector argv = new Vector(2);
  +
         argv.addElement(xpc);
         argv.addElement(element);
  -      result = callFunction(localPart,
  -                            argv,
  -                            methodKey,
  +
  +      result = callFunction(localPart, argv, methodKey,
                               transformer.getXPathContext());
       }
       catch (XPathProcessorException e)
       {
  +
         // e.printStackTrace ();
  -      throw new SAXException (e.getMessage (), e);
  +      throw new SAXException(e.getMessage(), e);
       }
   
       if (result != null)
       {
  -      xpc.outputToResultTree (stylesheetTree, result);
  +      xpc.outputToResultTree(stylesheetTree, result);
       }
  - 
  - }
  -
  +  }
   }
  
  
  
  1.2       +19 -19    xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJava.java
  
  Index: ExtensionHandlerJava.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionHandlerJava.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ExtensionHandlerJava.java	2000/10/08 03:34:30	1.1
  +++ ExtensionHandlerJava.java	2000/10/30 18:56:28	1.2
  @@ -65,18 +65,19 @@
    * various java extension handlers.
    *
    */
  -
  -public abstract class ExtensionHandlerJava extends ExtensionHandler 
  +public abstract class ExtensionHandlerJava extends ExtensionHandler
   {
   
  +  /** NEEDSDOC Field m_className          */
     protected String m_className = "";
  -  private Hashtable m_cachedMethods = new Hashtable();
   
  +  /** NEEDSDOC Field m_cachedMethods          */
  +  private Hashtable m_cachedMethods = new Hashtable();
   
     /**
      * Construct a new extension handler given all the information
  -   * needed. 
  -   * 
  +   * needed.
  +   *
      * @param namespaceUri the extension namespace URI that I'm implementing
      * @param funcNames    string containing list of functions of extension NS
      * @param lang         language of code implementing the extension
  @@ -84,16 +85,18 @@
      *                     or a classname depending on the value of lang. If
      *                     srcURL is not null, then scriptSrc is ignored.
      * @param scriptSrc    the actual script code (if any)
  +   * NEEDSDOC @param scriptLang
  +   * NEEDSDOC @param className
      */
  -  protected ExtensionHandlerJava(String namespaceUri,
  -                                 String scriptLang,
  +  protected ExtensionHandlerJava(String namespaceUri, String scriptLang,
                                    String className)
     {
  +
       super(namespaceUri, scriptLang);
  +
       m_className = className;
     }
   
  -
     /**
      * Look up the entry in the method cache.
      * @param methodKey   A key that uniquely identifies this invocation in
  @@ -101,19 +104,17 @@
      * @param objType     A Class object or instance object representing the type
      * @param methodArgs  An array of the XObject arguments to be used for
      *                    function mangling.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -
  -  public Object getFromCache(Object methodKey,
  -                             Object objType,
  +  public Object getFromCache(Object methodKey, Object objType,
                                Object[] methodArgs)
     {
   
       // Eventually, we want to insert code to mangle the methodKey with methodArgs
  -
       return m_cachedMethods.get(methodKey);
     }
   
  -
     /**
      * Add a new entry into the method cache.
      * @param methodKey   A key that uniquely identifies this invocation in
  @@ -121,16 +122,15 @@
      * @param objType     A Class object or instance object representing the type
      * @param methodArgs  An array of the XObject arguments to be used for
      *                    function mangling.
  +   * NEEDSDOC @param methodObj
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -
  -  public Object putToCache(Object methodKey,
  -                         Object objType,
  -                         Object[] methodArgs,
  -                         Object methodObj)
  +  public Object putToCache(Object methodKey, Object objType,
  +                           Object[] methodArgs, Object methodObj)
     {
   
       // Eventually, we want to insert code to mangle the methodKey with methodArgs
  -
       return m_cachedMethods.put(methodKey, methodObj);
     }
   }
  
  
  
  1.9       +89 -51    xml-xalan/java/src/org/apache/xalan/extensions/ExtensionsTable.java
  
  Index: ExtensionsTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/ExtensionsTable.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- ExtensionsTable.java	2000/10/16 19:29:30	1.8
  +++ ExtensionsTable.java	2000/10/30 18:56:28	1.9
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -58,15 +58,21 @@
   
   import java.util.Hashtable;
   import java.util.Vector;
  +
   import org.apache.xpath.objects.XNull;
   import org.apache.xpath.XPathProcessorException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class ExtensionsTable <needs-comment/>
  + */
   public class ExtensionsTable
   {
  +
     /**
      * <meta name="usage" content="internal"/>
  -   * Table of extensions that may be called from the expression language 
  -   * via the call(name, ...) function.  Objects are keyed on the call 
  +   * Table of extensions that may be called from the expression language
  +   * via the call(name, ...) function.  Objects are keyed on the call
      * name.
      * @see extensions.html.
      */
  @@ -76,115 +82,134 @@
      * <meta name="usage" content="internal"/>
      * Primes the new ExtensionsTable object with built-in namespaces.
      */
  -
     public ExtensionsTable()
     {
  +
       // register the java namespace as being implemented by the 
       // xslt-javaclass engine. Note that there's no real code
       // per se for this extension as the functions carry the 
       // object on which to call etc. and all the logic of breaking
       // that up is in the xslt-javaclass engine.
  -
       String uri = "http://xml.apache.org/xslt/java";
  -    ExtensionHandler fh = new ExtensionHandlerJavaPackage(uri, "xslt-javaclass", "");
  -    addExtensionNamespace(uri, fh);   
  +    ExtensionHandler fh = new ExtensionHandlerJavaPackage(uri,
  +                            "xslt-javaclass", "");
  +
  +    addExtensionNamespace(uri, fh);
  +
       uri = "http://xsl.lotus.com/java";
  +
       addExtensionNamespace(uri, fh);
  +
       uri = "http://xml.apache.org/xalan";
  -    fh = new ExtensionHandlerJavaClass(uri, "javaclass", "org.apache.xalan.lib.Extensions");
  +    fh = new ExtensionHandlerJavaClass(uri, "javaclass",
  +                                       "org.apache.xalan.lib.Extensions");
  +
       addExtensionNamespace(uri, fh);
     }
   
  -
     /**
  -   * Get an ExtensionHandler object that represents the 
  +   * Get an ExtensionHandler object that represents the
      * given namespace.
      * @param extns A valid extension namespace.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public ExtensionHandler get(String extns)
     {
  -    return (ExtensionHandler)m_extensionFunctionNamespaces.get(extns);
  +    return (ExtensionHandler) m_extensionFunctionNamespaces.get(extns);
     }
  -  
   
     /**
      * <meta name="usage" content="advanced"/>
      * Register an extension namespace handler. This handler provides
  -   * functions for testing whether a function is known within the 
  +   * functions for testing whether a function is known within the
      * namespace and also for invoking the functions.
      *
      * @param uri the URI for the extension.
      * @param extNS the extension handler.
      */
  -
     public void addExtensionNamespace(String uri, ExtensionHandler extNS)
     {
       m_extensionFunctionNamespaces.put(uri, extNS);
     }
   
  -
     /**
      * Execute the function-available() function.
      * @param ns       the URI of namespace in which the function is needed
      * @param funcName the function name being tested
      *
      * @return whether the given function is available or not.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -
  -  public boolean functionAvailable (String ns, String funcName) 
  -    throws org.xml.sax.SAXException
  +  public boolean functionAvailable(String ns, String funcName)
  +          throws org.xml.sax.SAXException
     {
  +
       boolean isAvailable = false;
  -    if (null != ns) 
  +
  +    if (null != ns)
       {
  -      ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
  +      ExtensionHandler extNS =
  +        (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
  +
         if (extNS == null)
         {
           extNS = makeJavaNamespace(ns);
  -        addExtensionNamespace (ns, extNS);
  +
  +        addExtensionNamespace(ns, extNS);
         }
  -      if (extNS != null) 
  +
  +      if (extNS != null)
         {
           isAvailable = extNS.isFunctionAvailable(funcName);
         }
       }
  +
       // System.err.println (">>> functionAvailable (ns=" + ns + 
       //                    ", func=" + funcName + ") = " + isAvailable);
       return isAvailable;
     }
   
  -
     /**
      * Execute the element-available() function.
      * @param ns       the URI of namespace in which the function is needed
      * @param funcName the function name being tested
  +   * NEEDSDOC @param elemName
      *
      * @return whether the given function is available or not.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -
     public boolean elementAvailable(String ns, String elemName)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       boolean isAvailable = false;
  -    if (null != ns) 
  +
  +    if (null != ns)
       {
  -      ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
  +      ExtensionHandler extNS =
  +        (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
  +
         if (extNS == null)
         {
           extNS = makeJavaNamespace(ns);
  -        addExtensionNamespace (ns, extNS);
  +
  +        addExtensionNamespace(ns, extNS);
         }
  -      if (extNS != null) 
  +
  +      if (extNS != null)
         {
           isAvailable = extNS.isElementAvailable(elemName);
         }
       }
  +
       // System.err.println (">>> elementAvailable (ns=" + ns + 
       //                    ", elem=" + elemName + ") = " + isAvailable);
       return isAvailable;
     }
   
  -
     /**
      * Handle an extension function.
      * @param ns        the URI of namespace in which the function is needed
  @@ -197,69 +222,79 @@
      *                  areas in the environment
      *
      * @return result of executing the function
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -
  -  public Object extFunction (String ns, String funcName, Vector argVec, 
  -                             Object methodKey, ExpressionContext exprContext)
  -    throws org.xml.sax.SAXException
  +  public Object extFunction(
  +          String ns, String funcName, Vector argVec, Object methodKey, ExpressionContext exprContext)
  +            throws org.xml.sax.SAXException
     {
  +
       Object result = null;
  +
       if (null != ns)
       {
  -      ExtensionHandler extNS = (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
  +      ExtensionHandler extNS =
  +        (ExtensionHandler) m_extensionFunctionNamespaces.get(ns);
   
         // If the handler for this extension URI is not found try to auto declare 
         // this extension namespace:
  -
  -      if (null == extNS) 
  +      if (null == extNS)
         {
           extNS = makeJavaNamespace(ns);
  -        addExtensionNamespace (ns, extNS);
  +
  +        addExtensionNamespace(ns, extNS);
         }
   
         if (null != extNS)
         {
           try
           {
  -          result = extNS.callFunction(funcName, argVec, methodKey, exprContext);
  +          result = extNS.callFunction(funcName, argVec, methodKey,
  +                                      exprContext);
           }
           catch (Exception e)
           {
             e.printStackTrace();
  +
             // throw new XPathProcessorException ("Extension function '" + ns +
             //  ":" + funcName +
             //  "', threw exception: " + e, e);
             String msg = e.getMessage();
  -          if(null != msg)
  +
  +          if (null != msg)
             {
  -            if(msg.startsWith("Stopping after fatal error:"))
  +            if (msg.startsWith("Stopping after fatal error:"))
               {
                 msg = msg.substring("Stopping after fatal error:".length());
               }
  +
               // System.out.println("Call to extension function failed: "+msg);
               result = new XNull();
  +
               // throw new org.xml.sax.SAXException(e);
             }
           }
         }
  -      else 
  +      else
         {
  -        throw new XPathProcessorException ("Extension function '" + ns +
  -          ":" + funcName + "' is unknown");
  +        throw new XPathProcessorException("Extension function '" + ns + ":"
  +                                          + funcName + "' is unknown");
         }
       }
  +
       return result;
     }
   
  -
     /**
      * Declare the appropriate java extension handler.
      * @param ns        the URI of namespace in which the function is needed
      * @return          an ExtensionHandler for this namespace
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -
     public ExtensionHandler makeJavaNamespace(String ns)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
   
       // First, prepare the name of the actual class or package.  We strip
  @@ -268,25 +303,28 @@
       // In the documentation, we state that any classes or packages
       // declared using this technique must start with xalan://.  However,
       // in this version, we don't enforce that.
  -
       String className = ns;
  +
       if (className.startsWith("class:"))
       {
         className = className.substring(6);
       }
   
       int lastSlash = className.lastIndexOf("/");
  +
       if (-1 != lastSlash)
         className = className.substring(lastSlash + 1);
   
  -    try 
  +    try
       {
         Class.forName(className);
  +
         return new ExtensionHandlerJavaClass(ns, "javaclass", className);
       }
       catch (ClassNotFoundException e)
       {
  -      return new ExtensionHandlerJavaPackage(ns, "javapackage", className + ".");
  +      return new ExtensionHandlerJavaPackage(ns, "javapackage",
  +                                             className + ".");
       }
     }
   }
  
  
  
  1.5       +99 -54    xml-xalan/java/src/org/apache/xalan/extensions/XSLProcessorContext.java
  
  Index: XSLProcessorContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/extensions/XSLProcessorContext.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XSLProcessorContext.java	2000/10/17 18:45:42	1.4
  +++ XSLProcessorContext.java	2000/10/30 18:56:28	1.5
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -59,11 +59,14 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.DocumentFragment;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.transformer.ResultTreeHandler;
   import org.apache.xalan.templates.Stylesheet;
   import org.apache.xalan.utils.QName;
  +
   import org.xml.sax.SAXException;
  +
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XString;
   import org.apache.xpath.objects.XBoolean;
  @@ -80,67 +83,90 @@
    *
    * @author Sanjiva Weerawarana (sanjiva@watson.ibm.com)
    */
  -public class XSLProcessorContext {
  -  
  +public class XSLProcessorContext
  +{
  +
     /**
      * Create a processor context to be passed to an extension.
      * (Notice it is a package-only constructor).
  +   *
  +   * NEEDSDOC @param transformer
  +   * NEEDSDOC @param stylesheetTree
  +   * NEEDSDOC @param sourceTree
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param mode
      */
  -  public XSLProcessorContext (TransformerImpl transformer,
  -                       Stylesheet stylesheetTree,
  -                       Node sourceTree, Node sourceNode, QName mode) 
  +  public XSLProcessorContext(TransformerImpl transformer,
  +                             Stylesheet stylesheetTree, Node sourceTree,
  +                             Node sourceNode, QName mode)
     {
  +
       this.transformer = transformer;
       this.stylesheetTree = stylesheetTree;
       this.mode = mode;
       this.sourceTree = sourceTree;
       this.sourceNode = sourceNode;
     }
  -  
  +
  +  /** NEEDSDOC Field transformer          */
     private TransformerImpl transformer;
  -  
  +
     /**
      * Get the transformer.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public TransformerImpl getTransformer()
     {
       return transformer;
     }
  -  
  +
  +  /** NEEDSDOC Field stylesheetTree          */
     private Stylesheet stylesheetTree;
  -  
  +
     /**
      * Get the Stylesheet being executed.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Stylesheet getStylesheet()
     {
       return stylesheetTree;
     }
  -  
  +
  +  /** NEEDSDOC Field sourceTree          */
     private Node sourceTree;
  -  
  +
     /**
      * Get the root of the source tree being executed.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getSourceTree()
     {
       return sourceTree;
     }
  -  
  +
  +  /** NEEDSDOC Field sourceNode          */
     private Node sourceNode;
  -  
  +
     /**
      * Get the current context node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getContextNode()
     {
       return sourceNode;
     }
  -  
  +
  +  /** NEEDSDOC Field mode          */
     private QName mode;
  -  
  +
     /**
      * Get the current mode being executed.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public QName getMode()
     {
  @@ -151,49 +177,55 @@
      * Output an object to the result tree by doing the right conversions.
      * This is public for access by extensions.
      *
  +   *
  +   * NEEDSDOC @param stylesheetTree
      * @param obj the Java object to output. If its of an X<something> type
      *        then that conversion is done first and then sent out.
  +   *
  +   * @throws SAXException
  +   * @throws java.io.FileNotFoundException
  +   * @throws java.io.IOException
  +   * @throws java.net.MalformedURLException
      */
  -  public void outputToResultTree (Stylesheet stylesheetTree, Object obj)
  -    throws SAXException,
  -    java.net.MalformedURLException,
  -    java.io.FileNotFoundException,
  -    java.io.IOException
  +  public void outputToResultTree(Stylesheet stylesheetTree, Object obj)
  +          throws SAXException, java.net.MalformedURLException,
  +                 java.io.FileNotFoundException, java.io.IOException
     {
  +
       ResultTreeHandler rtreeHandler = transformer.getResultTreeHandler();
  -    
       XObject value;
  +
       // Make the return object into an XObject because it
       // will be easier below.  One of the reasons to do this
       // is to keep all the conversion functionality in the
       // XObject classes.
  -    if(obj instanceof XObject)
  +    if (obj instanceof XObject)
       {
  -      value = (XObject)obj;
  +      value = (XObject) obj;
       }
  -    else if(obj instanceof String)
  +    else if (obj instanceof String)
       {
  -      value = new XString((String)obj);
  +      value = new XString((String) obj);
       }
  -    else if(obj instanceof Boolean)
  +    else if (obj instanceof Boolean)
       {
  -      value = new XBoolean(((Boolean)obj).booleanValue());
  +      value = new XBoolean(((Boolean) obj).booleanValue());
       }
  -    else if(obj instanceof Double)
  +    else if (obj instanceof Double)
       {
  -      value = new XNumber(((Double)obj).doubleValue());
  +      value = new XNumber(((Double) obj).doubleValue());
       }
  -    else if(obj instanceof DocumentFragment)
  +    else if (obj instanceof DocumentFragment)
       {
  -      value = new XRTreeFrag((DocumentFragment)obj);
  +      value = new XRTreeFrag((DocumentFragment) obj);
       }
  -    else if(obj instanceof Node)
  +    else if (obj instanceof Node)
       {
  -      value = new XNodeSet((Node)obj);
  +      value = new XNodeSet((Node) obj);
       }
  -    else if(obj instanceof NodeIterator)
  +    else if (obj instanceof NodeIterator)
       {
  -      value = new XNodeSet((NodeIterator)obj);
  +      value = new XNodeSet((NodeIterator) obj);
       }
       else
       {
  @@ -202,58 +234,71 @@
   
       int type = value.getType();
       String s;
  -    switch(type)
  +
  +    switch (type)
       {
  -    case XObject.CLASS_BOOLEAN:        case XObject.CLASS_NUMBER:        case XObject.CLASS_STRING:
  +    case XObject.CLASS_BOOLEAN :
  +    case XObject.CLASS_NUMBER :
  +    case XObject.CLASS_STRING :
         s = value.str();
  +
         rtreeHandler.characters(s.toCharArray(), 0, s.length());
         break;
  -    case XObject.CLASS_NODESET:          // System.out.println(value);
  +    case XObject.CLASS_NODESET :  // System.out.println(value);
         NodeIterator nl = value.nodeset();
         Node pos;
  -      while(null != (pos = nl.nextNode()))
  +
  +      while (null != (pos = nl.nextNode()))
         {
           Node top = pos;
  -        while(null != pos)
  +
  +        while (null != pos)
           {
             rtreeHandler.flushPending();
             rtreeHandler.cloneToResultTree(pos, true);
  +
             Node nextNode = pos.getFirstChild();
  -          while(null == nextNode)
  +
  +          while (null == nextNode)
             {
  -            if(Node.ELEMENT_NODE == pos.getNodeType())
  +            if (Node.ELEMENT_NODE == pos.getNodeType())
               {
                 rtreeHandler.endElement("", "", pos.getNodeName());
               }
  -            if(top == pos)
  +
  +            if (top == pos)
                 break;
  +
               nextNode = pos.getNextSibling();
  -            if(null == nextNode)
  +
  +            if (null == nextNode)
               {
                 pos = pos.getParentNode();
  -              if(top == pos)
  +
  +              if (top == pos)
                 {
  -                if(Node.ELEMENT_NODE == pos.getNodeType())
  +                if (Node.ELEMENT_NODE == pos.getNodeType())
                   {
                     rtreeHandler.endElement("", "", pos.getNodeName());
                   }
  +
                   nextNode = null;
  +
                   break;
                 }
               }
             }
  +
             pos = nextNode;
           }
         }
         break;
  -
  -    case XObject.CLASS_RTREEFRAG:
  -      rtreeHandler.outputResultTreeFragment(value, 
  +    case XObject.CLASS_RTREEFRAG :
  +      rtreeHandler.outputResultTreeFragment(value,
                                               transformer.getXPathContext());
         break;
       }
     }
  -
   
     /**
      * I need a "Node transformNode (Node)" method somewhere that the
  
  
  
  1.3       +117 -21   xml-xalan/java/src/org/apache/xalan/lib/sql/Column.java
  
  Index: Column.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/Column.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Column.java	2000/09/22 19:46:17	1.2
  +++ Column.java	2000/10/30 18:56:31	1.3
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.Node;
  @@ -13,89 +69,129 @@
    */
   public class Column extends StreamableNode
   {
  +
  +  /** NEEDSDOC Field m_columnIndex          */
     int m_columnIndex;
  +
  +  /** NEEDSDOC Field m_parent          */
     Row m_parent;
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
  +
  +  /** NEEDSDOC Field m_text          */
     ColumnData m_text;
  -  
  -  public Column(XStatement statement, Row parent, int columnIndex, 
  +
  +  /**
  +   * Constructor Column
  +   *
  +   *
  +   * NEEDSDOC @param statement
  +   * NEEDSDOC @param parent
  +   * NEEDSDOC @param columnIndex
  +   * NEEDSDOC @param metadata
  +   */
  +  public Column(XStatement statement, Row parent, int columnIndex,
                   ResultSetMetaData metadata)
     {
  +
       super(statement);
  +
       m_columnIndex = columnIndex;
       m_parent = parent;
       m_text = null;
     }
  -  
  +
     /**
      * The parent of col is #Document (represented by XStatement).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Document getOwnerDocument()
     {
       return this.getXStatement();
     }
  -  
  +
     /**
      * Return "col".
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNodeName()
     {
       return XStatement.S_COLUMNNAME;
     }
  -      
  +
     /**
      * Return the col text node (the column value).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getFirstChild()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In Column.getFirstChild");
  -    
  -    if(null == m_text)
  +
  +    if (null == m_text)
         m_text = new ColumnData(this.getXStatement(), this);
  -    
  +
       return m_text;
     }
  -  
  +
     /**
      * Return the next col element for the current row.
      * @return a Column node or null.
      */
     public Node getNextSibling()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In Column.getNextSibling");
  -    int nextIndex = m_columnIndex+1;
  -    return (nextIndex < m_parent.m_childCount) 
  +
  +    int nextIndex = m_columnIndex + 1;
  +
  +    return (nextIndex < m_parent.m_childCount)
              ? m_parent.m_columns[nextIndex] : null;
     }
  -  
  +
     /**
      * The parent node of col is a row.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getParentNode()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In Column.getParentNode");
  +
       return m_parent;
     }
  -  
  +
     /**
  -   * Tell if there are any children of col, 
  +   * Tell if there are any children of col,
      * which is always true. I.e., col contains a text node
      * with a textual representation of the column value.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean            hasChildNodes()
  +  public boolean hasChildNodes()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In Column.hasChildNodes");
  +
       return true;
     }
  +
     /**
      * Return the metadata for this column.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public NamedNodeMap       getAttributes()
  +  public NamedNodeMap getAttributes()
     {
       return m_parent.m_parent.m_columnHeaders[m_columnIndex];
  -  }  
  +  }
   }
  
  
  
  1.3       +288 -58   xml-xalan/java/src/org/apache/xalan/lib/sql/ColumnAttribute.java
  
  Index: ColumnAttribute.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/ColumnAttribute.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ColumnAttribute.java	2000/09/22 19:46:19	1.2
  +++ ColumnAttribute.java	2000/10/30 18:56:32	1.3
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.Element;
  @@ -21,7 +77,7 @@
    * <ul>
    *   <li>column-label</li>
    *   <li>column-name</li>
  - *   <li>column-display-size</li> 
  + *   <li>column-display-size</li>
    *   <li>column-type</li>
    *   <li>column-type-name</li>
    *   <li>precision</li>
  @@ -40,53 +96,133 @@
    */
   public class ColumnAttribute extends StreamableNode implements Attr
   {
  +
  +  /** NEEDSDOC Field m_owner          */
     Element m_owner;
  +
  +  /** NEEDSDOC Field m_metadata          */
     ResultSetMetaData m_metadata;
  +
  +  /** NEEDSDOC Field m_name          */
     String m_name;
  +
  +  /** NEEDSDOC Field m_type          */
     int m_type;
  +
  +  /** NEEDSDOC Field m_columnIndex          */
     int m_columnIndex;
  +
  +  /** NEEDSDOC Field m_columnAttr          */
     ColumnAttribute m_columnAttr;
  +
  +  /** NEEDSDOC Field S_ISTRUE          */
     static final String S_ISTRUE = "true";
  +
  +  /** NEEDSDOC Field S_ISFALSE          */
     static final String S_ISFALSE = "false";
  -  
  +
  +  /** NEEDSDOC Field CATALOGUE_NAME          */
     public static final int CATALOGUE_NAME = 0;
  +
  +  /** NEEDSDOC Field DISPLAY_SIZE          */
     public static final int DISPLAY_SIZE = 1;
  +
  +  /** NEEDSDOC Field COLUMN_LABEL          */
     public static final int COLUMN_LABEL = 2;
  +
  +  /** NEEDSDOC Field COLUMN_NAME          */
     public static final int COLUMN_NAME = 3;
  +
  +  /** NEEDSDOC Field COLUMN_TYPE          */
     public static final int COLUMN_TYPE = 4;
  +
  +  /** NEEDSDOC Field COLUMN_TYPENAME          */
     public static final int COLUMN_TYPENAME = 5;
  +
  +  /** NEEDSDOC Field PRECISION          */
     public static final int PRECISION = 6;
  +
  +  /** NEEDSDOC Field SCALE          */
     public static final int SCALE = 7;
  +
  +  /** NEEDSDOC Field SCHEMA_NAME          */
     public static final int SCHEMA_NAME = 8;
  +
  +  /** NEEDSDOC Field TABLE_NAME          */
     public static final int TABLE_NAME = 9;
  +
  +  /** NEEDSDOC Field CASESENSITIVE          */
     public static final int CASESENSITIVE = 10;
  +
  +  /** NEEDSDOC Field DEFINATELYWRITABLE          */
     public static final int DEFINATELYWRITABLE = 11;
  +
  +  /** NEEDSDOC Field ISNULLABLE          */
     public static final int ISNULLABLE = 12;
  +
  +  /** NEEDSDOC Field ISSIGNED          */
     public static final int ISSIGNED = 13;
  +
  +  /** NEEDSDOC Field ISWRITEABLE          */
     public static final int ISWRITEABLE = 14;
  +
  +  /** NEEDSDOC Field ISSEARCHABLE          */
     public static final int ISSEARCHABLE = 15;
  -  
  +
  +  /** NEEDSDOC Field NUMBER_ATTRIBUTES          */
     public static final int NUMBER_ATTRIBUTES = 16;
   
  +  /** NEEDSDOC Field S_CATALOGUE_NAME          */
     public static final String S_CATALOGUE_NAME = "catalogue-name";
  +
  +  /** NEEDSDOC Field S_DISPLAY_SIZE          */
     public static final String S_DISPLAY_SIZE = "column-display-size";
  +
  +  /** NEEDSDOC Field S_COLUMN_LABEL          */
     public static final String S_COLUMN_LABEL = "column-label";
  +
  +  /** NEEDSDOC Field S_COLUMN_NAME          */
     public static final String S_COLUMN_NAME = "column-name";
  +
  +  /** NEEDSDOC Field S_COLUMN_TYPE          */
     public static final String S_COLUMN_TYPE = "column-type";
  +
  +  /** NEEDSDOC Field S_COLUMN_TYPENAME          */
     public static final String S_COLUMN_TYPENAME = "column-type-name";
  +
  +  /** NEEDSDOC Field S_PRECISION          */
     public static final String S_PRECISION = "precision";
  +
  +  /** NEEDSDOC Field S_SCALE          */
     public static final String S_SCALE = "scale";
  +
  +  /** NEEDSDOC Field S_SCHEMA_NAME          */
     public static final String S_SCHEMA_NAME = "schema-name";
  +
  +  /** NEEDSDOC Field S_TABLE_NAME          */
     public static final String S_TABLE_NAME = "table-name";
  +
  +  /** NEEDSDOC Field S_CASESENSITIVE          */
     public static final String S_CASESENSITIVE = "case-sensitive";
  +
  +  /** NEEDSDOC Field S_DEFINATELYWRITABLE          */
     public static final String S_DEFINATELYWRITABLE = "definitely-writable";
  +
  +  /** NEEDSDOC Field S_ISNULLABLE          */
     public static final String S_ISNULLABLE = "nullable";
  +
  +  /** NEEDSDOC Field S_ISSIGNED          */
     public static final String S_ISSIGNED = "signed";
  +
  +  /** NEEDSDOC Field S_ISWRITEABLE          */
     public static final String S_ISWRITEABLE = "writable";
  +
  +  /** NEEDSDOC Field S_ISSEARCHABLE          */
     public static final String S_ISSEARCHABLE = "searchable";
  -  
  +
  +  /** NEEDSDOC Field m_namelookup          */
     static java.util.Hashtable m_namelookup = new java.util.Hashtable();
  -  
  +
     static
     {
       m_namelookup.put(S_CATALOGUE_NAME, new Integer(CATALOGUE_NAME));
  @@ -107,169 +243,263 @@
       m_namelookup.put(S_ISSEARCHABLE, new Integer(ISSEARCHABLE));
     }
   
  +  /**
  +   * Constructor ColumnAttribute
  +   *
  +   *
  +   * NEEDSDOC @param statement
  +   * NEEDSDOC @param owner
  +   * NEEDSDOC @param columnIndex
  +   * NEEDSDOC @param type
  +   * NEEDSDOC @param metadata
  +   */
     public ColumnAttribute(XStatement statement, Element owner,
  -                         int columnIndex, int type, ResultSetMetaData metadata)
  +                         int columnIndex, int type,
  +                         ResultSetMetaData metadata)
     {
  +
       super(statement);
  +
       m_owner = owner;
       m_metadata = metadata;
       m_columnIndex = columnIndex;
       m_type = type;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getAttrNameFromPos 
  +   *
  +   *
  +   * NEEDSDOC @param pos
  +   *
  +   * NEEDSDOC (getAttrNameFromPos) @return
  +   */
     static String getAttrNameFromPos(int pos)
     {
  -    switch(pos)
  +
  +    switch (pos)
       {
  -    case  CATALOGUE_NAME:
  +    case CATALOGUE_NAME :
         return S_CATALOGUE_NAME;
  -    case  DISPLAY_SIZE:
  +    case DISPLAY_SIZE :
         return S_DISPLAY_SIZE;
  -    case  COLUMN_LABEL:
  +    case COLUMN_LABEL :
         return S_COLUMN_LABEL;
  -    case  COLUMN_NAME:
  +    case COLUMN_NAME :
         return S_COLUMN_NAME;
  -    case  COLUMN_TYPE:
  +    case COLUMN_TYPE :
         return S_COLUMN_TYPE;
  -    case  COLUMN_TYPENAME:
  +    case COLUMN_TYPENAME :
         return S_COLUMN_TYPENAME;
  -    case  PRECISION:
  +    case PRECISION :
         return S_PRECISION;
  -    case  SCALE:
  +    case SCALE :
         return S_SCALE;
  -    case  SCHEMA_NAME:
  +    case SCHEMA_NAME :
         return S_SCHEMA_NAME;
  -    case  TABLE_NAME:
  +    case TABLE_NAME :
         return S_TABLE_NAME;
  -    case  CASESENSITIVE:
  +    case CASESENSITIVE :
         return S_CASESENSITIVE;
  -    case  DEFINATELYWRITABLE:
  +    case DEFINATELYWRITABLE :
         return S_DEFINATELYWRITABLE;
  -    case  ISNULLABLE:
  +    case ISNULLABLE :
         return S_ISNULLABLE;
  -    case  ISSIGNED:
  +    case ISSIGNED :
         return S_ISSIGNED;
  -    case  ISWRITEABLE:
  +    case ISWRITEABLE :
         return S_ISWRITEABLE;
  -    case  ISSEARCHABLE:
  +    case ISSEARCHABLE :
         return S_ISSEARCHABLE;
  -    default:
  +    default :
         return null;
       }
     }
   
  -  
  +  /**
  +   * NEEDSDOC Method getAttrPosFromName 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (getAttrPosFromName) @return
  +   */
     static int getAttrPosFromName(String name)
     {
  -    Integer intObj = (Integer)m_namelookup.get(name);
  -    if(null != intObj)
  +
  +    Integer intObj = (Integer) m_namelookup.get(name);
  +
  +    if (null != intObj)
       {
         return intObj.intValue();
       }
       else
         return -1;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setName 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (setName) @return
  +   */
     public boolean setName(String name)
     {
  +
       m_name = name;
  +
       int i = getAttrPosFromName(name);
  +
       return (i >= 0);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getNodeName 
  +   *
  +   *
  +   * NEEDSDOC (getNodeName) @return
  +   */
     public String getNodeName()
     {
       return m_name;
     }
   
  -  public String getName() 
  +  /**
  +   * NEEDSDOC Method getName 
  +   *
  +   *
  +   * NEEDSDOC (getName) @return
  +   */
  +  public String getName()
     {
       return m_name;
     }
   
  +  /**
  +   * NEEDSDOC Method getSpecified 
  +   *
  +   *
  +   * NEEDSDOC (getSpecified) @return
  +   */
     public boolean getSpecified()
     {
       return true;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getNodeValue 
  +   *
  +   *
  +   * NEEDSDOC (getNodeValue) @return
  +   */
     public String getNodeValue()
     {
       return getValue();
     }
   
  +  /**
  +   * NEEDSDOC Method getValue 
  +   *
  +   *
  +   * NEEDSDOC (getValue) @return
  +   */
     public String getValue()
     {
  -    int i = m_columnIndex+1; // sql counts by 1
  +
  +    int i = m_columnIndex + 1;  // sql counts by 1
  +
       try
       {
  +
         // System.out.println("m_type: "+m_type);
  -      switch(m_type)
  +      switch (m_type)
         {
  -      case  CATALOGUE_NAME:
  +      case CATALOGUE_NAME :
           return m_metadata.getCatalogName(i);
  -      case  DISPLAY_SIZE:
  +      case DISPLAY_SIZE :
           return Integer.toString(m_metadata.getColumnDisplaySize(i));
  -      case  COLUMN_LABEL:
  +      case COLUMN_LABEL :
           return m_metadata.getColumnLabel(i);
  -      case  COLUMN_NAME:
  +      case COLUMN_NAME :
           return m_metadata.getColumnName(i);
  -      case  COLUMN_TYPE:
  +      case COLUMN_TYPE :
           return Integer.toString(m_metadata.getColumnType(i));
  -      case  COLUMN_TYPENAME:
  +      case COLUMN_TYPENAME :
           return m_metadata.getColumnTypeName(i);
  -      case  PRECISION:
  +      case PRECISION :
           return Integer.toString(m_metadata.getPrecision(i));
  -      case  SCALE:
  +      case SCALE :
           return Integer.toString(m_metadata.getScale(i));
  -      case  SCHEMA_NAME:
  +      case SCHEMA_NAME :
           return m_metadata.getSchemaName(i);
  -      case  TABLE_NAME:
  +      case TABLE_NAME :
           return m_metadata.getTableName(i);
  -      case  CASESENSITIVE:
  +      case CASESENSITIVE :
           return m_metadata.isCaseSensitive(i) ? S_ISTRUE : S_ISFALSE;
  -      case  DEFINATELYWRITABLE:
  +      case DEFINATELYWRITABLE :
           return m_metadata.isDefinitelyWritable(i) ? S_ISTRUE : S_ISFALSE;
  -      case  ISNULLABLE:
  +      case ISNULLABLE :
           return Integer.toString(m_metadata.isNullable(i));
  -      case  ISSIGNED:
  +      case ISSIGNED :
           return m_metadata.isSigned(i) ? S_ISTRUE : S_ISFALSE;
  -      case  ISWRITEABLE:
  +      case ISWRITEABLE :
           return m_metadata.isWritable(i) ? S_ISTRUE : S_ISFALSE;
  -      case  ISSEARCHABLE:
  +      case ISSEARCHABLE :
           return m_metadata.isSearchable(i) ? S_ISTRUE : S_ISFALSE;
  -      default:
  +      default :
           return "";
         }
       }
  -    catch(SQLException sqle)
  +    catch (SQLException sqle)
       {
         return "SQL ERROR!";
       }
     }
  -  
  -  public void setValue(String value)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method setValue 
  +   *
  +   *
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
  +   */
  +  public void setValue(String value) throws DOMException
     {
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
   
  +  /**
  +   * NEEDSDOC Method getOwnerElement 
  +   *
  +   *
  +   * NEEDSDOC (getOwnerElement) @return
  +   */
     public Element getOwnerElement()
     {
       return m_owner;
     }
   
  +  /**
  +   * NEEDSDOC Method getParentNode 
  +   *
  +   *
  +   * NEEDSDOC (getParentNode) @return
  +   */
     public Node getParentNode()
     {
       return null;
     }
  -  
  +
     /**
      * Return Node.ATTRIBUTE_NODE.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getNodeType()
     {
       return Node.ATTRIBUTE_NODE;
     }
  -
  -
   }
  
  
  
  1.3       +212 -73   xml-xalan/java/src/org/apache/xalan/lib/sql/ColumnData.java
  
  Index: ColumnData.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/ColumnData.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ColumnData.java	2000/09/22 19:46:20	1.2
  +++ ColumnData.java	2000/10/30 18:56:32	1.3
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.Node;
  @@ -16,196 +72,279 @@
    */
   public class ColumnData extends StreamableNode implements Text
   {
  +
  +  /** NEEDSDOC Field m_parent          */
     Column m_parent;
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
  -  
  +
  +  /**
  +   * Constructor ColumnData
  +   *
  +   *
  +   * NEEDSDOC @param statement
  +   * NEEDSDOC @param parent
  +   */
     public ColumnData(XStatement statement, Column parent)
     {
  +
       super(statement);
  +
       m_parent = parent;
     }
  -  
  +
     /**
      * Return Node.TEXT_NODE.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getNodeType()
     {
       return Node.TEXT_NODE;
     }
  -  
  -  public Text splitText(int offset)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method splitText 
  +   *
  +   *
  +   * NEEDSDOC @param offset
  +   *
  +   * NEEDSDOC (splitText) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Text splitText(int offset) throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
     /**
  -   * Return the value for this col element text node. I.e., return a String representation 
  +   * Return the value for this col element text node. I.e., return a String representation
      * of the data for this column in the current row.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
      */
  -  public String getData()
  -    throws DOMException
  +  public String getData() throws DOMException
     {
  +
       try
       {
         ResultSet rs = this.getXStatement().getResultSet();
         int columnIndex = m_parent.m_columnIndex;
  -      
  -      if(DEBUG)
  -        System.out.println("In ColumnData.getData, columnIndex: "+columnIndex);
  -      if(columnIndex < m_parent.m_parent.m_childCount)
  +
  +      if (DEBUG)
  +        System.out.println("In ColumnData.getData, columnIndex: "
  +                           + columnIndex);
  +
  +      if (columnIndex < m_parent.m_parent.m_childCount)
         {
  -        return rs.getString(columnIndex+1);
  +        return rs.getString(columnIndex + 1);
         }
         else
           return null;
       }
  -    catch(SQLException sqle)
  +    catch (SQLException sqle)
       {
         return null;
       }
     }
  +
     /**
  -   * Return the value for this col element text node. I.e., return a String representation 
  +   * Return the value for this col element text node. I.e., return a String representation
      * of the data for this column in the current row.
      * Calls @link #getNodeValue() getNodeValue()}.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
      */
  -  
  -  public String getNodeValue()
  -    throws DOMException
  +  public String getNodeValue() throws DOMException
     {
       return getData();
     }
  -  
  +
     /**
  -   *  The number of  16-bit units that are available through 
  -   * <code>data</code> and the <code>substringData</code> method below.  
  -   * This may have the value zero, i.e., <code>CharacterData</code> nodes 
  +   *  The number of  16-bit units that are available through
  +   * <code>data</code> and the <code>substringData</code> method below.
  +   * This may have the value zero, i.e., <code>CharacterData</code> nodes
      * may be empty.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getLength()
     {
  +
       String s = getData();
  +
       return (null != s) ? s.length() : 0;
     }
  -/**
  - * Not supported.
  - */  
  -  public String substringData(int offset, 
  -                              int count)
  -    throws DOMException
  +
  +  /**
  +   * Not supported.
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param count
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public String substringData(int offset, int count) throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  - /**
  - * Not supported.
  - */   
  -  public void appendData(String arg)
  -    throws DOMException
  +
  +  /**
  +   * Not supported.
  +   *
  +   * NEEDSDOC @param arg
  +   *
  +   * @throws DOMException
  +   */
  +  public void appendData(String arg) throws DOMException
     {
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
  -  
  -/**
  - * Not supported.
  - */    
  -  public void insertData(int offset, 
  -                         String arg)
  -    throws DOMException
  +
  +  /**
  +   * Not supported.
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param arg
  +   *
  +   * @throws DOMException
  +   */
  +  public void insertData(int offset, String arg) throws DOMException
     {
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
   
     /**
  - * Not supported.
  - */  
  -  public void deleteData(int offset, 
  -                         int count)
  -    throws DOMException
  +   * Not supported.
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param count
  +   *
  +   * @throws DOMException
  +   */
  +  public void deleteData(int offset, int count) throws DOMException
     {
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
   
  -/**
  - * Not supported.
  - */    
  -  public void replaceData(int offset, 
  -                          int count, 
  -                          String arg)
  -    throws DOMException
  +  /**
  +   * Not supported.
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param count
  +   * NEEDSDOC @param arg
  +   *
  +   * @throws DOMException
  +   */
  +  public void replaceData(int offset, int count, String arg)
  +          throws DOMException
     {
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
   
  -/**
  - * Not supported.
  - */    
  -  public void setData(String data)
  -    throws DOMException
  +  /**
  +   * Not supported.
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * @throws DOMException
  +   */
  +  public void setData(String data) throws DOMException
     {
  +
       // TODO: It would be cool to make this callable, to set 
       // a value in the database.
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
   
  -  
     /**
      * The owner of a col text ode is the #Document (represented by XStatement).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Document getOwnerDocument()
     {
       return this.getXStatement();
     }
  -  
  +
     /**
      * Return "#Text".
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNodeName()
     {
       return "#Text";
     }
  -      
  +
     /**
      * Return null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getFirstChild()
  +  public Node getFirstChild()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnData.getNextSibling");
  +
       return null;
     }
  -  
  +
     /**
      * This always returns null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getNextSibling()
  +  public Node getNextSibling()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnData.getNextSibling");
  +
       return null;
     }
  -  
  +
     /**
      * The parent node of the col text node is the col node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getParentNode()
  +  public Node getParentNode()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnData.getParentNode");
  +
       return m_parent;
     }
  -  
  +
     /**
  -   * Tell if there are any children of the col node, 
  +   * Tell if there are any children of the col node,
      * which is always false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean            hasChildNodes()
  +  public boolean hasChildNodes()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnData.hasChildNodes");
  +
       return false;
     }
   }
  
  
  
  1.3       +258 -71   xml-xalan/java/src/org/apache/xalan/lib/sql/ColumnHeader.java
  
  Index: ColumnHeader.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/ColumnHeader.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ColumnHeader.java	2000/09/22 19:46:21	1.2
  +++ ColumnHeader.java	2000/10/30 18:56:32	1.3
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.Node;
  @@ -11,20 +67,39 @@
   import org.apache.xalan.res.XSLTErrorResources;
   
   /**
  - * This class represents a column-header Node, which contains the metadata 
  + * This class represents a column-header Node, which contains the metadata
    * for a column.
    */
   public class ColumnHeader extends StreamableNode implements NamedNodeMap
   {
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
  +
  +  /** NEEDSDOC Field m_columnIndex          */
     int m_columnIndex;
  +
  +  /** NEEDSDOC Field m_metaData          */
     ResultSetMetaData m_metaData;
  +
  +  /** NEEDSDOC Field m_parent          */
     RowSet m_parent;
  -  
  -  public ColumnHeader(XStatement statement, RowSet parent, int columnIndex, 
  +
  +  /**
  +   * Constructor ColumnHeader
  +   *
  +   *
  +   * NEEDSDOC @param statement
  +   * NEEDSDOC @param parent
  +   * NEEDSDOC @param columnIndex
  +   * NEEDSDOC @param metaData
  +   */
  +  public ColumnHeader(XStatement statement, RowSet parent, int columnIndex,
                         ResultSetMetaData metaData)
     {
  +
       super(statement);
  +
       m_columnIndex = columnIndex;
       m_metaData = metaData;
       m_parent = parent;
  @@ -32,43 +107,54 @@
   
     /**
      * Return "column-header".
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNodeName()
     {
       return XStatement.S_COLUMNHEADERNAME;
     }
  -  
  +
     /**
      * Always returns null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getFirstChild()
  +  public Node getFirstChild()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnHeader.getFirstChild");
  -    
  +
       return null;
     }
  -  
  +
     /**
      * Returns column-header Node for the next column.
      * @return a ColumnHeader Node or null.
      */
  -  public Node               getNextSibling()
  +  public Node getNextSibling()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnHeader.getNextSibling");
  +
       // try
       {
  -      if(this.getNodeTest().getNamespace() == null)
  +      if (this.getNodeTest().getNamespace() == null)
         {
  -        if(this.getNodeTest().getLocalName().equals(XStatement.S_COLUMNHEADERNAME))
  +        if (this.getNodeTest().getLocalName().equals(
  +                XStatement.S_COLUMNHEADERNAME))
           {
  -          int nextIndex = m_columnIndex+1;
  -          if(nextIndex < m_parent.m_columnHeaders.length)
  +          int nextIndex = m_columnIndex + 1;
  +
  +          if (nextIndex < m_parent.m_columnHeaders.length)
             {
  -            if(null == m_parent.m_columnHeaders[nextIndex])
  -              m_parent.m_columnHeaders[nextIndex] 
  -                = new ColumnHeader(getXStatement(), m_parent, nextIndex, m_metaData);
  +            if (null == m_parent.m_columnHeaders[nextIndex])
  +              m_parent.m_columnHeaders[nextIndex] =
  +                new ColumnHeader(getXStatement(), m_parent, nextIndex,
  +                                 m_metaData);
  +
               return m_parent.m_columnHeaders[nextIndex];
             }
             else
  @@ -76,99 +162,144 @@
           }
         }
       }
  +
       // catch(SQLException sqle)
       {
  +
         // diagnostics?
       }
  +
       return null;
     }
  -  
  +
     /**
      * The parent node of a column-header Node is the row-set Node.
      * @returns a RowSet.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getParentNode()
  +  public Node getParentNode()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnHeader.getParentNode");
  +
       return m_parent;
     }
  -  
  +
     /**
  -   * Tell if there are any children of the column-header Node, 
  +   * Tell if there are any children of the column-header Node,
      * which is always false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean            hasChildNodes()
  +  public boolean hasChildNodes()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In ColumnHeader.hasChildNodes");
  +
       return false;
     }
   
     /**
      * Return the metadata for this column.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public NamedNodeMap       getAttributes()
  +  public NamedNodeMap getAttributes()
     {
       return this;
     }
  -  
  +
     // ============= NamedNodeMap ===============
  -  
  +
  +  /** NEEDSDOC Field m_attributes          */
     ColumnAttribute[] m_attributes = null;
  -  
  +
  +  /**
  +   * NEEDSDOC Method allocAttrs 
  +   *
  +   */
     private void allocAttrs()
     {
  +
       // try
       {
         m_attributes = new ColumnAttribute[ColumnAttribute.NUMBER_ATTRIBUTES];
       }
  +
       // catch(SQLException sqle)
       {
  +
         // diagnostics?
       }
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method allocAttr 
  +   *
  +   *
  +   * NEEDSDOC @param pos
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (allocAttr) @return
  +   */
     private ColumnAttribute allocAttr(int pos, String name)
     {
  -    if(null == m_attributes[pos])
  +
  +    if (null == m_attributes[pos])
       {
  -      ColumnAttribute attr
  -        = new ColumnAttribute(this.getXStatement(),
  -                              this,
  -                              m_columnIndex, pos, m_metaData);
  +      ColumnAttribute attr = new ColumnAttribute(this.getXStatement(), this,
  +                                                 m_columnIndex, pos,
  +                                                 m_metaData);
  +
         attr.m_name = name;
         m_attributes[pos] = attr;
       }
  +
       return m_attributes[pos];
     }
  -  
  - /**
  -  * Get an attribute by name from the metadata for this column.
  -  */
  +
  +  /**
  +   * Get an attribute by name from the metadata for this column.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Node getNamedItem(String name)
     {
  -    if(null == m_attributes)
  +
  +    if (null == m_attributes)
         allocAttrs();
  +
       int pos = ColumnAttribute.getAttrPosFromName(name);
  -    if(pos >= 0)
  +
  +    if (pos >= 0)
       {
         return allocAttr(pos, name);
       }
       else
         return null;
     }
  -    
  - /**
  -  * Get an attribute by index from the metadata for this column.
  -  */
  +
  +  /**
  +   * Get an attribute by index from the metadata for this column.
  +   *
  +   * NEEDSDOC @param index
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Node item(int index)
     {
  -    if(null == m_attributes)
  +
  +    if (null == m_attributes)
         allocAttrs();
  -    
  +
       String name = ColumnAttribute.getAttrNameFromPos(index);
  -    if(null != name)
  +
  +    if (null != name)
       {
         return allocAttr(index, name);
       }
  @@ -176,49 +307,105 @@
         return null;
     }
   
  - /**
  -  * Get the number of attributes of column metadata attributes.
  -  */  
  +  /**
  +   * Get the number of attributes of column metadata attributes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public int getLength()
     {
       return ColumnAttribute.NUMBER_ATTRIBUTES;
     }
   
  -  public Node getNamedItemNS(String namespaceURI, 
  -                             String localName)
  +  /**
  +   * NEEDSDOC Method getNamedItemNS 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC (getNamedItemNS) @return
  +   */
  +  public Node getNamedItemNS(String namespaceURI, String localName)
     {
  -    if(null == namespaceURI)
  +
  +    if (null == namespaceURI)
         return getNamedItem(localName);
  +
       return null;
     }
  -  
  -  public Node setNamedItem(Node arg)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method setNamedItem 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   *
  +   * NEEDSDOC (setNamedItem) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node setNamedItem(Node arg) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  public Node removeNamedItem(String name)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method removeNamedItem 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (removeNamedItem) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node removeNamedItem(String name) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  public Node setNamedItemNS(Node arg)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method setNamedItemNS 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   *
  +   * NEEDSDOC (setNamedItemNS) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node setNamedItemNS(Node arg) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  public Node removeNamedItemNS(String namespaceURI, 
  -                                String localName)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method removeNamedItemNS 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC (removeNamedItemNS) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node removeNamedItemNS(String namespaceURI, String localName)
  +          throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -
   }
  
  
  
  1.4       +142 -33   xml-xalan/java/src/org/apache/xalan/lib/sql/Row.java
  
  Index: Row.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/Row.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Row.java	2000/09/22 19:46:23	1.3
  +++ Row.java	2000/10/30 18:56:32	1.4
  @@ -1,8 +1,65 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.Document;
   import org.w3c.dom.DOMException;
  +
   import org.apache.xalan.utils.UnImplNode;
   
   import java.sql.ResultSet;
  @@ -11,147 +68,199 @@
   import java.sql.ResultSet;
   
   /**
  - * This class represents a row from a query result set.  It is used 
  - * over and over, and so is certainly not fully DOM complient, 
  - * and will result in strange results in the stylesheet if the 
  + * This class represents a row from a query result set.  It is used
  + * over and over, and so is certainly not fully DOM complient,
  + * and will result in strange results in the stylesheet if the
    * user is not carefull.
    */
   public class Row extends StreamableNode
   {
  +
  +  /** NEEDSDOC Field m_childCount          */
     int m_childCount;
  +
  +  /** NEEDSDOC Field m_columns          */
     Column[] m_columns;
  +
  +  /** NEEDSDOC Field m_metadata          */
     ResultSetMetaData m_metadata;
  +
  +  /** NEEDSDOC Field m_isStreamable          */
     boolean m_isStreamable = false;
  -  Row m_next; // normally null, if streamable.
  +
  +  /** NEEDSDOC Field m_next          */
  +  Row m_next;  // normally null, if streamable.
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
  +
  +  /** NEEDSDOC Field m_parent          */
     RowSet m_parent;
  -  
  +
  +  /**
  +   * Constructor Row
  +   *
  +   *
  +   * NEEDSDOC @param statement
  +   * NEEDSDOC @param parent
  +   */
     public Row(XStatement statement, RowSet parent)
     {
  +
       super(statement);
  +
       try
       {
         m_parent = parent;
  +
         XStatement xstatement = this.getXStatement();
         ResultSet resultSet = xstatement.getResultSet();
         ResultSetMetaData metadata = resultSet.getMetaData();
  +
         m_metadata = metadata;
         m_childCount = metadata.getColumnCount();
         m_columns = new Column[m_childCount];
  -      for(int i = 0; i < m_childCount; i++)
  +
  +      for (int i = 0; i < m_childCount; i++)
         {
           m_columns[i] = new Column(xstatement, this, i, metadata);
         }
       }
  -    catch(SQLException sqle)
  +    catch (SQLException sqle)
       {
  +
         // diagnostics?
       }
     }
  -    
  +
     // ===== Element implementation =====
  -    
  +
     /**
      * The parent of a row is #Document represented by XStatement).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Document getOwnerDocument()
     {
       return this.getXStatement();
     }
  -  
  +
     /**
      * Return "row".
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNodeName()
     {
       return XStatement.S_ROWNAME;
     }
  -      
  +
     /**
      * Return the first col element for the current row.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getFirstChild()
  +  public Node getFirstChild()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In Row.getFirstChild");
  -    
  -    if(this.hasChildNodes())
  +
  +    if (this.hasChildNodes())
         return m_columns[0];
       else
         return null;
     }
  -  
  +
     /**
      * Return next row in the row-set. Use the same Row object over and over
      * if the row-set is streamable.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getNextSibling()
  +  public Node getNextSibling()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
       {
         System.out.print("In Row.getNextSibling");
         System.out.flush();
       }
  +
       XStatement xstatement = this.getXStatement();
       ResultSet resultSet = xstatement.getResultSet();
  +
       try
       {
  -      if(m_isStreamable)
  +      if (m_isStreamable)
         {
  -        if(resultSet.next())
  +        if (resultSet.next())
             return this;
           else
             return null;
         }
         else
         {
  -        if(null == m_next)
  +        if (null == m_next)
           {
             try
             {
  -            if(resultSet.next())
  +            if (resultSet.next())
                 m_next = new Row(getXStatement(), m_parent);
             }
  -          catch(SQLException sqle)
  +          catch (SQLException sqle)
             {
  +
               // Diagnostics?
             }
           }
  -        if(DEBUG)
  +
  +        if (DEBUG)
           {
  -          System.out.println(": m_next: "+m_next);
  +          System.out.println(": m_next: " + m_next);
             System.out.flush();
  +
             // Exception e = new Exception();
             // e.printStackTrace();
           }
  +
           return m_next;
         }
       }
  -    catch(SQLException sqle)
  +    catch (SQLException sqle)
       {
  +
         // Diagnostics?
         return null;
       }
     }
  -    
  +
     /**
      * Return the RowSet parent.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getParentNode()
  +  public Node getParentNode()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In Row.getParentNode");
  +
       return m_parent;
     }
  -  
  +
     /**
  -   * Tell if the row Node has any children (col Nodes), 
  +   * Tell if the row Node has any children (col Nodes),
      * which should always be true.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean            hasChildNodes()
  +  public boolean hasChildNodes()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In Row.hasChildNodes");
  +
       return (m_childCount > 0);
     }
   }
  
  
  
  1.3       +117 -27   xml-xalan/java/src/org/apache/xalan/lib/sql/RowSet.java
  
  Index: RowSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/RowSet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- RowSet.java	2000/09/22 19:46:24	1.2
  +++ RowSet.java	2000/10/30 18:56:33	1.3
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.Node;
  @@ -9,68 +65,90 @@
   import java.sql.ResultSetMetaData;
   
   /**
  - * This class represents the row-set StreamableNode, a "streamable" holder  
  + * This class represents the row-set StreamableNode, a "streamable" holder
    * for the JDBC query result set.
    */
   public class RowSet extends StreamableNode
   {
  +
  +  /** NEEDSDOC Field m_columnHeaders          */
     ColumnHeader[] m_columnHeaders;
  +
  +  /** NEEDSDOC Field m_firstrow          */
     Row m_firstrow;
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
   
  +  /**
  +   * Constructor RowSet
  +   *
  +   *
  +   * NEEDSDOC @param statement
  +   */
     public RowSet(XStatement statement)
     {
       super(statement);
     }
  -  
  +
     // ===== Element implementation =====
  -    
  +
     /**
      * Return "row-set".
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNodeName()
     {
       return XStatement.S_DOCELEMENTNAME;
     }
  -    
  +
     /**
      * The first time the client asks for a column-header element, instantiate an array of ColumnHeaders
      * (1 per column), and return the ColumnHeader for the first row.
      * @return ColumnHeader Node for first row or null.
      */
  -  public Node               getFirstChild()
  +  public Node getFirstChild()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In RowSet.getFirstChild");
   
       try
       {
  -      if(this.getNodeTest().getNamespace() == null)
  +      if (this.getNodeTest().getNamespace() == null)
         {
  -        if(this.getNodeTest().getLocalName().equals(XStatement.S_COLUMNHEADERNAME))
  +        if (this.getNodeTest().getLocalName().equals(
  +                XStatement.S_COLUMNHEADERNAME))
           {
  -          if(null == m_columnHeaders)
  +          if (null == m_columnHeaders)
             {
  -            ResultSetMetaData metaData = getXStatement().m_resultSet.getMetaData();
  +            ResultSetMetaData metaData =
  +              getXStatement().m_resultSet.getMetaData();
               int columnCount = metaData.getColumnCount();
  -            if(columnCount > 0)
  +
  +            if (columnCount > 0)
               {
                 m_columnHeaders = new ColumnHeader[columnCount];
  -              m_columnHeaders[0] = new ColumnHeader(getXStatement(), this, 0, metaData);
  +              m_columnHeaders[0] = new ColumnHeader(getXStatement(), this, 0,
  +                                                    metaData);
  +
                 return m_columnHeaders[0];
               }
  -            else 
  +            else
                 return null;
             }
             else
               return m_columnHeaders[0];
           }
  -        else if(this.getNodeTest().getLocalName().equals(XStatement.S_ROWNAME))
  +        else if (this.getNodeTest().getLocalName().equals(
  +                XStatement.S_ROWNAME))
           {
  -          if(null == m_firstrow)
  +          if (null == m_firstrow)
             {
               m_firstrow = new Row(getXStatement(), this);
             }
  +
             return m_firstrow;
           }
           else
  @@ -79,42 +157,54 @@
         else
           return null;
       }
  -    catch(SQLException sqle)
  +    catch (SQLException sqle)
       {
  +
         // diagnostics?
         return null;
       }
     }
  -  
  +
     /**
      * This always returns null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getNextSibling()
  +  public Node getNextSibling()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In RowSet.getNextSibling");
  +
       return null;
     }
  -  
  +
     /**
      * The parent node of row-set is #Document (represented by XStatement).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getParentNode()
  +  public Node getParentNode()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In RowSet.getParentNode");
  +
       return this.getXStatement();
     }
  -  
  +
     /**
  -   * Tell if there are any children of the document, 
  +   * Tell if there are any children of the document,
      * which is always true.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean            hasChildNodes()
  +  public boolean hasChildNodes()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In RowSet.hasChildNodes");
  +
       return true;
     }
  -
   }
  
  
  
  1.6       +242 -47   xml-xalan/java/src/org/apache/xalan/lib/sql/StreamableNode.java
  
  Index: StreamableNode.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/StreamableNode.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- StreamableNode.java	2000/10/17 18:46:51	1.5
  +++ StreamableNode.java	2000/10/30 18:56:33	1.6
  @@ -1,55 +1,157 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.Document;
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.DOMException;
  +
   import org.apache.xalan.utils.UnImplNode;
   import org.apache.xpath.patterns.NodeTestFilter;
   import org.apache.xpath.patterns.NodeTest;
   import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xpath.DOMOrder;
  +import org.apache.xpath.axes.AxesWalker;
   
   /**
    * This is the superclass for all nodes in the org.apache.xalan.lib.sql package.
    */
  -public class StreamableNode extends UnImplNode 
  -  implements NodeTestFilter, NamedNodeMap, DOMOrder
  +public class StreamableNode extends UnImplNode
  +        implements NodeTestFilter, NamedNodeMap, DOMOrder
   {
  +
  +  /** NEEDSDOC Field m_statement          */
     private XStatement m_statement;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getXStatement 
  +   *
  +   *
  +   * NEEDSDOC (getXStatement) @return
  +   */
     public XStatement getXStatement()
     {
       return m_statement;
     }
  -  
  -  public boolean  supports(String feature,
  -                           String version)
  +
  +  /**
  +   * NEEDSDOC Method supports 
  +   *
  +   *
  +   * NEEDSDOC @param feature
  +   * NEEDSDOC @param version
  +   *
  +   * NEEDSDOC (supports) @return
  +   */
  +  public boolean supports(String feature, String version)
     {
  -    return feature.equals("NodeTestFilter");
  +    return (AxesWalker.FEATURE_NODETESTFILTER == feature)
  +           || feature.equals(AxesWalker.FEATURE_NODETESTFILTER);
     }
  -  
  +
  +  /** NEEDSDOC Field m_nodetest          */
     private NodeTest m_nodetest;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getNodeTest 
  +   *
  +   *
  +   * NEEDSDOC (getNodeTest) @return
  +   */
     public NodeTest getNodeTest()
     {
       return m_nodetest;
     }
  -  
  +
  +  /**
  +   * Constructor StreamableNode
  +   *
  +   *
  +   * NEEDSDOC @param statement
  +   */
     public StreamableNode(XStatement statement)
     {
  +
       m_statement = statement;
  -    if(null != statement)
  +
  +    if (null != statement)
       {
         m_orderIndex = m_statement.getAndIncrementNodeCounter();
       }
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setNodeTest 
  +   *
  +   *
  +   * NEEDSDOC @param nodeTest
  +   */
     public void setNodeTest(NodeTest nodeTest)
     {
       m_nodetest = nodeTest;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getOwnerDocument 
  +   *
  +   *
  +   * NEEDSDOC (getOwnerDocument) @return
  +   */
     public Document getOwnerDocument()
     {
       return m_statement;
  @@ -57,108 +159,201 @@
   
     /**
      * Streamable nodes default to being elements.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getNodeType()
     {
       return Node.ELEMENT_NODE;
     }
  -  
  +
     /**
      * Return NodeName.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String       getLocalName()
  +  public String getLocalName()
     {
       return getNodeName();
     }
   
     /**
      * Returns null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String             getNamespaceURI()
  +  public String getNamespaceURI()
     {
       return null;
     }
   
  -  /** 
  -   * Returns null. 
  +  /**
  +   * Returns null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String             getPrefix()
  +  public String getPrefix()
     {
       return null;
     }
  -  
  -  public NamedNodeMap       getAttributes()
  +
  +  /**
  +   * NEEDSDOC Method getAttributes 
  +   *
  +   *
  +   * NEEDSDOC (getAttributes) @return
  +   */
  +  public NamedNodeMap getAttributes()
     {
       return this;
     }
   
  +  /**
  +   * NEEDSDOC Method getNamedItem 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (getNamedItem) @return
  +   */
     public Node getNamedItem(String name)
     {
       return null;
     }
  -    
  +
  +  /**
  +   * NEEDSDOC Method item 
  +   *
  +   *
  +   * NEEDSDOC @param index
  +   *
  +   * NEEDSDOC (item) @return
  +   */
     public Node item(int index)
     {
       return null;
     }
   
  +  /**
  +   * NEEDSDOC Method getLength 
  +   *
  +   *
  +   * NEEDSDOC (getLength) @return
  +   */
     public int getLength()
     {
       return 0;
     }
   
  -  public Node getNamedItemNS(String namespaceURI, 
  -                             String localName)
  +  /**
  +   * NEEDSDOC Method getNamedItemNS 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC (getNamedItemNS) @return
  +   */
  +  public Node getNamedItemNS(String namespaceURI, String localName)
     {
       return null;
     }
  -  
  -  public Node setNamedItem(Node arg)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method setNamedItem 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   *
  +   * NEEDSDOC (setNamedItem) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node setNamedItem(Node arg) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  public Node removeNamedItem(String name)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method removeNamedItem 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (removeNamedItem) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node removeNamedItem(String name) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  public Node setNamedItemNS(Node arg)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method setNamedItemNS 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   *
  +   * NEEDSDOC (setNamedItemNS) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node setNamedItemNS(Node arg) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  public Node removeNamedItemNS(String namespaceURI, 
  -                                String localName)
  -    throws DOMException
  +
  +  /**
  +   * NEEDSDOC Method removeNamedItemNS 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC (removeNamedItemNS) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node removeNamedItemNS(String namespaceURI, String localName)
  +          throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); 
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  
  +
  +  /** NEEDSDOC Field m_orderIndex          */
     int m_orderIndex = -1;
  -  
  +
     /**
      * Get the UID (document order index).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getUid()
     {
  -    if(-1 == m_orderIndex)
  +
  +    if (-1 == m_orderIndex)
       {
  -      if(null != m_statement)
  +      if (null != m_statement)
         {
           m_orderIndex = m_statement.getAndIncrementNodeCounter();
         }
         else
  -        m_orderIndex = 0; // ?
  +        m_orderIndex = 0;  // ?
       }
  +
       // System.out.println(" Returning UID: "+m_orderIndex);
       // System.out.flush();
       return m_orderIndex;
  
  
  
  1.3       +176 -74   xml-xalan/java/src/org/apache/xalan/lib/sql/XConnection.java
  
  Index: XConnection.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/XConnection.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XConnection.java	2000/09/22 19:46:26	1.2
  +++ XConnection.java	2000/10/30 18:56:33	1.3
  @@ -1,11 +1,70 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import java.sql.Connection;
   import java.sql.DatabaseMetaData;
   import java.sql.DriverManager;
   import java.sql.SQLException;
  +
   import java.util.Properties;
  +
   import org.xml.sax.AttributeList;
  +
   import org.w3c.dom.Element;
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.traversal.NodeIterator;
  @@ -13,18 +72,20 @@
   /**
    * An XSLT extension that allows a stylesheet to
    * access JDBC data. From the stylesheet perspective,
  - * XConnection provides 3 extension functions: new(), 
  + * XConnection provides 3 extension functions: new(),
    * query(), and close().
    * Use new() to call one of XConnection constructors, which
  - * establishes a JDBC driver connection to a data source and 
  + * establishes a JDBC driver connection to a data source and
    * returns an XConnection object.
  - * Then use the XConnection object query() method to return a 
  - * result set in the form of a row-set element. 
  + * Then use the XConnection object query() method to return a
  + * result set in the form of a row-set element.
    * When you have finished working with the row-set, call the
    * XConnection object close() method to terminate the connection.
    */
   public class XConnection
  -{ 
  +{
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
   
     /**
  @@ -36,7 +97,7 @@
      * A database URL of the form jdbc:subprotocol:subname.
      */
     public String m_dbURL;
  -  
  +
     /**
      * A user ID.
      */
  @@ -45,21 +106,20 @@
     /**
      * A password.
      */
  -public String m_password;
  -  
  +  public String m_password;
  +
     /**
  -   * A list of arbitrary string tag/value pairs as connection 
  -   * arguments; normally at least a "user" and "password" 
  +   * A list of arbitrary string tag/value pairs as connection
  +   * arguments; normally at least a "user" and "password"
      * property should be included.
      */
  -  
     public Properties m_protocol;
  -  
  +
     /**
      * The JDBC connection.
      */
     public Connection m_connection = null;
  -    
  +
     /**
      * Create an XConnection object with just a driver and database URL.
      * @param driver JDBC driver of the form foo.bar.Driver.
  @@ -67,10 +127,12 @@
      */
     public XConnection(String driver, String dbURL)
     {
  +
       super();
  -	
  +
       init(driver, dbURL, null, null, null, 1);
     }
  +
     /**
      * Create an XConnection object with user ID and password.
      * @param driver JDBC driver of the form foo.bar.Driver.
  @@ -78,126 +140,166 @@
      * @param user user ID.
      * @param password connection password.
      */
  -  
  -  public XConnection(String driver, String dbURL, String user, String password)
  -   {
  +  public XConnection(String driver, String dbURL, String user,
  +                     String password)
  +  {
  +
       super();
  +
       init(driver, dbURL, user, password, null, 3);
     }
  -  
  +
     /**
      * Create an XConnection object with a connection protocol
      * @param driver JDBC driver of the form foo.bar.Driver.
      * @param dbURL database URL of the form jdbc:subprotocol:subname.
      * @param protocol list of string tag/value connection arguments,
      * normally including at least "user" and "password".
  +   * NEEDSDOC @param protocolElem
      */
     public XConnection(String driver, String dbURL, Element protocolElem)
     {
  -    super();	
  +
  +    super();
  +
       init(driver, dbURL, null, null, protocolElem, 2);
  -  }  
  +  }
  +
     /**
      * Initialize.
  -   */
  -  private void init(String driver, String dbURL, String user, 
  -					String password,  Element protocolElem, int getConnectionArgs)
  +   *
  +   * NEEDSDOC @param driver
  +   * NEEDSDOC @param dbURL
  +   * NEEDSDOC @param user
  +   * NEEDSDOC @param password
  +   * NEEDSDOC @param protocolElem
  +   * NEEDSDOC @param getConnectionArgs
  +   */
  +  private void init(String driver, String dbURL, String user,
  +                    String password, Element protocolElem,
  +                    int getConnectionArgs)
     {
  +
       m_driver = driver;
       m_dbURL = dbURL;
  -	m_user = user;
  -	m_password = password;
  -	
  -	if(protocolElem == null)
  -	  m_protocol = null;
  -	else
  -	{
  -	  m_protocol = new Properties();
  -	  NamedNodeMap atts = protocolElem.getAttributes();
  +    m_user = user;
  +    m_password = password;
  +
  +    if (protocolElem == null)
  +      m_protocol = null;
  +    else
  +    {
  +      m_protocol = new Properties();
  +
  +      NamedNodeMap atts = protocolElem.getAttributes();
  +
         for (int i = 0; i < atts.getLength(); i++)
  -      {	  
  -        m_protocol.put(atts.item(i).getNodeName(), atts.item(i).getNodeValue());
  +      {
  +        m_protocol.put(atts.item(i).getNodeName(),
  +                       atts.item(i).getNodeValue());
         }
  -	}	
  -	connect(driver, dbURL, user, password, m_protocol, getConnectionArgs);
  +    }
  +
  +    connect(driver, dbURL, user, password, m_protocol, getConnectionArgs);
     }
  -  
  +
     /**
  -   * Connect to the JDBC database. 
  +   * Connect to the JDBC database.
      * @param driver Database url of the form jdbc:subprotocol:subname .
  -   * @param protocol List of arbitrary string tag/value pairs as 
  -   * connection arguments; normally at least a "user" and "password" 
  +   * NEEDSDOC @param dbURL
  +   * NEEDSDOC @param user
  +   * NEEDSDOC @param password
  +   * @param protocol List of arbitrary string tag/value pairs as
  +   * connection arguments; normally at least a "user" and "password"
      * property should be included.
  +   * NEEDSDOC @param getConnectionArgs
      */
     public void connect(String driver, String dbURL, String user,
  -					  String password, Properties protocol, int getConnectionArgs) 
  -  {    
    try 
  -    {      
  +                      String password, Properties protocol,
  +                      int getConnectionArgs)
  +  {
  +
  +    try
  +    {
  +
         // The driver is installed by loading its class.
         Class.forName(driver).newInstance();
   
         // Use the appropriate getConnection() method.
  -	  switch(getConnectionArgs)
  -	  {
  -	    case 1:		 
  -	    m_connection = DriverManager.getConnection(dbURL);
  -		break;
  -	    case 2:
  -		m_connection = DriverManager.getConnection(dbURL, protocol);
  -		break;
  -        case 3:
  -		m_connection = DriverManager.getConnection(dbURL, user, password);
  -	 }
  +      switch (getConnectionArgs)
  +      {
  +      case 1 :
  +        m_connection = DriverManager.getConnection(dbURL);
  +        break;
  +      case 2 :
  +        m_connection = DriverManager.getConnection(dbURL, protocol);
  +        break;
  +      case 3 :
  +        m_connection = DriverManager.getConnection(dbURL, user, password);
  +      }
  +
         /*
         We could also turn autocommit off by putting
         ;autocommit=false on the URL.
         */
         m_connection.setAutoCommit(false);
  -      
	  DatabaseMetaData dma = m_connection.getMetaData ();
  +
  +      DatabaseMetaData dma = m_connection.getMetaData();
   
  -      if(DEBUG)
  +      if (DEBUG)
         {
           System.out.println("\nConnected to " + dma.getURL());
           System.out.println("Driver   " + dma.getDriverName());
           System.out.println("Version  " + dma.getDriverVersion());
           System.out.println("");
         }
  -
       }
  -    catch (Throwable e) 
  +    catch (Throwable e)
       {
         e.printStackTrace();
       }
     }
  -  
  - /**
  -  * Execute a query statement by instantiating an {@link org.apache.xalan.lib.sql.XStatement XStatement}
  -  * object. The XStatement executes the query, and uses the result set to create a 
  -  * {@link org.apache.xalan.lib.sql.RowSet RowSet}, a row-set element.
  -  * @param queryString the SQL query.
  -  * @return XStatement implements NodeIterator.
  -  */
  -  public NodeIterator query(String queryString)
  -    throws SQLException
  +
  +  /**
  +   * Execute a query statement by instantiating an {@link org.apache.xalan.lib.sql.XStatement XStatement}
  +   * object. The XStatement executes the query, and uses the result set to create a
  +   * {@link org.apache.xalan.lib.sql.RowSet RowSet}, a row-set element.
  +   * @param queryString the SQL query.
  +   * @return XStatement implements NodeIterator.
  +   *
  +   * @throws SQLException
  +   */
  +  public NodeIterator query(String queryString) throws SQLException
     {
  +
       // TODO: These need to be pooled.
       return new XStatement(this, queryString);
     }
  -  
  +
     /*
      * Close the connection to the data source.
      */
  -   public void close()
  -    throws SQLException
  +
  +  /**
  +   * NEEDSDOC Method close 
  +   *
  +   *
  +   * @throws SQLException
  +   */
  +  public void close() throws SQLException
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("Entering XConnection.close");
  -    if(null != m_connection)
  +
  +    if (null != m_connection)
       {
         m_connection.close();
  +
         m_connection = null;
       }
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("Exiting XConnection.close");
     }
   }
  
  
  
  1.4       +324 -97   xml-xalan/java/src/org/apache/xalan/lib/sql/XStatement.java
  
  Index: XStatement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/lib/sql/XStatement.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XStatement.java	2000/09/22 19:46:27	1.3
  +++ XStatement.java	2000/10/30 18:56:33	1.4
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.lib.sql;
   
   import org.w3c.dom.traversal.NodeIterator;
  @@ -15,62 +71,108 @@
   
   /**
    * Represents a JDBC query statement. Also acts as both a
  - * NodeIterator and the Document node for the row-set representation 
  + * NodeIterator and the Document node for the row-set representation
    * of the query result set.
    */
  -public class XStatement extends StreamableNode 
  -  implements NodeIterator, ContextNodeList, Cloneable
  +public class XStatement extends StreamableNode
  +        implements NodeIterator, ContextNodeList, Cloneable
   {
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
  +
  +  /** NEEDSDOC Field m_statement          */
     private Statement m_statement;
  -  
  +
  +  /** NEEDSDOC Field m_nodeCounter          */
     private int m_nodeCounter = 0;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getAndIncrementNodeCounter 
  +   *
  +   *
  +   * NEEDSDOC (getAndIncrementNodeCounter) @return
  +   */
     int getAndIncrementNodeCounter()
     {
  +
       int c = m_nodeCounter;
  +
       m_nodeCounter++;
  +
       return c;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getStatement 
  +   *
  +   *
  +   * NEEDSDOC (getStatement) @return
  +   */
     public Statement getStatement()
     {
       return m_statement;
     }
  -  
  +
  +  /** NEEDSDOC Field m_resultSet          */
     ResultSet m_resultSet;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getResultSet 
  +   *
  +   *
  +   * NEEDSDOC (getResultSet) @return
  +   */
     public ResultSet getResultSet()
     {
       return m_resultSet;
     }
  -  
  +
  +  /** NEEDSDOC Field m_xconnection          */
     private XConnection m_xconnection;
  -  private String m_queryString; 
  +
  +  /** NEEDSDOC Field m_queryString          */
  +  private String m_queryString;
  +
  +  /** NEEDSDOC Field m_rowset          */
     RowSet m_rowset;
  +
  +  /** NEEDSDOC Field m_nextHasBeenCalled          */
     boolean m_nextHasBeenCalled = false;
  -  
  +
  +  /** NEEDSDOC Field S_DOCELEMENTNAME          */
     static final String S_DOCELEMENTNAME = "row-set";
  +
  +  /** NEEDSDOC Field S_COLUMNHEADERNAME          */
     static final String S_COLUMNHEADERNAME = "column-header";
  +
  +  /** NEEDSDOC Field S_ROWNAME          */
     static final String S_ROWNAME = "row";
  +
  +  /** NEEDSDOC Field S_COLUMNNAME          */
     static final String S_COLUMNNAME = "col";
  -  
  - /**
  -  * The {@link org.apache.xalan.lib.sql.XConnection#query(java.lang.String) XConnection query()}
  -  * method uses this constructor to execute a SQL query statement. When instantiated,
  -  * XStatement executes the query and creates a 
  -  * {@link org.apache.xalan.lib.sql.RowSet RowSet}, a row-set element associated with the query
  -  * result set.
  -  * @param connection the XConnection object that calls this constructor.
  -  * @param queryString the SQL query.
  -  * 
  -  */
  +
  +  /**
  +   * The {@link org.apache.xalan.lib.sql.XConnection#query(java.lang.String) XConnection query()}
  +   * method uses this constructor to execute a SQL query statement. When instantiated,
  +   * XStatement executes the query and creates a
  +   * {@link org.apache.xalan.lib.sql.RowSet RowSet}, a row-set element associated with the query
  +   * result set.
  +   * @param connection the XConnection object that calls this constructor.
  +   * @param queryString the SQL query.
  +   *
  +   *
  +   * @throws SQLException
  +   */
     public XStatement(XConnection connection, String queryString)
  -    throws SQLException
  +          throws SQLException
     {
  +
       super(null);
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement constructor");
  +
       // The SQL statement which lets us execute commands against the connection.
       m_xconnection = connection;
       m_statement = m_xconnection.m_connection.createStatement();
  @@ -78,37 +180,49 @@
       m_resultSet = m_statement.executeQuery(m_queryString);
       m_rowset = new RowSet(this);
   
  -    if(DEBUG)
  +    if (DEBUG)
         System.out.println("Exiting XStatement constructor");
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getXStatement 
  +   *
  +   *
  +   * NEEDSDOC (getXStatement) @return
  +   */
     public XStatement getXStatement()
     {
       return this;
     }
  -    
  +
     // ============== NodeIterator interface =============
  -  
  +
     /**
      *  The XStatement object is the NodeIterator root.
      * @return itself.
      */
     public Node getRoot()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.getRoot");
  +
       return this;
     }
   
     /**
  -   *  This attribute determines which node types are presented via the 
  -   * iterator. The available set of constants is defined in the 
  +   *  This attribute determines which node types are presented via the
  +   * iterator. The available set of constants is defined in the
      * <code>NodeFilter</code> interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getWhatToShow()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.getWhatToShow");
  +
       // TODO: ??
       return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
     }
  @@ -119,94 +233,118 @@
      */
     public NodeFilter getFilter()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.getFilter");
  +
       return null;
     }
   
     /**
  -   *  The value of this flag determines whether the children of entity 
  -   * reference nodes are visible to the iterator. If false, they will be 
  +   *  The value of this flag determines whether the children of entity
  +   * reference nodes are visible to the iterator. If false, they will be
      * skipped over.
  -   * <br> To produce a view of the document that has entity references 
  -   * expanded and does not expose the entity reference node itself, use the 
  -   * whatToShow flags to hide the entity reference node and set 
  -   * expandEntityReferences to true when creating the iterator. To produce 
  -   * a view of the document that has entity reference nodes but no entity 
  -   * expansion, use the whatToShow flags to show the entity reference node 
  +   * <br> To produce a view of the document that has entity references
  +   * expanded and does not expose the entity reference node itself, use the
  +   * whatToShow flags to hide the entity reference node and set
  +   * expandEntityReferences to true when creating the iterator. To produce
  +   * a view of the document that has entity reference nodes but no entity
  +   * expansion, use the whatToShow flags to show the entity reference node
      * and set expandEntityReferences to false.
      * @return true.
      */
     public boolean getExpandEntityReferences()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.getExpandEntityReferences");
  +
       return true;
     }
  -    
  +
     /**
  -   * Return the #Document node (one role the XStatement plays) the first time called; 
  +   * Return the #Document node (one role the XStatement plays) the first time called;
      * return null thereafter.
      * @return this or null.
  +   *
  +   * @throws DOMException
      */
  -  public Node nextNode()
  -    throws DOMException
  +  public Node nextNode() throws DOMException
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.nextNode");
  -    if(!m_nextHasBeenCalled)
  +
  +    if (!m_nextHasBeenCalled)
       {
         m_nextHasBeenCalled = true;
  +
         return this;
       }
       else
         return null;
     }
  -  
  +
     /**
  -   * Throw an exception, since streaming nodes and iterators can not 
  +   * Throw an exception, since streaming nodes and iterators can not
      * go backwards.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
      */
  -  public Node previousNode()
  -    throws DOMException
  +  public Node previousNode() throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getParentNode not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getParentNode not supported!");
  +
       return null;
     }
   
     /**
  -   *  Detaches the iterator from the set which it iterated over, releasing 
  -   * any computational resources and placing the iterator in the INVALID 
  -   * state. After<code>detach</code> has been invoked, calls to 
  -   * <code>nextNode</code> or<code>previousNode</code> will raise the 
  +   *  Detaches the iterator from the set which it iterated over, releasing
  +   * any computational resources and placing the iterator in the INVALID
  +   * state. After<code>detach</code> has been invoked, calls to
  +   * <code>nextNode</code> or<code>previousNode</code> will raise the
      * exception INVALID_STATE_ERR.
      */
     public void detach()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("XStatement.detach");
  +
       try
       {
         m_statement.close();
  +
         m_statement = null;
         m_resultSet = null;
       }
  -    catch(SQLException sqle)
  -    { 
  +    catch (SQLException sqle)
  +    {
  +
         // diagnostics?
       }
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method toString 
  +   *
  +   *
  +   * NEEDSDOC (toString) @return
  +   */
     public String toString()
     {
  -    return "XStatement: "+m_queryString;
  +    return "XStatement: " + m_queryString;
     }
   
  -
     // ===== Document implementation ====
  -  
  +
     /**
      * The parent of a document is null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Document getOwnerDocument()
     {
  @@ -215,128 +353,217 @@
   
     /**
      * Return Node.DOCUMENT_NODE.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getNodeType()
     {
       return Node.DOCUMENT_NODE;
     }
  -  
  +
     /**
      * Return "#Document".
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNodeName()
     {
       return "#Document";
     }
  -  
  +
     /**
      * Return the row-set node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getFirstChild()
  +  public Node getFirstChild()
     {
  -    if(DEBUG)
  -      System.out.println("In XStatement.getFirstChild: "+this.getNodeTest());
  -    
  +
  +    if (DEBUG)
  +      System.out.println("In XStatement.getFirstChild: "
  +                         + this.getNodeTest());
  +
       try
       {
  -      if((this.getNodeTest().getNamespace() == null) && 
  -         (this.getNodeTest().getLocalName().equals(S_DOCELEMENTNAME)))
  +      if ((this.getNodeTest().getNamespace() == null)
  +              && (this.getNodeTest().getLocalName().equals(S_DOCELEMENTNAME)))
           return m_rowset;
         else
           return null;
       }
  -    catch(NullPointerException e)
  +    catch (NullPointerException e)
       {
         e.printStackTrace();
  +
         throw e;
       }
     }
  -  
  +
     /**
      * This always returns null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getNextSibling()
  +  public Node getNextSibling()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.getNextSibling");
  +
       return null;
     }
  -  
  +
     /**
      * The parent node of document is always null.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Node               getParentNode()
  +  public Node getParentNode()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.getParentNode");
  +
       return null;
     }
  -  
  +
     /**
  -   * Tell if there are any children of the document, 
  +   * Tell if there are any children of the document,
      * which is always true.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean            hasChildNodes()
  +  public boolean hasChildNodes()
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
         System.out.println("In XStatement.hasChildNodes");
  +
       return true;
     }
  -  
  +
     // ===== ContextNodeList implementation =====
  -  
  +
  +  /**
  +   * NEEDSDOC Method getCurrentNode 
  +   *
  +   *
  +   * NEEDSDOC (getCurrentNode) @return
  +   */
     public Node getCurrentNode()
     {
       return this.m_rowset;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getCurrentPos 
  +   *
  +   *
  +   * NEEDSDOC (getCurrentPos) @return
  +   */
     public int getCurrentPos()
     {
  -    return 0; // Not totally sure...
  +    return 0;  // Not totally sure...
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method reset 
  +   *
  +   */
     public void reset()
     {
       this.m_nextHasBeenCalled = false;
     }
   
  +  /**
  +   * NEEDSDOC Method setShouldCacheNodes 
  +   *
  +   *
  +   * NEEDSDOC @param b
  +   */
     public void setShouldCacheNodes(boolean b)
     {
  +
       // Set streamable?
     }
   
  +  /**
  +   * NEEDSDOC Method runTo 
  +   *
  +   *
  +   * NEEDSDOC @param index
  +   */
     public void runTo(int index)
     {
  +
       // Throw exception if not streamable!
     }
   
  +  /**
  +   * NEEDSDOC Method setCurrentPos 
  +   *
  +   *
  +   * NEEDSDOC @param i
  +   */
     public void setCurrentPos(int i)
     {
  +
       // Throw exception if not streamable!
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method size 
  +   *
  +   *
  +   * NEEDSDOC (size) @return
  +   */
     public int size()
     {
       return 1;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method isFresh 
  +   *
  +   *
  +   * NEEDSDOC (isFresh) @return
  +   */
     public boolean isFresh()
     {
       return (!this.m_nextHasBeenCalled);
     }
  -  
  -  public NodeIterator cloneWithReset()
  -    throws CloneNotSupportedException
  +
  +  /**
  +   * NEEDSDOC Method cloneWithReset 
  +   *
  +   *
  +   * NEEDSDOC (cloneWithReset) @return
  +   *
  +   * @throws CloneNotSupportedException
  +   */
  +  public NodeIterator cloneWithReset() throws CloneNotSupportedException
     {
  -    XStatement clone = (XStatement)super.clone();
  +
  +    XStatement clone = (XStatement) super.clone();
  +
       clone.reset();
  +
       return clone;
     }
   
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  /**
  +   * NEEDSDOC Method clone 
  +   *
  +   *
  +   * NEEDSDOC (clone) @return
  +   *
  +   * @throws CloneNotSupportedException
  +   */
  +  public Object clone() throws CloneNotSupportedException
     {
  -    XStatement clone = (XStatement)super.clone();
  +
  +    XStatement clone = (XStatement) super.clone();
  +
       return clone;
     }
   }
  
  
  
  1.3       +188 -106  xml-xalan/java/src/org/apache/xalan/res/XSLMessages.java
  
  Index: XSLMessages.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLMessages.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XSLMessages.java	2000/07/05 14:38:45	1.2
  +++ XSLMessages.java	2000/10/30 18:56:37	1.3
  @@ -60,42 +60,60 @@
   import java.util.ResourceBundle;
   import java.util.ListResourceBundle;
   import java.util.MissingResourceException;
  -import org.apache.xpath.res.XPATHErrorResources;
  -
   
  +import org.apache.xpath.res.XPATHErrorResources;
   
   /**
    * <meta name="usage" content="internal"/>
  - * Sets things up for issuing error messages.  This class is misnamed, and 
  + * Sets things up for issuing error messages.  This class is misnamed, and
    * should be called XalanMessages, or some such.
    */
  -public class XSLMessages 
  +public class XSLMessages
   {
  -  
  +
  +  /** NEEDSDOC Field fLocale          */
     private Locale fLocale = Locale.getDefault();
  -  private static XSLResourceBundle XSLTBundle = null ;
  -  private static XSLResourceBundle XPATHBundle = null ;
  -  private static final String XSLT_ERROR_RESOURCES = "org.apache.xalan.res.XSLTErrorResources";
  -  private static final String XPATH_ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources";
  +
  +  /** NEEDSDOC Field XSLTBundle          */
  +  private static XSLResourceBundle XSLTBundle = null;
  +
  +  /** NEEDSDOC Field XPATHBundle          */
  +  private static XSLResourceBundle XPATHBundle = null;
  +
  +  /** NEEDSDOC Field XSLT_ERROR_RESOURCES          */
  +  private static final String XSLT_ERROR_RESOURCES =
  +    "org.apache.xalan.res.XSLTErrorResources";
  +
  +  /** NEEDSDOC Field XPATH_ERROR_RESOURCES          */
  +  private static final String XPATH_ERROR_RESOURCES =
  +    "org.apache.xpath.res.XPATHErrorResources";
  +
  +  /** NEEDSDOC Field BAD_CODE          */
     private static String BAD_CODE = "BAD_CODE";
  +
  +  /** NEEDSDOC Field FORMAT_FAILED          */
     private static String FORMAT_FAILED = "FORMAT_FAILED";
  -  
  +
     /**
      *
  +   *
  +   * NEEDSDOC @param locale
      */
  -  public void setLocale(Locale locale) 
  +  public void setLocale(Locale locale)
     {
       fLocale = locale;
     }
  -  
  +
     /**
      *
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Locale getLocale() 
  +  public Locale getLocale()
     {
       return fLocale;
     }
  -  
  +
     /**
      * Creates a message from the specified key and replacement
      * arguments, localized to the given locale.
  @@ -103,22 +121,28 @@
      * @param errorCode The key for the message text.
      * @param args      The arguments to be used as replacement text
      *                  in the message created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public static final String createXPATHWarning(int errorCode, Object args[]) //throws Exception 
  +  public static final String createXPATHWarning(int errorCode, Object args[])  //throws Exception 
     {
  -    if (XPATHBundle == null)        
  -      XPATHBundle = (XSLResourceBundle)loadResourceBundle(XPATH_ERROR_RESOURCES );      
  +
  +    if (XPATHBundle == null)
  +      XPATHBundle =
  +        (XSLResourceBundle) loadResourceBundle(XPATH_ERROR_RESOURCES);
  +
       XSLResourceBundle fResourceBundle = XPATHBundle;
  -    
  +
       if (fResourceBundle != null)
       {
         String msgKey = fResourceBundle.getWarningKey(errorCode);
  +
         return createXPATHMsg(fResourceBundle, msgKey, args);
       }
       else
         return "Could not load any resource bundles.";
     }
  -  
  +
     /**
      * Creates a message from the specified key and replacement
      * arguments, localized to the given locale.
  @@ -126,59 +150,77 @@
      * @param errorCode The key for the message text.
      * @param args      The arguments to be used as replacement text
      *                  in the message created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public static final String createXPATHMessage(int errorCode, Object args[]) //throws Exception 
  +  public static final String createXPATHMessage(int errorCode, Object args[])  //throws Exception 
     {
  +
       if (XPATHBundle == null)
  -      XPATHBundle = (XSLResourceBundle)loadResourceBundle(XPATH_ERROR_RESOURCES );
  +      XPATHBundle =
  +        (XSLResourceBundle) loadResourceBundle(XPATH_ERROR_RESOURCES);
  +
       XSLResourceBundle fResourceBundle = XPATHBundle;
  -    
  +
       if (fResourceBundle != null)
       {
         String msgKey = fResourceBundle.getMessageKey(errorCode);
  +
         return createXPATHMsg(fResourceBundle, msgKey, args);
       }
       else
  -      return "Could not load any resource bundles."; 
  +      return "Could not load any resource bundles.";
     }
  -  
  +
     /**
      * Creates a message from the specified key and replacement
      * arguments, localized to the given locale.
      *
      * @param errorCode The key for the message text.
  +   *
  +   * NEEDSDOC @param fResourceBundle
  +   * NEEDSDOC @param msgKey
      * @param args      The arguments to be used as replacement text
      *                  in the message created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public static final String createXPATHMsg(XSLResourceBundle fResourceBundle, String msgKey, Object args[]) //throws Exception 
  +  public static final String createXPATHMsg(XSLResourceBundle fResourceBundle,
  +                                            String msgKey, Object args[])  //throws Exception 
     {
  -    String fmsg= null;
  -    boolean throwex = false;		
  -    
  +
  +    String fmsg = null;
  +    boolean throwex = false;
       String msg = null;
  +
       if (msgKey != null)
         msg = fResourceBundle.getString(msgKey);
  +
       if (msg == null)
  -    {	
  +    {
         msg = fResourceBundle.getString(XPATHErrorResources.BAD_CODE);
         throwex = true;
       }
  -    if (args != null) 
  +
  +    if (args != null)
       {
  -      try 
  +      try
         {
  +
           // Do this to keep format from crying.
           // This is better than making a bunch of conditional
           // code all over the place.
           int n = args.length;
  -        for(int i = 0; i < n; i++)
  +
  +        for (int i = 0; i < n; i++)
           {
  -          if(null == args[i])
  -            args[i]="";
  +          if (null == args[i])
  +            args[i] = "";
           }
  +
           fmsg = java.text.MessageFormat.format(msg, args);
         }
  -      catch (Exception e) 
  +      catch (Exception e)
         {
           fmsg = fResourceBundle.getString(XPATHErrorResources.FORMAT_FAILED);
           fmsg += " " + msg;
  @@ -187,13 +229,14 @@
       else
         fmsg = msg;
   
  -    if (throwex) 
  +    if (throwex)
       {
         throw new RuntimeException(fmsg);
       }
  -    return fmsg;	
  -  } 
  -  
  +
  +    return fmsg;
  +  }
  +
     /**
      * Creates a message from the specified key and replacement
      * arguments, localized to the given locale.
  @@ -201,23 +244,28 @@
      * @param errorCode The key for the message text.
      * @param args      The arguments to be used as replacement text
      *                  in the message created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public static final String createWarning(int errorCode, Object args[]) //throws Exception 
  +  public static final String createWarning(int errorCode, Object args[])  //throws Exception 
     {
  +
       if (XSLTBundle == null)
  -      XSLTBundle = (XSLResourceBundle)loadResourceBundle(XSLT_ERROR_RESOURCES );
  -    
  +      XSLTBundle =
  +        (XSLResourceBundle) loadResourceBundle(XSLT_ERROR_RESOURCES);
  +
       XSLResourceBundle fResourceBundle = XSLTBundle;
  -    
  +
       if (fResourceBundle != null)
  -    { 
  +    {
         String msgKey = fResourceBundle.getWarningKey(errorCode);
  +
         return createMsg(fResourceBundle, msgKey, args);
       }
       else
  -      return "Could not load any resource bundles.";  
  +      return "Could not load any resource bundles.";
     }
  -  
  +
     /**
      * Creates a message from the specified key and replacement
      * arguments, localized to the given locale.
  @@ -225,60 +273,77 @@
      * @param errorCode The key for the message text.
      * @param args      The arguments to be used as replacement text
      *                  in the message created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public static final String createMessage(int errorCode, Object args[]) //throws Exception 
  +  public static final String createMessage(int errorCode, Object args[])  //throws Exception 
     {
  +
       if (XSLTBundle == null)
  -      XSLTBundle = (XSLResourceBundle)loadResourceBundle(XSLT_ERROR_RESOURCES );
  -    
  +      XSLTBundle =
  +        (XSLResourceBundle) loadResourceBundle(XSLT_ERROR_RESOURCES);
  +
       XSLResourceBundle fResourceBundle = XSLTBundle;
  -    
  +
       if (fResourceBundle != null)
  -    {  
  +    {
         String msgKey = fResourceBundle.getMessageKey(errorCode);
  +
         return createMsg(fResourceBundle, msgKey, args);
       }
       else
         return "Could not load any resource bundles.";
  -  }  
  -  
  +  }
  +
     /**
      * Creates a message from the specified key and replacement
      * arguments, localized to the given locale.
      *
      * @param errorCode The key for the message text.
  +   *
  +   * NEEDSDOC @param fResourceBundle
  +   * NEEDSDOC @param msgKey
      * @param args      The arguments to be used as replacement text
      *                  in the message created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public static final String createMsg(XSLResourceBundle fResourceBundle, String msgKey, Object args[]) //throws Exception 
  +  public static final String createMsg(XSLResourceBundle fResourceBundle,
  +                                       String msgKey, Object args[])  //throws Exception 
     {
  -    String fmsg= null;
  +
  +    String fmsg = null;
       boolean throwex = false;
  -    
       String msg = null;
  +
       if (msgKey != null)
         msg = fResourceBundle.getString(msgKey);
  +
       if (msg == null)
  -    {	
  +    {
         msg = fResourceBundle.getString(BAD_CODE);
         throwex = true;
       }
  -    if (args != null) 
  +
  +    if (args != null)
       {
  -      try 
  +      try
         {
  +
           // Do this to keep format from crying.
           // This is better than making a bunch of conditional
           // code all over the place.
           int n = args.length;
  -        for(int i = 0; i < n; i++)
  +
  +        for (int i = 0; i < n; i++)
           {
  -          if(null == args[i])
  -            args[i]="";
  +          if (null == args[i])
  +            args[i] = "";
           }
  +
           fmsg = java.text.MessageFormat.format(msg, args);
  -      } 
  -      catch (Exception e) 
  +      }
  +      catch (Exception e)
         {
           fmsg = fResourceBundle.getString(FORMAT_FAILED);
           fmsg += " " + msg;
  @@ -287,13 +352,14 @@
       else
         fmsg = msg;
   
  -    if (throwex) 
  +    if (throwex)
       {
         throw new RuntimeException(fmsg);
       }
  -    return fmsg;	
  -  }   
   
  +    return fmsg;
  +  }
  +
     /**
      * Creates a message from the specified key and replacement
      * arguments, localized to the given locale.
  @@ -303,44 +369,54 @@
      * @param errorCode The key for the message text.
      * @param args      The arguments to be used as replacement text
      *                  in the message created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws Exception
      */
  -  public String createMessage(String bundleName, int errorCode, Object args[]) throws Exception 
  +  public String createMessage(String bundleName, int errorCode, Object args[])
  +          throws Exception
     {
  +
       boolean throwex = false;
  -    int majorCode; 
  +    int majorCode;
       int minorCode;
       String fmsg = null;
       XSLResourceBundle aResourceBundle = null;
  -    
  -    aResourceBundle = (XSLResourceBundle)loadResourceBundle(bundleName );	      
  -    
  +
  +    aResourceBundle = (XSLResourceBundle) loadResourceBundle(bundleName);
  +
       String msgKey = aResourceBundle.getMessageKey(errorCode);
       String msg = null;
  +
       if (msgKey != null)
         msg = aResourceBundle.getString(msgKey);
  -    
  +
       if (msg == null)
  -    {	
  +    {
         msg = aResourceBundle.getString(BAD_CODE);
         throwex = true;
       }
  -    
  -    if (args != null) 
  +
  +    if (args != null)
       {
  -      try 
  +      try
         {
  +
           // Do this to keep format from crying.
           // This is better than making a bunch of conditional
           // code all over the place.
           int n = args.length;
  -        for(int i = 0; i < n; i++)
  +
  +        for (int i = 0; i < n; i++)
           {
  -          if(null == args[i])
  -            args[i]="";
  +          if (null == args[i])
  +            args[i] = "";
           }
  +
           fmsg = java.text.MessageFormat.format(msg, args);
  -      } 
  -      catch (Exception e) 
  +      }
  +      catch (Exception e)
         {
           fmsg = aResourceBundle.getString(FORMAT_FAILED);
           fmsg += " " + msg;
  @@ -349,53 +425,60 @@
       else
         fmsg = msg;
   
  -    if (throwex) 
  +    if (throwex)
       {
         throw new RuntimeException(fmsg);
       }
  +
       return fmsg;
     }
  -  
  +
     /**
      * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
  -   * of ResourceBundle.getBundle(). 
  +   * of ResourceBundle.getBundle().
      *
  -   * @param res the name of the resource to load. 
  +   * @param res the name of the resource to load.
      * @param locale the locale to prefer when searching for the bundle
  +   *
  +   * NEEDSDOC @param className
      * @return the ResourceBundle
  -   * @throws MissingResourceException  
  +   * @throws MissingResourceException
      */
  -  public static final ListResourceBundle loadResourceBundle (String className) 
  -    throws MissingResourceException
  +  public static final ListResourceBundle loadResourceBundle(String className)
  +          throws MissingResourceException
     {
  +
       Locale locale = Locale.getDefault();
  -    
  +
       // String suffix = getResourceSuffix(locale);  
       try
       {
  +
         //System.out.println("resource " +className+suffix);
         // first try with the given locale
  -      return (ListResourceBundle)ResourceBundle.getBundle (className, locale);
  +      return (ListResourceBundle) ResourceBundle.getBundle(className, locale);
       }
       catch (MissingResourceException e)
  -    {		
  -      try                                                  // try to fall back to en_US if we can't load
  +    {
  +      try  // try to fall back to en_US if we can't load
         {
  +
           // Since we can't find the localized property file,
           // fall back to en_US.
  -        return (ListResourceBundle)ResourceBundle.getBundle (XSLT_ERROR_RESOURCES, new Locale ("en", "US"));
  +        return (ListResourceBundle) ResourceBundle.getBundle(
  +          XSLT_ERROR_RESOURCES, new Locale("en", "US"));
         }
         catch (MissingResourceException e2)
  -      {		  
  +      {
  +
           // Now we are really in trouble.
           // very bad, definitely very bad...not going to get very far
  -        throw new MissingResourceException ("Could not load any resource bundles."+ className, className,"");
  +        throw new MissingResourceException(
  +          "Could not load any resource bundles." + className, className, "");
         }
       }
  -    
  -  }	
  -  
  -  
  +  }
  +
     /**
      * Return the resource file suffic for the indicated locale
      * For most locales, this will be based the language code.  However
  @@ -403,17 +486,16 @@
      *
      * @param locale the locale
      * @return an String suffix which canbe appended to a resource name
  -   */        
  +   */
     private static final String getResourceSuffix(Locale locale)
     {
  +
       String suffix = "_" + locale.getLanguage();
  -    
  -    String country = locale.getCountry();        
  -    
  +    String country = locale.getCountry();
  +
       if (country.equals("TW"))
         suffix += "_" + country;
   
       return suffix;
  -  }	
  -  
  +  }
   }
  
  
  
  1.2       +14 -8     xml-xalan/java/src/org/apache/xalan/res/XSLResourceBundle.java
  
  Index: XSLResourceBundle.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLResourceBundle.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLResourceBundle.java	2000/06/19 16:52:23	1.1
  +++ XSLResourceBundle.java	2000/10/30 18:56:38	1.2
  @@ -60,21 +60,27 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * This is an interface for error messages.  This class is misnamed, 
  + * This is an interface for error messages.  This class is misnamed,
    * and should be called XalanResourceBundle, or some such.
    */
   abstract public class XSLResourceBundle extends ListResourceBundle
  -{  
  +{
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     abstract public String getMessageKey(int errorCode);
  -  
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     abstract public String getWarningKey(int errorCode);
  -  
  -
   }
  
  
  
  1.6       +1303 -759 xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java
  
  Index: XSLTErrorResources.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XSLTErrorResources.java	2000/09/27 21:43:21	1.5
  +++ XSLTErrorResources.java	2000/10/30 18:56:38	1.6
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -67,910 +67,1432 @@
   
   /**
    * Set up error messages.
  - * We build a two dimensional array of message keys and 
  + * We build a two dimensional array of message keys and
    * message strings. In order to add a new message here,
  - * you need to first update the count of messages(MAX_CODE)or 
  - * the count of warnings(MAX_WARNING). The array will be 
  - * automatically filled in with the keys, but you need to 
  + * you need to first update the count of messages(MAX_CODE)or
  + * the count of warnings(MAX_WARNING). The array will be
  + * automatically filled in with the keys, but you need to
    * fill in the actual message string. Follow the instructions
  - * below.   
  + * below.
    */
  -public class XSLTErrorResources extends XSLResourceBundle 
  -{  
  +public class XSLTErrorResources extends XSLResourceBundle
  +{
   
  -public static final String ERROR_SUFFIX = "ER";  
  -public static final String WARNING_SUFFIX = "WR";
  +  /** NEEDSDOC Field ERROR_SUFFIX          */
  +  public static final String ERROR_SUFFIX = "ER";
   
  -public static final int MAX_CODE = 106;                  // this is needed to keep track of the number of messages          
  -public static final int MAX_WARNING = 26;             // this is needed to keep track of the number of warnings
  -public static final int MAX_OTHERS = 41;
  -public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
  -
  -static final Object[][] contents = new Object[MAX_MESSAGES + MAX_OTHERS +1][2];
  -
  -/* 
  - * Now fill in the message keys.
  - * This does not need to be updated. If MAX_CODE and MAX_WARNING
  - * are correct, the keys will get filled in automatically with
  - * the value ERxxxx (WRxxxx for warnings) where xxxx is a 
  - * formatted number corresponding to the error code (i.e. ER0001).
  - */ 
  -static 
  -{
  -  for(int i = 0; i < MAX_CODE+1; i++)
  -  {
  -    contents[i][0] = getMKey(i);
  -  }
  -  for(int i = 1; i < MAX_WARNING+1; i++)
  +  /** NEEDSDOC Field WARNING_SUFFIX          */
  +  public static final String WARNING_SUFFIX = "WR";
  +
  +  /** NEEDSDOC Field MAX_CODE          */
  +  public static final int MAX_CODE = 106;  // this is needed to keep track of the number of messages          
  +
  +  /** NEEDSDOC Field MAX_WARNING          */
  +  public static final int MAX_WARNING = 26;  // this is needed to keep track of the number of warnings
  +
  +  /** NEEDSDOC Field MAX_OTHERS          */
  +  public static final int MAX_OTHERS = 41;
  +
  +  /** NEEDSDOC Field MAX_MESSAGES          */
  +  public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1;
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +    new Object[MAX_MESSAGES + MAX_OTHERS + 1][2];
  +
  +  /*
  +   * Now fill in the message keys.
  +   * This does not need to be updated. If MAX_CODE and MAX_WARNING
  +   * are correct, the keys will get filled in automatically with
  +   * the value ERxxxx (WRxxxx for warnings) where xxxx is a
  +   * formatted number corresponding to the error code (i.e. ER0001).
  +   */
  +  static
     {
  -    contents[i+ MAX_CODE][0] = getWKey(i);
  +    for (int i = 0; i < MAX_CODE + 1; i++)
  +    {
  +      contents[i][0] = getMKey(i);
  +    }
  +
  +    for (int i = 1; i < MAX_WARNING + 1; i++)
  +    {
  +      contents[i + MAX_CODE][0] = getWKey(i);
  +    }
     }
  -}
   
  -/*
  - * Now fill in the message text.
  - * First create an int for the message code. Make sure you 
  - * update MAX_CODE for error messages and MAX_WARNING for warnings
  - * Then fill in the message text for that message code in the
  - * array. Use the new error code as the index into the array.
  - */ 
  -
  -// Error messages...
  -
  -public static final int ERROR0000 = 0;
  -static {contents[ERROR0000][1] 
  -          = "{0}";
  -}
  +  /*
  +   * Now fill in the message text.
  +   * First create an int for the message code. Make sure you
  +   * update MAX_CODE for error messages and MAX_WARNING for warnings
  +   * Then fill in the message text for that message code in the
  +   * array. Use the new error code as the index into the array.
  +   */
   
  -public static final int ER_NO_CURLYBRACE = 1;
  -static {contents[ER_NO_CURLYBRACE][1] 
  -          = "Error: Can not have '{' within expression";
  -}
  +  // Error messages...
   
  -public static final int ER_ILLEGAL_ATTRIBUTE = 2;
  -static {contents[ER_ILLEGAL_ATTRIBUTE][1] 
  -          = "{0} has an illegal attribute: {1}";
  -}
  +  /** NEEDSDOC Field ERROR0000          */
  +  public static final int ERROR0000 = 0;
   
  -public static final int ER_NULL_SOURCENODE_APPLYIMPORTS = 3;
  -static {contents[ER_NULL_SOURCENODE_APPLYIMPORTS][1] 
  -          = "sourceNode is null in xsl:apply-imports!";
  -}
  +  static
  +  {
  +    contents[ERROR0000][1] = "{0}";
  +  }
   
  -public static final int ER_CANNOT_ADD = 4;
  -static {contents[ER_CANNOT_ADD][1] 
  -          = "Can not add {0} to {1}";
  -}
  +  /** NEEDSDOC Field ER_NO_CURLYBRACE          */
  +  public static final int ER_NO_CURLYBRACE = 1;
   
  -public static final int ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES = 5;
  -static {contents[ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES][1] 
  -          = "sourceNode is null in handleApplyTemplatesInstruction!";
  -}
  +  static
  +  {
  +    contents[ER_NO_CURLYBRACE][1] =
  +      "Error: Can not have '{' within expression";
  +  }
   
  -public static final int ER_NO_NAME_ATTRIB = 6;
  -static {contents[ER_NO_NAME_ATTRIB][1] 
  -          = "{0} must have a name attribute.";
  -}
  +  /** NEEDSDOC Field ER_ILLEGAL_ATTRIBUTE          */
  +  public static final int ER_ILLEGAL_ATTRIBUTE = 2;
   
  -public static final int ER_TEMPLATE_NOT_FOUND = 7;
  -static {contents[ER_TEMPLATE_NOT_FOUND][1] 
  -          = "Could not find template named: {0}";
  -}
  +  static
  +  {
  +    contents[ER_ILLEGAL_ATTRIBUTE][1] = "{0} has an illegal attribute: {1}";
  +  }
   
  -public static final int ER_CANT_RESOLVE_NAME_AVT = 8;
  -static {contents[ER_CANT_RESOLVE_NAME_AVT][1] 
  -          = "Could not resolve name AVT in xsl:call-template.";
  -}
  +  /** NEEDSDOC Field ER_NULL_SOURCENODE_APPLYIMPORTS          */
  +  public static final int ER_NULL_SOURCENODE_APPLYIMPORTS = 3;
   
  -public static final int ER_REQUIRES_ATTRIB = 9;
  -static {contents[ER_REQUIRES_ATTRIB][1] 
  -          = "{0} requires attribute: {1}";
  -}
  +  static
  +  {
  +    contents[ER_NULL_SOURCENODE_APPLYIMPORTS][1] =
  +      "sourceNode is null in xsl:apply-imports!";
  +  }
   
  -public static final int ER_MUST_HAVE_TEST_ATTRIB = 10;
  -static {contents[ER_MUST_HAVE_TEST_ATTRIB][1] 
  -          = "{0} must have a 'test' attribute.";
  -}
  +  /** NEEDSDOC Field ER_CANNOT_ADD          */
  +  public static final int ER_CANNOT_ADD = 4;
   
  -public static final int ER_BAD_VAL_ON_LEVEL_ATTRIB = 11;
  -static {contents[ER_BAD_VAL_ON_LEVEL_ATTRIB][1] 
  -          = "Bad value on level attribute: {0}";
  -}
  +  static
  +  {
  +    contents[ER_CANNOT_ADD][1] = "Can not add {0} to {1}";
  +  }
   
  -public static final int ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = 12;
  -static {contents[ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML][1] 
  -          = "processing-instruction name can not be 'xml'";
  -}
  +  /** NEEDSDOC Field ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES          */
  +  public static final int ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES = 5;
   
  -public static final int ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = 13;
  -static {contents[ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME][1] 
  -          = "processing-instruction name must be a valid NCName: {0}";
  -}
  +  static
  +  {
  +    contents[ER_NULL_SOURCENODE_HANDLEAPPLYTEMPLATES][1] =
  +      "sourceNode is null in handleApplyTemplatesInstruction!";
  +  }
   
  -public static final int ER_NEED_MATCH_ATTRIB = 14;
  -static {contents[ER_NEED_MATCH_ATTRIB][1] 
  -          = "{0} must have a match attribute if it has a mode.";
  -}
  +  /** NEEDSDOC Field ER_NO_NAME_ATTRIB          */
  +  public static final int ER_NO_NAME_ATTRIB = 6;
   
  -public static final int ER_NEED_NAME_OR_MATCH_ATTRIB = 15;
  -static {contents[ER_NEED_NAME_OR_MATCH_ATTRIB][1] 
  -          = "{0} requires either a name or a match attribute.";
  -}
  +  static
  +  {
  +    contents[ER_NO_NAME_ATTRIB][1] = "{0} must have a name attribute.";
  +  }
   
  -public static final int ER_CANT_RESOLVE_NSPREFIX = 16;
  -static {contents[ER_CANT_RESOLVE_NSPREFIX][1] 
  -          = "Can not resolve namespace prefix: {0}";
  -}
  +  /** NEEDSDOC Field ER_TEMPLATE_NOT_FOUND          */
  +  public static final int ER_TEMPLATE_NOT_FOUND = 7;
   
  -public static final int ER_ILLEGAL_VALUE = 17;
  -static {contents[ER_ILLEGAL_VALUE][1] 
  -          = "xml:space has an illegal value: {0}";
  -}
  +  static
  +  {
  +    contents[ER_TEMPLATE_NOT_FOUND][1] = "Could not find template named: {0}";
  +  }
   
  -public static final int ER_NO_OWNERDOC = 18;
  -static {contents[ER_NO_OWNERDOC][1] 
  -          = "Child node does not have an owner document!";
  -}
  +  /** NEEDSDOC Field ER_CANT_RESOLVE_NAME_AVT          */
  +  public static final int ER_CANT_RESOLVE_NAME_AVT = 8;
   
  -public static final int ER_ELEMTEMPLATEELEM_ERR = 19;
  -static {contents[ER_ELEMTEMPLATEELEM_ERR][1] 
  -          = "ElemTemplateElement error: {0}";
  -}
  +  static
  +  {
  +    contents[ER_CANT_RESOLVE_NAME_AVT][1] =
  +      "Could not resolve name AVT in xsl:call-template.";
  +  }
   
  -public static final int ER_NULL_CHILD = 20;
  -static {contents[ER_NULL_CHILD][1] 
  -          = "Trying to add a null child!";
  -}
  +  /** NEEDSDOC Field ER_REQUIRES_ATTRIB          */
  +  public static final int ER_REQUIRES_ATTRIB = 9;
   
  -public static final int ER_NEED_SELECT_ATTRIB = 21;
  -static {contents[ER_NEED_SELECT_ATTRIB][1] 
  -          = "{0} requires a select attribute.";
  -}
  +  static
  +  {
  +    contents[ER_REQUIRES_ATTRIB][1] = "{0} requires attribute: {1}";
  +  }
   
  -public static final int ER_NEED_TEST_ATTRIB = 22;
  -static {contents[ER_NEED_TEST_ATTRIB][1] 
  -          = "xsl:when must have a 'test' attribute.";
  -}
  +  /** NEEDSDOC Field ER_MUST_HAVE_TEST_ATTRIB          */
  +  public static final int ER_MUST_HAVE_TEST_ATTRIB = 10;
   
  -public static final int ER_NEED_NAME_ATTRIB = 23;
  -static {contents[ER_NEED_NAME_ATTRIB][1] 
  -          = "xsl:with-param must have a 'name' attribute.";
  -}
  +  static
  +  {
  +    contents[ER_MUST_HAVE_TEST_ATTRIB][1] =
  +      "{0} must have a 'test' attribute.";
  +  }
   
  -public static final int ER_NO_CONTEXT_OWNERDOC = 24;
  -static {contents[ER_NO_CONTEXT_OWNERDOC][1] 
  -          = "context does not have an owner document!";
  -}
  +  /** NEEDSDOC Field ER_BAD_VAL_ON_LEVEL_ATTRIB          */
  +  public static final int ER_BAD_VAL_ON_LEVEL_ATTRIB = 11;
   
  -public static final int ER_COULD_NOT_CREATE_XML_PROC_LIAISON = 25;
  -static {contents[ER_COULD_NOT_CREATE_XML_PROC_LIAISON][1] 
  -          = "Could not create XML Processor Liaison: {0}";
  -}
  +  static
  +  {
  +    contents[ER_BAD_VAL_ON_LEVEL_ATTRIB][1] =
  +      "Bad value on level attribute: {0}";
  +  }
   
  -public static final int ER_PROCESS_NOT_SUCCESSFUL = 26;
  -static {contents[ER_PROCESS_NOT_SUCCESSFUL][1] 
  -          = "Xalan: Process was not successful.";
  -}
  +  /** NEEDSDOC Field ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML          */
  +  public static final int ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML = 12;
   
  -public static final int ER_NOT_SUCCESSFUL = 27;
  -static {contents[ER_NOT_SUCCESSFUL][1] 
  -          = "Xalan: was not successful.";
  -}
  +  static
  +  {
  +    contents[ER_PROCESSINGINSTRUCTION_NAME_CANT_BE_XML][1] =
  +      "processing-instruction name can not be 'xml'";
  +  }
   
  -public static final int ER_ENCODING_NOT_SUPPORTED = 28;
  -static {contents[ER_ENCODING_NOT_SUPPORTED][1] 
  -          = "Encoding not supported: {0}";
  -}
  +  /** NEEDSDOC Field ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME          */
  +  public static final int ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME = 13;
   
  -public static final int ER_COULD_NOT_CREATE_TRACELISTENER = 29;
  -static {contents[ER_COULD_NOT_CREATE_TRACELISTENER][1] 
  -          = "Could not create TraceListener: {0}";
  -}
  +  static
  +  {
  +    contents[ER_PROCESSINGINSTRUCTION_NOTVALID_NCNAME][1] =
  +      "processing-instruction name must be a valid NCName: {0}";
  +  }
   
  -public static final int ER_KEY_REQUIRES_NAME_ATTRIB = 30;
  -static {contents[ER_KEY_REQUIRES_NAME_ATTRIB][1] 
  -          = "xsl:key requires a 'name' attribute!";
  -}
  +  /** NEEDSDOC Field ER_NEED_MATCH_ATTRIB          */
  +  public static final int ER_NEED_MATCH_ATTRIB = 14;
   
  -public static final int ER_KEY_REQUIRES_MATCH_ATTRIB = 31;
  -static {contents[ER_KEY_REQUIRES_MATCH_ATTRIB][1] 
  -          = "xsl:key requires a 'match' attribute!";
  -}
  +  static
  +  {
  +    contents[ER_NEED_MATCH_ATTRIB][1] =
  +      "{0} must have a match attribute if it has a mode.";
  +  }
   
  -public static final int ER_KEY_REQUIRES_USE_ATTRIB = 32;
  -static {contents[ER_KEY_REQUIRES_USE_ATTRIB][1] 
  -          = "xsl:key requires a 'use' attribute!";
  -}
  +  /** NEEDSDOC Field ER_NEED_NAME_OR_MATCH_ATTRIB          */
  +  public static final int ER_NEED_NAME_OR_MATCH_ATTRIB = 15;
   
  -public static final int ER_REQUIRES_ELEMENTS_ATTRIB = 33;
  -static {contents[ER_REQUIRES_ELEMENTS_ATTRIB][1] 
  -          = "(StylesheetHandler) {0} requires an 'elements' attribute!";
  -}
  +  static
  +  {
  +    contents[ER_NEED_NAME_OR_MATCH_ATTRIB][1] =
  +      "{0} requires either a name or a match attribute.";
  +  }
   
  -public static final int ER_MISSING_PREFIX_ATTRIB = 34;
  -static {contents[ER_MISSING_PREFIX_ATTRIB][1] 
  -          = "(StylesheetHandler) {0} attribute 'prefix' is missing";
  -}
  +  /** NEEDSDOC Field ER_CANT_RESOLVE_NSPREFIX          */
  +  public static final int ER_CANT_RESOLVE_NSPREFIX = 16;
   
  -public static final int ER_BAD_STYLESHEET_URL = 35;
  -static {contents[ER_BAD_STYLESHEET_URL][1] 
  -          = "Stylesheet URL is bad: {0}";
  -}
  +  static
  +  {
  +    contents[ER_CANT_RESOLVE_NSPREFIX][1] =
  +      "Can not resolve namespace prefix: {0}";
  +  }
   
  -public static final int ER_FILE_NOT_FOUND = 36;
  -static {contents[ER_FILE_NOT_FOUND][1] 
  -          = "Stylesheet file was not found: {0}";
  -}
  +  /** NEEDSDOC Field ER_ILLEGAL_VALUE          */
  +  public static final int ER_ILLEGAL_VALUE = 17;
   
  -public static final int ER_IOEXCEPTION = 37;
  -static {contents[ER_IOEXCEPTION][1] 
  -          = "Had IO Exception with stylesheet file: {0}";
  -}
  +  static
  +  {
  +    contents[ER_ILLEGAL_VALUE][1] = "xml:space has an illegal value: {0}";
  +  }
   
  -public static final int ER_NO_HREF_ATTRIB = 38;
  -static {contents[ER_NO_HREF_ATTRIB][1] 
  -          = "(StylesheetHandler) Could not find href attribute for {0}";
  -}
  +  /** NEEDSDOC Field ER_NO_OWNERDOC          */
  +  public static final int ER_NO_OWNERDOC = 18;
   
  -public static final int ER_STYLESHEET_INCLUDES_ITSELF = 39;
  -static {contents[ER_STYLESHEET_INCLUDES_ITSELF][1] 
  -          = "(StylesheetHandler) {0} is directly or indirectly including itself!";
  -}
  +  static
  +  {
  +    contents[ER_NO_OWNERDOC][1] =
  +      "Child node does not have an owner document!";
  +  }
   
  -public static final int ER_PROCESSINCLUDE_ERROR = 40;
  -static {contents[ER_PROCESSINCLUDE_ERROR][1] 
  -          = "StylesheetHandler.processInclude error, {0}";
  -}
  +  /** NEEDSDOC Field ER_ELEMTEMPLATEELEM_ERR          */
  +  public static final int ER_ELEMTEMPLATEELEM_ERR = 19;
   
  -public static final int ER_MISSING_LANG_ATTRIB = 41;
  -static {contents[ER_MISSING_LANG_ATTRIB][1] 
  -          = "(StylesheetHandler) {0} attribute 'lang' is missing";
  -}
  +  static
  +  {
  +    contents[ER_ELEMTEMPLATEELEM_ERR][1] = "ElemTemplateElement error: {0}";
  +  }
   
  -public static final int ER_MISSING_CONTAINER_ELEMENT_COMPONENT = 42;
  -static {contents[ER_MISSING_CONTAINER_ELEMENT_COMPONENT][1] 
  -          = "(StylesheetHandler) misplaced {0} element?? Missing container element 'component'";
  -}
  +  /** NEEDSDOC Field ER_NULL_CHILD          */
  +  public static final int ER_NULL_CHILD = 20;
   
  -public static final int ER_CAN_ONLY_OUTPUT_TO_ELEMENT = 43;
  -static {contents[ER_CAN_ONLY_OUTPUT_TO_ELEMENT][1] 
  -          = "Can only output to an Element, DocumentFragment, Document, or PrintWriter.";
  -}
  +  static
  +  {
  +    contents[ER_NULL_CHILD][1] = "Trying to add a null child!";
  +  }
   
  -public static final int ER_PROCESS_ERROR = 44;
  -static {contents[ER_PROCESS_ERROR][1] 
  -          = "StylesheetRoot.process error";
  -}
  +  /** NEEDSDOC Field ER_NEED_SELECT_ATTRIB          */
  +  public static final int ER_NEED_SELECT_ATTRIB = 21;
   
  -public static final int ER_UNIMPLNODE_ERROR = 45;
  -static {contents[ER_UNIMPLNODE_ERROR][1] 
  -          = "UnImplNode error: {0}";
  -}
  +  static
  +  {
  +    contents[ER_NEED_SELECT_ATTRIB][1] = "{0} requires a select attribute.";
  +  }
   
  -public static final int ER_NO_SELECT_EXPRESSION = 46;
  -static {contents[ER_NO_SELECT_EXPRESSION][1] 
  -          = "Error! Did not find xpath select expression (-select).";
  -}
  +  /** NEEDSDOC Field ER_NEED_TEST_ATTRIB          */
  +  public static final int ER_NEED_TEST_ATTRIB = 22;
   
  -public static final int ER_CANNOT_SERIALIZE_XSLPROCESSOR = 47;
  -static {contents[ER_CANNOT_SERIALIZE_XSLPROCESSOR][1] 
  -          = "Can not serialize an XSLProcessor!";
  -}
  +  static
  +  {
  +    contents[ER_NEED_TEST_ATTRIB][1] =
  +      "xsl:when must have a 'test' attribute.";
  +  }
   
  -public static final int ER_NO_INPUT_STYLESHEET = 48;
  -static {contents[ER_NO_INPUT_STYLESHEET][1] 
  -          = "Stylesheet input was not specified!";
  -}
  +  /** NEEDSDOC Field ER_NEED_NAME_ATTRIB          */
  +  public static final int ER_NEED_NAME_ATTRIB = 23;
   
  -public static final int ER_FAILED_PROCESS_STYLESHEET = 49;
  -static {contents[ER_FAILED_PROCESS_STYLESHEET][1] 
  -          = "Failed to process stylesheet!";
  -}
  +  static
  +  {
  +    contents[ER_NEED_NAME_ATTRIB][1] =
  +      "xsl:with-param must have a 'name' attribute.";
  +  }
   
  -public static final int ER_COULDNT_PARSE_DOC = 50;
  -static {contents[ER_COULDNT_PARSE_DOC][1] 
  -          = "Could not parse {0} document!";
  -}
  +  /** NEEDSDOC Field ER_NO_CONTEXT_OWNERDOC          */
  +  public static final int ER_NO_CONTEXT_OWNERDOC = 24;
   
  -public static final int ER_COULDNT_FIND_FRAGMENT = 51;
  -static {contents[ER_COULDNT_FIND_FRAGMENT][1] 
  -          = "Could not find fragment: {0}";
  -}
  +  static
  +  {
  +    contents[ER_NO_CONTEXT_OWNERDOC][1] =
  +      "context does not have an owner document!";
  +  }
   
  -public static final int ER_NODE_NOT_ELEMENT = 52;
  -static {contents[ER_NODE_NOT_ELEMENT][1] 
  -          = "Node pointed to by fragment identifier was not an element: {0}";
  -}
  +  /** NEEDSDOC Field ER_COULD_NOT_CREATE_XML_PROC_LIAISON          */
  +  public static final int ER_COULD_NOT_CREATE_XML_PROC_LIAISON = 25;
   
  -public static final int ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = 53;
  -static {contents[ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB][1] 
  -          = "for-each must have either a match or name attribute";
  -}
  +  static
  +  {
  +    contents[ER_COULD_NOT_CREATE_XML_PROC_LIAISON][1] =
  +      "Could not create XML Processor Liaison: {0}";
  +  }
   
  -public static final int ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = 54;
  -static {contents[ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB][1] 
  -          = "templates must have either a match or name attribute";
  -}
  +  /** NEEDSDOC Field ER_PROCESS_NOT_SUCCESSFUL          */
  +  public static final int ER_PROCESS_NOT_SUCCESSFUL = 26;
   
  -public static final int ER_NO_CLONE_OF_DOCUMENT_FRAG = 55;
  -static {contents[ER_NO_CLONE_OF_DOCUMENT_FRAG][1] 
  -          = "No clone of a document fragment!";
  -}
  +  static
  +  {
  +    contents[ER_PROCESS_NOT_SUCCESSFUL][1] =
  +      "Xalan: Process was not successful.";
  +  }
   
  -public static final int ER_CANT_CREATE_ITEM = 56;
  -static {contents[ER_CANT_CREATE_ITEM][1] 
  -          = "Can not create item in result tree: {0}";
  -}
  +  /** NEEDSDOC Field ER_NOT_SUCCESSFUL          */
  +  public static final int ER_NOT_SUCCESSFUL = 27;
   
  -public static final int ER_XMLSPACE_ILLEGAL_VALUE = 57;
  -static {contents[ER_XMLSPACE_ILLEGAL_VALUE][1] 
  -          = "xml:space in the source XML has an illegal value: {0}";
  -}
  +  static
  +  {
  +    contents[ER_NOT_SUCCESSFUL][1] = "Xalan: was not successful.";
  +  }
   
  -public static final int ER_NO_XSLKEY_DECLARATION = 58;
  -static {contents[ER_NO_XSLKEY_DECLARATION][1] 
  -          = "There is no xsl:key declaration for {0}!";
  -}
  +  /** NEEDSDOC Field ER_ENCODING_NOT_SUPPORTED          */
  +  public static final int ER_ENCODING_NOT_SUPPORTED = 28;
   
  -public static final int ER_CANT_CREATE_URL = 59;
  -static {contents[ER_CANT_CREATE_URL][1] 
  -          = "Error! Cannot create url for: {0}";
  -}
  +  static
  +  {
  +    contents[ER_ENCODING_NOT_SUPPORTED][1] = "Encoding not supported: {0}";
  +  }
   
  -public static final int ER_XSLFUNCTIONS_UNSUPPORTED = 60;
  -static {contents[ER_XSLFUNCTIONS_UNSUPPORTED][1] 
  -          = "xsl:functions is unsupported";
  -}
  +  /** NEEDSDOC Field ER_COULD_NOT_CREATE_TRACELISTENER          */
  +  public static final int ER_COULD_NOT_CREATE_TRACELISTENER = 29;
   
  -public static final int ER_PROCESSOR_ERROR = 61;
  -static {contents[ER_PROCESSOR_ERROR][1] 
  -          = "XSLT Processor Error";
  -}
  +  static
  +  {
  +    contents[ER_COULD_NOT_CREATE_TRACELISTENER][1] =
  +      "Could not create TraceListener: {0}";
  +  }
   
  -public static final int ER_NOT_ALLOWED_INSIDE_STYLESHEET = 62;
  -static {contents[ER_NOT_ALLOWED_INSIDE_STYLESHEET][1] 
  -          = "(StylesheetHandler) {0} not allowed inside a stylesheet!";
  -}
  +  /** NEEDSDOC Field ER_KEY_REQUIRES_NAME_ATTRIB          */
  +  public static final int ER_KEY_REQUIRES_NAME_ATTRIB = 30;
   
  -public static final int ER_RESULTNS_NOT_SUPPORTED = 63;
  -static {contents[ER_RESULTNS_NOT_SUPPORTED][1] 
  -          = "result-ns no longer supported!  Use xsl:output instead.";
  -}
  +  static
  +  {
  +    contents[ER_KEY_REQUIRES_NAME_ATTRIB][1] =
  +      "xsl:key requires a 'name' attribute!";
  +  }
   
  -public static final int ER_DEFAULTSPACE_NOT_SUPPORTED = 64;
  -static {contents[ER_DEFAULTSPACE_NOT_SUPPORTED][1] 
  -          = "default-space no longer supported!  Use xsl:strip-space or xsl:preserve-space instead.";
  -}
  +  /** NEEDSDOC Field ER_KEY_REQUIRES_MATCH_ATTRIB          */
  +  public static final int ER_KEY_REQUIRES_MATCH_ATTRIB = 31;
   
  -public static final int ER_INDENTRESULT_NOT_SUPPORTED = 65;
  -static {contents[ER_INDENTRESULT_NOT_SUPPORTED][1] 
  -          = "indent-result no longer supported!  Use xsl:output instead.";
  -}
  +  static
  +  {
  +    contents[ER_KEY_REQUIRES_MATCH_ATTRIB][1] =
  +      "xsl:key requires a 'match' attribute!";
  +  }
   
  -public static final int ER_ILLEGAL_ATTRIB = 66;
  -static {contents[ER_ILLEGAL_ATTRIB][1] 
  -          = "(StylesheetHandler) {0} has an illegal attribute: {1}";
  -}
  +  /** NEEDSDOC Field ER_KEY_REQUIRES_USE_ATTRIB          */
  +  public static final int ER_KEY_REQUIRES_USE_ATTRIB = 32;
   
  -public static final int ER_UNKNOWN_XSL_ELEM = 67;
  -static {contents[ER_UNKNOWN_XSL_ELEM][1] 
  -          = "Unknown XSL element: {0}";
  -}
  +  static
  +  {
  +    contents[ER_KEY_REQUIRES_USE_ATTRIB][1] =
  +      "xsl:key requires a 'use' attribute!";
  +  }
   
  -public static final int ER_BAD_XSLSORT_USE = 68;
  -static {contents[ER_BAD_XSLSORT_USE][1] 
  -          = "(StylesheetHandler) xsl:sort can only be used with xsl:apply-templates or xsl:for-each.";
  -}
  +  /** NEEDSDOC Field ER_REQUIRES_ELEMENTS_ATTRIB          */
  +  public static final int ER_REQUIRES_ELEMENTS_ATTRIB = 33;
   
  -public static final int ER_MISPLACED_XSLWHEN = 69;
  -static {contents[ER_MISPLACED_XSLWHEN][1] 
  -          = "(StylesheetHandler) misplaced xsl:when!";
  -}
  +  static
  +  {
  +    contents[ER_REQUIRES_ELEMENTS_ATTRIB][1] =
  +      "(StylesheetHandler) {0} requires an 'elements' attribute!";
  +  }
   
  -public static final int ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = 70;
  -static {contents[ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE][1] 
  -          = "(StylesheetHandler) xsl:when not parented by xsl:choose!";
  -}
  +  /** NEEDSDOC Field ER_MISSING_PREFIX_ATTRIB          */
  +  public static final int ER_MISSING_PREFIX_ATTRIB = 34;
   
  -public static final int ER_MISPLACED_XSLOTHERWISE = 71;
  -static {contents[ER_MISPLACED_XSLOTHERWISE][1] 
  -          = "(StylesheetHandler) misplaced xsl:otherwise!";
  -}
  +  static
  +  {
  +    contents[ER_MISSING_PREFIX_ATTRIB][1] =
  +      "(StylesheetHandler) {0} attribute 'prefix' is missing";
  +  }
   
  -public static final int ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = 72;
  -static {contents[ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE][1] 
  -          = "(StylesheetHandler) xsl:otherwise not parented by xsl:choose!";
  -}
  +  /** NEEDSDOC Field ER_BAD_STYLESHEET_URL          */
  +  public static final int ER_BAD_STYLESHEET_URL = 35;
   
  -public static final int ER_NOT_ALLOWED_INSIDE_TEMPLATE = 73;
  -static {contents[ER_NOT_ALLOWED_INSIDE_TEMPLATE][1] 
  -          = "(StylesheetHandler) {0} is not allowed inside a template!";
  -}
  +  static
  +  {
  +    contents[ER_BAD_STYLESHEET_URL][1] = "Stylesheet URL is bad: {0}";
  +  }
   
  -public static final int ER_UNKNOWN_EXT_NS_PREFIX = 74;
  -static {contents[ER_UNKNOWN_EXT_NS_PREFIX][1] 
  -          = "(StylesheetHandler) {0} extension namespace prefix {1} unknown";
  -}
  +  /** NEEDSDOC Field ER_FILE_NOT_FOUND          */
  +  public static final int ER_FILE_NOT_FOUND = 36;
   
  -public static final int ER_IMPORTS_AS_FIRST_ELEM = 75;
  -static {contents[ER_IMPORTS_AS_FIRST_ELEM][1] 
  -          = "(StylesheetHandler) Imports can only occur as the first elements in the stylesheet!";
  -}
  +  static
  +  {
  +    contents[ER_FILE_NOT_FOUND][1] = "Stylesheet file was not found: {0}";
  +  }
   
  -public static final int ER_IMPORTING_ITSELF = 76;
  -static {contents[ER_IMPORTING_ITSELF][1] 
  -          = "(StylesheetHandler) {0} is directly or indirectly importing itself!";
  -}
  +  /** NEEDSDOC Field ER_IOEXCEPTION          */
  +  public static final int ER_IOEXCEPTION = 37;
   
  -public static final int ER_XMLSPACE_ILLEGAL_VAL = 77;
  -static {contents[ER_XMLSPACE_ILLEGAL_VAL][1] 
  -          = "(StylesheetHandler) "+"xml:space has an illegal value: {0}";
  -}
  +  static
  +  {
  +    contents[ER_IOEXCEPTION][1] =
  +      "Had IO Exception with stylesheet file: {0}";
  +  }
   
  -public static final int ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = 78;
  -static {contents[ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL][1] 
  -          = "processStylesheet not succesfull!";
  -}
  +  /** NEEDSDOC Field ER_NO_HREF_ATTRIB          */
  +  public static final int ER_NO_HREF_ATTRIB = 38;
   
  -public static final int ER_SAX_EXCEPTION = 79;
  -static {contents[ER_SAX_EXCEPTION][1] 
  -          = "SAX Exception";
  -}
  +  static
  +  {
  +    contents[ER_NO_HREF_ATTRIB][1] =
  +      "(StylesheetHandler) Could not find href attribute for {0}";
  +  }
   
  -public static final int ER_FUNCTION_NOT_SUPPORTED = 80;
  -static {contents[ER_FUNCTION_NOT_SUPPORTED][1] 
  -          = "Function not supported!";
  -}
  +  /** NEEDSDOC Field ER_STYLESHEET_INCLUDES_ITSELF          */
  +  public static final int ER_STYLESHEET_INCLUDES_ITSELF = 39;
   
  -public static final int ER_XSLT_ERROR = 81;
  -static {contents[ER_XSLT_ERROR][1] 
  -          = "XSLT Error";
  -}
  +  static
  +  {
  +    contents[ER_STYLESHEET_INCLUDES_ITSELF][1] =
  +      "(StylesheetHandler) {0} is directly or indirectly including itself!";
  +  }
   
  -public static final int ER_CURRENCY_SIGN_ILLEGAL = 82;
  -static {contents[ER_CURRENCY_SIGN_ILLEGAL][1] 
  -          = "currency sign is not allowed in format pattern string";
  -}
  +  /** NEEDSDOC Field ER_PROCESSINCLUDE_ERROR          */
  +  public static final int ER_PROCESSINCLUDE_ERROR = 40;
   
  -public static final int ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = 83;
  -static {contents[ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM][1] 
  -          = "Document function not supported in Stylesheet DOM!";
  -}
  +  static
  +  {
  +    contents[ER_PROCESSINCLUDE_ERROR][1] =
  +      "StylesheetHandler.processInclude error, {0}";
  +  }
   
  -public static final int ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = 84;
  -static {contents[ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER][1] 
  -          = "Can't resolve prefix of non-Prefix resolver!";
  -}
  +  /** NEEDSDOC Field ER_MISSING_LANG_ATTRIB          */
  +  public static final int ER_MISSING_LANG_ATTRIB = 41;
   
  -public static final int ER_REDIRECT_COULDNT_GET_FILENAME = 85;
  -static {contents[ER_REDIRECT_COULDNT_GET_FILENAME][1] 
  -          = "Redirect extension: Could not get filename - file or select attribute must return vald string.";
  -}
  +  static
  +  {
  +    contents[ER_MISSING_LANG_ATTRIB][1] =
  +      "(StylesheetHandler) {0} attribute 'lang' is missing";
  +  }
   
  -public static final int ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = 86;
  -static {contents[ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT][1] 
  -          = "Can not build FormatterListener in Redirect extension!";
  -}
  +  /** NEEDSDOC Field ER_MISSING_CONTAINER_ELEMENT_COMPONENT          */
  +  public static final int ER_MISSING_CONTAINER_ELEMENT_COMPONENT = 42;
   
  -public static final int ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = 87;
  -static {contents[ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX][1] 
  -          = "Prefix in exclude-result-prefixes is not valid: {0}";
  -}
  +  static
  +  {
  +    contents[ER_MISSING_CONTAINER_ELEMENT_COMPONENT][1] =
  +      "(StylesheetHandler) misplaced {0} element?? Missing container element 'component'";
  +  }
   
  -public static final int ER_MISSING_NS_URI = 88;
  -static {contents[ER_MISSING_NS_URI][1] 
  -          = "Missing namespace URI for specified prefix";
  -}
  +  /** NEEDSDOC Field ER_CAN_ONLY_OUTPUT_TO_ELEMENT          */
  +  public static final int ER_CAN_ONLY_OUTPUT_TO_ELEMENT = 43;
   
  -public static final int ER_MISSING_ARG_FOR_OPTION = 89;
  -static {contents[ER_MISSING_ARG_FOR_OPTION][1] 
  -          = "Missing argument for option: {0}";
  -}
  +  static
  +  {
  +    contents[ER_CAN_ONLY_OUTPUT_TO_ELEMENT][1] =
  +      "Can only output to an Element, DocumentFragment, Document, or PrintWriter.";
  +  }
   
  -public static final int ER_INVALID_OPTION = 90;
  -static {contents[ER_INVALID_OPTION][1] 
  -          = "Invalid option: {0}";
  -}
  +  /** NEEDSDOC Field ER_PROCESS_ERROR          */
  +  public static final int ER_PROCESS_ERROR = 44;
   
  -public static final int ER_MALFORMED_FORMAT_STRING = 91;
  -static {contents[ER_MALFORMED_FORMAT_STRING][1] 
  -          = "Malformed format string: {0}";
  -}
  +  static
  +  {
  +    contents[ER_PROCESS_ERROR][1] = "StylesheetRoot.process error";
  +  }
   
  -public static final int ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = 92;
  -static {contents[ER_STYLESHEET_REQUIRES_VERSION_ATTRIB][1] 
  -          = "xsl:stylesheet requires a 'version' attribute!";
  -}
  +  /** NEEDSDOC Field ER_UNIMPLNODE_ERROR          */
  +  public static final int ER_UNIMPLNODE_ERROR = 45;
   
  -public static final int ER_ILLEGAL_ATTRIBUTE_VALUE = 93;
  -static {contents[ER_ILLEGAL_ATTRIBUTE_VALUE][1] 
  -			= "Attribute: {0} has an illegal value: {1}";
  -}
  +  static
  +  {
  +    contents[ER_UNIMPLNODE_ERROR][1] = "UnImplNode error: {0}";
  +  }
   
  -public static final int ER_CHOOSE_REQUIRES_WHEN = 94;
  -static {contents[ER_CHOOSE_REQUIRES_WHEN][1] 
  -			= "xsl:choose requires an xsl:when";
  -}
  +  /** NEEDSDOC Field ER_NO_SELECT_EXPRESSION          */
  +  public static final int ER_NO_SELECT_EXPRESSION = 46;
   
  -public static final int ER_NO_APPLY_IMPORT_IN_FOR_EACH = 95;
  -static {contents[ER_NO_APPLY_IMPORT_IN_FOR_EACH][1] 
  -			= "xsl:apply-imports not allowed in a xsl:for-each";
  -}
  +  static
  +  {
  +    contents[ER_NO_SELECT_EXPRESSION][1] =
  +      "Error! Did not find xpath select expression (-select).";
  +  }
   
  -public static final int ER_CANT_USE_DTM_FOR_OUTPUT = 96;
  -static {contents[ER_CANT_USE_DTM_FOR_OUTPUT][1] 
  -			= "Cannot use a DTMLiaison for an output DOM node... pass a org.apache.xpath.DOM2Helper instead!";
  -}
  +  /** NEEDSDOC Field ER_CANNOT_SERIALIZE_XSLPROCESSOR          */
  +  public static final int ER_CANNOT_SERIALIZE_XSLPROCESSOR = 47;
   
  -public static final int ER_CANT_USE_DTM_FOR_INPUT = 97;
  -static {contents[ER_CANT_USE_DTM_FOR_INPUT][1] 
  -			= "Cannot use a DTMLiaison for a input DOM node... pass a org.apache.xpath.DOM2Helper instead!";
  -}
  +  static
  +  {
  +    contents[ER_CANNOT_SERIALIZE_XSLPROCESSOR][1] =
  +      "Can not serialize an XSLProcessor!";
  +  }
   
  -public static final int ER_CALL_TO_EXT_FAILED = 98;
  -static {contents[ER_CALL_TO_EXT_FAILED][1] 
  -          = "Call to extension element failed: {0}";
  -}
  +  /** NEEDSDOC Field ER_NO_INPUT_STYLESHEET          */
  +  public static final int ER_NO_INPUT_STYLESHEET = 48;
   
  -public static final int ER_PREFIX_MUST_RESOLVE = 99;
  -static {contents[ER_PREFIX_MUST_RESOLVE][1] 
  -          = "Prefix must resolve to a namespace: {0}";
  -}
  +  static
  +  {
  +    contents[ER_NO_INPUT_STYLESHEET][1] =
  +      "Stylesheet input was not specified!";
  +  }
   
  -public static final int ER_INVALID_UTF16_SURROGATE = 100;
  -static {contents[ER_INVALID_UTF16_SURROGATE][1] 
  -          = "Invalid UTF-16 surrogate detected: {0} ?";
  -}
  +  /** NEEDSDOC Field ER_FAILED_PROCESS_STYLESHEET          */
  +  public static final int ER_FAILED_PROCESS_STYLESHEET = 49;
   
  -public static final int ER_XSLATTRSET_USED_ITSELF = 101;
  -static {contents[ER_XSLATTRSET_USED_ITSELF][1] 
  -          = "xsl:attribute-set {0} used itself, which will cause an infinite loop.";
  -}
  +  static
  +  {
  +    contents[ER_FAILED_PROCESS_STYLESHEET][1] =
  +      "Failed to process stylesheet!";
  +  }
   
  -public static final int ER_CANNOT_MIX_XERCESDOM = 102;
  -static {contents[ER_CANNOT_MIX_XERCESDOM][1] 
  -          = "Can not mix non Xerces-DOM input with Xerces-DOM output!";      
  -}
  +  /** NEEDSDOC Field ER_COULDNT_PARSE_DOC          */
  +  public static final int ER_COULDNT_PARSE_DOC = 50;
   
  -public static final int ER_TOO_MANY_LISTENERS = 103;
  -static {contents[ER_TOO_MANY_LISTENERS][1] 
  -          = "addTraceListenersToStylesheet - TooManyListenersException";      
  -}
  +  static
  +  {
  +    contents[ER_COULDNT_PARSE_DOC][1] = "Could not parse {0} document!";
  +  }
   
  -public static final int ER_IN_ELEMTEMPLATEELEM_READOBJECT = 104;
  -static {contents[ER_IN_ELEMTEMPLATEELEM_READOBJECT][1] 
  -          = "In ElemTemplateElement.readObject: {0}";      
  -}
  +  /** NEEDSDOC Field ER_COULDNT_FIND_FRAGMENT          */
  +  public static final int ER_COULDNT_FIND_FRAGMENT = 51;
   
  -public static final int ER_DUPLICATE_NAMED_TEMPLATE = 105;
  -static {contents[ER_DUPLICATE_NAMED_TEMPLATE][1] 
  -          = "Found more than one template named: {0}";      
  -}
  +  static
  +  {
  +    contents[ER_COULDNT_FIND_FRAGMENT][1] = "Could not find fragment: {0}";
  +  }
   
  -public static final int ER_INVALID_KEY_CALL = 106;
  -static {contents[ER_INVALID_KEY_CALL][1] 
  -          = "Invalid function call: recursive key() calls are not allowed";      
  -}
  +  /** NEEDSDOC Field ER_NODE_NOT_ELEMENT          */
  +  public static final int ER_NODE_NOT_ELEMENT = 52;
   
  -// Warnings...
  +  static
  +  {
  +    contents[ER_NODE_NOT_ELEMENT][1] =
  +      "Node pointed to by fragment identifier was not an element: {0}";
  +  }
   
  -public static final int WG_FOUND_CURLYBRACE = 1;
  -static {contents[WG_FOUND_CURLYBRACE + MAX_CODE][1] 
  -          = "Found '}' but no attribute template open!";
  -}
  +  /** NEEDSDOC Field ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB          */
  +  public static final int ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB = 53;
   
  -public static final int WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = 2;
  -static {contents[WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR + MAX_CODE][1] 
  -          = "Warning: count attribute does not match an ancestor in xsl:number! Target = {0}";
  -}
  +  static
  +  {
  +    contents[ER_FOREACH_NEED_MATCH_OR_NAME_ATTRIB][1] =
  +      "for-each must have either a match or name attribute";
  +  }
   
  -public static final int WG_EXPR_ATTRIB_CHANGED_TO_SELECT = 3;
  -static {contents[WG_EXPR_ATTRIB_CHANGED_TO_SELECT + MAX_CODE][1] 
  -          = "Old syntax: The name of the 'expr' attribute has been changed to 'select'.";
  -}
  +  /** NEEDSDOC Field ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB          */
  +  public static final int ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB = 54;
   
  -public static final int WG_NO_LOCALE_IN_FORMATNUMBER = 4;
  -static {contents[WG_NO_LOCALE_IN_FORMATNUMBER + MAX_CODE][1] 
  -          = "Xalan doesn't yet handle the locale name in the format-number function.";
  -}
  +  static
  +  {
  +    contents[ER_TEMPLATES_NEED_MATCH_OR_NAME_ATTRIB][1] =
  +      "templates must have either a match or name attribute";
  +  }
   
  -public static final int WG_LOCALE_NOT_FOUND = 5;
  -static {contents[WG_LOCALE_NOT_FOUND + MAX_CODE][1] 
  -          = "Warning: Could not find locale for xml:lang={0}";
  -}
  +  /** NEEDSDOC Field ER_NO_CLONE_OF_DOCUMENT_FRAG          */
  +  public static final int ER_NO_CLONE_OF_DOCUMENT_FRAG = 55;
   
  -public static final int WG_CANNOT_MAKE_URL_FROM = 6;
  -static {contents[WG_CANNOT_MAKE_URL_FROM + MAX_CODE][1] 
  -          = "Can not make URL from: {0}";
  -}
  +  static
  +  {
  +    contents[ER_NO_CLONE_OF_DOCUMENT_FRAG][1] =
  +      "No clone of a document fragment!";
  +  }
   
  -public static final int WG_CANNOT_LOAD_REQUESTED_DOC = 7;
  -static {contents[WG_CANNOT_LOAD_REQUESTED_DOC + MAX_CODE][1] 
  -          = "Can not load requested doc: {0}";
  -}
  +  /** NEEDSDOC Field ER_CANT_CREATE_ITEM          */
  +  public static final int ER_CANT_CREATE_ITEM = 56;
   
  -public static final int WG_CANNOT_FIND_COLLATOR = 8;
  -static {contents[WG_CANNOT_FIND_COLLATOR + MAX_CODE][1] 
  -          = "Could not find Collator for <sort xml:lang={0}";
  -}
  +  static
  +  {
  +    contents[ER_CANT_CREATE_ITEM][1] =
  +      "Can not create item in result tree: {0}";
  +  }
   
  -public static final int WG_FUNCTIONS_SHOULD_USE_URL = 9;
  -static {contents[WG_FUNCTIONS_SHOULD_USE_URL + MAX_CODE][1] 
  -          = "Old syntax: the functions instruction should use a url of {0}";
  -}
  +  /** NEEDSDOC Field ER_XMLSPACE_ILLEGAL_VALUE          */
  +  public static final int ER_XMLSPACE_ILLEGAL_VALUE = 57;
   
  -public static final int WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = 10;
  -static {contents[WG_ENCODING_NOT_SUPPORTED_USING_UTF8 + MAX_CODE][1] 
  -          = "encoding not supported: {0}, using UTF-8";
  -}
  +  static
  +  {
  +    contents[ER_XMLSPACE_ILLEGAL_VALUE][1] =
  +      "xml:space in the source XML has an illegal value: {0}";
  +  }
   
  -public static final int WG_ENCODING_NOT_SUPPORTED_USING_JAVA = 11;
  -static {contents[WG_ENCODING_NOT_SUPPORTED_USING_JAVA + MAX_CODE][1] 
  -          = "encoding not supported: {0}, using Java {1}";
  -}
  +  /** NEEDSDOC Field ER_NO_XSLKEY_DECLARATION          */
  +  public static final int ER_NO_XSLKEY_DECLARATION = 58;
   
  -public static final int WG_SPECIFICITY_CONFLICTS = 12;
  -static {contents[WG_SPECIFICITY_CONFLICTS + MAX_CODE][1] 
  -          = "Specificity conflicts found: {0} Last found in stylesheet will be used.";
  -}
  +  static
  +  {
  +    contents[ER_NO_XSLKEY_DECLARATION][1] =
  +      "There is no xsl:key declaration for {0}!";
  +  }
   
  -public static final int WG_PARSING_AND_PREPARING = 13;
  -static {contents[WG_PARSING_AND_PREPARING + MAX_CODE][1] 
  -          = "========= Parsing and preparing {0} ==========";
  -}
  +  /** NEEDSDOC Field ER_CANT_CREATE_URL          */
  +  public static final int ER_CANT_CREATE_URL = 59;
   
  -public static final int WG_ATTR_TEMPLATE = 14;
  -static {contents[WG_ATTR_TEMPLATE + MAX_CODE][1] 
  -          = "Attr Template, {0}";
  -}
  +  static
  +  {
  +    contents[ER_CANT_CREATE_URL][1] = "Error! Cannot create url for: {0}";
  +  }
   
  -public static final int WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE = 15;
  -static {contents[WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE + MAX_CODE][1] 
  -          = "Match conflict between xsl:strip-space and xsl:preserve-space";
  -}
  +  /** NEEDSDOC Field ER_XSLFUNCTIONS_UNSUPPORTED          */
  +  public static final int ER_XSLFUNCTIONS_UNSUPPORTED = 60;
   
  -public static final int WG_ATTRIB_NOT_HANDLED = 16;
  -static {contents[WG_ATTRIB_NOT_HANDLED + MAX_CODE][1] 
  -          = "Xalan does not yet handle the {0} attribute!";
  -}
  +  static
  +  {
  +    contents[ER_XSLFUNCTIONS_UNSUPPORTED][1] = "xsl:functions is unsupported";
  +  }
   
  -public static final int WG_NO_DECIMALFORMAT_DECLARATION = 17;
  -static {contents[WG_NO_DECIMALFORMAT_DECLARATION + MAX_CODE][1] 
  -          = "No declaration found for decimal format: {0}";
  -}
  +  /** NEEDSDOC Field ER_PROCESSOR_ERROR          */
  +  public static final int ER_PROCESSOR_ERROR = 61;
   
  -public static final int WG_OLD_XSLT_NS = 18;
  -static {contents[WG_OLD_XSLT_NS + MAX_CODE][1] 
  -          = "Old XSLT Namespace: {0}";
  -}
  +  static
  +  {
  +    contents[ER_PROCESSOR_ERROR][1] = "XSLT Processor Error";
  +  }
   
  -public static final int WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = 19;
  -static {contents[WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED + MAX_CODE][1] 
  -          = "Only one default xsl:decimal-format declaration is allowed. The last one will be used.";
  -}
  +  /** NEEDSDOC Field ER_NOT_ALLOWED_INSIDE_STYLESHEET          */
  +  public static final int ER_NOT_ALLOWED_INSIDE_STYLESHEET = 62;
   
  -public static final int WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = 20;
  -static {contents[WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE + MAX_CODE][1] 
  -          = "xsl:decimal-format names must be unique. The last one will be used.";
  -}
  +  static
  +  {
  +    contents[ER_NOT_ALLOWED_INSIDE_STYLESHEET][1] =
  +      "(StylesheetHandler) {0} not allowed inside a stylesheet!";
  +  }
   
  -public static final int WG_ILLEGAL_ATTRIBUTE = 21;
  -static {contents[WG_ILLEGAL_ATTRIBUTE + MAX_CODE][1] 
  -          = "{0} has an illegal attribute: {1}";
  -}
  +  /** NEEDSDOC Field ER_RESULTNS_NOT_SUPPORTED          */
  +  public static final int ER_RESULTNS_NOT_SUPPORTED = 63;
   
  -public static final int WG_COULD_NOT_RESOLVE_PREFIX = 22;
  -static {contents[WG_COULD_NOT_RESOLVE_PREFIX + MAX_CODE][1] 
  -          = "Could not resolve namespace prefix: {0}. The attribute will be ignored.";
  -}
  +  static
  +  {
  +    contents[ER_RESULTNS_NOT_SUPPORTED][1] =
  +      "result-ns no longer supported!  Use xsl:output instead.";
  +  }
   
  -public static final int WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = 23;
  -static {contents[WG_STYLESHEET_REQUIRES_VERSION_ATTRIB + MAX_CODE][1] 
  -          = "xsl:stylesheet requires a 'version' attribute!";
  -}
  +  /** NEEDSDOC Field ER_DEFAULTSPACE_NOT_SUPPORTED          */
  +  public static final int ER_DEFAULTSPACE_NOT_SUPPORTED = 64;
   
  -public static final int WG_ILLEGAL_ATTRIBUTE_NAME = 24;
  -static {contents[WG_ILLEGAL_ATTRIBUTE_NAME + MAX_CODE][1] 
  -          = "Illegal attribute name: {0}";
  -}
  +  static
  +  {
  +    contents[ER_DEFAULTSPACE_NOT_SUPPORTED][1] =
  +      "default-space no longer supported!  Use xsl:strip-space or xsl:preserve-space instead.";
  +  }
   
  -public static final int WG_ILLEGAL_ATTRIBUTE_VALUE = 25;
  -static {contents[WG_ILLEGAL_ATTRIBUTE_VALUE + MAX_CODE][1] 
  -          = "Illegal value used for attribute {0}: {1}";
  -}
  +  /** NEEDSDOC Field ER_INDENTRESULT_NOT_SUPPORTED          */
  +  public static final int ER_INDENTRESULT_NOT_SUPPORTED = 65;
   
  -public static final int WG_EMPTY_SECOND_ARG = 26;
  -static {contents[WG_EMPTY_SECOND_ARG + MAX_CODE][1] 
  -          = "Resulting nodeset from second argument of document function is empty. The first agument will be used.";
  -}
  +  static
  +  {
  +    contents[ER_INDENTRESULT_NOT_SUPPORTED][1] =
  +      "indent-result no longer supported!  Use xsl:output instead.";
  +  }
  +
  +  /** NEEDSDOC Field ER_ILLEGAL_ATTRIB          */
  +  public static final int ER_ILLEGAL_ATTRIB = 66;
  +
  +  static
  +  {
  +    contents[ER_ILLEGAL_ATTRIB][1] =
  +      "(StylesheetHandler) {0} has an illegal attribute: {1}";
  +  }
  +
  +  /** NEEDSDOC Field ER_UNKNOWN_XSL_ELEM          */
  +  public static final int ER_UNKNOWN_XSL_ELEM = 67;
  +
  +  static
  +  {
  +    contents[ER_UNKNOWN_XSL_ELEM][1] = "Unknown XSL element: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_BAD_XSLSORT_USE          */
  +  public static final int ER_BAD_XSLSORT_USE = 68;
   
  +  static
  +  {
  +    contents[ER_BAD_XSLSORT_USE][1] =
  +      "(StylesheetHandler) xsl:sort can only be used with xsl:apply-templates or xsl:for-each.";
  +  }
  +
  +  /** NEEDSDOC Field ER_MISPLACED_XSLWHEN          */
  +  public static final int ER_MISPLACED_XSLWHEN = 69;
   
  +  static
  +  {
  +    contents[ER_MISPLACED_XSLWHEN][1] =
  +      "(StylesheetHandler) misplaced xsl:when!";
  +  }
   
  -// Other miscellaneous text used inside the code...
  +  /** NEEDSDOC Field ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE          */
  +  public static final int ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE = 70;
   
  -static  {
  -         
  -         contents[MAX_MESSAGES][0] = "ui_language";
  -         contents[MAX_MESSAGES][1] = "en";
  -         
  -         contents[MAX_MESSAGES + 1][0] = "help_language";
  -         contents[MAX_MESSAGES + 1][1] = "en";
  -         
  -         contents[MAX_MESSAGES + 2][0] = "language";
  -         contents[MAX_MESSAGES + 2][1] = "en";
  -         
  -         contents[MAX_MESSAGES + 3][0] = "BAD_CODE";
  -         contents[MAX_MESSAGES + 3][1] = "Parameter to createMessage was out of bounds";
  -  
  -         contents[MAX_MESSAGES + 4][0] = "FORMAT_FAILED";
  -         contents[MAX_MESSAGES + 4][1] = "Exception thrown during messageFormat call";
  -         
  -         contents[MAX_MESSAGES + 5][0] = "version";
  -         contents[MAX_MESSAGES + 5][1] = ">>>>>>> Xalan Version ";
  -         
  -         contents[MAX_MESSAGES + 6][0] = "version2";
  -         contents[MAX_MESSAGES + 6][1] = "<<<<<<<";
  -         
  -         contents[MAX_MESSAGES + 7][0] = "yes";
  -         contents[MAX_MESSAGES + 7][1] = "yes";
  -         
  -         contents[MAX_MESSAGES + 8][0] = "line";
  -         contents[MAX_MESSAGES + 8][1] = "Line #";
  -         
  -         contents[MAX_MESSAGES + 9][0] = "column";
  -         contents[MAX_MESSAGES + 9][1] = "Column #";
  -         
  -         contents[MAX_MESSAGES + 10][0] = "xsldone";
  -         contents[MAX_MESSAGES + 10][1] = "XSLProcessor: done";
  -         
  -         contents[MAX_MESSAGES + 11][0] = "xslProc_option";
  -         contents[MAX_MESSAGES + 11][1] = "=xslproc options:";
  -         
  -         contents[MAX_MESSAGES + 12][0] = "optionIN";
  -         contents[MAX_MESSAGES + 12][1] = "    -IN inputXMLURL";
  -         
  -         contents[MAX_MESSAGES + 13][0] = "optionXSL";
  -         contents[MAX_MESSAGES + 13][1] = "   [-XSL XSLTransformationURL]";
  -         
  -         contents[MAX_MESSAGES + 14][0] = "optionOUT";
  -         contents[MAX_MESSAGES + 14][1] = "   [-XSL XSLTransformationURL]";
  -         
  -         contents[MAX_MESSAGES + 15][0] = "optionLXCIN";
  -         contents[MAX_MESSAGES + 15][1] = "   [-LXCIN compiledStylesheetFileNameIn]";
  -         
  -         contents[MAX_MESSAGES + 16][0] = "optionLXCOUT";
  -         contents[MAX_MESSAGES + 16][1] = "   [-LXCOUT compiledStylesheetFileNameOutOut]";
  -         
  -         contents[MAX_MESSAGES + 17][0] = "optionPARSER";
  -         contents[MAX_MESSAGES + 17][1] = "   [-PARSER fully qualified class name of parser liaison]";
  -         
  -         contents[MAX_MESSAGES + 18][0] = "optionE";
  -         contents[MAX_MESSAGES + 18][1] = "   [-E (Do not expand entity refs)]";
  -         
  -         contents[MAX_MESSAGES + 19][0] = "optionV";
  -         contents[MAX_MESSAGES + 19][1] = "   [-E (Do not expand entity refs)]";
  -         
  -         contents[MAX_MESSAGES + 20][0] = "optionQC";
  -         contents[MAX_MESSAGES + 20][1] = "   [-QC (Quiet Pattern Conflicts Warnings)]";
  -         
  -         contents[MAX_MESSAGES + 21][0] = "optionQ";
  -         contents[MAX_MESSAGES + 21][1] = "   [-Q  (Quiet Mode)]";
  -         
  -         contents[MAX_MESSAGES + 22][0] = "optionLF";
  -         contents[MAX_MESSAGES + 22][1] = "   [-LF (Use linefeeds only on output {default is CR/LF})]";
  -         
  -         contents[MAX_MESSAGES + 23][0] = "optionCR";
  -         contents[MAX_MESSAGES + 23][1] = "   [-CR (Use carriage returns only on output {default is CR/LF})]";
  -         
  -         contents[MAX_MESSAGES + 24][0] = "optionESCAPE";
  -         contents[MAX_MESSAGES + 24][1] = "   [-ESCAPE (Which characters to escape {default is <>&\"\'\\r\\n}]";
  -
  -         contents[MAX_MESSAGES + 25][0] = "optionINDENT";
  -         contents[MAX_MESSAGES + 25][1] = "   [-INDENT (Control how many spaces to indent {default is 0})]";
  -
  -         contents[MAX_MESSAGES + 26][0] = "optionTT";
  -         contents[MAX_MESSAGES + 26][1] = "   [-TT (Trace the templates as they are being called.)]";
  -
  -         contents[MAX_MESSAGES + 27][0] = "optionTG";
  -         contents[MAX_MESSAGES + 27][1] = "   [-TG (Trace each generation event.)]";
  -
  -         contents[MAX_MESSAGES + 28][0] = "optionTS";
  -         contents[MAX_MESSAGES + 28][1] = "   [-TS (Trace each selection event.)]";
  -
  -         contents[MAX_MESSAGES + 29][0] = "optionTTC";
  -         contents[MAX_MESSAGES + 29][1] = "   [-TTC (Trace the template children as they are being processed.)]";
  -
  -         contents[MAX_MESSAGES + 30][0] = "optionTCLASS";
  -         contents[MAX_MESSAGES + 30][1] = "   [-TCLASS (TraceListener class for trace extensions.)]";
  -
  -         contents[MAX_MESSAGES + 31][0] = "optionVALIDATE"; 
  -         contents[MAX_MESSAGES + 31][1] = "   [-VALIDATE (Set whether validation occurs.  Validation is off by default.)]";
  -         
  -         contents[MAX_MESSAGES + 32][0] = "optionEDUMP";
  -         contents[MAX_MESSAGES + 32][1] = "   [-EDUMP {optional filename} (Do stackdump on error.)]";
  -         
  -         contents[MAX_MESSAGES + 33][0] = "optionXML";
  -         contents[MAX_MESSAGES + 33][1] = "   [-XML (Use XML formatter and add XML header.)]";
  -         
  -         contents[MAX_MESSAGES + 34][0] = "optionTEXT";
  -         contents[MAX_MESSAGES + 34][1] = "   [-TEXT (Use simple Text formatter.)]";
  -         
  -         contents[MAX_MESSAGES + 35][0] = "optionHTML";
  -         contents[MAX_MESSAGES + 35][1] = "   [-HTML (Use HTML formatter.)]";
  -         
  -         contents[MAX_MESSAGES + 36][0] = "optionPARAM";
  -         contents[MAX_MESSAGES + 36][1] = "   [-PARAM name expression (Set a stylesheet parameter)]";
  -
  -         contents[MAX_MESSAGES + 37][0] = "noParsermsg1";
  -         contents[MAX_MESSAGES + 37][1] = "XSL Process was not successful.";
  -         
  -         contents[MAX_MESSAGES + 38][0] = "noParsermsg2";
  -         contents[MAX_MESSAGES + 38][1] = "** Could not find parser **";
  -         
  -         contents[MAX_MESSAGES + 39][0] = "noParsermsg3";
  -         contents[MAX_MESSAGES + 39][1] = "Please check your classpath.";
  -         
  -         contents[MAX_MESSAGES + 40][0] = "noParsermsg4";
  -         contents[MAX_MESSAGES + 40][1] = "If you don't have IBM's XML Parser for Java, you can download it from";
  -         
  -         contents[MAX_MESSAGES + 41][0] = "noParsermsg5";
  -         contents[MAX_MESSAGES + 41][1] = "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml";         
  +  static
  +  {
  +    contents[ER_XSLWHEN_NOT_PARENTED_BY_XSLCHOOSE][1] =
  +      "(StylesheetHandler) xsl:when not parented by xsl:choose!";
  +  }
  +
  +  /** NEEDSDOC Field ER_MISPLACED_XSLOTHERWISE          */
  +  public static final int ER_MISPLACED_XSLOTHERWISE = 71;
  +
  +  static
  +  {
  +    contents[ER_MISPLACED_XSLOTHERWISE][1] =
  +      "(StylesheetHandler) misplaced xsl:otherwise!";
  +  }
  +
  +  /** NEEDSDOC Field ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE          */
  +  public static final int ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE = 72;
  +
  +  static
  +  {
  +    contents[ER_XSLOTHERWISE_NOT_PARENTED_BY_XSLCHOOSE][1] =
  +      "(StylesheetHandler) xsl:otherwise not parented by xsl:choose!";
  +  }
  +
  +  /** NEEDSDOC Field ER_NOT_ALLOWED_INSIDE_TEMPLATE          */
  +  public static final int ER_NOT_ALLOWED_INSIDE_TEMPLATE = 73;
  +
  +  static
  +  {
  +    contents[ER_NOT_ALLOWED_INSIDE_TEMPLATE][1] =
  +      "(StylesheetHandler) {0} is not allowed inside a template!";
  +  }
  +
  +  /** NEEDSDOC Field ER_UNKNOWN_EXT_NS_PREFIX          */
  +  public static final int ER_UNKNOWN_EXT_NS_PREFIX = 74;
  +
  +  static
  +  {
  +    contents[ER_UNKNOWN_EXT_NS_PREFIX][1] =
  +      "(StylesheetHandler) {0} extension namespace prefix {1} unknown";
  +  }
  +
  +  /** NEEDSDOC Field ER_IMPORTS_AS_FIRST_ELEM          */
  +  public static final int ER_IMPORTS_AS_FIRST_ELEM = 75;
  +
  +  static
  +  {
  +    contents[ER_IMPORTS_AS_FIRST_ELEM][1] =
  +      "(StylesheetHandler) Imports can only occur as the first elements in the stylesheet!";
  +  }
  +
  +  /** NEEDSDOC Field ER_IMPORTING_ITSELF          */
  +  public static final int ER_IMPORTING_ITSELF = 76;
  +
  +  static
  +  {
  +    contents[ER_IMPORTING_ITSELF][1] =
  +      "(StylesheetHandler) {0} is directly or indirectly importing itself!";
  +  }
  +
  +  /** NEEDSDOC Field ER_XMLSPACE_ILLEGAL_VAL          */
  +  public static final int ER_XMLSPACE_ILLEGAL_VAL = 77;
  +
  +  static
  +  {
  +    contents[ER_XMLSPACE_ILLEGAL_VAL][1] =
  +      "(StylesheetHandler) " + "xml:space has an illegal value: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL          */
  +  public static final int ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL = 78;
  +
  +  static
  +  {
  +    contents[ER_PROCESSSTYLESHEET_NOT_SUCCESSFUL][1] =
  +      "processStylesheet not succesfull!";
  +  }
  +
  +  /** NEEDSDOC Field ER_SAX_EXCEPTION          */
  +  public static final int ER_SAX_EXCEPTION = 79;
  +
  +  static
  +  {
  +    contents[ER_SAX_EXCEPTION][1] = "SAX Exception";
  +  }
  +
  +  /** NEEDSDOC Field ER_FUNCTION_NOT_SUPPORTED          */
  +  public static final int ER_FUNCTION_NOT_SUPPORTED = 80;
  +
  +  static
  +  {
  +    contents[ER_FUNCTION_NOT_SUPPORTED][1] = "Function not supported!";
  +  }
  +
  +  /** NEEDSDOC Field ER_XSLT_ERROR          */
  +  public static final int ER_XSLT_ERROR = 81;
  +
  +  static
  +  {
  +    contents[ER_XSLT_ERROR][1] = "XSLT Error";
  +  }
  +
  +  /** NEEDSDOC Field ER_CURRENCY_SIGN_ILLEGAL          */
  +  public static final int ER_CURRENCY_SIGN_ILLEGAL = 82;
  +
  +  static
  +  {
  +    contents[ER_CURRENCY_SIGN_ILLEGAL][1] =
  +      "currency sign is not allowed in format pattern string";
     }
   
  +  /** NEEDSDOC Field ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM          */
  +  public static final int ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM = 83;
  +
  +  static
  +  {
  +    contents[ER_DOCUMENT_FUNCTION_INVALID_IN_STYLESHEET_DOM][1] =
  +      "Document function not supported in Stylesheet DOM!";
  +  }
  +
  +  /** NEEDSDOC Field ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER          */
  +  public static final int ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER = 84;
  +
  +  static
  +  {
  +    contents[ER_CANT_RESOLVE_PREFIX_OF_NON_PREFIX_RESOLVER][1] =
  +      "Can't resolve prefix of non-Prefix resolver!";
  +  }
  +
  +  /** NEEDSDOC Field ER_REDIRECT_COULDNT_GET_FILENAME          */
  +  public static final int ER_REDIRECT_COULDNT_GET_FILENAME = 85;
  +
  +  static
  +  {
  +    contents[ER_REDIRECT_COULDNT_GET_FILENAME][1] =
  +      "Redirect extension: Could not get filename - file or select attribute must return vald string.";
  +  }
  +
  +  /** NEEDSDOC Field ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT          */
  +  public static final int ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT = 86;
  +
  +  static
  +  {
  +    contents[ER_CANNOT_BUILD_FORMATTERLISTENER_IN_REDIRECT][1] =
  +      "Can not build FormatterListener in Redirect extension!";
  +  }
  +
  +  /** NEEDSDOC Field ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX          */
  +  public static final int ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX = 87;
  +
  +  static
  +  {
  +    contents[ER_INVALID_PREFIX_IN_EXCLUDERESULTPREFIX][1] =
  +      "Prefix in exclude-result-prefixes is not valid: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_MISSING_NS_URI          */
  +  public static final int ER_MISSING_NS_URI = 88;
  +
  +  static
  +  {
  +    contents[ER_MISSING_NS_URI][1] =
  +      "Missing namespace URI for specified prefix";
  +  }
  +
  +  /** NEEDSDOC Field ER_MISSING_ARG_FOR_OPTION          */
  +  public static final int ER_MISSING_ARG_FOR_OPTION = 89;
  +
  +  static
  +  {
  +    contents[ER_MISSING_ARG_FOR_OPTION][1] =
  +      "Missing argument for option: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_INVALID_OPTION          */
  +  public static final int ER_INVALID_OPTION = 90;
  +
  +  static
  +  {
  +    contents[ER_INVALID_OPTION][1] = "Invalid option: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_MALFORMED_FORMAT_STRING          */
  +  public static final int ER_MALFORMED_FORMAT_STRING = 91;
  +
  +  static
  +  {
  +    contents[ER_MALFORMED_FORMAT_STRING][1] = "Malformed format string: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_STYLESHEET_REQUIRES_VERSION_ATTRIB          */
  +  public static final int ER_STYLESHEET_REQUIRES_VERSION_ATTRIB = 92;
  +
  +  static
  +  {
  +    contents[ER_STYLESHEET_REQUIRES_VERSION_ATTRIB][1] =
  +      "xsl:stylesheet requires a 'version' attribute!";
  +  }
  +
  +  /** NEEDSDOC Field ER_ILLEGAL_ATTRIBUTE_VALUE          */
  +  public static final int ER_ILLEGAL_ATTRIBUTE_VALUE = 93;
  +
  +  static
  +  {
  +    contents[ER_ILLEGAL_ATTRIBUTE_VALUE][1] =
  +      "Attribute: {0} has an illegal value: {1}";
  +  }
  +
  +  /** NEEDSDOC Field ER_CHOOSE_REQUIRES_WHEN          */
  +  public static final int ER_CHOOSE_REQUIRES_WHEN = 94;
  +
  +  static
  +  {
  +    contents[ER_CHOOSE_REQUIRES_WHEN][1] = "xsl:choose requires an xsl:when";
  +  }
  +
  +  /** NEEDSDOC Field ER_NO_APPLY_IMPORT_IN_FOR_EACH          */
  +  public static final int ER_NO_APPLY_IMPORT_IN_FOR_EACH = 95;
  +
  +  static
  +  {
  +    contents[ER_NO_APPLY_IMPORT_IN_FOR_EACH][1] =
  +      "xsl:apply-imports not allowed in a xsl:for-each";
  +  }
  +
  +  /** NEEDSDOC Field ER_CANT_USE_DTM_FOR_OUTPUT          */
  +  public static final int ER_CANT_USE_DTM_FOR_OUTPUT = 96;
  +
  +  static
  +  {
  +    contents[ER_CANT_USE_DTM_FOR_OUTPUT][1] =
  +      "Cannot use a DTMLiaison for an output DOM node... pass a org.apache.xpath.DOM2Helper instead!";
  +  }
  +
  +  /** NEEDSDOC Field ER_CANT_USE_DTM_FOR_INPUT          */
  +  public static final int ER_CANT_USE_DTM_FOR_INPUT = 97;
  +
  +  static
  +  {
  +    contents[ER_CANT_USE_DTM_FOR_INPUT][1] =
  +      "Cannot use a DTMLiaison for a input DOM node... pass a org.apache.xpath.DOM2Helper instead!";
  +  }
  +
  +  /** NEEDSDOC Field ER_CALL_TO_EXT_FAILED          */
  +  public static final int ER_CALL_TO_EXT_FAILED = 98;
  +
  +  static
  +  {
  +    contents[ER_CALL_TO_EXT_FAILED][1] =
  +      "Call to extension element failed: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_PREFIX_MUST_RESOLVE          */
  +  public static final int ER_PREFIX_MUST_RESOLVE = 99;
  +
  +  static
  +  {
  +    contents[ER_PREFIX_MUST_RESOLVE][1] =
  +      "Prefix must resolve to a namespace: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_INVALID_UTF16_SURROGATE          */
  +  public static final int ER_INVALID_UTF16_SURROGATE = 100;
  +
  +  static
  +  {
  +    contents[ER_INVALID_UTF16_SURROGATE][1] =
  +      "Invalid UTF-16 surrogate detected: {0} ?";
  +  }
  +
  +  /** NEEDSDOC Field ER_XSLATTRSET_USED_ITSELF          */
  +  public static final int ER_XSLATTRSET_USED_ITSELF = 101;
  +
  +  static
  +  {
  +    contents[ER_XSLATTRSET_USED_ITSELF][1] =
  +      "xsl:attribute-set {0} used itself, which will cause an infinite loop.";
  +  }
  +
  +  /** NEEDSDOC Field ER_CANNOT_MIX_XERCESDOM          */
  +  public static final int ER_CANNOT_MIX_XERCESDOM = 102;
  +
  +  static
  +  {
  +    contents[ER_CANNOT_MIX_XERCESDOM][1] =
  +      "Can not mix non Xerces-DOM input with Xerces-DOM output!";
  +  }
  +
  +  /** NEEDSDOC Field ER_TOO_MANY_LISTENERS          */
  +  public static final int ER_TOO_MANY_LISTENERS = 103;
  +
  +  static
  +  {
  +    contents[ER_TOO_MANY_LISTENERS][1] =
  +      "addTraceListenersToStylesheet - TooManyListenersException";
  +  }
  +
  +  /** NEEDSDOC Field ER_IN_ELEMTEMPLATEELEM_READOBJECT          */
  +  public static final int ER_IN_ELEMTEMPLATEELEM_READOBJECT = 104;
  +
  +  static
  +  {
  +    contents[ER_IN_ELEMTEMPLATEELEM_READOBJECT][1] =
  +      "In ElemTemplateElement.readObject: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_DUPLICATE_NAMED_TEMPLATE          */
  +  public static final int ER_DUPLICATE_NAMED_TEMPLATE = 105;
  +
  +  static
  +  {
  +    contents[ER_DUPLICATE_NAMED_TEMPLATE][1] =
  +      "Found more than one template named: {0}";
  +  }
  +
  +  /** NEEDSDOC Field ER_INVALID_KEY_CALL          */
  +  public static final int ER_INVALID_KEY_CALL = 106;
  +
  +  static
  +  {
  +    contents[ER_INVALID_KEY_CALL][1] =
  +      "Invalid function call: recursive key() calls are not allowed";
  +  }
  +
  +  // Warnings...
  +
  +  /** NEEDSDOC Field WG_FOUND_CURLYBRACE          */
  +  public static final int WG_FOUND_CURLYBRACE = 1;
  +
  +  static
  +  {
  +    contents[WG_FOUND_CURLYBRACE + MAX_CODE][1] =
  +      "Found '}' but no attribute template open!";
  +  }
  +
  +  /** NEEDSDOC Field WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR          */
  +  public static final int WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR = 2;
  +
  +  static
  +  {
  +    contents[WG_COUNT_ATTRIB_MATCHES_NO_ANCESTOR + MAX_CODE][1] =
  +      "Warning: count attribute does not match an ancestor in xsl:number! Target = {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_EXPR_ATTRIB_CHANGED_TO_SELECT          */
  +  public static final int WG_EXPR_ATTRIB_CHANGED_TO_SELECT = 3;
  +
  +  static
  +  {
  +    contents[WG_EXPR_ATTRIB_CHANGED_TO_SELECT + MAX_CODE][1] =
  +      "Old syntax: The name of the 'expr' attribute has been changed to 'select'.";
  +  }
  +
  +  /** NEEDSDOC Field WG_NO_LOCALE_IN_FORMATNUMBER          */
  +  public static final int WG_NO_LOCALE_IN_FORMATNUMBER = 4;
  +
  +  static
  +  {
  +    contents[WG_NO_LOCALE_IN_FORMATNUMBER + MAX_CODE][1] =
  +      "Xalan doesn't yet handle the locale name in the format-number function.";
  +  }
  +
  +  /** NEEDSDOC Field WG_LOCALE_NOT_FOUND          */
  +  public static final int WG_LOCALE_NOT_FOUND = 5;
  +
  +  static
  +  {
  +    contents[WG_LOCALE_NOT_FOUND + MAX_CODE][1] =
  +      "Warning: Could not find locale for xml:lang={0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_CANNOT_MAKE_URL_FROM          */
  +  public static final int WG_CANNOT_MAKE_URL_FROM = 6;
  +
  +  static
  +  {
  +    contents[WG_CANNOT_MAKE_URL_FROM + MAX_CODE][1] =
  +      "Can not make URL from: {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_CANNOT_LOAD_REQUESTED_DOC          */
  +  public static final int WG_CANNOT_LOAD_REQUESTED_DOC = 7;
  +
  +  static
  +  {
  +    contents[WG_CANNOT_LOAD_REQUESTED_DOC + MAX_CODE][1] =
  +      "Can not load requested doc: {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_CANNOT_FIND_COLLATOR          */
  +  public static final int WG_CANNOT_FIND_COLLATOR = 8;
  +
  +  static
  +  {
  +    contents[WG_CANNOT_FIND_COLLATOR + MAX_CODE][1] =
  +      "Could not find Collator for <sort xml:lang={0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_FUNCTIONS_SHOULD_USE_URL          */
  +  public static final int WG_FUNCTIONS_SHOULD_USE_URL = 9;
  +
  +  static
  +  {
  +    contents[WG_FUNCTIONS_SHOULD_USE_URL + MAX_CODE][1] =
  +      "Old syntax: the functions instruction should use a url of {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_ENCODING_NOT_SUPPORTED_USING_UTF8          */
  +  public static final int WG_ENCODING_NOT_SUPPORTED_USING_UTF8 = 10;
  +
  +  static
  +  {
  +    contents[WG_ENCODING_NOT_SUPPORTED_USING_UTF8 + MAX_CODE][1] =
  +      "encoding not supported: {0}, using UTF-8";
  +  }
  +
  +  /** NEEDSDOC Field WG_ENCODING_NOT_SUPPORTED_USING_JAVA          */
  +  public static final int WG_ENCODING_NOT_SUPPORTED_USING_JAVA = 11;
  +
  +  static
  +  {
  +    contents[WG_ENCODING_NOT_SUPPORTED_USING_JAVA + MAX_CODE][1] =
  +      "encoding not supported: {0}, using Java {1}";
  +  }
  +
  +  /** NEEDSDOC Field WG_SPECIFICITY_CONFLICTS          */
  +  public static final int WG_SPECIFICITY_CONFLICTS = 12;
  +
  +  static
  +  {
  +    contents[WG_SPECIFICITY_CONFLICTS + MAX_CODE][1] =
  +      "Specificity conflicts found: {0} Last found in stylesheet will be used.";
  +  }
  +
  +  /** NEEDSDOC Field WG_PARSING_AND_PREPARING          */
  +  public static final int WG_PARSING_AND_PREPARING = 13;
  +
  +  static
  +  {
  +    contents[WG_PARSING_AND_PREPARING + MAX_CODE][1] =
  +      "========= Parsing and preparing {0} ==========";
  +  }
  +
  +  /** NEEDSDOC Field WG_ATTR_TEMPLATE          */
  +  public static final int WG_ATTR_TEMPLATE = 14;
  +
  +  static
  +  {
  +    contents[WG_ATTR_TEMPLATE + MAX_CODE][1] = "Attr Template, {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE          */
  +  public static final int WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE =
  +    15;
  +
  +  static
  +  {
  +    contents[WG_CONFLICT_BETWEEN_XSLSTRIPSPACE_AND_XSLPRESERVESPACE + MAX_CODE][1] =
  +      "Match conflict between xsl:strip-space and xsl:preserve-space";
  +  }
  +
  +  /** NEEDSDOC Field WG_ATTRIB_NOT_HANDLED          */
  +  public static final int WG_ATTRIB_NOT_HANDLED = 16;
  +
  +  static
  +  {
  +    contents[WG_ATTRIB_NOT_HANDLED + MAX_CODE][1] =
  +      "Xalan does not yet handle the {0} attribute!";
  +  }
  +
  +  /** NEEDSDOC Field WG_NO_DECIMALFORMAT_DECLARATION          */
  +  public static final int WG_NO_DECIMALFORMAT_DECLARATION = 17;
  +
  +  static
  +  {
  +    contents[WG_NO_DECIMALFORMAT_DECLARATION + MAX_CODE][1] =
  +      "No declaration found for decimal format: {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_OLD_XSLT_NS          */
  +  public static final int WG_OLD_XSLT_NS = 18;
  +
  +  static
  +  {
  +    contents[WG_OLD_XSLT_NS + MAX_CODE][1] = "Old XSLT Namespace: {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED          */
  +  public static final int WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED = 19;
  +
  +  static
  +  {
  +    contents[WG_ONE_DEFAULT_XSLDECIMALFORMAT_ALLOWED + MAX_CODE][1] =
  +      "Only one default xsl:decimal-format declaration is allowed. The last one will be used.";
  +  }
  +
  +  /** NEEDSDOC Field WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE          */
  +  public static final int WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE = 20;
  +
  +  static
  +  {
  +    contents[WG_XSLDECIMALFORMAT_NAMES_MUST_BE_UNIQUE + MAX_CODE][1] =
  +      "xsl:decimal-format names must be unique. The last one will be used.";
  +  }
  +
  +  /** NEEDSDOC Field WG_ILLEGAL_ATTRIBUTE          */
  +  public static final int WG_ILLEGAL_ATTRIBUTE = 21;
  +
  +  static
  +  {
  +    contents[WG_ILLEGAL_ATTRIBUTE + MAX_CODE][1] =
  +      "{0} has an illegal attribute: {1}";
  +  }
  +
  +  /** NEEDSDOC Field WG_COULD_NOT_RESOLVE_PREFIX          */
  +  public static final int WG_COULD_NOT_RESOLVE_PREFIX = 22;
  +
  +  static
  +  {
  +    contents[WG_COULD_NOT_RESOLVE_PREFIX + MAX_CODE][1] =
  +      "Could not resolve namespace prefix: {0}. The attribute will be ignored.";
  +  }
  +
  +  /** NEEDSDOC Field WG_STYLESHEET_REQUIRES_VERSION_ATTRIB          */
  +  public static final int WG_STYLESHEET_REQUIRES_VERSION_ATTRIB = 23;
  +
  +  static
  +  {
  +    contents[WG_STYLESHEET_REQUIRES_VERSION_ATTRIB + MAX_CODE][1] =
  +      "xsl:stylesheet requires a 'version' attribute!";
  +  }
  +
  +  /** NEEDSDOC Field WG_ILLEGAL_ATTRIBUTE_NAME          */
  +  public static final int WG_ILLEGAL_ATTRIBUTE_NAME = 24;
  +
  +  static
  +  {
  +    contents[WG_ILLEGAL_ATTRIBUTE_NAME + MAX_CODE][1] =
  +      "Illegal attribute name: {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_ILLEGAL_ATTRIBUTE_VALUE          */
  +  public static final int WG_ILLEGAL_ATTRIBUTE_VALUE = 25;
  +
  +  static
  +  {
  +    contents[WG_ILLEGAL_ATTRIBUTE_VALUE + MAX_CODE][1] =
  +      "Illegal value used for attribute {0}: {1}";
  +  }
  +
  +  /** NEEDSDOC Field WG_EMPTY_SECOND_ARG          */
  +  public static final int WG_EMPTY_SECOND_ARG = 26;
  +
  +  static
  +  {
  +    contents[WG_EMPTY_SECOND_ARG + MAX_CODE][1] =
  +      "Resulting nodeset from second argument of document function is empty. The first agument will be used.";
  +  }
  +
  +  // Other miscellaneous text used inside the code...
  +  static
  +  {
  +    contents[MAX_MESSAGES][0] = "ui_language";
  +    contents[MAX_MESSAGES][1] = "en";
  +    contents[MAX_MESSAGES + 1][0] = "help_language";
  +    contents[MAX_MESSAGES + 1][1] = "en";
  +    contents[MAX_MESSAGES + 2][0] = "language";
  +    contents[MAX_MESSAGES + 2][1] = "en";
  +    contents[MAX_MESSAGES + 3][0] = "BAD_CODE";
  +    contents[MAX_MESSAGES + 3][1] =
  +      "Parameter to createMessage was out of bounds";
  +    contents[MAX_MESSAGES + 4][0] = "FORMAT_FAILED";
  +    contents[MAX_MESSAGES + 4][1] =
  +      "Exception thrown during messageFormat call";
  +    contents[MAX_MESSAGES + 5][0] = "version";
  +    contents[MAX_MESSAGES + 5][1] = ">>>>>>> Xalan Version ";
  +    contents[MAX_MESSAGES + 6][0] = "version2";
  +    contents[MAX_MESSAGES + 6][1] = "<<<<<<<";
  +    contents[MAX_MESSAGES + 7][0] = "yes";
  +    contents[MAX_MESSAGES + 7][1] = "yes";
  +    contents[MAX_MESSAGES + 8][0] = "line";
  +    contents[MAX_MESSAGES + 8][1] = "Line #";
  +    contents[MAX_MESSAGES + 9][0] = "column";
  +    contents[MAX_MESSAGES + 9][1] = "Column #";
  +    contents[MAX_MESSAGES + 10][0] = "xsldone";
  +    contents[MAX_MESSAGES + 10][1] = "XSLProcessor: done";
  +    contents[MAX_MESSAGES + 11][0] = "xslProc_option";
  +    contents[MAX_MESSAGES + 11][1] = "=xslproc options:";
  +    contents[MAX_MESSAGES + 12][0] = "optionIN";
  +    contents[MAX_MESSAGES + 12][1] = "    -IN inputXMLURL";
  +    contents[MAX_MESSAGES + 13][0] = "optionXSL";
  +    contents[MAX_MESSAGES + 13][1] = "   [-XSL XSLTransformationURL]";
  +    contents[MAX_MESSAGES + 14][0] = "optionOUT";
  +    contents[MAX_MESSAGES + 14][1] = "   [-XSL XSLTransformationURL]";
  +    contents[MAX_MESSAGES + 15][0] = "optionLXCIN";
  +    contents[MAX_MESSAGES + 15][1] =
  +      "   [-LXCIN compiledStylesheetFileNameIn]";
  +    contents[MAX_MESSAGES + 16][0] = "optionLXCOUT";
  +    contents[MAX_MESSAGES + 16][1] =
  +      "   [-LXCOUT compiledStylesheetFileNameOutOut]";
  +    contents[MAX_MESSAGES + 17][0] = "optionPARSER";
  +    contents[MAX_MESSAGES + 17][1] =
  +      "   [-PARSER fully qualified class name of parser liaison]";
  +    contents[MAX_MESSAGES + 18][0] = "optionE";
  +    contents[MAX_MESSAGES + 18][1] = "   [-E (Do not expand entity refs)]";
  +    contents[MAX_MESSAGES + 19][0] = "optionV";
  +    contents[MAX_MESSAGES + 19][1] = "   [-E (Do not expand entity refs)]";
  +    contents[MAX_MESSAGES + 20][0] = "optionQC";
  +    contents[MAX_MESSAGES + 20][1] =
  +      "   [-QC (Quiet Pattern Conflicts Warnings)]";
  +    contents[MAX_MESSAGES + 21][0] = "optionQ";
  +    contents[MAX_MESSAGES + 21][1] = "   [-Q  (Quiet Mode)]";
  +    contents[MAX_MESSAGES + 22][0] = "optionLF";
  +    contents[MAX_MESSAGES + 22][1] =
  +      "   [-LF (Use linefeeds only on output {default is CR/LF})]";
  +    contents[MAX_MESSAGES + 23][0] = "optionCR";
  +    contents[MAX_MESSAGES + 23][1] =
  +      "   [-CR (Use carriage returns only on output {default is CR/LF})]";
  +    contents[MAX_MESSAGES + 24][0] = "optionESCAPE";
  +    contents[MAX_MESSAGES + 24][1] =
  +      "   [-ESCAPE (Which characters to escape {default is <>&\"\'\\r\\n}]";
  +    contents[MAX_MESSAGES + 25][0] = "optionINDENT";
  +    contents[MAX_MESSAGES + 25][1] =
  +      "   [-INDENT (Control how many spaces to indent {default is 0})]";
  +    contents[MAX_MESSAGES + 26][0] = "optionTT";
  +    contents[MAX_MESSAGES + 26][1] =
  +      "   [-TT (Trace the templates as they are being called.)]";
  +    contents[MAX_MESSAGES + 27][0] = "optionTG";
  +    contents[MAX_MESSAGES + 27][1] =
  +      "   [-TG (Trace each generation event.)]";
  +    contents[MAX_MESSAGES + 28][0] = "optionTS";
  +    contents[MAX_MESSAGES + 28][1] = "   [-TS (Trace each selection event.)]";
  +    contents[MAX_MESSAGES + 29][0] = "optionTTC";
  +    contents[MAX_MESSAGES + 29][1] =
  +      "   [-TTC (Trace the template children as they are being processed.)]";
  +    contents[MAX_MESSAGES + 30][0] = "optionTCLASS";
  +    contents[MAX_MESSAGES + 30][1] =
  +      "   [-TCLASS (TraceListener class for trace extensions.)]";
  +    contents[MAX_MESSAGES + 31][0] = "optionVALIDATE";
  +    contents[MAX_MESSAGES + 31][1] =
  +      "   [-VALIDATE (Set whether validation occurs.  Validation is off by default.)]";
  +    contents[MAX_MESSAGES + 32][0] = "optionEDUMP";
  +    contents[MAX_MESSAGES + 32][1] =
  +      "   [-EDUMP {optional filename} (Do stackdump on error.)]";
  +    contents[MAX_MESSAGES + 33][0] = "optionXML";
  +    contents[MAX_MESSAGES + 33][1] =
  +      "   [-XML (Use XML formatter and add XML header.)]";
  +    contents[MAX_MESSAGES + 34][0] = "optionTEXT";
  +    contents[MAX_MESSAGES + 34][1] =
  +      "   [-TEXT (Use simple Text formatter.)]";
  +    contents[MAX_MESSAGES + 35][0] = "optionHTML";
  +    contents[MAX_MESSAGES + 35][1] = "   [-HTML (Use HTML formatter.)]";
  +    contents[MAX_MESSAGES + 36][0] = "optionPARAM";
  +    contents[MAX_MESSAGES + 36][1] =
  +      "   [-PARAM name expression (Set a stylesheet parameter)]";
  +    contents[MAX_MESSAGES + 37][0] = "noParsermsg1";
  +    contents[MAX_MESSAGES + 37][1] = "XSL Process was not successful.";
  +    contents[MAX_MESSAGES + 38][0] = "noParsermsg2";
  +    contents[MAX_MESSAGES + 38][1] = "** Could not find parser **";
  +    contents[MAX_MESSAGES + 39][0] = "noParsermsg3";
  +    contents[MAX_MESSAGES + 39][1] = "Please check your classpath.";
  +    contents[MAX_MESSAGES + 40][0] = "noParsermsg4";
  +    contents[MAX_MESSAGES + 40][1] =
  +      "If you don't have IBM's XML Parser for Java, you can download it from";
  +    contents[MAX_MESSAGES + 41][0] = "noParsermsg5";
  +    contents[MAX_MESSAGES + 41][1] =
  +      "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml";
  +  }
  +
     // ================= INFRASTRUCTURE ======================
   
  +  /** NEEDSDOC Field BAD_CODE          */
     public static final String BAD_CODE = "BAD_CODE";
  +
  +  /** NEEDSDOC Field FORMAT_FAILED          */
     public static final String FORMAT_FAILED = "FORMAT_FAILED";
   
  +  /** NEEDSDOC Field ERROR_STRING          */
     public static final String ERROR_STRING = "#error";
  +
  +  /** NEEDSDOC Field ERROR_HEADER          */
     public static final String ERROR_HEADER = "Error: ";
  +
  +  /** NEEDSDOC Field WARNING_HEADER          */
     public static final String WARNING_HEADER = "Warning: ";
  +
  +  /** NEEDSDOC Field XSL_HEADER          */
     public static final String XSL_HEADER = "XSL ";
  +
  +  /** NEEDSDOC Field XML_HEADER          */
     public static final String XML_HEADER = "XML ";
  +
  +  /** NEEDSDOC Field QUERY_HEADER          */
     public static final String QUERY_HEADER = "PATTERN ";
   
  -  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
     public Object[][] getContents()
     {
       return contents;
     }
   
  -/**
  -   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
  -   * of ResourceBundle.getBundle(). 
  +  /**
  +   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
  +   *   of ResourceBundle.getBundle().
  +   *  
  +   *   @param res the name of the resource to load.
  +   *   @param locale the locale to prefer when searching for the bundle
      *
  -   * @param res the name of the resource to load. 
  -   * @param locale the locale to prefer when searching for the bundle
  -   * @return the ResourceBundle
  -   * @throws MissingResourceException  
  +   * NEEDSDOC @param className
  +   *   @return the ResourceBundle
  +   *   @throws MissingResourceException
      */
  -  public static final XSLTErrorResources loadResourceBundle (String className) 
  -	  throws MissingResourceException
  +  public static final XSLTErrorResources loadResourceBundle(String className)
  +          throws MissingResourceException
     {
  -	Locale locale = Locale.getDefault();
  -	String suffix = getResourceSuffix(locale);  
  +
  +    Locale locale = Locale.getDefault();
  +    String suffix = getResourceSuffix(locale);
  +
       try
  -    {		
  -                                                           // first try with the given locale
  -      return (XSLTErrorResources)ResourceBundle.getBundle (className + suffix, locale);
  +    {
  +
  +      // first try with the given locale
  +      return (XSLTErrorResources) ResourceBundle.getBundle(className
  +              + suffix, locale);
       }
       catch (MissingResourceException e)
       {
  -      try                                                  // try to fall back to en_US if we can't load
  +      try  // try to fall back to en_US if we can't load
         {
  -                                                           // Since we can't find the localized property file,
  -                                                           // fall back to en_US.
  -        return (XSLTErrorResources)ResourceBundle.getBundle (className, new Locale ("en", "US"));
  +
  +        // Since we can't find the localized property file,
  +        // fall back to en_US.
  +        return (XSLTErrorResources) ResourceBundle.getBundle(className,
  +                new Locale("en", "US"));
         }
         catch (MissingResourceException e2)
         {
  -                                                              // Now we are really in trouble.
  -                                                              // very bad, definitely very bad...not going to get very far
  -        throw new MissingResourceException ("Could not load any resource bundles.", className, "");
  +
  +        // Now we are really in trouble.
  +        // very bad, definitely very bad...not going to get very far
  +        throw new MissingResourceException(
  +          "Could not load any resource bundles.", className, "");
         }
       }
     }
  -  
  +
     /**
      * Return the resource file suffic for the indicated locale
      * For most locales, this will be based the language code.  However
  @@ -978,74 +1500,96 @@
      *
      * @param locale the locale
      * @return an String suffix which canbe appended to a resource name
  -   */        
  +   */
     private static final String getResourceSuffix(Locale locale)
     {
  -        String suffix = "_" + locale.getLanguage();
  -        
  -        String country = locale.getCountry();        
  -        
  -        if (country.equals("TW"))
  -            suffix += "_" + country;
  +
  +    String suffix = "_" + locale.getLanguage();
  +    String country = locale.getCountry();
  +
  +    if (country.equals("TW"))
  +      suffix += "_" + country;
   
  -        return suffix;
  +    return suffix;
     }
  -  
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getMessageKey(int errorCode)
     {
  -	  if (errorCode > MAX_CODE)
  +
  +    if (errorCode > MAX_CODE)
         return null;
       else
       {
         DecimalFormat df = new DecimalFormat("0000");
  -      return ERROR_SUFFIX + df.format(errorCode);	
  -    }  
  +
  +      return ERROR_SUFFIX + df.format(errorCode);
  +    }
     }
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getWarningKey(int errorCode)
     {
  -	  if (errorCode > MAX_WARNING)
  +
  +    if (errorCode > MAX_WARNING)
         return null;
  -	  else 
  -		{
  +    else
  +    {
         DecimalFormat df = new DecimalFormat("0000");
  -      return WARNING_SUFFIX + df.format(errorCode);	
  +
  +      return WARNING_SUFFIX + df.format(errorCode);
       }
     }
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public static String getMKey(int errorCode)
     {
  -	  if (errorCode > MAX_CODE)
  +
  +    if (errorCode > MAX_CODE)
         return null;
       else
       {
         DecimalFormat df = new DecimalFormat("0000");
  -      return ERROR_SUFFIX + df.format(errorCode);	
  -    }  
  +
  +      return ERROR_SUFFIX + df.format(errorCode);
  +    }
     }
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public static String getWKey(int errorCode)
     {
  -	  if (errorCode > MAX_WARNING)
  +
  +    if (errorCode > MAX_WARNING)
         return null;
  -	  else 
  -		{
  +    else
  +    {
         DecimalFormat df = new DecimalFormat("0000");
  -      return WARNING_SUFFIX + df.format(errorCode);	
  +
  +      return WARNING_SUFFIX + df.format(errorCode);
       }
     }
  -}    
  -
  +}
  
  
  
  1.2       +10 -3     xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources_en.java
  
  Index: XSLTErrorResources_en.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTErrorResources_en.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTErrorResources_en.java	2000/06/19 16:52:23	1.1
  +++ XSLTErrorResources_en.java	2000/10/30 18:56:38	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,10 +55,17 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTErrorResources_en extends XSLTErrorResources 
  +
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTErrorResources_en <needs-comment/>
  + */
  +public class XSLTErrorResources_en extends XSLTErrorResources
   {
   }
  
  
  
  1.2       +85 -58    xml-xalan/java/src/org/apache/xalan/res/XSLTResourceBundle.java
  
  Index: XSLTResourceBundle.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResourceBundle.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResourceBundle.java	2000/06/19 16:52:24	1.1
  +++ XSLTResourceBundle.java	2000/10/30 18:56:39	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,50 +55,68 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   import org.apache.xalan.templates.Constants;
  +
   //
   //  LotusXSLResourceBundle 
   //
  -public class XSLTResourceBundle extends ListResourceBundle 
  -{
  -	
  +
   /**
  -   * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
  -   * of ResourceBundle.getBundle(). 
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResourceBundle <needs-comment/>
  + */
  +public class XSLTResourceBundle extends ListResourceBundle
  +{
  +
  +  /**
  +   *   Return a named ResourceBundle for a particular locale.  This method mimics the behavior
  +   *   of ResourceBundle.getBundle().
  +   *  
  +   *   @param res the name of the resource to load.
      *
  -   * @param res the name of the resource to load. 
  -   * @param locale the locale to prefer when searching for the bundle
  -   * @return the ResourceBundle
  -   * @throws MissingResourceException  
  +   * NEEDSDOC @param className
  +   *   @param locale the locale to prefer when searching for the bundle
  +   *   @return the ResourceBundle
  +   *   @throws MissingResourceException
      */
  -  public static final XSLTResourceBundle loadResourceBundle (String className, Locale locale) 
  -	  throws MissingResourceException
  +  public static final XSLTResourceBundle loadResourceBundle(
  +          String className, Locale locale) throws MissingResourceException
     {
  -	String suffix = getResourceSuffix(locale); 
  -	//System.out.println("resource " + className + suffix);
  +
  +    String suffix = getResourceSuffix(locale);
  +
  +    //System.out.println("resource " + className + suffix);
       try
  -    {		
  -                                                           // first try with the given locale
  -      return (XSLTResourceBundle)ResourceBundle.getBundle (className + suffix, locale);
  +    {
  +
  +      // first try with the given locale
  +      return (XSLTResourceBundle) ResourceBundle.getBundle(className
  +              + suffix, locale);
       }
       catch (MissingResourceException e)
       {
  -      try                                                  // try to fall back to en_US if we can't load
  +      try  // try to fall back to en_US if we can't load
         {
  -                                                           // Since we can't find the localized property file,
  -                                                           // fall back to en_US.
  -        return (XSLTResourceBundle)ResourceBundle.getBundle (Constants.XSLT_RESOURCE, new Locale ("en", "US"));
  +
  +        // Since we can't find the localized property file,
  +        // fall back to en_US.
  +        return (XSLTResourceBundle) ResourceBundle.getBundle(
  +          Constants.XSLT_RESOURCE, new Locale("en", "US"));
         }
         catch (MissingResourceException e2)
         {
  -                                                              // Now we are really in trouble.
  -                                                              // very bad, definitely very bad...not going to get very far
  -        throw new MissingResourceException ("Could not load any resource bundles.", className, "");
  +
  +        // Now we are really in trouble.
  +        // very bad, definitely very bad...not going to get very far
  +        throw new MissingResourceException(
  +          "Could not load any resource bundles.", className, "");
         }
       }
     }
  -  
  +
     /**
      * Return the resource file suffic for the indicated locale
      * For most locales, this will be based the language code.  However
  @@ -106,43 +124,52 @@
      *
      * @param locale the locale
      * @return an String suffix which canbe appended to a resource name
  -   */        
  +   */
     private static final String getResourceSuffix(Locale locale)
     {
  -        String lang = locale.getLanguage();        
  -        String country = locale.getCountry();
  -		String variant = locale.getVariant();
  -        
  -		String suffix = "_" + locale.getLanguage();
  -        if (lang.equals("zh"))
  -            suffix += "_" + country;
  -		if (country.equals("JP"))
  -            suffix += "_" + country + "_" + variant;
  -
  -        return suffix;
  -  }		
  -	
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
  -
  -static final Object[][] contents = {
   
  -{"ui_language","en"},
  -{"help_language", "en"},
  -{"language", "en"},
  -   
  -{"alphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  +    String lang = locale.getLanguage();
  +    String country = locale.getCountry();
  +    String variant = locale.getVariant();
  +    String suffix = "_" + locale.getLanguage();
   
  -//language orientation
  -{"orientation", "LeftToRight"},
  +    if (lang.equals("zh"))
  +      suffix += "_" + country;
   
  -//language numbering   
  -{"numbering", "additive"},
  +    if (country.equals("JP"))
  +      suffix += "_" + country + "_" + variant;
   
  -};
  +    return suffix;
  +  }
   
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
   
  -}  
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" },
  +    { "alphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "additive" },
  +  };
  +}
  
  
  
  1.2       +68 -44    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_cy.java
  
  Index: XSLTResources_cy.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_cy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_cy.java	2000/06/19 16:52:24	1.1
  +++ XSLTResources_cy.java	2000/10/30 18:56:39	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,51 +55,75 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_cy extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_cy <needs-comment/>
  + */
  +public class XSLTResources_cy extends XSLTResourceBundle
  +{
   
  -{"ui_language","cy"},
  -{"help_language", "cy"},
  -{"language", "cy"},
  -
  - 
  -{"alphabet", new char[]{0x0430,0x0432,0x0433,0x0434,0x0435,0x0437,0x0438,0x0439,0x04A9,0x0457,0x043A,0x043B,0x043C,0x043D,0x046F,0x043E,0x043F,0x0447,0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0470,0x0460,0x0446}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "LeftToRight"},
  -
  -//language numbering 
  -//{"numbering", "additive"},
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "precedes"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer(10000000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{100, 10, 1}},
  -//These only used for mutiplicative-additive numbering
  -{"multiplier", new int[] {1000}},
  -{"multiplierChar", new char[] {0x03D9}},
  -// chinese only??
  -{"zero", new char[0]},
  -//{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  -{"digits", new char[]{0x0430,0x0432,0x0433,0x0434,0x0435,0x0437,0x0438,0x0439,0x04A9}},
  -{"tens", new char[]{0x0457,0x043A,0x043B,0x043C,0x043D,0x046F,0x043E,0x043F,0x0447}},  
  -{"hundreds", new char[]{0x0440,0x0441,0x0442,0x0443,0x0444,0x0445,0x0470,0x0460,0x0446}},
  -
  -
  -{"tables", new String[]{"hundreds", "tens", "digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "cy" }, { "help_language", "cy" }, { "language", "cy" },
  +    { "alphabet",
  +      new char[]{ 0x0430, 0x0432, 0x0433, 0x0434, 0x0435, 0x0437, 0x0438,
  +                  0x0439, 0x04A9, 0x0457, 0x043A, 0x043B, 0x043C, 0x043D,
  +                  0x046F, 0x043E, 0x043F, 0x0447, 0x0440, 0x0441, 0x0442,
  +                  0x0443, 0x0444, 0x0445, 0x0470, 0x0460, 0x0446 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering 
  +    //{"numbering", "additive"},
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "precedes" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer(10000000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 100, 10, 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    { "multiplier", new int[]{ 1000 } },
  +    { "multiplierChar", new char[]{ 0x03D9 } },
  +
  +    // chinese only??
  +    { "zero", new char[0] },
  +
  +    //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  +    { "digits",
  +      new char[]{ 0x0430, 0x0432, 0x0433, 0x0434, 0x0435, 0x0437, 0x0438,
  +                  0x0439, 0x04A9 } },
  +    { "tens",
  +      new char[]{ 0x0457, 0x043A, 0x043B, 0x043C, 0x043D, 0x046F, 0x043E,
  +                  0x043F, 0x0447 } },
  +    { "hundreds",
  +      new char[]{ 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0470,
  +                  0x0460, 0x0446 } },
  +    { "tables", new String[]{ "hundreds", "tens", "digits" } }
  +  };
  +}
  
  
  
  1.2       +71 -45    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_el.java
  
  Index: XSLTResources_el.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_el.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_el.java	2000/06/19 16:52:24	1.1
  +++ XSLTResources_el.java	2000/10/30 18:56:39	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,52 +55,78 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_el extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_el <needs-comment/>
  + */
  +public class XSLTResources_el extends XSLTResourceBundle
  +{
   
  -{"ui_language","el"},
  -{"help_language", "el"},
  -{"language", "el"},
  -
  - 
  -{"alphabet", new char[]{0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,0x03b6,0x03b7,0x03b8,0x03b9,0x03ba,0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03c1,0x03c2,0x03c3,0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "LeftToRight"},
  -
  -//language numbering 
  -//{"numbering", "additive"},
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "precedes"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer()},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{100, 10, 1}},
  -//These only used for mutiplicative-additive numbering
  -{"multiplier", new int[]{1000}},
  -{"multiplierChar", new char[]{0x03d9}},
  -// chinese only??
  -{"zero", new char[0]},
  -//{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  -{"digits", new char[]{0x03b1,0x03b2,0x03b3,0x03b4,0x03b5,0x03db, 0x03b6,0x03b7,0x03b8}},
  -{"tens", new char[]{0x03b9,0x03ba,0x03bb,0x03bc,0x03bd,0x03be,0x03bf,0x03c0,0x03df}},  
  -{"hundreds", new char[]{0x03c1,0x03c2,0x03c4,0x03c5,0x03c6,0x03c7,0x03c8,0x03c9,0x03e1}},
  -//{"thousands", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}},  
  -
  -//hundreds, etc...
  -{"tables", new String[]{"hundreds", "tens", "digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "el" }, { "help_language", "el" }, { "language", "el" },
  +    { "alphabet",
  +      new char[]{ 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7,
  +                  0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be,
  +                  0x03bf, 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5,
  +                  0x03c6, 0x03c7, 0x03c8, 0x03c9 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering 
  +    //{"numbering", "additive"},
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "precedes" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer()},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 100, 10, 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    { "multiplier", new int[]{ 1000 } },
  +    { "multiplierChar", new char[]{ 0x03d9 } },
  +
  +    // chinese only??
  +    { "zero", new char[0] },
  +
  +    //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  +    { "digits",
  +      new char[]{ 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03db, 0x03b6,
  +                  0x03b7, 0x03b8 } },
  +    { "tens",
  +      new char[]{ 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf,
  +                  0x03c0, 0x03df } },
  +    { "hundreds",
  +      new char[]{ 0x03c1, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8,
  +                  0x03c9, 0x03e1 } },
  +
  +    //{"thousands", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}},  
  +    //hundreds, etc...
  +    { "tables", new String[]{ "hundreds", "tens", "digits" } }
  +  };
  +}
  
  
  
  1.2       +54 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_en.java
  
  Index: XSLTResources_en.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_en.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_en.java	2000/06/19 16:52:24	1.1
  +++ XSLTResources_en.java	2000/10/30 18:56:39	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,61 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_en extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_en <needs-comment/>
  + */
  +public class XSLTResources_en extends XSLTResourceBundle
  +{
   
  -{"ui_language","en"},
  -{"help_language", "en"},
  -{"language", "en"},
  -
  - 
  -{"alphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "additive"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer()},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -//{"numberGroups", new int[]{10,1}},
  -//These only used for mutiplicative-additive numbering
  -//{"multiplier", "10"},
  -//{"multiplierChar", "M"}, 
  -//{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  -//{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}},
  -//{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}},  
  -//hundreds, etc...
  -//{"tables", new String[]{"tens", "digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" },
  +    { "alphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "additive" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer()},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    //{"numberGroups", new int[]{10,1}},
  +    //These only used for mutiplicative-additive numbering
  +    //{"multiplier", "10"},
  +    //{"multiplierChar", "M"}, 
  +    //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  +    //{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10D7,0x10D8}},
  +    //{"tens", new char[]{0x10D9,0x10DA,0x10DB,0x10DC,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1}},  
  +    //hundreds, etc...
  +    //{"tables", new String[]{"tens", "digits"}}
  +  };
  +}
  
  
  
  1.2       +60 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_he.java
  
  Index: XSLTResources_he.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_he.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_he.java	2000/06/19 16:52:24	1.1
  +++ XSLTResources_he.java	2000/10/30 18:56:40	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,67 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_he extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_he <needs-comment/>
  + */
  +public class XSLTResources_he extends XSLTResourceBundle
  +{
   
  -{"ui_language","he"},
  -{"help_language", "he"},
  -{"language", "he"},
  -
  - 
  -{"alphabet", new char[]{0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,0x05D8,0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,0x05E0,0x05E1}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "RightToLeft"},
  -
  -//language numbering   
  -{"numbering", "additive"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer()},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{10,1}},
  -//These only used for mutiplicative-additive numbering
  -//{"multiplier", "10"},
  -//{"multiplierChar", "M"}, 
  -//{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  -{"digits", new char[]{0x05D0,0x05D1,0x05D2,0x05D3,0x05D4,0x05D5,0x05D6,0x05D7,0x05D8}},
  -{"tens", new char[]{0x05D9,0x05DA,0x05DB,0x05DC,0x05DD,0x05DE,0x05DF,0x05E0,0x05E1}},  
  -//hundreds, etc...
  -{"tables", new String[]{"tens", "digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "he" }, { "help_language", "he" }, { "language", "he" },
  +    { "alphabet",
  +      new char[]{ 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6,
  +                  0x05D7, 0x05D8, 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD,
  +                  0x05DE, 0x05DF, 0x05E0, 0x05E1 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "RightToLeft" },
  +
  +    //language numbering   
  +    { "numbering", "additive" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer()},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 10, 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    //{"multiplier", "10"},
  +    //{"multiplierChar", "M"}, 
  +    //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  +    { "digits",
  +      new char[]{ 0x05D0, 0x05D1, 0x05D2, 0x05D3, 0x05D4, 0x05D5, 0x05D6,
  +                  0x05D7, 0x05D8 } },
  +    { "tens",
  +      new char[]{ 0x05D9, 0x05DA, 0x05DB, 0x05DC, 0x05DD, 0x05DE, 0x05DF,
  +                  0x05E0, 0x05E1 } },
  +
  +    //hundreds, etc...
  +    { "tables", new String[]{ "tens", "digits" } }
  +  };
  +}
  
  
  
  1.2       +67 -40    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_hy.java
  
  Index: XSLTResources_hy.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_hy.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_hy.java	2000/06/19 16:52:24	1.1
  +++ XSLTResources_hy.java	2000/10/30 18:56:40	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,47 +55,74 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_hy extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_hy <needs-comment/>
  + */
  +public class XSLTResources_hy extends XSLTResourceBundle
  +{
   
  -{"ui_language","hy"},
  -{"help_language", "hy"},
  -{"language", "hy"},
  -
  - 
  -{"alphabet", new char[]{0x0561,0x0562,0x0563,0x0564,0x0565,0x0566,0x0567,0x0568,0x0569,0x056A,0x056B,0x056C,0x056D,0x056E,0x056F,0x0567,0x0568,0x0572,0x0573,0x0574,0x0575,0x0576,0x0577,0x0578,0x0579,0x057A,0x057B,0x057C,0x057D,0x057E,0x057F,0x0580,0x0581,0x0582,0x0583,0x0584}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "additive"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer()},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1000,100,10,1}},
  -//These only used for mutiplicative-additive numbering
  -//{"multiplier", "10"},
  -//{"multiplierChar", "M"}, 
  -//{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  -{"digits", new char[]{0x0561,0x0562,0x0563,0x0564,0x0565,0x0566,0x0567,0x0568,0x0569}},
  -{"tens", new char[]{0x056A,0x056B,0x056C,0x056D,0x056E,0x056F,0x0567,0x0568,0x0572}},  
  -{"hundreds", new char[]{0x0573,0x0574,0x0575,0x0576,0x0577,0x0578,0x0579,0x057A,0x057B}},
  -{"thousands", new char[]{0x057C,0x057D,0x057E,0x057F,0x0580,0x0581,0x0582,0x0583,0x0584}},
  -
  -{"tables", new String[]{"thousands","hundreds","tens", "digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "hy" }, { "help_language", "hy" }, { "language", "hy" },
  +    { "alphabet",
  +      new char[]{ 0x0561, 0x0562, 0x0563, 0x0564, 0x0565, 0x0566, 0x0567,
  +                  0x0568, 0x0569, 0x056A, 0x056B, 0x056C, 0x056D, 0x056E,
  +                  0x056F, 0x0567, 0x0568, 0x0572, 0x0573, 0x0574, 0x0575,
  +                  0x0576, 0x0577, 0x0578, 0x0579, 0x057A, 0x057B, 0x057C,
  +                  0x057D, 0x057E, 0x057F, 0x0580, 0x0581, 0x0582, 0x0583,
  +                  0x0584 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "additive" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer()},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1000, 100, 10, 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    //{"multiplier", "10"},
  +    //{"multiplierChar", "M"}, 
  +    //{"digits", new char[]{'a','b','c','d','e','f','g','h','i'}},
  +    { "digits",
  +      new char[]{ 0x0561, 0x0562, 0x0563, 0x0564, 0x0565, 0x0566, 0x0567,
  +                  0x0568, 0x0569 } },
  +    { "tens",
  +      new char[]{ 0x056A, 0x056B, 0x056C, 0x056D, 0x056E, 0x056F, 0x0567,
  +                  0x0568, 0x0572 } },
  +    { "hundreds",
  +      new char[]{ 0x0573, 0x0574, 0x0575, 0x0576, 0x0577, 0x0578, 0x0579,
  +                  0x057A, 0x057B } },
  +    { "thousands",
  +      new char[]{ 0x057C, 0x057D, 0x057E, 0x057F, 0x0580, 0x0581, 0x0582,
  +                  0x0583, 0x0584 } },
  +    { "tables", new String[]{ "thousands", "hundreds", "tens", "digits" } }
  +  };
  +}
  
  
  
  1.2       +63 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_A.java
  
  Index: XSLTResources_ja_JP_A.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_A.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_ja_JP_A.java	2000/06/19 16:52:24	1.1
  +++ XSLTResources_ja_JP_A.java	2000/10/30 18:56:40	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,70 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_ja_JP_A extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_ja_JP_A <needs-comment/>
  + */
  +public class XSLTResources_ja_JP_A extends XSLTResourceBundle
  +{
   
  -{"ui_language","ja"},
  -{"help_language", "ja"},
  -{"language", "ja"},
  -
  -
  -{"alphabet", new char[]{0x30a2,0x30a4,0x30a6,0x30a8,0x30aa,0x30ab,0x30ad,0x30af,0x30b1,0x30b3,0x30b5,0x30b7,0x30b9,0x30bb,0x30bd,0x30bf,0x30c1,0x30c4,0x30c6,0x30c8,0x30ca,0x30cb,0x30cc,0x30cd,0x30ce,0x30cf,0x30d2,0x30d5,0x30d8,0x30db,0x30de,0x30df,0x30e0,0x30e1,0x30e2,0x30e4,0x30e6,0x30e8,0x30e9,0x30ea,0x30eb,0x30ec,0x30ed,0x30ef,0x30f0,0x30f1,0x30f2,0x30f3}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation 
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "follows"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer(10000000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1}},
  -//These only used for mutiplicative-additive numbering
  -{"multiplier", new int [] {1000000000,100000000,10000,1000,100,10}},
  -{"multiplierChar", new char[]{0x4EAC,0x5146,0x5104,0x4E07,0x5343,0x767e,0x5341}}, 
  -// chinese only? 
  -{"zero", new char[0]},
  -{"digits", new char[]{0x4E00,0x4E8C,0x4E09,0x56DB,0x4E94,0x516D,0x4E03,0x516B,0x4E5D}},
  -{"tables", new String[]{"digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" },
  +    { "alphabet",
  +      new char[]{ 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad,
  +                  0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb,
  +                  0x30bd, 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca,
  +                  0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5,
  +                  0x30d8, 0x30db, 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2,
  +                  0x30e4, 0x30e6, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec,
  +                  0x30ed, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation 
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "follows" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer(10000000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    { "multiplier",
  +      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplierChar",
  +      new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
  +
  +    // chinese only? 
  +    { "zero", new char[0] },
  +    { "digits",
  +      new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03,
  +                  0x516B, 0x4E5D } }, { "tables", new String[]{ "digits" } }
  +  };
  +}
  
  
  
  1.2       +63 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_HA.java
  
  Index: XSLTResources_ja_JP_HA.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_HA.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_ja_JP_HA.java	2000/06/19 16:52:24	1.1
  +++ XSLTResources_ja_JP_HA.java	2000/10/30 18:56:41	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,70 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_ja_JP_HA extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_ja_JP_HA <needs-comment/>
  + */
  +public class XSLTResources_ja_JP_HA extends XSLTResourceBundle
  +{
   
  -{"ui_language","ja"},
  -{"help_language", "ja"},
  -{"language", "ja"},
  -
  -
  -{"alphabet", new char[]{0x3042,0x3044,0x3046,0x3048,0x304a,0x304b,0x304d,0x304f,0x3051,0x3053,0x3055,0x3057,0x3059,0x305b,0x305d,0x305f,0x3061,0x3064,0x3066,0x3068,0x306a,0x306b,0x306c,0x306d,0x306e,0x306f,0x3072,0x3075,0x3078,0x307b,0x307e,0x307f,0x3080,0x3081,0x3082,0x3084,0x3086,0x3088,0x3089,0x308a,0x308b,0x308c,0x308d,0x308f,0x3090,0x3091,0x3092,0x3093}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation 
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "follows"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer(10000000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1}},
  -//These only used for mutiplicative-additive numbering
  -{"multiplier", new int [] {1000000000,100000000,10000,1000,100,10}},
  -{"multiplierChar", new char[]{0x4EAC,0x5146,0x5104,0x4E07,0x5343,0x767e,0x5341}}, 
  -// chinese only? 
  -{"zero", new char[0]},
  -{"digits", new char[]{0x4E00,0x4E8C,0x4E09,0x56DB,0x4E94,0x516D,0x4E03,0x516B,0x4E5D}},
  -{"tables", new String[]{"digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" },
  +    { "alphabet",
  +      new char[]{ 0x3042, 0x3044, 0x3046, 0x3048, 0x304a, 0x304b, 0x304d,
  +                  0x304f, 0x3051, 0x3053, 0x3055, 0x3057, 0x3059, 0x305b,
  +                  0x305d, 0x305f, 0x3061, 0x3064, 0x3066, 0x3068, 0x306a,
  +                  0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3072, 0x3075,
  +                  0x3078, 0x307b, 0x307e, 0x307f, 0x3080, 0x3081, 0x3082,
  +                  0x3084, 0x3086, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c,
  +                  0x308d, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation 
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "follows" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer(10000000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    { "multiplier",
  +      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplierChar",
  +      new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
  +
  +    // chinese only? 
  +    { "zero", new char[0] },
  +    { "digits",
  +      new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03,
  +                  0x516B, 0x4E5D } }, { "tables", new String[]{ "digits" } }
  +  };
  +}
  
  
  
  1.2       +63 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_HI.java
  
  Index: XSLTResources_ja_JP_HI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_HI.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_ja_JP_HI.java	2000/06/19 16:52:25	1.1
  +++ XSLTResources_ja_JP_HI.java	2000/10/30 18:56:41	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,70 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_ja_JP_HI extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_ja_JP_HI <needs-comment/>
  + */
  +public class XSLTResources_ja_JP_HI extends XSLTResourceBundle
  +{
   
  -{"ui_language","ja"},
  -{"help_language", "ja"},
  -{"language", "ja"},
  -
  - 
  -{"alphabet", new char[]{0x3044,0x308d,0x306f,0x306b,0x307b,0x3078,0x3068,0x3061,0x308a,0x306c,0x308b,0x3092,0x308f,0x304b,0x3088,0x305f,0x308c,0x305d,0x3064,0x306d,0x306a,0x3089,0x3080,0x3046,0x3090,0x306e,0x304a,0x304f,0x3084,0x307e,0x3051,0x3075,0x3053,0x3048,0x3066,0x3042,0x3055,0x304d,0x3086,0x3081,0x307f,0x3057,0x3091,0x3072,0x3082,0x305b,0x3059}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "follows"},
  -
  -// largest numerical value 
  -//{"MaxNumericalValue", new Integer(10000000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1}},
  -//These only used for mutiplicative-additive numbering
  -{"multiplier", new int [] {1000000000,100000000,10000,1000,100,10}},
  -{"multiplierChar", new char[]{0x4EAC,0x5146,0x5104,0x4E07,0x5343,0x767e,0x5341}}, 
  -// chinese only??
  -{"zero", new char[0]},
  -{"digits", new char[]{0x4E00,0x4E8C,0x4E09,0x56DB,0x4E94,0x516D,0x4E03,0x516B,0x4E5D}},
  -{"tables", new String[]{"digits"}}
  -};    
  -}
  \ No newline at end of file
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" },
  +    { "alphabet",
  +      new char[]{ 0x3044, 0x308d, 0x306f, 0x306b, 0x307b, 0x3078, 0x3068,
  +                  0x3061, 0x308a, 0x306c, 0x308b, 0x3092, 0x308f, 0x304b,
  +                  0x3088, 0x305f, 0x308c, 0x305d, 0x3064, 0x306d, 0x306a,
  +                  0x3089, 0x3080, 0x3046, 0x3090, 0x306e, 0x304a, 0x304f,
  +                  0x3084, 0x307e, 0x3051, 0x3075, 0x3053, 0x3048, 0x3066,
  +                  0x3042, 0x3055, 0x304d, 0x3086, 0x3081, 0x307f, 0x3057,
  +                  0x3091, 0x3072, 0x3082, 0x305b, 0x3059 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "follows" },
  +
  +    // largest numerical value 
  +    //{"MaxNumericalValue", new Integer(10000000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    { "multiplier",
  +      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplierChar",
  +      new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
  +
  +    // chinese only??
  +    { "zero", new char[0] },
  +    { "digits",
  +      new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03,
  +                  0x516B, 0x4E5D } }, { "tables", new String[]{ "digits" } }
  +  };
  +}
  
  
  
  1.2       +63 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_I.java
  
  Index: XSLTResources_ja_JP_I.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ja_JP_I.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_ja_JP_I.java	2000/06/19 16:52:25	1.1
  +++ XSLTResources_ja_JP_I.java	2000/10/30 18:56:41	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,70 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_ja_JP_I extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_ja_JP_I <needs-comment/>
  + */
  +public class XSLTResources_ja_JP_I extends XSLTResourceBundle
  +{
   
  -{"ui_language","ja"},
  -{"help_language", "ja"},
  -{"language", "ja"},
  -
  - 
  -{"alphabet", new char[]{0x30a4,0x30ed,0x30cf,0x30cb,0x30db,0x30d8,0x30c8,0x30c1,0x30ea,0x30cc,0x30eb,0x30f2,0x30ef,0x30ab,0x30e8,0x30bf,0x30ec,0x30bd,0x30c4,0x30cd,0x30ca,0x30e9,0x30e0,0x30a6,0x30f0,0x30ce,0x30aa,0x30af,0x30e4,0x30de,0x30b1,0x30d5,0x30b3,0x30a8,0x30c6,0x30a2,0x30b5,0x30ad,0x30e6,0x30e1,0x30df,0x30b7,0x30f1,0x30d2,0x30e2,0x30bb,0x30b9}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "follows"},
  -
  -// largest numerical value 
  -//{"MaxNumericalValue", new Integer(10000000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1}},
  -//These only used for mutiplicative-additive numbering
  -{"multiplier", new int [] {1000000000,100000000,10000,1000,100,10}},
  -{"multiplierChar", new char[]{0x4EAC,0x5146,0x5104,0x4E07,0x5343,0x767e,0x5341}}, 
  -// chinese only??
  -{"zero", new char[0]},
  -{"digits", new char[]{0x4E00,0x4E8C,0x4E09,0x56DB,0x4E94,0x516D,0x4E03,0x516B,0x4E5D}},
  -{"tables", new String[]{"digits"}}
  -};    
  -}
  \ No newline at end of file
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "ja" }, { "help_language", "ja" }, { "language", "ja" },
  +    { "alphabet",
  +      new char[]{ 0x30a4, 0x30ed, 0x30cf, 0x30cb, 0x30db, 0x30d8, 0x30c8,
  +                  0x30c1, 0x30ea, 0x30cc, 0x30eb, 0x30f2, 0x30ef, 0x30ab,
  +                  0x30e8, 0x30bf, 0x30ec, 0x30bd, 0x30c4, 0x30cd, 0x30ca,
  +                  0x30e9, 0x30e0, 0x30a6, 0x30f0, 0x30ce, 0x30aa, 0x30af,
  +                  0x30e4, 0x30de, 0x30b1, 0x30d5, 0x30b3, 0x30a8, 0x30c6,
  +                  0x30a2, 0x30b5, 0x30ad, 0x30e6, 0x30e1, 0x30df, 0x30b7,
  +                  0x30f1, 0x30d2, 0x30e2, 0x30bb, 0x30b9 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "follows" },
  +
  +    // largest numerical value 
  +    //{"MaxNumericalValue", new Integer(10000000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    { "multiplier",
  +      new int[]{ 1000000000, 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplierChar",
  +      new char[]{ 0x4EAC, 0x5146, 0x5104, 0x4E07, 0x5343, 0x767e, 0x5341 } },
  +
  +    // chinese only??
  +    { "zero", new char[0] },
  +    { "digits",
  +      new char[]{ 0x4E00, 0x4E8C, 0x4E09, 0x56DB, 0x4E94, 0x516D, 0x4E03,
  +                  0x516B, 0x4E5D } }, { "tables", new String[]{ "digits" } }
  +  };
  +}
  
  
  
  1.2       +64 -37    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ka.java
  
  Index: XSLTResources_ka.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_ka.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_ka.java	2000/06/19 16:52:25	1.1
  +++ XSLTResources_ka.java	2000/10/30 18:56:42	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,44 +55,71 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_ka extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_ka <needs-comment/>
  + */
  +public class XSLTResources_ka extends XSLTResourceBundle
  +{
   
  -{"ui_language","ka"},
  -{"help_language", "ka"},
  -{"language", "ka"},
  -
  - 
  -{"alphabet", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10f1,0x10D7,0x10D8,0x10D9,0x10DA,0x10DB,0x10DC,0x10f2,0x10DD,0x10DE,0x10DF,0x10E0,0x10E1,0x10E2,0x10E3,0x10E4,0x10E5,0x10E6,0x10E7,0x10E8,0x10E9,0x10EA,0x10EB,0x10EC,0x10ED,0x10EE,0x10F4,0x10EF,0x10F0}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "additive"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer(10000000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1000,100,10,1}},
  -//These used for additive numbering
  -{"digits", new char[]{0x10D0,0x10D1,0x10D2,0x10D3,0x10D4,0x10D5,0x10D6,0x10f1,0x10D7}},
  -{"tens", new char[]{0x10D8,0x10D9,0x10DA,0x10DB,0x10DC,0x10f2,0x10DD,0x10DE,0x10DF}},  
  -{"hundreds", new char[]{0x10E0,0x10E1,0x10E2,0x10E3,0x10E4,0x10E5,0x10E6,0x10E7,0x10E8}},
  -{"thousands", new char[]{0x10E9,0x10EA,0x10EB,0x10EC,0x10ED,0x10EE,0x10F4,0x10EF,0x10F0}},
  -
  -{"tables", new String[]{"thousands","hundreds","tens", "digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "ka" }, { "help_language", "ka" }, { "language", "ka" },
  +    { "alphabet",
  +      new char[]{ 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6,
  +                  0x10f1, 0x10D7, 0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC,
  +                  0x10f2, 0x10DD, 0x10DE, 0x10DF, 0x10E0, 0x10E1, 0x10E2,
  +                  0x10E3, 0x10E4, 0x10E5, 0x10E6, 0x10E7, 0x10E8, 0x10E9,
  +                  0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10F4, 0x10EF,
  +                  0x10F0 } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "additive" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer(10000000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1000, 100, 10, 1 } },
  +
  +    //These used for additive numbering
  +    { "digits",
  +      new char[]{ 0x10D0, 0x10D1, 0x10D2, 0x10D3, 0x10D4, 0x10D5, 0x10D6,
  +                  0x10f1, 0x10D7 } },
  +    { "tens",
  +      new char[]{ 0x10D8, 0x10D9, 0x10DA, 0x10DB, 0x10DC, 0x10f2, 0x10DD,
  +                  0x10DE, 0x10DF } },
  +    { "hundreds",
  +      new char[]{ 0x10E0, 0x10E1, 0x10E2, 0x10E3, 0x10E4, 0x10E5, 0x10E6,
  +                  0x10E7, 0x10E8 } },
  +    { "thousands",
  +      new char[]{ 0x10E9, 0x10EA, 0x10EB, 0x10EC, 0x10ED, 0x10EE, 0x10F4,
  +                  0x10EF, 0x10F0 } },
  +    { "tables", new String[]{ "thousands", "hundreds", "tens", "digits" } }
  +  };
  +}
  
  
  
  1.2       +59 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_zh_CN.java
  
  Index: XSLTResources_zh_CN.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_zh_CN.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_zh_CN.java	2000/06/19 16:52:25	1.1
  +++ XSLTResources_zh_CN.java	2000/10/30 18:56:42	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,66 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_zh_CN extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_zh_CN <needs-comment/>
  + */
  +public class XSLTResources_zh_CN extends XSLTResourceBundle
  +{
   
  -{"ui_language","zh"},
  -{"help_language", "zh"},
  -{"language", "zh"},
  -
  - 
  -{"alphabet", new char[]{0xff21,0xff22,0xff23,0xff24,0xff25,0xff26,0xff27,0xff28,0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e,0xff2f,0xff30,0xff31,0xff32,0xff33,0xff34,0xff35,0xff36,0xff37,0xff38,0xff39,0xff3a}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation 
  -{"orientation", "LeftToRight"},
  -
  -//language numbering   
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "follows"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer(100000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1}},
  -// simplified chinese  
  -{"zero", new char[]{0x96f6}}, 
  -//These only used for mutiplicative-additive numbering
  -{"multiplier", new int [] {100000000,10000,1000,100,10}},
  -{"multiplierChar", new char[]{0x4ebf,0x4e07,0x5343,0x767e,0x5341}}, 
  -{"digits", new char[]{0x4e00,0x4e8c,0x4e09,0x56db,0x4e94,0x516d,0x4e03,0x516b,0x4e5d}},
  -{"tables", new String[]{"digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "zh" }, { "help_language", "zh" }, { "language", "zh" },
  +    { "alphabet",
  +      new char[]{ 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27,
  +                  0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e,
  +                  0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35,
  +                  0xff36, 0xff37, 0xff38, 0xff39, 0xff3a } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation 
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering   
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "follows" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer(100000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1 } },
  +
  +    // simplified chinese  
  +    { "zero", new char[]{ 0x96f6 } },
  +
  +    //These only used for mutiplicative-additive numbering
  +    { "multiplier", new int[]{ 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplierChar",
  +      new char[]{ 0x4ebf, 0x4e07, 0x5343, 0x767e, 0x5341 } },
  +    { "digits",
  +      new char[]{ 0x4e00, 0x4e8c, 0x4e09, 0x56db, 0x4e94, 0x516d, 0x4e03,
  +                  0x516b, 0x4e5d } }, { "tables", new String[]{ "digits" } }
  +  };
  +}
  
  
  
  1.2       +59 -38    xml-xalan/java/src/org/apache/xalan/res/XSLTResources_zh_TW.java
  
  Index: XSLTResources_zh_TW.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/res/XSLTResources_zh_TW.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLTResources_zh_TW.java	2000/06/19 16:52:25	1.1
  +++ XSLTResources_zh_TW.java	2000/10/30 18:56:42	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,45 +55,66 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.res;
  +
   import java.util.*;
  +
   //
   //  LangResources_en.properties
   //
  -public class XSLTResources_zh_TW extends XSLTResourceBundle 
  -{
  -public Object[][] getContents()
  -{
  -	return contents;
  -}	
   
  -static final Object[][] contents = {
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLTResources_zh_TW <needs-comment/>
  + */
  +public class XSLTResources_zh_TW extends XSLTResourceBundle
  +{
   
  -{"ui_language","zh"},
  -{"help_language", "zh"},
  -{"language", "zh"},
  -
  -{"alphabet", new char[]{0xff21,0xff22,0xff23,0xff24,0xff25,0xff26,0xff27,0xff28,0xff29,0xff2a,0xff2b,0xff2c,0xff2d,0xff2e,0xff2f,0xff30,0xff31,0xff32,0xff33,0xff34,0xff35,0xff36,0xff37,0xff38,0xff39,0xff3a}},
  -{"tradAlphabet", new char[]{'A','B','C','D','E','F','G','H','I','J','K','L','M','N','O','P','Q','R','S','T','U','V','W','X','Y','Z'}},
  -
  -//language orientation 
  -{"orientation", "LeftToRight"},
  -
  -//language numbering    
  -{"numbering", "multiplicative-additive"},
  -{"multiplierOrder", "follows"},
  -
  -// largest numerical value
  -//{"MaxNumericalValue", new Integer(100000000)},
  -
  -//These would not be used for EN. Only used for traditional numbering   
  -{"numberGroups", new int[]{1}},
  -// simplified chinese 
  -{"zero", new char[]{0x96f6}},
  -
  -//These only used for mutiplicative-additive numbering 
  -{"multiplier", new int [] {100000000,10000,1000,100,10}},
  -{"multiplierChar", new char[]{0x5104,0x842c,0x4edf,0x4f70,0x62fe}}, 
  -{"digits", new char[]{0x58f9,0x8cb3,0x53c3,0x8086,0x4f0d,0x9678,0x67d2,0x634c,0x7396}},
  -{"tables", new String[]{"digits"}}
  -};    
  -}  
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
  +  public Object[][] getContents()
  +  {
  +    return contents;
  +  }
  +
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +  {
  +    { "ui_language", "zh" }, { "help_language", "zh" }, { "language", "zh" },
  +    { "alphabet",
  +      new char[]{ 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27,
  +                  0xff28, 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e,
  +                  0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, 0xff34, 0xff35,
  +                  0xff36, 0xff37, 0xff38, 0xff39, 0xff3a } },
  +    { "tradAlphabet",
  +      new char[]{ 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
  +                  'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
  +                  'Y', 'Z' } },
  +
  +    //language orientation 
  +    { "orientation", "LeftToRight" },
  +
  +    //language numbering    
  +    { "numbering", "multiplicative-additive" },
  +    { "multiplierOrder", "follows" },
  +
  +    // largest numerical value
  +    //{"MaxNumericalValue", new Integer(100000000)},
  +    //These would not be used for EN. Only used for traditional numbering   
  +    { "numberGroups", new int[]{ 1 } },
  +
  +    // simplified chinese 
  +    { "zero", new char[]{ 0x96f6 } },
  +
  +    //These only used for mutiplicative-additive numbering 
  +    { "multiplier", new int[]{ 100000000, 10000, 1000, 100, 10 } },
  +    { "multiplierChar",
  +      new char[]{ 0x5104, 0x842c, 0x4edf, 0x4f70, 0x62fe } },
  +    { "digits",
  +      new char[]{ 0x58f9, 0x8cb3, 0x53c3, 0x8086, 0x4f0d, 0x9678, 0x67d2,
  +                  0x634c, 0x7396 } }, { "tables", new String[]{ "digits" } }
  +  };
  +}
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/serialize/ElemDesc.java
  
  Index: ElemDesc.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xalan" 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, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.serialize;
  
  import java.util.Hashtable;
  
  /**
   * <meta name="usage" content="internal"/>
   * This class is in support of FormatterToHTML, and acts as a sort
   * of element representative for HTML elements.
   */
  class ElemDesc
  {
  
    /** NEEDSDOC Field m_flags          */
    int m_flags;
  
    /** NEEDSDOC Field m_attrs          */
    Hashtable m_attrs = null;
  
    /** NEEDSDOC Field EMPTY          */
    static final int EMPTY = (1 << 1);
  
    /** NEEDSDOC Field FLOW          */
    static final int FLOW = (1 << 2);
  
    /** NEEDSDOC Field BLOCK          */
    static final int BLOCK = (1 << 3);
  
    /** NEEDSDOC Field BLOCKFORM          */
    static final int BLOCKFORM = (1 << 4);
  
    /** NEEDSDOC Field BLOCKFORMFIELDSET          */
    static final int BLOCKFORMFIELDSET = (1 << 5);
  
    /** NEEDSDOC Field CDATA          */
    static final int CDATA = (1 << 6);
  
    /** NEEDSDOC Field PCDATA          */
    static final int PCDATA = (1 << 7);
  
    /** NEEDSDOC Field RAW          */
    static final int RAW = (1 << 8);
  
    /** NEEDSDOC Field INLINE          */
    static final int INLINE = (1 << 9);
  
    /** NEEDSDOC Field INLINEA          */
    static final int INLINEA = (1 << 10);
  
    /** NEEDSDOC Field INLINELABEL          */
    static final int INLINELABEL = (1 << 11);
  
    /** NEEDSDOC Field FONTSTYLE          */
    static final int FONTSTYLE = (1 << 12);
  
    /** NEEDSDOC Field PHRASE          */
    static final int PHRASE = (1 << 13);
  
    /** NEEDSDOC Field FORMCTRL          */
    static final int FORMCTRL = (1 << 14);
  
    /** NEEDSDOC Field SPECIAL          */
    static final int SPECIAL = (1 << 15);
  
    /** NEEDSDOC Field ASPECIAL          */
    static final int ASPECIAL = (1 << 16);
  
    /** NEEDSDOC Field HEADMISC          */
    static final int HEADMISC = (1 << 17);
  
    /** NEEDSDOC Field HEAD          */
    static final int HEAD = (1 << 18);
  
    /** NEEDSDOC Field LIST          */
    static final int LIST = (1 << 19);
  
    /** NEEDSDOC Field PREFORMATTED          */
    static final int PREFORMATTED = (1 << 20);
  
    /** NEEDSDOC Field WHITESPACESENSITIVE          */
    static final int WHITESPACESENSITIVE = (1 << 21);
  
    /** NEEDSDOC Field HEADELEM          */
    static final int HEADELEM = (1 << 22);
  
    /** NEEDSDOC Field ATTRURL          */
    static final int ATTRURL = (1 << 1);
  
    /** NEEDSDOC Field ATTREMPTY          */
    static final int ATTREMPTY = (1 << 2);
  
    /**
     * Constructor ElemDesc
     *
     *
     * NEEDSDOC @param flags
     */
    ElemDesc(int flags)
    {
      m_flags = flags;
    }
  
    /**
     * NEEDSDOC Method is 
     *
     *
     * NEEDSDOC @param flags
     *
     * NEEDSDOC (is) @return
     */
    boolean is(int flags)
    {
  
      // int which = (m_flags & flags);
      return (m_flags & flags) != 0;
    }
  
    /**
     * NEEDSDOC Method setAttr 
     *
     *
     * NEEDSDOC @param name
     * NEEDSDOC @param flags
     */
    void setAttr(String name, int flags)
    {
  
      if (null == m_attrs)
        m_attrs = new Hashtable();
  
      m_attrs.put(name, new Integer(flags));
    }
  
    /**
     * NEEDSDOC Method isAttrFlagSet 
     *
     *
     * NEEDSDOC @param name
     * NEEDSDOC @param flags
     *
     * NEEDSDOC (isAttrFlagSet) @return
     */
    boolean isAttrFlagSet(String name, int flags)
    {
  
      if (null != m_attrs)
      {
        Integer _flags = (Integer) m_attrs.get(name);
  
        if (null != _flags)
        {
          return (_flags.intValue() & flags) != 0;
        }
      }
  
      return false;
    }
  }
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/serialize/EncodingInfo.java
  
  Index: EncodingInfo.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xalan" 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, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.serialize;
  
  /**
   * Holds information about a given encoding.
   */
  public class EncodingInfo extends Object
  {
  
    /**
     * The encoding name.
     */
    final String name;
  
    /**
     * The name used by the Java convertor.
     */
    final String javaName;
  
    /**
     * The last printable character.
     */
    final int lastPrintable;
  
    /**
     * Constructor EncodingInfo
     *
     *
     * NEEDSDOC @param name
     * NEEDSDOC @param javaName
     * NEEDSDOC @param lastPrintable
     */
    public EncodingInfo(String name, String javaName, int lastPrintable)
    {
  
      this.name = name;
      this.javaName = javaName;
      this.lastPrintable = lastPrintable;
    }
  }
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/serialize/Encodings.java
  
  Index: Encodings.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xalan" 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, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.serialize;
  
  import java.io.Writer;
  import java.io.OutputStream;
  import java.io.OutputStreamWriter;
  import java.io.UnsupportedEncodingException;
  
  /**
   * Provides information about encodings. Depends on the Java runtime
   * to provides writers for the different encodings, but can be used
   * to override encoding names and provide the last printable character
   * for each encoding.
   *
   * @version $Revision: 1.1 $ $Date: 2000/10/30 18:56:50 $
   * @author <a href="mailto:arkin@intalio.com">Assaf Arkin</a>
   */
  public class Encodings extends Object
  {
  
    /** NEEDSDOC Field m_shouldNormalizeLinebreaks          */
    public static boolean m_shouldNormalizeLinebreaks = true;
  
    /**
     * The last printable character for unknown encodings.
     */
    static final int DefaultLastPrintable = 0x7F;
  
    /**
     * Returns a writer for the specified encoding based on
     * an output stream.
     *
     * @param output The output stream
     * @param encoding The encoding
     * @return A suitable writer
     * @throws UnsupportedEncodingException There is no convertor
     *  to support this encoding
     */
    public static Writer getWriter(OutputStream output, String encoding)
            throws UnsupportedEncodingException
    {
  
      for (int i = 0; i < _encodings.length; ++i)
      {
        if (_encodings[i].name.equalsIgnoreCase(encoding))
        {
          try
          {
            return new OutputStreamWriter(output, _encodings[i].javaName);
          }
          catch (UnsupportedEncodingException usee)
          {
  
            // keep trying
          }
        }
      }
  
      return new OutputStreamWriter(output, encoding);
    }
  
    /**
     * Returns the last printable character for the specified
     * encoding.
     *
     * @param encoding The encoding
     * @return The last printable character
     */
    public static int getLastPrintable(String encoding)
    {
  
      for (int i = 0; i < _encodings.length; ++i)
      {
        if (_encodings[i].name.equalsIgnoreCase(encoding)
                || _encodings[i].javaName.equalsIgnoreCase(encoding))
          return _encodings[i].lastPrintable;
      }
  
      return DefaultLastPrintable;
    }
  
    /**
     * Returns the last printable character for an unspecified
     * encoding.
     *
     * NEEDSDOC ($objectName$) @return
     */
    public static int getLastPrintable()
    {
      return DefaultLastPrintable;
    }
  
    /** NEEDSDOC Field DEFAULT_MIME_ENCODING          */
    public static final String DEFAULT_MIME_ENCODING = "UTF-8";
  
    /**
     * Get the proper mime encoding.  From the XSLT recommendation: "The encoding
     * attribute specifies the preferred encoding to use for outputting the result
     * tree. XSLT processors are required to respect values of UTF-8 and UTF-16.
     * For other values, if the XSLT processor does not support the specified
     * encoding it may signal an error; if it does not signal an error it should
     * use UTF-8 or UTF-16 instead. The XSLT processor must not use an encoding
     * whose name does not match the EncName production of the XML Recommendation
     * [XML]. If no encoding attribute is specified, then the XSLT processor should
     * use either UTF-8 or UTF-16."
     *
     * NEEDSDOC @param encoding
     *
     * NEEDSDOC ($objectName$) @return
     */
    public static String getMimeEncoding(String encoding)
    {
  
      if (null == encoding)
      {
        try
        {
  
          // Get the default system character encoding.  This may be 
          // incorrect if they passed in a writer, but right now there 
          // seems to be no way to get the encoding from a writer.
          encoding = System.getProperty("file.encoding");
  
          if (null != encoding)
          {
  
            /*
            * See if the mime type is equal to UTF8.  If you don't
            * do that, then  convertJava2MimeEncoding will convert
            * 8859_1 to "ISO-8859-1", which is not what we want,
            * I think, and I don't think I want to alter the tables
            * to convert everything to UTF-8.
            */
            String jencoding =
              (encoding.equalsIgnoreCase("Cp1252") || encoding.equalsIgnoreCase(
              "ISO8859_1") || encoding.equalsIgnoreCase("8859_1") || encoding.equalsIgnoreCase("UTF8")) ? DEFAULT_MIME_ENCODING
                                                                                                        : convertJava2MimeEncoding(
                                                                                                          encoding);
  
            encoding = (null != jencoding) ? jencoding : DEFAULT_MIME_ENCODING;
          }
          else
          {
            encoding = DEFAULT_MIME_ENCODING;
          }
        }
        catch (SecurityException se)
        {
          encoding = DEFAULT_MIME_ENCODING;
        }
      }
      else
      {
        encoding = convertJava2MimeEncoding(encoding);
      }
  
      return encoding;
    }
  
    /**
     * Try the best we can to convert a Java encoding to a XML-style encoding.
     *
     * NEEDSDOC @param encoding
     *
     * NEEDSDOC ($objectName$) @return
     */
    public static String convertJava2MimeEncoding(String encoding)
    {
  
      for (int i = 0; i < _encodings.length; ++i)
      {
        if (_encodings[i].javaName.equalsIgnoreCase(encoding))
        {
          return _encodings[i].name;
        }
      }
  
      return encoding;
    }
  
    /**
     * Constructs a list of all the supported encodings.
     */
    private static final EncodingInfo[] _encodings = new EncodingInfo[]
    {
  
      //    <preferred MIME name>, <Java encoding name>
      // new EncodingInfo( "ISO 8859-1", "CP1252"); // Close enough, I guess
      new EncodingInfo("WINDOWS-1250", "Cp1250", 0x00FF),  // Peter Smolik
      new EncodingInfo("UTF-8", "UTF8", 0xFFFF),
      new EncodingInfo("US-ASCII", "ISO8859_1", 0x7F),
      new EncodingInfo("ISO-8859-1", "ISO8859_1", 0x00FF),
      new EncodingInfo("ISO-8859-2", "ISO8859_2", 0x00FF),
      new EncodingInfo("ISO-8859-3", "ISO8859_3", 0x00FF),
      new EncodingInfo("ISO-8859-4", "ISO8859_4", 0x00FF),
      new EncodingInfo("ISO-8859-5", "ISO8859_5", 0x00FF),
      new EncodingInfo("ISO-8859-6", "ISO8859_6", 0x00FF),
      new EncodingInfo("ISO-8859-7", "ISO8859_7", 0x00FF),
      new EncodingInfo("ISO-8859-8", "ISO8859_8", 0x00FF),
      new EncodingInfo("ISO-8859-9", "ISO8859_9", 0x00FF),
      new EncodingInfo("US-ASCII", "8859_1", 0x00FF),  // ?
      new EncodingInfo("ISO-8859-1", "8859_1", 0x00FF),
      new EncodingInfo("ISO-8859-2", "8859_2", 0x00FF),
      new EncodingInfo("ISO-8859-3", "8859_3", 0x00FF),
      new EncodingInfo("ISO-8859-4", "8859_4", 0x00FF),
      new EncodingInfo("ISO-8859-5", "8859_5", 0x00FF),
      new EncodingInfo("ISO-8859-6", "8859_6", 0x00FF),
      new EncodingInfo("ISO-8859-7", "8859_7", 0x00FF),
      new EncodingInfo("ISO-8859-8", "8859_8", 0x00FF),
      new EncodingInfo("ISO-8859-9", "8859_9", 0x00FF),
      new EncodingInfo("ISO-2022-JP", "JIS", 0xFFFF),
      new EncodingInfo("SHIFT_JIS", "SJIS", 0xFFFF),
      new EncodingInfo("EUC-JP", "EUCJIS", 0xFFFF),
      new EncodingInfo("GB2312", "GB2312", 0xFFFF),
      new EncodingInfo("BIG5", "Big5", 0xFFFF),
      new EncodingInfo("EUC-KR", "KSC5601", 0xFFFF),
      new EncodingInfo("ISO-2022-KR", "ISO2022KR", 0xFFFF),
      new EncodingInfo("KOI8-R", "KOI8_R", 0xFFFF),
      new EncodingInfo("EBCDIC-CP-US", "Cp037", 0x00FF),
      new EncodingInfo("EBCDIC-CP-CA", "Cp037", 0x00FF),
      new EncodingInfo("EBCDIC-CP-NL", "Cp037", 0x00FF),
      new EncodingInfo("EBCDIC-CP-DK", "Cp277", 0x00FF),
      new EncodingInfo("EBCDIC-CP-NO", "Cp277", 0x00FF),
      new EncodingInfo("EBCDIC-CP-FI", "Cp278", 0x00FF),
      new EncodingInfo("EBCDIC-CP-SE", "Cp278", 0x00FF),
      new EncodingInfo("EBCDIC-CP-IT", "Cp280", 0x00FF),
      new EncodingInfo("EBCDIC-CP-ES", "Cp284", 0x00FF),
      new EncodingInfo("EBCDIC-CP-GB", "Cp285", 0x00FF),
      new EncodingInfo("EBCDIC-CP-FR", "Cp297", 0x00FF),
      new EncodingInfo("EBCDIC-CP-AR1", "Cp420", 0x00FF),
      new EncodingInfo("EBCDIC-CP-HE", "Cp424", 0x00FF),
      new EncodingInfo("EBCDIC-CP-CH", "Cp500", 0x00FF),
      new EncodingInfo("EBCDIC-CP-ROECE", "Cp870", 0x00FF),
      new EncodingInfo("EBCDIC-CP-YU", "Cp870", 0x00FF),
      new EncodingInfo("EBCDIC-CP-IS", "Cp871", 0x00FF),
      new EncodingInfo("EBCDIC-CP-AR2", "Cp918", 0x00FF),
      new EncodingInfo("ASCII", "ASCII", 0x7F),
      new EncodingInfo("ISO-Latin-1", "ASCII", 0xFF),
      new EncodingInfo("UTF-8", "UTF8", 0xFFFF),
      new EncodingInfo("UNICODE", "Unicode", 0xFFFF),
      new EncodingInfo("UTF-16", "Unicode", 0xFFFF)
    };
  }
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/serialize/FormatterToHTML.java
  
  Index: FormatterToHTML.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xalan" 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, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.serialize;
  
  import java.util.Stack;
  
  import java.io.Writer;
  import java.io.IOException;
  
  import java.util.Hashtable;
  import java.util.Vector;
  
  import org.xml.sax.*;
  
  import org.apache.xalan.utils.BoolStack;
  import org.apache.xalan.utils.Trie;
  import org.apache.xalan.res.XSLMessages;
  import org.apache.xpath.res.XPATHErrorResources;
  import org.apache.serialize.OutputFormat;
  import org.apache.serialize.Method;
  import org.apache.serialize.helpers.HTMLOutputFormat;
  
  /**
   * <meta name="usage" content="general"/>
   * FormatterToHTML formats SAX-style events into XML.
   * Warning: this class will be replaced by the Xerces Serializer classes.
   */
  public class FormatterToHTML extends FormatterToXML
  {
  
    // StringVector m_parents = new StringVector();
  
    /** NEEDSDOC Field m_isRawStack          */
    BoolStack m_isRawStack = new BoolStack();
  
    /** NEEDSDOC Field m_inBlockElem          */
    boolean m_inBlockElem = false;
  
    /** NEEDSDOC Field s_HTMLlat1          */
    static String[] s_HTMLlat1 = { "nbsp", "iexcl", "cent", "pound", "curren",
                                   "yen", "brvbar", "sect", "uml", "copy",
                                   "ordf", "laquo", "not", "shy", "reg", "macr",
                                   "deg", "plusmn", "sup2", "sup3", "acute",
                                   "micro", "para", "middot", "cedil", "sup1",
                                   "ordm", "raquo", "frac14", "frac12",
                                   "frac34", "iquest", "Agrave", "Aacute",
                                   "Acirc", "Atilde", "Auml", "Aring", "AElig",
                                   "Ccedil", "Egrave", "Eacute", "Ecirc",
                                   "Euml", "Igrave", "Iacute", "Icirc", "Iuml",
                                   "ETH", "Ntilde", "Ograve", "Oacute", "Ocirc",
                                   "Otilde", "Ouml", "times", "Oslash",
                                   "Ugrave", "Uacute", "Ucirc", "Uuml",
                                   "Yacute", "THORN", "szlig", "agrave",
                                   "aacute", "acirc", "atilde", "auml", "aring",
                                   "aelig", "ccedil", "egrave", "eacute",
                                   "ecirc", "euml", "igrave", "iacute", "icirc",
                                   "iuml", "eth", "ntilde", "ograve", "oacute",
                                   "ocirc", "otilde", "ouml", "divide",
                                   "oslash", "ugrave", "uacute", "ucirc",
                                   "uuml", "yacute", "thorn", "yuml" };
  
    /** NEEDSDOC Field HTMLsymbol1          */
    static String[] HTMLsymbol1 = { "Alpha", "Beta", "Gamma", "Delta",
                                    "Epsilon", "Zeta", "Eta", "Theta", "Iota",
                                    "Kappa", "Lambda", "Mu", "Nu", "Xi",
                                    "Omicron", "Pi", "Rho", "", "Sigma", "Tau",
                                    "Upsilon", "Phi", "Chi", "Psi", "Omega" };
  
    /** NEEDSDOC Field HTMLsymbol2          */
    static String[] HTMLsymbol2 = { "alpha", "beta", "gamma", "delta",
                                    "epsilon", "zeta", "eta", "theta", "iota",
                                    "kappa", "lambda", "mu", "nu", "xi",
                                    "omicron", "pi", "rho", "sigmaf", "sigma",
                                    "tau", "upsilon", "phi", "chi", "psi",
                                    "omega", "thetasym", "upsih", "piv" };
  
    // "fnof",
    // static   String[]  HTMLsymbol2 =    {"bull",    "hellip",    
    //                                     "prime",    "Prime",    "oline",    "frasl",    
    //                                     "weierp",    "image",    "real",    "trade",    
    //                                     "alefsym",    "larr",    "uarr",    "rarr",    
    //                                     "darr",    "harr",    "crarr",    "lArr",    
    //                                     "uArr",    "rArr",    "dArr",    "hArr",    
    //                                     "forall",    "part",    "exist",    "empty",    
    //                                     "nabla",    "isin",    "notin",    "ni",    
    //                                     "prod",    "sum",    "minus",    "lowast",    
    //                                     "radic",    "prop",    "infin",    "ang",    
    //                                     "and",    "or",    "cap",    "cup",    "int",    
    //                                     "there4",    "sim",    "cong",    "asymp",    
    //                                     "ne",    "equiv",    "le",    "ge",    "sub",    
    //                                     "sup",    "nsub",    "sube",    "supe",    
    //                                     "oplus",    "otimes",    "perp",    "sdot",    
    //                                     "lceil",    "rceil",    "lfloor",    "rfloor",    
    //                                     "lang",    "rang",    "loz",    "spades",    
    //                                      "clubs",    "hearts",    "diams"};
  
    /** NEEDSDOC Field m_elementFlags          */
    static Trie m_elementFlags = new Trie();
  
    static
    {
  
      // HTML 4.0 loose DTD
      m_elementFlags.put("BASEFONT", new ElemDesc(0 | ElemDesc.EMPTY));
      m_elementFlags.put("FRAME",
                         new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK));
      m_elementFlags.put("FRAMESET", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("NOFRAMES", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("ISINDEX",
                         new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK));
      m_elementFlags.put("APPLET",
                         new ElemDesc(0 | ElemDesc.WHITESPACESENSITIVE));
      m_elementFlags.put("CENTER", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("DIR", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("MENU", new ElemDesc(0 | ElemDesc.BLOCK));
  
      // HTML 4.0 strict DTD
      m_elementFlags.put("TT", new ElemDesc(0 | ElemDesc.FONTSTYLE));
      m_elementFlags.put("I", new ElemDesc(0 | ElemDesc.FONTSTYLE));
      m_elementFlags.put("B", new ElemDesc(0 | ElemDesc.FONTSTYLE));
      m_elementFlags.put("BIG", new ElemDesc(0 | ElemDesc.FONTSTYLE));
      m_elementFlags.put("SMALL", new ElemDesc(0 | ElemDesc.FONTSTYLE));
      m_elementFlags.put("EM", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("STRONG", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("DFN", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("CODE", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("SAMP", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("KBD", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("VAR", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("CITE", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("ABBR", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("ACRONYM", new ElemDesc(0 | ElemDesc.PHRASE));
      m_elementFlags.put("SUP",
                         new ElemDesc(0 | ElemDesc.SPECIAL
                                      | ElemDesc.ASPECIAL));
      m_elementFlags.put("SUB",
                         new ElemDesc(0 | ElemDesc.SPECIAL
                                      | ElemDesc.ASPECIAL));
      m_elementFlags.put("SPAN",
                         new ElemDesc(0 | ElemDesc.SPECIAL
                                      | ElemDesc.ASPECIAL));
      m_elementFlags.put("BDO",
                         new ElemDesc(0 | ElemDesc.SPECIAL
                                      | ElemDesc.ASPECIAL));
      m_elementFlags.put("BR",
                         new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL
                                      | ElemDesc.EMPTY | ElemDesc.BLOCK));
      m_elementFlags.put("BODY", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("ADDRESS",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET));
      m_elementFlags.put("DIV",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET));
      m_elementFlags.put("A", new ElemDesc(0 | ElemDesc.SPECIAL));
      m_elementFlags.put("MAP",
                         new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL
                                      | ElemDesc.BLOCK));
      m_elementFlags.put("AREA",
                         new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK));
      m_elementFlags.put("LINK",
                         new ElemDesc(0 | ElemDesc.HEADMISC | ElemDesc.EMPTY
                                      | ElemDesc.BLOCK));
      m_elementFlags.put("IMG",
                         new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL
                                      | ElemDesc.EMPTY
                                      | ElemDesc.WHITESPACESENSITIVE));
      m_elementFlags.put("OBJECT",
                         new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL
                                      | ElemDesc.HEADMISC
                                      | ElemDesc.WHITESPACESENSITIVE));
      m_elementFlags.put("PARAM", new ElemDesc(0 | ElemDesc.EMPTY));
      m_elementFlags.put("HR",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET
                                      | ElemDesc.EMPTY));
      m_elementFlags.put("P",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET));
      m_elementFlags.put("H1",
                         new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK));
      m_elementFlags.put("H2",
                         new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK));
      m_elementFlags.put("H3",
                         new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK));
      m_elementFlags.put("H4",
                         new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK));
      m_elementFlags.put("H5",
                         new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK));
      m_elementFlags.put("H6",
                         new ElemDesc(0 | ElemDesc.HEAD | ElemDesc.BLOCK));
      m_elementFlags.put("PRE",
                         new ElemDesc(0 | ElemDesc.PREFORMATTED
                                      | ElemDesc.BLOCK));
      m_elementFlags.put("Q",
                         new ElemDesc(0 | ElemDesc.SPECIAL
                                      | ElemDesc.ASPECIAL));
      m_elementFlags.put("BLOCKQUOTE",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET));
      m_elementFlags.put("INS", new ElemDesc(0));
      m_elementFlags.put("DEL", new ElemDesc(0));
      m_elementFlags.put("DL",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET));
      m_elementFlags.put("DT", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("DD", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("OL",
                         new ElemDesc(0 | ElemDesc.LIST | ElemDesc.BLOCK));
      m_elementFlags.put("UL",
                         new ElemDesc(0 | ElemDesc.LIST | ElemDesc.BLOCK));
      m_elementFlags.put("LI", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("FORM", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("LABEL", new ElemDesc(0 | ElemDesc.FORMCTRL));
      m_elementFlags.put("INPUT",
                         new ElemDesc(0 | ElemDesc.FORMCTRL
                                      | ElemDesc.INLINELABEL | ElemDesc.EMPTY));
      m_elementFlags.put("SELECT",
                         new ElemDesc(0 | ElemDesc.FORMCTRL
                                      | ElemDesc.INLINELABEL));
      m_elementFlags.put("OPTGROUP", new ElemDesc(0));
      m_elementFlags.put("OPTION", new ElemDesc(0));
      m_elementFlags.put("TEXTAREA",
                         new ElemDesc(0 | ElemDesc.FORMCTRL
                                      | ElemDesc.INLINELABEL));
      m_elementFlags.put("FIELDSET",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM));
      m_elementFlags.put("LEGEND", new ElemDesc(0));
      m_elementFlags.put("BUTTON",
                         new ElemDesc(0 | ElemDesc.FORMCTRL
                                      | ElemDesc.INLINELABEL));
      m_elementFlags.put("TABLE",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET));
      m_elementFlags.put("CAPTION", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("THEAD", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("TFOOT", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("TBODY", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("COLGROUP", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("COL",
                         new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK));
      m_elementFlags.put("TR", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("TH", new ElemDesc(0));
      m_elementFlags.put("TD", new ElemDesc(0));
      m_elementFlags.put("HEAD",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.HEADELEM));
      m_elementFlags.put("TITLE", new ElemDesc(0 | ElemDesc.BLOCK));
      m_elementFlags.put("BASE",
                         new ElemDesc(0 | ElemDesc.EMPTY | ElemDesc.BLOCK));
      m_elementFlags.put("META",
                         new ElemDesc(0 | ElemDesc.HEADMISC | ElemDesc.EMPTY
                                      | ElemDesc.BLOCK));
      m_elementFlags.put("STYLE",
                         new ElemDesc(0 | ElemDesc.HEADMISC | ElemDesc.RAW
                                      | ElemDesc.BLOCK));
      m_elementFlags.put("SCRIPT",
                         new ElemDesc(0 | ElemDesc.SPECIAL | ElemDesc.ASPECIAL
                                      | ElemDesc.HEADMISC | ElemDesc.RAW));
      m_elementFlags.put("NOSCRIPT",
                         new ElemDesc(0 | ElemDesc.BLOCK | ElemDesc.BLOCKFORM
                                      | ElemDesc.BLOCKFORMFIELDSET));
      m_elementFlags.put("HTML", new ElemDesc(0 | ElemDesc.BLOCK));
  
      ElemDesc elemDesc;
  
      elemDesc = (ElemDesc) m_elementFlags.get("BASE");
  
      elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("BLOCKQUOTE");
  
      elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("Q");
  
      elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("INS");
  
      elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("DEL");
  
      elemDesc.setAttr("CITE", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("A");
  
      elemDesc.setAttr("HREF", ElemDesc.ATTRURL);
      elemDesc.setAttr("NAME", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("INPUT");
  
      elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
      elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL);
      elemDesc.setAttr("CHECKED", ElemDesc.ATTREMPTY);
      elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
      elemDesc.setAttr("READONLY", ElemDesc.ATTREMPTY);
  
      elemDesc = (ElemDesc) m_elementFlags.get("SELECT");
  
      elemDesc.setAttr("READONLY", ElemDesc.ATTREMPTY);
      elemDesc.setAttr("MULTIPLE", ElemDesc.ATTREMPTY);
  
      elemDesc = (ElemDesc) m_elementFlags.get("OPTGROUP");
  
      elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
  
      elemDesc = (ElemDesc) m_elementFlags.get("OPTION");
  
      elemDesc.setAttr("SELECTED", ElemDesc.ATTREMPTY);
      elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
  
      elemDesc = (ElemDesc) m_elementFlags.get("TEXTAREA");
  
      elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
      elemDesc.setAttr("READONLY", ElemDesc.ATTREMPTY);
  
      elemDesc = (ElemDesc) m_elementFlags.get("BUTTON");
  
      elemDesc.setAttr("DISABLED", ElemDesc.ATTREMPTY);
  
      elemDesc = (ElemDesc) m_elementFlags.get("SCRIPT");
  
      elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
      elemDesc.setAttr("FOR", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("IMG");
  
      elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
      elemDesc.setAttr("LONGDESC", ElemDesc.ATTRURL);
      elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("OBJECT");
  
      elemDesc.setAttr("CLASSID", ElemDesc.ATTRURL);
      elemDesc.setAttr("CODEBASE", ElemDesc.ATTRURL);
      elemDesc.setAttr("DATA", ElemDesc.ATTRURL);
      elemDesc.setAttr("ARCHIVE", ElemDesc.ATTRURL);
      elemDesc.setAttr("USEMAP", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("FORM");
  
      elemDesc.setAttr("ACTION", ElemDesc.ATTRURL);
  
      elemDesc = (ElemDesc) m_elementFlags.get("HEAD");
  
      elemDesc.setAttr("PROFILE", ElemDesc.ATTRURL);
  
      // Attribution to: "Voytenko, Dimitry" <DV...@SECTORBASE.COM>
      elemDesc = (ElemDesc) m_elementFlags.get("FRAME");
  
      elemDesc.setAttr("SRC", ElemDesc.ATTRURL);
    }
  
    /**
     * Dummy element for elements not found.
     */
    static private ElemDesc m_dummy = new ElemDesc(0 | ElemDesc.BLOCK);
  
    /** NEEDSDOC Field m_specialEscapeURLs          */
    private boolean m_specialEscapeURLs = false;
  
    /**
     * Tells if the formatter should use special URL escaping.
     *
     * NEEDSDOC @param bool
     */
    public void setSpecialEscapeURLs(boolean bool)
    {
      m_specialEscapeURLs = bool;
    }
  
    /**
     * Tells if the formatter should use special URL escaping.
     *
     * NEEDSDOC ($objectName$) @return
     */
    public boolean getSpecialEscapeURLs()
    {
      return m_specialEscapeURLs;
    }
  
    /**
     * Get a description of the given element.
     *
     * NEEDSDOC @param name
     *
     * NEEDSDOC ($objectName$) @return
     */
    ElemDesc getElemDesc(String name)
    {
  
      if (null != name)
      {
        Object obj = m_elementFlags.get(name);
  
        if (null != obj)
          return (ElemDesc) obj;
      }
  
      return m_dummy;
    }
  
    /**
     * Default constructor.
     */
    public FormatterToHTML()
    {
      super();
    }
  
    /**
     * Constructor using a writer.
     * @param writer        The character output stream to use.
     */
    public FormatterToHTML(Writer writer)
    {
      super(writer);
    }
  
    /**
     * Constructor using an output stream, and a simple OutputFormat.
     * @param writer        The character output stream to use.
     *
     * NEEDSDOC @param os
     *
     * @throws java.io.UnsupportedEncodingException
     */
    public FormatterToHTML(java.io.OutputStream os)
            throws java.io.UnsupportedEncodingException
    {
  
      OutputFormat of = new HTMLOutputFormat("UTF-8");
  
      this.init(os, of);
    }
  
    /**
     * Constructor using a writer.
     * @param writer        The character output stream to use.
     *
     * NEEDSDOC @param xmlListener
     */
    public FormatterToHTML(FormatterToXML xmlListener)
    {
  
      super(xmlListener);
  
      m_doIndent = true;  // TODO: But what if the user wants to set it???
    }
  
    /**
     * Set the attribute characters what will require special mapping.
     */
    protected void initAttrCharsMap()
    {
  
      super.initAttrCharsMap();
  
      m_attrCharsMap[(int) '\n'] = 'S';
  
      // XSLT Spec: The html output method should not 
      // escape < characters occurring in attribute values.
      m_attrCharsMap[(int) '<'] = '\0';
      m_attrCharsMap[(int) '>'] = '\0';
      m_attrCharsMap[0x0A] = 'S';
      m_attrCharsMap[0x0D] = 'S';
  
      int n = (255 > SPECIALSSIZE) ? 255 : SPECIALSSIZE;
  
      for (int i = 160; i < n; i++)
      {
        m_attrCharsMap[i] = 'S';
      }
    }
  
    /**
     * Set the characters what will require special mapping.
     */
    protected void initCharsMap()
    {
  
      initAttrCharsMap();
  
      int n = (m_maxCharacter > SPECIALSSIZE) ? SPECIALSSIZE : m_maxCharacter;
  
      for (int i = 0; i < n; i++)
      {
        m_charsMap[i] = '\0';
      }
  
      m_charsMap[(int) '\n'] = 'S';
      m_charsMap[(int) '<'] = 'S';
      m_charsMap[(int) '>'] = 'S';
      m_charsMap[(int) '&'] = 'S';
  
      for (int i = 0; i < 10; i++)
      {
        m_charsMap[i] = 'S';
      }
  
      m_charsMap[0x0A] = 'S';
      m_charsMap[0x0D] = 'S';
      n = (255 > SPECIALSSIZE) ? 255 : SPECIALSSIZE;
  
      for (int i = 160; i < n; i++)
      {
        m_charsMap[i] = 'S';
      }
  
      for (int i = m_maxCharacter; i < SPECIALSSIZE; i++)
      {
        m_charsMap[i] = 'S';
      }
    }
  
    /** NEEDSDOC Field m_currentElementName          */
    String m_currentElementName = null;
  
    // protected boolean shouldIndent()
    // {
    //   return (!m_ispreserve && !m_isprevtext);
    // }
  
    /**
     * Receive notification of the beginning of a document.
     *
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void startDocument() throws SAXException
    {
  
      m_needToOutputDocTypeDecl = true;
      m_startNewLine = false;
      m_shouldNotWriteXMLHeader = true;
  
      if (true == m_needToOutputDocTypeDecl)
      {
        if ((null != m_doctypeSystem) || (null != m_doctypePublic))
        {
          accum("<!DOCTYPE HTML");
  
          if (null != m_doctypePublic)
          {
            accum(" PUBLIC \"");
            accum(m_doctypePublic);
            accum("\"");
          }
  
          if (null != m_doctypeSystem)
          {
            if (null == m_doctypePublic)
              accum(" SYSTEM \"");
            else
              accum(" \"");
  
            accum(m_doctypeSystem);
            accum("\"");
          }
  
          accum(">");
          accum(m_lineSep);
        }
      }
  
      m_needToOutputDocTypeDecl = false;
    }
  
    /**
     *  Receive notification of the beginning of an element.
     * 
     *
     * NEEDSDOC @param namespaceURI
     * NEEDSDOC @param localName
     *  @param name The element type name.
     *  @param atts The attributes attached to the element, if any.
     *  @exception org.xml.sax.SAXException Any SAX exception, possibly
     *             wrapping another exception.
     *  @see #endElement
     *  @see org.xml.sax.AttributeList
     *
     * @throws SAXException
     */
    public void startElement(
            String namespaceURI, String localName, String name, Attributes atts)
              throws SAXException
    {
  
      boolean savedDoIndent = m_doIndent;
      boolean noLineBreak;
  
      writeParentTagEnd();
      pushState(namespaceURI, localName, m_format.getCDataElements(),
                m_cdataSectionStates);
      pushState(namespaceURI, localName, m_format.getNonEscapingElements(),
                m_disableOutputEscapingStates);
  
      String nameUpper = name.toUpperCase();
      ElemDesc elemDesc = getElemDesc(nameUpper);
  
      // ElemDesc parentElemDesc = getElemDesc(m_currentElementName);
      boolean isBlockElement = elemDesc.is(ElemDesc.BLOCK);
      boolean isHeadElement = elemDesc.is(ElemDesc.HEADELEM);
  
      // boolean isWhiteSpaceSensitive = elemDesc.is(ElemDesc.WHITESPACESENSITIVE);
      if (m_ispreserve)
        m_ispreserve = false;
      else if (m_doIndent && (null != m_currentElementName)
               && (!m_inBlockElem || isBlockElement)
  
      /* && !isWhiteSpaceSensitive */
      )
      {
        m_startNewLine = true;
  
        indent(m_currentIndent);
      }
  
      m_inBlockElem = !isBlockElement;
  
      m_isRawStack.push(elemDesc.is(ElemDesc.RAW));
  
      m_currentElementName = nameUpper;
  
      // m_parents.push(m_currentElementName);
      this.accum('<');
      this.accum(name);
  
      int nAttrs = atts.getLength();
  
      for (int i = 0; i < nAttrs; i++)
      {
        processAttribute(atts.getQName(i), elemDesc, atts.getValue(i));
      }
  
      // Flag the current element as not yet having any children.
      openElementForChildren();
  
      m_currentIndent += this.indent;
      m_isprevtext = false;
      m_doIndent = savedDoIndent;
  
      if (isHeadElement)
      {
        writeParentTagEnd();
  
        if (m_doIndent)
          indent(m_currentIndent);
  
        accum(
          "<META http-equiv=\"Content-Type\" content=\"text/html; charset=");
  
        String encoding = Encodings.getMimeEncoding(m_encoding);
  
        accum(encoding);
        accum('"');
        accum('>');
      }
    }
  
    /**
     *  Receive notification of the end of an element.
     * 
     *
     * NEEDSDOC @param namespaceURI
     * NEEDSDOC @param localName
     *  @param name The element type name
     *  @exception org.xml.sax.SAXException Any SAX exception, possibly
     *             wrapping another exception.
     *
     * @throws SAXException
     */
    public void endElement(String namespaceURI, String localName, String name)
            throws SAXException
    {
  
      m_currentIndent -= this.indent;
  
      // name = name.toUpperCase();
      boolean hasChildNodes = childNodesWereAdded();
  
      // System.out.println(m_currentElementName);
      // m_parents.pop();
      m_isRawStack.pop();
  
      String nameUpper = name.toUpperCase();
      ElemDesc elemDesc = getElemDesc(nameUpper);
  
      // ElemDesc parentElemDesc = getElemDesc(m_currentElementName);
      boolean isBlockElement = elemDesc.is(ElemDesc.BLOCK);
      boolean shouldIndent = false;
  
      if (m_ispreserve)
      {
        m_ispreserve = false;
      }
      else if (m_doIndent && (!m_inBlockElem || isBlockElement))
      {
        m_startNewLine = true;
        shouldIndent = true;
  
        // indent(m_currentIndent);
      }
  
      m_inBlockElem = !isBlockElement;
  
      if (hasChildNodes)
      {
        if (shouldIndent)
          indent(m_currentIndent);
  
        this.accum("</");
        this.accum(name);
        this.accum('>');
  
        m_currentElementName = name;
      }
      else
      {
        if (!elemDesc.is(ElemDesc.EMPTY))
        {
          this.accum('>');
  
          if (shouldIndent)
            indent(m_currentIndent);
  
          this.accum('<');
          this.accum('/');
          this.accum(name);
          this.accum('>');
        }
        else
        {
          this.accum('>');
        }
      }
  
      if (elemDesc.is(ElemDesc.WHITESPACESENSITIVE))
        m_ispreserve = true;
  
      if (hasChildNodes)
      {
        if (!m_preserves.isEmpty())
          m_preserves.pop();
      }
  
      m_isprevtext = false;
  
      m_disableOutputEscapingStates.pop();
      m_cdataSectionStates.pop();
    }
  
    /**
     * Process an attribute.
     * @param   name   The name of the attribute.
     * NEEDSDOC @param elemDesc
     * @param   value   The value of the attribute.
     *
     * @throws SAXException
     */
    protected void processAttribute(
            String name, ElemDesc elemDesc, String value) throws SAXException
    {
  
      String nameUpper = name.toUpperCase();
  
      this.accum(' ');
  
      if (elemDesc.isAttrFlagSet(nameUpper, ElemDesc.ATTREMPTY)
              && ((value.length() == 0) || value.equalsIgnoreCase(name)))
      {
        this.accum(name);
      }
      else
      {
        this.accum(name);
        this.accum('=');
        this.accum('\"');
  
        if (m_specialEscapeURLs
                && elemDesc.isAttrFlagSet(nameUpper, ElemDesc.ATTRURL))
          writeAttrURI(value, this.m_encoding);
        else
          writeAttrString(value, this.m_encoding);
  
        this.accum('\"');
      }
    }
  
    /** NEEDSDOC Field MASK1          */
    static final int MASK1 = 0xFF00;
  
    /** NEEDSDOC Field MASK2          */
    static final int MASK2 = 0x00FF;
  
    /**
     * Write the specified <var>string</var> after substituting non ASCII characters,
     * with <CODE>%HH</CODE>, where HH is the hex of the byte value.
     *
     * @param   string      String to convert to XML format.
     * @param   specials    Chracters, should be represeted in chracter referenfces.
     * @param   encoding    CURRENTLY NOT IMPLEMENTED.
     * @see #backReference
     *
     * @throws SAXException
     */
    public void writeAttrURI(String string, String encoding) throws SAXException
    {
  
      char[] stringArray = string.toCharArray();
      int len = stringArray.length;
  
      for (int i = 0; i < len; i++)
      {
        char ch = stringArray[i];
  
        // if first 8 bytes are 0, no need to append them.
        if ((ch < 9) || (ch > 127)
                || /*(ch == '"') || -sb, as per #PDIK4L9LZY */ (ch == ' '))
        {
          int b1 = (int) ((((int) ch) & MASK1) >> 8);
          int b2 = (int) (((int) ch) & MASK2);
  
          if (b1 != 0)
          {
            accum("%");
            accum(Integer.toHexString(b1));
          }
  
          accum("%");
          accum(Integer.toHexString(b2));
        }
        else if (ch == '"')
        {
          accum('&');
          accum('q');
          accum('u');
          accum('o');
          accum('t');
          accum(';');
        }
        else
        {
          accum(ch);
        }
      }
    }
  
    /**
     * Writes the specified <var>string</var> after substituting <VAR>specials</VAR>,
     * and UTF-16 surrogates for character references <CODE>&amp;#xnn</CODE>.
     *
     * @param   string      String to convert to XML format.
     * @param   encoding    CURRENTLY NOT IMPLEMENTED.
     * @see #backReference
     *
     * @throws SAXException
     */
    public void writeAttrString(String string, String encoding)
            throws SAXException
    {
  
      final char chars[] = string.toCharArray();
      final int strLen = chars.length;
  
      for (int i = 0; i < strLen; i++)
      {
        char ch = chars[i];
  
        // System.out.println("SPECIALSSIZE: "+SPECIALSSIZE);
        // System.out.println("ch: "+(int)ch);
        // System.out.println("m_maxCharacter: "+(int)m_maxCharacter);
        // System.out.println("m_attrCharsMap[ch]: "+(int)m_attrCharsMap[ch]);
        if ((ch < SPECIALSSIZE) && (m_attrCharsMap[ch] != 'S'))
        {
          accum(ch);
        }
        else if (('&' == ch) && ((i + 1) < strLen) && ('{' == chars[i + 1]))
        {
          accum(ch);  // no escaping in this case, as specified in 15.2
        }
        else
        {
          int pos = accumDefaultEntity(ch, i, chars, strLen, false);
  
          if (i != pos)
          {
            i = pos - 1;
          }
          else
          {
            if (0xd800 <= ch && ch < 0xdc00)
            {
  
              // UTF-16 surrogate
              int next;
  
              if (i + 1 >= strLen)
              {
                throw new SAXException(
                  XSLMessages.createXPATHMessage(
                    XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                    new Object[]{ Integer.toHexString(ch) }));  //"Invalid UTF-16 surrogate detected: "
  
                //+Integer.toHexString(ch)+ " ?");
              }
              else
              {
                next = chars[++i];
  
                if (!(0xdc00 <= next && next < 0xe000))
                  throw new SAXException(
                    XSLMessages.createXPATHMessage(
                      XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                      new Object[]{
                        Integer.toHexString(ch) + " "
                        + Integer.toHexString(next) }));  //"Invalid UTF-16 surrogate detected: "
  
                //+Integer.toHexString(ch)+" "+Integer.toHexString(next));
                next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
              }
  
              accum("&#");
              accum(Integer.toString(next));
              accum(';');
  
              /*} else if (null != ctbc && !ctbc.canConvert(ch)) {
              accum("&#x");
              accum(Integer.toString((int)ch, 16));
              accum(";");*/
            }
  
            // The next is kind of a hack to keep from escaping in the case 
            // of Shift_JIS and the like.
            else if ((ch < m_maxCharacter) && (m_maxCharacter == 0xFFFF)
                     && (ch != 160) /* nbsp */)
            {
              accum(ch);  // no escaping in this case
            }
            else if ((ch >= 160) && (ch <= 255))
            {
              accum('&');
              accum(s_HTMLlat1[((int) ch) - 160]);
              accum(';');
            }
            else if ((ch >= 913) && (ch <= 937) && (ch != 930))
            {
              accum('&');
              accum(HTMLsymbol1[((int) ch) - 913]);
              accum(';');
            }
            else if ((ch >= 945) && (ch <= 969))
            {
              accum('&');
              accum(HTMLsymbol2[((int) ch) - 945]);
              accum(';');
            }
            else if ((ch >= 977) && (ch <= 978))
            {
              accum('&');
  
              // substracting the number of unused characters
              accum(HTMLsymbol2[((int) ch) - 945 - 7]);
              accum(';');
            }
            else if ((ch == 982))
            {
              accum('&');
  
              // substracting the number of unused characters
              accum(HTMLsymbol2[((int) ch) - 945 - 10]);
              accum(';');
            }
            else if (402 == ch)
            {
              accum("&fnof;");
            }
            else if (ch < m_maxCharacter)
            {
              accum(ch);  // no escaping in this case
            }
            else
            {
              accum("&#");
              accum(Integer.toString(ch));
              accum(';');
            }
          }
        }
      }
    }
  
    /**
     * NEEDSDOC Method copyEntityIntoBuf 
     *
     *
     * NEEDSDOC @param s
     * NEEDSDOC @param pos
     *
     * NEEDSDOC (copyEntityIntoBuf) @return
     *
     * @throws SAXException
     */
    private int copyEntityIntoBuf(String s, int pos) throws SAXException
    {
  
      int l = s.length();
  
      accum('&');
  
      for (int i = 0; i < l; i++)
      {
        accum(s.charAt(i));
      }
  
      accum(';');
  
      return pos;
    }
  
    /**
     * Receive notification of character data.
     *
     * <p>The Parser will call this method to report each chunk of
     * character data.  SAX parsers may return all contiguous character
     * data in a single chunk, or they may split it into several
     * chunks; however, all of the characters in any single event
     * must come from the same external entity, so that the Locator
     * provides useful information.</p>
     *
     * <p>The application must not attempt to read from the array
     * outside of the specified range.</p>
     *
     * <p>Note that some parsers will report whitespace using the
     * ignorableWhitespace() method rather than this one (validating
     * parsers must do so).</p>
     *
     * @param chars The characters from the XML document.
     * @param start The start position in the array.
     * @param length The number of characters to read from the array.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #ignorableWhitespace
     * @see org.xml.sax.Locator
     *
     * @throws SAXException
     */
    public void characters(char chars[], int start, int length)
            throws SAXException
    {
  
      if (0 == length)
        return;
  
      if (m_inCData)
      {
        cdata(chars, start, length);
  
        return;
      }
  
      if (isEscapingDisabled())
      {
        charactersRaw(chars, start, length);
  
        return;
      }
  
      if (!m_isRawStack.isEmpty() && m_isRawStack.peek())
      {
        try
        {
          writeParentTagEnd();
  
          m_ispreserve = true;
  
          if (shouldIndent())
            indent(m_currentIndent);
  
          // this.accum("<![CDATA[");
          // this.accum(chars, start, length);
          writeNormalizedChars(chars, start, length, false);
  
          // this.accum("]]>");
          return;
        }
        catch (IOException ioe)
        {
          throw new SAXException(
            XSLMessages.createXPATHMessage(
            XPATHErrorResources.ER_OIERROR, null), ioe);  //"IO error", ioe);
        }
      }
  
      writeParentTagEnd();
  
      m_ispreserve = true;
  
      int pos = 0;
      int end = start + length;
      int startClean = start;
      int lengthClean = 0;
  
      for (int i = start; i < end; i++)
      {
        char ch = chars[i];
  
        if ((ch < SPECIALSSIZE) && (m_charsMap[ch] != 'S'))
        {
  
          // accum(ch);
          lengthClean++;
  
          continue;
        }
        else if ((0x0A == ch) && ((i + 1) < end) && (0x0D == chars[i + 1]))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 2;
  
          outputLineSep();
  
          i++;
        }
  
        if ((0x0D == ch) && ((i + 1) < end) && (0x0A == chars[i + 1]))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 2;
  
          outputLineSep();
  
          i++;
        }
        else if (0x0D == ch)
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 2;
  
          outputLineSep();
  
          i++;
        }
        else if ('\n' == ch)
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
  
          outputLineSep();
        }
        else if ('<' == ch)
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
          pos = copyEntityIntoBuf("lt", pos);
        }
        else if ('>' == ch)
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
          pos = copyEntityIntoBuf("gt", pos);
        }
        else if ('&' == ch)
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
          pos = copyEntityIntoBuf("amp", pos);
        }
        else if ((ch >= 9) && (ch <= 126))
        {
          lengthClean++;
  
          // accum(ch);
        }
        else if ((ch >= 160) && (ch <= 255))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
          pos = copyEntityIntoBuf(s_HTMLlat1[((int) ch) - 160], pos);
        }
        else if ((ch >= 913) && (ch <= 937) && (ch != 930))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
          pos = copyEntityIntoBuf(HTMLsymbol1[((int) ch) - 913], pos);
        }
        else if ((ch >= 945) && (ch <= 969))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
          pos = copyEntityIntoBuf(HTMLsymbol2[((int) ch) - 945], pos);
        }
        else if ((ch >= 977) && (ch <= 978))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
  
          // subtract the unused characters 
          pos = copyEntityIntoBuf(HTMLsymbol2[((int) ch) - 945 - 7], pos);
        }
        else if ((ch == 982))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
  
          // subtract the unused characters
          pos = copyEntityIntoBuf(HTMLsymbol2[((int) ch) - 945 - 10], pos);
        }
        else if (402 == ch)
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
          pos = copyEntityIntoBuf("fnof", pos);
        }
        else if (m_isUTF8 && (0xd800 <= ch && ch < 0xdc00))
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          // UTF-16 surrogate
          int next;
  
          if (i + 1 >= length)
          {
            throw new SAXException(
              XSLMessages.createXPATHMessage(
                XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                new Object[]{ Integer.toHexString(ch) }));  //"Invalid UTF-16 surrogate detected: "
  
            //+Integer.toHexString(ch)+ " ?");
          }
          else
          {
            next = chars[++i];
  
            if (!(0xdc00 <= next && next < 0xe000))
              throw new SAXException(
                XSLMessages.createXPATHMessage(
                  XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                  new Object[]{
                    Integer.toHexString(ch) + " "
                    + Integer.toHexString(next) }));  //"Invalid UTF-16 surrogate detected: "
  
            //+Integer.toHexString(ch)+" "+Integer.toHexString(next));
            next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
          }
  
          accum('&');
          accum('#');
  
          String intStr = Integer.toString(next);
          int nIntStr = intStr.length();
  
          for (int k = 0; k < nIntStr; k++)
          {
            accum(intStr.charAt(k));
          }
  
          accum(';');
  
          startClean = i + 1;
        }
        else if ((ch >= '\u007F') && (ch <= m_maxCharacter))
        {
  
          // Hope this is right...
          lengthClean++;
  
          // accum(ch);
        }
        else
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = i + 1;
  
          accum('&');
          accum('#');
  
          String intStr = Integer.toString(ch);
          int nIntStr = intStr.length();
  
          for (int k = 0; k < nIntStr; k++)
          {
            accum(intStr.charAt(k));
          }
  
          accum(';');
        }
      }
  
      if (lengthClean > 0)
      {
        accum(chars, startClean, lengthClean);
      }
  
      m_isprevtext = true;
    }
  
    /**
     *  Receive notification of cdata.
     * 
     *  <p>The Parser will call this method to report each chunk of
     *  character data.  SAX parsers may return all contiguous character
     *  data in a single chunk, or they may split it into several
     *  chunks; however, all of the characters in any single event
     *  must come from the same external entity, so that the Locator
     *  provides useful information.</p>
     * 
     *  <p>The application must not attempt to read from the array
     *  outside of the specified range.</p>
     * 
     *  <p>Note that some parsers will report whitespace using the
     *  ignorableWhitespace() method rather than this one (validating
     *  parsers must do so).</p>
     * 
     *  @param ch The characters from the XML document.
     *  @param start The start position in the array.
     *  @param length The number of characters to read from the array.
     *  @exception org.xml.sax.SAXException Any SAX exception, possibly
     *             wrapping another exception.
     *  @see #ignorableWhitespace
     *  @see org.xml.sax.Locator
     *
     * @throws SAXException
     */
    public void cdata(char ch[], int start, int length) throws SAXException
    {
  
      if ((null != m_currentElementName)
              && (m_currentElementName.equalsIgnoreCase("SCRIPT")
                  || m_currentElementName.equalsIgnoreCase("STYLE")))
      {
        try
        {
          writeParentTagEnd();
  
          m_ispreserve = true;
  
          if (shouldIndent())
            indent(m_currentIndent);
  
          // this.accum(ch, start, length);
          writeNormalizedChars(ch, start, length, true);
        }
        catch (IOException ioe)
        {
          throw new SAXException(
            XSLMessages.createXPATHMessage(
            XPATHErrorResources.ER_OIERROR, null), ioe);  //"IO error", ioe);
        }
      }
  
      /*
      else if(m_stripCData) // should normally always be false
      {
        try
        {
          writeParentTagEnd();
          m_ispreserve = true;
          if (shouldIndent())
            indent(m_currentIndent);
          // this.accum("<![CDATA[");
          this.accum(ch, start, length);
          // this.accum("]]>");
        }
        catch(IOException ioe)
        {
          throw new SAXException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_OIERROR, null),ioe); //"IO error", ioe);
        }
      }
      */
      else
      {
        super.cdata(ch, start, length);
      }
    }
  
    /**
     *  Receive notification of a processing instruction.
     * 
     *  @param target The processing instruction target.
     *  @param data The processing instruction data, or null if
     *         none was supplied.
     *  @exception org.xml.sax.SAXException Any SAX exception, possibly
     *             wrapping another exception.
     *
     * @throws SAXException
     */
    public void processingInstruction(String target, String data)
            throws SAXException
    {
  
      // Use a fairly nasty hack to tell if the next node is supposed to be 
      // unescaped text.
      if (target.equals("xslt-next-is-raw") && data.equals("formatter-to-dom"))
      {
        m_disableOutputEscapingStates.setTop(true);
      }
      else
      {
        writeParentTagEnd();
  
        if (shouldIndent())
          indent(m_currentIndent);
  
        this.accum("<?" + target);
  
        if (data.length() > 0 &&!Character.isSpaceChar(data.charAt(0)))
          this.accum(" ");
  
        this.accum(data + ">");  // different from XML
  
        m_startNewLine = true;
      }
    }
  
    /**
     * Receive notivication of a entityReference.
     *
     * NEEDSDOC @param name
     *
     * @throws SAXException
     */
    public void entityReference(String name) throws SAXException
    {
  
      this.accum("&");
      this.accum(name);
      this.accum(";");
    }
  }
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/serialize/FormatterToText.java
  
  Index: FormatterToText.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xalan" 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, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.serialize;
  
  import org.xml.sax.*;
  
  import java.util.*;
  
  import java.io.*;
  
  import org.apache.xpath.res.XPATHErrorResources;
  import org.apache.xalan.res.XSLMessages;
  import org.apache.serialize.OutputFormat;
  import org.apache.serialize.helpers.TextOutputFormat;
  
  /**
   * <meta name="usage" content="general"/>
   * This class takes SAX events (in addition to some extra events
   * that SAX doesn't handle yet) and produces simple text only.
   * Warning: this class will be replaced by the Xerces Serializer classes.
   */
  public class FormatterToText extends FormatterToXML
  {
  
    /**
     * Default constructor.
     */
    public FormatterToText()
    {
      super();
    }
  
    /**
     * Constructor using a writer.
     * @param writer        The character output stream to use.
     */
    public FormatterToText(Writer writer)
    {
      super(writer);
    }
  
    /**
     * Constructor using an output stream, and a simple OutputFormat.
     * @param writer        The character output stream to use.
     *
     * NEEDSDOC @param os
     *
     * @throws java.io.UnsupportedEncodingException
     */
    public FormatterToText(java.io.OutputStream os)
            throws java.io.UnsupportedEncodingException
    {
  
      OutputFormat of = new TextOutputFormat("UTF-8");
  
      this.init(os, of);
    }
  
    /**
     * Constructor using a writer.
     * @param writer        The character output stream to use.
     *
     * NEEDSDOC @param xmlListener
     */
    public FormatterToText(FormatterToXML xmlListener)
    {
  
      super(xmlListener);
  
      m_doIndent = true;  // TODO: But what if the user wants to set it???
    }
  
    /**
     * Receive an object for locating the origin of SAX document events.
     *
     * <p>SAX parsers are strongly encouraged (though not absolutely
     * required) to supply a locator: if it does so, it must supply
     * the locator to the application by invoking this method before
     * invoking any of the other methods in the DocumentHandler
     * interface.</p>
     *
     * <p>The locator allows the application to determine the end
     * position of any document-related event, even if the parser is
     * not reporting an error.  Typically, the application will
     * use this information for reporting its own errors (such as
     * character content that does not match an application's
     * business rules).  The information returned by the locator
     * is probably not sufficient for use with a search engine.</p>
     *
     * <p>Note that the locator will return correct information only
     * during the invocation of the events in this interface.  The
     * application should not attempt to use it at any other time.</p>
     *
     * @param locator An object that can return the location of
     *                any SAX document event.
     * @see org.xml.sax.Locator
     */
    public void setDocumentLocator(Locator locator)
    {
  
      // No action for the moment.
    }
  
    /**
     * Receive notification of the beginning of a document.
     *
     * <p>The SAX parser will invoke this method only once, before any
     * other methods in this interface or in DTDHandler (except for
     * setDocumentLocator).</p>
     *
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void startDocument() throws SAXException
    {
  
      // No action for the moment.
    }
  
    /**
     * Receive notification of the end of a document.
     *
     * <p>The SAX parser will invoke this method only once, and it will
     * be the last method invoked during the parse.  The parser shall
     * not invoke this method until it has either abandoned parsing
     * (because of an unrecoverable error) or reached the end of
     * input.</p>
     *
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void endDocument() throws SAXException
    {
      this.flush();
      flushWriter();
    }
  
    /**
     * Receive notification of the beginning of an element.
     *
     * <p>The Parser will invoke this method at the beginning of every
     * element in the XML document; there will be a corresponding
     * endElement() event for every startElement() event (even when the
     * element is empty). All of the element's content will be
     * reported, in order, before the corresponding endElement()
     * event.</p>
     *
     * <p>If the element name has a namespace prefix, the prefix will
     * still be attached.  Note that the attribute list provided will
     * contain only attributes with explicit values (specified or
     * defaulted): #IMPLIED attributes will be omitted.</p>
     *
     *
     * NEEDSDOC @param namespaceURI
     * NEEDSDOC @param localName
     * @param name The element type name.
     * @param atts The attributes attached to the element, if any.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #endElement
     * @see org.xml.sax.AttributeList
     *
     * @throws SAXException
     */
    public void startElement(
            String namespaceURI, String localName, String name, Attributes atts)
              throws SAXException
    {
  
      // No action for the moment.
    }
  
    /**
     * Receive notification of the end of an element.
     *
     * <p>The SAX parser will invoke this method at the end of every
     * element in the XML document; there will be a corresponding
     * startElement() event for every endElement() event (even when the
     * element is empty).</p>
     *
     * <p>If the element name has a namespace prefix, the prefix will
     * still be attached to the name.</p>
     *
     *
     * NEEDSDOC @param namespaceURI
     * NEEDSDOC @param localName
     * @param name The element type name
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void endElement(String namespaceURI, String localName, String name)
            throws SAXException
    {
  
      // No action for the moment.
    }
  
    /**
     * Receive notification of character data.
     *
     * <p>The Parser will call this method to report each chunk of
     * character data.  SAX parsers may return all contiguous character
     * data in a single chunk, or they may split it into several
     * chunks; however, all of the characters in any single event
     * must come from the same external entity, so that the Locator
     * provides useful information.</p>
     *
     * <p>The application must not attempt to read from the array
     * outside of the specified range.</p>
     *
     * <p>Note that some parsers will report whitespace using the
     * ignorableWhitespace() method rather than this one (validating
     * parsers must do so).</p>
     *
     * @param ch The characters from the XML document.
     * @param start The start position in the array.
     * @param length The number of characters to read from the array.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #ignorableWhitespace
     * @see org.xml.sax.Locator
     *
     * @throws SAXException
     */
    public void characters(char ch[], int start, int length) throws SAXException
    {
  
      this.accum(ch, start, length);
      this.flush();
  
      // flushWriter();
    }
  
    /**
     * If available, when the disable-output-escaping attribute is used,
     * output raw text without escaping.
     *
     * NEEDSDOC @param ch
     * NEEDSDOC @param start
     * NEEDSDOC @param length
     *
     * @throws SAXException
     */
    public void charactersRaw(char ch[], int start, int length)
            throws SAXException
    {
  
      accum(ch, start, length);
      flush();
  
      // flushWriter();
    }
  
    /**
     * Receive notification of cdata.
     *
     * <p>The Parser will call this method to report each chunk of
     * character data.  SAX parsers may return all contiguous character
     * data in a single chunk, or they may split it into several
     * chunks; however, all of the characters in any single event
     * must come from the same external entity, so that the Locator
     * provides useful information.</p>
     *
     * <p>The application must not attempt to read from the array
     * outside of the specified range.</p>
     *
     * <p>Note that some parsers will report whitespace using the
     * ignorableWhitespace() method rather than this one (validating
     * parsers must do so).</p>
     *
     * @param ch The characters from the XML document.
     * @param start The start position in the array.
     * @param length The number of characters to read from the array.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #ignorableWhitespace
     * @see org.xml.sax.Locator
     *
     * @throws SAXException
     */
    public void cdata(char ch[], int start, int length) throws SAXException
    {
  
      accum(ch, start, length);
      flush();
  
      // flushWriter();
    }
  
    /**
     * Receive notification of ignorable whitespace in element content.
     *
     * <p>Validating Parsers must use this method to report each chunk
     * of ignorable whitespace (see the W3C XML 1.0 recommendation,
     * section 2.10): non-validating parsers may also use this method
     * if they are capable of parsing and using content models.</p>
     *
     * <p>SAX parsers may return all contiguous whitespace in a single
     * chunk, or they may split it into several chunks; however, all of
     * the characters in any single event must come from the same
     * external entity, so that the Locator provides useful
     * information.</p>
     *
     * <p>The application must not attempt to read from the array
     * outside of the specified range.</p>
     *
     * @param ch The characters from the XML document.
     * @param start The start position in the array.
     * @param length The number of characters to read from the array.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #characters
     *
     * @throws SAXException
     */
    public void ignorableWhitespace(char ch[], int start, int length)
            throws SAXException
    {
  
      // No action for the moment.
    }
  
    /**
     * Receive notification of a processing instruction.
     *
     * <p>The Parser will invoke this method once for each processing
     * instruction found: note that processing instructions may occur
     * before or after the main document element.</p>
     *
     * <p>A SAX parser should never report an XML declaration (XML 1.0,
     * section 2.8) or a text declaration (XML 1.0, section 4.3.1)
     * using this method.</p>
     *
     * @param target The processing instruction target.
     * @param data The processing instruction data, or null if
     *        none was supplied.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void processingInstruction(String target, String data)
            throws SAXException
    {
  
      // No action for the moment.
    }
  
    /**
     * Called when a Comment is to be constructed.
     * @param   data  The comment data.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void comment(String data) throws SAXException
    {
  
      // No action for the moment.
    }
  
    /**
     * Receive notivication of a entityReference.
     *
     * NEEDSDOC @param name
     *
     * @throws SAXException
     */
    public void entityReference(String name) throws SAXException
    {
  
      // No action for the moment.
    }
  }
  
  
  
  1.1                  xml-xalan/java/src/org/apache/xalan/serialize/FormatterToXML.java
  
  Index: FormatterToXML.java
  ===================================================================
  /*
   * The Apache Software License, Version 1.1
   *
   *
   * Copyright (c) 1999 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 "Xalan" 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, Lotus
   * Development Corporation., http://www.lotus.com.  For more
   * information on the Apache Software Foundation, please see
   * <http://www.apache.org/>.
   */
  package org.apache.xalan.serialize;
  
  import java.io.Writer;
  import java.io.OutputStream;
  import java.io.OutputStreamWriter;
  import java.io.UnsupportedEncodingException;
  import java.io.IOException;
  
  import java.util.Enumeration;
  import java.util.Stack;
  import java.util.Vector;
  import java.util.Hashtable;
  
  import org.xml.sax.*;
  import org.xml.sax.ext.LexicalHandler;
  
  import org.apache.serialize.SerializerHandler;
  import org.apache.serialize.OutputFormat;
  import org.apache.serialize.helpers.XMLOutputFormat;
  import org.apache.serialize.Serializer;
  import org.apache.serialize.OutputFormat;
  import org.apache.serialize.DOMSerializer;
  import org.apache.serialize.QName;
  import org.apache.xalan.utils.BoolStack;
  import org.apache.xalan.res.XSLTErrorResources;
  import org.apache.xalan.res.XSLMessages;
  import org.apache.xpath.res.XPATHErrorResources;
  
  /**
   * <meta name="usage" content="general"/>
   * FormatterToXML formats SAX-style events into XML.
   * Warning: this class will be replaced by the Xerces Serializer classes.
   */
  public class FormatterToXML
          implements ContentHandler, LexicalHandler, SerializerHandler,
                     Serializer
  {
  
    /**
     * The writer where the XML will be written.
     */
    protected Writer m_writer = null;
  
    /** NEEDSDOC Field m_shouldFlush          */
    boolean m_shouldFlush = true;
  
    /** NEEDSDOC Field m_outputStream          */
    protected OutputStream m_outputStream = System.out;
  
    /** NEEDSDOC Field m_bytesEqualChars          */
    private boolean m_bytesEqualChars = false;
  
    /**
     * The character encoding.  Must match the encoding used for the printWriter.
     */
    protected String m_encoding = null;
  
    /**
     * Assume java encoding names are the same as the ISO encoding names if this is true.
     */
    static boolean javaEncodingIsISO = false;
  
    /**
     * Tells if we should write the XML declaration.
     */
    public boolean m_shouldNotWriteXMLHeader = false;
  
    /**
     * Tells the XML version, for writing out to the XML decl.
     */
    public String m_version = null;
  
    /**
     * A stack of Boolean objects that tell if the given element
     * has children.
     */
    protected BoolStack m_elemStack = new BoolStack();
  
    /** NEEDSDOC Field m_disableOutputEscapingStates          */
    protected BoolStack m_disableOutputEscapingStates = new BoolStack();
  
    /** NEEDSDOC Field m_cdataSectionStates          */
    protected BoolStack m_cdataSectionStates = new BoolStack();
  
    /**
     * NEEDSDOC Method isEscapingDisabled 
     *
     *
     * NEEDSDOC (isEscapingDisabled) @return
     */
    protected boolean isEscapingDisabled()
    {
      return m_disableOutputEscapingStates.peekOrFalse();
    }
  
    /**
     * NEEDSDOC Method isCDataSection 
     *
     *
     * NEEDSDOC (isCDataSection) @return
     */
    protected boolean isCDataSection()
    {
      return m_cdataSectionStates.peekOrFalse();
    }
  
    /**
     * Use the system line seperator to write line breaks.
     */
    protected final String m_lineSep = System.getProperty("line.separator");
  
    /**
     * The length of the line seperator, since the write is done
     * one character at a time.
     */
    protected final int m_lineSepLen = m_lineSep.length();
  
    /**
     * Output a system-dependent line break.
     *
     * @throws SAXException
     */
    protected final void outputLineSep() throws SAXException
    {
  
      for (int z = 0; z < m_lineSepLen; z++)
      {
        accum(m_lineSep.charAt(z));
      }
    }
  
    /**
     * State flag to tell if preservation of whitespace
     * is important.
     */
    protected boolean m_ispreserve = false;
  
    /**
     * Stack to keep track of whether or not we need to
     * preserve whitespace.
     */
    protected BoolStack m_preserves = new BoolStack();
  
    /**
     * State flag that tells if the previous node processed
     * was text, so we can tell if we should preserve whitespace.
     */
    protected boolean m_isprevtext = false;
  
    /**
     * Flag to tell if indenting (pretty-printing) is on.
     */
    protected boolean m_doIndent = false;
  
    /**
     * Flag to keep track of the indent amount.
     */
    protected int m_currentIndent = 0;
  
    /**
     * Amount to indent.
     */
    public int indent = 0;
  
    /**
     * Current level of indent.
     */
    protected int level = 0;
  
    /**
     * Flag to signal that a newline should be added.
     */
    boolean m_startNewLine;
  
    /**
     * Flag to tell that we need to add the doctype decl,
     * which we can't do until the first element is
     * encountered.
     */
    boolean m_needToOutputDocTypeDecl = true;
  
    /**
     * The System ID for the doc type.
     */
    String m_doctypeSystem;
  
    /**
     * The public ID for the doc type.
     */
    String m_doctypePublic;
  
    /**
     * The standalone value for the doctype.
     */
    boolean m_standalone = false;
  
    /**
     * The mediatype.  Not used right now.
     */
    String m_mediatype;
  
    /**
     * Tells if we're in an EntityRef event.
     */
    protected boolean m_inEntityRef = false;
  
    /**
     * These are characters that will be escaped in the output.
     */
  
    // public char[] m_attrSpecialChars = {'<', '>', '&', '\"', '\r', '\n'};
    public char[] m_attrSpecialChars = { '<', '>', '&', '\"' };
  
    /** NEEDSDOC Field SPECIALSSIZE          */
    static final int SPECIALSSIZE = 256;
  
    /** NEEDSDOC Field m_attrCharsMap          */
    public char[] m_attrCharsMap = new char[SPECIALSSIZE];
  
    /** NEEDSDOC Field m_charsMap          */
    public char[] m_charsMap = new char[SPECIALSSIZE];
  
    /**
     * Set the attribute characters what will require special mapping.
     */
    protected void initAttrCharsMap()
    {
  
      int n = (m_maxCharacter > SPECIALSSIZE) ? SPECIALSSIZE : m_maxCharacter;
  
      for (int i = 0; i < n; i++)
      {
        m_attrCharsMap[i] = '\0';
      }
  
      int nSpecials = m_attrSpecialChars.length;
  
      for (int i = 0; i < nSpecials; i++)
      {
        m_attrCharsMap[(int) m_attrSpecialChars[i]] = 'S';
      }
  
      m_attrCharsMap[0x0A] = 'S';
      m_attrCharsMap[0x0D] = 'S';
  
      for (int i = m_maxCharacter; i < SPECIALSSIZE; i++)
      {
        m_attrCharsMap[i] = 'S';
      }
    }
  
    /**
     * Set the characters what will require special mapping.
     */
    protected void initCharsMap()
    {
  
      initAttrCharsMap();
  
      int n = (m_maxCharacter > SPECIALSSIZE) ? SPECIALSSIZE : m_maxCharacter;
  
      for (int i = 0; i < n; i++)
      {
        m_charsMap[i] = '\0';
      }
  
      m_charsMap[(int) '\n'] = 'S';
      m_charsMap[(int) '<'] = 'S';
      m_charsMap[(int) '>'] = 'S';
      m_charsMap[(int) '&'] = 'S';
  
      for (int i = 0; i < 20; i++)
      {
        m_charsMap[i] = 'S';
      }
  
      m_charsMap[0x0A] = 'S';
      m_charsMap[0x0D] = 'S';
      m_charsMap[9] = '\0';
  
      for (int i = m_maxCharacter; i < SPECIALSSIZE; i++)
      {
        m_charsMap[i] = 'S';
      }
    }
  
    /**
     * Flag to quickly tell if the encoding is UTF8.
     */
    boolean m_isUTF8;
  
    /**
     * The maximum character size before we have to resort
     * to escaping.
     */
    int m_maxCharacter = Encodings.getLastPrintable();
  
    /**
     * Add space before '/>' for XHTML.
     */
    public boolean m_spaceBeforeClose = false;
  
    /** NEEDSDOC Field DEFAULT_MIME_ENCODING          */
    static final String DEFAULT_MIME_ENCODING = "UTF-8";
  
    /** NEEDSDOC Field m_format          */
    protected OutputFormat m_format;
  
    /**
     * Default constructor.
     */
    public FormatterToXML(){}
  
    /**
     * Constructor using a writer.
     * @param writer        The character output stream to use.
     */
    public FormatterToXML(Writer writer)
    {
      m_shouldFlush = false;
      m_writer = writer;
    }
  
    /**
     * Constructor using an output stream, and a simple OutputFormat.
     * @param writer        The character output stream to use.
     *
     * NEEDSDOC @param os
     *
     * @throws UnsupportedEncodingException
     */
    public FormatterToXML(java.io.OutputStream os)
            throws UnsupportedEncodingException
    {
  
      OutputFormat of = new XMLOutputFormat();
  
      init(os, of);
    }
  
    /**
     * Constructor using a writer.
     * @param writer        The character output stream to use.
     *
     * NEEDSDOC @param xmlListener
     */
    public FormatterToXML(FormatterToXML xmlListener)
    {
  
      m_writer = xmlListener.m_writer;
      m_outputStream = xmlListener.m_outputStream;
      m_bytesEqualChars = xmlListener.m_bytesEqualChars;
      m_encoding = xmlListener.m_encoding;
      javaEncodingIsISO = xmlListener.javaEncodingIsISO;
      m_shouldNotWriteXMLHeader = xmlListener.m_shouldNotWriteXMLHeader;
      m_shouldNotWriteXMLHeader = xmlListener.m_shouldNotWriteXMLHeader;
      m_elemStack = xmlListener.m_elemStack;
  
      // m_lineSep = xmlListener.m_lineSep;
      // m_lineSepLen = xmlListener.m_lineSepLen;
      m_ispreserve = xmlListener.m_ispreserve;
      m_preserves = xmlListener.m_preserves;
      m_isprevtext = xmlListener.m_isprevtext;
      m_doIndent = xmlListener.m_doIndent;
      m_currentIndent = xmlListener.m_currentIndent;
      indent = xmlListener.indent;
      level = xmlListener.level;
      m_startNewLine = xmlListener.m_startNewLine;
      m_needToOutputDocTypeDecl = xmlListener.m_needToOutputDocTypeDecl;
      m_doctypeSystem = xmlListener.m_doctypeSystem;
      m_doctypePublic = xmlListener.m_doctypePublic;
      m_standalone = xmlListener.m_standalone;
      m_mediatype = xmlListener.m_mediatype;
      m_attrSpecialChars = xmlListener.m_attrSpecialChars;
      m_attrCharsMap = xmlListener.m_attrCharsMap;
      m_charsMap = xmlListener.m_charsMap;
      m_maxCharacter = xmlListener.m_maxCharacter;
      m_spaceBeforeClose = xmlListener.m_spaceBeforeClose;
      m_inCData = xmlListener.m_inCData;
      m_charBuf = xmlListener.m_charBuf;
      m_byteBuf = xmlListener.m_byteBuf;
  
      // m_pos = xmlListener.m_pos;
      m_pos = 0;
  
      initCharsMap();
    }
  
    /**
     * Initialize the serializer with the specified writer and output format.
     * Must be called before calling any of the serialize methods.
     *
     * @param writer The writer to use
     * @param format The output format
     */
    public synchronized void init(Writer writer, OutputFormat format)
    {
      init(writer, format, false);
    }
  
    /**
     * Initialize the serializer with the specified writer and output format.
     * Must be called before calling any of the serialize methods.
     *
     * @param writer The writer to use
     * @param format The output format
     * NEEDSDOC @param shouldFlush
     */
    private synchronized void init(Writer writer, OutputFormat format,
                                   boolean shouldFlush)
    {
  
      m_shouldFlush = shouldFlush;
      m_writer = writer;
      m_format = format;
  
      // This is to get around differences between Xalan and Xerces.
      // Xalan uses -1 as default for no indenting, Xerces uses 0.
      // So we just adjust the indent value here because we bumped it
      // up previously ( in StylesheetRoot);
      indent = format.getIndentAmount() - 1;
      m_doIndent = format.getIndent();
      m_shouldNotWriteXMLHeader = format.getOmitXMLDeclaration();
      m_doctypeSystem = format.getDoctypeSystemId();
      m_doctypePublic = format.getDoctypePublicId();
      m_standalone = format.getStandalone();
      m_mediatype = format.getMediaType();
  
      if (null != m_doctypePublic)
      {
        if (m_doctypePublic.startsWith("-//W3C//DTD XHTML"))
          m_spaceBeforeClose = true;
      }
  
      // initCharsMap();
      if (null == m_encoding)
        m_encoding = Encodings.getMimeEncoding(format.getEncoding());
  
      m_isUTF8 = m_encoding.equals(DEFAULT_MIME_ENCODING);
      m_maxCharacter = Encodings.getLastPrintable(m_encoding);
  
      initCharsMap();
    }
  
    /**
     * Initialize the serializer with the specified output stream and output format.
     * Must be called before calling any of the serialize methods.
     *
     * @param output The output stream to use
     * @param format The output format
     * @throws UnsupportedEncodingException The encoding specified
     *   in the output format is not supported
     */
    public synchronized void init(OutputStream output, OutputFormat format)
            throws UnsupportedEncodingException
    {
  
      m_encoding = Encodings.getMimeEncoding(format.getEncoding());
  
      if (m_encoding.equals("WINDOWS-1250") || m_encoding.equals("US-ASCII")
              || m_encoding.equals("ASCII"))
      {
        m_bytesEqualChars = true;
        m_outputStream = output;
  
        init((Writer) null, format, true);
      }
      else
      {
        Writer osw;
  
        try
        {
          osw = Encodings.getWriter(output, m_encoding);
        }
        catch (UnsupportedEncodingException uee)
        {
          System.out.println("Warning: encoding \"" + m_encoding
                             + "\" not supported" + ", using "
                             + Encodings.DEFAULT_MIME_ENCODING);
  
          m_encoding = Encodings.DEFAULT_MIME_ENCODING;
          osw = Encodings.getWriter(output, m_encoding);
        }
  
        m_maxCharacter = Encodings.getLastPrintable(m_encoding);
  
        init(osw, format, true);
      }
    }
  
    /**
     * Receive an object for locating the origin of SAX document events.
     *
     * @param locator An object that can return the location of
     *                any SAX document event.
     * @see org.xml.sax.Locator
     */
    public void setDocumentLocator(Locator locator)
    {
  
      // I don't do anything with this yet.
    }
  
    /**
     * Output the doc type declaration.
     *
     * NEEDSDOC @param name
     *
     * @throws SAXException
     */
    void outputDocTypeDecl(String name) throws SAXException
    {
  
      accum("<!DOCTYPE ");
      accum(name);
  
      if (null != m_doctypePublic)
      {
        accum(" PUBLIC \"");
        accum(m_doctypePublic);
        accum("\"");
      }
  
      if (null == m_doctypePublic)
        accum(" SYSTEM \"");
      else
        accum(" \"");
  
      accum(m_doctypeSystem);
      accum("\">");
      outputLineSep();
    }
  
    /**
     * Receive notification of the beginning of a document.
     *
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void startDocument() throws SAXException
    {
  
      if (m_inEntityRef)
        return;
  
      m_needToOutputDocTypeDecl = true;
      m_startNewLine = false;
  
      if (m_shouldNotWriteXMLHeader == false)
      {
        String encoding = Encodings.getMimeEncoding(m_encoding);
        String version = (null == m_version) ? "1.0" : m_version;
        String standalone = (m_standalone) ? " standalone=\"yes\"" : "";
  
        accum("<?xml version=\"" + version + "\" encoding=\"" + encoding + "\""
              + standalone + "?>");
        outputLineSep();
      }
    }
  
    /**
     * Receive notification of the end of a document.
     *
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void endDocument() throws SAXException
    {
  
      if (m_doIndent &&!m_isprevtext)
      {
        outputLineSep();
      }
  
      flush();
      flushWriter();
    }
  
    /**
     * Report the start of DTD declarations, if any.
     *
     * Any declarations are assumed to be in the internal subset
     * unless otherwise indicated.
     *
     * @param name The document type name.
     * @param publicId The declared public identifier for the
     *        external DTD subset, or null if none was declared.
     * @param systemId The declared system identifier for the
     *        external DTD subset, or null if none was declared.
     * @exception SAXException The application may raise an
     *            exception.
     * @see #endDTD
     * @see #startEntity
     */
    public void startDTD(String name, String publicId, String systemId)
            throws SAXException
    {
  
      // Do nothing for now.
    }
  
    /**
     * Report the end of DTD declarations.
     *
     * @exception SAXException The application may raise an exception.
     * @see #startDTD
     */
    public void endDTD() throws SAXException
    {
  
      // Do nothing for now.
    }
  
    /**
     * NEEDSDOC Method startPrefixMapping 
     *
     *
     * NEEDSDOC @param prefix
     * NEEDSDOC @param uri
     *
     * @throws SAXException
     */
    public void startPrefixMapping(String prefix, String uri)
            throws SAXException{}
  
    /**
     * NEEDSDOC Method endPrefixMapping 
     *
     *
     * NEEDSDOC @param prefix
     *
     * @throws SAXException
     */
    public void endPrefixMapping(String prefix) throws SAXException{}
  
    /**
     * NEEDSDOC Method subPartMatch 
     *
     *
     * NEEDSDOC @param p
     * NEEDSDOC @param t
     *
     * NEEDSDOC (subPartMatch) @return
     */
    protected static final boolean subPartMatch(String p, String t)
    {
      return (p == t) || ((null != p) && (p.equals(t)));
    }
  
    /**
     * Push a boolean state based on if the name of the element
     * is found in the list of qnames.  A state is always pushed,
     * one way or the other.
     *
     * NEEDSDOC @param namespaceURI
     * NEEDSDOC @param localName
     * NEEDSDOC @param qnames
     * NEEDSDOC @param state
     */
    protected void pushState(String namespaceURI, String localName,
                             QName[] qnames, BoolStack state)
    {
  
      boolean b;
  
      if (null != qnames)
      {
        b = false;
  
        if ((null != namespaceURI) && namespaceURI.length() == 0)
          namespaceURI = null;
  
        int nElems = qnames.length;
  
        for (int i = 0; i < nElems; i++)
        {
          QName q = qnames[i];
  
          if (q.getLocalName().equals(localName)
                  && subPartMatch(namespaceURI, q.getNamespaceURI()))
          {
            b = true;
            ;
  
            break;
          }
        }
      }
      else
      {
        b = state.peekOrFalse();
      }
  
      state.push(b);
    }
  
    /**
     * Receive notification of the beginning of an element.
     *
     *
     * NEEDSDOC @param namespaceURI
     * NEEDSDOC @param localName
     * @param name The element type name.
     * @param atts The attributes attached to the element, if any.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #endElement
     * @see org.xml.sax.AttributeList
     *
     * @throws SAXException
     */
    public void startElement(
            String namespaceURI, String localName, String name, Attributes atts)
              throws SAXException
    {
  
      if (m_inEntityRef)
        return;
  
      if ((true == m_needToOutputDocTypeDecl) && (null != m_doctypeSystem))
      {
        outputDocTypeDecl(name);
      }
  
      m_needToOutputDocTypeDecl = false;
  
      writeParentTagEnd();
      pushState(namespaceURI, localName, m_format.getCDataElements(),
                m_cdataSectionStates);
      pushState(namespaceURI, localName, m_format.getNonEscapingElements(),
                m_disableOutputEscapingStates);
  
      m_ispreserve = false;
  
      //  System.out.println(name+": m_doIndent = "+m_doIndent+", m_ispreserve = "+m_ispreserve+", m_isprevtext = "+m_isprevtext);
      if (shouldIndent() && m_startNewLine)
      {
        indent(m_currentIndent);
      }
  
      m_startNewLine = true;
  
      accum('<');
      accum(name);
  
      int nAttrs = atts.getLength();
  
      for (int i = 0; i < nAttrs; i++)
      {
        processAttribute(atts.getQName(i), atts.getValue(i));
      }
  
      // Flag the current element as not yet having any children.
      openElementForChildren();
  
      m_currentIndent += indent;
      m_isprevtext = false;
    }
  
    /**
     * Check to see if a parent's ">" has been written, and, if
     * it has not, write it.
     *
     * @throws SAXException
     */
    protected void writeParentTagEnd() throws SAXException
    {
  
      if (!m_elemStack.isEmpty())
      {
  
        // See if the parent element has already been flagged as having children.
        if ((false == m_elemStack.peek()))
        {
          accum('>');
  
          m_isprevtext = false;
  
          m_elemStack.pop();
          m_elemStack.push(true);
          m_preserves.push(m_ispreserve);
        }
      }
    }
  
    /**
     * Flag the current element as not yet having any
     * children.
     */
    protected void openElementForChildren()
    {
  
      // Flag the current element as not yet having any children.
      m_elemStack.push(false);
    }
  
    /**
     * Tell if child nodes have been added to the current
     * element.  Must be called in balance with openElementForChildren().
     *
     * NEEDSDOC ($objectName$) @return
     */
    protected boolean childNodesWereAdded()
    {
      return m_elemStack.isEmpty() ? false : m_elemStack.pop();
    }
  
    /**
     * Receive notification of the end of an element.
     *
     *
     * NEEDSDOC @param namespaceURI
     * NEEDSDOC @param localName
     * @param name The element type name
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void endElement(String namespaceURI, String localName, String name)
            throws SAXException
    {
  
      if (m_inEntityRef)
        return;
  
      m_currentIndent -= indent;
  
      boolean hasChildNodes = childNodesWereAdded();
  
      if (hasChildNodes)
      {
        if (shouldIndent())
          indent(m_currentIndent);
  
        accum('<');
        accum('/');
        accum(name);
        accum('>');
      }
      else
      {
        if (m_spaceBeforeClose)
          accum(" />");
        else
          accum("/>");
      }
  
      if (hasChildNodes)
      {
        m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
      }
  
      m_isprevtext = false;
  
      m_disableOutputEscapingStates.pop();
      m_cdataSectionStates.pop();
    }
  
    /**
     * Process an attribute.
     * @param   name   The name of the attribute.
     * @param   value   The value of the attribute.
     *
     * @throws SAXException
     */
    protected void processAttribute(String name, String value)
            throws SAXException
    {
  
      accum(' ');
      accum(name);
      accum("=\"");
      writeAttrString(value, m_encoding);
      accum('\"');
    }
  
    /**
     * Starts an un-escaping section. All characters printed within an
     * un-escaping section are printed as is, without escaping special
     * characters into entity references. Only XML and HTML serializers
     * need to support this method.
     * <p>
     * The contents of the un-escaping section will be delivered through
     * the regular <tt>characters</tt> event.
     *
     * @throws SAXException
     */
    public void startNonEscaping() throws SAXException
    {
      m_disableOutputEscapingStates.push(true);
    }
  
    /**
     * Ends an un-escaping section.
     *
     * @see #startNonEscaping
     *
     * @throws SAXException
     */
    public void endNonEscaping() throws SAXException
    {
      m_disableOutputEscapingStates.pop();
    }
  
    /**
     * Starts a whitespace preserving section. All characters printed
     * within a preserving section are printed without indentation and
     * without consolidating multiple spaces. This is equivalent to
     * the <tt>xml:space=&quot;preserve&quot;</tt> attribute. Only XML
     * and HTML serializers need to support this method.
     * <p>
     * The contents of the whitespace preserving section will be delivered
     * through the regular <tt>characters</tt> event.
     *
     * @throws SAXException
     */
    public void startPreserving() throws SAXException
    {
  
      // Not sure this is really what we want.  -sb
      m_preserves.push(true);
  
      m_ispreserve = true;
    }
  
    /**
     * Ends a whitespace preserving section.
     *
     * @see #startPreserving
     *
     * @throws SAXException
     */
    public void endPreserving() throws SAXException
    {
  
      // Not sure this is really what we want.  -sb
      m_ispreserve = m_preserves.isEmpty() ? false : m_preserves.pop();
    }
  
    /**
     * Receive notification of a processing instruction.
     *
     * @param target The processing instruction target.
     * @param data The processing instruction data, or null if
     *        none was supplied.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     *
     * @throws SAXException
     */
    public void processingInstruction(String target, String data)
            throws SAXException
    {
  
      if (m_inEntityRef)
        return;
  
      // Use a fairly nasty hack to tell if the next node is supposed to be 
      // unescaped text.
      if (target.equals("xslt-next-is-raw") && data.equals("formatter-to-dom"))
      {
        m_disableOutputEscapingStates.setTop(true);
      }
      else
      {
        writeParentTagEnd();
  
        if (shouldIndent())
          indent(m_currentIndent);
  
        accum('<');
        accum('?');
        accum(target);
  
        if (data.length() > 0 &&!Character.isSpaceChar(data.charAt(0)))
          accum(' ');
  
        accum(data);
        accum('?');
        accum('>');
  
        m_startNewLine = true;
      }
    }
  
    /**
     * Report an XML comment anywhere in the document.
     *
     * This callback will be used for comments inside or outside the
     * document element, including comments in the external DTD
     * subset (if read).
     *
     * @param ch An array holding the characters in the comment.
     * @param start The starting position in the array.
     * @param length The number of characters to use from the array.
     * @exception SAXException The application may raise an exception.
     */
    public void comment(char ch[], int start, int length) throws SAXException
    {
  
      if (m_inEntityRef)
        return;
  
      writeParentTagEnd();
  
      if (shouldIndent())
        indent(m_currentIndent);
  
      accum("<!--");
      accum(ch, start, length);
      accum("-->");
  
      m_startNewLine = true;
    }
  
    /** NEEDSDOC Field m_inCData          */
    protected boolean m_inCData = false;
  
    /**
     * Report the start of a CDATA section.
     *
     * @exception SAXException The application may raise an exception.
     * @see #endCDATA
     */
    public void startCDATA() throws SAXException
    {
      m_inCData = true;
    }
  
    /**
     * Report the end of a CDATA section.
     *
     * @exception SAXException The application may raise an exception.
     * @see #startCDATA
     */
    public void endCDATA() throws SAXException
    {
      m_inCData = false;
    }
  
    /**
     * Receive notification of cdata.
     *
     * <p>The Parser will call this method to report each chunk of
     * character data.  SAX parsers may return all contiguous character
     * data in a single chunk, or they may split it into several
     * chunks; however, all of the characters in any single event
     * must come from the same external entity, so that the Locator
     * provides useful information.</p>
     *
     * <p>The application must not attempt to read from the array
     * outside of the specified range.</p>
     *
     * <p>Note that some parsers will report whitespace using the
     * ignorableWhitespace() method rather than this one (validating
     * parsers must do so).</p>
     *
     * @param ch The characters from the XML document.
     * @param start The start position in the array.
     * @param length The number of characters to read from the array.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #ignorableWhitespace
     * @see org.xml.sax.Locator
     *
     * @throws SAXException
     */
    public void cdata(char ch[], int start, int length) throws SAXException
    {
  
      try
      {
        writeParentTagEnd();
  
        m_ispreserve = true;
  
        if (shouldIndent())
          indent(m_currentIndent);
  
        boolean writeCDataBrackets = (((length >= 1)
                                       && (ch[start] <= m_maxCharacter)));
  
        if (writeCDataBrackets)
        {
          accum("<![CDATA[");
        }
  
        // accum(ch, start, length);
        if (isEscapingDisabled())
        {
          charactersRaw(ch, start, length);
        }
        else
          writeNormalizedChars(ch, start, length, true);
  
        if (writeCDataBrackets)
        {
          accum("]]>");
        }
      }
      catch (IOException ioe)
      {
        throw new SAXException(
          XSLMessages.createXPATHMessage(XPATHErrorResources.ER_OIERROR, null),
          ioe);  //"IO error", ioe);
      }
    }
  
    /** NEEDSDOC Field MAXCHARBUF          */
    static final int MAXCHARBUF = (4 * 1024);
  
    /** NEEDSDOC Field NUMBERBYTESTOWRITEDIRECT          */
    static final int NUMBERBYTESTOWRITEDIRECT = (1024);
  
    /** NEEDSDOC Field m_charBuf          */
    protected char[] m_charBuf = new char[MAXCHARBUF];
  
    /** NEEDSDOC Field m_byteBuf          */
    protected byte[] m_byteBuf = new byte[MAXCHARBUF];
  
    /** NEEDSDOC Field m_pos          */
    protected int m_pos = 0;
  
    /**
     * Append a byte to the buffer.
     *
     * NEEDSDOC @param b
     *
     * @throws SAXException
     */
    protected final void accum(byte b) throws SAXException
    {
  
      if (m_bytesEqualChars)
      {
        m_byteBuf[m_pos++] = b;
  
        if (m_pos >= MAXCHARBUF)
          flushBytes();
      }
      else
      {
        m_charBuf[m_pos++] = (char) b;
  
        if (m_pos >= MAXCHARBUF)
          flushChars();
      }
    }
  
    /**
     * Append a character to the buffer.
     *
     * NEEDSDOC @param b
     *
     * @throws SAXException
     */
    protected final void accum(char b) throws SAXException
    {
  
      if (m_bytesEqualChars)
      {
        m_byteBuf[m_pos++] = (byte) b;
  
        if (m_pos >= MAXCHARBUF)
          flushBytes();
      }
      else
      {
        m_charBuf[m_pos++] = b;
  
        if (m_pos >= MAXCHARBUF)
          flushChars();
      }
    }
  
    /**
     * Append a character to the buffer.
     *
     * NEEDSDOC @param chars
     * NEEDSDOC @param start
     * NEEDSDOC @param length
     *
     * @throws SAXException
     */
    protected final void accum(char chars[], int start, int length)
            throws SAXException
    {
  
      int n = start + length;
  
      if (m_bytesEqualChars)
      {
        for (int i = start; i < n; i++)
        {
          m_byteBuf[m_pos++] = (byte) chars[i];
  
          if (m_pos >= MAXCHARBUF)
            flushBytes();
        }
      }
      else
      {
        if (length >= NUMBERBYTESTOWRITEDIRECT)
        {
          if (m_pos != 0)
            flushChars();
  
          try
          {
            m_writer.write(chars, start, length);
          }
          catch (IOException ioe)
          {
            throw new SAXException(ioe);
          }
        }
        else
        {
          if ((m_pos + length) >= MAXCHARBUF)
            flushChars();
  
          // if(1 == length)
          //   m_charBuf[m_pos] = chars[start];
          // else
          System.arraycopy(chars, start, m_charBuf, m_pos, length);
  
          m_pos += length;
        }
      }
    }
  
    /**
     * Append a character to the buffer.
     *
     * NEEDSDOC @param s
     *
     * @throws SAXException
     */
    protected final void accum(String s) throws SAXException
    {
  
      int n = s.length();
  
      if (m_bytesEqualChars)
      {
        char[] chars = s.toCharArray();
  
        for (int i = 0; i < n; i++)
        {
          m_byteBuf[m_pos++] = (byte) chars[i];
          ;
  
          if (m_pos >= MAXCHARBUF)
            flushBytes();
        }
      }
      else
      {
        if (n >= NUMBERBYTESTOWRITEDIRECT)
        {
          if (m_pos != 0)
            flushChars();
  
          try
          {
            m_writer.write(s);
          }
          catch (IOException ioe)
          {
            throw new SAXException(ioe);
          }
        }
        else
        {
          for (int i = 0; i < n; i++)
          {
            m_charBuf[m_pos++] = s.charAt(i);
            ;
  
            if (m_pos >= MAXCHARBUF)
              flushChars();
          }
        }
      }
    }
  
    /**
     * NEEDSDOC Method flushBytes 
     *
     *
     * @throws SAXException
     */
    private final void flushBytes() throws SAXException
    {
  
      try
      {
        m_outputStream.write(m_byteBuf, 0, m_pos);
  
        m_pos = 0;
      }
      catch (IOException ioe)
      {
        throw new SAXException(ioe);
      }
    }
  
    /**
     * Flush the formatter's result stream.
     *
     * @throws SAXException
     */
    public final void flushWriter() throws SAXException
    {
  
      if (m_shouldFlush && (null != m_writer))
      {
        try
        {
          m_writer.flush();
        }
        catch (IOException ioe)
        {
          throw new SAXException(ioe);
        }
      }
    }
  
    /**
     * NEEDSDOC Method flushChars 
     *
     *
     * @throws SAXException
     */
    private final void flushChars() throws SAXException
    {
  
      try
      {
        m_writer.write(m_charBuf, 0, m_pos);
  
        m_pos = 0;
      }
      catch (IOException ioe)
      {
        throw new SAXException(ioe);
      }
    }
  
    /**
     * NEEDSDOC Method flush 
     *
     *
     * @throws SAXException
     */
    public final void flush() throws SAXException
    {
  
      if (m_bytesEqualChars)
      {
        flushBytes();
      }
      else
      {
        flushChars();
      }
    }
  
    /**
     * Receive notification of character data.
     *
     * <p>The Parser will call this method to report each chunk of
     * character data.  SAX parsers may return all contiguous character
     * data in a single chunk, or they may split it into several
     * chunks; however, all of the characters in any single event
     * must come from the same external entity, so that the Locator
     * provides useful information.</p>
     *
     * <p>The application must not attempt to read from the array
     * outside of the specified range.</p>
     *
     * <p>Note that some parsers will report whitespace using the
     * ignorableWhitespace() method rather than this one (validating
     * parsers must do so).</p>
     *
     * @param chars The characters from the XML document.
     * @param start The start position in the array.
     * @param length The number of characters to read from the array.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #ignorableWhitespace
     * @see org.xml.sax.Locator
     *
     * @throws SAXException
     */
    public void characters(char chars[], int start, int length)
            throws SAXException
    {
  
      if (m_inEntityRef)
        return;
  
      if (0 == length)
        return;
  
      if (isCDataSection())
      {
        cdata(chars, start, length);
  
        return;
      }
  
      if (isEscapingDisabled())
      {
        charactersRaw(chars, start, length);
  
        return;
      }
  
      writeParentTagEnd();
  
      m_ispreserve = true;
  
      int startClean = start;
      int lengthClean = 0;
  
      // int pos = 0;
      int end = start + length;
  
      for (int i = start; i < end; i++)
      {
        char ch = chars[i];
  
        if ((ch < SPECIALSSIZE) && (m_charsMap[ch] != 'S'))
        {
  
          // accum(ch);
          lengthClean++;
        }
        else
        {
          if (lengthClean > 0)
          {
            accum(chars, startClean, lengthClean);
  
            lengthClean = 0;
          }
  
          startClean = accumDefaultEscape(ch, i, chars, end, false);
          i = startClean - 1;
        }
      }
  
      if (lengthClean > 0)
      {
        accum(chars, startClean, lengthClean);
      }
  
      m_isprevtext = true;
    }
  
    /**
     * If available, when the disable-output-escaping attribute is used,
     * output raw text without escaping.
     *
     * NEEDSDOC @param ch
     * NEEDSDOC @param start
     * NEEDSDOC @param length
     *
     * @throws SAXException
     */
    public void charactersRaw(char ch[], int start, int length)
            throws SAXException
    {
  
      if (m_inEntityRef)
        return;
  
      writeParentTagEnd();
  
      m_ispreserve = true;
  
      accum(ch, start, length);
    }
  
    /**
     * Normalize the characters, but don't escape.
     *
     * NEEDSDOC @param ch
     * NEEDSDOC @param start
     * NEEDSDOC @param length
     * NEEDSDOC @param isCData
     *
     * @throws IOException
     * @throws SAXException
     */
    void writeNormalizedChars(char ch[], int start, int length, boolean isCData)
            throws IOException, SAXException
    {
  
      int end = start + length;
  
      for (int i = start; i < end; i++)
      {
        char c = ch[i];
  
        if ((0x0D == c) && ((i + 1) < end) && (0x0A == ch[i + 1]))
        {
          outputLineSep();
  
          i++;
        }
        else if ((0x0A == c) && ((i + 1) < end) && (0x0D == ch[i + 1]))
        {
          outputLineSep();
  
          i++;
        }
        else if ('\n' == c)
        {
          outputLineSep();
        }
        else if (isCData && (c > m_maxCharacter))
        {
          if (i != 0)
            accum("]]>");
  
          // This needs to go into a function... 
          if (0xd800 <= ((int) c) && ((int) c) < 0xdc00)
          {
  
            // UTF-16 surrogate
            int next;
  
            if (i + 1 >= end)
            {
              throw new SAXException(
                XSLMessages.createXPATHMessage(
                  XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                  new Object[]{ Integer.toHexString((int) c) }));  //"Invalid UTF-16 surrogate detected: "
  
              //+Integer.toHexString((int)c)+ " ?");
            }
            else
            {
              next = ch[++i];
  
              if (!(0xdc00 <= next && next < 0xe000))
                throw new SAXException(
                  XSLMessages.createXPATHMessage(
                    XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                    new Object[]{
                      Integer.toHexString((int) c) + " "
                      + Integer.toHexString(next) }));  //"Invalid UTF-16 surrogate detected: "
  
              //+Integer.toHexString((int)c)+" "+Integer.toHexString(next));
              next = ((c - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
            }
  
            accum('&');
            accum('#');
  
            // accum('x');
            accum(Integer.toString(next));
            accum(';');
          }
          else
          {
            accum("&#");
  
            String intStr = Integer.toString((int) c);
  
            accum(intStr);
            accum(';');
          }
  
          if ((i != 0) && (i < (end - 1)))
            accum("<![CDATA[");
        }
        else if (isCData
                 && ((i < (end - 2)) && (']' == c) && (']' == ch[i + 1])
                     && ('>' == ch[i + 2])))
        {
          accum("]]]]><![CDATA[>");
  
          i += 2;
        }
        else
        {
          if (c <= m_maxCharacter)
          {
            accum(c);
          }
  
          // This needs to go into a function... 
          else if (0xd800 <= ((int) c) && ((int) c) < 0xdc00)
          {
  
            // UTF-16 surrogate
            int next;
  
            if (i + 1 >= end)
            {
              throw new SAXException(
                XSLMessages.createXPATHMessage(
                  XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                  new Object[]{ Integer.toHexString((int) c) }));  //"Invalid UTF-16 surrogate detected: "
  
              //+Integer.toHexString((int)c)+ " ?");
            }
            else
            {
              next = ch[++i];
  
              if (!(0xdc00 <= next && next < 0xe000))
                throw new SAXException(
                  XSLMessages.createXPATHMessage(
                    XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                    new Object[]{
                      Integer.toHexString((int) c) + " "
                      + Integer.toHexString(next) }));  //"Invalid UTF-16 surrogate detected: "
  
              //+Integer.toHexString((int)c)+" "+Integer.toHexString(next));
              next = ((c - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
            }
  
            accum("&#");
            accum(Integer.toString(next));
            accum(";");
          }
          else
          {
            accum("&#");
  
            String intStr = Integer.toString((int) c);
  
            accum(intStr);
            accum(';');
          }
        }
      }
    }
  
    /**
     * Receive notification of ignorable whitespace in element content.
     *
     * Not sure how to get this invoked quite yet.
     *
     * @param ch The characters from the XML document.
     * @param start The start position in the array.
     * @param length The number of characters to read from the array.
     * @exception org.xml.sax.SAXException Any SAX exception, possibly
     *            wrapping another exception.
     * @see #characters
     *
     * @throws SAXException
     */
    public void ignorableWhitespace(char ch[], int start, int length)
            throws SAXException
    {
  
      if (0 == length)
        return;
  
      characters(ch, start, length);
    }
  
    /**
     * NEEDSDOC Method skippedEntity 
     *
     *
     * NEEDSDOC @param name
     *
     * @throws SAXException
     */
    public void skippedEntity(String name) throws SAXException
    {
  
      // TODO: Should handle
    }
  
    /**
     * Report the beginning of an entity.
     *
     * The start and end of the document entity are not reported.
     * The start and end of the external DTD subset are reported
     * using the pseudo-name "[dtd]".  All other events must be
     * properly nested within start/end entity events.
     *
     * @param name The name of the entity.  If it is a parameter
     *        entity, the name will begin with '%'.
     * @exception SAXException The application may raise an exception.
     * @see #endEntity
     * @see org.xml.sax.misc.DeclHandler#internalEntityDecl
     * @see org.xml.sax.misc.DeclHandler#externalEntityDecl
     */
    public void startEntity(String name) throws SAXException
    {
  
      entityReference(name);
  
      m_inEntityRef = true;
    }
  
    /**
     * Report the end of an entity.
     *
     * @param name The name of the entity that is ending.
     * @exception SAXException The application may raise an exception.
     * @see #startEntity
     */
    public void endEntity(String name) throws SAXException
    {
      m_inEntityRef = false;
    }
  
    /**
     * Receive notivication of a entityReference.
     *
     * NEEDSDOC @param name
     *
     * @throws SAXException
     */
    public void entityReference(String name) throws SAXException
    {
  
      writeParentTagEnd();
  
      if (shouldIndent())
        indent(m_currentIndent);
  
      accum("&");
      accum(name);
      accum(";");
    }
  
    /**
     * Handle one of the default entities, return false if it
     * is not a default entity.
     *
     * NEEDSDOC @param ch
     * NEEDSDOC @param i
     * NEEDSDOC @param chars
     * NEEDSDOC @param len
     * NEEDSDOC @param escLF
     *
     * NEEDSDOC ($objectName$) @return
     *
     * @throws SAXException
     */
    final int accumDefaultEntity(
            char ch, int i, char[] chars, int len, boolean escLF)
              throws SAXException
    {
  
      if (!escLF && (0x0D == ch) && ((i + 1) < len) && (0x0A == chars[i + 1]))
      {
        outputLineSep();
  
        i++;
      }
      else if (!escLF && (0x0A == ch) && ((i + 1) < len)
               && (0x0D == chars[i + 1]))
      {
        outputLineSep();
  
        i++;
      }
      else if (!escLF && 0x0D == ch)
      {
        outputLineSep();
  
        i++;
      }
      else if (!escLF && '\n' == ch)
      {
        outputLineSep();
      }
      else if ('<' == ch)
      {
        accum('&');
        accum('l');
        accum('t');
        accum(';');
      }
      else if ('>' == ch)
      {
        accum('&');
        accum('g');
        accum('t');
        accum(';');
      }
      else if ('&' == ch)
      {
        accum('&');
        accum('a');
        accum('m');
        accum('p');
        accum(';');
      }
      else if ('"' == ch)
      {
        accum('&');
        accum('q');
        accum('u');
        accum('o');
        accum('t');
        accum(';');
      }
      else if ('\'' == ch)
      {
        accum('&');
        accum('a');
        accum('p');
        accum('o');
        accum('s');
        accum(';');
      }
      else
      {
        return i;
      }
  
      return i + 1;
    }
  
    /**
     * Escape and accum a character.
     *
     * NEEDSDOC @param ch
     * NEEDSDOC @param i
     * NEEDSDOC @param chars
     * NEEDSDOC @param len
     * NEEDSDOC @param escLF
     *
     * NEEDSDOC ($objectName$) @return
     *
     * @throws SAXException
     */
    final int accumDefaultEscape(
            char ch, int i, char[] chars, int len, boolean escLF)
              throws SAXException
    {
  
      int pos = accumDefaultEntity(ch, i, chars, len, escLF);
  
      if (i == pos)
      {
        pos++;
  
        if (0xd800 <= ch && ch < 0xdc00)
        {
  
          // UTF-16 surrogate
          int next;
  
          if (i + 1 >= len)
          {
            throw new SAXException(
              XSLMessages.createXPATHMessage(
                XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                new Object[]{ Integer.toHexString(ch) }));  //"Invalid UTF-16 surrogate detected: "
  
            //+Integer.toHexString(ch)+ " ?");
          }
          else
          {
            next = chars[++i];
  
            if (!(0xdc00 <= next && next < 0xe000))
              throw new SAXException(
                XSLMessages.createXPATHMessage(
                  XPATHErrorResources.ER_INVALID_UTF16_SURROGATE,
                  new Object[]{
                    Integer.toHexString(ch) + " "
                    + Integer.toHexString(next) }));  //"Invalid UTF-16 surrogate detected: "
  
            //+Integer.toHexString(ch)+" "+Integer.toHexString(next));
            next = ((ch - 0xd800) << 10) + next - 0xdc00 + 0x00010000;
          }
  
          accum("&#");
          accum(Integer.toString(next));
          accum(";");
  
          /*} else if (null != ctbc && !ctbc.canConvert(ch)) {
          sb.append("&#x");
          sb.append(Integer.toString((int)ch, 16));
          sb.append(";");*/
        }
        else
        {
          if (ch > m_maxCharacter
                  || ((ch < SPECIALSSIZE) && (m_attrCharsMap[ch] == 'S')))
          {
            accum("&#");
            accum(Integer.toString(ch));
            accum(";");
          }
          else
          {
            accum(ch);
          }
        }
      }
  
      return pos;
    }
  
    /**
     * Returns the specified <var>string</var> after substituting <VAR>specials</VAR>,
     * and UTF-16 surrogates for chracter references <CODE>&amp;#xnn</CODE>.
     *
     * @param   string      String to convert to XML format.
     * @param   specials    Chracters, should be represeted in chracter referenfces.
     * @param   encoding    CURRENTLY NOT IMPLEMENTED.
     * @return              XML-formatted string.
     * @see #backReference
     *
     * @throws SAXException
     */
    public void writeAttrString(String string, String encoding)
            throws SAXException
    {
  
      char[] stringChars = string.toCharArray();
      int len = stringChars.length;
  
      for (int i = 0; i < len; i++)
      {
        char ch = stringChars[i];
  
        if ((ch < SPECIALSSIZE) && (m_attrCharsMap[ch] != 'S'))
          accum(ch);
        else
          accumDefaultEscape(ch, i, stringChars, len, true);
      }
    }
  
    /**
     * NEEDSDOC Method shouldIndent 
     *
     *
     * NEEDSDOC (shouldIndent) @return
     */
    protected boolean shouldIndent()
    {
      return m_doIndent && (!m_ispreserve &&!m_isprevtext);
    }
  
    /**
     * Prints <var>n</var> spaces.
     * @param pw        The character output stream to use.
     * @param n         Number of spaces to print.
     * @exception IOException   Thrown if <var>pw</var> is invalid.
     *
     * @throws SAXException
     */
    public void printSpace(int n) throws SAXException
    {
  
      for (int i = 0; i < n; i++)
      {
        accum(' ');
      }
    }
  
    /**
     * Prints a newline character and <var>n</var> spaces.
     * @param pw        The character output stream to use.
     * @param n         Number of spaces to print.
     * @exception IOException   Thrown if <var>pw</var> is invalid.
     *
     * @throws SAXException
     */
    public void indent(int n) throws SAXException
    {
  
      if (m_startNewLine)
        outputLineSep();
  
      if (m_doIndent)
      {
        printSpace(n);
      }
    }
  
    /**
     * Specifies an output stream to which the document should be
     * serialized. This method should not be called while the
     * serializer is in the process of serializing a document.
     * <p>
     * The encoding specified in the {@link OutputFormat} is used, or
     * if no encoding was specified, the default for the selected
     * output method.
     *
     * @param output The output stream
     */
    public void setOutputStream(OutputStream output)
    {
  
      try
      {
        init(output, m_format);
      }
      catch (UnsupportedEncodingException uee)
      {
  
        // Should have been warned in init, I guess...
      }
    }
  
    /**
     * NEEDSDOC Method getOutputStream 
     *
     *
     * NEEDSDOC (getOutputStream) @return
     */
    public OutputStream getOutputStream()
    {
      return m_outputStream;
    }
  
    /**
     * Specifies a writer to which the document should be serialized.
     * This method should not be called while the serializer is in
     * the process of serializing a document.
     * <p>
     * The encoding specified for the {@link OutputFormat} must be
     * identical to the output format used with the writer.
     *
     * @param writer The output writer stream
     */
    public void setWriter(Writer writer)
    {
      m_writer = writer;
    }
  
    /**
     * NEEDSDOC Method getWriter 
     *
     *
     * NEEDSDOC (getWriter) @return
     */
    public Writer getWriter()
    {
      return m_writer;
    }
  
    /**
     * Specifies an output format for this serializer. It the
     * serializer has already been associated with an output format,
     * it will switch to the new format. This method should not be
     * called while the serializer is in the process of serializing
     * a document.
     *
     * @param format The output format to use
     */
    public void setOutputFormat(OutputFormat format)
    {
  
      boolean shouldFlush = m_shouldFlush;
  
      init(m_writer, format, false);
  
      m_shouldFlush = shouldFlush;
    }
  
    /**
     * Returns the output format for this serializer.
     *
     * @return The output format in use
     */
    public OutputFormat getOutputFormat()
    {
      return m_format;
    }
  
    /**
     * Return a {@link DocumentHandler} interface into this serializer.
     * If the serializer does not support the {@link DocumentHandler}
     * interface, it should return null.
     *
     * @return A {@link DocumentHandler} interface into this serializer,
     *  or null if the serializer is not SAX 1 capable
     * @throws IOException An I/O exception occured
     */
    public DocumentHandler asDocumentHandler() throws IOException
    {
      return null;  // at least for now
    }
  
    /**
     * Return a {@link ContentHandler} interface into this serializer.
     * If the serializer does not support the {@link ContentHandler}
     * interface, it should return null.
     *
     * @return A {@link ContentHandler} interface into this serializer,
     *  or null if the serializer is not SAX 2 capable
     * @throws IOException An I/O exception occured
     */
    public ContentHandler asContentHandler() throws IOException
    {
      return this;
    }
  
    /**
     * Return a {@link DOMSerializer} interface into this serializer.
     * If the serializer does not support the {@link DOMSerializer}
     * interface, it should return null.
     *
     * @return A {@link DOMSerializer} interface into this serializer,
     *  or null if the serializer is not DOM capable
     * @throws IOException An I/O exception occured
     */
    public DOMSerializer asDOMSerializer() throws IOException
    {
      return null;  // for now
    }
  
    /**
     * Resets the serializer. If this method returns true, the
     * serializer may be used for subsequent serialization of new
     * documents. It is possible to change the output format and
     * output stream prior to serializing, or to use the existing
     * output format and output stream.
     *
     * @return True if serializer has been reset and can be reused
     */
    public boolean reset()
    {
      return false;
    }
  }  //ToXMLStringVisitor
  
  
  
  
  1.2       +21 -15    xml-xalan/java/src/org/apache/xalan/trace/GenerateEvent.java
  
  Index: GenerateEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/GenerateEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- GenerateEvent.java	2000/06/19 16:53:00	1.1
  +++ GenerateEvent.java	2000/10/30 18:56:51	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -57,8 +57,11 @@
   package org.apache.xalan.trace;
   
   import org.xml.sax.*;
  +
   import java.util.*;
  +
   import java.io.*;
  +
   import org.apache.xalan.transformer.TransformerImpl;
   
   /**
  @@ -71,10 +74,11 @@
    * @see org.apache.xalan.utils.FormatterToHTML
    * @see org.apache.xalan.utils.FormatterToText
    * @see org.apache.xalan.utils.FormatterToXML
  -
  + *
    */
  -public class GenerateEvent  implements java.util.EventListener
  +public class GenerateEvent implements java.util.EventListener
   {
  +
     /**
      * The XSLT Processor, which either directly or indirectly contains most needed information.
      * Accessing the m_stylesheetRoot member variable will get you to the stylesheet information.
  @@ -190,9 +194,10 @@
      * @param name The name of the element.
      * @param atts The SAX attribute list.
      */
  -  public GenerateEvent(TransformerImpl processor, int eventType,
  -                         String name, Attributes atts)
  +  public GenerateEvent(TransformerImpl processor, int eventType, String name,
  +                       Attributes atts)
     {
  +
       m_name = name;
       m_atts = atts;
       m_processor = processor;
  @@ -208,9 +213,10 @@
      * @param start The start offset to be used in the char array.
      * @param length The end offset to be used in the chara array.
      */
  -  public GenerateEvent(TransformerImpl processor, int eventType,
  -                         char ch[], int start, int length)
  +  public GenerateEvent(TransformerImpl processor, int eventType, char ch[],
  +                       int start, int length)
     {
  +
       m_characters = ch;
       m_start = start;
       m_length = length;
  @@ -226,9 +232,10 @@
      * @param name The name of the processing instruction.
      * @param data The processing instruction data.
      */
  -  public GenerateEvent(TransformerImpl processor, int eventType,
  -                         String name, String data)
  +  public GenerateEvent(TransformerImpl processor, int eventType, String name,
  +                       String data)
     {
  +
       m_name = name;
       m_data = data;
       m_processor = processor;
  @@ -242,12 +249,11 @@
      * @param eventType One of the EVENTTYPE_XXX constants.
      * @param data The comment or entity ref data.
      */
  -  public GenerateEvent(TransformerImpl processor, int eventType,
  -                         String data)
  +  public GenerateEvent(TransformerImpl processor, int eventType, String data)
     {
  +
       m_data = data;
       m_processor = processor;
       m_eventtype = eventType;
     }
  -
   }
  
  
  
  1.2       +97 -73    xml-xalan/java/src/org/apache/xalan/trace/PrintTraceListener.java
  
  Index: PrintTraceListener.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/PrintTraceListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PrintTraceListener.java	2000/06/19 16:53:00	1.1
  +++ PrintTraceListener.java	2000/10/30 18:56:52	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -60,6 +60,7 @@
   
   import org.w3c.dom.*;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import org.apache.xalan.templates.ElemTemplate;
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.templates.ElemTextLiteral;
  @@ -74,8 +75,11 @@
    */
   public class PrintTraceListener implements TraceListener
   {
  +
     /**
      * Construct a trace listener.
  +   *
  +   * NEEDSDOC @param pw
      */
     public PrintTraceListener(java.io.PrintWriter pw)
     {
  @@ -114,45 +118,50 @@
      */
     public void trace(TracerEvent ev)
     {
  -    switch(ev.m_styleNode.getXSLToken())
  +
  +    switch (ev.m_styleNode.getXSLToken())
       {
  -    case Constants.ELEMNAME_TEXTLITERALRESULT:
  -      if(m_traceElements)
  +    case Constants.ELEMNAME_TEXTLITERALRESULT :
  +      if (m_traceElements)
         {
  -        m_pw.print("Line #"+ev.m_styleNode.getLineNumber()+", "+
  -                         "Column #"+ev.m_styleNode.getColumnNumber()+" -- "+
  -                         ev.m_styleNode.getNodeName()+": ");
  -        ElemTextLiteral etl = (ElemTextLiteral)ev.m_styleNode;
  +        m_pw.print("Line #" + ev.m_styleNode.getLineNumber() + ", "
  +                   + "Column #" + ev.m_styleNode.getColumnNumber() + " -- "
  +                   + ev.m_styleNode.getNodeName() + ": ");
  +
  +        ElemTextLiteral etl = (ElemTextLiteral) ev.m_styleNode;
           String chars = new String(etl.getChars(), 0, etl.getChars().length);
  -        m_pw.println("    "+chars.trim());
  +
  +        m_pw.println("    " + chars.trim());
         }
         break;
  -    case Constants.ELEMNAME_TEMPLATE:
  -      if(m_traceTemplates || m_traceElements)
  +    case Constants.ELEMNAME_TEMPLATE :
  +      if (m_traceTemplates || m_traceElements)
         {
  -        ElemTemplate et = (ElemTemplate)ev.m_styleNode;
  -        m_pw.print("Line #"+et.getLineNumber()+", "+
  -                           "Column #"+et.getColumnNumber()+": "+
  -                           et.getNodeName()+" ");
  -        if(null != et.getMatch())
  +        ElemTemplate et = (ElemTemplate) ev.m_styleNode;
  +
  +        m_pw.print("Line #" + et.getLineNumber() + ", " + "Column #"
  +                   + et.getColumnNumber() + ": " + et.getNodeName() + " ");
  +
  +        if (null != et.getMatch())
           {
  -          m_pw.print("match='"+et.getMatch().getPatternString()+"' ");
  +          m_pw.print("match='" + et.getMatch().getPatternString() + "' ");
           }
  -        if(null != et.getName())
  +
  +        if (null != et.getName())
           {
  -          m_pw.print("name='"+et.getName()+"' ");
  +          m_pw.print("name='" + et.getName() + "' ");
           }
  +
           m_pw.println();
         }
         break;
  -    default:
  -      if(m_traceElements)
  +    default :
  +      if (m_traceElements)
         {
  -        m_pw.println("Line #"+ev.m_styleNode.getLineNumber()+", "+
  -                           "Column #"+ev.m_styleNode.getColumnNumber()+": "+
  -                           ev.m_styleNode.getNodeName());
  +        m_pw.println("Line #" + ev.m_styleNode.getLineNumber() + ", "
  +                     + "Column #" + ev.m_styleNode.getColumnNumber() + ": "
  +                     + ev.m_styleNode.getNodeName());
         }
  -
       }
     }
   
  @@ -160,52 +169,65 @@
      * Method that is called just after the formatter listener is called.
      *
      * @param ev the generate event.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void selected(SelectionEvent ev)
  -    throws org.xml.sax.SAXException
  +  public void selected(SelectionEvent ev) throws org.xml.sax.SAXException
     {
  -    if(m_traceSelection)
  +
  +    if (m_traceSelection)
       {
  -      ElemTemplateElement ete = (ElemTemplateElement)ev.m_styleNode;
  -      if(ev.m_styleNode.getLineNumber() == 0)
  +      ElemTemplateElement ete = (ElemTemplateElement) ev.m_styleNode;
  +
  +      if (ev.m_styleNode.getLineNumber() == 0)
         {
  +
           // You may not have line numbers if the selection is occuring from a
           // default template.
  -        ElemTemplateElement parent = (ElemTemplateElement)ete.getParentNode();
  -        if(parent == ete.getStylesheetRoot().getDefaultRootRule())
  +        ElemTemplateElement parent =
  +          (ElemTemplateElement) ete.getParentNode();
  +
  +        if (parent == ete.getStylesheetRoot().getDefaultRootRule())
           {
             m_pw.print("(default root rule) ");
           }
  -        else if(parent == ete.getStylesheetRoot().getDefaultTextRule())
  +        else if (parent == ete.getStylesheetRoot().getDefaultTextRule())
           {
             m_pw.print("(default text rule) ");
           }
  -        else if(parent == ete.getStylesheetRoot().getDefaultRule())
  +        else if (parent == ete.getStylesheetRoot().getDefaultRule())
           {
             m_pw.print("(default rule) ");
           }
  -        m_pw.print(ete.getNodeName()+", "+ev.m_attributeName+"='"+ev.m_xpath.getPatternString()+"': ");
  +
  +        m_pw.print(ete.getNodeName() + ", " + ev.m_attributeName + "='"
  +                   + ev.m_xpath.getPatternString() + "': ");
         }
         else
         {
  -        m_pw.print("Line #"+ev.m_styleNode.getLineNumber()+", "+
  -                         "Column #"+ev.m_styleNode.getColumnNumber()+": "+
  -                         ete.getNodeName()+", "+ev.m_attributeName+"='"+ev.m_xpath.getPatternString()+"': ");
  +        m_pw.print("Line #" + ev.m_styleNode.getLineNumber() + ", "
  +                   + "Column #" + ev.m_styleNode.getColumnNumber() + ": "
  +                   + ete.getNodeName() + ", " + ev.m_attributeName + "='"
  +                   + ev.m_xpath.getPatternString() + "': ");
         }
  -      if(ev.m_selection.getType() == ev.m_selection.CLASS_NODESET)
  +
  +      if (ev.m_selection.getType() == ev.m_selection.CLASS_NODESET)
         {
           m_pw.println();
  +
           NodeIterator nl = ev.m_selection.nodeset();
           Node pos = nl.nextNode();
  -        if(null == pos)
  +
  +        if (null == pos)
           {
             m_pw.println("     [empty node list]");
           }
           else
           {
  -          while(null != pos)
  +          while (null != pos)
             {
  -            m_pw.println("     "+pos);
  +            m_pw.println("     " + pos);
  +
               pos = nl.nextNode();
             }
           }
  @@ -224,48 +246,50 @@
      */
     public void generated(GenerateEvent ev)
     {
  -    if(m_traceGeneration)
  +
  +    if (m_traceGeneration)
       {
  -      switch(ev.m_eventtype)
  +      switch (ev.m_eventtype)
         {
  -      case GenerateEvent.EVENTTYPE_STARTDOCUMENT:
  +      case GenerateEvent.EVENTTYPE_STARTDOCUMENT :
           m_pw.println("STARTDOCUMENT");
           break;
  -      case GenerateEvent.EVENTTYPE_ENDDOCUMENT:
  +      case GenerateEvent.EVENTTYPE_ENDDOCUMENT :
           m_pw.println("ENDDOCUMENT");
           break;
  -      case GenerateEvent.EVENTTYPE_STARTELEMENT:
  -        m_pw.println("STARTELEMENT: "+ev.m_name);
  +      case GenerateEvent.EVENTTYPE_STARTELEMENT :
  +        m_pw.println("STARTELEMENT: " + ev.m_name);
           break;
  -      case GenerateEvent.EVENTTYPE_ENDELEMENT:
  -        m_pw.println("ENDELEMENT: "+ev.m_name);
  -        break;
  -      case GenerateEvent.EVENTTYPE_CHARACTERS:
  -        {
  -          String chars = new String(ev.m_characters, ev.m_start, ev.m_length);
  -          m_pw.println("CHARACTERS: "+chars);
  -        }
  -        break;
  -      case GenerateEvent.EVENTTYPE_CDATA:
  -        {
  -          String chars = new String(ev.m_characters, ev.m_start, ev.m_length);
  -          m_pw.println("CDATA: "+chars);
  -        }
  +      case GenerateEvent.EVENTTYPE_ENDELEMENT :
  +        m_pw.println("ENDELEMENT: " + ev.m_name);
           break;
  -      case GenerateEvent.EVENTTYPE_COMMENT:
  -        m_pw.println("COMMENT: "+ev.m_data);
  +      case GenerateEvent.EVENTTYPE_CHARACTERS :
  +      {
  +        String chars = new String(ev.m_characters, ev.m_start, ev.m_length);
  +
  +        m_pw.println("CHARACTERS: " + chars);
  +      }
  +      break;
  +      case GenerateEvent.EVENTTYPE_CDATA :
  +      {
  +        String chars = new String(ev.m_characters, ev.m_start, ev.m_length);
  +
  +        m_pw.println("CDATA: " + chars);
  +      }
  +      break;
  +      case GenerateEvent.EVENTTYPE_COMMENT :
  +        m_pw.println("COMMENT: " + ev.m_data);
           break;
  -      case GenerateEvent.EVENTTYPE_PI:
  -        m_pw.println("PI: "+ev.m_name+", "+ev.m_data);
  +      case GenerateEvent.EVENTTYPE_PI :
  +        m_pw.println("PI: " + ev.m_name + ", " + ev.m_data);
           break;
  -      case GenerateEvent.EVENTTYPE_ENTITYREF:
  -        m_pw.println("ENTITYREF: "+ev.m_name);
  +      case GenerateEvent.EVENTTYPE_ENTITYREF :
  +        m_pw.println("ENTITYREF: " + ev.m_name);
           break;
  -      case GenerateEvent.EVENTTYPE_IGNORABLEWHITESPACE:
  +      case GenerateEvent.EVENTTYPE_IGNORABLEWHITESPACE :
           m_pw.println("IGNORABLEWHITESPACE");
           break;
         }
       }
     }
  -
   }
  
  
  
  1.3       +14 -12    xml-xalan/java/src/org/apache/xalan/trace/SelectionEvent.java
  
  Index: SelectionEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/SelectionEvent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SelectionEvent.java	2000/07/05 14:42:44	1.2
  +++ SelectionEvent.java	2000/10/30 18:56:52	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -69,6 +69,7 @@
    */
   public class SelectionEvent implements java.util.EventListener
   {
  +
     /**
      * The node in the style tree where the event occurs.
      */
  @@ -106,14 +107,16 @@
      * @param mode The current mode.
      * @param m_styleNode node in the style tree reference for the event.
      * Should not be null.  That is not enforced.
  -   */
  -  public SelectionEvent(TransformerImpl processor,
  -                     Node sourceNode,
  -                     ElemTemplateElement styleNode,
  -                     String attributeName,
  -                     XPath xpath,
  -                     XObject selection)
  +   * NEEDSDOC @param styleNode
  +   * NEEDSDOC @param attributeName
  +   * NEEDSDOC @param xpath
  +   * NEEDSDOC @param selection
  +   */
  +  public SelectionEvent(TransformerImpl processor, Node sourceNode,
  +                        ElemTemplateElement styleNode, String attributeName,
  +                        XPath xpath, XObject selection)
     {
  +
       this.m_processor = processor;
       this.m_sourceNode = sourceNode;
       this.m_styleNode = styleNode;
  @@ -121,5 +124,4 @@
       this.m_xpath = xpath;
       this.m_selection = selection;
     }
  -
   }
  
  
  
  1.2       +8 -7      xml-xalan/java/src/org/apache/xalan/trace/TraceListener.java
  
  Index: TraceListener.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TraceListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TraceListener.java	2000/06/19 16:53:00	1.1
  +++ TraceListener.java	2000/10/30 18:56:52	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -68,6 +68,7 @@
    */
   public interface TraceListener extends java.util.EventListener
   {
  +
     /**
      * Method that is called when a trace event occurs.
      * The method is blocking.  It must return before processing continues.
  @@ -80,9 +81,10 @@
      * Method that is called just after the formatter listener is called.
      *
      * @param ev the generate event.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void selected(SelectionEvent ev)
  -    throws org.xml.sax.SAXException;
  +  public void selected(SelectionEvent ev) throws org.xml.sax.SAXException;
   
     /**
      * Method that is called just after the formatter listener is called.
  @@ -90,5 +92,4 @@
      * @param ev the generate event.
      */
     public void generated(GenerateEvent ev);
  -
   }
  
  
  
  1.4       +79 -39    xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java
  
  Index: TraceManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TraceManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TraceManager.java	2000/10/17 19:10:04	1.3
  +++ TraceManager.java	2000/10/30 18:56:53	1.4
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -58,7 +58,9 @@
   
   import java.util.Vector;
   import java.util.TooManyListenersException;
  +
   import org.w3c.dom.Node;
  +
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.transformer.TransformerImpl;
  @@ -66,21 +68,25 @@
   import org.apache.xpath.XPath;
   
   /**
  - * This class manages trace listeners, and acts as an 
  + * This class manages trace listeners, and acts as an
    * interface for the tracing functionality in Xalan.
    */
   public class TraceManager
   {
  +
  +  /** NEEDSDOC Field m_transformer          */
     private TransformerImpl m_transformer;
  -  
  +
     /**
      * Constructor for the trace manager.
  +   *
  +   * NEEDSDOC @param transformer
      */
     public TraceManager(TransformerImpl transformer)
     {
       m_transformer = transformer;
     }
  -  
  +
     /**
      * List of listeners who are interested in tracing what's
      * being generated.
  @@ -90,13 +96,18 @@
     /**
      * Add a trace listener for the purposes of debugging and diagnosis.
      * @param tl Trace listener to be added.
  +   *
  +   * @throws TooManyListenersException
      */
     public void addTraceListener(TraceListener tl)
  -    throws TooManyListenersException
  +          throws TooManyListenersException
     {
  +
       TransformerImpl.S_DEBUG = true;
  -    if(null == m_traceListeners)
  +
  +    if (null == m_traceListeners)
         m_traceListeners = new Vector();
  +
       m_traceListeners.addElement(tl);
     }
   
  @@ -106,7 +117,8 @@
      */
     public void removeTraceListener(TraceListener tl)
     {
  -    if(null != m_traceListeners)
  +
  +    if (null != m_traceListeners)
       {
         m_traceListeners.removeElement(tl);
       }
  @@ -114,89 +126,117 @@
   
     /**
      * Fire a generate event.
  +   *
  +   * NEEDSDOC @param te
      */
     public void fireGenerateEvent(GenerateEvent te)
     {
  -    if(null != m_traceListeners)
  +
  +    if (null != m_traceListeners)
       {
         int nListeners = m_traceListeners.size();
  -      for(int i = 0; i < nListeners; i++)
  +
  +      for (int i = 0; i < nListeners; i++)
         {
  -        TraceListener tl = (TraceListener)m_traceListeners.elementAt(i);
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +
           tl.generated(te);
         }
       }
     }
  -  
  +
     /**
      * Tell if trace listeners are present.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean hasTraceListeners()
     {
       return (null != m_traceListeners);
     }
  -  
  +
     /**
      * Fire a trace event.
  +   *
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param mode
  +   * NEEDSDOC @param styleNode
      */
  -  public void fireTraceEvent(Node sourceNode,
  -                             QName mode,
  +  public void fireTraceEvent(Node sourceNode, QName mode,
                                ElemTemplateElement styleNode)
     {
  -    if(hasTraceListeners())
  +
  +    if (hasTraceListeners())
       {
  -      fireTraceEvent(new TracerEvent(m_transformer,  
  -                                     sourceNode, mode, styleNode));
  +      fireTraceEvent(new TracerEvent(m_transformer, sourceNode, mode,
  +                                     styleNode));
       }
     }
   
  -  
     /**
      * Fire a trace event.
  +   *
  +   * NEEDSDOC @param te
      */
     public void fireTraceEvent(TracerEvent te)
     {
  -    if(hasTraceListeners())
  +
  +    if (hasTraceListeners())
       {
         int nListeners = m_traceListeners.size();
  -      for(int i = 0; i < nListeners; i++)
  +
  +      for (int i = 0; i < nListeners; i++)
         {
  -        TraceListener tl = (TraceListener)m_traceListeners.elementAt(i);
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +
           tl.trace(te);
         }
       }
     }
  -  
  +
     /**
      * Fire a selection event.
  -   */
  -  public void fireSelectedEvent(Node sourceNode,
  -                                ElemTemplateElement styleNode,
  -                                String attributeName,
  -                                XPath xpath,
  -                                XObject selection)
  -    throws org.xml.sax.SAXException
  -  {
  -    if(hasTraceListeners())
  -      fireSelectedEvent(new SelectionEvent(m_transformer, sourceNode, styleNode, 
  -                                           attributeName, xpath, selection));
  +   *
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param styleNode
  +   * NEEDSDOC @param attributeName
  +   * NEEDSDOC @param xpath
  +   * NEEDSDOC @param selection
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public void fireSelectedEvent(
  +          Node sourceNode, ElemTemplateElement styleNode, String attributeName, XPath xpath, XObject selection)
  +            throws org.xml.sax.SAXException
  +  {
  +
  +    if (hasTraceListeners())
  +      fireSelectedEvent(new SelectionEvent(m_transformer, sourceNode,
  +                                           styleNode, attributeName, xpath,
  +                                           selection));
     }
   
     /**
      * Fire a selection event.
  +   *
  +   * NEEDSDOC @param se
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public void fireSelectedEvent(SelectionEvent se)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    if(hasTraceListeners())
  +
  +    if (hasTraceListeners())
       {
         int nListeners = m_traceListeners.size();
  -      for(int i = 0; i < nListeners; i++)
  +
  +      for (int i = 0; i < nListeners; i++)
         {
  -        TraceListener tl = (TraceListener)m_traceListeners.elementAt(i);
  +        TraceListener tl = (TraceListener) m_traceListeners.elementAt(i);
  +
           tl.selected(se);
         }
       }
     }
  -
   }
  
  
  
  1.2       +39 -26    xml-xalan/java/src/org/apache/xalan/trace/TracerEvent.java
  
  Index: TracerEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/trace/TracerEvent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TracerEvent.java	2000/06/19 16:53:00	1.1
  +++ TracerEvent.java	2000/10/30 18:56:53	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -69,6 +69,7 @@
    */
   public class TracerEvent implements java.util.EventListener
   {
  +
     /**
      * The node in the style tree where the event occurs.
      */
  @@ -96,12 +97,12 @@
      * @param mode The current mode.
      * @param m_styleNode node in the style tree reference for the event.
      * Should not be null.  That is not enforced.
  +   * NEEDSDOC @param styleNode
      */
  -  public TracerEvent(TransformerImpl processor,
  -                     Node sourceNode,
  -                     QName mode,
  +  public TracerEvent(TransformerImpl processor, Node sourceNode, QName mode,
                        ElemTemplateElement styleNode)
     {
  +
       this.m_processor = processor;
       this.m_sourceNode = sourceNode;
       this.m_mode = mode;
  @@ -109,38 +110,43 @@
     }
   
     /**
  -   Returns a string representation of the node.
  -   The string returned for elements will contain the element name
  -   and any attributes enclosed in angle brackets.
  -   The string returned for attributes will be of form, "name=value."
  -
  -   @param n any DOM node. Must not be null.
  -
  -   @return a string representation of the given node.
  +   * Returns a string representation of the node.
  +   * The string returned for elements will contain the element name
  +   * and any attributes enclosed in angle brackets.
  +   * The string returned for attributes will be of form, "name=value."
  +   *
  +   * @param n any DOM node. Must not be null.
  +   *
  +   * @return a string representation of the given node.
      */
     public static String printNode(Node n)
     {
  +
       String r = n.hashCode() + " ";
   
       if (n instanceof Element)
       {
  -      r += "<"+n.getNodeName();
  +      r += "<" + n.getNodeName();
  +
         Node c = n.getFirstChild();
  +
         while (null != c)
         {
           if (c instanceof Attr)
           {
             r += printNode(c) + " ";
           }
  +
           c = c.getNextSibling();
         }
  +
         r += ">";
       }
       else
       {
         if (n instanceof Attr)
         {
  -        r += n.getNodeName()+"="+n.getNodeValue();
  +        r += n.getNodeName() + "=" + n.getNodeValue();
         }
         else
         {
  @@ -152,38 +158,45 @@
     }
   
     /**
  -   Returns a string representation of the node list.
  -   The string will contain the list of nodes inside square braces.
  -   Elements will contain the element name
  -   and any attributes enclosed in angle brackets.
  -   Attributes will be of form, "name=value."
  -
  -   @param l any DOM node list. Must not be null.
  -
  -   @return a string representation of the given node list.
  +   * Returns a string representation of the node list.
  +   * The string will contain the list of nodes inside square braces.
  +   * Elements will contain the element name
  +   * and any attributes enclosed in angle brackets.
  +   * Attributes will be of form, "name=value."
  +   *
  +   * @param l any DOM node list. Must not be null.
  +   *
  +   * @return a string representation of the given node list.
      */
     public static String printNodeList(NodeList l)
     {
  +
       String r = l.hashCode() + "[";
       int len = l.getLength() - 1;
       int i = 0;
  +
       while (i < len)
       {
         Node n = l.item(i);
  +
         if (null != n)
         {
           r += printNode(n) + ", ";
         }
  +
         ++i;
       }
  +
       if (i == len)
       {
         Node n = l.item(len);
  +
         if (null != n)
         {
           r += printNode(n);
         }
       }
  +
       return r + "]";
     }
   }
  
  
  
  1.4       +202 -107  xml-xalan/java/src/org/apache/xalan/transformer/ClonerToResultTree.java
  
  Index: ClonerToResultTree.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ClonerToResultTree.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ClonerToResultTree.java	2000/10/17 19:11:56	1.3
  +++ ClonerToResultTree.java	2000/10/30 18:56:56	1.4
  @@ -1,6 +1,63 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.transformer;
   
   import org.apache.xalan.templates.Stylesheet;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.Text;
   import org.w3c.dom.Attr;
  @@ -8,163 +65,201 @@
   import org.w3c.dom.CDATASection;
   import org.w3c.dom.ProcessingInstruction;
   import org.w3c.dom.EntityReference;
  +
   import org.xml.sax.SAXException;
   import org.xml.sax.Attributes;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
   import org.apache.xalan.res.XSLTErrorResources;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class ClonerToResultTree <needs-comment/>
  + */
   public class ClonerToResultTree
   {
  +
  +  /** NEEDSDOC Field m_rth          */
     private ResultTreeHandler m_rth;
  +
  +  /** NEEDSDOC Field m_transformer          */
     private TransformerImpl m_transformer;
  -  
  -  public ClonerToResultTree(TransformerImpl transformer, ResultTreeHandler rth)
  +
  +  /**
  +   * Constructor ClonerToResultTree
  +   *
  +   *
  +   * NEEDSDOC @param transformer
  +   * NEEDSDOC @param rth
  +   */
  +  public ClonerToResultTree(TransformerImpl transformer,
  +                            ResultTreeHandler rth)
     {
       m_rth = rth;
       m_transformer = transformer;
     }
  -  
  +
     /**
      * Clone an element with or without children.
      * TODO: Fix or figure out node clone failure!
      * the error condition is severe enough to halt processing.
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param shouldCloneAttributes
  +   *
  +   * @throws SAXException
      */
  -  public void cloneToResultTree(Node node,
  -                                boolean shouldCloneAttributes)
  -    throws SAXException
  +  public void cloneToResultTree(Node node, boolean shouldCloneAttributes)
  +          throws SAXException
     {
  +
       boolean stripWhiteSpace = false;
       XPathContext xctxt = m_transformer.getXPathContext();
       DOMHelper dhelper = xctxt.getDOMHelper();
   
  -    switch(node.getNodeType())
  +    switch (node.getNodeType())
  +    {
  +    case Node.TEXT_NODE :
       {
  -    case Node.TEXT_NODE:
  +      Text tx = (Text) node;
  +      String data = null;
  +
  +      // System.out.println("stripWhiteSpace = "+stripWhiteSpace+", "+tx.getData());
  +      if (stripWhiteSpace)
         {
  -        Text tx = (Text)node;
  -        String data = null;
  -        // System.out.println("stripWhiteSpace = "+stripWhiteSpace+", "+tx.getData());
  -        if(stripWhiteSpace)
  +        if (!dhelper.isIgnorableWhitespace(tx))
           {
  -          if(!dhelper.isIgnorableWhitespace(tx))
  +          data = tx.getData();
  +
  +          if ((null != data) && (0 == data.trim().length()))
             {
  -            data = tx.getData();
  -            if((null != data) && (0 == data.trim().length()))
  -            {
  -              data = null;
  -            }
  +            data = null;
             }
           }
  -        else
  +      }
  +      else
  +      {
  +        Node parent = node.getParentNode();
  +
  +        if (null != parent)
           {
  -          Node parent = node.getParentNode();
  -          if(null != parent)
  +          if (Node.DOCUMENT_NODE != parent.getNodeType())
             {
  -            if( Node.DOCUMENT_NODE != parent.getNodeType())
  -            {
  -              data = tx.getData();
  -              if((null != data) && (0 == data.length()))
  -              {
  -                data = null;
  -              }
  -            }
  -          }
  -          else
  -          {
               data = tx.getData();
  -            if((null != data) && (0 == data.length()))
  +
  +            if ((null != data) && (0 == data.length()))
               {
                 data = null;
               }
             }
           }
  -
  -        if(null != data)
  +        else
           {
  -          // TODO: Hack around the issue of comments next to literals.
  -          // This would be, when a comment is present, the whitespace
  -          // after the comment must be added to the literal.  The
  -          // parser should do this, but XML4J doesn't seem to.
  -          // <foo>some lit text
  -          //     <!-- comment -->
  -          //     </foo>
  -          // Loop through next siblings while they are comments, then,
  -          // if the node after that is a ignorable text node, append
  -          // it to the text node just added.
  -          if(dhelper.isIgnorableWhitespace(tx))
  -          {
  -            m_rth.ignorableWhitespace(data.toCharArray(), 0, data.length());
  -          }
  -          else
  +          data = tx.getData();
  +
  +          if ((null != data) && (0 == data.length()))
             {
  -            m_rth.characters(data.toCharArray(), 0, data.length());
  +            data = null;
             }
           }
         }
  -      break;
  -    case Node.DOCUMENT_NODE:
  -      // Can't clone a document, but refrain from throwing an error
  -      // so that copy-of will work
  -      break;
  -    case Node.ELEMENT_NODE:
  +
  +      if (null != data)
         {
  -        Attributes atts;
  -        if(shouldCloneAttributes)
  +
  +        // TODO: Hack around the issue of comments next to literals.
  +        // This would be, when a comment is present, the whitespace
  +        // after the comment must be added to the literal.  The
  +        // parser should do this, but XML4J doesn't seem to.
  +        // <foo>some lit text
  +        //     <!-- comment -->
  +        //     </foo>
  +        // Loop through next siblings while they are comments, then,
  +        // if the node after that is a ignorable text node, append
  +        // it to the text node just added.
  +        if (dhelper.isIgnorableWhitespace(tx))
           {
  -          m_rth.addAttributes( node );
  -          m_rth.processNSDecls(node);
  +          m_rth.ignorableWhitespace(data.toCharArray(), 0, data.length());
           }
  -        String ns = dhelper.getNamespaceOfNode(node);
  -        String localName = dhelper.getLocalNameOfNode(node);
  -        m_rth.startElement (ns, localName, node.getNodeName());
  -      }
  -      break;
  -    case Node.CDATA_SECTION_NODE:
  -      {
  -        m_rth.startCDATA();
  -        String data = ((CDATASection)node).getData();
  -        m_rth.characters(data.toCharArray(), 0, data.length());
  -        m_rth.endCDATA();
  -      }
  -      break;
  -    case Node.ATTRIBUTE_NODE:
  -      {
  -        if(m_rth.isDefinedNSDecl((Attr)node))
  -          break; 
  -        
  -        String ns = dhelper.getNamespaceOfNode(node);
  -        String localName = dhelper.getLocalNameOfNode(node);
  -        m_rth.addAttribute(ns, localName, node.getNodeName(), "CDATA", 
  -                     ((Attr)node).getValue());
  -      }
  -      break;
  -    case Node.COMMENT_NODE:
  -      {
  -        m_rth.comment(((Comment)node).getData());
  -      }
  -      break;
  -    case Node.DOCUMENT_FRAGMENT_NODE:
  -      {
  -        
  -        m_transformer.getMsgMgr().error(null, node, XSLTErrorResources.ER_NO_CLONE_OF_DOCUMENT_FRAG); //"No clone of a document fragment!");
  -      }
  -      break;
  -    case Node.ENTITY_REFERENCE_NODE:
  -      {
  -        EntityReference er = (EntityReference)node;
  -        m_rth.entityReference(er.getNodeName());
  +        else
  +        {
  +          m_rth.characters(data.toCharArray(), 0, data.length());
  +        }
         }
  +    }
  +    break;
  +    case Node.DOCUMENT_NODE :
  +
  +      // Can't clone a document, but refrain from throwing an error
  +      // so that copy-of will work
         break;
  -    case Node.PROCESSING_INSTRUCTION_NODE:
  +    case Node.ELEMENT_NODE :
  +    {
  +      Attributes atts;
  +
  +      if (shouldCloneAttributes)
         {
  -        ProcessingInstruction pi = (ProcessingInstruction)node;
  -        m_rth.processingInstruction(pi.getTarget(), pi.getData());
  +        m_rth.addAttributes(node);
  +        m_rth.processNSDecls(node);
         }
  -      break;
  -    default:
  -      m_transformer.getMsgMgr().error(XSLTErrorResources.ER_CANT_CREATE_ITEM, new Object[] {node.getNodeName()}); //"Can not create item in result tree: "+node.getNodeName());
  +
  +      String ns = dhelper.getNamespaceOfNode(node);
  +      String localName = dhelper.getLocalNameOfNode(node);
  +
  +      m_rth.startElement(ns, localName, node.getNodeName());
  +    }
  +    break;
  +    case Node.CDATA_SECTION_NODE :
  +    {
  +      m_rth.startCDATA();
  +
  +      String data = ((CDATASection) node).getData();
  +
  +      m_rth.characters(data.toCharArray(), 0, data.length());
  +      m_rth.endCDATA();
  +    }
  +    break;
  +    case Node.ATTRIBUTE_NODE :
  +    {
  +      if (m_rth.isDefinedNSDecl((Attr) node))
  +        break;
  +
  +      String ns = dhelper.getNamespaceOfNode(node);
  +      String localName = dhelper.getLocalNameOfNode(node);
  +
  +      m_rth.addAttribute(ns, localName, node.getNodeName(), "CDATA",
  +                         ((Attr) node).getValue());
       }
  +    break;
  +    case Node.COMMENT_NODE :
  +    {
  +      m_rth.comment(((Comment) node).getData());
  +    }
  +    break;
  +    case Node.DOCUMENT_FRAGMENT_NODE :
  +    {
  +      m_transformer.getMsgMgr().error(
  +        null, node, XSLTErrorResources.ER_NO_CLONE_OF_DOCUMENT_FRAG);  //"No clone of a document fragment!");
  +    }
  +    break;
  +    case Node.ENTITY_REFERENCE_NODE :
  +    {
  +      EntityReference er = (EntityReference) node;
   
  -  } // end cloneToResultTree function
  +      m_rth.entityReference(er.getNodeName());
  +    }
  +    break;
  +    case Node.PROCESSING_INSTRUCTION_NODE :
  +    {
  +      ProcessingInstruction pi = (ProcessingInstruction) node;
  +
  +      m_rth.processingInstruction(pi.getTarget(), pi.getData());
  +    }
  +    break;
  +    default :
  +      m_transformer.getMsgMgr().error(XSLTErrorResources.ER_CANT_CREATE_ITEM,
  +                                      new Object[]{ node.getNodeName() });  //"Can not create item in result tree: "+node.getNodeName());
  +    }
  +  }  // end cloneToResultTree function
   }
  
  
  
  1.3       +55 -29    xml-xalan/java/src/org/apache/xalan/transformer/Counter.java
  
  Index: Counter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/Counter.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Counter.java	2000/07/05 14:42:49	1.2
  +++ Counter.java	2000/10/30 18:56:56	1.3
  @@ -57,10 +57,13 @@
   package org.apache.xalan.transformer;
   
   import org.w3c.dom.Node;
  +
   import org.apache.xalan.utils.NodeVector;
  -import org.apache.xpath.NodeSet; // for isNodeAfter support
  +import org.apache.xpath.NodeSet;  // for isNodeAfter support
   import org.apache.xpath.XPathContext;
  +
   import org.xml.sax.SAXException;
  +
   import org.apache.xpath.NodeSet;
   import org.apache.xpath.XPath;
   import org.apache.xalan.templates.ElemNumber;
  @@ -68,55 +71,60 @@
   /**
    * <meta name="usage" content="internal"/>
    * A class that does incremental counting for support of xsl:number.
  - * This class stores a cache of counted nodes (m_countNodes). 
  - * It tries to cache the counted nodes in document order... 
  - * the node count is based on its position in the cache list 
  + * This class stores a cache of counted nodes (m_countNodes).
  + * It tries to cache the counted nodes in document order...
  + * the node count is based on its position in the cache list
    */
   class Counter
   {
  +
     /**
  -   * Set the maximum ammount the m_countNodes list can 
  +   * Set the maximum ammount the m_countNodes list can
      * grow to.
      */
     static final int MAXCOUNTNODES = 500;
  -  
  +
     /**
  -   * The start count from where m_countNodes counts 
  -   * from.  In other words, the count of a given node 
  -   * in the m_countNodes vector is node position + 
  +   * The start count from where m_countNodes counts
  +   * from.  In other words, the count of a given node
  +   * in the m_countNodes vector is node position +
      * m_countNodesStartCount.
      */
     int m_countNodesStartCount = 0;
  -  
  +
     /**
      * A vector of all nodes counted so far.
      */
     NodeSet m_countNodes = new NodeSet();
  -  
  +
     /**
  -   * The node from where the counting starts.  This is needed to 
  +   * The node from where the counting starts.  This is needed to
      * find a counter if the node being counted is not immediatly
      * found in the m_countNodes vector.
      */
     Node m_fromNode = null;
  -  
  +
     /**
      * The owning xsl:number element.
      */
     ElemNumber m_numberElem;
  -    
  +
     /**
      * Value to store result of last getCount call, for benifit
  -   * of returning val from CountersTable.getCounterByCounted, 
  +   * of returning val from CountersTable.getCounterByCounted,
      * who calls getCount.
      */
     int m_countResult;
   
     /**
      * Construct a counter object.
  +   *
  +   * NEEDSDOC @param numberElem
  +   * NEEDSDOC @param countNodes
  +   *
  +   * @throws SAXException
      */
  -  Counter(ElemNumber numberElem, NodeSet countNodes)
  -    throws SAXException
  +  Counter(ElemNumber numberElem, NodeSet countNodes) throws SAXException
     {
       m_countNodes = countNodes;
       m_numberElem = numberElem;
  @@ -124,48 +132,66 @@
   
     /**
      * Construct a counter object.
  +   *
  +   * NEEDSDOC @param numberElem
  +   *
  +   * @throws SAXException
      */
  -  Counter(ElemNumber numberElem)
  -    throws SAXException
  +  Counter(ElemNumber numberElem) throws SAXException
     {
       m_numberElem = numberElem;
     }
  -    
  +
     /**
  -   * Try and find a node that was previously counted. If found, 
  +   * Try and find a node that was previously counted. If found,
      * return a positive integer that corresponds to the count.
  +   *
  +   * NEEDSDOC @param support
      * @param node The node to be counted.
      * @returns The count of the node, or -1 if not found.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     int getPreviouslyCounted(XPathContext support, Node node)
     {
  +
       int n = m_countNodes.size();
  +
       m_countResult = 0;
  -    for(int i = n-1;i >= 0; i--)
  +
  +    for (int i = n - 1; i >= 0; i--)
       {
  -      Node countedNode = (Node)m_countNodes.elementAt(i);
  -      if(node.equals( countedNode ))
  +      Node countedNode = (Node) m_countNodes.elementAt(i);
  +
  +      if (node.equals(countedNode))
         {
  +
           // Since the list is in backwards order, the count is 
           // how many are in the rest of the list.
  -        m_countResult = i+1+m_countNodesStartCount;
  +        m_countResult = i + 1 + m_countNodesStartCount;
  +
           break;
         }
  +
         // Try to see if the given node falls after the counted node...
         // if it does, don't keep searching backwards.
  -      if(support.getDOMHelper().isNodeAfter(countedNode, node))
  +      if (support.getDOMHelper().isNodeAfter(countedNode, node))
           break;
       }
  +
       return m_countResult;
     }
  -    
  +
     /**
      * Get the last node in the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     Node getLast()
     {
  +
       int size = m_countNodes.size();
  -    return (size > 0) ? m_countNodes.elementAt(size-1) : null;
  +
  +    return (size > 0) ? m_countNodes.elementAt(size - 1) : null;
     }
  -  
   }
  
  
  
  1.3       +84 -42    xml-xalan/java/src/org/apache/xalan/transformer/CountersTable.java
  
  Index: CountersTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/CountersTable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CountersTable.java	2000/07/05 14:42:50	1.2
  +++ CountersTable.java	2000/10/30 18:56:57	1.3
  @@ -58,7 +58,9 @@
   
   import java.util.Hashtable;
   import java.util.Vector;
  +
   import org.w3c.dom.Node;
  +
   import org.xml.sax.SAXException;
   
   import org.apache.xpath.XPathContext;
  @@ -68,90 +70,118 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * This is a table of counters, keyed by ElemNumber objects, each 
  - * of which has a list of Counter objects.  This really isn't a true 
  - * table, it is more like a list of lists (there must be a technical 
  + * This is a table of counters, keyed by ElemNumber objects, each
  + * of which has a list of Counter objects.  This really isn't a true
  + * table, it is more like a list of lists (there must be a technical
    * term for that...).
    */
   public class CountersTable extends Hashtable
  -{  
  +{
  +
     /**
      * Construct a CountersTable.
      */
  -  public CountersTable()
  -  {
  -  }
  -  
  +  public CountersTable(){}
  +
     /**
  -   * Get the list of counters that corresponds to 
  +   * Get the list of counters that corresponds to
      * the given ElemNumber object.
  +   *
  +   * NEEDSDOC @param numberElem
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     Vector getCounters(ElemNumber numberElem)
     {
  -    Vector counters = (Vector)this.get(numberElem);
  +
  +    Vector counters = (Vector) this.get(numberElem);
  +
       return (null == counters) ? putElemNumber(numberElem) : counters;
     }
  -  
  +
     /**
  -   * Put a counter into the table and create an empty 
  +   * Put a counter into the table and create an empty
      * vector as it's value.
  +   *
  +   * NEEDSDOC @param numberElem
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     Vector putElemNumber(ElemNumber numberElem)
     {
  +
       Vector counters = new Vector();
  +
       this.put(numberElem, counters);
  +
       return counters;
     }
  -  
  +
     /**
      * Place to collect new counters.
      */
     private NodeSet m_newFound = new NodeSet();
  -  
  +
     /**
  -   * Add a list of counted nodes that were built in backwards document 
  -   * order, or a list of counted nodes that are in forwards document 
  +   * Add a list of counted nodes that were built in backwards document
  +   * order, or a list of counted nodes that are in forwards document
      * order.
  +   *
  +   * NEEDSDOC @param flist
  +   * NEEDSDOC @param blist
      */
     void appendBtoFList(NodeSet flist, NodeSet blist)
     {
  +
       int n = blist.size();
  -    for(int i = (n-1); i >= 0; i--)
  +
  +    for (int i = (n - 1); i >= 0; i--)
       {
         flist.addElement(blist.item(i));
       }
     }
  -  
  +
     // For diagnostics
  +
  +  /** NEEDSDOC Field m_countersMade          */
     int m_countersMade = 0;
  -    
  +
     /**
  -   * Count forward until the given node is found, or until 
  +   * Count forward until the given node is found, or until
      * we have looked to the given amount.
      * @node The node to count.
  +   *
  +   * NEEDSDOC @param support
  +   * NEEDSDOC @param numberElem
  +   * NEEDSDOC @param node
      * @return The node count, or 0 if not found.
  +   *
  +   * @throws SAXException
      */
     public int countNode(XPathContext support, ElemNumber numberElem, Node node)
  -    throws SAXException
  +          throws SAXException
     {
  +
       int count = 0;
       Vector counters = getCounters(numberElem);
       int nCounters = counters.size();
  +
       // XPath countMatchPattern = numberElem.getCountMatchPattern(support, node);
       // XPath fromMatchPattern = numberElem.m_fromMatchPattern;
  -    
       Node target = numberElem.getTargetNode(support, node);
  -    if(null != target)
  +
  +    if (null != target)
       {
  -      for(int i = 0; i < nCounters; i++)
  -      {    
  -        Counter counter = (Counter)counters.elementAt(i);
  -        
  +      for (int i = 0; i < nCounters; i++)
  +      {
  +        Counter counter = (Counter) counters.elementAt(i);
  +
           count = counter.getPreviouslyCounted(support, target);
  -        if(count > 0)
  +
  +        if (count > 0)
             return count;
         }
  -      
  +
         // In the loop below, we collect the nodes in backwards doc order, so 
         // we don't have to do inserts, but then we store the nodes in forwards 
         // document order, so we don't have to insert nodes into that list, 
  @@ -159,41 +189,53 @@
         // of forward counting by one, this will mean a single node copy from 
         // the backwards list (m_newFound) to the forwards list (counter.m_countNodes).
         count = 0;
  -      for(; null != target; target = numberElem.getPreviousNode(support, target))
  -      {   
  +
  +      for (; null != target;
  +              target = numberElem.getPreviousNode(support, target))
  +      {
  +
           // First time in, we should not have to check for previous counts, 
           // since the original target node was already checked in the 
           // block above.
  -        if(0 != count)  
  +        if (0 != count)
           {
  -          for(int i = 0; i < nCounters; i++)
  -          {    
  -            Counter counter = (Counter)counters.elementAt(i);
  +          for (int i = 0; i < nCounters; i++)
  +          {
  +            Counter counter = (Counter) counters.elementAt(i);
               int cacheLen = counter.m_countNodes.size();
  -            if((cacheLen > 0) && counter.m_countNodes.elementAt(cacheLen-1).equals(target))
  +
  +            if ((cacheLen > 0)
  +                    && counter.m_countNodes.elementAt(cacheLen
  +                                                      - 1).equals(target))
               {
  -              count += (cacheLen+counter.m_countNodesStartCount);
  -              if(cacheLen > 0)
  +              count += (cacheLen + counter.m_countNodesStartCount);
  +
  +              if (cacheLen > 0)
                   appendBtoFList(counter.m_countNodes, m_newFound);
  +
                 m_newFound.removeAllElements();
  +
                 return count;
               }
             }
           }
  +
           m_newFound.addElement(target);
  +
           count++;
         }
  +
         // If we got to this point, then we didn't find a counter, so make 
         // one and add it to the list.
         Counter counter = new Counter(numberElem);
  -      m_countersMade++; // for diagnostics
  +
  +      m_countersMade++;  // for diagnostics
  +
         appendBtoFList(counter.m_countNodes, m_newFound);
         m_newFound.removeAllElements();
         counters.addElement(counter);
       }
  -    
  +
       return count;
     }
  -  
  -
   }
  
  
  
  1.2       +26 -9     xml-xalan/java/src/org/apache/xalan/transformer/DecimalToRoman.java
  
  Index: DecimalToRoman.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/DecimalToRoman.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DecimalToRoman.java	2000/06/19 16:53:04	1.1
  +++ DecimalToRoman.java	2000/10/30 18:56:57	1.2
  @@ -62,20 +62,37 @@
    * @see long2roman
    * @see m_romanConvertTable
    */
  -public class DecimalToRoman 
  -{      
  -  public DecimalToRoman(
  -                        long postValue, String postLetter, 
  -                        long preValue, String preLetter)
  +public class DecimalToRoman
  +{
  +
  +  /**
  +   * Constructor DecimalToRoman
  +   *
  +   *
  +   * NEEDSDOC @param postValue
  +   * NEEDSDOC @param postLetter
  +   * NEEDSDOC @param preValue
  +   * NEEDSDOC @param preLetter
  +   */
  +  public DecimalToRoman(long postValue, String postLetter, long preValue,
  +                        String preLetter)
     {
  +
       this.m_postValue = postValue;
       this.m_postLetter = postLetter;
       this.m_preValue = preValue;
       this.m_preLetter = preLetter;
     }
  -  
  -  public long  m_postValue;      
  +
  +  /** NEEDSDOC Field m_postValue          */
  +  public long m_postValue;
  +
  +  /** NEEDSDOC Field m_postLetter          */
     public String m_postLetter;
  -  public long  m_preValue;      
  +
  +  /** NEEDSDOC Field m_preValue          */
  +  public long m_preValue;
  +
  +  /** NEEDSDOC Field m_preLetter          */
     public String m_preLetter;
  -}
  \ No newline at end of file
  +}
  
  
  
  1.4       +129 -21   xml-xalan/java/src/org/apache/xalan/transformer/KeyIterator.java
  
  Index: KeyIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyIterator.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- KeyIterator.java	2000/08/04 22:26:29	1.3
  +++ KeyIterator.java	2000/10/30 18:56:57	1.4
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.transformer;
   
   import java.util.Vector;
  @@ -5,9 +61,7 @@
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.utils.QName;
  -
   import org.apache.xalan.templates.KeyDeclaration;
  -
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.axes.DescendantOrSelfWalker;
   import org.apache.xpath.objects.XObject;
  @@ -21,47 +75,101 @@
   
   import org.xml.sax.SAXException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class KeyIterator <needs-comment/>
  + */
   public class KeyIterator extends LocPathIterator
   {
  +
  +  /** NEEDSDOC Field m_name          */
     private QName m_name;
  -  public QName getName() { return m_name; }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getName 
  +   *
  +   *
  +   * NEEDSDOC (getName) @return
  +   */
  +  public QName getName()
  +  {
  +    return m_name;
  +  }
  +
  +  /** NEEDSDOC Field m_keyDeclarations          */
     private Vector m_keyDeclarations;
  -  public Vector getKeyDeclarations() { return m_keyDeclarations; }
  -  
  -  public KeyIterator(Node doc, 
  -                     PrefixResolver nscontext, 
  -                     QName name, 
  -                     Vector keyDeclarations, 
  -                     XPathContext xctxt)
  +
  +  /**
  +   * NEEDSDOC Method getKeyDeclarations 
  +   *
  +   *
  +   * NEEDSDOC (getKeyDeclarations) @return
  +   */
  +  public Vector getKeyDeclarations()
  +  {
  +    return m_keyDeclarations;
  +  }
  +
  +  /**
  +   * Constructor KeyIterator
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param nscontext
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param keyDeclarations
  +   * NEEDSDOC @param xctxt
  +   */
  +  public KeyIterator(Node doc, PrefixResolver nscontext, QName name,
  +                     Vector keyDeclarations, XPathContext xctxt)
     {
  +
       super(nscontext);
  +
       initContext(xctxt);
  +
       m_name = name;
       m_keyDeclarations = keyDeclarations;
       m_firstWalker = new KeyWalker(this);
  +
       this.setLastUsedWalker(m_firstWalker);
     }
  -  
  -  public Node nextNode()
  -    throws DOMException
  -  {  
  +
  +  /**
  +   * NEEDSDOC Method nextNode 
  +   *
  +   *
  +   * NEEDSDOC (nextNode) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node nextNode() throws DOMException
  +  {
  +
       // If the cache is on, and the node has already been found, then 
       // just return from the list.
       Node n = super.nextNode();
  +
       // System.out.println("--> "+((null == n) ? "null" : n.getNodeName()));
       return n;
     }
   
  -  
  +  /**
  +   * NEEDSDOC Method setLookupKey 
  +   *
  +   *
  +   * NEEDSDOC @param lookupKey
  +   */
     public void setLookupKey(String lookupKey)
     {
  +
       // System.out.println("setLookupKey - lookupKey: "+lookupKey);
  -    ((KeyWalker)m_firstWalker).m_lookupKey = lookupKey;
  -    m_firstWalker.setRoot((this.getContext().getNodeType()== Node.DOCUMENT_NODE) ? 
  -                          this.getContext() : this.getContext().getOwnerDocument());
  +    ((KeyWalker) m_firstWalker).m_lookupKey = lookupKey;
  +
  +    m_firstWalker.setRoot(
  +      (this.getContext().getNodeType() == Node.DOCUMENT_NODE)
  +      ? this.getContext() : this.getContext().getOwnerDocument());
       this.setLastUsedWalker(m_firstWalker);
       this.setNextPosition(0);
  -  }  
  -  
  +  }
   }
  
  
  
  1.5       +41 -19    xml-xalan/java/src/org/apache/xalan/transformer/KeyManager.java
  
  Index: KeyManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyManager.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- KeyManager.java	2000/10/17 19:12:31	1.4
  +++ KeyManager.java	2000/10/30 18:56:58	1.5
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,8 +57,10 @@
   package org.apache.xalan.transformer;
   
   import java.util.Vector;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  +
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.utils.PrefixResolver;
  @@ -70,54 +72,75 @@
    */
   public class KeyManager
   {
  +
     /**
      * Table of tables of element keys.
      * @see KeyTable.
      */
     private transient Vector m_key_tables = null;
  -  
  +
     /**
      * Given a valid element key, return the corresponding node list.
  +   *
  +   * NEEDSDOC @param xctxt
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param ref
  +   * NEEDSDOC @param nscontext
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public LocPathIterator getNodeSetByKey(XPathContext xctxt, 
  -                                  Node doc, QName name,
  -                                  String ref, PrefixResolver nscontext)
  -    throws org.xml.sax.SAXException
  +  public LocPathIterator getNodeSetByKey(
  +          XPathContext xctxt, Node doc, QName name, String ref, PrefixResolver nscontext)
  +            throws org.xml.sax.SAXException
     {
  +
       LocPathIterator nl = null;
  -    ElemTemplateElement template = (ElemTemplateElement)nscontext; // yuck -sb
  +    ElemTemplateElement template = (ElemTemplateElement) nscontext;  // yuck -sb
   
  -    if((null != template) && null != template.getStylesheetComposed().getKeysComposed())
  +    if ((null != template)
  +            && null != template.getStylesheetComposed().getKeysComposed())
       {
         boolean foundDoc = false;
  -      if(null == m_key_tables)
  +
  +      if (null == m_key_tables)
         {
           m_key_tables = new Vector(4);
         }
         else
         {
           int nKeyTables = m_key_tables.size();
  -        for(int i = 0; i < nKeyTables; i++)
  +
  +        for (int i = 0; i < nKeyTables; i++)
           {
  -          KeyTable kt = (KeyTable)m_key_tables.elementAt(i);
  -          if(kt.getKeyTableName().equals(name) &&  doc == kt.getDocKey())
  +          KeyTable kt = (KeyTable) m_key_tables.elementAt(i);
  +
  +          if (kt.getKeyTableName().equals(name) && doc == kt.getDocKey())
             {
               nl = kt.getNodeSetByKey(name, ref);
  +
               if (nl != null)
               {
                 foundDoc = true;
  +
                 break;
               }
             }
           }
         }
  -      if((null == nl) && !foundDoc /* && m_needToBuildKeysTable */ )
  +
  +      if ((null == nl) &&!foundDoc /* && m_needToBuildKeysTable */)
         {
  -        KeyTable kt = new KeyTable(doc, nscontext, name, 
  -                                   template.getStylesheetComposed().getKeysComposed(),
  -                                   xctxt);
  +        KeyTable kt =
  +          new KeyTable(doc, nscontext, name,
  +                       template.getStylesheetComposed().getKeysComposed(),
  +                       xctxt);
  +
           m_key_tables.addElement(kt);
  -        if(doc == kt.getDocKey())
  +
  +        if (doc == kt.getDocKey())
           {
             foundDoc = true;
             nl = kt.getNodeSetByKey(name, ref);
  @@ -127,5 +150,4 @@
   
       return nl;
     }
  -
   }
  
  
  
  1.4       +50 -32    xml-xalan/java/src/org/apache/xalan/transformer/KeyTable.java
  
  Index: KeyTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyTable.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- KeyTable.java	2000/08/04 22:26:29	1.3
  +++ KeyTable.java	2000/10/30 18:56:58	1.4
  @@ -60,42 +60,50 @@
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  +
   import java.util.Hashtable;
   import java.util.Vector;
  +
   import org.apache.xpath.NodeSet;
   import org.apache.xpath.objects.XObject;
  -import org.apache.xpath.XPathContext; 
  -import org.apache.xpath.XPathContext; 
  -import org.apache.xpath.DOMHelper; 
  -import org.apache.xalan.utils.QName; 
  +import org.apache.xpath.XPathContext;
  +import org.apache.xpath.XPathContext;
  +import org.apache.xpath.DOMHelper;
  +import org.apache.xalan.utils.QName;
   import org.apache.xalan.templates.KeyDeclaration;
   import org.apache.xpath.XPathContext;
   import org.apache.xalan.utils.PrefixResolver;
  -
  -import org.apache.xpath.axes.LocPathIterator; 
  +import org.apache.xpath.axes.LocPathIterator;
   
   // import org.apache.xalan.dtm.*;
   
   /**
    * <meta name="usage" content="advanced"/>
  - * Table of element keys, keyed by document node.  An instance of this 
  - * class is keyed by a Document node that should be matched with the 
  - * root of the current context.  It contains a table of name mappings 
  + * Table of element keys, keyed by document node.  An instance of this
  + * class is keyed by a Document node that should be matched with the
  + * root of the current context.  It contains a table of name mappings
    * to tables that contain mappings of identifier values to nodes.
    */
   public class KeyTable
   {
  +
     /**
      * The document key.  This table should only be used with contexts
      * whose Document roots match this key.
      */
     private Node m_docKey;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getDocKey 
  +   *
  +   *
  +   * NEEDSDOC (getDocKey) @return
  +   */
     public Node getDocKey()
     {
       return m_docKey;
     }
  -  
  +
     /**
      * Hashtable of keys.
      * The table is:
  @@ -109,49 +117,59 @@
      * @param doc The owner document key (normally the same as startNode).
      * @param startNode The node to start itterating from to build the keys index.
      * @param nscontext The stylesheet's namespace context.
  +   * NEEDSDOC @param name
      * @param keyDeclarations The stylesheet's xsl:key declarations.
      * @param xmlLiaison The parser liaison for support of getNodeData(useNode).
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public KeyTable(Node doc, PrefixResolver nscontext, 
  -                  QName name, Vector keyDeclarations, XPathContext xmlLiaison)
  -    throws org.xml.sax.SAXException
  -  {    
  +  public KeyTable(
  +          Node doc, PrefixResolver nscontext, QName name, Vector keyDeclarations, XPathContext xmlLiaison)
  +            throws org.xml.sax.SAXException
  +  {
  +
       m_docKey = doc;
  -    
  -    m_keyIter = new KeyIterator(doc, nscontext, 
  -                                name, keyDeclarations, xmlLiaison);
  -    
  -  } // end buildKeysTable method
  -  
  -  
  +    m_keyIter = new KeyIterator(doc, nscontext, name, keyDeclarations,
  +                                xmlLiaison);
  +  }  // end buildKeysTable method
  +
     /**
  -   * Given a valid element key, return the corresponding node list. 
  +   * Given a valid element key, return the corresponding node list.
      * @param The name of the key, which must match the 'name' attribute on xsl:key.
  +   *
  +   * NEEDSDOC @param name
      * @param ref The value that must match the value found by the 'match' attribute on xsl:key.
  -   * @return If the name was not declared with xsl:key, this will return null, 
  -   * if the identifier is not found, it will return null, 
  +   * @return If the name was not declared with xsl:key, this will return null,
  +   * if the identifier is not found, it will return null,
      * otherwise it will return a LocPathIterator instance.
      */
     public KeyIterator getNodeSetByKey(QName name, String ref)
     {
  +
       KeyIterator ki;
  +
       try
       {
  -      ki = (KeyIterator)m_keyIter.clone();
  +      ki = (KeyIterator) m_keyIter.clone();
  +
         ki.setLookupKey(ref);
       }
  -    catch(CloneNotSupportedException cnse)
  +    catch (CloneNotSupportedException cnse)
       {
         ki = null;
       }
  -    
  +
       return ki;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getKeyTableName 
  +   *
  +   *
  +   * NEEDSDOC (getKeyTableName) @return
  +   */
     public QName getKeyTableName()
     {
       return m_keyIter.getName();
  -  }  
  -
  -  
  +  }
   }
  
  
  
  1.5       +120 -35   xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java
  
  Index: KeyWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/KeyWalker.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- KeyWalker.java	2000/09/27 21:42:32	1.4
  +++ KeyWalker.java	2000/10/30 18:56:58	1.5
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.transformer;
   
   import java.util.Vector;
  @@ -5,9 +61,7 @@
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.utils.QName;
  -
   import org.apache.xalan.templates.KeyDeclaration;
  -
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.axes.DescendantOrSelfWalker;
   import org.apache.xpath.objects.XObject;
  @@ -21,45 +75,67 @@
   
   import org.xml.sax.SAXException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class KeyWalker <needs-comment/>
  + */
   public class KeyWalker extends DescendantOrSelfWalker
   {
  +
     /**
      * Construct a KeyWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public KeyWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_attrs = null;
       m_foundAttrs = false;
       m_attrPos = 0;
  +
       super.setRoot(root);
     }
  -  
  +
  +  /** NEEDSDOC Field m_attrs          */
     NamedNodeMap m_attrs;
  +
  +  /** NEEDSDOC Field m_foundAttrs          */
     boolean m_foundAttrs;
  +
  +  /** NEEDSDOC Field m_attrPos          */
     int m_attrPos;
  +
  +  /** NEEDSDOC Field m_lookupKey          */
     String m_lookupKey;
  -  
  +
     /**
      * Get the next node in document order on the axes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected Node getNextNode()
     {
  -    if(!m_foundAttrs)
  +
  +    if (!m_foundAttrs)
       {
         m_attrs = getCurrentNode().getAttributes();
         m_foundAttrs = true;
       }
  -    if(null != m_attrs)
  +
  +    if (null != m_attrs)
       {
  -      if(m_attrPos < m_attrs.getLength())
  +      if (m_attrPos < m_attrs.getLength())
         {
           return m_attrs.item(m_attrPos++);
         }
  @@ -68,81 +144,90 @@
           m_attrs = null;
         }
       }
  -    
  +
       Node next = super.getNextNode();
  -    if(null != next)
  +
  +    if (null != next)
         m_foundAttrs = false;
  -    
  +
       return next;
     }
   
  -  
     /**
  -   *  Test whether a specified node is visible in the logical view of a 
  -   * TreeWalker or NodeIterator. This function will be called by the 
  -   * implementation of TreeWalker and NodeIterator; it is not intended to 
  +   *  Test whether a specified node is visible in the logical view of a
  +   * TreeWalker or NodeIterator. This function will be called by the
  +   * implementation of TreeWalker and NodeIterator; it is not intended to
      * be called directly from user code.
      * @param n  The node to check to see if it passes the filter or not.
  -   * @return  a constant to determine whether the node is accepted, 
  +   *
  +   * NEEDSDOC @param testNode
  +   * @return  a constant to determine whether the node is accepted,
      *   rejected, or skipped, as defined  above .
      */
     public short acceptNode(Node testNode)
     {
  -    KeyIterator ki = (KeyIterator)m_lpi;
  +
  +    KeyIterator ki = (KeyIterator) m_lpi;
       Vector keys = ki.getKeyDeclarations();
  -    QName name = ki.getName();
  +
  +    // QName name = ki.getName();
       try
       {
         String lookupKey = m_lookupKey;
  +
         // System.out.println("lookupKey: "+lookupKey);
         int nDeclarations = keys.size();
   
         // Walk through each of the declarations made with xsl:key
  -      for(int i = 0; i < nDeclarations; i++)
  +      for (int i = 0; i < nDeclarations; i++)
         {
  -        KeyDeclaration kd = (KeyDeclaration)keys.elementAt(i);
  -        
  +        KeyDeclaration kd = (KeyDeclaration) keys.elementAt(i);
  +
           //if(!kd.getName().equals(name)) 
           //  continue;
  -        
           ki.getXPathContext().setNamespaceContext(ki.getPrefixResolver());
  -            
  +
           // See if our node matches the given key declaration according to 
           // the match attribute on xsl:key.
  -        double score = kd.getMatch().getMatchScore(ki.getXPathContext(), testNode);
  -        
  -        if(score == kd.getMatch().MATCH_SCORE_NONE)
  +        double score = kd.getMatch().getMatchScore(ki.getXPathContext(),
  +                                                   testNode);
  +
  +        if (score == kd.getMatch().MATCH_SCORE_NONE)
             continue;
   
           // Query from the node, according the the select pattern in the
           // use attribute in xsl:key.
  -        XObject xuse = kd.getUse().execute(ki.getXPathContext(), testNode, ki.getPrefixResolver());
  +        XObject xuse = kd.getUse().execute(ki.getXPathContext(), testNode,
  +                                           ki.getPrefixResolver());
   
  -        if(xuse.getType() != xuse.CLASS_NODESET)
  +        if (xuse.getType() != xuse.CLASS_NODESET)
           {
             String exprResult = xuse.str();
  -          if(lookupKey.equals(exprResult))
  +
  +          if (lookupKey.equals(exprResult))
               return this.FILTER_ACCEPT;
           }
           else
           {
             NodeIterator nl = xuse.nodeset();
             Node useNode;
  -          while(null != (useNode = nl.nextNode()))
  +
  +          while (null != (useNode = nl.nextNode()))
             {
               String exprResult = m_lpi.getDOMHelper().getNodeData(useNode);
  -            if((null != exprResult) && lookupKey.equals(exprResult))
  +
  +            if ((null != exprResult) && lookupKey.equals(exprResult))
                 return this.FILTER_ACCEPT;
             }
           }
  -
  -      } // end for(int i = 0; i < nDeclarations; i++)
  -
  +      }  // end for(int i = 0; i < nDeclarations; i++)
       }
  -    catch(SAXException se)
  +    catch (SAXException se)
       {
  +
         // TODO: What to do?
       }
  +
       return this.FILTER_REJECT;
     }
   }
  
  
  
  1.3       +114 -38   xml-xalan/java/src/org/apache/xalan/transformer/MsgMgr.java
  
  Index: MsgMgr.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/MsgMgr.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MsgMgr.java	2000/10/13 02:33:12	1.2
  +++ MsgMgr.java	2000/10/30 18:56:59	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,49 +57,64 @@
   package org.apache.xalan.transformer;
   
   import org.apache.xalan.res.XSLMessages;
  +
   import org.xml.sax.SAXException;
   import org.xml.sax.Locator;
   import org.xml.sax.ErrorHandler;
  +
   import org.w3c.dom.Node;
  +
   import org.apache.trax.TransformException;
   
   /**
  - * This class will manage error messages, warning messages, and other types of 
  + * This class will manage error messages, warning messages, and other types of
    * message events.
    */
   public class MsgMgr
  -{  
  +{
  +
     /**
      * Create a message manager object.
  +   *
  +   * NEEDSDOC @param transformer
      */
     public MsgMgr(TransformerImpl transformer)
     {
       m_transformer = transformer;
     }
  -  
  +
  +  /** NEEDSDOC Field m_transformer          */
     private TransformerImpl m_transformer;
  +
  +  /** NEEDSDOC Field m_XSLMessages          */
     private static XSLMessages m_XSLMessages = new XSLMessages();
   
     /**
      * Warn the user of an problem.
      * This is public for access by extensions.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param terminate
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void message(String msg, boolean terminate)
  -    throws SAXException
  +  public void message(String msg, boolean terminate) throws SAXException
     {
  +
       ErrorHandler errHandler = m_transformer.getErrorHandler();
  -    if(null != errHandler)
  +
  +    if (null != errHandler)
       {
  -      if(terminate)
  +      if (terminate)
           errHandler.fatalError(new TransformException(msg));
         else
           errHandler.warning(new TransformException(msg));
       }
       else
       {
  -      if(terminate)
  +      if (terminate)
           throw new TransformException(msg);
         else
           System.out.println(msg);
  @@ -109,11 +124,14 @@
     /**
      * <meta name="usage" content="internal"/>
      * Warn the user of an problem.
  +   *
  +   * NEEDSDOC @param msg
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void warn(int msg)
  -    throws SAXException
  +  public void warn(int msg) throws SAXException
     {
       warn(null, null, msg, null);
     }
  @@ -121,11 +139,15 @@
     /**
      * <meta name="usage" content="internal"/>
      * Warn the user of an problem.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void warn(int msg, Object[] args)
  -    throws SAXException
  +  public void warn(int msg, Object[] args) throws SAXException
     {
       warn(null, null, msg, args);
     }
  @@ -133,11 +155,17 @@
     /**
      * <meta name="usage" content="internal"/>
      * Warn the user of an problem.
  +   *
  +   * NEEDSDOC @param styleNode
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param msg
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
     public void warn(Node styleNode, Node sourceNode, int msg)
  -    throws SAXException
  +          throws SAXException
     {
       warn(styleNode, sourceNode, msg, null);
     }
  @@ -145,16 +173,24 @@
     /**
      * <meta name="usage" content="internal"/>
      * Warn the user of an problem.
  +   *
  +   * NEEDSDOC @param styleNode
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
     public void warn(Node styleNode, Node sourceNode, int msg, Object args[])
  -    throws SAXException
  +          throws SAXException
     {
  +
       String formattedMsg = m_XSLMessages.createWarning(msg, args);
  -    
       ErrorHandler errHandler = m_transformer.getErrorHandler();
  -    if(null != errHandler)
  +
  +    if (null != errHandler)
         errHandler.warning(new TransformException(formattedMsg));
       else
         System.out.println(formattedMsg);
  @@ -164,18 +200,23 @@
      * <meta name="usage" content="internal"/>
      * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void error(String msg)
  -    throws SAXException
  +  public void error(String msg) throws SAXException
     {
  +
       // Locator locator = m_stylesheetLocatorStack.isEmpty()
       //                  ? null :
       //                    ((Locator)m_stylesheetLocatorStack.peek());
  -    Locator locator = null;
  +    // Locator locator = null;
       ErrorHandler errHandler = m_transformer.getErrorHandler();
  -    if(null != errHandler)
  +
  +    if (null != errHandler)
         errHandler.fatalError(new TransformException(msg));
       else
         throw new TransformException(msg);
  @@ -185,11 +226,14 @@
      * <meta name="usage" content="internal"/>
      * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void error(int msg)
  -    throws SAXException
  +  public void error(int msg) throws SAXException
     {
       error(null, null, msg, null);
     }
  @@ -198,11 +242,15 @@
      * <meta name="usage" content="internal"/>
      * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void error(int msg, Object[] args)
  -    throws SAXException
  +  public void error(int msg, Object[] args) throws SAXException
     {
       error(null, null, msg, args);
     }
  @@ -211,11 +259,15 @@
      * <meta name="usage" content="internal"/>
      * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param e
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void error(int msg, Exception e)
  -    throws SAXException
  +  public void error(int msg, Exception e) throws SAXException
     {
       error(msg, null, e);
     }
  @@ -224,34 +276,48 @@
      * <meta name="usage" content="internal"/>
      * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   * NEEDSDOC @param e
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
  -  public void error(int msg, Object args[], Exception e)
  -    throws SAXException
  +  public void error(int msg, Object args[], Exception e) throws SAXException
     {
  +
       //msg  = (null == msg) ? XSLTErrorResources.ER_PROCESSOR_ERROR : msg;
       String formattedMsg = m_XSLMessages.createMessage(msg, args);
  +
       // Locator locator = m_stylesheetLocatorStack.isEmpty()
       //                   ? null :
       //                    ((Locator)m_stylesheetLocatorStack.peek());
  -    Locator locator = null;
  +    // Locator locator = null;
       ErrorHandler errHandler = m_transformer.getErrorHandler();
  -    if(null != errHandler)
  +
  +    if (null != errHandler)
         errHandler.fatalError(new TransformException(formattedMsg));
       else
         throw new TransformException(formattedMsg);
     }
   
     /**
  -    * <meta name="usage" content="internal"/>
  -  * Tell the user of an error, and probably throw an
  +   *  <meta name="usage" content="internal"/>
  +   * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param styleNode
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param msg
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
     public void error(Node styleNode, Node sourceNode, int msg)
  -    throws SAXException
  +          throws SAXException
     {
       error(styleNode, sourceNode, msg, null);
     }
  @@ -260,19 +326,29 @@
      * <meta name="usage" content="internal"/>
      * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param styleNode
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
     public void error(Node styleNode, Node sourceNode, int msg, Object args[])
  -    throws SAXException
  +          throws SAXException
     {
  +
       String formattedMsg = m_XSLMessages.createMessage(msg, args);
  +
       // Locator locator = m_stylesheetLocatorStack.isEmpty()
       //                   ? null :
       //                    ((Locator)m_stylesheetLocatorStack.peek());
  -    Locator locator = null;
  +    // Locator locator = null;
       ErrorHandler errHandler = m_transformer.getErrorHandler();
  -    if(null != errHandler)
  +
  +    if (null != errHandler)
         errHandler.warning(new TransformException(formattedMsg));
       else
         throw new TransformException(formattedMsg);
  
  
  
  1.3       +53 -19    xml-xalan/java/src/org/apache/xalan/transformer/NodeSortKey.java
  
  Index: NodeSortKey.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/NodeSortKey.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NodeSortKey.java	2000/07/05 14:42:53	1.2
  +++ NodeSortKey.java	2000/10/30 18:56:59	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -57,10 +57,12 @@
   package org.apache.xalan.transformer;
   
   import java.util.Locale;
  +
   import org.apache.xpath.XPath;
  +
   import java.text.Collator;
  -import org.apache.xalan.res.XSLTErrorResources;
   
  +import org.apache.xalan.res.XSLTErrorResources;
   
   /**
    * <meta name="usage" content="internal"/>
  @@ -68,34 +70,65 @@
    */
   class NodeSortKey
   {
  +
  +  /** NEEDSDOC Field m_selectPat          */
     XPath m_selectPat;
  +
  +  /** NEEDSDOC Field m_treatAsNumbers          */
     boolean m_treatAsNumbers;
  +
  +  /** NEEDSDOC Field m_descending          */
     boolean m_descending;
  +
  +  /** NEEDSDOC Field m_caseOrderUpper          */
     boolean m_caseOrderUpper;
  +
  +  /** NEEDSDOC Field m_col          */
     Collator m_col;
  +
  +  /** NEEDSDOC Field m_locale          */
     Locale m_locale;
  +
  +  /** NEEDSDOC Field m_namespaceContext          */
     org.apache.xalan.utils.PrefixResolver m_namespaceContext;
  -  TransformerImpl m_processor; // needed for error reporting.
  +
  +  /** NEEDSDOC Field m_processor          */
  +  TransformerImpl m_processor;  // needed for error reporting.
   
  -  NodeSortKey(TransformerImpl transformer, XPath selectPat,
  -                   boolean treatAsNumbers,
  -                   boolean descending, String langValue,
  -				           boolean caseOrderUpper,
  -                   org.apache.xalan.utils.PrefixResolver namespaceContext)
  -    throws org.xml.sax.SAXException
  +  /**
  +   * Constructor NodeSortKey
  +   *
  +   *
  +   * NEEDSDOC @param transformer
  +   * NEEDSDOC @param selectPat
  +   * NEEDSDOC @param treatAsNumbers
  +   * NEEDSDOC @param descending
  +   * NEEDSDOC @param langValue
  +   * NEEDSDOC @param caseOrderUpper
  +   * NEEDSDOC @param namespaceContext
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  NodeSortKey(
  +          TransformerImpl transformer, XPath selectPat, boolean treatAsNumbers, boolean descending, String langValue, boolean caseOrderUpper, org.apache.xalan.utils.PrefixResolver namespaceContext)
  +            throws org.xml.sax.SAXException
     {
  +
       m_processor = transformer;
       m_namespaceContext = namespaceContext;
       m_selectPat = selectPat;
       m_treatAsNumbers = treatAsNumbers;
       m_descending = descending;
  -	  m_caseOrderUpper = caseOrderUpper;
  -    if(null != langValue && m_treatAsNumbers == false)
  +    m_caseOrderUpper = caseOrderUpper;
  +
  +    if (null != langValue && m_treatAsNumbers == false)
       {
         m_locale = new Locale(langValue.toUpperCase(),
                               Locale.getDefault().getDisplayCountry());
  -      if(null == m_locale)
  +
  +      if (null == m_locale)
         {
  +
           // m_processor.warn("Could not find locale for <sort xml:lang="+langValue);
           m_locale = Locale.getDefault();
         }
  @@ -106,12 +139,13 @@
       }
   
       m_col = Collator.getInstance(m_locale);
  -    if(null == m_col)
  +
  +    if (null == m_col)
       {
  -      m_processor.getMsgMgr().warn(
  -        XSLTErrorResources.WG_CANNOT_FIND_COLLATOR, new Object[] {langValue}); //"Could not find Collator for <sort xml:lang="+langValue);
  +      m_processor.getMsgMgr().warn(XSLTErrorResources.WG_CANNOT_FIND_COLLATOR,
  +                                   new Object[]{ langValue });  //"Could not find Collator for <sort xml:lang="+langValue);
  +
         m_col = Collator.getInstance();
       }
     }
   }
  -
  
  
  
  1.5       +307 -197  xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java
  
  Index: NodeSorter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/NodeSorter.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- NodeSorter.java	2000/10/05 22:58:25	1.4
  +++ NodeSorter.java	2000/10/30 18:56:59	1.5
  @@ -57,147 +57,184 @@
   package org.apache.xalan.transformer;
   
   import java.util.Vector;
  +
   import java.text.NumberFormat;
   import java.text.CollationKey;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import org.apache.xpath.axes.ContextNodeList;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.NodeSet;
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNodeSet;
   import org.apache.xalan.utils.NodeVector;
  +
   import org.xml.sax.SAXException;
   
   /**
    * <meta name="usage" content="internal"/>
    * This class can sort vectors of DOM nodes according to a select pattern.
    */
  -class NodeSorter
  +public class NodeSorter
   {
  +
  +  /** NEEDSDOC Field m_execContext          */
     XPathContext m_execContext;
  -  
  -  Vector m_keys; // vector of NodeSortKeys
  -  
  +
  +  /** NEEDSDOC Field m_keys          */
  +  Vector m_keys;  // vector of NodeSortKeys
  +
     /**
      * TODO: Adjust this for locale.
      */
  -  NumberFormat m_formatter = NumberFormat.getNumberInstance();   
  -  
  +  NumberFormat m_formatter = NumberFormat.getNumberInstance();
  +
     /**
  -   * Construct a NodeSorter, passing in the XSL Processor 
  -   * so it can know how to get the node data according to 
  +   * Construct a NodeSorter, passing in the XSL Processor
  +   * so it can know how to get the node data according to
      * the proper whitespace rules.
  +   *
  +   * NEEDSDOC @param p
      */
     public NodeSorter(XPathContext p)
     {
       m_execContext = p;
     }
  -  
  +
     /**
  -   * Given a vector of nodes, sort each node according to 
  +   * Given a vector of nodes, sort each node according to
      * the criteria in the keys.
      * @param v an vector of Nodes.
      * @param keys a vector of NodeSortKeys.
  +   * NEEDSDOC @param support
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void sort(NodeVector v, Vector keys, XPathContext support) 
  -    throws org.xml.sax.SAXException
  - {    
  +  public void sort(NodeVector v, Vector keys, XPathContext support)
  +          throws org.xml.sax.SAXException
  +  {
  +
       m_keys = keys;
  +
       // QuickSort2(v, 0, v.size() - 1 );
       int n = v.size();
  -    
  +
       // Create a vector of node compare elements
       // based on the input vector of nodes
       Vector nodes = new Vector();
  -    for (int i = 0; i<n; i++) 
  +
  +    for (int i = 0; i < n; i++)
       {
  -      NodeCompareElem elem = new NodeCompareElem((Node)v.elementAt(i)); 
  +      NodeCompareElem elem = new NodeCompareElem((Node) v.elementAt(i));
  +
         nodes.addElement(elem);
       }
  +
       Vector scratchVector = new Vector();
  +
       mergesort(nodes, scratchVector, 0, n - 1, support);
  -    
  +
       // return sorted vector of nodes
  -    for (int i = 0; i<n; i++) 
  +    for (int i = 0; i < n; i++)
       {
  -      v.setElementAt(((NodeCompareElem)nodes.elementAt(i)).m_node, i);
  +      v.setElementAt(((NodeCompareElem) nodes.elementAt(i)).m_node, i);
       }
  +
       // old code...
       //NodeVector scratchVector = new NodeVector(n);
       //mergesort(v, scratchVector, 0, n - 1, support);
     }
  -  
  +
     /**
      * Return the results of a compare of two nodes.
      * TODO: Optimize compare -- cache the getStringExpr results, key by m_selectPat + hash of node.
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   * NEEDSDOC @param kIndex
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws SAXException
      */
  -  int compare(NodeCompareElem n1, NodeCompareElem n2, int kIndex, XPathContext support)
  -    throws SAXException
  +  int compare(
  +          NodeCompareElem n1, NodeCompareElem n2, int kIndex, XPathContext support)
  +            throws SAXException
     {
  +
       int result = 0;
  -   
  -    NodeSortKey k = (NodeSortKey)m_keys.elementAt(kIndex); 
  -    if(k.m_treatAsNumbers)
  +    NodeSortKey k = (NodeSortKey) m_keys.elementAt(kIndex);
  +
  +    if (k.m_treatAsNumbers)
       {
  -		  double n1Num, n2Num;
  -	    if (kIndex ==0)
  -      { 
  -        n1Num = ((Double)n1.m_key1Value).doubleValue();
  -        n2Num = ((Double)n2.m_key1Value).doubleValue();
  -      }
  -	    else if (kIndex ==1)
  -      { 
  -        n1Num = ((Double)n1.m_key2Value).doubleValue();
  -        n2Num = ((Double)n2.m_key2Value).doubleValue();
  +      double n1Num, n2Num;
  +
  +      if (kIndex == 0)
  +      {
  +        n1Num = ((Double) n1.m_key1Value).doubleValue();
  +        n2Num = ((Double) n2.m_key1Value).doubleValue();
         }
  -      /* Leave this in case we decide to use an array later 
  +      else if (kIndex == 1)
  +      {
  +        n1Num = ((Double) n1.m_key2Value).doubleValue();
  +        n2Num = ((Double) n2.m_key2Value).doubleValue();
  +      }
  +
  +      /* Leave this in case we decide to use an array later
         if (kIndex < maxkey)
  -      { 
  +      {
         double n1Num = (double)n1.m_keyValue[kIndex];
         double n2Num = (double)n2.m_keyValue[kIndex];
         }*/
         else
         {
  +
           // Get values dynamically
  -        XObject r1 = k.m_selectPat.execute(m_execContext, n1.m_node, k.m_namespaceContext);
  -        XObject r2 = k.m_selectPat.execute(m_execContext, n2.m_node, k.m_namespaceContext);
  -    
  +        XObject r1 = k.m_selectPat.execute(m_execContext, n1.m_node,
  +                                           k.m_namespaceContext);
  +        XObject r2 = k.m_selectPat.execute(m_execContext, n2.m_node,
  +                                           k.m_namespaceContext);
           double d = r1.num();
  +
           // Can't use NaN for compare. They are never equal. Use zero instead.
           // That way we can keep elements in document order. 
  -        n1Num = Double.isNaN(d)? 0.0 : d;
  +        n1Num = Double.isNaN(d) ? 0.0 : d;
           d = r2.num();
  -        n2Num = Double.isNaN(d)? 0.0 : d;
  -      } 
  -      
  -      if((n1Num == n2Num) && ((kIndex+1) < m_keys.size()))
  +        n2Num = Double.isNaN(d) ? 0.0 : d;
  +      }
  +
  +      if ((n1Num == n2Num) && ((kIndex + 1) < m_keys.size()))
         {
  -        result = compare(n1, n2, kIndex+1, support);
  +        result = compare(n1, n2, kIndex + 1, support);
         }
         else
         {
           double diff = n1Num - n2Num;
  +
           // process order parameter 
  -        result = (int)((diff < 0.0) 
  -                       ? (k.m_descending ? 1 : -1) 
  -                         : (diff > 0.0) ? (k.m_descending ? -1 : 1)
  -                                          : 0);
  +        result = (int) ((diff < 0.0)
  +                        ? (k.m_descending ? 1 : -1)
  +                        : (diff > 0.0) ? (k.m_descending ? -1 : 1) : 0);
         }
  -    }// end treat as numbers 
  +    }  // end treat as numbers 
       else
       {
  -		  CollationKey n1String, n2String;
  -	    if (kIndex == 0)
  +      CollationKey n1String, n2String;
  +
  +      if (kIndex == 0)
         {
  -        n1String = (CollationKey)n1.m_key1Value;
  -        n2String = (CollationKey)n2.m_key1Value;
  +        n1String = (CollationKey) n1.m_key1Value;
  +        n2String = (CollationKey) n2.m_key1Value;
         }
  -	    else if (kIndex == 1)
  +      else if (kIndex == 1)
         {
  -        n1String = (CollationKey)n1.m_key2Value;
  -        n2String = (CollationKey)n2.m_key2Value;
  -      }	
  +        n1String = (CollationKey) n1.m_key2Value;
  +        n2String = (CollationKey) n2.m_key2Value;
  +      }
  +
         /* Leave this in case we decide to use an array later
         if (kIndex < maxkey)
         {
  @@ -206,75 +243,97 @@
         }*/
         else
         {
  +
           // Get values dynamically
  -        XObject r1 = k.m_selectPat.execute(m_execContext, n1.m_node, k.m_namespaceContext);
  -        XObject r2 = k.m_selectPat.execute(m_execContext, n2.m_node, k.m_namespaceContext);
  -    
  +        XObject r1 = k.m_selectPat.execute(m_execContext, n1.m_node,
  +                                           k.m_namespaceContext);
  +        XObject r2 = k.m_selectPat.execute(m_execContext, n2.m_node,
  +                                           k.m_namespaceContext);
  +
           n1String = k.m_col.getCollationKey(r1.str());
           n2String = k.m_col.getCollationKey(r2.str());
         }
  -    
  +
         // Use collation keys for faster compare, but note that whitespaces 
         // etc... are treated differently from if we were comparing Strings.
         result = n1String.compareTo(n2String);
  -            
  +
         //Process caseOrder parameter
         if (k.m_caseOrderUpper)
  -	    {
  -	      String tempN1 = n1String.getSourceString().toLowerCase();
  -		    String tempN2 = n2String.getSourceString().toLowerCase();
  -		    if (tempN1.equals(tempN2))
  -		    {
  -		      //java defaults to upper case is greater.
  -		      result = result == 0 ? 0 : -result;	
  -		    }	
  -	    }
  -      
  +      {
  +        String tempN1 = n1String.getSourceString().toLowerCase();
  +        String tempN2 = n2String.getSourceString().toLowerCase();
  +
  +        if (tempN1.equals(tempN2))
  +        {
  +
  +          //java defaults to upper case is greater.
  +          result = result == 0 ? 0 : -result;
  +        }
  +      }
  +
         //Process order parameter
  -      if(k.m_descending)
  +      if (k.m_descending)
         {
           result = -result;
         }
  -    }//end else
  -	
  -    if(0 == result)
  +    }  //end else
  +
  +    if (0 == result)
       {
  -      if((kIndex+1) < m_keys.size())
  +      if ((kIndex + 1) < m_keys.size())
         {
  -        result = compare(n1, n2, kIndex+1, support);
  +        result = compare(n1, n2, kIndex + 1, support);
         }
       }
  -    if(0 == result)
  +
  +    if (0 == result)
       {
  +
         // I shouldn't have to do this except that there seems to 
         // be a glitch in the mergesort
  -      
         // if(r1.getType() == r1.CLASS_NODESET)
         // {
  -        result = support.getDOMHelper().isNodeAfter(n1.m_node, n2.m_node) ? -1 : 1;
  +      result = support.getDOMHelper().isNodeAfter(n1.m_node, n2.m_node)
  +               ? -1 : 1;
  +
         // }
       }
  +
       return result;
     }
  -  
  +
     /**
  -   * This implements a standard Mergesort, as described in 
  -   * Robert Sedgewick's Algorithms book.  This is a better 
  -   * sort for our purpose than the Quicksort because it 
  -   * maintains the original document order of the input if 
  +   * This implements a standard Mergesort, as described in
  +   * Robert Sedgewick's Algorithms book.  This is a better
  +   * sort for our purpose than the Quicksort because it
  +   * maintains the original document order of the input if
      * the order isn't changed by the sort.
  +   *
  +   * NEEDSDOC @param a
  +   * NEEDSDOC @param b
  +   * NEEDSDOC @param l
  +   * NEEDSDOC @param r
  +   * NEEDSDOC @param support
  +   *
  +   * @throws SAXException
      */
     void mergesort(Vector a, Vector b, int l, int r, XPathContext support)
  -    throws SAXException
  +          throws SAXException
     {
  -    if((r-l)>0)
  +
  +    if ((r - l) > 0)
       {
  -      int m = (r+l) / 2;
  +      int m = (r + l) / 2;
  +
         mergesort(a, b, l, m, support);
  -      mergesort(a, b, m+1, r, support);
  +      mergesort(a, b, m + 1, r, support);
  +
         int i, j, k;
  -      for(i = m; i >= l; i--)
  +
  +      for (i = m; i >= l; i--)
         {
  +
           // b[i] = a[i];
           // Use insert if we need to increment vector size.
           if (i >= b.size())
  @@ -282,42 +341,55 @@
           else
             b.setElementAt(a.elementAt(i), i);
         }
  -      i=l;
  -      for(j = (m + 1); j <= r; j++)
  +
  +      i = l;
  +
  +      for (j = (m + 1); j <= r; j++)
         {
  +
           // b[r+m+1-j] = a[j];
  -        if (r+m+1-j>= b.size())
  -          b.insertElementAt(a.elementAt(j), r+m+1-j);
  +        if (r + m + 1 - j >= b.size())
  +          b.insertElementAt(a.elementAt(j), r + m + 1 - j);
           else
  -          b.setElementAt(a.elementAt(j), r+m+1-j);
  +          b.setElementAt(a.elementAt(j), r + m + 1 - j);
         }
  -      j=r;
  +
  +      j = r;
  +
         int compVal;
  -      for(k = l; k <= r; k++)
  +
  +      for (k = l; k <= r; k++)
         {
  +
           // if(b[i] < b[j])
           if (i == j)
             compVal = -1;
           else
  -          compVal = compare((NodeCompareElem)b.elementAt(i), (NodeCompareElem)b.elementAt(j), 0, support);
  -        
  -        if(compVal < 0)
  +          compVal = compare((NodeCompareElem) b.elementAt(i),
  +                            (NodeCompareElem) b.elementAt(j), 0, support);
  +
  +        if (compVal < 0)
           {
  +
             // a[k]=b[i];
             a.setElementAt(b.elementAt(i), k);
  -          i++;          
  +
  +          i++;
           }
  -        else if(compVal > 0)
  +        else if (compVal > 0)
           {
  +
             // a[k]=b[j]; 
             a.setElementAt(b.elementAt(j), k);
  -          j--;          
  -        }  
  +
  +          j--;
  +        }
         }
       }
     }
  -  
  -  /** This is a generic version of C.A.R Hoare's Quick Sort 
  +
  +  /**
  +   * This is a generic version of C.A.R Hoare's Quick Sort
      * algorithm.  This will handle arrays that are already
      * sorted, and arrays with duplicate keys.<BR>
      *
  @@ -330,156 +402,194 @@
      * @param a       an integer array
      * @param lo0     left boundary of array partition
      * @param hi0     right boundary of array partition
  +   *
  +   * NEEDSDOC @param v
  +   * NEEDSDOC @param i
  +   * NEEDSDOC @param j
      */
  -/*  private void QuickSort2(Vector v, int lo0, int hi0, XPathContext support)
  -    throws org.xml.sax.SAXException,
  -           java.net.MalformedURLException, 
  -           java.io.FileNotFoundException, 
  -           java.io.IOException
  -  {
  -    int lo = lo0;
  -    int hi = hi0;
   
  -    if ( hi0 > lo0)
  +  /*  private void QuickSort2(Vector v, int lo0, int hi0, XPathContext support)
  +      throws org.xml.sax.SAXException,
  +             java.net.MalformedURLException,
  +             java.io.FileNotFoundException,
  +             java.io.IOException
       {
  -      // Arbitrarily establishing partition element as the midpoint of
  -      // the array.
  -      Node midNode = (Node)v.elementAt( ( lo0 + hi0 ) / 2 );
  +      int lo = lo0;
  +      int hi = hi0;
   
  -      // loop through the array until indices cross
  -      while( lo <= hi )
  +      if ( hi0 > lo0)
         {
  -        // find the first element that is greater than or equal to 
  -        // the partition element starting from the left Index.
  -        while( (lo < hi0) && (compare((Node)v.elementAt(lo), midNode, 0, support) < 0) )
  -        {
  -          ++lo;
  -        } // end while
  +        // Arbitrarily establishing partition element as the midpoint of
  +        // the array.
  +        Node midNode = (Node)v.elementAt( ( lo0 + hi0 ) / 2 );
   
  -        // find an element that is smaller than or equal to 
  -        // the partition element starting from the right Index.
  -        while( (hi > lo0) && (compare((Node)v.elementAt(hi), midNode, 0, support) > 0) )
  +        // loop through the array until indices cross
  +        while( lo <= hi )
           {
  -          --hi;
  +          // find the first element that is greater than or equal to
  +          // the partition element starting from the left Index.
  +          while( (lo < hi0) && (compare((Node)v.elementAt(lo), midNode, 0, support) < 0) )
  +          {
  +            ++lo;
  +          } // end while
  +
  +          // find an element that is smaller than or equal to
  +          // the partition element starting from the right Index.
  +          while( (hi > lo0) && (compare((Node)v.elementAt(hi), midNode, 0, support) > 0) )
  +          {
  +            --hi;
  +          }
  +
  +          // if the indexes have not crossed, swap
  +          if( lo <= hi )
  +          {
  +            swap(v, lo, hi);
  +            ++lo;
  +            --hi;
  +          }
           }
   
  -        // if the indexes have not crossed, swap
  -        if( lo <= hi ) 
  +        // If the right index has not reached the left side of array
  +        // must now sort the left partition.
  +        if( lo0 < hi )
           {
  -          swap(v, lo, hi);
  -          ++lo;
  -          --hi;
  +          QuickSort2( v, lo0, hi, support );
           }
  -      }
  -
  -      // If the right index has not reached the left side of array
  -      // must now sort the left partition.
  -      if( lo0 < hi )
  -      {
  -        QuickSort2( v, lo0, hi, support );
  -      }
   
  -      // If the left index has not reached the right side of array
  -      // must now sort the right partition.
  -      if( lo < hi0 )
  -      {
  -        QuickSort2( v, lo, hi0, support );
  +        // If the left index has not reached the right side of array
  +        // must now sort the right partition.
  +        if( lo < hi0 )
  +        {
  +          QuickSort2( v, lo, hi0, support );
  +        }
         }
  -    }
  -  } // end QuickSort2  */
  +    } // end QuickSort2  */
   
     /**
  -   * Simple function to swap two elements in 
  +   * Simple function to swap two elements in
      * a vector.
      */
     private void swap(Vector v, int i, int j)
     {
  -    Node node = (Node)v.elementAt(i); 
  +
  +    Node node = (Node) v.elementAt(i);
  +
       v.setElementAt(v.elementAt(j), i);
       v.setElementAt(node, j);
     }
  -  
  +
  +  /**
  +   * <meta name="usage" content="internal"/>
  +   * NEEDSDOC Class NodeCompareElem <needs-comment/>
  +   */
     class NodeCompareElem
     {
  +
  +    /** NEEDSDOC Field m_node          */
       Node m_node;
  +
       // This maxkey value was chosen arbitrarily. We are assuming that the    
       // maxkey + 1 keys will only hit fairly rarely and therefore, we
       // will get the node values for those keys dynamically.
  +
  +    /** NEEDSDOC Field maxkey          */
       int maxkey = 2;
  +
       // Keep this in case we decide to use an array. Right now
       // using two variables is cheaper.
       //Object[] m_KeyValue = new Object[2];
  -	  Object m_key1Value;
  -	  Object m_key2Value;
  -    
  +
  +    /** NEEDSDOC Field m_key1Value          */
  +    Object m_key1Value;
  +
  +    /** NEEDSDOC Field m_key2Value          */
  +    Object m_key2Value;
  +
  +    /**
  +     * Constructor NodeCompareElem
  +     *
  +     *
  +     * NEEDSDOC @param node
  +     *
  +     * @throws org.xml.sax.SAXException
  +     */
       NodeCompareElem(Node node) throws org.xml.sax.SAXException
       {
  +
         boolean tryNextKey = true;
  +
         m_node = node;
  +
         if (!m_keys.isEmpty())
  -      { 
  -		    NodeSortKey k1 = (NodeSortKey)m_keys.elementAt(0);
  -        XObject r = k1.m_selectPat.execute(m_execContext, node, k1.m_namespaceContext);
  -        
  +      {
  +        NodeSortKey k1 = (NodeSortKey) m_keys.elementAt(0);
  +        XObject r = k1.m_selectPat.execute(m_execContext, node,
  +                                           k1.m_namespaceContext);
  +
           if (r == null)
             tryNextKey = false;
  -        
  -        double d ;
  -        if(k1.m_treatAsNumbers)
  -        {  
  +
  +        double d;
  +
  +        if (k1.m_treatAsNumbers)
  +        {
             d = r.num();
  +
             // Can't use NaN for compare. They are never equal. Use zero instead.  
  -          m_key1Value = new Double(Double.isNaN(d)? 0.0 : d);
  -        }  
  +          m_key1Value = new Double(Double.isNaN(d) ? 0.0 : d);
  +        }
           else
           {
             m_key1Value = k1.m_col.getCollationKey(r.str());
           }
  -        
  -         if (r.getType()== XObject.CLASS_NODESET)
  +
  +        if (r.getType() == XObject.CLASS_NODESET)
           {
  -           NodeIterator ni = (NodeIterator)r.object();
  -           if(ni instanceof ContextNodeList)
  -             tryNextKey = (((ContextNodeList)ni).getCurrentNode() != null);
  -           // else abdicate... should never happen, but... -sb
  +          NodeIterator ni = (NodeIterator) r.object();
  +
  +          if (ni instanceof ContextNodeList)
  +            tryNextKey = (((ContextNodeList) ni).getCurrentNode() != null);
  +
  +          // else abdicate... should never happen, but... -sb
           }
  -		  
  -		    if (m_keys.size()>1)
  -		    {
  -			    NodeSortKey k2 = (NodeSortKey)m_keys.elementAt(1);
  +
  +        if (m_keys.size() > 1)
  +        {
  +          NodeSortKey k2 = (NodeSortKey) m_keys.elementAt(1);
  +
             if (!tryNextKey)
  -          {  
  -            if(k2.m_treatAsNumbers)            
  -              m_key2Value =  new Double(0.0);              
  +          {
  +            if (k2.m_treatAsNumbers)
  +              m_key2Value = new Double(0.0);
               else
                 m_key2Value = k2.m_col.getCollationKey("");
  -          }  
  +          }
             else
  -          {  
  -            XObject r2 = k2.m_selectPat.execute(m_execContext, node, k2.m_namespaceContext);
  -            if(k2.m_treatAsNumbers)
  +          {
  +            XObject r2 = k2.m_selectPat.execute(m_execContext, node,
  +                                                k2.m_namespaceContext);
  +
  +            if (k2.m_treatAsNumbers)
               {
                 d = r2.num();
  -              m_key2Value = new Double(Double.isNaN(d)? 0.0 : d);
  -            }  
  +              m_key2Value = new Double(Double.isNaN(d) ? 0.0 : d);
  +            }
               else
                 m_key2Value = k2.m_col.getCollationKey(r2.str());
             }
  -		    }	  
  +        }
  +
           /* Leave this in case we decide to use an array later
           while (kIndex <= m_keys.size() && kIndex < maxkey)
  -        {  
  +        {
             NodeSortKey k = (NodeSortKey)m_keys.elementAt(kIndex);
             XObject r = k.m_selectPat.execute(m_execContext, node, k.m_namespaceContext);
  -          if(k.m_treatAsNumbers)    
  +          if(k.m_treatAsNumbers)
               m_KeyValue[kIndex] = r.num();
             else
               m_KeyValue[kIndex] = r.str();
           } */
  -		  
  -      } // end if not empty    
  -    }  
  -  } // end NodeCompareElem class
  -
  +      }  // end if not empty    
  +    }
  +  }  // end NodeCompareElem class
   }
  -
  
  
  
  1.2       +101 -57   xml-xalan/java/src/org/apache/xalan/transformer/NumeratorFormatter.java
  
  Index: NumeratorFormatter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/NumeratorFormatter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NumeratorFormatter.java	2000/06/19 16:53:05	1.1
  +++ NumeratorFormatter.java	2000/10/30 18:56:59	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -54,11 +54,11 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -
   package org.apache.xalan.transformer;
   
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +
   import java.util.Locale;
   import java.util.NoSuchElementException;
   
  @@ -69,10 +69,20 @@
    */
   class NumeratorFormatter
   {
  +
  +  /** NEEDSDOC Field m_xslNumberElement          */
     protected Element m_xslNumberElement;
  +
  +  /** NEEDSDOC Field m_formatTokenizer          */
     NumberFormatStringTokenizer m_formatTokenizer;
  +
  +  /** NEEDSDOC Field m_locale          */
     Locale m_locale;
  +
  +  /** NEEDSDOC Field m_formatter          */
     java.text.NumberFormat m_formatter;
  +
  +  /** NEEDSDOC Field m_processor          */
     TransformerImpl m_processor;
   
     /**
  @@ -80,42 +90,40 @@
      * @see TransformerImpl#DecimalToRoman
      * @see TransformerImpl#long2roman
      */
  -  private final static DecimalToRoman m_romanConvertTable[] =
  -  {
  +  private final static DecimalToRoman m_romanConvertTable[] = {
       new DecimalToRoman(1000, "M", 900, "CM"),
       new DecimalToRoman(500, "D", 400, "CD"),
       new DecimalToRoman(100L, "C", 90L, "XC"),
       new DecimalToRoman(50L, "L", 40L, "XL"),
       new DecimalToRoman(10L, "X", 9L, "IX"),
       new DecimalToRoman(5L, "V", 4L, "IV"),
  -    new DecimalToRoman(1L, "I", 1L, "I")
  -  };
  +    new DecimalToRoman(1L, "I", 1L, "I") };
   
     /**
      * Chars for converting integers into alpha counts.
      * @see TransformerImpl#int2alphaCount
      */
  -  private final static char[] m_alphaCountTable =
  -  {
  -    'Z', // z for zero
    'A' , 'B' , 'C' , 'D' , 'E' , 'F' ,
  -    'G' , 'H' , 'I' , 'J' , 'K' , 'L' ,
  -    'M' , 'N' , 'O' , 'P' , 'Q' , 'R' ,
  -    'S' , 'T' , 'U' , 'V' , 'W' , 'X' ,
  -    'Y'
  -  };
  +  private final static char[] m_alphaCountTable = { 'Z',  // z for zero
  +                                                    'A', 'B', 'C', 'D', 'E',
  +                                                    'F', 'G', 'H', 'I', 'J',
  +                                                    'K', 'L', 'M', 'N', 'O',
  +                                                    'P', 'Q', 'R', 'S', 'T',
  +                                                    'U', 'V', 'W', 'X', 'Y' };
   
     /**
      * Construct a NumeratorFormatter using an element
      * that contains XSL number conversion attributes -
      * format, letter-value, xml:lang, digit-group-sep,
      * n-digits-per-group, and sequence-src.
  +   *
  +   * NEEDSDOC @param xslNumberElement
  +   * NEEDSDOC @param processor
      */
     NumeratorFormatter(Element xslNumberElement, TransformerImpl processor)
     {
       m_xslNumberElement = xslNumberElement;
       m_processor = processor;
  -
  -  } // end NumeratorFormatter(Element) constructor
  +  }  // end NumeratorFormatter(Element) constructor
   
     /**
      * Convert a long integer into alphabetic counting, in other words
  @@ -128,7 +136,7 @@
      * Note that the radix of the conversion is inferred from the size
      * of the table.
      */
  -  protected String int2alphaCount(int val, char [] table)
  +  protected String int2alphaCount(int val, char[] table)
     {
   
       int radix = table.length;
  @@ -139,20 +147,20 @@
       char buf[] = new char[100];
   
       // next character to set in the buffer
  -    int charPos = buf.length -1 ;    // work backward through buf[]
  +    int charPos = buf.length - 1;  // work backward through buf[]
   
       // index in table of the last character that we stored
       int lookupIndex = 1;  // start off with anything other than zero to make correction work
   
  -    //						Correction number
  +    //                                          Correction number
       //
  -    //	Correction can take on exactly two values:
  +    //  Correction can take on exactly two values:
       //
  -    //		0	if the next character is to be emitted is usual
  +    //          0       if the next character is to be emitted is usual
       //
       //      radix - 1
  -    //			if the next char to be emitted should be one less than
  -    //			you would expect
  +    //                  if the next char to be emitted should be one less than
  +    //                  you would expect
       //
       // For example, consider radix 10, where 1="A" and 10="J"
       //
  @@ -168,21 +176,21 @@
       // it can represent either 10 or zero).  In summary, the correction value of
       // "radix-1" acts like "-1" when run through the mod operator, but with the
       // desireable characteristic that it never produces a negative number.
  -
       int correction = 0;
   
       // TODO:  throw error on out of range input
  -
       do
       {
  +
         // most of the correction calculation is explained above,  the reason for the
         // term after the "|| " is that it correctly propagates carries across
         // multiple columns.
  -      correction = ((lookupIndex == 0) ||
  -                    (correction != 0 && lookupIndex == radix-1 )) ? (radix-1) : 0;
  +      correction =
  +        ((lookupIndex == 0) || (correction != 0 && lookupIndex == radix - 1))
  +        ? (radix - 1) : 0;
   
         // index in "table" of the next char to emit
  -      lookupIndex  = (val+correction) % radix;
  +      lookupIndex = (val + correction) % radix;
   
         // shift input by one "column"
         val = (val / radix);
  @@ -194,9 +202,9 @@
         // put out the next character of output
         buf[charPos--] = table[lookupIndex];
       }
  -      while (val > 0);
  +    while (val > 0);
   
  -    return new String(buf, charPos+1, (buf.length - charPos -1));
  +    return new String(buf, charPos + 1, (buf.length - charPos - 1));
     }
   
     /**
  @@ -210,13 +218,15 @@
      */
     String long2roman(long val, boolean prefixesAreOK)
     {
  -    if(val <= 0)
  +
  +    if (val <= 0)
       {
  -      return "#E("+val+")";
  +      return "#E(" + val + ")";
       }
   
       String roman = "";
       int place = 0;
  +
       if (val <= 3999L)
       {
         do
  @@ -226,6 +236,7 @@
             roman += m_romanConvertTable[place].m_postLetter;
             val -= m_romanConvertTable[place].m_postValue;
           }
  +
           if (prefixesAreOK)
           {
             if (val >= m_romanConvertTable[place].m_preValue)
  @@ -234,16 +245,18 @@
               val -= m_romanConvertTable[place].m_preValue;
             }
           }
  +
           place++;
         }
  -        while (val > 0);
  +      while (val > 0);
       }
       else
       {
         roman = "#error";
       }
  +
       return roman;
  -  } // end long2roman
  +  }  // end long2roman
   
     /**
      * This class returns tokens using non-alphanumberic
  @@ -251,20 +264,41 @@
      */
     class NumberFormatStringTokenizer
     {
  +
  +    /** NEEDSDOC Field currentPosition          */
       private int currentPosition;
  +
  +    /** NEEDSDOC Field maxPosition          */
       private int maxPosition;
  +
  +    /** NEEDSDOC Field str          */
       private String str;
  -
    /**
  +
  +    /**
        * Construct a NumberFormatStringTokenizer.
  +     *
  +     * NEEDSDOC @param str
        */
  -    NumberFormatStringTokenizer(String str) 
    {
  +    NumberFormatStringTokenizer(String str)
  +    {
         this.str = str;
         maxPosition = str.length();
  -    }
    
    /**
  +    }
  +
  +    /**
        * Reset tokenizer so that nextToken() starts from the beginning.
  -     */
    void reset()
    {
      currentPosition = 0;
  +     */
  +
  +    /**
  +     * NEEDSDOC Method reset 
  +     *
  +     */
  +    void reset()
  +    {
  +      currentPosition = 0;
       }
  -
    /**
  +
  +    /**
        * Returns the next token from this string tokenizer.
        *
        * @return     the next token from this string tokenizer.
  @@ -273,34 +307,40 @@
        */
       String nextToken()
       {
  +
         if (currentPosition >= maxPosition)
         {
           throw new NoSuchElementException();
         }
   
         int start = currentPosition;
  -      while ((currentPosition < maxPosition) &&
  -             Character.isLetterOrDigit(str.charAt(currentPosition)))
  +
  +      while ((currentPosition < maxPosition)
  +             && Character.isLetterOrDigit(str.charAt(currentPosition)))
         {
           currentPosition++;
         }
  -      if ((start == currentPosition) &&
  -          (!Character.isLetterOrDigit(str.charAt(currentPosition))))
  +
  +      if ((start == currentPosition)
  +              && (!Character.isLetterOrDigit(str.charAt(currentPosition))))
         {
           currentPosition++;
         }
  +
         return str.substring(start, currentPosition);
       }
  -    
    /**
  -     * Tells if <code>nextToken</code> will throw an exception 
     * if it is called.
  +
  +    /**
  +     * Tells if <code>nextToken</code> will throw an exception      * if it is called.
        *
  -     * @return true if <code>nextToken</code> can be called 
     * without throwing an exception.
  +     * @return true if <code>nextToken</code> can be called      * without throwing an exception.
        */
       boolean hasMoreTokens()
       {
         return (currentPosition >= maxPosition) ? false : true;
       }
  -    
    /**
  +
  +    /**
        * Calculates the number of times that this tokenizer's
        * <code>nextToken</code> method can be called before it generates an
        * exception.
  @@ -311,26 +351,30 @@
        */
       int countTokens()
       {
  +
         int count = 0;
         int currpos = currentPosition;
   
         while (currpos < maxPosition)
         {
           int start = currpos;
  -        while ((currpos < maxPosition) &&
  -               Character.isLetterOrDigit(str.charAt(currpos)))
  +
  +        while ((currpos < maxPosition)
  +               && Character.isLetterOrDigit(str.charAt(currpos)))
           {
             currpos++;
           }
  -        if ((start == currpos) &&
  -            (Character.isLetterOrDigit(str.charAt(currpos)) == false))
  +
  +        if ((start == currpos)
  +                && (Character.isLetterOrDigit(str.charAt(currpos)) == false))
           {
             currpos++;
           }
  +
           count++;
         }
  +
         return count;
       }
  -  } // end NumberFormatStringTokenizer
  -
  -}
  \ No newline at end of file
  +  }  // end NumberFormatStringTokenizer
  +}
  
  
  
  1.3       +84 -66    xml-xalan/java/src/org/apache/xalan/transformer/QueuedEvents.java
  
  Index: QueuedEvents.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/QueuedEvents.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueuedEvents.java	2000/10/17 19:13:15	1.2
  +++ QueuedEvents.java	2000/10/30 18:57:00	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,129 +57,147 @@
   package org.apache.xalan.transformer;
   
   import java.util.Stack;
  +
   import org.apache.xalan.utils.ObjectPool;
  +
   import org.xml.sax.Attributes;
   
   /**
  - * This class acts as a base for ResultTreeHandler, and keeps 
  - * queud stack events.  In truth, we don't need a stack, 
  + * This class acts as a base for ResultTreeHandler, and keeps
  + * queud stack events.  In truth, we don't need a stack,
    * so I may change this down the line a bit.
    */
   abstract class QueuedEvents
   {
  -  /**
  -   * Get the queued document event.
  -   */
  -  QueuedSAXEvent getQueuedSAXEvent()
  -  {
  -    return (QueuedSAXEvent)m_eventQueue.peek();
  -  }
  -  
  +
  +  /** NEEDSDOC Field m_eventCount          */
  +  int m_eventCount = 0;
  +
  +  /** NEEDSDOC Field m_startDoc          */
  +  QueuedStartDocument m_startDoc = new QueuedStartDocument();
  +
  +  /** NEEDSDOC Field m_startElement          */
  +  QueuedStartElement m_startElement = new QueuedStartElement();
  +
     /**
      * Get the queued document event.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     QueuedStartDocument getQueuedDoc()
     {
  -    QueuedSAXEvent event = (QueuedSAXEvent)m_eventQueue.peek();
  -    return (event.getType() == QueuedSAXEvent.DOC) 
  -           ? (QueuedStartDocument)event : null;
  +    return (m_eventCount == 1) ? m_startDoc : null;
     }
  -  
  +
     /**
      * Get the queued document event.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     QueuedStartDocument getQueuedDocAtBottom()
     {
  -    return (QueuedStartDocument)m_eventQueue.elementAt(0);
  +    return m_startDoc;
     }
   
  -
     /**
      * Get the queued element.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     QueuedStartElement getQueuedElem()
     {
  -    QueuedSAXEvent event = (QueuedSAXEvent)m_eventQueue.peek();
  -    return (event.getType() == QueuedSAXEvent.ELEM) 
  -           ? (QueuedStartElement)event : null;
  +    return (m_eventCount > 1) ? m_startElement : null;
     }
  -  
  +
     /**
      * This is for the derived class to init new events.
  +   *
  +   * NEEDSDOC @param qse
      */
     protected abstract void initQSE(QueuedSAXEvent qse);
  -  
  +
  +  /**
  +   * NEEDSDOC Method reInitEvents 
  +   *
  +   */
     protected void reInitEvents()
     {
  -    int n = m_eventQueue.size();
  -    for(int i = 0; i < n; i++)
  -    {
  -      QueuedSAXEvent qse = (QueuedSAXEvent)m_eventQueue.elementAt(i);
  -      initQSE(qse);
  -    }
  +    initQSE(m_startDoc);
  +    initQSE(m_startElement);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method reset 
  +   *
  +   */
     public void reset()
     {
  -    // if(null != m_serializer)
  -    //  m_serializer.reset();
  -    m_eventQueue.removeAllElements();
       pushDocumentEvent();
  -    this.reInitEvents();
  +    reInitEvents();
     }
  -  
  +
     /**
      * Push the document event.  This never gets popped.
      */
     void pushDocumentEvent()
     {
  -    QueuedStartDocument qsd 
  -      = new QueuedStartDocument();
  -    qsd.setPending(true);
  -    m_eventQueue.push(qsd);
  -    initQSE(qsd);
  -  }
   
  -  void pushElementEvent(String ns, String localName, String name, Attributes atts)
  -  {
  -    QueuedStartElement qse = (QueuedStartElement)m_queuedStartElementPool.getInstance();
  -    m_eventQueue.push(qse);
  -    qse.setPending(ns, localName, name, atts);
  -    initQSE(qse);
  -  }
  -  
  -  QueuedSAXEvent popEvent()
  -  {
  -    QueuedSAXEvent event = (QueuedSAXEvent)m_eventQueue.pop();
  -    m_queuedStartElementPool.freeInstance(event);
  -    event.reset();
  -    return event;
  +    m_startDoc.setPending(true);
  +    initQSE(m_startDoc);
  +
  +    m_eventCount++;
     }
  -    
  +
     /**
  -   * Stack of QueuedSAXEvents.
  +   * NEEDSDOC Method pushElementEvent 
  +   *
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
      */
  -  private Stack m_eventQueue = new Stack();
  -  
  +  void pushElementEvent(String ns, String localName, String name,
  +                        Attributes atts)
  +  {
  +
  +    m_startElement.setPending(ns, localName, name, atts);
  +    initQSE(m_startElement);
  +
  +    m_eventCount++;
  +  }
  +
     /**
  -   * Pool of QueuedStartElement objects.
  +   * NEEDSDOC Method popEvent 
  +   *
      */
  -  private ObjectPool m_queuedStartElementPool = new ObjectPool(QueuedStartElement.class);
  -  
  +  void popEvent()
  +  {
  +
  +    m_startElement.reset();
  +
  +    m_eventCount--;
  +  }
  +
  +  /** NEEDSDOC Field m_serializer          */
     private org.apache.serialize.Serializer m_serializer;
  -  
  +
     /**
  -   * This is only for use of object pooling, so the that 
  +   * This is only for use of object pooling, so the that
      * it can be reset.
  +   *
  +   * NEEDSDOC @param s
      */
     void setSerializer(org.apache.serialize.Serializer s)
     {
       m_serializer = s;
     }
  -  
  +
     /**
  -   * This is only for use of object pooling, so the that 
  +   * This is only for use of object pooling, so the that
      * it can be reset.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     org.apache.serialize.Serializer getSerializer()
     {
  
  
  
  1.3       +87 -30    xml-xalan/java/src/org/apache/xalan/transformer/QueuedSAXEvent.java
  
  Index: QueuedSAXEvent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/QueuedSAXEvent.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueuedSAXEvent.java	2000/10/17 19:14:14	1.2
  +++ QueuedSAXEvent.java	2000/10/30 18:57:00	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -68,50 +68,109 @@
    */
   public abstract class QueuedSAXEvent
   {
  +
  +  /**
  +   * Constructor QueuedSAXEvent
  +   *
  +   *
  +   * NEEDSDOC @param type
  +   */
     public QueuedSAXEvent(int type)
     {
       m_type = type;
     }
  -  
  +
  +  /** NEEDSDOC Field DOC          */
     static final int DOC = 1;
  +
  +  /** NEEDSDOC Field ELEM          */
     static final int ELEM = 2;
  +
  +  /** NEEDSDOC Field m_traceManager          */
     protected TraceManager m_traceManager;
  +
  +  /** NEEDSDOC Field m_transformer          */
     protected TransformerImpl m_transformer;
  +
  +  /** NEEDSDOC Field m_contentHandler          */
     protected ContentHandler m_contentHandler;
  -  
  +
  +  /** NEEDSDOC Field isPending          */
     public boolean isPending = false;
  +
  +  /** NEEDSDOC Field isEnded          */
     public boolean isEnded = false;
  -  
  +
  +  /** NEEDSDOC Field m_type          */
     private int m_type;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getType 
  +   *
  +   *
  +   * NEEDSDOC (getType) @return
  +   */
     int getType()
     {
       return m_type;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setTraceManager 
  +   *
  +   *
  +   * NEEDSDOC @param traceManager
  +   */
     void setTraceManager(TraceManager traceManager)
     {
       m_traceManager = traceManager;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setTransformer 
  +   *
  +   *
  +   * NEEDSDOC @param transformer
  +   */
     void setTransformer(TransformerImpl transformer)
     {
       m_transformer = transformer;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method fireGenerateEvent 
  +   *
  +   *
  +   * NEEDSDOC @param type
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param attrs
  +   */
     protected void fireGenerateEvent(int type, String name, Attributes attrs)
     {
  -    GenerateEvent ge 
  -      = new GenerateEvent(m_transformer, type, name, attrs);
  -    if(null != m_traceManager)
  +
  +    GenerateEvent ge = new GenerateEvent(m_transformer, type, name, attrs);
  +
  +    if (null != m_traceManager)
         m_traceManager.fireGenerateEvent(ge);
     }
  -        
  +
  +  /**
  +   * NEEDSDOC Method getContentHandler 
  +   *
  +   *
  +   * NEEDSDOC (getContentHandler) @return
  +   */
     ContentHandler getContentHandler()
     {
       return m_contentHandler;
     }
   
  +  /**
  +   * NEEDSDOC Method setContentHandler 
  +   *
  +   *
  +   * NEEDSDOC @param ch
  +   */
     void setContentHandler(ContentHandler ch)
     {
       m_contentHandler = ch;
  @@ -124,37 +183,35 @@
     {
       isPending = false;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setPending 
  +   *
  +   *
  +   * NEEDSDOC @param b
  +   */
     void setPending(boolean b)
     {
       isPending = b;
       this.isEnded = !isPending;
  -  } 
  -  
  +  }
  +
     /**
      * Flush the event.
  +   *
  +   * @throws SAXException
      */
  -  void flush()
  -    throws SAXException
  +  void flush() throws SAXException
     {
       clearPending();
     }
  -  
  +
     /**
  -   * Flush the end event.
  +   * NEEDSDOC Method reset 
  +   *
      */
  -  void flushEnd()
  -    throws SAXException
  -  {
  -    reset();
  -    this.isEnded = true;
  -  }
  -
  -  
     void reset()
     {
       isPending = false;
     }
  -
  -  
   }
  
  
  
  1.3       +44 -32    xml-xalan/java/src/org/apache/xalan/transformer/QueuedStartDocument.java
  
  Index: QueuedStartDocument.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/QueuedStartDocument.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueuedStartDocument.java	2000/10/17 19:14:45	1.2
  +++ QueuedStartDocument.java	2000/10/30 18:57:00	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -66,6 +66,11 @@
    */
   public class QueuedStartDocument extends QueuedSAXEvent
   {
  +
  +  /**
  +   * Constructor QueuedStartDocument
  +   *
  +   */
     public QueuedStartDocument()
     {
       super(DOC);
  @@ -78,72 +83,79 @@
     {
       super.clearPending();
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setPending 
  +   *
  +   *
  +   * NEEDSDOC @param b
  +   */
     void setPending(boolean b)
     {
       super.setPending(b);
  -  } 
  +  }
   
     /**
      * Flush the event.
  +   *
  +   * @throws SAXException
      */
  -  void flush()
  -    throws SAXException
  +  void flush() throws SAXException
     {
  -    if(isPending)
  +
  +    if (isPending)
       {
         m_contentHandler.startDocument();
  -      
         fireGenerateEvent(GenerateEvent.EVENTTYPE_STARTDOCUMENT, null, null);
  -      
  +
         ContentHandler chandler = getContentHandler();
  -      if((null != chandler) 
  -         && (chandler instanceof TransformerClient))
  +
  +      if ((null != chandler) && (chandler instanceof TransformerClient))
         {
  -        ((TransformerClient)chandler).setTransformState(m_transformer);
  +        ((TransformerClient) chandler).setTransformState(m_transformer);
         }
   
         super.flush();
       }
     }
  -  
  -  /**
  -   * Flush the end event.
  -   */
  -  void flushEnd()
  -    throws SAXException
  -  {
  -    if(!this.isEnded)
  -    {
  -      m_contentHandler.endDocument();
  -      
  -      fireGenerateEvent(GenerateEvent.EVENTTYPE_ENDDOCUMENT, null, null);
   
  -      super.flushEnd();
  -    }
  -  }
  -
  -  
     /**
      * Flag to indicate that we have some document content since the last
      * call to startDocument()
      */
     private boolean m_isTextEntity = false;
  -    
  +
  +  /**
  +   * NEEDSDOC Method setIsTextEntity 
  +   *
  +   *
  +   * NEEDSDOC @param b
  +   */
     void setIsTextEntity(boolean b)
     {
       m_isTextEntity = b;
     }
   
  +  /**
  +   * NEEDSDOC Method getIsTextEntity 
  +   *
  +   *
  +   * NEEDSDOC (getIsTextEntity) @return
  +   */
     boolean getIsTextEntity()
     {
       return m_isTextEntity;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method reset 
  +   *
  +   */
     void reset()
     {
  +
       super.reset();
  +
       m_isTextEntity = false;
     }
  -
   }
  
  
  
  1.3       +115 -112  xml-xalan/java/src/org/apache/xalan/transformer/QueuedStartElement.java
  
  Index: QueuedStartElement.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/QueuedStartElement.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- QueuedStartElement.java	2000/10/17 19:15:11	1.2
  +++ QueuedStartElement.java	2000/10/30 18:57:00	1.3
  @@ -8,69 +8,13 @@
    * 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 "Xalan" 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, Lotus
  - * Development Corporation., http://www.lotus.com.  For more
  - * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>.
  - */
  -/*
  - * The Apache Software License, Version 1.1
  - *
  - *
  - * Copyright (c) 1999 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -113,9 +57,11 @@
   package org.apache.xalan.transformer;
   
   import java.util.Vector;
  +
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   import org.xml.sax.Attributes;
  +
   import org.apache.xalan.utils.MutableAttrListImpl;
   import org.apache.xalan.trace.GenerateEvent;
   import org.apache.xalan.utils.NameSpace;
  @@ -125,11 +71,16 @@
    */
   public class QueuedStartElement extends QueuedSAXEvent
   {
  +
  +  /**
  +   * Constructor QueuedStartElement
  +   *
  +   */
     public QueuedStartElement()
     {
       super(ELEM);
     }
  -    
  +
     /**
      * The pending attributes.  We have to delay the call to
      * m_flistener.startElement(name, atts) because of the
  @@ -138,36 +89,49 @@
      * can call startElement.
      */
     private MutableAttrListImpl m_attributes = new MutableAttrListImpl();
  -  
  +
     /**
  -   * Flag to try and get the xmlns decls to the attribute list 
  +   * Flag to try and get the xmlns decls to the attribute list
      * before other attributes are added.
      */
     private boolean m_nsDeclsHaveBeenAdded = false;
  -  
  +
     /**
      * The pending element, namespace, and local name.
      */
     private String m_name;
  -  private String m_url; 
  +
  +  /** NEEDSDOC Field m_url          */
  +  private String m_url;
  +
  +  /** NEEDSDOC Field m_localName          */
     private String m_localName;
  -  
  -  
  +
     /**
      * Set the pending element names.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
      */
     void setPending(String ns, String localName, String name, Attributes atts)
     {
  +
       m_name = name;
  -    m_url = ns; 
  +    m_url = ns;
       m_localName = localName;
  -    if(null != atts)
  +
  +    if (null != atts)
         m_attributes.addAttributes(atts);
  +
       setPending(true);
  -  } 
  -  
  +  }
  +
     /**
      * Get the list of pending attributes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     MutableAttrListImpl getAttrs()
     {
  @@ -176,115 +140,154 @@
   
     /**
      * Set an attribute in the pending attributes list.
  +   *
  +   * NEEDSDOC @param uri
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param qName
  +   * NEEDSDOC @param type
  +   * NEEDSDOC @param value
      */
  -  void addAttribute(String uri, String localName, String qName,
  -                            String type, String value)
  +  void addAttribute(String uri, String localName, String qName, String type,
  +                    String value)
     {
       m_attributes.addAttribute(uri, localName, qName, type, value);
     }
   
  -  
  +  /**
  +   * NEEDSDOC Method isElement 
  +   *
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC (isElement) @return
  +   */
     boolean isElement(String ns, String localName)
     {
  -    if((null != m_localName) && m_localName.equals(localName))
  +
  +    if ((null != m_localName) && m_localName.equals(localName))
       {
  -      if((null == ns) && (null == m_url))
  +      if ((null == ns) && (null == m_url))
           return true;
  -      if((null != ns) && (null != m_url))
  +
  +      if ((null != ns) && (null != m_url))
           return ns.equals(m_url);
       }
  +
       return false;
     }
  -  
  +
     /**
      * Get the pending element name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     String getName()
     {
       return m_name;
     }
  -  
  +
     /**
      * Get the pending element name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     String getURL()
     {
       return m_url;
     }
  -  
  +
     /**
      * Get the the local name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     String getLocalName()
     {
       return m_localName;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method nsDeclsHaveBeenAdded 
  +   *
  +   *
  +   * NEEDSDOC (nsDeclsHaveBeenAdded) @return
  +   */
     boolean nsDeclsHaveBeenAdded()
     {
       return m_nsDeclsHaveBeenAdded;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setNSDeclsHaveBeenAdded 
  +   *
  +   *
  +   * NEEDSDOC @param b
  +   */
     void setNSDeclsHaveBeenAdded(boolean b)
     {
       m_nsDeclsHaveBeenAdded = b;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method reset 
  +   *
  +   */
     void reset()
     {
  +
       super.reset();
       m_attributes.clear();
  +
       m_nsDeclsHaveBeenAdded = false;
       m_name = null;
  -    m_url = null; 
  +    m_url = null;
       m_localName = null;
       m_namespaces = null;
     }
  -  
  +
  +  /** NEEDSDOC Field m_namespaces          */
     Vector m_namespaces = null;
  -  
  +
  +  /**
  +   * NEEDSDOC Method startPrefixMapping 
  +   *
  +   *
  +   * NEEDSDOC @param prefix
  +   * NEEDSDOC @param uri
  +   */
     void startPrefixMapping(String prefix, String uri)
     {
  -    if(null == m_namespaces)
  +
  +    if (null == m_namespaces)
         m_namespaces = new Vector();
  +
       NameSpace ns = new NameSpace(prefix, uri);
  +
       m_namespaces.addElement(ns);
     }
  -  
  +
     /**
      * Flush the event.
  +   *
  +   * @throws SAXException
      */
  -  void flush()
  -    throws SAXException
  +  void flush() throws SAXException
     {
  -    if(isPending)
  -    {
  -      if(null != m_name)
  -      {
  -        m_contentHandler.startElement(m_url, m_localName, 
  -                                      m_name, m_attributes);
  -        fireGenerateEvent(GenerateEvent.EVENTTYPE_STARTELEMENT, m_name, m_attributes);
  -      }
  -      super.flush();
  -    }
  -  }
  -  
  -  /**
  -   * Flush the end event.
  -   */
  -  void flushEnd()
  -    throws SAXException
  -  {
  -    if(!this.isEnded)
  +
  +    if (isPending)
       {
  -      if(null != m_name)
  +      if (null != m_name)
         {
  -        getContentHandler().endElement(m_url, m_localName, m_name);
  -        fireGenerateEvent(GenerateEvent.EVENTTYPE_ENDELEMENT, m_name, null);
  +        m_contentHandler.startElement(m_url, m_localName, m_name,
  +                                      m_attributes);
  +        fireGenerateEvent(GenerateEvent.EVENTTYPE_STARTELEMENT, m_name,
  +                          m_attributes);
         }
  -      super.flushEnd();
  -    }
  -  }
   
  +      reset();
   
  +      // super.flush();
  +    }
  +  }
   }
  
  
  
  1.2       +12 -3     xml-xalan/java/src/org/apache/xalan/transformer/ResultNameSpace.java
  
  Index: ResultNameSpace.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultNameSpace.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ResultNameSpace.java	2000/06/19 16:53:05	1.1
  +++ ResultNameSpace.java	2000/10/30 18:57:01	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -64,13 +64,22 @@
    */
   public class ResultNameSpace
   {
  +
  +  /** NEEDSDOC Field m_next          */
     public ResultNameSpace m_next = null;
  +
  +  /** NEEDSDOC Field m_prefix          */
     public String m_prefix;
  -  public String m_uri; // if null, then Element namespace is empty.
  +
  +  /** NEEDSDOC Field m_uri          */
  +  public String m_uri;  // if null, then Element namespace is empty.
   
     /**
      * Construct a namespace for placement on the
      * result tree namespace stack.
  +   *
  +   * NEEDSDOC @param prefix
  +   * NEEDSDOC @param uri
      */
     public ResultNameSpace(String prefix, String uri)
     {
  
  
  
  1.6       +52 -22    xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeFrag.java
  
  Index: ResultTreeFrag.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeFrag.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- ResultTreeFrag.java	2000/09/11 19:42:14	1.5
  +++ ResultTreeFrag.java	2000/10/30 18:57:01	1.6
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -62,12 +62,12 @@
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.Node;
   import org.w3c.dom.NodeList;
  +
   import org.apache.xpath.NodeSet;
   import org.apache.xpath.XPathContext;
   import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.utils.UnImplNode;
  -
   import org.apache.xalan.stree.DocumentFragmentImpl;
   
   /**
  @@ -76,34 +76,59 @@
    */
   public class ResultTreeFrag extends DocumentFragmentImpl implements NodeList
   {
  +
  +  /** NEEDSDOC Field m_docFactory          */
     Document m_docFactory;
  +
  +  /** NEEDSDOC Field m_xsupport          */
     XPathContext m_xsupport;
   
  +  /**
  +   * Constructor ResultTreeFrag
  +   *
  +   *
  +   * NEEDSDOC @param docFactory
  +   * NEEDSDOC @param support
  +   */
     public ResultTreeFrag(Document docFactory, XPathContext support)
     {
       m_xsupport = support;
       m_docFactory = docFactory;
     }
   
  +  /**
  +   * Constructor ResultTreeFrag
  +   *
  +   *
  +   * NEEDSDOC @param docFactory
  +   * NEEDSDOC @param children
  +   * NEEDSDOC @param support
  +   */
     public ResultTreeFrag(Document docFactory, NodeSet children,
                           XPathContext support)
     {
       m_xsupport = support;
       m_docFactory = docFactory;
     }
  -  
  -  public NodeList           getChildNodes()
  +
  +  /**
  +   * NEEDSDOC Method getChildNodes 
  +   *
  +   *
  +   * NEEDSDOC (getChildNodes) @return
  +   */
  +  public NodeList getChildNodes()
     {
       return this;
     }
  -  
  +
     /**
  -   *  Returns the <code>index</code> th item in the collection. If 
  -   * <code>index</code> is greater than or equal to the number of nodes in 
  +   *  Returns the <code>index</code> th item in the collection. If
  +   * <code>index</code> is greater than or equal to the number of nodes in
      * the list, this returns <code>null</code> .
      * @param index  Index into the collection.
  -   * @return  The node at the <code>index</code> th position in the 
  -   *   <code>NodeList</code> , or <code>null</code> if that is not a valid 
  +   * @return  The node at the <code>index</code> th position in the
  +   *   <code>NodeList</code> , or <code>null</code> if that is not a valid
      *   index.
      */
     public Node item(int index)
  @@ -112,23 +137,28 @@
     }
   
     /**
  -   *  The number of nodes in the list. The range of valid child node indices 
  -   * is 0 to <code>length-1</code> inclusive. 
  +   *  The number of nodes in the list. The range of valid child node indices
  +   * is 0 to <code>length-1</code> inclusive.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getLength()
     {
       return getChildCount();
     }
  -  
  +
     /**
  -   * The <code>Document</code> object associated with this node. This is 
  -   * also the <code>Document</code> object used to create new nodes. When 
  -   * this node is a <code>Document</code> or a <code>DocumentType</code> 
  -   * which is not used with any <code>Document</code> yet, this is 
  +   * The <code>Document</code> object associated with this node. This is
  +   * also the <code>Document</code> object used to create new nodes. When
  +   * this node is a <code>Document</code> or a <code>DocumentType</code>
  +   * which is not used with any <code>Document</code> yet, this is
      * <code>null</code>.
      * @version DOM Level 2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public Document     getOwnerDocument()
  {
    return m_docFactory;
  -  }
  -
  +  public Document getOwnerDocument()
  +  {
  +    return m_docFactory;
  +  }
   }
  
  
  
  1.21      +696 -288  xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java
  
  Index: ResultTreeHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/ResultTreeHandler.java,v
  retrieving revision 1.20
  retrieving revision 1.21
  diff -u -r1.20 -r1.21
  --- ResultTreeHandler.java	2000/10/17 19:17:07	1.20
  +++ ResultTreeHandler.java	2000/10/30 18:57:01	1.21
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,21 +55,18 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xalan.transformer;
  - 
  +
   import java.util.Enumeration;
   
   import org.apache.xalan.templates.Stylesheet;
   import org.apache.xalan.templates.StylesheetRoot;
  -
   import org.apache.xalan.trace.TraceManager;
   import org.apache.xalan.trace.GenerateEvent;
  -
   import org.apache.xalan.utils.MutableAttrListImpl;
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.utils.TreeWalker;
   import org.apache.xalan.utils.ObjectPool;
   import org.apache.xalan.utils.XMLCharacterRecognizer;
  -
   import org.apache.xpath.DOMHelper;
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.XPathContext;
  @@ -91,8 +88,8 @@
   import org.apache.serialize.SerializerHandler;
   
   /**
  - * This class is a layer between the direct calls to the result 
  - * tree content handler, and the transformer.  For one thing, 
  + * This class is a layer between the direct calls to the result
  + * tree content handler, and the transformer.  For one thing,
    * we have to delay the call to
    * getContentHandler().startElement(name, atts) because of the
    * xsl:attribute and xsl:copy calls.  In other words,
  @@ -100,132 +97,207 @@
    * can call startElement.
    */
   public class ResultTreeHandler extends QueuedEvents
  -  implements ContentHandler, SerializerHandler, LexicalHandler
  +        implements ContentHandler, SerializerHandler, LexicalHandler
   {
  +
  +  /** NEEDSDOC Field DEBUG          */
     private static final boolean DEBUG = false;
  -  
  +
     /**
      * Null constructor for object pooling.
      */
  -  public ResultTreeHandler()
  -  {
  -  }
  -    
  +  public ResultTreeHandler(){}
  +
     /**
  -   * Create a new result tree handler.  The real content 
  +   * Create a new result tree handler.  The real content
      * handler will be the ContentHandler passed as an argument.
  +   *
  +   * NEEDSDOC @param transformer
  +   * NEEDSDOC @param realHandler
      */
     public ResultTreeHandler(TransformerImpl transformer,
                              ContentHandler realHandler)
     {
       init(transformer, realHandler);
     }
  -  
  +
     /**
      * Initializer method.
  +   *
  +   * NEEDSDOC @param transformer
  +   * NEEDSDOC @param realHandler
      */
  -  public void init(TransformerImpl transformer,
  -                           ContentHandler realHandler)
  +  public void init(TransformerImpl transformer, ContentHandler realHandler)
     {
  +
       m_transformer = transformer;
  -    m_tracer = transformer.getTraceManager();
  +
  +    TraceManager tracer = transformer.getTraceManager();
  +
  +    if ((null != tracer) && tracer.hasTraceListeners())
  +      m_tracer = tracer;
  +    else
  +      m_tracer = null;
  +
       m_contentHandler = realHandler;
  +
  +    if (m_contentHandler instanceof LexicalHandler)
  +      m_lexicalHandler = (LexicalHandler) m_contentHandler;
  +    else
  +      m_lexicalHandler = null;
  +
       m_cloner = new ClonerToResultTree(transformer, this);
  -    
  +
       // The stylesheet is set at a rather late stage, so I do 
       // this here, though it would probably be better done elsewhere.
  -    if(null != m_transformer)
  +    if (null != m_transformer)
         m_stylesheetRoot = m_transformer.getStylesheet();
   
  -    pushDocumentEvent(); // not pending yet.
  +    pushDocumentEvent();  // not pending yet.
     }
  -  
  +
     /**
      * Bottleneck the startDocument event.
  +   *
  +   * @throws SAXException
      */
  -  public void startDocument ()
  -    throws SAXException
  -  {
  -  }
  +  public void startDocument() throws SAXException{}
   
     /**
  -   * Bottleneck the endDocument event.  This may be called 
  -   * more than once in order to make sure the pending start 
  +   * Bottleneck the endDocument event.  This may be called
  +   * more than once in order to make sure the pending start
      * document is called.
  +   *
  +   * @throws SAXException
      */
  -  public void endDocument ()
  -    throws SAXException
  +  public void endDocument() throws SAXException
     {
  +
       flushPending(EVT_ENDDOCUMENT);
  -    getQueuedDocAtBottom().flushEnd();
  +
  +    QueuedStartDocument qsd = getQueuedDocAtBottom();
  +
  +    if (!qsd.isEnded)
  +    {
  +      m_contentHandler.endDocument();
  +
  +      if (null != m_tracer)
  +      {
  +        GenerateEvent ge =
  +          new GenerateEvent(m_transformer,
  +                            GenerateEvent.EVENTTYPE_ENDDOCUMENT, null);
  +
  +        m_tracer.fireGenerateEvent(ge);
  +      }
  +
  +      qsd.setPending(false);
  +    }
     }
   
     /**
      * Bottleneck the startElement event.  This is used to "pend" an
  -   * element, so that attributes can still be added to it before 
  +   * element, so that attributes can still be added to it before
      * the real "startElement" is called on the result tree listener.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SAXException
      */
  -  public void startElement (String ns, String localName, String name)
  -    throws SAXException
  +  public void startElement(String ns, String localName, String name)
  +          throws SAXException
     {
  -    startElement (ns, localName, name, null);
  +    startElement(ns, localName, name, null);
     }
  -    
  +
     /**
      * Bottleneck the startElement event.  This is used to "pend" an
  -   * element, so that attributes can still be added to it before 
  +   * element, so that attributes can still be added to it before
      * the real "startElement" is called on the result tree listener.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param atts
  +   *
  +   * @throws SAXException
      */
  -  public void startElement (String ns, String localName, String name, 
  -                            Attributes atts)
  -    throws SAXException
  +  public void startElement(
  +          String ns, String localName, String name, Attributes atts)
  +            throws SAXException
     {
  +
       QueuedStartElement qse = getQueuedElem();
  -    if(DEBUG)
  +
  +    if (DEBUG)
       {
  -      if(null != qse)
  -        System.out.println("(pended: "+qse.getURL()+"#"+qse.getLocalName());
  -      System.out.println("startElement: "+ns+"#"+localName);
  +      if (null != qse)
  +        System.out.println("(pended: " + qse.getURL() + "#"
  +                           + qse.getLocalName());
  +
  +      System.out.println("startElement: " + ns + "#" + localName);
       }
  +
       checkForSerializerSwitch(ns, localName);
       flushPending(EVT_STARTELEMENT);
  -    if(!m_nsContextPushed)
  +
  +    if (!m_nsContextPushed)
       {
  -      if(DEBUG)
  +      if (DEBUG)
           System.out.println("push(startElement)");
  +
         m_nsSupport.pushContext();
       }
   
       ensurePrefixIsDeclared(ns, name);
  -        
  +
       // getQueuedElem().setPending(ns, localName, name, atts);
       this.pushElementEvent(ns, localName, name, atts);
     }
   
     /**
      * Bottleneck the endElement event.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SAXException
      */
  -  public void endElement (String ns, String localName, String name)
  -    throws SAXException
  +  public void endElement(String ns, String localName, String name)
  +          throws SAXException
     {
  +
       flushPending(EVT_ENDELEMENT);
  -    QueuedStartElement qse = getQueuedElem();
  -    qse.flushEnd();
  +    m_contentHandler.endElement(ns, localName, name);
  +
  +    if (null != m_tracer)
  +    {
  +      GenerateEvent ge = new GenerateEvent(m_transformer,
  +                                           GenerateEvent.EVENTTYPE_ENDELEMENT,
  +                                           name);
  +
  +      m_tracer.fireGenerateEvent(ge);
  +    }
  +
       sendEndPrefixMappings();
       popEvent();
  -    
  -    if(DEBUG)
  -      System.out.println("pop: "+localName);
  +
  +    if (DEBUG)
  +      System.out.println("pop: " + localName);
  +
       m_nsSupport.popContext();
     }
  -  
  +
  +  /** NEEDSDOC Field m_nsContextPushed          */
     boolean m_nsContextPushed = false;
  -  
  +
     /**
      * Begin the scope of a prefix-URI Namespace mapping.
      *
      * <p>The information from this event is not necessary for
  -   * normal Namespace processing: the SAX XML reader will 
  +   * normal Namespace processing: the SAX XML reader will
      * automatically replace prefixes for element and attribute
      * names when the http://xml.org/sax/features/namespaces
      * feature is true (the default).</p>
  @@ -250,41 +322,59 @@
      *            an exception during processing.
      * @see #endPrefixMapping
      * @see #startElement
  +   *
  +   * @throws SAXException
  +   */
  +  public void startPrefixMapping(String prefix, String uri)
  +          throws SAXException
  +  {
  +    startPrefixMapping(prefix, uri, false);
  +  }
  +
  +  /**
  +   * NEEDSDOC Method startPrefixMapping 
  +   *
  +   *
  +   * NEEDSDOC @param prefix
  +   * NEEDSDOC @param uri
  +   * NEEDSDOC @param shouldFlush
  +   *
  +   * @throws SAXException
      */
  -  public void startPrefixMapping (String prefix, String uri)
  -    throws SAXException
  -  {    
  -    startPrefixMapping (prefix, uri, false);
  -  }
  -  
  -  public void startPrefixMapping (String prefix, String uri, boolean shouldFlush)
  -    throws SAXException
  -  {    
  -    if(shouldFlush)
  +  public void startPrefixMapping(
  +          String prefix, String uri, boolean shouldFlush) throws SAXException
  +  {
  +
  +    if (shouldFlush)
         flushPending(EVT_STARTPREFIXMAPPING);
  -    if(!m_nsContextPushed)
  +
  +    if (!m_nsContextPushed)
       {
  -      if(DEBUG)
  -        System.out.println("push(startPrefixMapping: "+prefix+")");
  +      if (DEBUG)
  +        System.out.println("push(startPrefixMapping: " + prefix + ")");
  +
         m_nsSupport.pushContext();
  +
         m_nsContextPushed = true;
       }
  -    if(null == prefix)
  -      prefix = ""; // bit-o-hack, that that's OK
  -        
  +
  +    if (null == prefix)
  +      prefix = "";  // bit-o-hack, that that's OK
  +
       String existingURI = m_nsSupport.getURI(prefix);
  -    if((null == existingURI) || !existingURI.equals(uri))
  +
  +    if ((null == existingURI) ||!existingURI.equals(uri))
       {
  -      if(DEBUG)
  +      if (DEBUG)
         {
  -        System.out.println("Prefix: "+prefix);
  -        System.out.println("uri: "+uri);
  +        System.out.println("Prefix: " + prefix);
  +        System.out.println("uri: " + uri);
         }
  +
         m_nsSupport.declarePrefix(prefix, uri);
       }
     }
   
  -
     /**
      * End the scope of a prefix-URI mapping.
      *
  @@ -298,160 +388,263 @@
      *            an exception during processing.
      * @see #startPrefixMapping
      * @see #endElement
  +   *
  +   * @throws SAXException
      */
  -  public void endPrefixMapping (String prefix)
  -    throws SAXException
  -  {
  -  }
  -  
  +  public void endPrefixMapping(String prefix) throws SAXException{}
  +
     /**
      * Bottleneck the characters event.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
      */
  -  public void characters (char ch[], int start, int length)
  -    throws SAXException
  +  public void characters(char ch[], int start, int length) throws SAXException
     {
  -    QueuedStartDocument qsd = getQueuedDoc();
  -    if((null != qsd) && qsd.isPending 
  -       && XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
  +
  +    if (m_startDoc.isPending
  +            && XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
         return;
  -    
  -    flushPending(EVT_CHARACTERS);    
  -        
  -    getContentHandler().characters(ch, start, length);
  -    m_tracer.fireGenerateEvent(new GenerateEvent(m_transformer,
  -                                                 GenerateEvent.EVENTTYPE_CHARACTERS,
  -                                                 ch, start, length));
  +
  +    flushPending(EVT_CHARACTERS);
  +    m_contentHandler.characters(ch, start, length);
  +
  +    if (null != m_tracer)
  +    {
  +      GenerateEvent ge = new GenerateEvent(m_transformer,
  +                                           GenerateEvent.EVENTTYPE_CHARACTERS,
  +                                           ch, start, length);
  +
  +      m_tracer.fireGenerateEvent(ge);
  +    }
     }
   
     /**
      * Bottleneck the ignorableWhitespace event.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
      */
  -  public void ignorableWhitespace (char ch[], int start, int length)
  -    throws SAXException
  +  public void ignorableWhitespace(char ch[], int start, int length)
  +          throws SAXException
     {
  +
       QueuedStartDocument qsd = getQueuedDoc();
  -    if((null != qsd) && qsd.isPending 
  -       && XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
  +
  +    if ((null != qsd) && qsd.isPending
  +            && XMLCharacterRecognizer.isWhiteSpace(ch, start, length))
         return;
   
       flushPending(EVT_IGNORABLEWHITESPACE);
  -    getContentHandler().ignorableWhitespace(ch, start, length);
  -    m_tracer.fireGenerateEvent(new GenerateEvent(m_transformer,
  -                                                 GenerateEvent.EVENTTYPE_IGNORABLEWHITESPACE,
  -                                                 ch, start, length));
  +    m_contentHandler.ignorableWhitespace(ch, start, length);
  +
  +    if (null != m_tracer)
  +    {
  +      GenerateEvent ge =
  +        new GenerateEvent(m_transformer,
  +                          GenerateEvent.EVENTTYPE_IGNORABLEWHITESPACE, ch,
  +                          start, length);
  +
  +      m_tracer.fireGenerateEvent(ge);
  +    }
     }
   
     /**
      * Bottleneck the processingInstruction event.
  +   *
  +   * NEEDSDOC @param target
  +   * NEEDSDOC @param data
  +   *
  +   * @throws SAXException
      */
  -  public void processingInstruction (String target, String data)
  -    throws SAXException
  +  public void processingInstruction(String target, String data)
  +          throws SAXException
     {
  +
       flushPending(EVT_PROCESSINGINSTRUCTION);
  -    getContentHandler().processingInstruction(target, data);
  -    m_tracer.fireGenerateEvent(new GenerateEvent(m_transformer,
  -                                                 GenerateEvent.EVENTTYPE_PI,
  -                                                 target, data));
  +    m_contentHandler.processingInstruction(target, data);
  +
  +    if (null != m_tracer)
  +    {
  +      GenerateEvent ge = new GenerateEvent(m_transformer,
  +                                           GenerateEvent.EVENTTYPE_PI,
  +                                           target, data);
  +
  +      m_tracer.fireGenerateEvent(ge);
  +    }
     }
   
     /**
      * Bottleneck the comment event.
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * @throws SAXException
      */
     public void comment(String data) throws SAXException
     {
  +
       flushPending(EVT_COMMENT);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
  +    {
  +      m_lexicalHandler.comment(data.toCharArray(), 0, data.length());
  +    }
  +
  +    if (null != m_tracer)
       {
  -      ((LexicalHandler)getContentHandler()).comment(data.toCharArray(), 0, data.length());
  +      GenerateEvent ge = new GenerateEvent(m_transformer,
  +                                           GenerateEvent.EVENTTYPE_COMMENT,
  +                                           data);
  +
  +      m_tracer.fireGenerateEvent(ge);
       }
  -    m_tracer.fireGenerateEvent(new GenerateEvent(m_transformer,
  -                                                 GenerateEvent.EVENTTYPE_COMMENT,
  -                                                 data));
     }
   
     /**
      * Bottleneck the comment event.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
      */
     public void comment(char ch[], int start, int length) throws SAXException
     {
  +
       flushPending(EVT_COMMENT);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
       {
  -      ((LexicalHandler)getContentHandler()).comment(ch, start, length);
  +      m_lexicalHandler.comment(ch, start, length);
       }
  -    m_tracer.fireGenerateEvent(new GenerateEvent(m_transformer,
  -                                                 GenerateEvent.EVENTTYPE_COMMENT,
  -                                                 new String(ch, start, length)));
  -  }
   
  +    if (null != m_tracer)
  +    {
  +      GenerateEvent ge = new GenerateEvent(m_transformer,
  +                                           GenerateEvent.EVENTTYPE_COMMENT,
  +                                           new String(ch, start, length));
  +
  +      m_tracer.fireGenerateEvent(ge);
  +    }
  +  }
   
     /**
      * Bottleneck the comment event.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SAXException
      */
     public void entityReference(String name) throws SAXException
     {
  +
       flushPending(EVT_ENTITYREF);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
  +    {
  +      m_lexicalHandler.startEntity(name);
  +      m_lexicalHandler.endEntity(name);
  +    }
  +
  +    if (null != m_tracer)
       {
  -      ((LexicalHandler)getContentHandler()).startEntity(name);
  -      ((LexicalHandler)getContentHandler()).endEntity(name);
  +      GenerateEvent ge = new GenerateEvent(m_transformer,
  +                                           GenerateEvent.EVENTTYPE_ENTITYREF,
  +                                           name);
  +
  +      m_tracer.fireGenerateEvent(ge);
       }
  -    m_tracer.fireGenerateEvent(new GenerateEvent(m_transformer,
  -                                                 GenerateEvent.EVENTTYPE_ENTITYREF,
  -                                                 name));
     }
   
     /**
      * Start an entity.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SAXException
      */
     public void startEntity(String name) throws SAXException
     {
  +
       flushPending(EVT_STARTENTITY);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
       {
  -      ((LexicalHandler)getContentHandler()).startEntity(name);
  +      m_lexicalHandler.startEntity(name);
       }
     }
   
     /**
      * End an entity.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SAXException
      */
     public void endEntity(String name) throws SAXException
     {
  +
       flushPending(EVT_ENDENTITY);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
  +    {
  +      m_lexicalHandler.endEntity(name);
  +    }
  +
  +    if (null != m_tracer)
       {
  -      ((LexicalHandler)getContentHandler()).endEntity(name);
  +      GenerateEvent ge = new GenerateEvent(m_transformer,
  +                                           GenerateEvent.EVENTTYPE_ENTITYREF,
  +                                           name);
  +
  +      m_tracer.fireGenerateEvent(ge);
       }
  -    m_tracer.fireGenerateEvent(new GenerateEvent(m_transformer,
  -                                                 GenerateEvent.EVENTTYPE_ENTITYREF,
  -                                                 name));
     }
   
     /**
      * Start the DTD.
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   * NEEDSDOC @param s3
  +   *
  +   * @throws SAXException
      */
     public void startDTD(String s1, String s2, String s3) throws SAXException
     {
  +
       flushPending(EVT_STARTDTD);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
       {
  -      ((LexicalHandler)getContentHandler()).startDTD(s1, s2, s3);
  +      m_lexicalHandler.startDTD(s1, s2, s3);
       }
     }
   
     /**
      * End the DTD.
  +   *
  +   * @throws SAXException
      */
     public void endDTD() throws SAXException
     {
  +
       flushPending(EVT_ENDDTD);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
       {
  -      ((LexicalHandler)getContentHandler()).endDTD();
  +      m_lexicalHandler.endDTD();
       }
     }
  -  
  +
     /**
      * Starts an un-escaping section. All characters printed within an
      * un-escaping section are printed as is, without escaping special
  @@ -460,14 +653,17 @@
      * <p>
      * The contents of the un-escaping section will be delivered through
      * the regular <tt>characters</tt> event.
  +   *
  +   * @throws SAXException
      */
  -  public void startNonEscaping()
  -    throws SAXException
  +  public void startNonEscaping() throws SAXException
     {
  +
       flushPending(EVT_STARTNONESCAPING);
  -    if(getContentHandler() instanceof SerializerHandler)
  +
  +    if (m_contentHandler instanceof SerializerHandler)
       {
  -      ((SerializerHandler)getContentHandler()).startNonEscaping();
  +      ((SerializerHandler) m_contentHandler).startNonEscaping();
       }
     }
   
  @@ -475,14 +671,17 @@
      * Ends an un-escaping section.
      *
      * @see #startNonEscaping
  +   *
  +   * @throws SAXException
      */
  -  public void endNonEscaping()
  -    throws SAXException
  +  public void endNonEscaping() throws SAXException
     {
  +
       flushPending(EVT_ENDNONESCAPING);
  -    if(getContentHandler() instanceof SerializerHandler)
  +
  +    if (m_contentHandler instanceof SerializerHandler)
       {
  -      ((SerializerHandler)getContentHandler()).endNonEscaping();
  +      ((SerializerHandler) m_contentHandler).endNonEscaping();
       }
     }
   
  @@ -495,57 +694,70 @@
      * <p>
      * The contents of the whitespace preserving section will be delivered
      * through the regular <tt>characters</tt> event.
  +   *
  +   * @throws SAXException
      */
  -  public void startPreserving()
  -    throws SAXException
  +  public void startPreserving() throws SAXException
     {
  +
       flushPending(EVT_STARTPRESERVING);
  -    if(getContentHandler() instanceof SerializerHandler)
  +
  +    if (m_contentHandler instanceof SerializerHandler)
       {
  -      ((SerializerHandler)getContentHandler()).startPreserving();
  +      ((SerializerHandler) m_contentHandler).startPreserving();
       }
     }
   
  -
     /**
      * Ends a whitespace preserving section.
      *
      * @see #startPreserving
  +   *
  +   * @throws SAXException
      */
  -  public void endPreserving()
  -    throws SAXException
  +  public void endPreserving() throws SAXException
     {
  +
       flushPending(EVT_ENDENDPRESERVING);
  -    if(getContentHandler() instanceof SerializerHandler)
  +
  +    if (m_contentHandler instanceof SerializerHandler)
       {
  -      ((SerializerHandler)getContentHandler()).endPreserving();
  +      ((SerializerHandler) m_contentHandler).endPreserving();
       }
     }
   
     /**
      * Start the CDATACharacters.
  +   *
  +   * @throws SAXException
      */
     public void startCDATA() throws SAXException
     {
  +
       flushPending(EVT_STARTCDATA);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
       {
  -      ((LexicalHandler)getContentHandler()).startCDATA();
  +      m_lexicalHandler.startCDATA();
       }
     }
   
     /**
      * End the CDATA characters.
  +   *
  +   * @throws SAXException
      */
     public void endCDATA() throws SAXException
     {
  +
       flushPending(EVT_ENDCDATA);
  -    if(getContentHandler() instanceof LexicalHandler)
  +
  +    if (null != m_lexicalHandler)
       {
  -      ((LexicalHandler)getContentHandler()).endCDATA();
  +      m_lexicalHandler.endCDATA();
       }
     }
  -  
  +
     /**
      * Receive notification of a skipped entity.
      *
  @@ -558,34 +770,38 @@
      * http://xml.org/sax/features/external-parameter-entities
      * properties.</p>
      *
  -   * @param name The name of the skipped entity.  If it is a 
  +   * @param name The name of the skipped entity.  If it is a
      *        parameter entity, the name will begin with '%'.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  +   *
  +   * @throws SAXException
      */
  -  public void skippedEntity (String name)
  -    throws SAXException
  -  {
  -  }
  -  
  +  public void skippedEntity(String name) throws SAXException{}
  +
     /**
      * Flush the pending element.
  +   *
  +   * @throws SAXException
      */
  -  public void flushPending()
  -    throws SAXException
  -  {    
  +  public void flushPending() throws SAXException
  +  {
       flushPending(EVT_NODE);
     }
  -      
  +
     /**
      * Flush the pending element.
  +   *
  +   * NEEDSDOC @param type
  +   *
  +   * @throws SAXException
      */
  -  public void flushPending(int type)
  -    throws SAXException
  -  {    
  +  public void flushPending(int type) throws SAXException
  +  {
  +
       QueuedStartElement qe = getQueuedElem();
       QueuedStartDocument qdab = getQueuedDocAtBottom();
  -    
  +
       if ((type != EVT_STARTPREFIXMAPPING) && qdab.isPending)
       {
         qdab.flush();
  @@ -593,190 +809,241 @@
   
       if ((null != qe) && qe.isPending)
       {
  -      if(!qe.nsDeclsHaveBeenAdded())
  +      if (!qe.nsDeclsHaveBeenAdded())
           addNSDeclsToAttrs();
   
         sendStartPrefixMappings();
         qe.flush();
  +
         m_nsContextPushed = false;
       }
     }
  -  
  +
     /**
      * Given a result tree fragment, walk the tree and
      * output it to the result stream.
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param support
  +   *
  +   * @throws SAXException
      */
  -  public void outputResultTreeFragment(XObject obj, 
  -                                       XPathContext support)
  -    throws SAXException
  +  public void outputResultTreeFragment(XObject obj, XPathContext support)
  +          throws SAXException
     {
  +
       DocumentFragment docFrag = obj.rtree(support);
       NodeList nl = docFrag.getChildNodes();
       int nChildren = nl.getLength();
       TreeWalker tw = new TreeWalker(this);
  -    for(int i = 0; i < nChildren; i++)
  +
  +    for (int i = 0; i < nChildren; i++)
       {
  -      flushPending(EVT_NODE); // I think.
  +      flushPending(EVT_NODE);  // I think.
         tw.traverse(nl.item(i));
       }
     }
  -  
  +
     /**
      * Clone an element with or without children.
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param shouldCloneAttributes
  +   *
  +   * @throws SAXException
      */
  -  public void cloneToResultTree(Node node,
  -                                boolean shouldCloneAttributes)
  -    throws SAXException
  +  public void cloneToResultTree(Node node, boolean shouldCloneAttributes)
  +          throws SAXException
     {
       m_cloner.cloneToResultTree(node, shouldCloneAttributes);
  -  } 
  -  
  +  }
  +
     /**
      * To fullfill the FormatterListener interface... no action
      * for the moment.
  +   *
  +   * NEEDSDOC @param locator
      */
  -  public void setDocumentLocator (Locator locator)
  -  {
  -  }
  -  
  +  public void setDocumentLocator(Locator locator){}
  +
     /**
  -   * This function checks to make sure a given prefix is really 
  +   * This function checks to make sure a given prefix is really
      * declared.  It might not be, because it may be an excluded prefix.
      * If it's not, it still needs to be declared at this point.
      * TODO: This needs to be done at an earlier stage in the game... -sb
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param rawName
  +   *
  +   * @throws SAXException
      */
  -  void ensurePrefixIsDeclared(String ns, String rawName)
  -    throws SAXException
  +  void ensurePrefixIsDeclared(String ns, String rawName) throws SAXException
     {
  +
       if (ns != null && ns.length() > 0)
  -    { 
  +    {
         int index;
  -      String prefix = (index = rawName.indexOf(":"))< 0 ? "" : rawName.substring(0, index);
  -      if(null != prefix)
  +      String prefix = (index = rawName.indexOf(":")) < 0
  +                      ? "" : rawName.substring(0, index);
  +
  +      if (null != prefix)
         {
           String foundURI = m_nsSupport.getURI(prefix);
  -        if((null == foundURI) || !foundURI.equals(ns))
  -          startPrefixMapping ( prefix, ns, false);
  +
  +        if ((null == foundURI) ||!foundURI.equals(ns))
  +          startPrefixMapping(prefix, ns, false);
         }
       }
     }
  -  
  +
     /**
      * Add the attributes that have been declared to the attribute list.
      * (Seems like I shouldn't have to do this...)
  +   *
  +   * @throws SAXException
      */
  -  protected void sendStartPrefixMappings()
  -    throws SAXException
  +  protected void sendStartPrefixMappings() throws SAXException
     {
  +
       Enumeration prefixes = m_nsSupport.getDeclaredPrefixes();
  -    ContentHandler handler = getContentHandler();
  +    ContentHandler handler = m_contentHandler;
  +
       while (prefixes.hasMoreElements())
       {
  -      String prefix = (String)prefixes.nextElement();      
  +      String prefix = (String) prefixes.nextElement();
  +
         handler.startPrefixMapping(prefix, m_nsSupport.getURI(prefix));
       }
     }
  -  
  +
     /**
      * Add the attributes that have been declared to the attribute list.
      * (Seems like I shouldn't have to do this...)
  +   *
  +   * @throws SAXException
      */
  -  protected void sendEndPrefixMappings()
  -    throws SAXException
  +  protected void sendEndPrefixMappings() throws SAXException
     {
  +
       Enumeration prefixes = m_nsSupport.getDeclaredPrefixes();
  -    ContentHandler handler = getContentHandler();
  -    
  -    while (prefixes.hasMoreElements()) 
  +    ContentHandler handler = m_contentHandler;
  +
  +    while (prefixes.hasMoreElements())
       {
  -      String prefix = (String)prefixes.nextElement();
  +      String prefix = (String) prefixes.nextElement();
  +
         handler.endPrefixMapping(prefix);
       }
     }
   
     /**
  -   * Check to see if we should switch serializers based on the 
  +   * Check to see if we should switch serializers based on the
      * first output element being an HTML element.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   *
  +   * @throws SAXException
      */
     private void checkForSerializerSwitch(String ns, String localName)
  -    throws SAXException
  +          throws SAXException
     {
  +
       QueuedStartDocument qdab = getQueuedDocAtBottom();
  -    if(qdab.isPending)
  +
  +    if (qdab.isPending)
       {
         SerializerSwitcher.switchSerializerIfHTML(m_transformer, ns, localName);
       }
     }
  -  
  +
     /**
      * Add the attributes that have been declared to the attribute list.
      * (Seems like I shouldn't have to do this...)
      */
     protected void addNSDeclsToAttrs()
     {
  +
       Enumeration prefixes = m_nsSupport.getDeclaredPrefixes();
       QueuedStartElement qe = getQueuedElem();
  -    while (prefixes.hasMoreElements()) 
  +
  +    while (prefixes.hasMoreElements())
       {
  -      String prefix = (String)prefixes.nextElement();
  +      String prefix = (String) prefixes.nextElement();
         boolean isDefault = (prefix.length() == 0);
         String name;
  -      if(isDefault)
  +
  +      if (isDefault)
         {
  +
           //prefix = "xml";
           name = "xmlns";
         }
         else
  -        name="xmlns:"+prefix;
  -      
  +        name = "xmlns:" + prefix;
  +
         String uri = m_nsSupport.getURI(prefix);
  -      
  -      qe.addAttribute("http://www.w3.org/2000/xmlns/", 
  -                      prefix, name, "CDATA", uri);
  +
  +      qe.addAttribute("http://www.w3.org/2000/xmlns/", prefix, name, "CDATA",
  +                      uri);
       }
  +
       qe.setNSDeclsHaveBeenAdded(true);
     }
   
     /**
      * Copy <KBD>xmlns:</KBD> attributes in if not already in scope.
  +   *
  +   * NEEDSDOC @param src
  +   *
  +   * @throws SAXException
      */
  -  public void processNSDecls(Node src)
  -    throws SAXException
  +  public void processNSDecls(Node src) throws SAXException
     {
  +
       int type;
  +
       // Vector nameValues = null;
       // Vector alreadyProcessedPrefixes = null;
       Node parent;
  -    if(((type = src.getNodeType()) == Node.ELEMENT_NODE
  -        || (type == Node.ENTITY_REFERENCE_NODE))
  -       && (parent = src.getParentNode()) != null)
  +
  +    if (((type = src.getNodeType()) == Node.ELEMENT_NODE || (type == Node.ENTITY_REFERENCE_NODE))
  +            && (parent = src.getParentNode()) != null)
       {
         processNSDecls(parent);
  -    }  
  +    }
  +
       if (type == Node.ELEMENT_NODE)
       {
         NamedNodeMap nnm = src.getAttributes();
         int nAttrs = nnm.getLength();
  -      for (int i = 0;  i < nAttrs;  i++)
  +
  +      for (int i = 0; i < nAttrs; i++)
         {
           Node attr = nnm.item(i);
           String aname = attr.getNodeName();
  +
           if (QName.isXMLNSDecl(aname))
           {
             String prefix = QName.getPrefixFromXMLNSDecl(aname);
             String desturi = getURI(prefix);
             String srcURI = attr.getNodeValue();
  -          if(!srcURI.equalsIgnoreCase(desturi))
  +
  +          if (!srcURI.equalsIgnoreCase(desturi))
             {
               this.startPrefixMapping(prefix, srcURI);
             }
           }
         }
  -    }      
  +    }
     }
  -  
  +
     /**
      * Given a prefix, return the namespace,
  +   *
  +   * NEEDSDOC @param prefix
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getURI(String prefix)
     {
  @@ -785,38 +1052,51 @@
   
     /**
      * Given a namespace, try and find a prefix.
  +   *
  +   * NEEDSDOC @param namespace
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getPrefix(String namespace)
     {
  +
       // This Enumeration business may be too slow for our purposes...
       Enumeration enum = m_nsSupport.getPrefixes();
  -    while(enum.hasMoreElements())
  +
  +    while (enum.hasMoreElements())
       {
  -      String prefix = (String)enum.nextElement();
  -      if(m_nsSupport.getURI(prefix).equals(namespace))
  +      String prefix = (String) enum.nextElement();
  +
  +      if (m_nsSupport.getURI(prefix).equals(namespace))
           return prefix;
       }
  +
       return null;
  -  }  
  -  
  +  }
  +
     /**
      * Get the NamespaceSupport object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NamespaceSupport getNamespaceSupport()
     {
       return m_nsSupport;
     }
  -  
  +
     /**
      * Override QueuedEvents#initQSE.
  +   *
  +   * NEEDSDOC @param qse
      */
     protected void initQSE(QueuedSAXEvent qse)
     {
  +
       qse.setContentHandler(m_contentHandler);
       qse.setTransformer(m_transformer);
       qse.setTraceManager(m_tracer);
     }
  -  
  +
     /**
      * Return the current content handler.
      *
  @@ -828,22 +1108,28 @@
     {
       return m_contentHandler;
     }
  -  
  +
     /**
      * Set the current content handler.
      *
  +   *
  +   * NEEDSDOC @param ch
      * @return The current content handler, or null if none
      *         has been registered.
      * @see #getContentHandler
      */
     public void setContentHandler(ContentHandler ch)
     {
  +
       m_contentHandler = ch;
  +
       reInitEvents();
     }
   
     /**
      * Get a unique namespace value.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getUniqueNSValue()
     {
  @@ -852,27 +1138,31 @@
   
     /**
      * Get new unique namespace prefix.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNewUniqueNSPrefix()
     {
  -    return S_NAMESPACEPREFIX+String.valueOf(getUniqueNSValue());
  +    return S_NAMESPACEPREFIX + String.valueOf(getUniqueNSValue());
     }
  -  
  +
     /**
      * Get the pending attributes.  We have to delay the call to
      * m_flistener.startElement(name, atts) because of the
      * xsl:attribute and xsl:copy calls.  In other words,
      * the attributes have to be fully collected before you
      * can call startElement.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public MutableAttrListImpl getPendingAttributes()
     {
       return getQueuedElem().getAttrs();
     }
  -  
  +
     /**
      * Add an attribute to the end of the list.
  -   * 
  +   *
      * <p>Do not pass in xmlns decls to this function!
      *
      * <p>For the sake of speed, this method does no checking
  @@ -888,75 +1178,143 @@
      *        if raw names are not available.
      * @param type The attribute type as a string.
      * @param value The attribute value.
  +   *
  +   * @throws SAXException
      */
  -  public void addAttribute (String uri, String localName, String rawName,
  -                            String type, String value)
  -    throws SAXException
  +  public void addAttribute(
  +          String uri, String localName, String rawName, String type, String value)
  +            throws SAXException
     {
  +
       QueuedStartElement qe = getQueuedElem();
  -    if(!qe.nsDeclsHaveBeenAdded())
  +
  +    if (!qe.nsDeclsHaveBeenAdded())
         addNSDeclsToAttrs();
  -    
  +
       ensurePrefixIsDeclared(uri, rawName);
  -    if(DEBUG)
  -      System.out.println("Adding attr: "+localName+", "+uri);
  +
  +    if (DEBUG)
  +      System.out.println("Adding attr: " + localName + ", " + uri);
  +
  +    // if(!isDefinedNSDecl(rawName, value))
       qe.addAttribute(uri, localName, rawName, type, value);
  +  }
  +
  +  /**
  +   * NEEDSDOC Method isDefinedNSDecl 
  +   *
  +   *
  +   * NEEDSDOC @param rawName
  +   * NEEDSDOC @param value
  +   *
  +   * NEEDSDOC (isDefinedNSDecl) @return
  +   */
  +  public boolean isDefinedNSDecl(String rawName, String value)
  +  {
  +
  +    if (rawName.equals("xmlns") || rawName.startsWith("xmlns:"))
  +    {
  +      int index;
  +      String prefix = (index = rawName.indexOf(":")) < 0
  +                      ? "" : rawName.substring(0, index);
  +      String definedURI = m_nsSupport.getURI(prefix);
  +
  +      if (null != definedURI)
  +      {
  +        if (definedURI.equals(value))
  +        {
  +          return true;
  +        }
  +        else
  +          return false;
  +      }
  +      else
  +        return false;
  +    }
  +    else
  +      return false;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method isDefinedNSDecl 
  +   *
  +   *
  +   * NEEDSDOC @param attr
  +   *
  +   * NEEDSDOC (isDefinedNSDecl) @return
  +   */
     public boolean isDefinedNSDecl(Attr attr)
     {
  +
       String rawName = attr.getNodeName();
  -    if(rawName.equals("xmlns") || rawName.startsWith("xmlns:"))
  +
  +    if (rawName.equals("xmlns") || rawName.startsWith("xmlns:"))
       {
         int index;
  -      String prefix = (index = rawName.indexOf(":"))< 0 ? "" : rawName.substring(0, index);
  +      String prefix = (index = rawName.indexOf(":")) < 0
  +                      ? "" : rawName.substring(0, index);
         String uri = getURI(prefix);
  -      if((null != uri) && uri.equals(attr.getValue()))
  +
  +      if ((null != uri) && uri.equals(attr.getValue()))
           return true;
       }
  +
       return false;
     }
  -  
  +
     /**
      * Copy an DOM attribute to the created output element, executing
      * attribute templates as need be, and processing the xsl:use
      * attribute.
  +   *
  +   * NEEDSDOC @param attr
  +   *
  +   * @throws SAXException
      */
  -  public void addAttribute( Attr attr )
  -    throws SAXException
  +  public void addAttribute(Attr attr) throws SAXException
     {
  -    if(isDefinedNSDecl(attr))
  -      return; 
  -    
  +
  +    if (isDefinedNSDecl(attr))
  +      return;
  +
       DOMHelper helper = m_transformer.getXPathContext().getDOMHelper();
  -    addAttribute (helper.getNamespaceOfNode(attr), 
  -                  helper.getLocalNameOfNode(attr), 
  -                  attr.getNodeName(),
  -                  "CDATA", 
  -                  attr.getValue());
  -  } // end copyAttributeToTarget method
  -  
  +
  +    addAttribute(helper.getNamespaceOfNode(attr),
  +                 helper.getLocalNameOfNode(attr), attr.getNodeName(),
  +                 "CDATA", attr.getValue());
  +  }  // end copyAttributeToTarget method
  +
     /**
      * Copy DOM attributes to the result element.
  +   *
  +   * NEEDSDOC @param src
  +   *
  +   * @throws SAXException
      */
  -  public void addAttributes( Node src )
  -    throws SAXException
  +  public void addAttributes(Node src) throws SAXException
     {
  +
       NamedNodeMap nnm = src.getAttributes();
       int nAttrs = nnm.getLength();
  -    for (int i = 0;  i < nAttrs;  i++)
  +
  +    for (int i = 0; i < nAttrs; i++)
       {
  -      Attr node = (Attr)nnm.item(i);
  +      Attr node = (Attr) nnm.item(i);
  +
         addAttribute(node);
       }
     }
  -  
  +
     /**
      * Tell if an element is pending, to be output to the result tree.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isElementPending()
     {
  +
       QueuedStartElement qse = getQueuedElem();
  +
       return (null != qse) ? qse.isPending : false;
     }
   
  @@ -964,67 +1322,117 @@
      * Use the SAX2 helper class to track result namespaces.
      */
     private NamespaceSupport m_nsSupport = new NamespaceSupport();
  -  
  +
     /**
      * The transformer object.
      */
     private TransformerImpl m_transformer;
  -  
  +
     /**
  -   * The content handler.  May be null, in which 
  -   * case, we'll defer to the content handler in the 
  +   * The content handler.  May be null, in which
  +   * case, we'll defer to the content handler in the
      * transformer.
      */
     private ContentHandler m_contentHandler;
  -  
  +
  +  /** NEEDSDOC Field m_lexicalHandler          */
  +  private LexicalHandler m_lexicalHandler;
  +
     /**
      * The root of a linked set of stylesheets.
      */
     private StylesheetRoot m_stylesheetRoot = null;
  -  
  +
     /**
      * This is used whenever a unique namespace is needed.
      */
     private int m_uniqueNSValue = 0;
  -  
  +
  +  /** NEEDSDOC Field S_NAMESPACEPREFIX          */
     private static final String S_NAMESPACEPREFIX = "ns";
  -  
  +
     /**
      * This class clones nodes to the result tree.
      */
  -  ClonerToResultTree m_cloner;
  -  
  +  public ClonerToResultTree m_cloner;
  +
     /**
      * Trace manager for debug support.
      */
     private TraceManager m_tracer;
  -  
  -  
  +
     // These are passed to flushPending, to help it decide if it 
     // should really flush.
  +
  +  /** NEEDSDOC Field EVT_SETDOCUMENTLOCATOR          */
     private static final int EVT_SETDOCUMENTLOCATOR = 1;
  +
  +  /** NEEDSDOC Field EVT_STARTDOCUMENT          */
     private static final int EVT_STARTDOCUMENT = 2;
  +
  +  /** NEEDSDOC Field EVT_ENDDOCUMENT          */
     private static final int EVT_ENDDOCUMENT = 3;
  +
  +  /** NEEDSDOC Field EVT_STARTPREFIXMAPPING          */
     private static final int EVT_STARTPREFIXMAPPING = 4;
  +
  +  /** NEEDSDOC Field EVT_ENDPREFIXMAPPING          */
     private static final int EVT_ENDPREFIXMAPPING = 5;
  +
  +  /** NEEDSDOC Field EVT_STARTELEMENT          */
     private static final int EVT_STARTELEMENT = 6;
  +
  +  /** NEEDSDOC Field EVT_ENDELEMENT          */
     private static final int EVT_ENDELEMENT = 7;
  +
  +  /** NEEDSDOC Field EVT_CHARACTERS          */
     private static final int EVT_CHARACTERS = 8;
  +
  +  /** NEEDSDOC Field EVT_IGNORABLEWHITESPACE          */
     private static final int EVT_IGNORABLEWHITESPACE = 9;
  +
  +  /** NEEDSDOC Field EVT_PROCESSINGINSTRUCTION          */
     private static final int EVT_PROCESSINGINSTRUCTION = 10;
  +
  +  /** NEEDSDOC Field EVT_SKIPPEDENTITY          */
     private static final int EVT_SKIPPEDENTITY = 11;
  +
  +  /** NEEDSDOC Field EVT_COMMENT          */
     private static final int EVT_COMMENT = 12;
  +
  +  /** NEEDSDOC Field EVT_ENTITYREF          */
     private static final int EVT_ENTITYREF = 13;
  +
  +  /** NEEDSDOC Field EVT_STARTENTITY          */
     private static final int EVT_STARTENTITY = 14;
  +
  +  /** NEEDSDOC Field EVT_ENDENTITY          */
     private static final int EVT_ENDENTITY = 15;
  +
  +  /** NEEDSDOC Field EVT_STARTDTD          */
     private static final int EVT_STARTDTD = 16;
  +
  +  /** NEEDSDOC Field EVT_ENDDTD          */
     private static final int EVT_ENDDTD = 17;
  +
  +  /** NEEDSDOC Field EVT_STARTNONESCAPING          */
     private static final int EVT_STARTNONESCAPING = 18;
  +
  +  /** NEEDSDOC Field EVT_ENDNONESCAPING          */
     private static final int EVT_ENDNONESCAPING = 19;
  +
  +  /** NEEDSDOC Field EVT_STARTPRESERVING          */
     private static final int EVT_STARTPRESERVING = 20;
  +
  +  /** NEEDSDOC Field EVT_ENDENDPRESERVING          */
     private static final int EVT_ENDENDPRESERVING = 21;
  +
  +  /** NEEDSDOC Field EVT_STARTCDATA          */
     private static final int EVT_STARTCDATA = 22;
  +
  +  /** NEEDSDOC Field EVT_ENDCDATA          */
     private static final int EVT_ENDCDATA = 23;
  -  private static final int EVT_NODE = 24;
   
  +  /** NEEDSDOC Field EVT_NODE          */
  +  private static final int EVT_NODE = 24;
   }
  
  
  
  1.3       +45 -21    xml-xalan/java/src/org/apache/xalan/transformer/SerializerSwitcher.java
  
  Index: SerializerSwitcher.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/SerializerSwitcher.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SerializerSwitcher.java	2000/10/13 02:33:13	1.2
  +++ SerializerSwitcher.java	2000/10/30 18:57:01	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -58,9 +58,12 @@
   
   import java.io.Writer;
   import java.io.OutputStream;
  +
   import org.apache.xalan.templates.StylesheetRoot;
  +
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
  +
   import org.apache.serialize.Serializer;
   import org.apache.serialize.SerializerFactory;
   import org.apache.serialize.Method;
  @@ -68,60 +71,81 @@
   import org.apache.xalan.templates.OutputFormatExtended;
   
   /**
  - * This is a helper class that decides if Xalan needs to switch 
  + * This is a helper class that decides if Xalan needs to switch
    * serializers, based on the first output element.
    */
   public class SerializerSwitcher
  -{  
  -  public static void switchSerializerIfHTML(TransformerImpl transformer,
  -                                            String ns, String localName)
  -    throws SAXException
  +{
  +
  +  /**
  +   * NEEDSDOC Method switchSerializerIfHTML 
  +   *
  +   *
  +   * NEEDSDOC @param transformer
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
  +   *
  +   * @throws SAXException
  +   */
  +  public static void switchSerializerIfHTML(
  +          TransformerImpl transformer, String ns, String localName)
  +            throws SAXException
     {
  -    if(null == transformer)
  +
  +    if (null == transformer)
         return;
  -    
  +
       StylesheetRoot stylesheet = transformer.getStylesheet();
  -    
  -    if(null != stylesheet && !stylesheet.isOutputMethodSet())
  +
  +    if (null != stylesheet &&!stylesheet.isOutputMethodSet())
       {
  -      if(((null == ns) || (ns.length() == 0)) && localName.equalsIgnoreCase("html"))
  +      if (((null == ns) || (ns.length() == 0))
  +              && localName.equalsIgnoreCase("html"))
         {
           OutputFormat oformat = stylesheet.getOutputFormat();
  -        if(oformat instanceof OutputFormatExtended)
  +
  +        if (oformat instanceof OutputFormatExtended)
           {
  -          boolean methodHasBeeenSet 
  -            = ((OutputFormatExtended)oformat).methodHasBeenSet();
  -          if(methodHasBeeenSet)
  +          boolean methodHasBeeenSet =
  +            ((OutputFormatExtended) oformat).methodHasBeenSet();
  +
  +          if (methodHasBeeenSet)
               return;
           }
  +
           oformat.setMethod(Method.HTML);
  +
           try
           {
             Serializer oldSerializer = transformer.getSerializer();
  -          if(null != oldSerializer)
  +
  +          if (null != oldSerializer)
             {
               Serializer serializer = SerializerFactory.getSerializer(oformat);
               Writer writer = oldSerializer.getWriter();
  -            if(null != writer)
  +
  +            if (null != writer)
                 serializer.setWriter(writer);
               else
               {
                 OutputStream os = serializer.getOutputStream();
  -              if(null != os)
  +
  +              if (null != os)
                   serializer.setOutputStream(os);
               }
  +
               transformer.setSerializer(serializer);
  +
               ContentHandler ch = serializer.asContentHandler();
   
               transformer.setContentHandler(ch);
             }
           }
  -        catch(java.io.IOException e)
  +        catch (java.io.IOException e)
           {
             throw new SAXException(e);
           }
         }
       }
     }
  -
   }
  
  
  
  1.3       +109 -36   xml-xalan/java/src/org/apache/xalan/transformer/StackGuard.java
  
  Index: StackGuard.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/StackGuard.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StackGuard.java	2000/10/17 19:18:14	1.2
  +++ StackGuard.java	2000/10/30 18:57:02	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -59,9 +59,12 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.Text;
   import org.w3c.dom.Element;
  +
   import java.io.PrintWriter;
   import java.io.StringWriter;
  +
   import org.xml.sax.SAXException;
  +
   import org.apache.xalan.templates.ElemTemplateElement;
   
   /**
  @@ -69,127 +72,197 @@
    */
   public class StackGuard
   {
  +
     /**
      * Used for infinite loop check. If the value is -1, do not
  -   * check for infinite loops. Anyone who wants to enable that 
  +   * check for infinite loops. Anyone who wants to enable that
      * check should change the value of this variable to be the
  -   * level of recursion that they want to check. Be careful setting 
  -   * this variable, if the number is too low, it may report an 
  +   * level of recursion that they want to check. Be careful setting
  +   * this variable, if the number is too low, it may report an
      * infinite loop situation, when there is none.
  -   * Post version 1.0.0, we'll make this a runtime feature.   
  +   * Post version 1.0.0, we'll make this a runtime feature.
      */
  -  static int m_recursionLimit = -1;
  -  
  +  public static int m_recursionLimit = -1;
  +
     /**
      * Get the recursion limit.
      * Used for infinite loop check. If the value is -1, do not
  -   * check for infinite loops. Anyone who wants to enable that 
  +   * check for infinite loops. Anyone who wants to enable that
      * check should change the value of this variable to be the
  -   * level of recursion that they want to check. Be careful setting 
  -   * this variable, if the number is too low, it may report an 
  +   * level of recursion that they want to check. Be careful setting
  +   * this variable, if the number is too low, it may report an
      * infinite loop situation, when there is none.
  -   * Post version 1.0.0, we'll make this a runtime feature.   
  +   * Post version 1.0.0, we'll make this a runtime feature.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getRecursionLimit()
     {
       return m_recursionLimit;
     }
  -  
  +
     /**
      * Get the recursion limit.
      * Used for infinite loop check. If the value is -1, do not
  -   * check for infinite loops. Anyone who wants to enable that 
  +   * check for infinite loops. Anyone who wants to enable that
      * check should change the value of this variable to be the
  -   * level of recursion that they want to check. Be careful setting 
  -   * this variable, if the number is too low, it may report an 
  +   * level of recursion that they want to check. Be careful setting
  +   * this variable, if the number is too low, it may report an
      * infinite loop situation, when there is none.
  -   * Post version 1.0.0, we'll make this a runtime feature.   
  +   * Post version 1.0.0, we'll make this a runtime feature.
  +   *
  +   * NEEDSDOC @param limit
      */
     public void setRecursionLimit(int limit)
     {
       m_recursionLimit = limit;
     }
   
  +  /** NEEDSDOC Field m_xslRule          */
     Node m_xslRule;
  +
  +  /** NEEDSDOC Field m_sourceXML          */
     Node m_sourceXML;
   
  +  /** NEEDSDOC Field stack          */
     java.util.Stack stack = new java.util.Stack();
   
  -  public StackGuard()
  -  {
  -  }
  +  /**
  +   * Constructor StackGuard
  +   *
  +   */
  +  public StackGuard(){}
   
  +  /**
  +   * Constructor StackGuard
  +   *
  +   *
  +   * NEEDSDOC @param xslTemplate
  +   * NEEDSDOC @param sourceXML
  +   */
     public StackGuard(ElemTemplateElement xslTemplate, Node sourceXML)
     {
       m_xslRule = xslTemplate;
       m_sourceXML = sourceXML;
     }
   
  +  /**
  +   * NEEDSDOC Method equals 
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC (equals) @return
  +   */
     public boolean equals(Object obj)
     {
  -    if(((StackGuard)obj).m_xslRule.equals(m_xslRule) &&
  -       ((StackGuard)obj).m_sourceXML.equals(m_sourceXML))
  +
  +    if (((StackGuard) obj).m_xslRule.equals(m_xslRule)
  +            && ((StackGuard) obj).m_sourceXML.equals(m_sourceXML))
       {
         return true;
       }
  +
       return false;
     }
   
  +  /**
  +   * NEEDSDOC Method print 
  +   *
  +   *
  +   * NEEDSDOC @param pw
  +   */
     public void print(PrintWriter pw)
     {
  +
       // for the moment, these diagnostics are really bad...
  -    if(m_sourceXML instanceof Text)
  +    if (m_sourceXML instanceof Text)
       {
  -      Text tx = (Text)m_sourceXML;
  +      Text tx = (Text) m_sourceXML;
  +
         pw.println(tx.getData());
       }
  -    else if(m_sourceXML instanceof Element)
  +    else if (m_sourceXML instanceof Element)
       {
  -      Element elem = (Element)m_sourceXML;
  +      Element elem = (Element) m_sourceXML;
  +
         pw.println(elem.getNodeName());
       }
     }
   
  -  public void checkForInfinateLoop(StackGuard guard)
  -    throws SAXException
  +  /**
  +   * NEEDSDOC Method checkForInfinateLoop 
  +   *
  +   *
  +   * NEEDSDOC @param guard
  +   *
  +   * @throws SAXException
  +   */
  +  public void checkForInfinateLoop(StackGuard guard) throws SAXException
     {
  +
       int nRules = stack.size();
       int loopCount = 0;
  -    for(int i = (nRules - 1); i >= 0; i--)
  +
  +    for (int i = (nRules - 1); i >= 0; i--)
       {
  -      if(stack.elementAt(i).equals(guard))
  +      if (stack.elementAt(i).equals(guard))
         {
           loopCount++;
         }
  -      if(loopCount >= m_recursionLimit)
  +
  +      if (loopCount >= m_recursionLimit)
         {
  +
           // Print out really bad diagnostics.
           StringWriter sw = new StringWriter();
           PrintWriter pw = new PrintWriter(sw);
  +
           pw.println("Infinite loop diagnosed!  Stack trace:");
  +
           int k;
  -        for(k = 0; k < nRules; k++)
  +
  +        for (k = 0; k < nRules; k++)
           {
  -          pw.println("Source Elem #"+k+" ");
  -          StackGuard guardOnStack = (StackGuard)stack.elementAt(i);
  +          pw.println("Source Elem #" + k + " ");
  +
  +          StackGuard guardOnStack = (StackGuard) stack.elementAt(i);
  +
             guardOnStack.print(pw);
           }
  -        pw.println("Source Elem #"+k+" ");
  +
  +        pw.println("Source Elem #" + k + " ");
           guard.print(pw);
           pw.println("End of infinite loop diagnosis.");
  +
           throw new SAXException(sw.getBuffer().toString());
         }
       }
     }
   
  +  /**
  +   * NEEDSDOC Method push 
  +   *
  +   *
  +   * NEEDSDOC @param xslTemplate
  +   * NEEDSDOC @param sourceXML
  +   *
  +   * @throws SAXException
  +   */
     public void push(ElemTemplateElement xslTemplate, Node sourceXML)
  -    throws SAXException
  +          throws SAXException
     {
  +
       StackGuard guard = new StackGuard(xslTemplate, sourceXML);
  +
       checkForInfinateLoop(guard);
       stack.push(guard);
     }
   
  +  /**
  +   * NEEDSDOC Method pop 
  +   *
  +   */
     public void pop()
     {
       stack.pop();
  
  
  
  1.3       +106 -33   xml-xalan/java/src/org/apache/xalan/transformer/TransformState.java
  
  Index: TransformState.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformState.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- TransformState.java	2000/10/13 02:33:13	1.2
  +++ TransformState.java	2000/10/30 18:57:02	1.3
  @@ -1,81 +1,154 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.transformer;
   
   import org.apache.xalan.templates.ElemTemplate;
   import org.apache.xalan.templates.ElemTemplateElement;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import org.apache.trax.Transformer;
   
   /**
  - * This interface is meant to be used by a consumer of 
  - * SAX2 events produced by Xalan, and enables the consumer 
  - * to get information about the state of the transform.  It 
  - * is primarily intended as a tooling interface.  A content 
  - * handler can get a reference to a TransformState by implementing 
  - * the TransformerClient interface.  Xalan will check for 
  - * that interface before it calls startDocument, and, if it 
  - * is implemented, pass in a TransformState reference to the 
  - * setTransformState method. 
  - * 
  - * <p>Note that the current stylesheet and root stylesheet can 
  - * be retrieved from the ElemTemplateElement obtained from 
  + * This interface is meant to be used by a consumer of
  + * SAX2 events produced by Xalan, and enables the consumer
  + * to get information about the state of the transform.  It
  + * is primarily intended as a tooling interface.  A content
  + * handler can get a reference to a TransformState by implementing
  + * the TransformerClient interface.  Xalan will check for
  + * that interface before it calls startDocument, and, if it
  + * is implemented, pass in a TransformState reference to the
  + * setTransformState method.
  + *
  + * <p>Note that the current stylesheet and root stylesheet can
  + * be retrieved from the ElemTemplateElement obtained from
    * either getCurrentElement() or getCurrentTemplate().</p>
    */
   public interface TransformState
   {
  +
     /**
  -   * Retrieves the stylesheet element that produced 
  +   * Retrieves the stylesheet element that produced
      * the SAX event.
  -   * 
  -   * <p>Please note that the ElemTemplateElement returned may 
  -   * be in a default template, and thus may not be 
  +   *
  +   * <p>Please note that the ElemTemplateElement returned may
  +   * be in a default template, and thus may not be
      * defined in the stylesheet.</p>
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     ElemTemplateElement getCurrentElement();
   
     /**
  -   * This method retrieves the current context node 
  +   * This method retrieves the current context node
      * in the source tree.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     Node getCurrentNode();
  -  
  +
     /**
  -   * This method retrieves the xsl:template 
  -   * that is in effect, which may be a matched template 
  +   * This method retrieves the xsl:template
  +   * that is in effect, which may be a matched template
      * or a named template.
  -   * 
  -   * <p>Please note that the ElemTemplate returned may 
  -   * be a default template, and thus may not have a template 
  +   *
  +   * <p>Please note that the ElemTemplate returned may
  +   * be a default template, and thus may not have a template
      * defined in the stylesheet.</p>
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     ElemTemplate getCurrentTemplate();
   
     /**
  -   * This method retrieves the xsl:template 
  -   * that was matched.  Note that this may not be 
  -   * the same thing as the current template (which 
  -   * may be from getCurrentElement()), since a named 
  +   * This method retrieves the xsl:template
  +   * that was matched.  Note that this may not be
  +   * the same thing as the current template (which
  +   * may be from getCurrentElement()), since a named
      * template may be in effect.
  -   * 
  -   * <p>Please note that the ElemTemplate returned may 
  -   * be a default template, and thus may not have a template 
  +   *
  +   * <p>Please note that the ElemTemplate returned may
  +   * be a default template, and thus may not have a template
      * defined in the stylesheet.</p>
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     ElemTemplate getMatchedTemplate();
   
     /**
  -   * Retrieves the node in the source tree that matched 
  +   * Retrieves the node in the source tree that matched
      * the template obtained via getMatchedTemplate().
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     Node getMatchedNode();
  -  
  +
     /**
      * Get the current context node list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     NodeIterator getContextNodeList();
  -  
  +
     /**
      * Get the TrAX Transformer object in effect.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     Transformer getTransformer();
   }
  
  
  
  1.2       +69 -10    xml-xalan/java/src/org/apache/xalan/transformer/TransformerClient.java
  
  Index: TransformerClient.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerClient.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TransformerClient.java	2000/07/23 17:17:01	1.1
  +++ TransformerClient.java	2000/10/30 18:57:02	1.2
  @@ -1,20 +1,79 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.transformer;
   
   /**
  - * A content handler can get a reference 
  - * to a TransformState by implementing 
  - * the TransformerClient interface.  Xalan will check for 
  - * that interface before it calls startDocument, and, if it 
  - * is implemented, pass in a TransformState reference to the 
  - * setTransformState method. 
  -*/
  + * A content handler can get a reference
  + * to a TransformState by implementing
  + * the TransformerClient interface.  Xalan will check for
  + * that interface before it calls startDocument, and, if it
  + * is implemented, pass in a TransformState reference to the
  + * setTransformState method.
  + */
   public interface TransformerClient
   {
  +
     /**
  -   * Pass in a reference to a TransformState object, which 
  -   * can be used during SAX ContentHandler events to obtain 
  -   * information about he state of the transformation. This 
  +   * Pass in a reference to a TransformState object, which
  +   * can be used during SAX ContentHandler events to obtain
  +   * information about he state of the transformation. This
      * method will be called  before each startDocument event.
  +   *
  +   * NEEDSDOC @param ts
      */
     void setTransformState(TransformState ts);
   }
  
  
  
  1.39      +1112 -891 xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java
  
  Index: TransformerImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TransformerImpl.java,v
  retrieving revision 1.38
  retrieving revision 1.39
  diff -u -r1.38 -r1.39
  --- TransformerImpl.java	2000/10/18 04:36:46	1.38
  +++ TransformerImpl.java	2000/10/30 18:57:02	1.39
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -60,15 +60,14 @@
   import java.util.Stack;
   import java.util.Vector;
   import java.util.Enumeration;
  +
   import java.io.StringWriter;
   import java.io.IOException;
   import java.io.UnsupportedEncodingException;
   
   // Xalan imports
   import org.apache.xalan.res.XSLTErrorResources;
  -
   import org.apache.xalan.stree.SourceTreeHandler;
  -
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.templates.ElemAttributeSet;
   import org.apache.xalan.templates.ElemTemplateElement;
  @@ -81,18 +80,16 @@
   import org.apache.xalan.templates.AVT;
   import org.apache.xalan.templates.ElemVariable;
   import org.apache.xalan.templates.ElemParam;
  +import org.apache.xalan.templates.ElemCallTemplate;
   import org.apache.xalan.templates.ElemTemplate;
   import org.apache.xalan.templates.TemplateList;
  -
   import org.apache.xalan.trace.TraceManager;
  -
   import org.apache.xalan.utils.DOMBuilder;
   import org.apache.xalan.utils.NodeVector;
   import org.apache.xalan.utils.BoolStack;
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.utils.ObjectPool;
  -
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.NodeSet;
   import org.apache.xpath.objects.XObject;
  @@ -144,7 +141,7 @@
   // Imported JAVA API for XML Parsing 1.0 classes
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  -import javax.xml.parsers.ParserConfigurationException; 
  +import javax.xml.parsers.ParserConfigurationException;
   
   /**
    * <meta name="usage" content="advanced"/>
  @@ -160,21 +157,180 @@
    * The best way to perform transformations is to use the
    * {@link XSLTProcessor#process(XSLTInputSource, XSLTInputSource, XSLTResultTarget)} method,
    * but you may use any of process methods defined in TransformerImpl.</p>
  - * 
  - * <p>Please note that this class is not safe per instance over multiple 
  - * threads.  If you are in a multithreaded environment, you should 
  - * keep a pool of these objects, or create a new one each time.  In a 
  - * multithreaded environment, the right way to do things is to create a 
  - * StylesheetRoot via processStylesheet, and then reuse this object 
  + *
  + * <p>Please note that this class is not safe per instance over multiple
  + * threads.  If you are in a multithreaded environment, you should
  + * keep a pool of these objects, or create a new one each time.  In a
  + * multithreaded environment, the right way to do things is to create a
  + * StylesheetRoot via processStylesheet, and then reuse this object
    * over multiple threads.</p>
    *
    * <p>If you reuse the processor instance, you should call reset() between transformations.</p>
    * @see XSLTProcessorFactory
    * @see XSLTProcessor
    */
  -public class TransformerImpl extends XMLFilterImpl 
  -  implements Transformer, Runnable, TransformState
  +public class TransformerImpl extends XMLFilterImpl
  +        implements Transformer, Runnable, TransformState
   {
  +  /**
  +   * True if the parser events should be on the main thread,
  +   * false if not.  Experemental.  Can not be set right now.
  +   */
  +  private boolean m_parserEventsOnMain = true;
  +
  +  /** The thread that the transformer is running on.          */
  +  private Thread m_transformThread;
  +
  +  /** The base URL of the source tree.          */
  +  private String m_urlOfSource = null;
  +
  +  /**
  +   * The output format object set by the user.  May be null.
  +   */
  +  private OutputFormat m_outputFormat;
  +
  +  /** The output serializer         */
  +  private Serializer m_serializer;
  +  
  +  /**
  +   * The content handler for the source input tree.
  +   */
  +  ContentHandler m_inputContentHandler;
  +
  +  /**
  +   * Use member variable to store param variables as they're
  +   * being created, use member variable so we don't
  +   * have to create a new vector every time.
  +   */
  +  private Vector m_newVars = new Vector();
  +
  +  /** The JAXP Document Builder, mainly to create Result Tree Fragments. */
  +  DocumentBuilder m_docBuilder = null;
  +
  +  /** A pool of ResultTreeHandlers, for serialization of a subtree to text.
  +   *  Please note that each of these also holds onto a Text Serializer.  */
  +  private ObjectPool m_textResultHandlerObjectPool =
  +    new ObjectPool(org.apache.xalan.transformer.ResultTreeHandler.class);
  +
  +  /** Related to m_textResultHandlerObjectPool, this is a pool of 
  +   * StringWriters, which are passed to the Text Serializers.
  +   * (I'm not sure if this is really needed any more.  -sb)      */
  +  private ObjectPool m_stringWriterObjectPool =
  +    new ObjectPool(java.io.StringWriter.class);
  +
  +  /** A static text format object, which can be used over and 
  +   * over to create the text serializers.    */
  +  private static OutputFormat m_textformat;
  +
  +  static
  +  {
  +    // Synchronize??
  +    m_textformat = new OutputFormat();
  +
  +    m_textformat.setMethod("text");
  +    m_textformat.setPreserveSpace(true);
  +  }
  +  
  +  /** A node vector used as a stack to track the current 
  +   * ElemTemplateElement.  Needed for the 
  +   * org.apache.xalan.transformer.TransformState interface,  
  +   * so a tool can discover the calling template. */
  +  private NodeVector m_currentTemplateElements = new NodeVector(64);
  +
  +  /** A node vector used as a stack to track the current 
  +   * ElemTemplate that was matched, as well as the node that 
  +   * was matched.  Needed for the 
  +   * org.apache.xalan.transformer.TransformState interface,  
  +   * so a tool can discover the matched template, and matched 
  +   * node. */
  +  private NodeVector m_currentMatchTemplates = new NodeVector();
  +
  +  /**
  +   * The root of a linked set of stylesheets.
  +   */
  +  private StylesheetRoot m_stylesheetRoot = null;
  +
  +  /**
  +   * If this is set to true, do not warn about pattern
  +   * match conflicts.
  +   */
  +  private boolean m_quietConflictWarnings = true;
  +
  +  /**
  +   * The liason to the XML parser, so the XSL processor
  +   * can handle included files, and the like, and do the
  +   * initial parse of the XSL document.
  +   */
  +  private XPathContext m_xcontext;
  +
  +  /**
  +   * Object to guard agains infinite recursion when
  +   * doing queries.
  +   */
  +  private StackGuard m_stackGuard = new StackGuard();
  +
  +  /**
  +   * Output handler to bottleneck SAX events.
  +   */
  +  private ResultTreeHandler m_resultTreeHandler;
  +
  +  /** The key manager, which manages xsl:keys.   */
  +  private KeyManager m_keyManager = new KeyManager();
  +
  +  /**
  +   * Stack for the purposes of flagging infinite recursion with
  +   * attribute sets.
  +   */
  +  private Stack m_attrSetStack = null;
  +
  +  /**
  +   * The table of counters for xsl:number support.
  +   * @see ElemNumber
  +   */
  +  private CountersTable m_countersTable = null;
  +
  +  /**
  +   * Is > 0 when we're processing a for-each.
  +   */
  +  private BoolStack m_currentTemplateRuleIsNull = new BoolStack();
  +
  +  /** The message manager, which manages error messages, warning 
  +   * messages, and other types of message events.   */
  +  private MsgMgr m_msgMgr;
  +
  +  /**
  +   * This is a compile-time flag to turn off calling
  +   * of trace listeners. Set this to false for optimization purposes.
  +   */
  +  public static boolean S_DEBUG = false;
  +
  +  /**
  +   * The trace manager.
  +   */
  +  private TraceManager m_traceManager = new TraceManager(this);
  +
  +  /** If the transform thread throws an exception, the exception needs to 
  +   * be stashed away so that the main thread can pass it on to the 
  +   * client. */
  +  private Exception m_exceptionThrown = null;
  +
  +  /** The InputSource for the source tree, which is needed if the 
  +   * parse thread is not the main thread, in order for the parse 
  +   * thread's run method to get to the input source.   
  +   * (Delete this if reversing threads is outlawed. -sb)    */
  +  private InputSource m_xmlSource;
  +
  +  /** This is needed for support of setSourceTreeDocForThread(Node doc),
  +   * which must be called in order for the transform thread's run 
  +   * method to obtain the root of the source tree to be transformed.     */
  +  private Node m_doc;
  +
  +  /**
  +   * If the the transform is on the secondary thread, we
  +   * need to know when it is done, so we can return.
  +   */
  +  boolean m_isTransformDone = false;
  +
     //==========================================================
     // SECTION: Constructors
     //==========================================================
  @@ -186,25 +342,28 @@
      */
     public TransformerImpl(StylesheetRoot stylesheet)
     {
  +
       setStylesheet(stylesheet);
       setXPathContext(new XPathContext(this));
       getXPathContext().setNamespaceContext(stylesheet);
     }
  -  
  +
     /**
      * Reset the state.  This needs to be called after a process() call
      * is invoked, if the processor is to be used again.
      */
     public void reset()
     {
  +
       // I need to look more carefully at which of these really
       // needs to be reset.
  -    
       m_countersTable = null;
       m_stackGuard = new StackGuard();
  +
       getXPathContext().reset();
       m_currentTemplateElements.removeAllElements();
       m_currentMatchTemplates.removeAllElements();
  +
       m_resultTreeHandler = null;
       m_keyManager = new KeyManager();
       m_attrSetStack = null;
  @@ -215,13 +374,15 @@
       m_isTransformDone = false;
       m_inputContentHandler = null;
     }
  -      
  +
     // ========= Transformer Interface Implementation ==========
   
     /**
      * Transform a document.
      *
      * @param input The input source for the document entity.
  +   *
  +   * @param xmlSource A SAX InputSource object, must not be null.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
      * @exception java.io.IOException An IO exception from the parser,
  @@ -229,33 +390,29 @@
      *            supplied by the application.
      * @see org.xml.sax.XMLReader#parse(org.xml.sax.InputSource)
      */
  -  public void parse( InputSource xmlSource)
  -    throws SAXException, IOException
  +  public void parse(InputSource xmlSource) throws SAXException, IOException
     {
  -    transform( xmlSource );
  +    transform(xmlSource);
     }
  -  
  -  /**
  -   * True if the parser events should be on the main thread, 
  -   * false if not.  Experemental.  Can not be set right now.
  -   */
  -  private boolean m_parserEventsOnMain = true;
  -  
  +
     /**
  -   * Get true if the parser events should be on the main thread, 
  -   * false if not.  Experemental.  Can not be set right now.
  +   * <meta name="usage" content="experimental"/>
  +   * Get true if the parser events should be on the main thread,
  +   * false if not.  Experimental.  Can not be set right now.
  +   *
  +   * @return true if the parser events should be on the main thread,
  +   * false if not.
      */
     public boolean isParserEventsOnMain()
     {
       return m_parserEventsOnMain;
     }
  -  
  -  private Thread m_transformThread;
  -  
  +
     /**
  - * <meta name="usage" content="internal"/>
  +   * <meta name="usage" content="internal"/>
      * Get the thread that the transform process is on.
  -   * This may return null.
  +   *
  +   * @return The thread that the transform process is on, or null.
      */
     public Thread getTransformThread()
     {
  @@ -263,9 +420,10 @@
     }
   
     /**
  - * <meta name="usage" content="internal"/>
  +   * <meta name="usage" content="internal"/>
      * Get the thread that the transform process is on.
  -   * This may return null.
  +   *
  +   * @param t The transform thread, may be null.
      */
     public void setTransformThread(Thread t)
     {
  @@ -275,115 +433,139 @@
     /**
      * Process the source tree to SAX parse events.
      * @param xmlSource  The input for the source tree.
  +   *
  +   * @throws TransformException
      */
  -  public void transform( InputSource xmlSource)
  -    throws TransformException
  +  public void transform(InputSource xmlSource) throws TransformException
     {
  -    if(null != xmlSource.getSystemId())
  +
  +    if (null != xmlSource.getSystemId())
         m_urlOfSource = xmlSource.getSystemId();
  +
       try
       {
  +
         // Get an already set XMLReader, or create one.
         XMLReader reader = this.getParent();
  -      if(null == reader)
  +
  +      if (null == reader)
         {
           reader = XMLReaderFactory.createXMLReader();
         }
  +
         try
         {
  -        reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
  -        reader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
  +        reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
  +                          true);
  +        reader.setFeature("http://apache.org/xml/features/validation/dynamic",
  +                          true);
         }
  -      catch(SAXException se)
  +      catch (SAXException se)
         {
  +
           // What can we do?
           // TODO: User diagnostics.
         }
  -      
  +
         // Get the input content handler, which will handle the 
         // parse events and create the source tree. 
         ContentHandler inputHandler = getInputContentHandler();
  -      reader.setContentHandler( inputHandler );
  -      reader.setProperty("http://xml.org/sax/properties/lexical-handler", inputHandler);
  -      
  +
  +      reader.setContentHandler(inputHandler);
  +      reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +                         inputHandler);
  +
         // Set the reader for cloning purposes.
         getXPathContext().setPrimaryReader(reader);
  +
         this.m_exceptionThrown = null;
  -      if(inputHandler instanceof org.apache.xalan.stree.SourceTreeHandler)
  +
  +      if (inputHandler instanceof SourceTreeHandler)
         {
  -        ((org.apache.xalan.stree.SourceTreeHandler)inputHandler).setInputSource(xmlSource);
  -        ((org.apache.xalan.stree.SourceTreeHandler)inputHandler).setUseMultiThreading(true);
  -        Node doc 
  -          = ((org.apache.xalan.stree.SourceTreeHandler)inputHandler).getRoot();
  -        if(null != doc)
  +        SourceTreeHandler sth = (SourceTreeHandler) inputHandler;
  +
  +        sth.setInputSource(xmlSource);
  +        sth.setUseMultiThreading(true);
  +
  +        Node doc = sth.getRoot();
  +
  +        if (null != doc)
           {
  -          getXPathContext().getSourceTreeManager().putDocumentInCache(doc, xmlSource);
  -          
  +          getXPathContext().getSourceTreeManager().putDocumentInCache(doc,
  +                  xmlSource);
  +
             m_xmlSource = xmlSource;
             m_doc = doc;
  -          
  -          if(isParserEventsOnMain())
  +
  +          if (isParserEventsOnMain())
             {
               m_isTransformDone = false;
  +
               getXPathContext().getPrimaryReader().parse(xmlSource);
             }
             else
             {
               Thread t = new Thread(this);
  +
               t.start();
               transformNode(doc);
             }
           }
  -        
         }
         else
         {
  +
           // ??
  -        reader.parse( xmlSource );
  +        reader.parse(xmlSource);
         }
  -      
  -      
  +
         // Kick off the parse.  When the ContentHandler gets 
         // the startDocument event, it will call transformNode( node ).
         // reader.parse( xmlSource );
  -      
         // This has to be done to catch exceptions thrown from 
         // the transform thread spawned by the STree handler.
         Exception e = getExceptionThrown();
  -      if(null != e)
  +
  +      if (null != e)
         {
  -        if(e instanceof org.apache.trax.TransformException)
  -          throw (org.apache.trax.TransformException)e;
  -        else if(e instanceof org.apache.xalan.utils.WrappedRuntimeException)
  +        if (e instanceof org.apache.trax.TransformException)
  +          throw (org.apache.trax.TransformException) e;
  +        else if (e instanceof org.apache.xalan.utils.WrappedRuntimeException)
             throw new org.apache.trax.TransformException(
  -            ((org.apache.xalan.utils.WrappedRuntimeException)e).getException());
  +            ((org.apache.xalan.utils.WrappedRuntimeException) e).getException());
           else
           {
             throw new org.apache.trax.TransformException(e);
           }
         }
  -      else if(null != m_resultTreeHandler)
  +      else if (null != m_resultTreeHandler)
         {
           m_resultTreeHandler.endDocument();
         }
  -
       }
  -    catch(org.apache.xalan.utils.WrappedRuntimeException wre)
  +    catch (org.apache.xalan.utils.WrappedRuntimeException wre)
       {
         Throwable throwable = wre.getException();
  -      while(throwable instanceof org.apache.xalan.utils.WrappedRuntimeException)
  -        throwable = ((org.apache.xalan.utils.WrappedRuntimeException)throwable).getException();
  +
  +      while (throwable
  +             instanceof org.apache.xalan.utils.WrappedRuntimeException)
  +      {
  +        throwable =
  +          ((org.apache.xalan.utils.WrappedRuntimeException) throwable).getException();
  +      }
  +
         throw new TransformException(wre.getException());
       }
  -    catch(SAXException se)
  +    catch (SAXException se)
       {
         se.printStackTrace();
  -      if(se instanceof TransformException)
  -        throw (TransformException)se;
  +
  +      if (se instanceof TransformException)
  +        throw (TransformException) se;
         else
           throw new TransformException(se);
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
         throw new TransformException(ioe);
       }
  @@ -392,45 +574,51 @@
         reset();
       }
     }
  -  
  -  private String m_urlOfSource = null;
  -  
  +
     /**
      * Get the base URL of the source.
  +   *
  +   * @return The base URL of the source tree, or null. 
      */
     public String getBaseURLOfSource()
     {
       return m_urlOfSource;
     }
  -  
  +
     /**
      * Get the value of a property.  Recognized properties are:
      *
  -   * <p>"http://xml.apache.org/xslt/sourcebase" - the base URL for the 
  -   * source, which is needed when pure SAX ContentHandler transformation 
  +   * <p>"http://xml.apache.org/xslt/sourcebase" - the base URL for the
  +   * source, which is needed when pure SAX ContentHandler transformation
      * is to be done.</p>
      *
      * @param name The property name, which is a fully-qualified URI.
  +   *
  +   * @return The value of the property, or null if not found.
      * @exception org.xml.sax.SAXNotRecognizedException When the
      *            XMLReader does not recognize the property name.
      * @exception org.xml.sax.SAXNotSupportedException When the
  -   *            XMLReader recognizes the property name but 
  +   *            XMLReader recognizes the property name but
      *            cannot set the requested value.
  +   *
  +   * @throws SAXNotRecognizedException
  +   * @throws SAXNotSupportedException
      */
  -  public Object getProperty (String name)
  -    throws SAXNotRecognizedException, SAXNotSupportedException
  +  public Object getProperty(String name)
  +          throws SAXNotRecognizedException, SAXNotSupportedException
     {
  -    if(name.equals("http://xml.apache.org/xslt/sourcebase"))
  +
  +    if (name.equals("http://xml.apache.org/xslt/sourcebase"))
         return name;
       else
  -      return super.getProperty (name);
  +      return super.getProperty(name);
     }
  -  
  +
     /**
      * Set the value of a property.  Recognized properties are:
      *
  -   * <p>"http://xml.apache.org/xslt/sourcebase" - the base URL for the 
  -   * source, which is needed when pure SAX ContentHandler transformation 
  +   * <p>"http://xml.apache.org/xslt/sourcebase" - the base URL for the
  +   * source, which is needed when pure SAX ContentHandler transformation
      * is to be done.</p>
      *
      * @param name The property name, which is a fully-qualified URI.
  @@ -438,340 +626,354 @@
      * @exception org.xml.sax.SAXNotRecognizedException When the
      *            XMLReader does not recognize the property name.
      * @exception org.xml.sax.SAXNotSupportedException When the
  -   *            XMLReader recognizes the property name but 
  +   *            XMLReader recognizes the property name but
      *            cannot set the requested value.
  +   *
  +   * @throws SAXNotRecognizedException
  +   * @throws SAXNotSupportedException
      */
  -  public void setProperty (String name, Object value)
  -    throws SAXNotRecognizedException, SAXNotSupportedException
  +  public void setProperty(String name, Object value)
  +          throws SAXNotRecognizedException, SAXNotSupportedException
     {
  -    if(name.equals("http://xml.apache.org/xslt/sourcebase"))
  -      m_urlOfSource = (String)value;
  +
  +    if (name.equals("http://xml.apache.org/xslt/sourcebase"))
  +      m_urlOfSource = (String) value;
       else
  -      super.getProperty (name);
  +      super.getProperty(name);
     }
  -  
  +
     /**
  +   * <meta name="usage" content="internal"/>
      * Process the an input source to a DOM node.  FOR INTERNAL USE ONLY.
  +   * 
      * @param xmlSource  The input for the source tree.
  +   *
  +   * @return The Node result of the parse, never null.
  +   *
  +   * @throws TransformException
      */
  -  public Node parseToNode( InputSource xmlSource)
  -    throws TransformException
  +  public Node parseToNode(InputSource xmlSource) throws TransformException
     {
  +
       // Duplicate code from above... but slightly different.  
       // TODO: Work on this...
  -    
  -    if(null != xmlSource.getSystemId())
  +    if (null != xmlSource.getSystemId())
         m_urlOfSource = xmlSource.getSystemId();
  -    
  -    Node doc = null;
  -    String liaisonClassName = System.getProperty("org.apache.xalan.source.liaison");
   
  -    if(null != liaisonClassName)
  -    {
  -      try 
  -      {
  -        DOM2Helper liaison =  (DOM2Helper)(Class.forName(liaisonClassName).newInstance());
  -        liaison.parse(xmlSource);
  -        getXPathContext().setDOMHelper(liaison);
  -        doc = liaison.getDocument();
  -      } 
  -      catch (SAXException se) 
  -      {
  -        throw new TransformException(se);
  -      } 
  -      catch (ClassNotFoundException e1) 
  -      {
  -        throw new TransformException("XML Liaison class " + liaisonClassName +
  -          " specified but not found", e1);
  -      } 
  -      catch (IllegalAccessException e2) 
  -      {
  -          throw new TransformException("XML Liaison class " + liaisonClassName +
  -            " found but cannot be loaded", e2);
  -      } 
  -      catch (InstantiationException e3) 
  -      {
  -          throw new TransformException("XML Liaison class " + liaisonClassName +
  -            " loaded but cannot be instantiated (no empty public constructor?)",
  -            e3);
  -      } 
  -      catch (ClassCastException e4) 
  -      {
  -          throw new TransformException("XML Liaison class " + liaisonClassName +
  -            " does not implement DOM2Helper", e4);
  -      }
  -    }
  -    else
  -    {
  +    Node doc = null;
         try
         {
           // Get an already set XMLReader, or create one.
           XMLReader reader = this.getParent();
  -        if(null == reader)
  +
  +        if (null == reader)
           {
             reader = XMLReaderFactory.createXMLReader();
           }
  +
           try
           {
  -          reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
  -          reader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
  +          reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
  +                            true);
  +          reader.setFeature(
  +                            "http://apache.org/xml/features/validation/dynamic", true);
           }
  -        catch(SAXException se)
  +        catch (SAXException se)
           {
  +
             // What can we do?
             // TODO: User diagnostics.
           }
  -        
  +
           // TODO: Handle Xerces DOM parser.
  -        
           // Get the input content handler, which will handle the 
           // parse events and create the source tree.
           ContentHandler inputHandler = getInputContentHandler();
  -        
  -        Class inputHandlerClass = ((Object)inputHandler).getClass();
  -        inputHandler = (ContentHandler)inputHandlerClass.newInstance();
  -        
  -        reader.setContentHandler( inputHandler );
  -        reader.setProperty("http://xml.org/sax/properties/lexical-handler", inputHandler);
  -        
  +        Class inputHandlerClass = ((Object) inputHandler).getClass();
  +
  +        inputHandler = (ContentHandler) inputHandlerClass.newInstance();
  +
  +        reader.setContentHandler(inputHandler);
  +        reader.setProperty("http://xml.org/sax/properties/lexical-handler",
  +                           inputHandler);
           getXPathContext().setPrimaryReader(reader);
  -                
  +
           // ...and of course I need a standard way to get a node...
  -        if(inputHandler instanceof org.apache.xalan.stree.SourceTreeHandler)
  +        if (inputHandler instanceof org.apache.xalan.stree.SourceTreeHandler)
           {
  +
             // Kick off the parse.  When the ContentHandler gets 
             // the startDocument event, it will call transformNode( node ).
  -          reader.parse( xmlSource );
  -          
  -          doc = ((org.apache.xalan.stree.SourceTreeHandler)inputHandler).getRoot();
  +          reader.parse(xmlSource);
  +
  +          doc =
  +               ((org.apache.xalan.stree.SourceTreeHandler) inputHandler).getRoot();
           }
         }
  -      catch(java.lang.IllegalAccessException iae)
  +      catch (java.lang.IllegalAccessException iae)
         {
           throw new TransformException(iae);
         }
  -      catch(InstantiationException ie)
  +      catch (InstantiationException ie)
         {
           throw new TransformException(ie);
         }
  -      catch(SAXException se)
  +      catch (SAXException se)
         {
           throw new TransformException(se);
         }
  -      catch(IOException ioe)
  +      catch (IOException ioe)
         {
           throw new TransformException(ioe);
         }
  -    }
  +
       return doc;
     }
  -  
  -    /**
  -   * Create a ContentHandler from a Result object.
  +
  +  /**
  +   * Create a result ContentHandler from a Result object, based 
  +   * on the current OutputFormat.
  +   *
  +   * @param outputTarget Where the transform result should go, 
  +   * should not be null.
  +   *
  +   * @return A valid ContentHandler that will create the 
  +   * result tree when it is fed SAX events.
  +   *
  +   * @throws TransformException
      */
     public ContentHandler createResultContentHandler(Result outputTarget)
  -    throws TransformException
  +          throws TransformException
     {
       return createResultContentHandler(outputTarget, getOutputFormat());
     }
  -  
  +
     /**
  -   * Create a ContentHandler from a Result object.
  +   * Create a ContentHandler from a Result object and an OutputFormat.
  +   *
  +   * @param outputTarget Where the transform result should go, 
  +   * should not be null.
  +   * @param format The OutputFormat object that will contain 
  +   * instructions on how to serialize the output.
  +   *
  +   * @return A valid ContentHandler that will create the 
  +   * result tree when it is fed SAX events.
  +   *
  +   * @throws TransformException
      */
  -  public ContentHandler createResultContentHandler(Result outputTarget, 
  -                                                   OutputFormat format)
  -    throws TransformException
  +  public ContentHandler createResultContentHandler(
  +          Result outputTarget, OutputFormat format) throws TransformException
     {
  +
       ContentHandler handler;
  -    
  +
       // If the Result object contains a Node, then create 
       // a ContentHandler that will add nodes to the input node.
       Node outputNode = outputTarget.getNode();
  -    if(null != outputNode)
  -    {
  -      int type = outputNode.getNodeType();
   
  -      Document doc = (Node.DOCUMENT_NODE == type) 
  -                     ? (Document)outputNode : outputNode.getOwnerDocument();
  -      
  -      handler = (Node.DOCUMENT_FRAGMENT_NODE == type) ?
  -                new DOMBuilder(doc, (DocumentFragment)outputNode) :
  -                new DOMBuilder(doc, outputNode);
  +    if (null != outputNode)
  +    {
  +      short type = outputNode.getNodeType();
  +      Document doc = (Node.DOCUMENT_NODE == type)
  +                     ? (Document) outputNode : outputNode.getOwnerDocument();
  +
  +      handler = (Node.DOCUMENT_FRAGMENT_NODE == type)
  +                ? new DOMBuilder(doc, (DocumentFragment) outputNode)
  +                : new DOMBuilder(doc, outputNode);
       }
  +
       // Otherwise, create a ContentHandler that will serialize the 
       // result tree to either a stream or a writer.
       else
  -    {      
  +    {
         String method = format.getMethod();
  -      if(null == method)
  +
  +      if (null == method)
           method = Method.XML;
  -      
  +
         try
         {
           Serializer serializer = SerializerFactory.getSerializer(format);
  -        if(null != outputTarget.getCharacterStream())
  +
  +        if (null != outputTarget.getCharacterStream())
             serializer.setWriter(outputTarget.getCharacterStream());
           else
             serializer.setOutputStream(outputTarget.getByteStream());
  +
           handler = serializer.asContentHandler();
  +
           this.setSerializer(serializer);
         }
  -      catch(UnsupportedEncodingException uee)
  +      catch (UnsupportedEncodingException uee)
         {
           throw new TransformException(uee);
         }
  -      catch(IOException ioe)
  +      catch (IOException ioe)
         {
           throw new TransformException(ioe);
         }
  -      
       }
  +
       return handler;
     }
  -  
  +
     /**
      * Process the source tree to the output result.
      * @param xmlSource  The input for the source tree.
      * @param outputTarget The output source target.
  +   *
  +   * @throws TransformException
      */
  -  public void transform( InputSource xmlSource, Result outputTarget)
  -    throws TransformException
  +  public void transform(InputSource xmlSource, Result outputTarget)
  +          throws TransformException
     {
  +
       ContentHandler handler = createResultContentHandler(outputTarget);
  +
       this.setContentHandler(handler);
  -    transform( xmlSource );
  +    transform(xmlSource);
     }
   
     /**
  -   * Process the source node to the output result, if the 
  -   * processor supports the "http://xml.org/trax/features/dom/input" 
  +   * Process the source node to the output result, if the
  +   * processor supports the "http://xml.org/trax/features/dom/input"
      * feature.
      * @param node  The input source node, which can be any valid DOM node.
      * @param outputTarget The output source target.
  +   *
  +   * @throws TransformException
      */
  -  public void transformNode( Node node, Result outputTarget)
  -    throws TransformException
  +  public void transformNode(Node node, Result outputTarget)
  +          throws TransformException
     {
  +
       ContentHandler handler = createResultContentHandler(outputTarget);
  +
       this.setContentHandler(handler);
  -    transformNode( node );
  +    transformNode(node);
     }
  -  
  +
     /**
  -   * Process the source node to the output result, if the 
  -   * processor supports the "http://xml.org/trax/features/dom/input" 
  +   * Process the source node to the output result, if the
  +   * processor supports the "http://xml.org/trax/features/dom/input"
      * feature.
      * @param node  The input source node, which can be any valid DOM node.
      * @param outputTarget The output source target.
  +   *
  +   * @throws TransformException
      */
  -  public void transformNode( Node node )
  -    throws TransformException
  +  public void transformNode(Node node) throws TransformException
     {
  +
       try
       {
         pushGlobalVars(node);
  -      
  +
         // ==========
         // Give the top-level templates a chance to pass information into 
         // the context (this is mainly for setting up tables for extensions).
         StylesheetRoot stylesheet = this.getStylesheet();
         int n = stylesheet.getGlobalImportCount();
  -      for(int i = 0; i < n; i++)
  +
  +      for (int i = 0; i < n; i++)
         {
           StylesheetComposed imported = stylesheet.getGlobalImport(i);
  +
           imported.runtimeInit(this);
  -        for(ElemTemplateElement child = imported.getFirstChildElem();
  -            child != null; child = child.getNextSiblingElem())
  +
  +        for (ElemTemplateElement child = imported.getFirstChildElem();
  +                child != null; child = child.getNextSiblingElem())
           {
             child.runtimeInit(this);
           }
  +
           int includedCount = imported.getIncludeCountComposed();
  +
           for (int j = 0; j < includedCount; j++)
           {
             Stylesheet included = imported.getIncludeComposed(j);
  +
             included.runtimeInit(this);
  -          for(ElemTemplateElement child = included.getFirstChildElem();
  -              child != null; child = child.getNextSiblingElem())
  +
  +          for (ElemTemplateElement child = included.getFirstChildElem();
  +                  child != null; child = child.getNextSiblingElem())
             {
               child.runtimeInit(this);
             }
           }
         }
  +
         // ===========
  -      
  -      this.transformNode(null, null, node, null);
  -      if(null != m_resultTreeHandler)
  +      this.applyTemplateToNode(null, null, node, null);
  +
  +      if (null != m_resultTreeHandler)
         {
           m_resultTreeHandler.endDocument();
         }
       }
  -    catch(SAXException se)
  +    catch (SAXException se)
       {
  -      if(se instanceof org.apache.trax.TransformException)
  -        throw (org.apache.trax.TransformException)se;
  +      if (se instanceof org.apache.trax.TransformException)
  +        throw (org.apache.trax.TransformException) se;
         else
           throw new TransformException(se);
       }
     }
  -  
  -  /**
  -   * The content handler for the source input tree.
  -   */
  -  ContentHandler m_inputContentHandler;
  -  
  +
     /**
      * Get a SAX2 ContentHandler for the input.
  -   * @return A valid ContentHandler, which should never be null, as 
  -   * long as getFeature("http://xml.org/trax/features/sax/input") 
  +   * @return A valid ContentHandler, which should never be null, as
  +   * long as getFeature("http://xml.org/trax/features/sax/input")
      * returns true.
      */
     public ContentHandler getInputContentHandler()
     {
  -    if(null == m_inputContentHandler)
  +
  +    if (null == m_inputContentHandler)
         m_inputContentHandler = new SourceTreeHandler(this);
   
       return m_inputContentHandler;
     }
  -  
  -   /**
  +
  +  /**
      * Get a SAX2 DeclHandler for the input.
  -   * @return A valid DeclHandler, which should never be null, as 
  -   * long as getFeature("http://xml.org/trax/features/sax/input") 
  +   * @return A valid DeclHandler, which should never be null, as
  +   * long as getFeature("http://xml.org/trax/features/sax/input")
      * returns true.
      */
     public DeclHandler getInputDeclHandler()
     {
  -    if(m_inputContentHandler instanceof DeclHandler)
  -      return (DeclHandler)m_inputContentHandler;
  +
  +    if (m_inputContentHandler instanceof DeclHandler)
  +      return (DeclHandler) m_inputContentHandler;
       else
         return null;
     }
  - 
  -   /**
  +
  +  /**
      * Get a SAX2 LexicalHandler for the input.
  -   * @return A valid LexicalHandler, which should never be null, as 
  -   * long as getFeature("http://xml.org/trax/features/sax/input") 
  +   * @return A valid LexicalHandler, which should never be null, as
  +   * long as getFeature("http://xml.org/trax/features/sax/input")
      * returns true.
      */
     public LexicalHandler getInputLexicalHandler()
     {
  -    if(m_inputContentHandler instanceof LexicalHandler)
  -      return (LexicalHandler)m_inputContentHandler;
  +
  +    if (m_inputContentHandler instanceof LexicalHandler)
  +      return (LexicalHandler) m_inputContentHandler;
       else
         return null;
     }
  -  
  -  /**
  -   * The output format object set by the user.  May be null.
  -   */
  -  private OutputFormat m_outputFormat;
   
     /**
  -   * Set the output properties for the transformation.  These 
  -   * properties will override properties set in the templates 
  +   * Set the output properties for the transformation.  These
  +   * properties will override properties set in the templates
      * with xsl:output.
  -   * 
  +   *
      * @see org.xml.org.apache.serialize.OutputFormat
  +   *
  +   * @param oformat A valid OutputFormat object (which will 
  +   * not be mutated), or null.
      */
     public void setOutputFormat(OutputFormat oformat)
     {
  @@ -780,140 +982,155 @@
   
     /**
      * Get the output properties used for the transformation.
  -   * 
  +   *
      * @see org.xml.org.apache.serialize.OutputFormat
  +   *
  +   * @return the output format that was set by the user, 
  +   * otherwise the output format from the stylesheet.
      */
     public OutputFormat getOutputFormat()
     {
  +
       // Get the output format that was set by the user, otherwise get the 
       // output format from the stylesheet.
  -    OutputFormat format = (null == m_outputFormat) 
  -                          ? getStylesheet().getOutputComposed() :
  -                            m_outputFormat;
  +    OutputFormat format = (null == m_outputFormat)
  +                          ? getStylesheet().getOutputComposed()
  +                          : m_outputFormat;
  +
       return format;
     }
  -  
  -  private Serializer m_serializer;
  -  
  +
  +  /**
  +   * <meta name="usage" content="internal"/>
  +   * Get the current serializer in use, which may well not
  +   * be the main serializer (for instance, this may well be 
  +   * a text serializer for string creation from templates).
  +   *
  +   * @return The current serializer, or null if there is none.
  +   */
     public Serializer getSerializer()
     {
       return m_serializer;
     }
  -  
  +
  +  /**
  +   * <meta name="usage" content="internal"/>
  +   * Set the current serializer.
  +   *
  +   * @param s The current serializer, or null.
  +   */
     public void setSerializer(Serializer s)
     {
  -    m_serializer = s;;
  +    m_serializer = s;
  +    ;
     }
   
  -
     /**
      * Set a parameter for the templates.
  +   * 
      * @param name The name of the parameter.
      * @param namespace The namespace of the parameter.
  -   * @value The value object.  This can be any valid Java object 
  -   * -- it's up to the processor to provide the proper 
  -   * coersion to the object, or simply pass it on for use 
  +   * @param value The value object.  This can be any valid Java object
  +   * -- it's up to the processor to provide the proper
  +   * coersion to the object, or simply pass it on for use
      * in extensions.
      */
     public void setParameter(String name, String namespace, Object value)
     {
  +
       VariableStack varstack = getXPathContext().getVarStack();
       QName qname = new QName(namespace, name);
       XObject xobject = XObject.create(value);
  +
       varstack.pushVariable(qname, xobject);
  -  }
  -  
  -  /**
  -   * Reset the parameters to a null list.  
  -   */
  -  public void resetParameters()
  -  {
     }
  -  
  +
     /**
  -   * Use member variable to store param variables as they're
  -   * being created, use member variable so we don't
  -   * have to create a new vector every time.
  +   * Reset the parameters to a null list.
      */
  -  private Vector m_newVars = new Vector();
  -  
  +  public void resetParameters(){}
  +
     /**
      * Given a template, search for
      * the arguments and push them on the stack.  Also,
      * push default arguments on the stack.
      * You <em>must</em> call popContext() when you are
      * done with the arguments.
  +   *
  +   * @param xctxt The XPath runtime state for this transformation.
  +   * @param xslCallTemplateElement The xsl:call-template element.
  +   * @param sourceNode The Current source tree node.
  +   * @param mode The current xslt mode.
  +   *
  +   * @throws SAXException
      */
  -  public void pushParams(Stylesheet stylesheetTree,
  -                  ElemTemplateElement xslCallTemplateElement,
  -                  Node sourceNode, QName mode)
  -    throws SAXException
  +  public void pushParams(
  +          XPathContext xctxt, ElemCallTemplate xslCallTemplateElement, Node sourceNode, QName mode)
  +            throws SAXException
     {
  +
       // The trick here is, variables need to be executed outside the context 
       // of the current stack frame.
  -    
  -    XPathContext xctxt = getXPathContext();
       VariableStack vars = xctxt.getVarStack();
  -    if(1 == vars.getCurrentStackFrameIndex())
  -    {
  -      vars.pushElemFrame();
  -    }
  +    int n = xslCallTemplateElement.getParamElemCount();
   
  -    for(ElemTemplateElement child = xslCallTemplateElement.getFirstChildElem();
  -        null != child; child = child.getNextSiblingElem())
  +    for (int i = 0; i < n; i++)
       {
  -      // Is it an xsl:with-param element?
  -      if(Constants.ELEMNAME_WITHPARAM == child.getXSLToken())
  +      ElemWithParam xslParamElement = xslCallTemplateElement.getParamElem(i);
  +
  +      // Get the argument value as either an expression or 
  +      // a result tree fragment.
  +      XObject var;
  +      XPath param = xslParamElement.getSelect();
  +
  +      if (null != param)
  +      {
  +        var = param.execute(getXPathContext(), sourceNode, xslParamElement);
  +      }
  +      else if (null == xslParamElement.getFirstChild())
  +      {
  +        var = XString.EMPTYSTRING;
  +      }
  +      else
         {
  -        ElemWithParam xslParamElement = (ElemWithParam)child;
   
  -        // Get the argument value as either an expression or 
  -        // a result tree fragment.
  -        XObject var;
  -        if(null != xslParamElement.getSelect())
  -        {
  -          var = xslParamElement.getSelect().execute(getXPathContext(), sourceNode,
  -                                                    xslParamElement);
  -        }
  -        else if (null == xslParamElement.getFirstChild())
  -        {
  -          var = XString.EMPTYSTRING;
  -        }
  -        else
  -        {
  -          // Use result tree fragment
  -          DocumentFragment df = transformToRTF(stylesheetTree, 
  -                                               xslParamElement,
  -                                               sourceNode, mode);
  -          var = new XRTreeFrag(df);
  -        }
  -        
  -        m_newVars.addElement(new Arg(xslParamElement.getName(), var, true));
  +        // Use result tree fragment
  +        DocumentFragment df = transformToRTF(xslParamElement, sourceNode,
  +                                             mode);
  +
  +        var = new XRTreeFrag(df);
         }
  +
  +      m_newVars.addElement(new Arg(xslParamElement.getName(), var, true));
       }
  +
       vars.pushContextMarker();
  -    
  -    int n = m_newVars.size();
  -    if(n > 0)
  +
  +    int nNew = m_newVars.size();
  +
  +    if (nNew > 0)
       {
  -      for(int i = 0; i < n; i++)
  +      for (int i = 0; i < nNew; i++)
         {
  -        vars.push((Arg)m_newVars.elementAt(i));
  +        vars.push((Arg) m_newVars.elementAt(i));
         }
  -      
  +
         // Dragons check: make sure this is nulling the refs.
         m_newVars.removeAllElements();
       }
  -    
  -  } // end pushParams method
  -  
  +  }  // end pushParams method
  +
     /**
  -   * Internal -- push the global variables onto 
  +   * Internal -- push the global variables onto
      * the context's variable stack.
  +   *
  +   * @param contextNode The root of the source tree, can't be null.
  +   *
  +   * @throws SAXException
      */
  -  protected void pushGlobalVars(Node contextNode)
  -    throws SAXException
  +  protected void pushGlobalVars(Node contextNode) throws SAXException
     {
  +
       // I'm a little unhappy with this, as it seems like 
       // this will make all the variables for all stylesheets 
       // in scope, when really only the current stylesheet's 
  @@ -921,61 +1138,68 @@
       // this more...
       XPathContext xctxt = getXPathContext();
       VariableStack vs = xctxt.getVarStack();
  -    if(1 == vs.getCurrentStackFrameIndex())
  -    {
  -      vs.pushElemFrame();
  -    }
       StylesheetRoot sr = getStylesheet();
  -
       Enumeration vars = sr.getVariablesComposed();
  -    while(vars.hasMoreElements())
  +
  +    while (vars.hasMoreElements())
       {
  -      ElemVariable v = (ElemVariable)vars.nextElement();
  +      ElemVariable v = (ElemVariable) vars.nextElement();
         Object val = vs.getVariable(v.getName());
  -      if(null != val)
  +
  +      if (null != val)
           continue;
  +
         XObject xobj = v.getValue(this, contextNode);
  +
         vs.pushVariable(v.getName(), xobj);
       }
  +
       vars = sr.getParamsComposed();
  -    while(vars.hasMoreElements())
  +
  +    while (vars.hasMoreElements())
       {
  -      ElemParam v = (ElemParam)vars.nextElement();
  +      ElemParam v = (ElemParam) vars.nextElement();
         Object val = vs.getVariable(v.getName());
  -      if(null != val)
  +
  +      if (null != val)
           continue;
  +
         XObject xobj = v.getValue(this, contextNode);
  +
         vs.pushVariable(v.getName(), xobj);
       }
  +
       vs.markGlobalStackFrame();
     }
   
  -  
     /**
  -   * Set an object that will be used to resolve URIs used in 
  +   * Set an object that will be used to resolve URIs used in
      * document(), etc.
  -   * @param resolver An object that implements the URIResolver interface, 
  +   * @param resolver An object that implements the URIResolver interface,
      * or null.
      */
     public void setURIResolver(URIResolver resolver)
     {
       getXPathContext().getSourceTreeManager().setURIResolver(resolver);
     }
  -  
  -  /*
  -  * Allow an application to register an entity resolver.
  -  */
  -  public void setEntityResolver (org.xml.sax.EntityResolver resolver)
  +
  +  /**
  +   * Set the entity resolver, which will be passed on to any 
  +   * XMLReaders that are created.
  +   *
  +   * @param resolver The entity resolver, or null.
  +   * 
  +   * @see org.xml.sax.EntityResolver
  +   */
  +  public void setEntityResolver(org.xml.sax.EntityResolver resolver)
     {
       super.setEntityResolver(resolver);
       getXPathContext().getSourceTreeManager().setEntityResolver(resolver);
     }
   
  -    
     // ======== End Transformer Implementation ========  
  -  
  -  DocumentBuilder m_docBuilder = null;
  -    
  +
  +
     /**
      * <meta name="usage" content="advanced"/>
      * Given a stylesheet element, create a result tree fragment from it's
  @@ -985,33 +1209,38 @@
      * @param sourceNode The current source context node.
      * @param mode The mode under which the template is operating.
      * @return An object that represents the result tree fragment.
  +   *
  +   * @throws SAXException
      */
     public DocumentFragment transformToRTF(
  -                                        Stylesheet stylesheetTree,
  -                                        ElemTemplateElement templateParent,
  -                                        Node sourceNode, QName mode)
  -    throws SAXException
  +          ElemTemplateElement templateParent, Node sourceNode, QName mode)
  +            throws SAXException
     {
  +
       // XPathContext xctxt = getXPathContext();
       // Document docFactory = xctxt.getDOMHelper().getDOMFactory();
  -    
  -    if(null == m_docBuilder)
  +    if (null == m_docBuilder)
       {
         try
         {
  -        DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
  +        DocumentBuilderFactory dfactory =
  +          DocumentBuilderFactory.newInstance();
  +
           dfactory.setNamespaceAware(true);
           dfactory.setValidating(true);
  +
           m_docBuilder = dfactory.newDocumentBuilder();
         }
  -      catch(ParserConfigurationException pce)
  +      catch (ParserConfigurationException pce)
         {
  -        throw new SAXException(pce);//"createDocument() not supported in XPathContext!");
  +        throw new SAXException(pce);  //"createDocument() not supported in XPathContext!");
  +
           // return null;
         }
       }
  +
       Document docFactory = m_docBuilder.newDocument();
  -    
  +
       // Create a ResultTreeFrag object.
       DocumentFragment resultFragment = docFactory.createDocumentFragment();
   
  @@ -1021,13 +1250,13 @@
   
       // Save the current result tree handler.
       ResultTreeHandler savedRTreeHandler = this.m_resultTreeHandler;
  -    
  +
       // And make a new handler for the RTF.
       this.m_resultTreeHandler = new ResultTreeHandler(this, rtfHandler);
   
       // Do the transformation of the child elements.
       executeChildTemplates(templateParent, sourceNode, mode);
  -    
  +
       // Make sure everything is flushed!
       this.m_resultTreeHandler.flushPending();
   
  @@ -1035,351 +1264,241 @@
       this.m_resultTreeHandler = savedRTreeHandler;
   
       return resultFragment;
  -  }  
  -  
  -  private ObjectPool m_textResultHandlerObjectPool 
  -    = new ObjectPool(org.apache.xalan.transformer.ResultTreeHandler.class);
  +  }
   
  -  private ObjectPool m_stringWriterObjectPool 
  -    = new ObjectPool(java.io.StringWriter.class);
  -  
  -  /** 
  +
  +  /**
      * <meta name="usage" content="internal"/>
  -   * 
  +   * Get the StringWriter pool, so that StringWriter 
  +   * objects may be reused.
  +   *
  +   * @return The string writer pool, not null.
      */
     public ObjectPool getStringWriterPool()
     {
       return m_stringWriterObjectPool;
     }
  -  
  -  private static OutputFormat m_textformat;
  -  static
  -  {
  -    m_textformat = new OutputFormat();
  -    m_textformat.setMethod("text");
  -    m_textformat.setPreserveSpace(true);
  -  }
   
  -  /** 
  +  /**
      * <meta name="usage" content="advanced"/>
      * Take the contents of a template element, process it, and
      * convert it to a string.
  -   * 
  -   * @exception SAXException Might be thrown from the  document() function, or
  -   *      from xsl:include or xsl:import.
  +   *
  +   * @param elem The parent element whose children will be output 
  +   * as a string.
      * @param transformer The XSLT transformer instance.
      * @param sourceNode The current source node context.
  -   * @param mode The current mode.
  +   * @param mode The current xslt mode.
  +   * 
      * @return The stringized result of executing the elements children.
  +   * 
  +   * @exception SAXException
      */
  -  public String transformToString(ElemTemplateElement elem, 
  -                                 Node sourceNode,
  -                                 QName mode)
  -    throws SAXException
  -  {        
  +  public String transformToString(
  +          ElemTemplateElement elem, Node sourceNode, QName mode)
  +            throws SAXException
  +  {
  +
       // Save the current result tree handler.
       ResultTreeHandler savedRTreeHandler = this.m_resultTreeHandler;
  -    
  +
       // Create a Serializer object that will handle the SAX events 
       // and build the ResultTreeFrag nodes.
  -    StringWriter sw 
  -      = (StringWriter)m_stringWriterObjectPool.getInstance();
  -    m_resultTreeHandler 
  -      = (ResultTreeHandler)m_textResultHandlerObjectPool.getInstance();
  +    StringWriter sw = (StringWriter) m_stringWriterObjectPool.getInstance();
  +
  +    m_resultTreeHandler =
  +      (ResultTreeHandler) m_textResultHandlerObjectPool.getInstance();
  +
       Serializer serializer = m_resultTreeHandler.getSerializer();
  +
       try
       {
  -      if(null == serializer)
  +      if (null == serializer)
         {
           serializer = SerializerFactory.getSerializer(m_textformat);
  +
           m_resultTreeHandler.setSerializer(serializer);
           serializer.setWriter(sw);
  +
           ContentHandler shandler = serializer.asContentHandler();
  +
           m_resultTreeHandler.init(this, shandler);
         }
         else
         {
  +
           // serializer.setWriter(sw);
           // serializer.setOutputFormat(m_textformat);
           // ContentHandler shandler = serializer.asContentHandler();
           // m_resultTreeHandler.setContentHandler(shandler);
         }
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
         throw new SAXException(ioe);
       }
  -    
  +
       String result;
  +
       try
       {
         this.m_resultTreeHandler.startDocument();
   
         // Do the transformation of the child elements.
         executeChildTemplates(elem, sourceNode, mode);
  -      
         this.m_resultTreeHandler.endDocument();
  -      
  +
         result = sw.toString();
       }
       finally
       {
         sw.getBuffer().setLength(0);
  -      try { sw.close(); } catch(Exception ioe) {}
  +
  +      try
  +      {
  +        sw.close();
  +      }
  +      catch (Exception ioe){}
  +
         m_stringWriterObjectPool.freeInstance(sw);
         m_textResultHandlerObjectPool.freeInstance(m_resultTreeHandler);
  -      
         m_resultTreeHandler.reset();
  -      
  +
         // Restore the previous result tree handler.
         m_resultTreeHandler = savedRTreeHandler;
       }
  +
       return result;
     }
  -        
  -  /** 
  -   * <meta name="usage" content="advanced"/>
  -   * Perform a query if needed, and call transformNode for each child.
  -   * 
  -   * @exception SAXException Thrown in a variety of circumstances.
  -   * @param stylesheetTree The owning stylesheet tree.
  -   * @param xslInstruction The stylesheet element context (depricated -- I do 
  -   *      not think we need this).
  -   * @param template The owning template context.
  -   * @param sourceNodeContext The current source node context.
  -   * @param mode The current mode.
  -   * @param selectPattern The XPath with which to perform the selection.
  -   * @param xslToken The current XSLT instruction (depricated -- I do not     
  -   *     think we want this).
  -   * @param tcontext The TransformerImpl context.
  -   * @param selectStackFrameIndex The stack frame context for executing the
  -   *                              select statement.
  -   */
  -  public void transformSelectedNodes(StylesheetComposed stylesheetTree, 
  -                                     ElemTemplateElement xslInstruction, // xsl:apply-templates or xsl:for-each
  -                                     ElemTemplateElement template, // The template to copy to the result tree
  -                                     Node sourceNodeContext, QName mode, 
  -                                     XPath selectPattern, 
  -                                     int selectStackFrameIndex)
  -    throws SAXException
  -  {
  -    // Get the xsl:sort keys, if any.
  -    Vector keys = processSortKeys(xslInstruction, sourceNodeContext);
  -    
  -    XPathContext xctxt = getXPathContext();
  -      
  -    NodeIterator sourceNodes;
  -    VariableStack varstack = xctxt.getVarStack();
  -    
  -    // Was a select attribute specified?
  -    if(null == selectPattern)
  -    {
  -      if(null == m_selectDefault)
  -        m_selectDefault = new XPath("node()", xslInstruction, xslInstruction, XPath.SELECT);
  -        
  -      selectPattern = m_selectDefault;
  -    }
  -    
  -    // Save where-ever it is that the stack frame index may be pointing to.
  -    int savedCurrentStackFrameIndex = varstack.getCurrentStackFrameIndex();
  -
  -    // Make sure the stack frame index for variables is pointing to the right place.
  -    varstack.setCurrentStackFrameIndex(selectStackFrameIndex);
  -    
  -    try
  -    {
  -      XObject result = selectPattern.execute(xctxt, sourceNodeContext, 
  -                                             xslInstruction);
  -      sourceNodes = result.nodeset();
  -      
  -      if(TransformerImpl.S_DEBUG && m_traceManager.hasTraceListeners())
  -      {
  -        XNodeSet xresult = new XNodeSet(new NodeSet(sourceNodes));
  -        m_traceManager.fireSelectedEvent(sourceNodeContext,
  -                                         xslInstruction, "select", 
  -                                         selectPattern, xresult);
  -        // nodeList.setCurrentPos(0);
  -      }
  -
  -      // Of we now have a list of source nodes, sort them if needed, 
  -      // and then call transformNode on each of them.
  -      if(null == sourceNodes)
  -        return;
  -
  -      // Sort if we need to.
  -      if(null != keys)
  -      {               
  -        NodeSorter sorter = new NodeSorter(xctxt);
  -        NodeSet nodeList;
  -        
  -        if(sourceNodes instanceof NodeSet)
  -        {
  -          nodeList = ((NodeSet)sourceNodes);
  -          nodeList.setShouldCacheNodes(true);
  -          nodeList.runTo(-1);
  -        }
  -        else
  -        {
  -          nodeList = new NodeSet(sourceNodes);
  -          sourceNodes = nodeList;
  -          ((ContextNodeList)sourceNodes).setCurrentPos(0);
  -        }
  -        
  -        xctxt.pushContextNodeList((ContextNodeList)sourceNodes );
  -        try{
  -          sorter.sort(nodeList, keys, xctxt);
  -          nodeList.setCurrentPos(0);
  -        }
  -        finally
  -        {
  -          xctxt.popContextNodeList();
  -        }
  -      }
  -    }
  -    
  -    finally
  -    {
  -      varstack.setCurrentStackFrameIndex(savedCurrentStackFrameIndex);
  -    }
  -    
  -    // Push the ContextNodeList on a stack, so that select="position()"
  -    // and the like will work.
  -    // System.out.println("pushing context node list...");
  -    xctxt.pushContextNodeList((ContextNodeList)sourceNodes );
  -    try
  -    {   
  -      // Do the transformation on each.
  -      Node context;
  -      while(null != (context = sourceNodes.nextNode())) 
  -      {
  -        transformNode(xslInstruction, template, context, mode);
  -      }
  -    }
  -    finally
  -    {
  -      xctxt.popContextNodeList();
  -    }
  -  }
  - 
  -  /** 
  +
  +  /**
      * <meta name="usage" content="advanced"/>
      * Given an element and mode, find the corresponding
      * template and process the contents.
  -   * 
  +   *
      * @param stylesheetTree The current Stylesheet object.
      * @param xslInstruction The calling element.
      * @param template The template to use if xsl:for-each, or null.
      * @param selectContext The selection context.
      * @param child The source context node.
      * @param mode The current mode, may be null.
  -   * @exception SAXException 
  +   * @exception SAXException
      * @return true if applied a template, false if not.
      */
  -  public boolean transformNode(
  -                                ElemTemplateElement xslInstruction, // xsl:apply-templates or xsl:for-each
  -                                ElemTemplateElement template, // may be null
  -                                Node child,
  -                                QName mode
  -                                )
  -    throws SAXException
  -  {    
  -    int nodeType = child.getNodeType();
  +  public boolean applyTemplateToNode(ElemTemplateElement xslInstruction,  // xsl:apply-templates or xsl:for-each
  +                                     ElemTemplateElement template,  // may be null
  +                                             Node child, QName mode)
  +                                                     throws SAXException
  +  {
  +
  +    short nodeType = child.getNodeType();
  +    boolean isApplyImports = ((xslInstruction == null)
  +                              ? false
  +                              : xslInstruction.getXSLToken()
  +                                == Constants.ELEMNAME_APPLY_IMPORTS);
   
  -    boolean isApplyImports = ((xslInstruction == null)? false : 
  -                               xslInstruction.getXSLToken() == Constants.ELEMNAME_APPLY_IMPORTS);      
  -    
       // To find templates, use the the root of the import tree if 
       // this element is not an xsl:apply-imports or starting from the root, 
       // otherwise use the root of the stylesheet tree.
       // TODO: Not sure apply-import handling is correct right now.  -sb
       StylesheetComposed stylesheetTree;
  +
       if (isApplyImports)
  -    {  
  +    {
         StylesheetComposed stylesheet = xslInstruction.getStylesheetComposed();
         StylesheetRoot sroot = stylesheet.getStylesheetRoot();
         int importNumber = sroot.getImportNumber(stylesheet);
         int nImports = sroot.getGlobalImportCount();
  +
         if (importNumber < (nImports - 1))
  -        stylesheetTree = sroot.getGlobalImport(importNumber+1);
  -      else 
  +        stylesheetTree = sroot.getGlobalImport(importNumber + 1);
  +      else
           return false;
       }
  -    else 
  -    {  
  -      stylesheetTree = (null == template) 
  -                                        ? getStylesheet() 
  -                                          : template.getStylesheetComposed();
  -    }  
  +    else
  +    {
  +      stylesheetTree = (null == template)
  +                       ? getStylesheet() : template.getStylesheetComposed();
  +    }
   
       XPathContext xctxt = getXPathContext();
       boolean isDefaultTextRule = false;
  -    
  -    if(null == template)
  +
  +    if (null == template)
       {
  +
         // Find the XSL template that is the best match for the 
         // element.        
         PrefixResolver savedPrefixResolver = xctxt.getNamespaceContext();
  +
         try
         {
           xctxt.setNamespaceContext(xslInstruction);
  -        
  +
           TemplateList tl = stylesheetTree.getTemplateListComposed();
  -        template = tl.getTemplate(xctxt, child, mode, m_quietConflictWarnings);
  +
  +        template = tl.getTemplate(xctxt, child, mode,
  +                                  m_quietConflictWarnings);
         }
         finally
         {
           xctxt.setNamespaceContext(savedPrefixResolver);
         }
  -      
  +
         // If that didn't locate a node, fall back to a default template rule.
         // See http://www.w3.org/TR/xslt#built-in-rule.
  -      if(null == template)
  +      if (null == template)
         {
  -        switch(nodeType)
  +        switch (nodeType)
           {
  -        case Node.DOCUMENT_FRAGMENT_NODE:
  -        case Node.ELEMENT_NODE:
  +        case Node.DOCUMENT_FRAGMENT_NODE :
  +        case Node.ELEMENT_NODE :
             template = m_stylesheetRoot.getDefaultRule();
             break;
  -        case Node.CDATA_SECTION_NODE:
  -        case Node.TEXT_NODE:
  -        case Node.ATTRIBUTE_NODE:
  -          template = m_defaultTextRule;
  +        case Node.CDATA_SECTION_NODE :
  +        case Node.TEXT_NODE :
  +        case Node.ATTRIBUTE_NODE :
  +          template = m_stylesheetRoot.getDefaultTextRule();
             isDefaultTextRule = true;
             break;
  -        case Node.DOCUMENT_NODE:
  +        case Node.DOCUMENT_NODE :
             template = m_stylesheetRoot.getDefaultRootRule();
             break;
  -        default:
  +        default :
  +
             // No default rules for processing instructions and the like.
             return false;
  -        }   
  +        }
         }
       }
  -    
  +
       // If we are processing the default text rule, then just clone 
       // the value directly to the result tree.
       try
       {
  -      m_currentMatchTemplates.pushPair(template, child);
  -      if(isDefaultTextRule)
  +      pushPairCurrentMatched(template, child);
  +
  +      if (isDefaultTextRule)
         {
  -        switch(nodeType)
  +        switch (nodeType)
           {
  -        case Node.CDATA_SECTION_NODE:
  -        case Node.TEXT_NODE:
  +        case Node.CDATA_SECTION_NODE :
  +        case Node.TEXT_NODE :
             m_resultTreeHandler.m_cloner.cloneToResultTree(child, false);
  -          break;
  -        case Node.ATTRIBUTE_NODE:
  -          {
  -            String val = ((Attr)child).getValue();
  -            getResultTreeHandler().characters(val.toCharArray(), 0, val.length());
  -          }
             break;
  +        case Node.ATTRIBUTE_NODE :
  +        {
  +          String val = ((Attr) child).getValue();
  +
  +          getResultTreeHandler().characters(val.toCharArray(), 0,
  +                                            val.length());
  +        }
  +        break;
           }
         }
         else
         {
  +
           // 9/11/00: If template has been compiled, hand off to it
           // since much (most? all?) of the processing has been inlined.
           // (It would be nice if there was a single entry point that
  @@ -1388,41 +1507,45 @@
           // compiled obviously has to run its own code. It's
           // also unclear that "execute" is really the right name for
           // that entry point.)
  -
           // Fire a trace event for the template.
  -        if(TransformerImpl.S_DEBUG)
  +        if (TransformerImpl.S_DEBUG)
             getTraceManager().fireTraceEvent(child, mode, template);
  -        
  +
           // And execute the child templates.
  -        if(template.isCompiledTemplate())
  -          template.execute(this,child,mode);
  +        if (template.isCompiledTemplate())
  +          template.execute(this, child, mode);
           else
             executeChildTemplates(template, child, mode);
         }
       }
       finally
       {
  -      m_currentMatchTemplates.popPair();
  +      popCurrentMatched();
       }
  +
       return true;
     }
  -  
  -  /** 
  +
  +  /**
      * <meta name="usage" content="advanced"/>
      * Execute each of the children of a template element.
  -   * 
  -   * @param transformer The XSLT transformer instance.
  +   *
  +   * @param elem The ElemTemplateElement that contains the children 
  +   * that should execute.
      * @param sourceNode The current context node.
      * @param mode The current mode.
  -   * @exception SAXException Might be thrown from the  document() function, or
  -   *      from xsl:include or xsl:import.
  +   * @param handler The ContentHandler to where the result events 
  +   * should be fed.
  +   * 
  +   * @exception SAXException
      */
  -  public void executeChildTemplates(ElemTemplateElement elem, 
  -                              Node sourceNode,
  -                              QName mode, ContentHandler handler)
  -    throws SAXException
  -  { 
  +  public void executeChildTemplates(
  +          ElemTemplateElement elem, Node sourceNode, QName mode, ContentHandler handler)
  +            throws SAXException
  +  {
  +
       ContentHandler savedHandler = this.getContentHandler();
  +
       try
       {
         getResultTreeHandler().flushPending();
  @@ -1434,52 +1557,58 @@
         this.setContentHandler(savedHandler);
       }
     }
  -  
  -  private ElemTemplate m_defaultTextRule;
   
  -  /** 
  +  /**
      * <meta name="usage" content="advanced"/>
      * Execute each of the children of a template element.
  -   * 
  +   *
      * @param transformer The XSLT transformer instance.
  +   *
  +   * @param elem The ElemTemplateElement that contains the children 
  +   * that should execute.
      * @param sourceNode The current context node.
      * @param mode The current mode.
  -   * @exception SAXException Might be thrown from the  document() function, or
  -   *      from xsl:include or xsl:import.
  +   * 
  +   * @exception SAXException
      */
  -  public void executeChildTemplates(ElemTemplateElement elem, 
  -                              Node sourceNode,
  -                              QName mode)
  -    throws SAXException
  -  {    
  +  public void executeChildTemplates(
  +          ElemTemplateElement elem, Node sourceNode, QName mode)
  +            throws SAXException
  +  {
  +
       // Does this element have any children?
       ElemTemplateElement firstChild = elem.getFirstChildElem();
  -    if(null == firstChild)    
  -      return;      
  -    
  +
  +    if (null == firstChild)
  +      return;
  +
       XPathContext xctxt = getXPathContext();
   
       // Check for infinite loops if we have to.
       boolean check = (m_stackGuard.m_recursionLimit > -1);
  +
       if (check)
         getStackGuard().push(elem, sourceNode);
  -    
  +
       // We need to push an element frame in the variables stack, 
       // so all the variables can be popped at once when we're done.
       VariableStack varstack = getXPathContext().getVarStack();
  +
       varstack.pushElemFrame();
  -    
  +
       Locator savedLocator = xctxt.getSAXLocator();
  +
       try
       {
  -      pushElemTemplateElement(null, sourceNode);
  +      pushElemTemplateElement(null);
  +
         // Loop through the children of the template, calling execute on 
         // each of them.
  -      for (ElemTemplateElement t = firstChild; t != null; 
  -           t = t.getNextSiblingElem()) 
  +      for (ElemTemplateElement t = firstChild; t != null;
  +              t = t.getNextSiblingElem())
         {
           xctxt.setSAXLocator(t);
  -        m_currentTemplateElements.setTailSub1(t);
  +        m_currentTemplateElements.setTail(t);
           t.execute(this, sourceNode, mode);
         }
       }
  @@ -1487,247 +1616,309 @@
       {
         popElemTemplateElement();
         xctxt.setSAXLocator(savedLocator);
  +
         // Pop all the variables in this element frame.
         varstack.popElemFrame();
       }
  -    
  +
       // Check for infinite loops if we have to
       if (check)
         getStackGuard().pop();
     }
  -      
  +
     /**
      * <meta name="usage" content="advanced"/>
      * Get the keys for the xsl:sort elements.
  +   * Note: Should this go into ElemForEach?
  +   *
  +   * @param foreach Valid ElemForEach element, not null.
  +   * @param sourceNodeContext The current node context in the source tree, 
  +   * needed to evaluate the Attribute Value Templates.
  +   *
  +   * @return A Vector of NodeSortKeys, or null.
  +   *
  +   * @throws SAXException
      */
  -  private Vector processSortKeys(ElemTemplateElement xslInstruction,
  -                                 Node sourceNodeContext)
  +  public Vector processSortKeys(
  +                                ElemForEach foreach, Node sourceNodeContext)
       throws SAXException
     {
  +
       Vector keys = null;
  -    int tok = xslInstruction.getXSLToken();
  -    if((Constants.ELEMNAME_APPLY_TEMPLATES == tok) ||
  -       (Constants.ELEMNAME_FOREACH == tok))
  -    {
  -      XPathContext xctxt = getXPathContext();
  -      ElemForEach foreach = (ElemForEach)xslInstruction;
  -      int nElems = foreach.getSortElemCount();
  -      
  -      if(nElems > 0)
  -        keys = new Vector();
  -      
  -      // March backwards, collecting the sort keys.
  -      for(int i = 0; i < nElems; i++)
  -      {
  -        ElemSort sort = foreach.getSortElem(i);
  -        String langString = (null != sort.getLang())
  -                            ? sort.getLang().evaluate(xctxt, 
  -                                                      sourceNodeContext, 
  -                                                      xslInstruction)
  -                              : null;
  -        String dataTypeString 
  -          = sort.getDataType().evaluate(xctxt, 
  -                                        sourceNodeContext, 
  -                                        xslInstruction);
  -        if (dataTypeString.indexOf(":") >= 0 )
  -          System.out.println("TODO: Need to write the hooks for QNAME sort data type");        
  -        else if (!(dataTypeString.equalsIgnoreCase(Constants.ATTRVAL_DATATYPE_TEXT)) && 
  -			      !(dataTypeString.equalsIgnoreCase(Constants.ATTRVAL_DATATYPE_NUMBER)) )
  -			      xslInstruction.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {Constants.ATTRNAME_DATATYPE, dataTypeString});   
  -			
  -        boolean treatAsNumbers 
  -          = ((null != dataTypeString)&& 
  -             dataTypeString.equals(Constants.ATTRVAL_DATATYPE_NUMBER)) ? 
  -            true : false;
  -        String orderString 
  -          = sort.getOrder().evaluate(xctxt, sourceNodeContext, 
  -                                     xslInstruction);
  -        if (!(orderString.equalsIgnoreCase(Constants.ATTRVAL_ORDER_ASCENDING)) && 
  -			      !(orderString.equalsIgnoreCase(Constants.ATTRVAL_ORDER_DESCENDING)))
  -			      xslInstruction.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {Constants.ATTRNAME_ORDER, orderString});   
  -			
  -        boolean descending = ((null != orderString) &&  
  -                              orderString.equals(Constants.ATTRVAL_ORDER_DESCENDING))? 
  -                             true : false;
  -
  -        AVT caseOrder = sort.getCaseOrder();
  -        boolean caseOrderUpper;
  -        if(null != caseOrder)
  -        {
  -          String caseOrderString 
  -            = caseOrder.evaluate(xctxt, 
  -                                 sourceNodeContext, 
  -                                 xslInstruction);
  -          if (!(caseOrderString.equalsIgnoreCase(Constants.ATTRVAL_CASEORDER_UPPER)) && 
  -			      !(caseOrderString.equalsIgnoreCase(Constants.ATTRVAL_CASEORDER_LOWER)))
  -			      xslInstruction.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE, new Object[] {Constants.ATTRNAME_CASEORDER, caseOrderString});   
  -			
  -          caseOrderUpper = ((null != caseOrderString)&& 
  -                            caseOrderString.equals(Constants.ATTRVAL_CASEORDER_UPPER)) ? 
  -                           true : false;
  -        }
  -        else
  -        {
  -          caseOrderUpper = false;
  -        }
  +    XPathContext xctxt = getXPathContext();
  +    int nElems = foreach.getSortElemCount();
  +
  +    if (nElems > 0)
  +      keys = new Vector();
   
  -        keys.addElement(new NodeSortKey(this, sort.getSelect(), 
  -                                        treatAsNumbers, 
  -                                        descending, langString, 
  -                                        caseOrderUpper,xslInstruction));
  +    // March backwards, collecting the sort keys.
  +    for (int i = 0; i < nElems; i++)
  +    {
  +      ElemSort sort = foreach.getSortElem(i);
  +      String langString =
  +                         (null != sort.getLang())
  +                         ? sort.getLang().evaluate(xctxt, sourceNodeContext, foreach)
  +                           : null;
  +      String dataTypeString = sort.getDataType().evaluate(xctxt,
  +                                                          sourceNodeContext, foreach);
  +
  +      if (dataTypeString.indexOf(":") >= 0)
  +        System.out.println(
  +                           "TODO: Need to write the hooks for QNAME sort data type");
  +      else if (!(dataTypeString.equalsIgnoreCase(Constants.ATTRVAL_DATATYPE_TEXT))
  +               &&!(dataTypeString.equalsIgnoreCase(
  +                                                   Constants.ATTRVAL_DATATYPE_NUMBER)))
  +        foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE,
  +                             new Object[]{ Constants.ATTRNAME_DATATYPE,
  +                             dataTypeString });
  +
  +      boolean treatAsNumbers =
  +                              ((null != dataTypeString) && dataTypeString.equals(
  +                                                                                 Constants.ATTRVAL_DATATYPE_NUMBER)) ? true : false;
  +      String orderString = sort.getOrder().evaluate(xctxt,
  +                                                    sourceNodeContext, foreach);
  +
  +      if (!(orderString.equalsIgnoreCase(Constants.ATTRVAL_ORDER_ASCENDING))
  +          &&!(orderString.equalsIgnoreCase(
  +                                           Constants.ATTRVAL_ORDER_DESCENDING)))
  +        foreach.error(XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE,
  +                             new Object[]{ Constants.ATTRNAME_ORDER,
  +                             orderString });
  +
  +      boolean descending =
  +                          ((null != orderString) && orderString.equals(
  +                                                                       Constants.ATTRVAL_ORDER_DESCENDING)) ? true : false;
  +      AVT caseOrder = sort.getCaseOrder();
  +      boolean caseOrderUpper;
  +
  +      if (null != caseOrder)
  +      {
  +        String caseOrderString = caseOrder.evaluate(xctxt,
  +                                                    sourceNodeContext,
  +                                                    foreach);
  +
  +        if (!(caseOrderString.equalsIgnoreCase(Constants.ATTRVAL_CASEORDER_UPPER))
  +            &&!(caseOrderString.equalsIgnoreCase(
  +                                                 Constants.ATTRVAL_CASEORDER_LOWER)))
  +          foreach.error(
  +                               XSLTErrorResources.ER_ILLEGAL_ATTRIBUTE_VALUE,
  +                               new Object[]{ Constants.ATTRNAME_CASEORDER,
  +                               caseOrderString });
  +
  +        caseOrderUpper =
  +                        ((null != caseOrderString) && caseOrderString.equals(
  +                                                                             Constants.ATTRVAL_CASEORDER_UPPER)) ? true : false;
  +      }
  +      else
  +      {
  +        caseOrderUpper = false;
         }
  +
  +      keys.addElement(new NodeSortKey(this, sort.getSelect(),
  +                                      treatAsNumbers, descending,
  +                                      langString, caseOrderUpper,
  +                                      foreach));
       }
  +
       return keys;
     }
  -  
  +
     //==========================================================
     // SECTION: TransformState implementation
     //==========================================================
  -  
  -  private NodeVector m_currentTemplateElements = new NodeVector(64);
  -  
  +
     /**
      * Push the current template element.
  +   *
  +   * @param elem The current ElemTemplateElement (may be null, and then
  +   * set via setCurrentElement).
      */
  -  public void pushElemTemplateElement(ElemTemplateElement elem, Node currentNode)
  +  public void pushElemTemplateElement(ElemTemplateElement elem)
     {
  -    m_currentTemplateElements.pushPair(elem, currentNode);
  +    m_currentTemplateElements.push(elem);
     }
  -  
  +
     /**
      * Pop the current template element.
      */
     public void popElemTemplateElement()
     {
  -    m_currentTemplateElements.popPair();
  +    m_currentTemplateElements.pop();
     }
  -  
  +
  +  /**
  +   * Set the top of the current template elements 
  +   * stack.
  +   *
  +   * @param e The current ElemTemplateElement about to 
  +   * be executed.
  +   */
  +  public void setCurrentElement(ElemTemplateElement e)
  +  {
  +    m_currentTemplateElements.setTail(e);
  +  }
  +
     /**
  -   * Retrieves the stylesheet element that produced 
  -   * the SAX event.
  +   * Retrieves the current ElemTemplateElement that is 
  +   * being executed.
  +   *
  +   * @return The current ElemTemplateElement that is executing, 
  +   * should not normally be null.
      */
     public ElemTemplateElement getCurrentElement()
     {
  -    return (ElemTemplateElement)m_currentTemplateElements.peepTailSub1();
  +    return (ElemTemplateElement) m_currentTemplateElements.peepTail();
     }
   
     /**
  -   * This method retrieves the current context node 
  +   * This method retrieves the current context node
      * in the source tree.
  +   *
  +   * @return The current context node (should never be null?).
      */
     public Node getCurrentNode()
     {
  -    return m_currentTemplateElements.peepTail();
  +    return m_xcontext.getCurrentNode();
     }
  -  
  +
     /**
  -   * This method retrieves the xsl:template 
  -   * that is in effect, which may be a matched template 
  +   * This method retrieves the xsl:template
  +   * that is in effect, which may be a matched template
      * or a named template.
  -   * 
  -   * <p>Please note that the ElemTemplate returned may 
  -   * be a default template, and thus may not have a template 
  +   *
  +   * <p>Please note that the ElemTemplate returned may
  +   * be a default template, and thus may not have a template
      * defined in the stylesheet.</p>
  +   *
  +   * @return The current xsl:template, should not be null.
      */
     public ElemTemplate getCurrentTemplate()
     {
       ElemTemplateElement elem = getCurrentElement();
  -    while((null != elem) && (elem.getXSLToken() != Constants.ELEMNAME_TEMPLATE))
  +
  +    while ((null != elem)
  +           && (elem.getXSLToken() != Constants.ELEMNAME_TEMPLATE))
  +    {
         elem = elem.getParentElem();
  -    return (ElemTemplate)elem;
  +    }
  +
  +    return (ElemTemplate) elem;
     }
   
  -  private NodeVector m_currentMatchTemplates = new NodeVector();
  +  /**
  +   * Push both the current xsl:template or xsl:for-each onto the 
  +   * stack, along with the child node that was matched.
  +   * (Note: should this only be used for xsl:templates?? -sb)
  +   *
  +   * @param template xsl:template or xsl:for-each.
  +   * @param child The child that was matched.
  +   */
  +  public void pushPairCurrentMatched(ElemTemplateElement template, Node child)
  +  {
  +    m_currentMatchTemplates.pushPair(template, child);
  +  }
   
     /**
  -   * This method retrieves the xsl:template 
  -   * that was matched.  Note that this may not be 
  -   * the same thing as the current template (which 
  -   * may be from getCurrentElement()), since a named 
  +   * Pop the elements that were pushed via pushPairCurrentMatched.
  +   */
  +  public void popCurrentMatched()
  +  {
  +    m_currentMatchTemplates.popPair();
  +  }
  +
  +  /**
  +   * This method retrieves the xsl:template
  +   * that was matched.  Note that this may not be
  +   * the same thing as the current template (which
  +   * may be from getCurrentElement()), since a named
      * template may be in effect.
  +   *
  +   * @return The pushed template that was pushed via pushPairCurrentMatched.
      */
     public ElemTemplate getMatchedTemplate()
     {
  -    return (ElemTemplate)m_currentMatchTemplates.peepTailSub1();
  +    return (ElemTemplate) m_currentMatchTemplates.peepTailSub1();
     }
   
     /**
  -   * Retrieves the node in the source tree that matched 
  +   * Retrieves the node in the source tree that matched
      * the template obtained via getMatchedTemplate().
  +   *
  +   * @return The matched node that corresponds to the 
  +   * match attribute of the current xsl:template.
      */
     public Node getMatchedNode()
     {
       return m_currentMatchTemplates.peepTail();
     }
  -  
  +
     /**
      * Get the current context node list.
  +   *
  +   * @return A reset clone of the context node list.
      */
     public NodeIterator getContextNodeList()
     {
  +
       try
       {
         return getXPathContext().getContextNodeList().cloneWithReset();
       }
  -    catch(CloneNotSupportedException cnse)
  +    catch (CloneNotSupportedException cnse)
       {
  +
         // should never happen.
         return null;
       }
     }
  -  
  +
     /**
      * Get the TrAX Transformer object in effect.
  +   *
  +   * @return This object.
      */
     public Transformer getTransformer()
     {
       return this;
     }
  -  
  -  
  +
     //==========================================================
  -  // SECTION: Member variables
  +  // SECTION: Accessor Functions
     //==========================================================
  -  
  -  /**
  -   * The root of a linked set of stylesheets.
  -   */
  -  private StylesheetRoot m_stylesheetRoot = null;
  -  
  +
     /**
      * Set the stylesheet for this processor.  If this is set, then the
      * process calls that take only the input .xml will use
      * this instead of looking for a stylesheet PI.  Also,
      * setting the stylesheet is needed if you are going
      * to use the processor as a SAX ContentHandler.
  +   *
  +   * @param stylesheetRoot A non-null StylesheetRoot object,
  +   * or null if you wish to clear the stylesheet reference.
      */
     public void setStylesheet(StylesheetRoot stylesheetRoot)
     {
       m_stylesheetRoot = stylesheetRoot;
  -    m_defaultTextRule = stylesheetRoot.getDefaultTextRule();
     }
   
     /**
      * Get the current stylesheet for this processor.
  +   *
  +   * @return The stylesheet that is associated with this 
  +   * transformer.
      */
     public StylesheetRoot getStylesheet()
     {
       return m_stylesheetRoot;
     }
  -  
  -  /**
  -   * Used for default selection.
  -   */
  -  private XPath m_selectDefault;
   
  -  /**
  -   * If this is set to true, do not warn about pattern
  -   * match conflicts.
  -   */
  -  private boolean m_quietConflictWarnings = true;
  -  
     /**
  -   * Get quietConflictWarnings property.
  +   * Get quietConflictWarnings property. If the quietConflictWarnings 
  +   * property is set to true, warnings about pattern conflicts won't be
  +   * printed to the diagnostics stream.
  +   *
  +   * @return True if this transformer should not report 
  +   * template match conflicts.
      */
     public boolean getQuietConflictWarnings()
     {
  @@ -1738,7 +1929,9 @@
      * If the quietConflictWarnings property is set to
      * true, warnings about pattern conflicts won't be
      * printed to the diagnostics stream.
  -   * True by default.
  +   * False by default.
  +   * (Currently setting this property will have no effect.)
  +   * 
      * @param b true if conflict warnings should be suppressed.
      */
     public void setQuietConflictWarnings(boolean b)
  @@ -1746,15 +1939,12 @@
       m_quietConflictWarnings = b;
     }
   
  -  /**
  -   * The liason to the XML parser, so the XSL processor
  -   * can handle included files, and the like, and do the
  -   * initial parse of the XSL document.
  -   */
  -  private XPathContext m_xcontext;
  -  
     /**
  +   * <meta name="usage" content="internal"/>
      * Set the execution context for XPath.
  +   *
  +   * @param xcontext A non-null reference to the XPathContext 
  +   * associated with this transformer.
      */
     public void setXPathContext(XPathContext xcontext)
     {
  @@ -1762,7 +1952,9 @@
     }
   
     /**
  -   * Get the XML Parser Liaison that this processor uses.
  +   * Get the XPath context associated with this transformer.
  +   *
  +   * @return The XPathContext reference, never null.
      */
     public XPathContext getXPathContext()
     {
  @@ -1770,69 +1962,68 @@
     }
   
     /**
  -   * Object to guard agains infinite recursion when
  -   * doing queries.
  -   */
  -  private StackGuard m_stackGuard = new StackGuard();
  -  
  -  /**
      * <meta name="usage" content="internal"/>
  -   * Get the object used to guard the stack from 
  +   * Get the object used to guard the stack from
      * recursion.
  +   *
  +   * @return The StackGuard object, which should never be null.
      */
     public StackGuard getStackGuard()
  -  {  
  +  {
       return m_stackGuard;
  -  }  
  -  
  +  }
  +
     /**
      * Get the recursion limit.
      * Used for infinite loop check. If the value is -1, do not
  -   * check for infinite loops. Anyone who wants to enable that 
  +   * check for infinite loops. Anyone who wants to enable that
      * check should change the value of this variable to be the
  -   * level of recursion that they want to check. Be careful setting 
  -   * this variable, if the number is too low, it may report an 
  +   * level of recursion that they want to check. Be careful setting
  +   * this variable, if the number is too low, it may report an
      * infinite loop situation, when there is none.
  -   * Post version 1.0.0, we'll make this a runtime feature.   
  +   * Post version 1.0.0, we'll make this a runtime feature.
  +   *
  +   * @return The limit on recursion, or -1 if no check is to be made.
      */
     public int getRecursionLimit()
     {
       return m_stackGuard.getRecursionLimit();
     }
  -  
  +
     /**
      * Get the recursion limit.
      * Used for infinite loop check. If the value is -1, do not
  -   * check for infinite loops. Anyone who wants to enable that 
  +   * check for infinite loops. Anyone who wants to enable that
      * check should change the value of this variable to be the
  -   * level of recursion that they want to check. Be careful setting 
  -   * this variable, if the number is too low, it may report an 
  +   * level of recursion that they want to check. Be careful setting
  +   * this variable, if the number is too low, it may report an
      * infinite loop situation, when there is none.
  -   * Post version 1.0.0, we'll make this a runtime feature.   
  +   * Post version 1.0.0, we'll make this a runtime feature.
  +   *
  +   * @param limit A number that represents the limit of recursion, 
  +   * or -1 if no checking is to be done.
      */
     public void setRecursionLimit(int limit)
     {
       m_stackGuard.setRecursionLimit(limit);
     }
   
  -
  -  /**
  -   * Output handler to bottleneck SAX events.
  -   */
  -  private ResultTreeHandler m_resultTreeHandler;
  -  
     /**
      * Get the ResultTreeHandler object.
  +   *
  +   * @return The current ResultTreeHandler, which may not 
  +   * be the main result tree manager.
      */
     public ResultTreeHandler getResultTreeHandler()
     {
       return m_resultTreeHandler;
     }
  -  
  -  private KeyManager m_keyManager = new KeyManager();
  -  
  +
     /**
      * Get the KeyManager object.
  +   *
  +   * @return A reference to the KeyManager object, which should
  +   * never be null.
      */
     public KeyManager getKeyManager()
     {
  @@ -1840,40 +2031,44 @@
     }
   
     /**
  -   * Stack for the purposes of flagging infinite recursion with
  -   * attribute sets.
  -   */
  -  private Stack m_attrSetStack = null;
  -  
  -  /**
      * Check to see if this is a recursive attribute definition.
  +   *
  +   * @param attrSet A non-null ElemAttributeSet reference.
  +   *
  +   * @return true if the attribute set is recursive.
      */
     public boolean isRecursiveAttrSet(ElemAttributeSet attrSet)
     {
  -    if(null == m_attrSetStack)
  +
  +    if (null == m_attrSetStack)
       {
         m_attrSetStack = new Stack();
       }
  -    if(!m_attrSetStack.empty())
  +
  +    if (!m_attrSetStack.empty())
       {
  -      int loc = m_attrSetStack.search(this);
  -      if(loc > -1)
  +      int loc = m_attrSetStack.search(attrSet);
  +
  +      if (loc > -1)
         {
           return true;
         }
       }
  +
       return false;
     }
  -  
  +
     /**
  -   * Push an executing attribute set, so we can check for 
  +   * Push an executing attribute set, so we can check for
      * recursive attribute definitions.
  +   *
  +   * @param attrSet A non-null ElemAttributeSet reference.
      */
     public void pushElemAttributeSet(ElemAttributeSet attrSet)
     {
       m_attrSetStack.push(attrSet);
     }
  -  
  +
     /**
      * Pop the current executing attribute set.
      */
  @@ -1881,93 +2076,85 @@
     {
       m_attrSetStack.pop();
     }
  -  
   
     /**
  -   * The table of counters for xsl:number support.
  -   * @see ElemNumber
  -   */
  -  private CountersTable m_countersTable = null;
  -  
  -  /**
      * Get the table of counters, for optimized xsl:number support.
  +   *
  +   * @return The CountersTable, never null.
      */
     public CountersTable getCountersTable()
     {
  -    if(null == m_countersTable)
  +
  +    if (null == m_countersTable)
         m_countersTable = new CountersTable();
  +
       return m_countersTable;
     }
   
  -  /**
  -   * Is > 0 when we're processing a for-each.
  -   */
  -  private BoolStack m_currentTemplateRuleIsNull = new BoolStack();
  -  
     /**
  -   * Tell if the current template rule is null.
  +   * Tell if the current template rule is null, i.e. if we are 
  +   * directly within an apply-templates.  Used for xsl:apply-imports.
  +   *
  +   * @return True if the current template rule is null.
      */
     public boolean currentTemplateRuleIsNull()
     {
  -    return ((!m_currentTemplateRuleIsNull.isEmpty()) 
  +    return ((!m_currentTemplateRuleIsNull.isEmpty())
               && (m_currentTemplateRuleIsNull.peek() == true));
     }
  -  
  +
     /**
  -   * Push true if the current template rule is null, false 
  +   * Push true if the current template rule is null, false
      * otherwise.
  +   *
  +   * @param b True if the we are executing an xsl:for-each 
  +   * (or xsl:call-template?).
      */
     public void pushCurrentTemplateRuleIsNull(boolean b)
     {
       m_currentTemplateRuleIsNull.push(b);
     }
  -  
  +
     /**
  -   * Push true if the current template rule is null, false 
  +   * Push true if the current template rule is null, false
      * otherwise.
      */
     public void popCurrentTemplateRuleIsNull()
     {
       m_currentTemplateRuleIsNull.pop();
     }
  -  
  -  private MsgMgr m_msgMgr;
  -  
  +
     /**
      * Return the message manager.
  +   *
  +   * @return The message manager, never null.
      */
     public MsgMgr getMsgMgr()
     {
  -    if(null == m_msgMgr)
  +
  +    if (null == m_msgMgr)
         m_msgMgr = new MsgMgr(this);
  +
       return m_msgMgr;
     }
  -  
  -  /**
  -   * This is a compile-time flag to turn off calling 
  -   * of trace listeners. Set this to false for optimization purposes.
  -   */
  -  public static boolean S_DEBUG = false;
  -  
  -  /**
  -   * The trace manager.
  -   */
  -  private TraceManager m_traceManager = new TraceManager(this);
  -  
  +
     /**
  -   * Get an instance of the trace manager for this transformation. 
  -   * This object can be used to set trace listeners on various 
  +   * Get an instance of the trace manager for this transformation.
  +   * This object can be used to set trace listeners on various
      * events during the transformation.
  +   *
  +   * @return A reference to the TraceManager, never null.
      */
     public TraceManager getTraceManager()
     {
       return m_traceManager;
  -  }      
  -  
  -  /** Set the parent reader.
  +  }
  +
  +  /**
  +   * Set the parent reader.
      *
  -   * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which 
  -   * this filter will obtain its events and to which it will pass its 
  +   * <p>This is the {@link org.xml.sax.XMLReader XMLReader} from which
  +   * this filter will obtain its events and to which it will pass its
      * configuration requests.  The parent may itself be another filter.</p>
      *
      * <p>If there is no parent reader set, any attempt to parse
  @@ -1976,40 +2163,44 @@
      * @param parent The parent XML reader.
      * @exception java.lang.NullPointerException If the parent is null.
      */
  -  public void setParent (XMLReader parent)
  -  { 
  +  public void setParent(XMLReader parent)
  +  {
  +
       super.setParent(parent);
  +
       // the setting of the parent's content handler directly works 
       // because parse (InputSource input) is overridden, and 
       // setupParse(); in XMLFilterImpl is never called.
       parent.setContentHandler(getInputContentHandler());
     }
  -  
  -    /**
  -     * Allow an application to register a content event handler.
  -     *
  -     * <p>If the application does not register a content handler, all
  -     * content events reported by the SAX parser will be silently
  -     * ignored.</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 handler The content handler.
  -     * @exception java.lang.NullPointerException If the handler 
  -     *            argument is null.
  -     * @see #getContentHandler
  -     */
  -    public void setContentHandler (ContentHandler handler)
  -    {
  -      super.setContentHandler(handler);
  -      if(null == m_resultTreeHandler)
  -        m_resultTreeHandler = new ResultTreeHandler(this, handler);
  -      else 
  -        m_resultTreeHandler.setContentHandler(handler);
  -    }
  -  
  +
  +  /**
  +   * Allow an application to register a content event handler.
  +   *
  +   * <p>If the application does not register a content handler, all
  +   * content events reported by the SAX parser will be silently
  +   * ignored.</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 handler The content handler.
  +   * @exception java.lang.NullPointerException If the handler
  +   *            argument is null.
  +   * @see #getContentHandler
  +   */
  +  public void setContentHandler(ContentHandler handler)
  +  {
  +
  +    super.setContentHandler(handler);
  +
  +    if (null == m_resultTreeHandler)
  +      m_resultTreeHandler = new ResultTreeHandler(this, handler);
  +    else
  +      m_resultTreeHandler.setContentHandler(handler);
  +  }
  +
     /**
      * Look up the value of a feature.
      *
  @@ -2019,14 +2210,14 @@
      * in the case of an adapter for a SAX1 Parser, which has
      * no way of knowing whether the underlying parser is
      * validating, for example.</p>
  -   * 
  +   *
      * <h3>Open issues:</h3>
      * <dl>
      *    <dt><h4>Should getFeature be changed to hasFeature?</h4></dt>
  -   *    <dd>Keith Visco writes: Should getFeature be changed to hasFeature? 
  -   *        It returns a boolean which indicated whether the "state" 
  -   *        of feature is "true or false". I assume this means whether 
  -   *        or not a feature is supported? I know SAX is using "getFeature", 
  +   *    <dd>Keith Visco writes: Should getFeature be changed to hasFeature?
  +   *        It returns a boolean which indicated whether the "state"
  +   *        of feature is "true or false". I assume this means whether
  +   *        or not a feature is supported? I know SAX is using "getFeature",
      *        but to me "hasFeature" is cleaner.</dd>
      * </dl>
      *
  @@ -2036,99 +2227,129 @@
      * @exception org.xml.sax.SAXNotRecognizedException When the
      *            Processor does not recognize the feature name.
      * @exception org.xml.sax.SAXNotSupportedException When the
  -   *            Processor recognizes the feature name but 
  +   *            Processor recognizes the feature name but
      *            cannot determine its value at this time.
  +   *
  +   * @throws SAXNotRecognizedException
  +   * @throws SAXNotSupportedException
      */
  -  public boolean getFeature (String name)
  -    throws SAXNotRecognizedException, SAXNotSupportedException
  +  public boolean getFeature(String name)
  +          throws SAXNotRecognizedException, SAXNotSupportedException
     {
  -    if("http://xml.org/trax/features/sax/input".equals(name))
  +
  +    if ("http://xml.org/trax/features/sax/input".equals(name))
         return true;
  -    else if("http://xml.org/trax/features/dom/input".equals(name))
  +    else if ("http://xml.org/trax/features/dom/input".equals(name))
         return true;
  +
       throw new SAXNotRecognizedException(name);
     }
   
     ////////////////////////
     // Implement Runnable //  
     ////////////////////////
  -  
  -  private Exception m_exceptionThrown = null;
  -  
  +
  +  /**
  +   * Get the exception thrown by the secondary thread (normally 
  +   * the transform thread).
  +   *
  +   * @return The thrown exception, or null if no exception was 
  +   * thrown.
  +   */
     public Exception getExceptionThrown()
     {
       return m_exceptionThrown;
     }
  -  
  -  private InputSource m_xmlSource;
  -  private Node m_doc;
  -  
  +
     /**
      * This is just a way to set the document for run().
  +   *
  +   * @param doc A non-null reference to the root of the 
  +   * tree to be transformed.
      */
     public void setSourceTreeDocForThread(Node doc)
     {
       m_doc = doc;
     }
  -  
  +
     /**
  -   * If the the transform is on the secondary thread, we 
  -   * need to know when it is done, so we can return.
  +   * Tell if the transform method is completed.
  +   *
  +   * @return True if transformNode has completed, or 
  +   * an exception was thrown.
      */
  -  boolean m_isTransformDone = false;
  -
     public boolean isTransformDone()
     {
       return m_isTransformDone;
     }
  -  
  +
     /**
  -   * From a secondary thread, post the exception, so that 
  +   * From a secondary thread, post the exception, so that
      * it can be picked up from the main thread.
  +   *
  +   * @param e The exception that was thrown.
      */
     private void postExceptionFromThread(Exception e)
     {
  +
  +    if (m_inputContentHandler instanceof SourceTreeHandler)
  +    {
  +      SourceTreeHandler sth = (SourceTreeHandler) m_inputContentHandler;
  +
  +      sth.setExceptionThrown(e);
  +    }
  +
       m_isTransformDone = true;
       m_exceptionThrown = e;
  -    ; // should have already been reported via the error handler?
  +    ;  // should have already been reported via the error handler?
  +
       synchronized (this)
       {
         String msg = e.getMessage();
  +
         // System.out.println(e.getMessage());
         notifyAll();
  -      if(null == msg)
  +
  +      if (null == msg)
         {
  +
           // m_throwNewError = false;
           e.printStackTrace();
         }
  +
         // throw new org.apache.xalan.utils.WrappedRuntimeException(e);
       }
     }
  -  
  +
     /**
      * Run the transform thread.
      */
     public void run()
     {
  +
       try
       {
  +
         // Node n = ((SourceTreeHandler)getInputContentHandler()).getRoot();
         // transformNode(n);
  -      if(isParserEventsOnMain())
  +      if (isParserEventsOnMain())
         {
           try
           {
             m_isTransformDone = false;
  +
             transformNode(m_doc);
           }
  -        catch(Exception e)
  +        catch (Exception e)
           {
  +
             // Strange that the other catch won't catch this...
             postExceptionFromThread(e);
           }
           finally
           {
             m_isTransformDone = true;
  +
             synchronized (this)
             {
               notifyAll();
  @@ -2140,10 +2361,10 @@
           getXPathContext().getPrimaryReader().parse(m_xmlSource);
         }
       }
  -    catch(Exception e)
  +    catch (Exception e)
       {
         postExceptionFromThread(e);
       }
     }
  +}  // end TransformerImpl class
   
  -} // end TransformerImpl class
  
  
  
  1.4       +63 -34    xml-xalan/java/src/org/apache/xalan/transformer/TreeWalker2Result.java
  
  Index: TreeWalker2Result.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/TreeWalker2Result.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- TreeWalker2Result.java	2000/10/13 23:39:17	1.3
  +++ TreeWalker2Result.java	2000/10/30 18:57:03	1.4
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,6 +57,7 @@
   package org.apache.xalan.transformer;
   
   import org.w3c.dom.*;
  +
   import org.xml.sax.*;
   
   import org.apache.xalan.utils.TreeWalker;
  @@ -66,79 +67,107 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * Handle a walk of a tree, but screen out attributes for 
  + * Handle a walk of a tree, but screen out attributes for
    * the result tree.
    */
   public class TreeWalker2Result extends TreeWalker
   {
  +
  +  /** NEEDSDOC Field m_transformer          */
     TransformerImpl m_transformer;
  +
  +  /** NEEDSDOC Field m_handler          */
     ResultTreeHandler m_handler;
  +
  +  /** NEEDSDOC Field m_startNode          */
     Node m_startNode;
  -  
  +
     /**
      * Constructor.
  +   *
  +   * NEEDSDOC @param transformer
  +   * NEEDSDOC @param handler
      */
  -  public TreeWalker2Result(TransformerImpl transformer, 
  -                           ResultTreeHandler handler) 
  +  public TreeWalker2Result(TransformerImpl transformer,
  +                           ResultTreeHandler handler)
     {
  +
       super(handler);
  +
       m_transformer = transformer;
       m_handler = handler;
     }
  -  
  -    
  +
     /**
      * Perform a pre-order traversal non-recursive style.
  +   *
  +   * NEEDSDOC @param pos
  +   *
  +   * @throws SAXException
      */
  -  public void traverse(Node pos) throws SAXException 
  +  public void traverse(Node pos) throws SAXException
     {
  +
       m_startNode = pos;
  +
       super.traverse(pos);
     }
  -  
  -  protected void startNode(Node node)
  -    throws SAXException 
  +
  +  /**
  +   * NEEDSDOC Method startNode 
  +   *
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * @throws SAXException
  +   */
  +  protected void startNode(Node node) throws SAXException
     {
  -    if((Node.ELEMENT_NODE == node.getNodeType()) && (m_startNode == node))
  +
  +    if ((Node.ELEMENT_NODE == node.getNodeType()) && (m_startNode == node))
       {
         DOMHelper dhelper = m_transformer.getXPathContext().getDOMHelper();
         String elemName = node.getNodeName();
         String localName = dhelper.getLocalNameOfNode(node);
         String namespace = dhelper.getNamespaceOfNode(node);
  -      m_handler.startElement (namespace, localName, elemName);
  -        
  -      for(Node parent = node; parent != null; parent = parent.getParentNode())
  +
  +      m_handler.startElement(namespace, localName, elemName);
  +
  +      for (Node parent = node; parent != null;
  +              parent = parent.getParentNode())
         {
  -        if(Node.ELEMENT_NODE != parent.getNodeType())
  +        if (Node.ELEMENT_NODE != parent.getNodeType())
             continue;
  -      
  -        NamedNodeMap atts = ((Element)parent).getAttributes();
   
  +        NamedNodeMap atts = ((Element) parent).getAttributes();
           int n = atts.getLength();
  -        for(int i = 0; i < n; i++)
  +
  +        for (int i = 0; i < n; i++)
           {
             String nsDeclPrefix = null;
  -          Attr attr = (Attr)atts.item(i);
  +          Attr attr = (Attr) atts.item(i);
             String name = attr.getName();
             String value = attr.getValue();
  -          
  +
             if (name.startsWith("xmlns:"))
             {
  +
               // get the namespace prefix 
               nsDeclPrefix = name.substring(name.indexOf(":") + 1);
             }
  -          else if(name.equals("xmlns"))
  +          else if (name.equals("xmlns"))
             {
  -            nsDeclPrefix="";
  +            nsDeclPrefix = "";
             }
  -          
  -          if((nsDeclPrefix == null) && (node != parent))
  +
  +          if ((nsDeclPrefix == null) && (node != parent))
               continue;
  +
             /*
             else if(nsDeclPrefix != null)
             {
               String desturi = m_processor.getURI(nsDeclPrefix);
  -            // Look for an alias for this URI. If one is found, use it as the result URI   
  +            // Look for an alias for this URI. If one is found, use it as the result URI
               String aliasURI = m_elem.m_stylesheet.lookForAlias(value);
               if(aliasURI.equals(desturi)) // TODO: Check for extension namespaces
               {
  @@ -147,20 +176,22 @@
             }
             */
             m_handler.addAttribute(dhelper.getNamespaceOfNode(attr),
  -                                 dhelper.getLocalNameOfNode(attr),
  -                                 name, "CDATA", value);
  +                                 dhelper.getLocalNameOfNode(attr), name,
  +                                 "CDATA", value);
  +
             // Make sure namespace is not in the excluded list then
             // add to result tree
  +
             /*
             if(!m_handler.getPendingAttributes().contains(name))
             {
               if(nsDeclPrefix == null)
  -            {  
  +            {
                 m_handler.addAttribute(name, "CDATA", value);
               }
               else
               {
  -              String desturi 
  +              String desturi
                   = m_handler.getURI(nsDeclPrefix);
                 if(null == desturi)
                 {
  @@ -174,15 +205,13 @@
             }
             */
           }
  -
         }
  +
         // m_handler.processResultNS(m_elem);           
  -      
       }
       else
       {
         super.startNode(node);
       }
     }
  -
   }
  
  
  
  1.2       +17 -2     xml-xalan/java/src/org/apache/xalan/transformer/XSLInfiniteLoopException.java
  
  Index: XSLInfiniteLoopException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/transformer/XSLInfiniteLoopException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XSLInfiniteLoopException.java	2000/06/19 16:53:07	1.1
  +++ XSLInfiniteLoopException.java	2000/10/30 18:57:03	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -56,13 +56,28 @@
    */
   package org.apache.xalan.transformer;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XSLInfiniteLoopException <needs-comment/>
  + */
   class XSLInfiniteLoopException
   {
  +
  +  /**
  +   * Constructor XSLInfiniteLoopException
  +   *
  +   */
     XSLInfiniteLoopException()
     {
       super();
     }
   
  +  /**
  +   * NEEDSDOC Method getMessage 
  +   *
  +   *
  +   * NEEDSDOC (getMessage) @return
  +   */
     public String getMessage()
     {
       return "Processing Terminated.";
  
  
  
  1.4       +99 -32    xml-xalan/java/src/org/apache/xalan/utils/AttList.java
  
  Index: AttList.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/AttList.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AttList.java	2000/10/05 01:38:38	1.3
  +++ AttList.java	2000/10/30 18:57:13	1.4
  @@ -57,42 +57,71 @@
   package org.apache.xalan.utils;
   
   import org.w3c.dom.*;
  +
   import org.xml.sax.*;
  +
   import org.apache.xpath.DOMHelper;
   import org.apache.xpath.DOM2Helper;
   
  -
   /**
    * <meta name="usage" content="internal"/>
    * Wraps a DOM attribute list in a SAX Attributes.
    */
   public class AttList implements Attributes
   {
  +
  +  /** NEEDSDOC Field m_attrs          */
     NamedNodeMap m_attrs;
  +
  +  /** NEEDSDOC Field m_lastIndex          */
     int m_lastIndex;
  +
     // ARGHH!!  JAXP Uses Xerces without setting the namespace processing to ON!
     // DOM2Helper m_dh = new DOM2Helper();
  +
  +  /** NEEDSDOC Field m_dh          */
     DOMHelper m_dh;
  -  
  +
  +  /**
  +   * Constructor AttList
  +   *
  +   *
  +   * NEEDSDOC @param attrs
  +   */
     public AttList(NamedNodeMap attrs)
     {
  +
       m_attrs = attrs;
       m_lastIndex = m_attrs.getLength() - 1;
       m_dh = new DOM2Helper();
     }
  -  
  +
  +  /**
  +   * Constructor AttList
  +   *
  +   *
  +   * NEEDSDOC @param attrs
  +   * NEEDSDOC @param dh
  +   */
     public AttList(NamedNodeMap attrs, DOMHelper dh)
     {
  +
       m_attrs = attrs;
       m_lastIndex = m_attrs.getLength() - 1;
       m_dh = dh;
     }
  -  
  -  public int getLength ()
  +
  +  /**
  +   * NEEDSDOC Method getLength 
  +   *
  +   *
  +   * NEEDSDOC (getLength) @return
  +   */
  +  public int getLength()
     {
       return m_attrs.getLength();
     }
  -  
  +
     /**
      * Look up an attribute's Namespace URI by index.
      *
  @@ -101,9 +130,9 @@
      *         is available, or null if the index is out of
      *         range.
      */
  -  public String getURI (int index)
  +  public String getURI(int index)
     {
  -	  return m_dh.getNamespaceOfNode(((Attr)m_attrs.item(index)));
  +    return m_dh.getNamespaceOfNode(((Attr) m_attrs.item(index)));
     }
   
     /**
  @@ -114,31 +143,63 @@
      *         processing is not being performed, or null
      *         if the index is out of range.
      */
  -  public String getLocalName (int index)
  +  public String getLocalName(int index)
     {
  -	  return m_dh.getLocalNameOfNode(((Attr)m_attrs.item(index)));
  +    return m_dh.getLocalNameOfNode(((Attr) m_attrs.item(index)));
     }
   
  -  public String getQName (int i)
  +  /**
  +   * NEEDSDOC Method getQName 
  +   *
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC (getQName) @return
  +   */
  +  public String getQName(int i)
     {
  -    return ((Attr)m_attrs.item(i)).getName();
  +    return ((Attr) m_attrs.item(i)).getName();
     }
  -  
  -  public String getType (int i)
  +
  +  /**
  +   * NEEDSDOC Method getType 
  +   *
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC (getType) @return
  +   */
  +  public String getType(int i)
     {
       return "CDATA";  // for the moment
     }
  -  
  -  public String getValue (int i)
  +
  +  /**
  +   * NEEDSDOC Method getValue 
  +   *
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC (getValue) @return
  +   */
  +  public String getValue(int i)
     {
  -    return ((Attr)m_attrs.item(i)).getValue();
  +    return ((Attr) m_attrs.item(i)).getValue();
     }
  -  
  -  public String getType (String name)
  +
  +  /**
  +   * NEEDSDOC Method getType 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (getType) @return
  +   */
  +  public String getType(String name)
     {
       return "CDATA";  // for the moment
     }
  -  
  +
     /**
      * Look up an attribute's type by Namespace name.
      *
  @@ -149,17 +210,24 @@
      *         attribute is not in the list or if Namespace
      *         processing is not being performed.
      */
  -  public String getType (String uri, String localName)
  +  public String getType(String uri, String localName)
     {
       return "CDATA";  // for the moment
     }
   
  -  
  -  public String getValue (String name)
  +  /**
  +   * NEEDSDOC Method getValue 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (getValue) @return
  +   */
  +  public String getValue(String name)
     {
  -    return ((Attr)m_attrs.getNamedItem(name)).getValue();
  +    return ((Attr) m_attrs.getNamedItem(name)).getValue();
     }
  -  
  +
     /**
      * Look up an attribute's value by Namespace name.
      *
  @@ -169,26 +237,26 @@
      * @return The attribute value as a string, or null if the
      *         attribute is not in the list.
      */
  -  public String getValue (String uri, String localName)
  +  public String getValue(String uri, String localName)
     {
  -    return ((Attr)m_attrs.getNamedItem(localName)).getValue();
  +    return ((Attr) m_attrs.getNamedItem(localName)).getValue();
     }
  -  
  +
     /**
      * Look up the index of an attribute by Namespace name.
      *
      * @param uri The Namespace URI, or the empty string if
      *        the name has no Namespace URI.
      * @param localName The attribute's local name.
  +   * NEEDSDOC @param localPart
      * @return The index of the attribute, or -1 if it does not
      *         appear in the list.
      */
  -  public int getIndex (String uri, String localPart)
  +  public int getIndex(String uri, String localPart)
     {
       return 0;
     }
   
  -
     /**
      * Look up the index of an attribute by raw XML 1.0 name.
      *
  @@ -196,9 +264,8 @@
      * @return The index of the attribute, or -1 if it does not
      *         appear in the list.
      */
  -  public int getIndex (String rawName)
  +  public int getIndex(String rawName)
     {
       return 0;
     }
  -  
   }
  
  
  
  1.2       +143 -107  xml-xalan/java/src/org/apache/xalan/utils/BoolStack.java
  
  Index: BoolStack.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/BoolStack.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- BoolStack.java	2000/06/19 16:53:11	1.1
  +++ BoolStack.java	2000/10/30 18:57:14	1.2
  @@ -64,113 +64,149 @@
    */
   public final class BoolStack
   {
  -	private boolean m_values[];
  -	private int m_allocatedSize;
  -	private int m_index;
  -
  -	/**
  -	* Default constructor.  Note that the default 
  -	* block size is very small, for small lists.
  -	*/
  -	public BoolStack()
  -	{
  -		this(32);
  -	}
  -
  -	/**
  -	* Construct a IntVector, using the given block size.
  -	*/
  -	public BoolStack(int size)
  -	{
  -		m_allocatedSize = size;
  -		m_values = new boolean[size];
  -		m_index = -1; 
  -	}
  -
  -	/**
  -	* Get the length of the list.
  -	*/
  -	public int size()
  -	{
  -		return m_index+1;
  -	}
  -
  -	/**
  -	* Pushes an item onto the top of this stack. 
  -	*
  -	* @param   i   the int to be pushed onto this stack.
  -	* @return  the <code>item</code> argument.
  -	*/
  -	public boolean push(boolean val) 
  -	{
  -		if (m_index == m_allocatedSize-1)
  -			grow();
  -
  -		return (m_values[++m_index] = val);
  -	}
  -
  -	/**
  -	* Removes the object at the top of this stack and returns that 
  -	* object as the value of this function. 
  -	*
  -	* @return     The object at the top of this stack.
  -	* @exception  EmptyStackException  if this stack is empty.
  -	*/
  -	public boolean pop() 
  -	{
  -		try
  -		{
  -			return m_values[m_index--];
  -		}
  -		catch (ArrayIndexOutOfBoundsException  e)
  -		{
  -			throw new EmptyStackException();
  -		}
  -	}
  -
  -	/**
  -	* Looks at the object at the top of this stack without removing it 
  -	* from the stack. 
  -	*
  -	* @return     the object at the top of this stack. 
  -	* @exception  EmptyStackException  if this stack is empty.
  -	*/
  -	public boolean peek() 
  -	{
  -		try
  -		{
  -			return m_values[m_index];
  -		}
  -		catch (ArrayIndexOutOfBoundsException  e)
  -		{
  -			throw new EmptyStackException();
  -		}
  -	}
  -
  -	/**
  -	* Tests if this stack is empty.
  -	*
  -	* @return  <code>true</code> if this stack is empty;
  -	*          <code>false</code> otherwise.
  -	*/
  -	public boolean isEmpty() 
  -	{
  -		return (m_index == -1);
  -	}
  -
  -	/**
  -	* Grows the size of the stack
  -	*
  -	*/
  -
  -	private void grow()
  -	{
  -		m_allocatedSize*=2;
   
  -		boolean newVector [] = new boolean[m_allocatedSize];
  -		System.arraycopy(m_values, 0 , newVector, 0, m_index+1);
  +  /** NEEDSDOC Field m_values[]          */
  +  private boolean m_values[];
   
  -		m_values = newVector;
  -	}
  -}
  +  /** NEEDSDOC Field m_allocatedSize          */
  +  private int m_allocatedSize;
  +
  +  /** NEEDSDOC Field m_index          */
  +  private int m_index;
  +
  +  /**
  +   * Default constructor.  Note that the default
  +   * block size is very small, for small lists.
  +   */
  +  public BoolStack()
  +  {
  +    this(32);
  +  }
  +
  +  /**
  +   * Construct a IntVector, using the given block size.
  +   *
  +   * NEEDSDOC @param size
  +   */
  +  public BoolStack(int size)
  +  {
  +
  +    m_allocatedSize = size;
  +    m_values = new boolean[size];
  +    m_index = -1;
  +  }
  +
  +  /**
  +   * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public final int size()
  +  {
  +    return m_index + 1;
  +  }
  +
  +  /**
  +   * Pushes an item onto the top of this stack.
  +   *
  +   * @param   i   the int to be pushed onto this stack.
  +   *
  +   * NEEDSDOC @param val
  +   * @return  the <code>item</code> argument.
  +   */
  +  public final boolean push(boolean val)
  +  {
  +
  +    if (m_index == m_allocatedSize - 1)
  +      grow();
  +
  +    return (m_values[++m_index] = val);
  +  }
  +
  +  /**
  +   * Removes the object at the top of this stack and returns that
  +   * object as the value of this function.
  +   *
  +   * @return     The object at the top of this stack.
  +   * @exception  EmptyStackException  if this stack is empty.
  +   */
  +  public final boolean pop()
  +  {
  +    return m_values[m_index--];
  +  }
  +
  +  /**
  +   * NEEDSDOC Method popAndTop 
  +   *
  +   *
  +   * NEEDSDOC (popAndTop) @return
  +   */
  +  public final boolean popAndTop()
  +  {
  +
  +    m_index--;
  +
  +    return (m_index >= 0) ? m_values[m_index] : false;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method setTop 
  +   *
  +   *
  +   * NEEDSDOC @param b
  +   */
  +  public final void setTop(boolean b)
  +  {
  +    m_values[m_index] = b;
  +  }
  +
  +  /**
  +   * Looks at the object at the top of this stack without removing it
  +   * from the stack.
  +   *
  +   * @return     the object at the top of this stack.
  +   * @exception  EmptyStackException  if this stack is empty.
  +   */
  +  public final boolean peek()
  +  {
  +    return m_values[m_index];
  +  }
  +
  +  /**
  +   * Looks at the object at the top of this stack without removing it
  +   * from the stack.  If the stack is empty, it returns false.
  +   *
  +   * @return     the object at the top of this stack.
  +   */
  +  public final boolean peekOrFalse()
  +  {
  +    return (m_index > -1) ? m_values[m_index] : false;
  +  }
  +
  +  /**
  +   * Tests if this stack is empty.
  +   *
  +   * @return  <code>true</code> if this stack is empty;
  +   *          <code>false</code> otherwise.
  +   */
  +  public boolean isEmpty()
  +  {
  +    return (m_index == -1);
  +  }
  +
  +  /**
  +   * Grows the size of the stack
  +   *
  +   */
  +  private void grow()
  +  {
  +
  +    m_allocatedSize *= 2;
   
  +    boolean newVector[] = new boolean[m_allocatedSize];
  +
  +    System.arraycopy(m_values, 0, newVector, 0, m_index + 1);
  +
  +    m_values = newVector;
  +  }
  +}
  
  
  
  1.8       +273 -140  xml-xalan/java/src/org/apache/xalan/utils/DOMBuilder.java
  
  Index: DOMBuilder.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/DOMBuilder.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMBuilder.java	2000/10/09 23:25:20	1.7
  +++ DOMBuilder.java	2000/10/30 18:57:15	1.8
  @@ -56,35 +56,48 @@
    */
   package org.apache.xalan.utils;
   
  -import java.util.Stack;
  -
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xpath.res.XPATHErrorResources;
  +import org.apache.xalan.utils.NodeVector;
   
   import org.xml.sax.ext.LexicalHandler;
   import org.xml.sax.ContentHandler;
   import org.xml.sax.SAXException;
   import org.xml.sax.Locator;
   import org.xml.sax.Attributes;
  +
  +import org.apache.serialize.SerializerHandler;
   
  -import org.w3c.dom.*; // we pretty much use everything in the DOM here.
  +import org.w3c.dom.*;  // we pretty much use everything in the DOM here.
   
   /**
    * <meta name="usage" content="general"/>
  - * This class takes SAX events (in addition to some extra events 
  - * that SAX doesn't handle yet) and adds the result to a document 
  + * This class takes SAX events (in addition to some extra events
  + * that SAX doesn't handle yet) and adds the result to a document
    * or document fragment.
    */
  -public class DOMBuilder implements ContentHandler, LexicalHandler
  +public class DOMBuilder
  +        implements ContentHandler, LexicalHandler, SerializerHandler
   {
  -  Document m_doc;
  +
  +  /** NEEDSDOC Field m_doc          */
  +  public Document m_doc;
  +
  +  /** NEEDSDOC Field m_currentNode          */
     Node m_currentNode = null;
  +
  +  /** NEEDSDOC Field m_docFrag          */
     public DocumentFragment m_docFrag = null;
  -  Stack m_elemStack = new Stack();
  -    
  +
  +  /** NEEDSDOC Field m_elemStack          */
  +  NodeVector m_elemStack = new NodeVector();
  +
     /**
  -   * DOMBuilder instance constructor... it will add the DOM nodes 
  +   * DOMBuilder instance constructor... it will add the DOM nodes
      * to the document fragment.
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param node
      */
     public DOMBuilder(Document doc, Node node)
     {
  @@ -93,8 +106,11 @@
     }
   
     /**
  -   * DOMBuilder instance constructor... it will add the DOM nodes 
  +   * DOMBuilder instance constructor... it will add the DOM nodes
      * to the document fragment.
  +   *
  +   * NEEDSDOC @param doc
  +   * NEEDSDOC @param docFrag
      */
     public DOMBuilder(Document doc, DocumentFragment docFrag)
     {
  @@ -103,33 +119,41 @@
     }
   
     /**
  -   * DOMBuilder instance constructor... it will add the DOM nodes 
  +   * DOMBuilder instance constructor... it will add the DOM nodes
      * to the document.
  +   *
  +   * NEEDSDOC @param doc
      */
     public DOMBuilder(Document doc)
     {
       m_doc = doc;
     }
  -  
  +
     /**
  -   * Get the root node of the DOM being created.  This 
  +   * Get the root node of the DOM being created.  This
      * is either a Document or a DocumentFragment.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRootNode()
     {
  -    return (null != m_docFrag) ? (Node)m_docFrag : (Node)m_doc;
  +    return (null != m_docFrag) ? (Node) m_docFrag : (Node) m_doc;
     }
  -  
  +
     /**
  -   * Get the node currently being processed. 
  +   * Get the node currently being processed.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getCurrentNode()
     {
       return m_currentNode;
     }
  -  
  +
     /**
      * Return null since there is no Writer for this class.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public java.io.Writer getWriter()
     {
  @@ -138,44 +162,59 @@
   
     /**
      * Append a node to the current container.
  +   *
  +   * NEEDSDOC @param newNode
  +   *
  +   * @throws SAXException
      */
  -  private void append(Node newNode)
  -    throws SAXException
  +  protected void append(Node newNode) throws SAXException
     {
  -    if(null != m_currentNode)
  +
  +    Node currentNode = m_currentNode;
  +
  +    if (null != currentNode)
       {
  -      m_currentNode.appendChild(newNode);
  +      currentNode.appendChild(newNode);
  +
         // System.out.println(newNode.getNodeName());
       }
  -    else if(null != m_docFrag)
  +    else if (null != m_docFrag)
       {
         m_docFrag.appendChild(newNode);
       }
       else
       {
         boolean ok = true;
  -      int type = newNode.getNodeType();
  -      if(type == Node.TEXT_NODE)
  +      short type = newNode.getNodeType();
  +
  +      if (type == Node.TEXT_NODE)
         {
           String data = newNode.getNodeValue();
  -        if((null != data) && (data.trim().length() > 0))
  +
  +        if ((null != data) && (data.trim().length() > 0))
           {
  -          throw new SAXException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_OUTPUT_TEXT_BEFORE_DOC, null)); //"Warning: can't output text before document element!  Ignoring...");
  +          throw new SAXException(
  +            XSLMessages.createXPATHMessage(
  +              XPATHErrorResources.ER_CANT_OUTPUT_TEXT_BEFORE_DOC, null));  //"Warning: can't output text before document element!  Ignoring...");
           }
  +
           ok = false;
         }
  -      else if(type == Node.ELEMENT_NODE)
  +      else if (type == Node.ELEMENT_NODE)
         {
  -        if(m_doc.getDocumentElement() != null)
  +        if (m_doc.getDocumentElement() != null)
           {
  -          throw new SAXException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CANT_HAVE_MORE_THAN_ONE_ROOT, null)); //"Can't have more than one root on a DOM!");
  +          throw new SAXException(
  +            XSLMessages.createXPATHMessage(
  +              XPATHErrorResources.ER_CANT_HAVE_MORE_THAN_ONE_ROOT, null));  //"Can't have more than one root on a DOM!");
           }
         }
  -      if(ok)
  +
  +      if (ok)
           m_doc.appendChild(newNode);
       }
     }
  -  
  +
     /**
      * Receive an object for locating the origin of SAX document events.
      *
  @@ -201,8 +240,9 @@
      *                any SAX document event.
      * @see org.xml.sax.Locator
      */
  -  public void setDocumentLocator (Locator locator)
  +  public void setDocumentLocator(Locator locator)
     {
  +
       // No action for the moment.
     }
   
  @@ -215,14 +255,15 @@
      *
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  +   *
  +   * @throws SAXException
      */
  -  public void startDocument ()
  -    throws SAXException
  +  public void startDocument() throws SAXException
     {
  +
       // No action for the moment.
     }
   
  -
     /**
      * Receive notification of the end of a document.
      *
  @@ -234,14 +275,15 @@
      *
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  +   *
  +   * @throws SAXException
      */
  -  public void endDocument ()
  -    throws SAXException
  +  public void endDocument() throws SAXException
     {
  +
       // No action for the moment.
     }
   
  -
     /**
      * Receive notification of the beginning of an element.
      *
  @@ -257,47 +299,66 @@
      * contain only attributes with explicit values (specified or
      * defaulted): #IMPLIED attributes will be omitted.</p>
      *
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
      * @param name The element type name.
      * @param atts The attributes attached to the element, if any.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
      * @see #endElement
  -   * @see org.xml.sax.Attributes 
  +   * @see org.xml.sax.Attributes
  +   *
  +   * @throws SAXException
      */
  -  public void startElement (String ns, String localName, 
  -                            String name, Attributes atts)
  -    throws SAXException
  +  public void startElement(
  +          String ns, String localName, String name, Attributes atts)
  +            throws SAXException
     {
  +
       Element elem;
  -    if((null == ns) || (ns.length() == 0))
  +
  +    if ((null == ns) || (ns.length() == 0))
         elem = m_doc.createElement(name);
       else
         elem = m_doc.createElementNS(ns, name);
  -    append(elem); 
  +
  +    append(elem);
  +
       int nAtts = atts.getLength();
  -    for(int i = 0; i < nAtts; i++)
  -    {
  -      //System.out.println("type " + atts.getType(i) + " name " + atts.getLocalName(i) );
  -      // First handle a possible ID attribute
  -      if (atts.getType(i).equalsIgnoreCase("ID"))
  -        setIDAttribute(atts.getURI(i), atts.getLocalName(i), atts.getValue(i), elem);
  -      
  -      String attrNS = atts.getURI(i);
  -      // System.out.println("attrNS: "+attrNS+", localName: "+atts.getQName(i)
  -      //                   +", qname: "+atts.getQName(i)+", value: "+atts.getValue(i));
   
  -      if((null == attrNS) || (attrNS.length() == 0))
  -        elem.setAttribute(atts.getQName(i), atts.getValue(i));
  -      else
  +    if (0 != nAtts)
  +    {
  +      for (int i = 0; i < nAtts; i++)
         {
  -        // elem.setAttributeNS(atts.getURI(i), atts.getLocalName(i), atts.getValue(i));
  -        elem.setAttributeNS(atts.getURI(i), atts.getQName(i), atts.getValue(i));
  +
  +        //System.out.println("type " + atts.getType(i) + " name " + atts.getLocalName(i) );
  +        // First handle a possible ID attribute
  +        if (atts.getType(i).equalsIgnoreCase("ID"))
  +          setIDAttribute(atts.getURI(i), atts.getLocalName(i),
  +                         atts.getValue(i), elem);
  +
  +        String attrNS = atts.getURI(i);
  +
  +        // System.out.println("attrNS: "+attrNS+", localName: "+atts.getQName(i)
  +        //                   +", qname: "+atts.getQName(i)+", value: "+atts.getValue(i));
  +        if ((null == attrNS) || (attrNS.length() == 0))
  +          elem.setAttribute(atts.getQName(i), atts.getValue(i));
  +        else
  +        {
  +
  +          // elem.setAttributeNS(atts.getURI(i), atts.getLocalName(i), atts.getValue(i));
  +          elem.setAttributeNS(atts.getURI(i), atts.getQName(i),
  +                              atts.getValue(i));
  +        }
         }
       }
  +
       m_elemStack.push(elem);
  +
       m_currentNode = elem;
     }
  -  
  +
     /**
      * Receive notification of the end of an element.
      *
  @@ -309,34 +370,87 @@
      * <p>If the element name has a namespace prefix, the prefix will
      * still be attached to the name.</p>
      *
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
      * @param name The element type name
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  +   *
  +   * @throws SAXException
      */
  -  public void endElement (String ns, String localName,
  -                          String name)
  -    throws SAXException
  +  public void endElement(String ns, String localName, String name)
  +          throws SAXException
     {
  -    m_elemStack.pop();
  -    if(!m_elemStack.isEmpty())
  -    {
  -      m_currentNode = (Element)m_elemStack.peek();
  -    }
  -    else
  -    {
  -      m_currentNode = null;
  -    }
  +    m_currentNode = m_elemStack.popAndTop();
     }
  -  
  -  public void setIDAttribute(String namespaceURI,
  -                             String qualifiedName,
  -                             String value,
  -                             Element elem)
  +
  +  /**
  +   * NEEDSDOC Method setIDAttribute 
  +   *
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   * NEEDSDOC @param value
  +   * NEEDSDOC @param elem
  +   */
  +  public void setIDAttribute(String namespaceURI, String qualifiedName,
  +                             String value, Element elem)
     {
  +
       // Do nothing. This method is meant to be overiden.
     }
   
     /**
  +   * Starts an un-escaping section. All characters printed within an
  +   * un-escaping section are printed as is, without escaping special
  +   * characters into entity references. Only XML and HTML serializers
  +   * need to support this method.
  +   * <p>
  +   * The contents of the un-escaping section will be delivered through
  +   * the regular <tt>characters</tt> event.
  +   *
  +   * @throws SAXException
  +   */
  +  public void startNonEscaping() throws SAXException
  +  {
  +    append(m_doc.createProcessingInstruction("xslt-next-is-raw",
  +                                             "formatter-to-dom"));
  +  }
  +
  +  /**
  +   * Ends an un-escaping section.
  +   *
  +   * @see #startNonEscaping
  +   *
  +   * @throws SAXException
  +   */
  +  public void endNonEscaping() throws SAXException{}
  +
  +  /**
  +   * Starts a whitespace preserving section. All characters printed
  +   * within a preserving section are printed without indentation and
  +   * without consolidating multiple spaces. This is equivalent to
  +   * the <tt>xml:space=&quot;preserve&quot;</tt> attribute. Only XML
  +   * and HTML serializers need to support this method.
  +   * <p>
  +   * The contents of the whitespace preserving section will be delivered
  +   * through the regular <tt>characters</tt> event.
  +   *
  +   * @throws SAXException
  +   */
  +  public void startPreserving() throws SAXException{}
  +
  +  /**
  +   * Ends a whitespace preserving section.
  +   *
  +   * @see #startPreserving
  +   *
  +   * @throws SAXException
  +   */
  +  public void endPreserving() throws SAXException{}
  +
  +  /**
      * Receive notification of character data.
      *
      * <p>The Parser will call this method to report each chunk of
  @@ -358,37 +472,50 @@
      * @param length The number of characters to read from the array.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  -   * @see #ignorableWhitespace 
  +   * @see #ignorableWhitespace
      * @see org.xml.sax.Locator
  +   *
  +   * @throws SAXException
      */
  -  public void characters (char ch[], int start, int length)
  -    throws SAXException
  +  public void characters(char ch[], int start, int length) throws SAXException
     {
  -    if(m_inCData)
  +
  +    if (m_inCData)
       {
  -      cdata (ch, start, length);
  +      cdata(ch, start, length);
  +
         return;
       }
   
       String s = new String(ch, start, length);
       Text text = m_doc.createTextNode(s);
  +
       append(text);
     }
   
     /**
  -   * If available, when the disable-output-escaping attribute is used, 
  -   * output raw text without escaping.  A PI will be inserted in front 
  +   * If available, when the disable-output-escaping attribute is used,
  +   * output raw text without escaping.  A PI will be inserted in front
      * of the node with the name "lotusxsl-next-is-raw" and a value of
      * "formatter-to-dom".
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws SAXException
      */
  -  public void charactersRaw (char ch[], int start, int length)
  -    throws SAXException
  +  public void charactersRaw(char ch[], int start, int length)
  +          throws SAXException
     {
  +
       String s = new String(ch, start, length);
  -    append(m_doc.createProcessingInstruction("xslt-next-is-raw", "formatter-to-dom"));
  +
  +    append(m_doc.createProcessingInstruction("xslt-next-is-raw",
  +                                             "formatter-to-dom"));
       append(m_doc.createTextNode(s));
     }
  -  
  +
     /**
      * Report the beginning of an entity.
      *
  @@ -404,9 +531,9 @@
      * @see org.xml.sax.misc.DeclHandler#internalEntityDecl
      * @see org.xml.sax.misc.DeclHandler#externalEntityDecl
      */
  -  public void startEntity (String name)
  -    throws SAXException
  +  public void startEntity(String name) throws SAXException
     {
  +
       // Almost certainly the wrong behavior...
       // entityReference(name);
     }
  @@ -418,16 +545,16 @@
      * @exception SAXException The application may raise an exception.
      * @see #startEntity
      */
  -  public void endEntity (String name)
  -    throws SAXException
  -  {
  -  }
  +  public void endEntity(String name) throws SAXException{}
   
     /**
      * Receive notivication of a entityReference.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SAXException
      */
  -  public void entityReference(String name)
  -    throws SAXException
  +  public void entityReference(String name) throws SAXException
     {
       append(m_doc.createEntityReference(name));
     }
  @@ -455,15 +582,18 @@
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
      * @see #characters
  +   *
  +   * @throws SAXException
      */
  -  public void ignorableWhitespace (char ch[], int start, int length)
  -    throws SAXException
  +  public void ignorableWhitespace(char ch[], int start, int length)
  +          throws SAXException
     {
  +
       String s = new String(ch, start, length);
  +
       append(m_doc.createTextNode(s));
     }
   
  -
     /**
      * Receive notification of a processing instruction.
      *
  @@ -480,13 +610,15 @@
      *        none was supplied.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  +   *
  +   * @throws SAXException
      */
  -  public void processingInstruction (String target, String data)
  -    throws SAXException
  +  public void processingInstruction(String target, String data)
  +          throws SAXException
     {
       append(m_doc.createProcessingInstruction(target, data));
  - }
  -  
  +  }
  +
     /**
      * Report an XML comment anywhere in the document.
      *
  @@ -501,19 +633,19 @@
      */
     public void comment(char ch[], int start, int length) throws SAXException
     {
  -    append( m_doc.createComment(new String(ch, start, length)) );
  -  }  
  -  
  +    append(m_doc.createComment(new String(ch, start, length)));
  +  }
  +
  +  /** NEEDSDOC Field m_inCData          */
     protected boolean m_inCData = false;
  -  
  +
     /**
      * Report the start of a CDATA section.
      *
      * @exception SAXException The application may raise an exception.
      * @see #endCDATA
      */
  -  public void startCDATA ()
  -    throws SAXException
  +  public void startCDATA() throws SAXException
     {
       m_inCData = true;
     }
  @@ -524,12 +656,11 @@
      * @exception SAXException The application may raise an exception.
      * @see #startCDATA
      */
  -  public void endCDATA ()
  -    throws SAXException
  +  public void endCDATA() throws SAXException
     {
       m_inCData = false;
     }
  -  
  +
     /**
      * Receive notification of cdata.
      *
  @@ -552,16 +683,19 @@
      * @param length The number of characters to read from the array.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  -   * @see #ignorableWhitespace 
  +   * @see #ignorableWhitespace
      * @see org.xml.sax.Locator
  +   *
  +   * @throws SAXException
      */
  -  public void cdata (char ch[], int start, int length)
  -    throws SAXException
  +  public void cdata(char ch[], int start, int length) throws SAXException
     {
  +
       String s = new String(ch, start, length);
  +
       append(m_doc.createCDATASection(s));
     }
  -  
  +
     /**
      * Report the start of DTD declarations, if any.
      *
  @@ -578,10 +712,10 @@
      * @see #endDTD
      * @see #startEntity
      */
  -  public void startDTD (String name, String publicId,
  -                                 String systemId)
  -    throws SAXException
  +  public void startDTD(String name, String publicId, String systemId)
  +          throws SAXException
     {
  +
       // Do nothing for now.
     }
   
  @@ -591,9 +725,9 @@
      * @exception SAXException The application may raise an exception.
      * @see #startDTD
      */
  -  public void endDTD ()
  -    throws SAXException
  +  public void endDTD() throws SAXException
     {
  +
       // Do nothing for now.
     }
   
  @@ -601,7 +735,7 @@
      * Begin the scope of a prefix-URI Namespace mapping.
      *
      * <p>The information from this event is not necessary for
  -   * normal Namespace processing: the SAX XML reader will 
  +   * normal Namespace processing: the SAX XML reader will
      * automatically replace prefixes for element and attribute
      * names when the http://xml.org/sax/features/namespaces
      * feature is true (the default).</p>
  @@ -626,14 +760,17 @@
      *            an exception during processing.
      * @see #endPrefixMapping
      * @see #startElement
  +   *
  +   * @throws SAXException
      */
  -  public void startPrefixMapping (String prefix, String uri)
  -	  throws SAXException
  +  public void startPrefixMapping(String prefix, String uri)
  +          throws SAXException
     {
  +
       /*
       // Not sure if this is needed or wanted
       // Also, it fails in the stree.
  -    if((null != m_currentNode) 
  +    if((null != m_currentNode)
          && (m_currentNode.getNodeType() == Node.ELEMENT_NODE))
       {
         String qname;
  @@ -642,17 +779,16 @@
           qname = "xmlns";
         else
           qname = "xmlns:"+prefix;
  -       
  +
         Element elem = (Element)m_currentNode;
         String val = elem.getAttribute(qname);
         if(val == null)
         {
  -        elem.setAttributeNS("http://www.w3.org/XML/1998/namespace", 
  +        elem.setAttributeNS("http://www.w3.org/XML/1998/namespace",
                               qname, uri);
         }
       }
       */
  -
     }
   
     /**
  @@ -668,12 +804,11 @@
      *            an exception during processing.
      * @see #startPrefixMapping
      * @see #endElement
  +   *
  +   * @throws SAXException
      */
  -  public void endPrefixMapping (String prefix)
  -	  throws SAXException
  -  {
  -  }
  -  
  +  public void endPrefixMapping(String prefix) throws SAXException{}
  +
     /**
      * Receive notification of a skipped entity.
      *
  @@ -686,14 +821,12 @@
      * http://xml.org/sax/features/external-parameter-entities
      * properties.</p>
      *
  -   * @param name The name of the skipped entity.  If it is a 
  +   * @param name The name of the skipped entity.  If it is a
      *        parameter entity, the name will begin with '%'.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  +   *
  +   * @throws SAXException
      */
  -  public void skippedEntity (String name)
  -	  throws SAXException
  -  {
  -  }
  -
  +  public void skippedEntity(String name) throws SAXException{}
   }
  
  
  
  1.2       +32 -19    xml-xalan/java/src/org/apache/xalan/utils/DefaultErrorHandler.java
  
  Index: DefaultErrorHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/DefaultErrorHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultErrorHandler.java	2000/06/19 16:53:11	1.1
  +++ DefaultErrorHandler.java	2000/10/30 18:57:15	1.2
  @@ -62,10 +62,18 @@
    * <meta name="usage" content="general"/>
    * Implement SAX error handler for default reporting.
    */
  -public class DefaultErrorHandler implements ErrorHandler 
  +public class DefaultErrorHandler implements ErrorHandler
   {
  +
  +  /** NEEDSDOC Field m_xmlID          */
     String m_xmlID = null;
   
  +  /**
  +   * Constructor DefaultErrorHandler
  +   *
  +   *
  +   * NEEDSDOC @param identifier
  +   */
     public DefaultErrorHandler(String identifier)
     {
       m_xmlID = identifier;
  @@ -86,15 +94,15 @@
      *                  SAX parse exception.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  -   * @see org.xml.sax.SAXParseException 
  +   * @see org.xml.sax.SAXParseException
  +   *
  +   * @throws SAXException
      */
  -  public void warning (SAXParseException exception)
  -    throws SAXException
  +  public void warning(SAXParseException exception) throws SAXException
     {
  -    System.out.println("Parser warning: "+exception.getMessage());
  +    System.out.println("Parser warning: " + exception.getMessage());
     }
   
  -
     /**
      * Receive notification of a recoverable error.
      *
  @@ -115,12 +123,13 @@
      *                  SAX parse exception.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
  -   * @see org.xml.sax.SAXParseException 
  +   * @see org.xml.sax.SAXParseException
  +   *
  +   * @throws SAXException
      */
  -  public void error (SAXParseException exception)
  -    throws SAXException
  +  public void error(SAXParseException exception) throws SAXException
     {
  -    System.out.println("Parser error: "+exception.getMessage());
  +    System.out.println("Parser error: " + exception.getMessage());
     }
   
     /**
  @@ -138,21 +147,25 @@
      * other events once this method has been invoked.</p>
      *
      * @param exception The error information encapsulated in a
  -   *                  SAX parse exception.  
  +   *                  SAX parse exception.
      * @exception org.xml.sax.SAXException Any SAX exception, possibly
      *            wrapping another exception.
      * @see org.xml.sax.SAXParseException
  +   *
  +   * @throws SAXException
      */
  -  public void fatalError (SAXParseException exception)
  -    throws SAXException
  +  public void fatalError(SAXParseException exception) throws SAXException
     {
  +
       // System.out.println("Parser fatal error: "+exception.getMessage());
  -    String id = (exception.getPublicId() != exception.getPublicId()) 
  -                ? exception.getPublicId() : (null != exception.getSystemId()) 
  -                                            ? exception.getSystemId() : m_xmlID;
  -    System.out.println(id+"; Line "+exception.getLineNumber()
  -                       +"; Column "+exception.getColumnNumber());
  +    String id = (exception.getPublicId() != exception.getPublicId())
  +                ? exception.getPublicId()
  +                : (null != exception.getSystemId())
  +                  ? exception.getSystemId() : m_xmlID;
  +
  +    System.out.println(id + "; Line " + exception.getLineNumber()
  +                       + "; Column " + exception.getColumnNumber());
  +
       throw exception;
     }
  -
   }
  
  
  
  1.2       +93 -12    xml-xalan/java/src/org/apache/xalan/utils/ElemDesc.java
  
  Index: ElemDesc.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/ElemDesc.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ElemDesc.java	2000/06/19 16:53:11	1.1
  +++ ElemDesc.java	2000/10/30 18:57:16	1.2
  @@ -60,70 +60,151 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * This class is in support of FormatterToHTML, and acts as a sort 
  + * This class is in support of FormatterToHTML, and acts as a sort
    * of element representative for HTML elements.
    */
   class ElemDesc
   {
  +
  +  /** NEEDSDOC Field m_flags          */
     int m_flags;
  +
  +  /** NEEDSDOC Field m_attrs          */
     Hashtable m_attrs = null;
  -  
  +
  +  /** NEEDSDOC Field EMPTY          */
     static final int EMPTY = (1 << 1);
  +
  +  /** NEEDSDOC Field FLOW          */
     static final int FLOW = (1 << 2);
  +
  +  /** NEEDSDOC Field BLOCK          */
     static final int BLOCK = (1 << 3);
  +
  +  /** NEEDSDOC Field BLOCKFORM          */
     static final int BLOCKFORM = (1 << 4);
  +
  +  /** NEEDSDOC Field BLOCKFORMFIELDSET          */
     static final int BLOCKFORMFIELDSET = (1 << 5);
  +
  +  /** NEEDSDOC Field CDATA          */
     static final int CDATA = (1 << 6);
  +
  +  /** NEEDSDOC Field PCDATA          */
     static final int PCDATA = (1 << 7);
  +
  +  /** NEEDSDOC Field RAW          */
     static final int RAW = (1 << 8);
  +
  +  /** NEEDSDOC Field INLINE          */
     static final int INLINE = (1 << 9);
  +
  +  /** NEEDSDOC Field INLINEA          */
     static final int INLINEA = (1 << 10);
  +
  +  /** NEEDSDOC Field INLINELABEL          */
     static final int INLINELABEL = (1 << 11);
  +
  +  /** NEEDSDOC Field FONTSTYLE          */
     static final int FONTSTYLE = (1 << 12);
  +
  +  /** NEEDSDOC Field PHRASE          */
     static final int PHRASE = (1 << 13);
  +
  +  /** NEEDSDOC Field FORMCTRL          */
     static final int FORMCTRL = (1 << 14);
  +
  +  /** NEEDSDOC Field SPECIAL          */
     static final int SPECIAL = (1 << 15);
  +
  +  /** NEEDSDOC Field ASPECIAL          */
     static final int ASPECIAL = (1 << 16);
  +
  +  /** NEEDSDOC Field HEADMISC          */
     static final int HEADMISC = (1 << 17);
  +
  +  /** NEEDSDOC Field HEAD          */
     static final int HEAD = (1 << 18);
  +
  +  /** NEEDSDOC Field LIST          */
     static final int LIST = (1 << 19);
  +
  +  /** NEEDSDOC Field PREFORMATTED          */
     static final int PREFORMATTED = (1 << 20);
  +
  +  /** NEEDSDOC Field WHITESPACESENSITIVE          */
     static final int WHITESPACESENSITIVE = (1 << 21);
   
  +  /** NEEDSDOC Field ATTRURL          */
     static final int ATTRURL = (1 << 1);
  +
  +  /** NEEDSDOC Field ATTREMPTY          */
     static final int ATTREMPTY = (1 << 2);
   
  +  /**
  +   * Constructor ElemDesc
  +   *
  +   *
  +   * NEEDSDOC @param flags
  +   */
     ElemDesc(int flags)
     {
       m_flags = flags;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method is 
  +   *
  +   *
  +   * NEEDSDOC @param flags
  +   *
  +   * NEEDSDOC (is) @return
  +   */
     boolean is(int flags)
     {
  +
       // int which = (m_flags & flags);
       return (m_flags & flags) != 0;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setAttr 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param flags
  +   */
     void setAttr(String name, int flags)
     {
  -    if(null == m_attrs)
  +
  +    if (null == m_attrs)
         m_attrs = new Hashtable();
  -    
  +
       m_attrs.put(name, new Integer(flags));
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method isAttrFlagSet 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param flags
  +   *
  +   * NEEDSDOC (isAttrFlagSet) @return
  +   */
     boolean isAttrFlagSet(String name, int flags)
     {
  -    if(null != m_attrs)
  +
  +    if (null != m_attrs)
       {
  -      Integer _flags = (Integer)m_attrs.get(name);
  -      if(null != _flags)
  +      Integer _flags = (Integer) m_attrs.get(name);
  +
  +      if (null != _flags)
         {
           return (_flags.intValue() & flags) != 0;
         }
       }
  +
       return false;
     }
  -  
  -  
   }
  
  
  
  1.2       +109 -30   xml-xalan/java/src/org/apache/xalan/utils/FastStringBuffer.java
  
  Index: FastStringBuffer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/FastStringBuffer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FastStringBuffer.java	2000/10/18 04:36:46	1.1
  +++ FastStringBuffer.java	2000/10/30 18:57:16	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,15 +18,15 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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
  + * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -49,8 +49,8 @@
    *
    * 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.apache.org.  For more
  + * originally based on software copyright (c) 1999, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  @@ -61,9 +61,17 @@
    */
   public class FastStringBuffer
   {
  +
  +  /** NEEDSDOC Field m_blocksize          */
     public int m_blocksize;
  +
  +  /** NEEDSDOC Field m_map[]          */
     public char m_map[];  // don't hold on to a reference!
  +
  +  /** NEEDSDOC Field m_firstFree          */
     public int m_firstFree = 0;
  +
  +  /** NEEDSDOC Field m_mapSize          */
     public int m_mapSize;
   
     /**
  @@ -71,108 +79,179 @@
      */
     public FastStringBuffer()
     {
  +
       m_blocksize = 1024;
       m_mapSize = 1024;
  -    m_map = new char[1024]; 
  +    m_map = new char[1024];
     }
   
     /**
      * Construct a IntVector, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public FastStringBuffer(int blocksize)
     {
  +
       m_blocksize = blocksize;
       m_mapSize = blocksize;
  -    m_map = new char[blocksize]; 
  +    m_map = new char[blocksize];
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int size()
     {
       return m_firstFree;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method length 
  +   *
  +   *
  +   * NEEDSDOC (length) @return
  +   */
     public final int length()
     {
       return m_firstFree;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method reset 
  +   *
  +   */
     public final void reset()
     {
       m_firstFree = 0;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setLength 
  +   *
  +   *
  +   * NEEDSDOC @param l
  +   */
     public final void setLength(int l)
     {
       m_firstFree = l;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method toString 
  +   *
  +   *
  +   * NEEDSDOC (toString) @return
  +   */
     public final String toString()
     {
       return new String(m_map, 0, m_firstFree);
     }
  -    
  +
  +  /**
  +   * NEEDSDOC Method ensureSize 
  +   *
  +   *
  +   * NEEDSDOC @param newSize
  +   */
     private final void ensureSize(int newSize)
     {
  -    if((m_firstFree+newSize) >= m_mapSize)
  +
  +    if ((m_firstFree + newSize) >= m_mapSize)
       {
  -      if(m_blocksize > newSize)
  -        m_mapSize+=m_blocksize;
  +      if (m_blocksize > newSize)
  +        m_mapSize += m_blocksize;
         else
  -        m_mapSize+=(newSize+m_blocksize);
  +        m_mapSize += (newSize + m_blocksize);
  +
         char newMap[] = new char[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
     }
   
     /**
      * Append a int onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public final void append(char value)
     {
  +
       ensureSize(1);
  +
       m_map[m_firstFree] = value;
  +
       m_firstFree++;
     }
  -  
   
     /**
      * Append a int onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public final void append(String value)
     {
  +
       int len = value.length();
  +
       ensureSize(len);
       value.getChars(0, len, m_map, m_firstFree);
  -    m_firstFree+=len;
  +
  +    m_firstFree += len;
     }
  -  
  +
     /**
      * Append a int onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public final void append(StringBuffer value)
     {
  +
       int len = value.length();
  +
       ensureSize(len);
       value.getChars(0, len, m_map, m_firstFree);
  -    m_firstFree+=len;
  +
  +    m_firstFree += len;
     }
  -  
  -  public final void append( char[] chars, int start, int length )
  +
  +  /**
  +   * NEEDSDOC Method append 
  +   *
  +   *
  +   * NEEDSDOC @param chars
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   */
  +  public final void append(char[] chars, int start, int length)
     {
  +
       ensureSize(length);
       System.arraycopy(chars, start, m_map, m_firstFree, length);
  -    m_firstFree+=length;
  +
  +    m_firstFree += length;
     }
  -  
  -  public final void append( FastStringBuffer value )
  +
  +  /**
  +   * NEEDSDOC Method append 
  +   *
  +   *
  +   * NEEDSDOC @param value
  +   */
  +  public final void append(FastStringBuffer value)
     {
  +
       int length = value.m_firstFree;
  +
       ensureSize(length);
       System.arraycopy(value.m_map, 0, m_map, m_firstFree, length);
  -    m_firstFree+=length;
  +
  +    m_firstFree += length;
     }
   }
  
  
  
  1.2       +108 -29   xml-xalan/java/src/org/apache/xalan/utils/Heap.java
  
  Index: Heap.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/Heap.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Heap.java	2000/06/19 16:53:11	1.1
  +++ Heap.java	2000/10/30 18:57:17	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -58,79 +58,158 @@
   
   import java.util.Vector;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Heap <needs-comment/>
  + */
   public class Heap extends Vector
   {
  +
  +  /** NEEDSDOC Field m_a[]          */
     private HeapObject m_a[] = new HeapObject[50];
  +
  +  /** NEEDSDOC Field m_n          */
     private int m_n;
  -  
  -  public Heap()
  -  {
  -  }
  -  
  +
  +  /**
  +   * Constructor Heap
  +   *
  +   */
  +  public Heap(){}
  +
  +  /**
  +   * NEEDSDOC Method insert 
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   */
     public void insert(HeapObject obj)
     {
  +
       m_n++;
  +
       m_a[m_n] = obj;
  +
       upheap(m_n);
     }
  -    
  +
  +  /**
  +   * NEEDSDOC Method upheap 
  +   *
  +   *
  +   * NEEDSDOC @param k
  +   */
     private void upheap(int k)
     {
  -    HeapObject v = m_a[k]; 
  +
  +    HeapObject v = m_a[k];
  +
       m_a[0] = m_sentinel;
  -    while (m_a[k/2].getHeapValue() < v.getHeapValue()) 
  +
  +    while (m_a[k / 2].getHeapValue() < v.getHeapValue())
       {
  -      m_a[k] = m_a[k/2];
  -      k = k/2;
  +      m_a[k] = m_a[k / 2];
  +      k = k / 2;
       }
  +
       m_a[k] = v;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method remove 
  +   *
  +   *
  +   * NEEDSDOC (remove) @return
  +   */
     public HeapObject remove()
     {
  +
       HeapObject v = m_a[1];
  +
       m_a[1] = m_a[m_n--];
  +
       downheap(1);
  +
       return v;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method downheap 
  +   *
  +   *
  +   * NEEDSDOC @param k
  +   */
     private void downheap(int k)
     {
  +
       HeapObject v = m_a[k];
  -    while (k <= m_n/2) 
  +
  +    while (k <= m_n / 2)
       {
  -      int j = k+k;
  -      if (j < m_n && m_a[j].getHeapValue() < m_a[j+1].getHeapValue()) 
  +      int j = k + k;
  +
  +      if (j < m_n && m_a[j].getHeapValue() < m_a[j + 1].getHeapValue())
           j++;
  -      if (v.getHeapValue() >= m_a[j].getHeapValue()) 
  +
  +      if (v.getHeapValue() >= m_a[j].getHeapValue())
           break;
  -      m_a[k] = m_a[j]; k = j;
  +
  +      m_a[k] = m_a[j];
  +      k = j;
       }
  +
       m_a[k] = v;
     }
  -   
  +
  +  /**
  +   * NEEDSDOC Method replace 
  +   *
  +   *
  +   * NEEDSDOC @param v
  +   *
  +   * NEEDSDOC (replace) @return
  +   */
     HeapObject replace(HeapObject v)
     {
  +
       m_a[0] = v;
  +
       downheap(0);
  +
       return m_a[0];
  -  }
  -  
  -  void change()
  -  {
  -  }
  -  
  -  void delete()
  -  {
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method change 
  +   *
  +   */
  +  void change(){}
  +
  +  /**
  +   * NEEDSDOC Method delete 
  +   *
  +   */
  +  void delete(){}
  +
  +  /**
  +   * <meta name="usage" content="internal"/>
  +   * NEEDSDOC Class Sentinel <needs-comment/>
  +   */
     class Sentinel implements HeapObject
     {
  +
  +    /**
  +     * NEEDSDOC Method getHeapValue 
  +     *
  +     *
  +     * NEEDSDOC (getHeapValue) @return
  +     */
       public int getHeapValue()
       {
         return Short.MAX_VALUE;
       }
     }
  -  
  +
  +  /** NEEDSDOC Field m_sentinel          */
     final Sentinel m_sentinel = new Sentinel();
   }
  
  
  
  1.2       +12 -1     xml-xalan/java/src/org/apache/xalan/utils/HeapObject.java
  
  Index: HeapObject.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/HeapObject.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- HeapObject.java	2000/06/19 16:53:11	1.1
  +++ HeapObject.java	2000/10/30 18:57:17	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -56,7 +56,18 @@
    */
   package org.apache.xalan.utils;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Interface HeapObject
  + */
   public interface HeapObject
   {
  +
  +  /**
  +   * NEEDSDOC Method getHeapValue 
  +   *
  +   *
  +   * NEEDSDOC (getHeapValue) @return
  +   */
     int getHeapValue();
   }
  
  
  
  1.2       +52 -48    xml-xalan/java/src/org/apache/xalan/utils/IntStack.java
  
  Index: IntStack.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/IntStack.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IntStack.java	2000/06/19 16:53:11	1.1
  +++ IntStack.java	2000/10/30 18:57:17	1.2
  @@ -64,92 +64,95 @@
    */
   public class IntStack extends IntVector
   {
  +
     /**
  -   * Default constructor.  Note that the default 
  +   * Default constructor.  Note that the default
      * block size is very small, for small lists.
      */
     public IntStack()
     {
  -    super(); 
  +    super();
     }
   
     /**
      * Construct a IntVector, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public IntStack(int blocksize)
     {
  -    super(blocksize); 
  +    super(blocksize);
     }
  -  
  +
     /**
  -   * Pushes an item onto the top of this stack. 
  +   * Pushes an item onto the top of this stack.
      *
      * @param   i   the int to be pushed onto this stack.
      * @return  the <code>item</code> argument.
  -   * @since   JDK1.0
      */
  -  public int push(int i) 
  +  public int push(int i)
     {
  -    addElement(i);
   
  +    if ((m_firstFree + 1) >= m_mapSize)
  +    {
  +      m_mapSize += m_blocksize;
  +
  +      int newMap[] = new int[m_mapSize];
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
  +      m_map = newMap;
  +    }
  +
  +    m_map[m_firstFree] = i;
  +
  +    m_firstFree++;
  +
       return i;
     }
   
     /**
  -   * Removes the object at the top of this stack and returns that 
  -   * object as the value of this function. 
  +   * Removes the object at the top of this stack and returns that
  +   * object as the value of this function.
      *
      * @return     The object at the top of this stack.
  -   * @exception  EmptyStackException  if this stack is empty.
  -   * @since      JDK1.0
      */
  -  public int pop() 
  +  public int pop()
     {
  -    int	i;
  -    int	len = size();
  -
  -    i = peek();
  -    removeElementAt(len - 1);
  +    return m_map[--m_firstFree];
  +  }
   
  -    return i;
  -  }
  
  /**
  -   * Quickly pops a number of items from the stack. 
  -   *
  -   * @exception  EmptyStackException  if this stack is empty.
  +  /**
  +   * Quickly pops a number of items from the stack.
      */
  -  public void quickPop(int n) 
  +
  +  public void quickPop(int n)
     {
       m_firstFree -= n;
     }
   
  -
     /**
  -   * Looks at the object at the top of this stack without removing it 
  -   * from the stack. 
  +   * Looks at the object at the top of this stack without removing it
  +   * from the stack.
      *
  -   * @return     the object at the top of this stack. 
  +   * @return     the object at the top of this stack.
      * @exception  EmptyStackException  if this stack is empty.
  -   * @since      JDK1.0
      */
  -  public int peek() 
  +  public int peek()
     {
  -    int	len = size();
  -
  -    if (len == 0)
  -      throw new EmptyStackException();
  -    return elementAt(len - 1);
  +    return m_map[m_firstFree - 1];
     }
  -
  /**
  -   * Sets an object at a the top of the statck 
  +
  +  /**
  +   * Sets an object at a the top of the statck
  +   *
      *
  +   * NEEDSDOC @param val
      * @exception  EmptyStackException  if this stack is empty.
  -   * @since      JDK1.0
      */
  -  public void setTop(int val) 
  +  public void setTop(int val)
     {
  -    int	len = size();
  -    if (len == 0)
  -      throw new EmptyStackException();
    setElementAt(val, len - 1);
  +    m_map[m_firstFree - 1] = val;
     }
   
     /**
  @@ -159,13 +162,13 @@
      *          <code>false</code> otherwise.
      * @since   JDK1.0
      */
  -  public boolean empty() 
  +  public boolean empty()
     {
  -    return size() == 0;
  +    return m_firstFree == 0;
     }
   
     /**
  -   * Returns where an object is on this stack. 
  +   * Returns where an object is on this stack.
      *
      * @param   o   the desired object.
      * @return  the distance from the top of the stack where the object is]
  @@ -173,15 +176,16 @@
      *          object is not on the stack.
      * @since   JDK1.0
      */
  -  public int search(int o) 
  +  public int search(int o)
     {
  +
       int i = lastIndexOf(o);
   
  -    if (i >= 0) 
  +    if (i >= 0)
       {
         return size() - i;
       }
  +
       return -1;
     }
  -
   }
  
  
  
  1.2       +146 -75   xml-xalan/java/src/org/apache/xalan/utils/IntVector.java
  
  Index: IntVector.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/IntVector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- IntVector.java	2000/06/19 16:53:11	1.1
  +++ IntVector.java	2000/10/30 18:57:18	1.2
  @@ -62,34 +62,48 @@
    */
   public class IntVector
   {
  -  private int m_blocksize;
  +
  +  /** NEEDSDOC Field m_blocksize          */
  +  protected int m_blocksize;
  +
  +  /** NEEDSDOC Field m_map[]          */
     public int m_map[];  // expose to package for direct access.
  +
  +  /** NEEDSDOC Field m_firstFree          */
     protected int m_firstFree = 0;
  -  private int m_mapSize;
   
  +  /** NEEDSDOC Field m_mapSize          */
  +  protected int m_mapSize;
  +
     /**
  -   * Default constructor.  Note that the default 
  +   * Default constructor.  Note that the default
      * block size is very small, for small lists.
      */
     public IntVector()
     {
  +
       m_blocksize = 32;
       m_mapSize = m_blocksize;
  -    m_map = new int[m_blocksize]; 
  +    m_map = new int[m_blocksize];
     }
   
     /**
      * Construct a IntVector, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public IntVector(int blocksize)
     {
  +
       m_blocksize = blocksize;
       m_mapSize = blocksize;
  -    m_map = new int[blocksize]; 
  +    m_map = new int[blocksize];
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int size()
     {
  @@ -98,103 +112,138 @@
   
     /**
      * Append a int onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public final void addElement(int value)
     {
  -    if((m_firstFree+1) >= m_mapSize)
  +
  +    if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         int newMap[] = new int[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
  +
       m_map[m_firstFree] = value;
  +
       m_firstFree++;
     }
   
     /**
  -   * Inserts the specified node in this vector at the specified index. 
  -   * Each component in this vector with an index greater or equal to 
  -   * the specified index is shifted upward to have an index one greater 
  -   * than the value it had previously. 
  +   * Inserts the specified node in this vector at the specified index.
  +   * Each component in this vector with an index greater or equal to
  +   * the specified index is shifted upward to have an index one greater
  +   * than the value it had previously.
  +   *
  +   * NEEDSDOC @param value
  +   * NEEDSDOC @param at
      */
     public final void insertElementAt(int value, int at)
     {
  -    if((m_firstFree+1) >= m_mapSize)
  +
  +    if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         int newMap[] = new int[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
  -    if(at <= (m_firstFree-1))
  +
  +    if (at <= (m_firstFree - 1))
       {
  -      System.arraycopy(m_map, at, m_map, at+1, m_firstFree-at);
  +      System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at);
       }
  +
       m_map[at] = value;
  +
       m_firstFree++;
     }
   
     /**
  -   * Inserts the specified node in this vector at the specified index. 
  -   * Each component in this vector with an index greater or equal to 
  -   * the specified index is shifted upward to have an index one greater 
  -   * than the value it had previously. 
  +   * Inserts the specified node in this vector at the specified index.
  +   * Each component in this vector with an index greater or equal to
  +   * the specified index is shifted upward to have an index one greater
  +   * than the value it had previously.
      */
     public final void removeAllElements()
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
         m_map[i] = java.lang.Integer.MIN_VALUE;
       }
  +
       m_firstFree = 0;
     }
  -  
  +
     /**
  -   * Removes the first occurrence of the argument from this vector. 
  -   * If the object is found in this vector, each component in the vector 
  -   * with an index greater or equal to the object's index is shifted 
  -   * downward to have an index one smaller than the value it had 
  -   * previously. 
  +   * Removes the first occurrence of the argument from this vector.
  +   * If the object is found in this vector, each component in the vector
  +   * with an index greater or equal to the object's index is shifted
  +   * downward to have an index one smaller than the value it had
  +   * previously.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean removeElement(int s)
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i] == s)
  +      if (m_map[i] == s)
         {
  -        if((i+1) < m_firstFree)
  -          System.arraycopy(m_map, i+1, m_map, i-1, m_firstFree-i);
  +        if ((i + 1) < m_firstFree)
  +          System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i);
           else
             m_map[i] = java.lang.Integer.MIN_VALUE;
  +
           m_firstFree--;
  +
           return true;
         }
       }
  +
       return false;
     }
  -  
  +
     /**
  -   * Deletes the component at the specified index. Each component in 
  -   * this vector with an index greater or equal to the specified 
  -   * index is shifted downward to have an index one smaller than 
  -   * the value it had previously. 
  +   * Deletes the component at the specified index. Each component in
  +   * this vector with an index greater or equal to the specified
  +   * index is shifted downward to have an index one smaller than
  +   * the value it had previously.
  +   *
  +   * NEEDSDOC @param i
      */
     public final void removeElementAt(int i)
     {
  -    if(i > m_firstFree)
  -      System.arraycopy(m_map, i+1, m_map, i, m_firstFree);
  +
  +    if (i > m_firstFree)
  +      System.arraycopy(m_map, i + 1, m_map, i, m_firstFree);
       else
         m_map[i] = java.lang.Integer.MIN_VALUE;
  +
       m_firstFree--;
     }
  -  
  +
     /**
  -   * Sets the component at the specified index of this vector to be the 
  -   * specified object. The previous component at that position is discarded. 
  -   * 
  -   * The index must be a value greater than or equal to 0 and less 
  -   * than the current size of the vector. 
  +   * Sets the component at the specified index of this vector to be the
  +   * specified object. The previous component at that position is discarded.
  +   *
  +   * The index must be a value greater than or equal to 0 and less
  +   * than the current size of the vector.
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param index
      */
     public final void setElementAt(int node, int index)
     {
  @@ -203,77 +252,99 @@
   
     /**
      * Get the nth element.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int elementAt(int i)
     {
       return m_map[i];
     }
  -  
  +
     /**
      * Tell if the table contains the given node.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean contains(int s)
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i] == s)
  +      if (m_map[i] == s)
           return true;
       }
  +
       return false;
     }
  -  
  +
     /**
  -   * Searches for the first occurence of the given argument, 
  -   * beginning the search at index, and testing for equality 
  -   * using the equals method. 
  -   * @return the index of the first occurrence of the object 
  -   * argument in this vector at position index or later in the 
  -   * vector; returns -1 if the object is not found. 
  +   * Searches for the first occurence of the given argument,
  +   * beginning the search at index, and testing for equality
  +   * using the equals method.
  +   *
  +   * NEEDSDOC @param elem
  +   * NEEDSDOC @param index
  +   * @return the index of the first occurrence of the object
  +   * argument in this vector at position index or later in the
  +   * vector; returns -1 if the object is not found.
      */
     public final int indexOf(int elem, int index)
     {
  -    for(int i = index; i < m_firstFree; i++)
  +
  +    for (int i = index; i < m_firstFree; i++)
       {
  -      if(m_map[i] == elem)
  +      if (m_map[i] == elem)
           return i;
       }
  +
       return java.lang.Integer.MIN_VALUE;
     }
   
     /**
  -   * Searches for the first occurence of the given argument, 
  -   * beginning the search at index, and testing for equality 
  -   * using the equals method. 
  -   * @return the index of the first occurrence of the object 
  -   * argument in this vector at position index or later in the 
  -   * vector; returns -1 if the object is not found. 
  +   * Searches for the first occurence of the given argument,
  +   * beginning the search at index, and testing for equality
  +   * using the equals method.
  +   *
  +   * NEEDSDOC @param elem
  +   * @return the index of the first occurrence of the object
  +   * argument in this vector at position index or later in the
  +   * vector; returns -1 if the object is not found.
      */
     public final int indexOf(int elem)
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i] == elem)
  +      if (m_map[i] == elem)
           return i;
       }
  +
       return java.lang.Integer.MIN_VALUE;
     }
   
     /**
  -   * Searches for the first occurence of the given argument, 
  -   * beginning the search at index, and testing for equality 
  -   * using the equals method. 
  -   * @return the index of the first occurrence of the object 
  -   * argument in this vector at position index or later in the 
  -   * vector; returns -1 if the object is not found. 
  +   * Searches for the first occurence of the given argument,
  +   * beginning the search at index, and testing for equality
  +   * using the equals method.
  +   *
  +   * NEEDSDOC @param elem
  +   * @return the index of the first occurrence of the object
  +   * argument in this vector at position index or later in the
  +   * vector; returns -1 if the object is not found.
      */
     public final int lastIndexOf(int elem)
     {
  -    for(int i = (m_firstFree - 1); i >= 0; i--)
  +
  +    for (int i = (m_firstFree - 1); i >= 0; i--)
       {
  -      if(m_map[i] == elem)
  +      if (m_map[i] == elem)
           return i;
       }
  +
       return java.lang.Integer.MIN_VALUE;
     }
  -
   }
  
  
  
  1.3       +43 -27    xml-xalan/java/src/org/apache/xalan/utils/MutableAttrListImpl.java
  
  Index: MutableAttrListImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/MutableAttrListImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- MutableAttrListImpl.java	2000/07/30 23:04:28	1.2
  +++ MutableAttrListImpl.java	2000/10/30 18:57:18	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,25 +57,30 @@
   package org.apache.xalan.utils;
   
   import org.apache.xalan.utils.StringVector;
  +
   import org.xml.sax.Attributes;
  +
   import java.io.Serializable;
  +
   import org.xml.sax.helpers.AttributesImpl;
   
   /**
    * <meta name="usage" content="advanced"/>
    * Mutable version of AttributesImpl.
    */
  -public class MutableAttrListImpl extends AttributesImpl 
  -  implements Serializable
  -{
  /**
  -   * Construct a new, empty AttributesImpl object.
  -   */
  -  public MutableAttrListImpl ()
  +public class MutableAttrListImpl extends AttributesImpl
  +        implements Serializable
  +{
  +
  +/**
  + * Construct a new, empty AttributesImpl object.
  + */
  +
  +public MutableAttrListImpl()
     {
       super();
     }
   
  -
     /**
      * Copy an existing Attributes object.
      *
  @@ -84,11 +89,11 @@
      *
      * @param atts The existing Attributes object.
      */
  -  public MutableAttrListImpl (Attributes atts)
  +  public MutableAttrListImpl(Attributes atts)
     {
       super(atts);
     }
  -  
  +
     /**
      * Add an attribute to the end of the list.
      *
  @@ -106,51 +111,62 @@
      * @param type The attribute type as a string.
      * @param value The attribute value.
      */
  -  public void addAttribute (String uri, String localName, String qName,
  -                            String type, String value)
  +  public void addAttribute(String uri, String localName, String qName,
  +                           String type, String value)
     {
  -    if(null == uri)
  +
  +    if (null == uri)
         uri = "";
   
       int index = this.getIndex(uri, localName);
  -    if(index >= 0)
  +
  +    if (index >= 0)
         this.setAttribute(index, uri, localName, qName, type, value);
       else
         super.addAttribute(uri, localName, qName, type, value);
     }
  -  
  +
     /**
      * Add the contents of the attribute list to this list.
  +   *
  +   * NEEDSDOC @param atts
      */
     public void addAttributes(Attributes atts)
  -  {    
  +  {
  +
       int nAtts = atts.getLength();
  -    for(int i = 0; i < nAtts; i++)
  +
  +    for (int i = 0; i < nAtts; i++)
       {
         String uri = atts.getURI(i);
  -      if(null == uri)
  +
  +      if (null == uri)
           uri = "";
  +
         String localName = atts.getLocalName(i);
         String qname = atts.getQName(i);
         int index = this.getIndex(uri, localName);
  -      if(index >= 0)
  -        this.setAttribute(index, uri, localName, qname, 
  -                          atts.getType(i), atts.getValue(i));
  +
  +      if (index >= 0)
  +        this.setAttribute(index, uri, localName, qname, atts.getType(i),
  +                          atts.getValue(i));
         else
  -        addAttribute(uri, localName, qname, 
  -                     atts.getType(i),
  +        addAttribute(uri, localName, qname, atts.getType(i),
                        atts.getValue(i));
       }
     }
  -  
  +
     /**
      * Return true if list contains the given (raw) attribute name.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean contains(String name)
     {
  -    return getValue (name) != null;
  +    return getValue(name) != null;
     }
  -
   }
   
   // end of MutableAttrListImpl.java
  
  
  
  1.2       +43 -3     xml-xalan/java/src/org/apache/xalan/utils/NSInfo.java
  
  Index: NSInfo.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/NSInfo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NSInfo.java	2000/06/19 16:53:12	1.1
  +++ NSInfo.java	2000/10/30 18:57:18	1.2
  @@ -59,13 +59,22 @@
   /**
    * <meta name="usage" content="internal"/>
    * This class holds information about the namespace info
  - * of a node.  It is used to optimize namespace lookup in 
  + * of a node.  It is used to optimize namespace lookup in
    * a generic DOM.
    */
   public class NSInfo
   {
  +
  +  /**
  +   * Constructor NSInfo
  +   *
  +   *
  +   * NEEDSDOC @param hasProcessedNS
  +   * NEEDSDOC @param hasXMLNSAttrs
  +   */
     public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs)
     {
  +
       m_hasProcessedNS = hasProcessedNS;
       m_hasXMLNSAttrs = hasXMLNSAttrs;
       m_namespace = null;
  @@ -73,28 +82,59 @@
     }
   
     // Unused at the moment
  -  public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs, int ancestorHasXMLNSAttrs)
  +
  +  /**
  +   * Constructor NSInfo
  +   *
  +   *
  +   * NEEDSDOC @param hasProcessedNS
  +   * NEEDSDOC @param hasXMLNSAttrs
  +   * NEEDSDOC @param ancestorHasXMLNSAttrs
  +   */
  +  public NSInfo(boolean hasProcessedNS, boolean hasXMLNSAttrs,
  +                int ancestorHasXMLNSAttrs)
     {
  +
       m_hasProcessedNS = hasProcessedNS;
       m_hasXMLNSAttrs = hasXMLNSAttrs;
       m_ancestorHasXMLNSAttrs = ancestorHasXMLNSAttrs;
       m_namespace = null;
     }
   
  +  /**
  +   * Constructor NSInfo
  +   *
  +   *
  +   * NEEDSDOC @param namespace
  +   * NEEDSDOC @param hasXMLNSAttrs
  +   */
     public NSInfo(String namespace, boolean hasXMLNSAttrs)
     {
  +
       m_hasProcessedNS = true;
       m_hasXMLNSAttrs = hasXMLNSAttrs;
       m_namespace = namespace;
       m_ancestorHasXMLNSAttrs = ANCESTORXMLNSUNPROCESSED;
     }
   
  +  /** NEEDSDOC Field m_namespace          */
     public String m_namespace;
  +
  +  /** NEEDSDOC Field m_hasXMLNSAttrs          */
     public boolean m_hasXMLNSAttrs;
  +
  +  /** NEEDSDOC Field m_hasProcessedNS          */
     public boolean m_hasProcessedNS;
  +
  +  /** NEEDSDOC Field m_ancestorHasXMLNSAttrs          */
     public int m_ancestorHasXMLNSAttrs;
  -  
  +
  +  /** NEEDSDOC Field ANCESTORXMLNSUNPROCESSED          */
     public static final int ANCESTORXMLNSUNPROCESSED = 0;
  +
  +  /** NEEDSDOC Field ANCESTORHASXMLNS          */
     public static final int ANCESTORHASXMLNS = 1;
  +
  +  /** NEEDSDOC Field ANCESTORNOXMLNS          */
     public static final int ANCESTORNOXMLNS = 2;
   }
  
  
  
  1.2       +13 -4     xml-xalan/java/src/org/apache/xalan/utils/NameSpace.java
  
  Index: NameSpace.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/NameSpace.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NameSpace.java	2000/06/19 16:53:12	1.1
  +++ NameSpace.java	2000/10/30 18:57:19	1.2
  @@ -60,19 +60,28 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * A representation of a namespace.  One of these will 
  + * A representation of a namespace.  One of these will
    * be pushed on the namespace stack for each
    * element.
    */
   public class NameSpace implements Serializable
   {
  +
  +  /** NEEDSDOC Field m_next          */
     public NameSpace m_next = null;
  +
  +  /** NEEDSDOC Field m_prefix          */
     public String m_prefix;
  -  public String m_uri; // if null, then Element namespace is empty.
  -  
  +
  +  /** NEEDSDOC Field m_uri          */
  +  public String m_uri;  // if null, then Element namespace is empty.
  +
     /**
  -   * Construct a namespace for placement on the 
  +   * Construct a namespace for placement on the
      * result tree namespace stack.
  +   *
  +   * NEEDSDOC @param prefix
  +   * NEEDSDOC @param uri
      */
     public NameSpace(String prefix, String uri)
     {
  
  
  
  1.2       +62 -3     xml-xalan/java/src/org/apache/xalan/utils/NodeConsumer.java
  
  Index: NodeConsumer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/NodeConsumer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NodeConsumer.java	2000/08/08 00:27:34	1.1
  +++ NodeConsumer.java	2000/10/30 18:57:19	1.2
  @@ -1,17 +1,76 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.utils;
   
   import org.w3c.dom.Node;
   
   /**
  - * The tree walker will test for this interface, and call 
  - * setOriginatingNode before calling the SAX event.  For creating 
  - * DOM backpointers for things that are normally created via 
  + * The tree walker will test for this interface, and call
  + * setOriginatingNode before calling the SAX event.  For creating
  + * DOM backpointers for things that are normally created via
    * SAX events.
    */
   public interface NodeConsumer
   {
  +
     /**
      * Set the node that is originating the SAX event.
  +   *
  +   * NEEDSDOC @param n
      */
     public void setOriginatingNode(Node n);
   }
  
  
  
  1.4       +282 -144  xml-xalan/java/src/org/apache/xalan/utils/NodeVector.java
  
  Index: NodeVector.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/NodeVector.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- NodeVector.java	2000/10/17 19:22:32	1.3
  +++ NodeVector.java	2000/10/30 18:57:19	1.4
  @@ -57,6 +57,7 @@
   package org.apache.xalan.utils;
   
   import java.io.Serializable;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -65,11 +66,19 @@
    */
   public class NodeVector implements Serializable, Cloneable
   {
  +
  +  /** NEEDSDOC Field m_blocksize          */
     private int m_blocksize;
  +
  +  /** NEEDSDOC Field m_map[]          */
     private Node m_map[];
  +
  +  /** NEEDSDOC Field m_firstFree          */
     protected int m_firstFree = 0;
  -  private int m_mapSize; // lazy initialization
   
  +  /** NEEDSDOC Field m_mapSize          */
  +  private int m_mapSize;  // lazy initialization
  +
     /**
      * Default constructor.
      */
  @@ -81,30 +90,41 @@
   
     /**
      * Construct a NodeVector, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public NodeVector(int blocksize)
     {
       m_blocksize = blocksize;
       m_mapSize = 0;
     }
  -  
  +
     /**
      * Get a cloned LocPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  public Object clone() throws CloneNotSupportedException
     {
  -    NodeVector clone = (NodeVector)super.clone();
  -    if((null != this.m_map) && (this.m_map == clone.m_map))
  +
  +    NodeVector clone = (NodeVector) super.clone();
  +
  +    if ((null != this.m_map) && (this.m_map == clone.m_map))
       {
         clone.m_map = new Node[this.m_map.length];
  +
         System.arraycopy(this.m_map, 0, clone.m_map, 0, this.m_map.length);
       }
  +
       return clone;
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int size()
     {
  @@ -113,360 +133,478 @@
   
     /**
      * Append a Node onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public void addElement(Node value)
     {
  -    if(null == m_map)
  +
  +    if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_map = new Node[m_blocksize];
  -      m_mapSize = m_blocksize;
  -    }
  -    else 
  -    {  
  -      if((m_firstFree+1) >= m_mapSize)
  +      if (null == m_map)
  +      {
  +        m_map = new Node[m_blocksize];
  +        m_mapSize = m_blocksize;
  +      }
  +      else
         {
  -        m_mapSize+=m_blocksize;
  +        m_mapSize += m_blocksize;
  +
           Node newMap[] = new Node[m_mapSize];
  -        System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +        System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
           m_map = newMap;
         }
  -      if (contains(value))
  -        return;
  -    }  
  +    }
  +
       m_map[m_firstFree] = value;
  +
       m_firstFree++;
     }
  -  
  +
     /**
      * Append a Node onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public final void push(Node value)
     {
  -    if(null == m_map)
  +
  +    int ff = m_firstFree;
  +
  +    if ((ff + 1) >= m_mapSize)
       {
  -      m_map = new Node[m_blocksize];
  -      m_mapSize = m_blocksize;
  -    }
  -    else 
  -    {  
  -      if((m_firstFree+1) >= m_mapSize)
  +      if (null == m_map)
  +      {
  +        m_map = new Node[m_blocksize];
  +        m_mapSize = m_blocksize;
  +      }
  +      else
         {
  -        m_mapSize+=m_blocksize;
  +        m_mapSize += m_blocksize;
  +
           Node newMap[] = new Node[m_mapSize];
  -        System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +        System.arraycopy(m_map, 0, newMap, 0, ff + 1);
  +
           m_map = newMap;
         }
  -    }  
  -    m_map[m_firstFree] = value;
  -    m_firstFree++;
  +    }
  +
  +    m_map[ff] = value;
  +
  +    ff++;
  +
  +    m_firstFree = ff;
     }
  -  
  +
     /**
      * Pop a node from the tail of the vector and return the result.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final Node pop()
     {
  +
       m_firstFree--;
  +
       Node n = m_map[m_firstFree];
  +
       m_map[m_firstFree] = null;
  +
       return n;
  +  }
  +
  +  /**
  +   * Pop a node from the tail of the vector and return the
  +   * top of the stack after the pop.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public final Node popAndTop()
  +  {
  +
  +    m_firstFree--;
  +
  +    m_map[m_firstFree] = null;
  +
  +    return (m_firstFree == 0) ? null : m_map[m_firstFree - 1];
     }
  -  
  +
     /**
      * Pop a node from the tail of the vector.
      */
     public final void popQuick()
     {
  +
       m_firstFree--;
  +
       m_map[m_firstFree] = null;
     }
  -  
  +
     /**
      * Special purpose method for TransformerImpl, pushElemTemplateElement.
      * Performance critical.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final Node peepOrNull()
     {
  -    return ((null != m_map) && (m_firstFree > 0)) 
  -           ? m_map[m_firstFree-1] 
  -             : null;
  -  }  
  +    return ((null != m_map) && (m_firstFree > 0))
  +           ? m_map[m_firstFree - 1] : null;
  +  }
   
  -  
     /**
      * Special purpose method for TransformerImpl, pushElemTemplateElement.
      * Performance critical.
  +   *
  +   * NEEDSDOC @param v1
  +   * NEEDSDOC @param v2
      */
     public final void pushPair(Node v1, Node v2)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
       {
         m_map = new Node[m_blocksize];
         m_mapSize = m_blocksize;
       }
  -    else 
  -    {  
  -      if((m_firstFree+2) >= m_mapSize)
  +    else
  +    {
  +      if ((m_firstFree + 2) >= m_mapSize)
         {
  -        m_mapSize+=m_blocksize;
  +        m_mapSize += m_blocksize;
  +
           Node newMap[] = new Node[m_mapSize];
  +
           System.arraycopy(m_map, 0, newMap, 0, m_firstFree);
  +
           m_map = newMap;
         }
  -    }  
  +    }
  +
       m_map[m_firstFree] = v1;
  -    m_map[m_firstFree+1] = v2;
  -    m_firstFree+=2;
  +    m_map[m_firstFree + 1] = v2;
  +    m_firstFree += 2;
     }
  -  
  +
     /**
      * Special purpose method for TransformerImpl, pushElemTemplateElement.
      * Performance critical.
      */
     public final void popPair()
     {
  -    m_firstFree-=2;
  +
  +    m_firstFree -= 2;
       m_map[m_firstFree] = null;
  -    m_map[m_firstFree+1] = null;
  -  } 
  -  
  +    m_map[m_firstFree + 1] = null;
  +  }
  +
     /**
      * Special purpose method for TransformerImpl, pushElemTemplateElement.
      * Performance critical.
  +   *
  +   * NEEDSDOC @param n
      */
     public final void setTail(Node n)
     {
  -    m_map[m_firstFree-1] = n;
  -  } 
  -  
  +    m_map[m_firstFree - 1] = n;
  +  }
  +
     /**
      * Special purpose method for TransformerImpl, pushElemTemplateElement.
      * Performance critical.
  +   *
  +   * NEEDSDOC @param n
      */
     public final void setTailSub1(Node n)
     {
  -    m_map[m_firstFree-2] = n;
  -  }  
  +    m_map[m_firstFree - 2] = n;
  +  }
   
     /**
      * Special purpose method for TransformerImpl, pushElemTemplateElement.
      * Performance critical.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final Node peepTail()
     {
  -    return m_map[m_firstFree-1];
  -  }  
  +    return m_map[m_firstFree - 1];
  +  }
   
     /**
      * Special purpose method for TransformerImpl, pushElemTemplateElement.
      * Performance critical.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final Node peepTailSub1()
     {
  -    return m_map[m_firstFree-2];
  -  }  
  -
  +    return m_map[m_firstFree - 2];
  +  }
   
     /**
  -   * Inserts the specified node in this vector at the specified index. 
  -   * Each component in this vector with an index greater or equal to 
  -   * the specified index is shifted upward to have an index one greater 
  -   * than the value it had previously. 
  +   * Inserts the specified node in this vector at the specified index.
  +   * Each component in this vector with an index greater or equal to
  +   * the specified index is shifted upward to have an index one greater
  +   * than the value it had previously.
  +   *
  +   * NEEDSDOC @param value
  +   * NEEDSDOC @param at
      */
     public void insertElementAt(Node value, int at)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
       {
         m_map = new Node[m_blocksize];
         m_mapSize = m_blocksize;
       }
  -    else if((m_firstFree+1) >= m_mapSize)
  +    else if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         Node newMap[] = new Node[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
  -    if(at <= (m_firstFree-1))
  +
  +    if (at <= (m_firstFree - 1))
       {
  -      System.arraycopy(m_map, at, m_map, at+1, m_firstFree-at);
  +      System.arraycopy(m_map, at, m_map, at + 1, m_firstFree - at);
       }
  +
       m_map[at] = value;
  +
       m_firstFree++;
     }
  -  
  +
     /**
  -   * Append the nodes to the list. 
  +   * Append the nodes to the list.
  +   *
  +   * NEEDSDOC @param nodes
      */
     public void appendNodes(NodeVector nodes)
     {
  +
       int nNodes = nodes.size();
  -    if(null == m_map)
  +
  +    if (null == m_map)
       {
  -      m_mapSize = nNodes+m_blocksize;
  +      m_mapSize = nNodes + m_blocksize;
         m_map = new Node[m_mapSize];
       }
  -    else if((m_firstFree+nNodes) >= m_mapSize)
  +    else if ((m_firstFree + nNodes) >= m_mapSize)
       {
  -      m_mapSize+=(nNodes+m_blocksize);
  +      m_mapSize += (nNodes + m_blocksize);
  +
         Node newMap[] = new Node[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+nNodes);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + nNodes);
  +
         m_map = newMap;
       }
  +
       System.arraycopy(nodes.m_map, 0, m_map, m_firstFree, nNodes);
  +
       m_firstFree += nNodes;
     }
   
  -
     /**
  -   * Inserts the specified node in this vector at the specified index. 
  -   * Each component in this vector with an index greater or equal to 
  -   * the specified index is shifted upward to have an index one greater 
  -   * than the value it had previously. 
  +   * Inserts the specified node in this vector at the specified index.
  +   * Each component in this vector with an index greater or equal to
  +   * the specified index is shifted upward to have an index one greater
  +   * than the value it had previously.
      */
     public void removeAllElements()
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
         return;
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
         m_map[i] = null;
       }
  +
       m_firstFree = 0;
     }
  -  
  +
     /**
  -   * Removes the first occurrence of the argument from this vector. 
  -   * If the object is found in this vector, each component in the vector 
  -   * with an index greater or equal to the object's index is shifted 
  -   * downward to have an index one smaller than the value it had 
  -   * previously. 
  +   * Removes the first occurrence of the argument from this vector.
  +   * If the object is found in this vector, each component in the vector
  +   * with an index greater or equal to the object's index is shifted
  +   * downward to have an index one smaller than the value it had
  +   * previously.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean removeElement(Node s)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
         return false;
  -    
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
         Node node = m_map[i];
  -      if((null != node) && node.equals(s))
  +
  +      if ((null != node) && node.equals(s))
         {
  -        if(i > m_firstFree)
  -          System.arraycopy(m_map, i+1, m_map, i-1, m_firstFree-i);
  +        if (i > m_firstFree)
  +          System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i);
           else
             m_map[i] = null;
  +
           m_firstFree--;
  +
           return true;
         }
       }
  +
       return false;
     }
  -  
  +
     /**
  -   * Deletes the component at the specified index. Each component in 
  -   * this vector with an index greater or equal to the specified 
  -   * index is shifted downward to have an index one smaller than 
  -   * the value it had previously. 
  +   * Deletes the component at the specified index. Each component in
  +   * this vector with an index greater or equal to the specified
  +   * index is shifted downward to have an index one smaller than
  +   * the value it had previously.
  +   *
  +   * NEEDSDOC @param i
      */
     public void removeElementAt(int i)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
         return;
  -    
  -    if(i > m_firstFree)
  -      System.arraycopy(m_map, i+1, m_map, i-1, m_firstFree-i);
  +
  +    if (i > m_firstFree)
  +      System.arraycopy(m_map, i + 1, m_map, i - 1, m_firstFree - i);
       else
         m_map[i] = null;
     }
  -  
  +
     /**
  -   * Sets the component at the specified index of this vector to be the 
  -   * specified object. The previous component at that position is discarded. 
  -   * 
  -   * The index must be a value greater than or equal to 0 and less 
  -   * than the current size of the vector. 
  +   * Sets the component at the specified index of this vector to be the
  +   * specified object. The previous component at that position is discarded.
  +   *
  +   * The index must be a value greater than or equal to 0 and less
  +   * than the current size of the vector.
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param index
      */
     public void setElementAt(Node node, int index)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
       {
         m_map = new Node[m_blocksize];
         m_mapSize = m_blocksize;
       }
  +
       m_map[index] = node;
     }
   
     /**
      * Get the nth element.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node elementAt(int i)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
         return null;
  -    
  +
       return m_map[i];
     }
  -  
  +
     /**
      * Tell if the table contains the given node.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean contains(Node s)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
         return false;
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
         Node node = m_map[i];
  -      if((null != node) && node.equals(s))
  +
  +      if ((null != node) && node.equals(s))
           return true;
       }
  +
       return false;
     }
  -  
  +
     /**
  -   * Searches for the first occurence of the given argument, 
  -   * beginning the search at index, and testing for equality 
  -   * using the equals method. 
  -   * @return the index of the first occurrence of the object 
  -   * argument in this vector at position index or later in the 
  -   * vector; returns -1 if the object is not found. 
  +   * Searches for the first occurence of the given argument,
  +   * beginning the search at index, and testing for equality
  +   * using the equals method.
  +   *
  +   * NEEDSDOC @param elem
  +   * NEEDSDOC @param index
  +   * @return the index of the first occurrence of the object
  +   * argument in this vector at position index or later in the
  +   * vector; returns -1 if the object is not found.
      */
     public int indexOf(Node elem, int index)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
         return -1;
  -    
  -    for(int i = index; i < m_firstFree; i++)
  +
  +    for (int i = index; i < m_firstFree; i++)
       {
         Node node = m_map[i];
  -      if((null != node) && node.equals(elem))
  +
  +      if ((null != node) && node.equals(elem))
           return i;
       }
  +
       return -1;
     }
   
     /**
  -   * Searches for the first occurence of the given argument, 
  -   * beginning the search at index, and testing for equality 
  -   * using the equals method. 
  -   * @return the index of the first occurrence of the object 
  -   * argument in this vector at position index or later in the 
  -   * vector; returns -1 if the object is not found. 
  +   * Searches for the first occurence of the given argument,
  +   * beginning the search at index, and testing for equality
  +   * using the equals method.
  +   *
  +   * NEEDSDOC @param elem
  +   * @return the index of the first occurrence of the object
  +   * argument in this vector at position index or later in the
  +   * vector; returns -1 if the object is not found.
      */
     public int indexOf(Node elem)
     {
  -    if(null == m_map)
  +
  +    if (null == m_map)
         return -1;
  -    
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
         Node node = m_map[i];
  -      if((null != node) && node.equals(elem))
  +
  +      if ((null != node) && node.equals(elem))
           return i;
       }
  +
       return -1;
     }
  -
  -
   }
  
  
  
  1.4       +134 -20   xml-xalan/java/src/org/apache/xalan/utils/ObjectPool.java
  
  Index: ObjectPool.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/ObjectPool.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- ObjectPool.java	2000/10/23 15:24:06	1.3
  +++ ObjectPool.java	2000/10/30 18:57:20	1.4
  @@ -1,74 +1,188 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.utils;
   
   import java.util.*;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class ObjectPool <needs-comment/>
  + */
   public class ObjectPool implements java.io.Serializable
   {
  +
  +  /** NEEDSDOC Field objectType          */
     private final Class objectType;
  +
  +  /** NEEDSDOC Field freeStack          */
     private final Vector freeStack;
   
  -  public ObjectPool(Class type) {
  +  /**
  +   * Constructor ObjectPool
  +   *
  +   *
  +   * NEEDSDOC @param type
  +   */
  +  public ObjectPool(Class type)
  +  {
       objectType = type;
       freeStack = new Vector();
     }
   
  -  public ObjectPool(Class type, int size) {
  +  /**
  +   * Constructor ObjectPool
  +   *
  +   *
  +   * NEEDSDOC @param type
  +   * NEEDSDOC @param size
  +   */
  +  public ObjectPool(Class type, int size)
  +  {
       objectType = type;
       freeStack = new Vector(size);
     }
  -  
  -  public ObjectPool() 
  +
  +  /**
  +   * Constructor ObjectPool
  +   *
  +   */
  +  public ObjectPool()
     {
       objectType = null;
       freeStack = new Vector();
     }
  -  
  -  public synchronized Object getInstanceIfFree() 
  +
  +  /**
  +   * NEEDSDOC Method getInstanceIfFree 
  +   *
  +   *
  +   * NEEDSDOC (getInstanceIfFree) @return
  +   */
  +  public synchronized Object getInstanceIfFree()
     {
  +
       // Check if the pool is empty.
  -    if (!freeStack.isEmpty()) 
  +    if (!freeStack.isEmpty())
       {
  +
         // Remove object from end of free pool.
         Object result = freeStack.lastElement();
  +
         freeStack.setSize(freeStack.size() - 1);
  +
         return result;
       }
  +
       return null;
     }
  -  
  -  public synchronized Object getInstance() 
  +
  +  /**
  +   * NEEDSDOC Method getInstance 
  +   *
  +   *
  +   * NEEDSDOC (getInstance) @return
  +   */
  +  public synchronized Object getInstance()
     {
   
       // Check if the pool is empty.
  -    if (freeStack.isEmpty()) {
  +    if (freeStack.isEmpty())
  +    {
   
         // Create a new object if so.
  -      try {
  +      try
  +      {
           return objectType.newInstance();
  -      } catch (InstantiationException ex) {}
  -        catch (IllegalAccessException ex) {}
  +      }
  +      catch (InstantiationException ex){}
  +      catch (IllegalAccessException ex){}
   
         // Throw unchecked exception for error in pool configuration.
         throw new RuntimeException("exception creating new instance for pool");
  -
  -    } else {
  +    }
  +    else
  +    {
   
         // Remove object from end of free pool.
         Object result = freeStack.lastElement();
  +
         freeStack.setSize(freeStack.size() - 1);
  +
         return result;
       }
     }
   
  -  public synchronized void freeInstance(Object obj) 
  +  /**
  +   * NEEDSDOC Method freeInstance 
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   */
  +  public synchronized void freeInstance(Object obj)
     {
  +
       // Make sure the object is of the correct type.
  -    if (objectType.isInstance(obj)) {
  +    if (objectType.isInstance(obj))
  +    {
         freeStack.addElement(obj);
  -    } else {
  +    }
  +    else
  +    {
         throw new IllegalArgumentException("argument type invalid for pool");
       }
     }
   }
  -
  -
  
  
  
  1.3       +16 -4     xml-xalan/java/src/org/apache/xalan/utils/PrefixResolver.java
  
  Index: PrefixResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/PrefixResolver.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PrefixResolver.java	2000/07/30 23:05:11	1.2
  +++ PrefixResolver.java	2000/10/30 18:57:20	1.3
  @@ -58,25 +58,37 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * The class that implements this interface can resolve prefixes 
  + * The class that implements this interface can resolve prefixes
    * to namespaces.
    */
   public interface PrefixResolver
   {
  +
     /**
  -   * Given a namespace, get the corrisponding prefix.  This assumes that 
  +   * Given a namespace, get the corrisponding prefix.  This assumes that
      * the PrevixResolver hold's it's own namespace context, or is a namespace
      * context itself.
  +   *
  +   * NEEDSDOC @param prefix
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     String getNamespaceForPrefix(String prefix);
   
     /**
      * Given a namespace, get the corrisponding prefix.
  +   *
  +   * NEEDSDOC @param prefix
  +   * NEEDSDOC @param context
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     String getNamespaceForPrefix(String prefix, org.w3c.dom.Node context);
  -  
  -  /** 
  +
  +  /**
      * Return the base identifier.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getBaseIdentifier();
   }
  
  
  
  1.3       +44 -31    xml-xalan/java/src/org/apache/xalan/utils/PrefixResolverDefault.java
  
  Index: PrefixResolverDefault.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/PrefixResolverDefault.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- PrefixResolverDefault.java	2000/07/05 14:44:02	1.2
  +++ PrefixResolverDefault.java	2000/10/30 18:57:20	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -61,46 +61,47 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * This class implements a generic PrefixResolver that 
  - * can be used to perform prefix-to-namespace lookup 
  + * This class implements a generic PrefixResolver that
  + * can be used to perform prefix-to-namespace lookup
    * for the XPath object.
    */
   public class PrefixResolverDefault implements PrefixResolver
   {
  +
     /**
  -   * The context to resolve the prefix from, if the context 
  +   * The context to resolve the prefix from, if the context
      * is not given.
      */
     Node m_context;
  -  
  +
     /**
      * The URI for the XML namespace.
      * (Duplicate of that found in org.apache.xpath.XPathContext).
      */
  -  public static final String S_XMLNAMESPACEURI = "http://www.w3.org/XML/1998/namespace";
  +  public static final String S_XMLNAMESPACEURI =
  +    "http://www.w3.org/XML/1998/namespace";
   
  -  
     /**
      * Construct a PrefixResolverDefault object.
  -   * @param xpathExpressionContext The context from 
  +   * @param xpathExpressionContext The context from
      * which XPath expression prefixes will be resolved.
  -   * Warning: This will not work correctly if xpathExpressionContext 
  +   * Warning: This will not work correctly if xpathExpressionContext
      * is an attribute node.
  -   * @param xpathExpressionContext Node from which to start searching for a 
  -   * xmlns attribute that binds a prefix to a namespace (when the namespace 
  +   * @param xpathExpressionContext Node from which to start searching for a
  +   * xmlns attribute that binds a prefix to a namespace (when the namespace
      * context is not specified in the getNamespaceForPrefix call).
      */
     public PrefixResolverDefault(Node xpathExpressionContext)
     {
       m_context = xpathExpressionContext;
     }
  -  
  +
     /**
  -   * Given a namespace, get the corrisponding prefix.  This assumes that 
  +   * Given a namespace, get the corrisponding prefix.  This assumes that
      * the PrevixResolver hold's it's own namespace context, or is a namespace
      * context itself.
      * @param prefix Prefix to resolve.
  -   * @return Namespace that prefix resolves to, or null if prefix 
  +   * @return Namespace that prefix resolves to, or null if prefix
      * is not bound.
      */
     public String getNamespaceForPrefix(String prefix)
  @@ -110,60 +111,72 @@
   
     /**
      * Given a namespace, get the corrisponding prefix.
  -   * Warning: This will not work correctly if namespaceContext 
  +   * Warning: This will not work correctly if namespaceContext
      * is an attribute node.
      * @param prefix Prefix to resolve.
  -   * @param namespaceContext Node from which to start searching for a 
  +   * @param namespaceContext Node from which to start searching for a
      * xmlns attribute that binds a prefix to a namespace.
  -   * @return Namespace that prefix resolves to, or null if prefix 
  +   * @return Namespace that prefix resolves to, or null if prefix
      * is not bound.
      */
  -  public String getNamespaceForPrefix(String prefix, org.w3c.dom.Node namespaceContext)
  +  public String getNamespaceForPrefix(String prefix,
  +                                      org.w3c.dom.Node namespaceContext)
     {
  +
       Node parent = namespaceContext;
       String namespace = null;
  -    if(prefix.equals("xml"))
  +
  +    if (prefix.equals("xml"))
       {
         namespace = S_XMLNAMESPACEURI;
       }
       else
       {
  -     int type;
  -     while ((null != parent) && (null == namespace)
  +      int type;
  +
  +      while ((null != parent) && (null == namespace)
                && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
  -                 || (type == Node.ENTITY_REFERENCE_NODE))) 
  +                 || (type == Node.ENTITY_REFERENCE_NODE)))
         {
  -        if (type == Node.ELEMENT_NODE) 
  +        if (type == Node.ELEMENT_NODE)
           {
             NamedNodeMap nnm = parent.getAttributes();
  -          for (int i = 0;  i < nnm.getLength();  i ++) 
  +
  +          for (int i = 0; i < nnm.getLength(); i++)
             {
               Node attr = nnm.item(i);
               String aname = attr.getNodeName();
               boolean isPrefix = aname.startsWith("xmlns:");
  -            if (isPrefix || aname.equals("xmlns")) 
  +
  +            if (isPrefix || aname.equals("xmlns"))
               {
                 int index = aname.indexOf(':');
  -              String p = isPrefix ? aname.substring(index+1) : "";
  -              if (p.equals(prefix)) 
  +              String p = isPrefix ? aname.substring(index + 1) : "";
  +
  +              if (p.equals(prefix))
                 {
                   namespace = attr.getNodeValue();
  +
                   break;
                 }
               }
             }
           }
  +
           parent = parent.getParentNode();
         }
       }
  +
       return namespace;
     }
  -  
  -  /** 
  +
  +  /**
      * Return the base identifier.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getBaseIdentifier()
     {
       return null;
  -  }  
  +  }
   }
  
  
  
  1.7       +179 -84   xml-xalan/java/src/org/apache/xalan/utils/QName.java
  
  Index: QName.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/QName.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- QName.java	2000/10/23 15:24:06	1.6
  +++ QName.java	2000/10/30 18:57:21	1.7
  @@ -59,40 +59,47 @@
   import java.util.Stack;
   
   import org.w3c.dom.Element;
  +
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xalan.res.XSLMessages;
   
   /**
    * <meta name="usage" content="general"/>
  - * Class to represent a qualified name: "The name of an internal XSLT object, 
  - * specifically a named template (see [7 Named Templates]), a mode (see [6.7 Modes]), 
  - * an attribute set (see [8.1.4 Named Attribute Sets]), a key (see [14.2 Keys]), 
  - * a locale (see [14.3 Number Formatting]), a variable or a parameter (see 
  - * [12 Variables and Parameters]) is specified as a QName. If it has a prefix, 
  - * then the prefix is expanded into a URI reference using the namespace declarations 
  - * in effect on the attribute in which the name occurs. The expanded name 
  - * consisting of the local part of the name and the possibly null URI reference 
  - * is used as the name of the object. The default namespace is not used for 
  + * Class to represent a qualified name: "The name of an internal XSLT object,
  + * specifically a named template (see [7 Named Templates]), a mode (see [6.7 Modes]),
  + * an attribute set (see [8.1.4 Named Attribute Sets]), a key (see [14.2 Keys]),
  + * a locale (see [14.3 Number Formatting]), a variable or a parameter (see
  + * [12 Variables and Parameters]) is specified as a QName. If it has a prefix,
  + * then the prefix is expanded into a URI reference using the namespace declarations
  + * in effect on the attribute in which the name occurs. The expanded name
  + * consisting of the local part of the name and the possibly null URI reference
  + * is used as the name of the object. The default namespace is not used for
    * unprefixed names."
    */
  -public class QName extends org.apache.serialize.QName implements java.io.Serializable
  +public class QName extends org.apache.serialize.QName
  +        implements java.io.Serializable
   {
  +
     /**
      * The XML namespace.
      */
  -  public static final String S_XMLNAMESPACEURI = "http://www.w3.org/XML/1998/namespace";
  -  
  -  
  +  public static final String S_XMLNAMESPACEURI =
  +    "http://www.w3.org/XML/1998/namespace";
  +
     /**
      * Get the namespace of the qualified name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNamespace()
     {
       return getNamespaceURI();
     }
  -  
  +
     /**
      * Get the local part of the qualified name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getLocalPart()
     {
  @@ -103,234 +110,322 @@
      * The cached hashcode, which is calculated at construction time.
      */
     private int m_hashCode;
  -  
  +
     /**
      * Return the cached hashcode of the qualified name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int hashCode()
     {
       return m_hashCode;
     }
  -    
  +
     /**
  -   * Override equals and agree that we're equal if 
  -   * the passed object is a string and it matches 
  +   * Override equals and agree that we're equal if
  +   * the passed object is a string and it matches
      * the name of the arg.
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localPart
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean equals(String ns, String localPart)
     {
  +
       String thisnamespace = getNamespaceURI();
  -    return getLocalName().equals(localPart) 
  -           && (((null != thisnamespace) && (null != ns)) 
  +
  +    return getLocalName().equals(localPart)
  +           && (((null != thisnamespace) && (null != ns))
                  ? thisnamespace.equals(ns)
  -                 : ((null == thisnamespace) && (null == ns)));
  +               : ((null == thisnamespace) && (null == ns)));
     }
   
  -
     /**
  -   * Override equals and agree that we're equal if 
  -   * the passed object is a QName and it matches 
  +   * Override equals and agree that we're equal if
  +   * the passed object is a QName and it matches
      * the name of the arg.
  +   *
  +   * NEEDSDOC @param qname
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean equals(QName qname)
     {
  +
       String thisnamespace = getNamespaceURI();
       String thatnamespace = qname.getNamespaceURI();
  -    return getLocalName().equals(qname.getLocalName()) 
  -           && (((null != thisnamespace) && (null != thatnamespace)) 
  -           ? thisnamespace.equals(thatnamespace)
  -             : ((null == thisnamespace) && (null == thatnamespace)));
  +
  +    return getLocalName().equals(qname.getLocalName())
  +           && (((null != thisnamespace) && (null != thatnamespace))
  +               ? thisnamespace.equals(thatnamespace)
  +               : ((null == thisnamespace) && (null == thatnamespace)));
     }
  -  
  +
     /**
  -   * Construct a QName from a string, without namespace resolution.  Good 
  +   * Construct a QName from a string, without namespace resolution.  Good
      * for a few odd cases.
  +   *
  +   * NEEDSDOC @param localName
      */
     public QName(String localName)
     {
  +
       super(null, localName);
  +
       m_hashCode = toString().hashCode();
     }
  -  
  +
     /**
      * Construct a QName from a namespace and a local name.
  -   * TODO: Discards the ns. Is that really intended???
  +   *
  +   * NEEDSDOC @param ns
  +   * NEEDSDOC @param localName
      */
     public QName(String ns, String localName)
     {
  -    super(null, localName);
  +
  +    super(ns, localName);
  +
       m_hashCode = toString().hashCode();
     }
  -  
  +
     /**
  -   * This function tells if a raw attribute name is a 
  +   * This function tells if a raw attribute name is a
      * xmlns attribute.
  +   *
  +   * NEEDSDOC @param attRawName
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static boolean isXMLNSDecl(String attRawName)
     {
  -    return (attRawName.startsWith("xmlns") && 
  -            (attRawName.equals("xmlns") ||
  -             attRawName.startsWith("xmlns:")));
  +
  +    return (attRawName.startsWith("xmlns")
  +            && (attRawName.equals("xmlns")
  +                || attRawName.startsWith("xmlns:")));
     }
   
     /**
  -   * This function tells if a raw attribute name is a 
  +   * This function tells if a raw attribute name is a
      * xmlns attribute.
  +   *
  +   * NEEDSDOC @param attRawName
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static String getPrefixFromXMLNSDecl(String attRawName)
     {
  +
       int index = attRawName.indexOf(':');
  -    return (index >= 0) ? attRawName.substring(index+1) : "";
  +
  +    return (index >= 0) ? attRawName.substring(index + 1) : "";
     }
   
     /**
      * Returns the local name of the given node.
  +   *
  +   * NEEDSDOC @param qname
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static String getLocalPart(String qname)
     {
  +
       int index = qname.indexOf(':');
  -    return (index < 0) ? qname : qname.substring(index+1);
  +
  +    return (index < 0) ? qname : qname.substring(index + 1);
     }
   
     /**
      * Returns the local name of the given node.
  +   *
  +   * NEEDSDOC @param qname
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static String getPrefixPart(String qname)
     {
  +
       int index = qname.indexOf(':');
  +
       return (index >= 0) ? qname.substring(0, index) : "";
     }
  -  
  +
     /**
  -   * Construct a QName from a string, resolving the prefix 
  -   * using the given namespace stack. The default namespace is 
  +   * Construct a QName from a string, resolving the prefix
  +   * using the given namespace stack. The default namespace is
      * not resolved.
  +   *
  +   * NEEDSDOC @param qname
  +   * NEEDSDOC @param namespaces
      */
     public QName(String qname, Stack namespaces)
     {
  +
       String namespace = null;
       String prefix = null;
  -
       int indexOfNSSep = qname.indexOf(':');
  -    if(indexOfNSSep > 0)
  +
  +    if (indexOfNSSep > 0)
       {
         prefix = qname.substring(0, indexOfNSSep);
  -      if(prefix.equals("xml"))
  +
  +      if (prefix.equals("xml"))
         {
           namespace = S_XMLNAMESPACEURI;
         }
  -      else if(prefix.equals("xmlns"))
  +      else if (prefix.equals("xmlns"))
         {
           return;
         }
         else
         {
           int depth = namespaces.size();
  -        for(int i = depth-1; i >= 0; i--)
  +
  +        for (int i = depth - 1; i >= 0; i--)
           {
  -          NameSpace ns = (NameSpace)namespaces.elementAt(i);
  -          while(null != ns)
  +          NameSpace ns = (NameSpace) namespaces.elementAt(i);
  +
  +          while (null != ns)
             {
  -            if((null != ns.m_prefix) && prefix.equals(ns.m_prefix))
  +            if ((null != ns.m_prefix) && prefix.equals(ns.m_prefix))
               {
                 namespace = ns.m_uri;
                 i = -1;
  +
                 break;
               }
  +
               ns = ns.m_next;
             }
           }
  -      }  
  -      if(null == namespace)
  +      }
  +
  +      if (null == namespace)
         {
  -        throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE, new Object[]{prefix})); //"Prefix must resolve to a namespace: "+prefix);
  +        throw new RuntimeException(
  +          XSLMessages.createXPATHMessage(
  +            XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
  +            new Object[]{ prefix }));  //"Prefix must resolve to a namespace: "+prefix);
         }
       }
  -    _localName = (indexOfNSSep < 0) ? qname : qname.substring(indexOfNSSep+1);
  +
  +    _localName = (indexOfNSSep < 0)
  +                 ? qname : qname.substring(indexOfNSSep + 1);
       _namespaceURI = namespace;
       _prefix = prefix;
       m_hashCode = toString().hashCode();
     }
  -  
  +
     /**
  -   * Construct a QName from a string, resolving the prefix 
  -   * using the given namespace stack. The default namespace is 
  +   * Construct a QName from a string, resolving the prefix
  +   * using the given namespace stack. The default namespace is
      * not resolved.
  +   *
  +   * NEEDSDOC @param qname
  +   * NEEDSDOC @param namespaceContext
  +   * NEEDSDOC @param resolver
      */
  -  public QName(String qname, Element namespaceContext, PrefixResolver resolver)
  +  public QName(String qname, Element namespaceContext,
  +               PrefixResolver resolver)
     {
  +
       _namespaceURI = null;
   
       int indexOfNSSep = qname.indexOf(':');
  -    if(indexOfNSSep > 0)
  +
  +    if (indexOfNSSep > 0)
       {
  -      if(null != namespaceContext)
  +      if (null != namespaceContext)
         {
           String prefix = qname.substring(0, indexOfNSSep);
  +
           _prefix = prefix;
  -        if(prefix.equals("xml"))
  +
  +        if (prefix.equals("xml"))
           {
             _namespaceURI = S_XMLNAMESPACEURI;
           }
           else
           {
  -          _namespaceURI = resolver.getNamespaceForPrefix(prefix, namespaceContext);
  -        }  
  -        if(null == _namespaceURI)
  +          _namespaceURI = resolver.getNamespaceForPrefix(prefix,
  +                  namespaceContext);
  +        }
  +
  +        if (null == _namespaceURI)
           {
  -          throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE, new Object[]{prefix})); //"Prefix must resolve to a namespace: "+prefix);
  +          throw new RuntimeException(
  +            XSLMessages.createXPATHMessage(
  +              XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
  +              new Object[]{ prefix }));  //"Prefix must resolve to a namespace: "+prefix);
           }
         }
         else
         {
  +
           // TODO: error or warning...
         }
       }
  -    
  -    _localName = (indexOfNSSep < 0) ? qname : qname.substring(indexOfNSSep+1);
  +
  +    _localName = (indexOfNSSep < 0)
  +                 ? qname : qname.substring(indexOfNSSep + 1);
       m_hashCode = toString().hashCode();
     }
  -  
  +
     /**
  -   * Construct a QName from a string, resolving the prefix 
  -   * using the given namespace stack. The default namespace is 
  +   * Construct a QName from a string, resolving the prefix
  +   * using the given namespace stack. The default namespace is
      * not resolved.
  +   *
  +   * NEEDSDOC @param qname
  +   * NEEDSDOC @param resolver
      */
     public QName(String qname, PrefixResolver resolver)
     {
  +
       _namespaceURI = null;
   
       int indexOfNSSep = qname.indexOf(':');
  -    if(indexOfNSSep > 0)
  +
  +    if (indexOfNSSep > 0)
       {
         String prefix = qname.substring(0, indexOfNSSep);
  -      if(prefix.equals("xml"))
  +
  +      if (prefix.equals("xml"))
         {
           _namespaceURI = S_XMLNAMESPACEURI;
         }
         else
         {
           _namespaceURI = resolver.getNamespaceForPrefix(prefix);
  -      }  
  -      if(null == _namespaceURI)
  +      }
  +
  +      if (null == _namespaceURI)
         {
  -        throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_PREFIX_MUST_RESOLVE, new Object[]{prefix})); //"Prefix must resolve to a namespace: "+prefix);
  +        throw new RuntimeException(
  +          XSLMessages.createXPATHMessage(
  +            XPATHErrorResources.ER_PREFIX_MUST_RESOLVE,
  +            new Object[]{ prefix }));  //"Prefix must resolve to a namespace: "+prefix);
         }
       }
  -    
  -    _localName = (indexOfNSSep < 0) ? qname : qname.substring(indexOfNSSep+1);
  +
  +    _localName = (indexOfNSSep < 0)
  +                 ? qname : qname.substring(indexOfNSSep + 1);
       m_hashCode = toString().hashCode();
     }
  -  
  +
     /**
  -   * Return the string representation of the namespace. Performs 
  +   * Return the string representation of the namespace. Performs
      * string concatenation, so beware of performance issues.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String toString()
     {
  -    return (null != this._namespaceURI) 
  -           ? (this._namespaceURI + ":" + this._localName) 
  -             : this._localName;
  +    return (null != this._namespaceURI)
  +           ? (this._namespaceURI + ":" + this._localName) : this._localName;
     }
   
     /** Serializable objects seem to require a public no-args constructor.
  
  
  
  1.2       +9 -2      xml-xalan/java/src/org/apache/xalan/utils/RawCharacterHandler.java
  
  Index: RawCharacterHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/RawCharacterHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RawCharacterHandler.java	2000/06/19 16:53:13	1.1
  +++ RawCharacterHandler.java	2000/10/30 18:57:21	1.2
  @@ -58,14 +58,21 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * An interface that a Serializer/ContentHandler/ContentHandler must 
  + * An interface that a Serializer/ContentHandler/ContentHandler must
    * implement in order for disable-output-escaping to work.
    */
   public interface RawCharacterHandler
   {
  +
     /**
      * Serialize the characters without escaping.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void charactersRaw (char ch[], int start, int length)
  +  public void charactersRaw(char ch[], int start, int length)
       throws org.xml.sax.SAXException;
   }
  
  
  
  1.3       +79 -6     xml-xalan/java/src/org/apache/xalan/utils/StringBufferPool.java
  
  Index: StringBufferPool.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/StringBufferPool.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- StringBufferPool.java	2000/10/18 04:36:46	1.2
  +++ StringBufferPool.java	2000/10/30 18:57:22	1.3
  @@ -1,19 +1,92 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.utils;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class StringBufferPool <needs-comment/>
  + */
   public class StringBufferPool
   {
  -  private static ObjectPool m_stringBufPool 
  -    = new ObjectPool(org.apache.xalan.utils.FastStringBuffer.class);
  -  
  +
  +  /** NEEDSDOC Field m_stringBufPool          */
  +  private static ObjectPool m_stringBufPool =
  +    new ObjectPool(org.apache.xalan.utils.FastStringBuffer.class);
  +
  +  /**
  +   * NEEDSDOC Method get 
  +   *
  +   *
  +   * NEEDSDOC (get) @return
  +   */
     public static FastStringBuffer get()
     {
  -    return (FastStringBuffer)m_stringBufPool.getInstance();
  +    return (FastStringBuffer) m_stringBufPool.getInstance();
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method free 
  +   *
  +   *
  +   * NEEDSDOC @param sb
  +   */
     public static void free(FastStringBuffer sb)
     {
       m_stringBufPool.freeInstance(sb);
       sb.setLength(0);
     }
  -  
   }
  
  
  
  1.2       +28 -4     xml-xalan/java/src/org/apache/xalan/utils/StringKey.java
  
  Index: StringKey.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/StringKey.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringKey.java	2000/06/19 16:53:13	1.1
  +++ StringKey.java	2000/10/30 18:57:22	1.2
  @@ -58,25 +58,49 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * Simple class for fast lookup of string values, when used with 
  + * Simple class for fast lookup of string values, when used with
    * hashtables.  This class caches the hash value of the string.
    */
   public class StringKey extends Object
   {
  +
  +  /** NEEDSDOC Field m_str          */
     private String m_str;
  +
  +  /** NEEDSDOC Field m_hash          */
     int m_hash;
  -    
  +
  +  /**
  +   * Constructor StringKey
  +   *
  +   *
  +   * NEEDSDOC @param key
  +   */
     public StringKey(String key)
     {
       m_str = key;
       m_hash = key.hashCode();
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method hashCode 
  +   *
  +   *
  +   * NEEDSDOC (hashCode) @return
  +   */
     public int hashCode()
     {
       return m_hash;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method equals 
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC (equals) @return
  +   */
     public final boolean equals(Object obj)
     {
       return obj.equals(m_str);
  
  
  
  1.2       +66 -23    xml-xalan/java/src/org/apache/xalan/utils/StringToIntTable.java
  
  Index: StringToIntTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/StringToIntTable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToIntTable.java	2000/06/19 16:53:13	1.1
  +++ StringToIntTable.java	2000/10/30 18:57:23	1.2
  @@ -58,42 +58,58 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * A very simple lookup table that stores a list of strings, the even 
  + * A very simple lookup table that stores a list of strings, the even
    * number strings being keys, and the odd number strings being values.
    */
   public class StringToIntTable
   {
  +
  +  /** NEEDSDOC Field m_blocksize          */
     private int m_blocksize;
  +
  +  /** NEEDSDOC Field m_map[]          */
     private String m_map[];
  +
  +  /** NEEDSDOC Field m_values[]          */
     private int m_values[];
  +
  +  /** NEEDSDOC Field m_firstFree          */
     private int m_firstFree = 0;
  +
  +  /** NEEDSDOC Field m_mapSize          */
     private int m_mapSize;
   
     /**
  -   * Default constructor.  Note that the default 
  +   * Default constructor.  Note that the default
      * block size is very small, for small lists.
      */
     public StringToIntTable()
     {
  +
       m_blocksize = 8;
       m_mapSize = m_blocksize;
  -    m_map = new String[m_blocksize]; 
  -    m_values = new int[m_blocksize]; 
  +    m_map = new String[m_blocksize];
  +    m_values = new int[m_blocksize];
     }
   
     /**
      * Construct a StringToIntTable, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public StringToIntTable(int blocksize)
     {
  +
       m_blocksize = blocksize;
       m_mapSize = blocksize;
  -    m_map = new String[blocksize]; 
  -    m_values = new int[m_blocksize]; 
  +    m_map = new String[blocksize];
  +    m_values = new int[m_blocksize];
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int getLength()
     {
  @@ -102,66 +118,93 @@
   
     /**
      * Append a string onto the vector.
  +   *
  +   * NEEDSDOC @param key
  +   * NEEDSDOC @param value
      */
     public final void put(String key, int value)
     {
  -    if((m_firstFree+1) >= m_mapSize)
  +
  +    if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         String newMap[] = new String[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
   
         int newValues[] = new int[m_mapSize];
  -      System.arraycopy(m_values, 0, newValues, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_values, 0, newValues, 0, m_firstFree + 1);
  +
         m_values = newValues;
       }
  +
       m_map[m_firstFree] = key;
       m_values[m_firstFree] = value;
  +
       m_firstFree++;
     }
  -  
  +
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int get(String key)
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i].equals(key))
  +      if (m_map[i].equals(key))
           return m_values[i];
       }
  +
       return -10000;  // Bogus value, needs to throw exception.
     }
  -  
   
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int getIgnoreCase(String key)
     {
  -    if(null == key)
  +
  +    if (null == key)
         return -10000;  // Bogus value, needs to throw exception.
  -    
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i].equalsIgnoreCase(key))
  +      if (m_map[i].equalsIgnoreCase(key))
           return m_values[i];
       }
  +
       return -10000;  // Bogus value, needs to throw exception.
     }
  -  
  +
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean contains(String key)
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i].equals(key))
  +      if (m_map[i].equals(key))
           return true;
       }
  +
       return false;
     }
  -
   }
  
  
  
  1.2       +95 -34    xml-xalan/java/src/org/apache/xalan/utils/StringToStringTable.java
  
  Index: StringToStringTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/StringToStringTable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToStringTable.java	2000/06/19 16:53:13	1.1
  +++ StringToStringTable.java	2000/10/30 18:57:23	1.2
  @@ -58,39 +58,53 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * A very simple lookup table that stores a list of strings, the even 
  + * A very simple lookup table that stores a list of strings, the even
    * number strings being keys, and the odd number strings being values.
    */
   public class StringToStringTable
   {
  +
  +  /** NEEDSDOC Field m_blocksize          */
     private int m_blocksize;
  +
  +  /** NEEDSDOC Field m_map[]          */
     private String m_map[];
  +
  +  /** NEEDSDOC Field m_firstFree          */
     private int m_firstFree = 0;
  +
  +  /** NEEDSDOC Field m_mapSize          */
     private int m_mapSize;
   
     /**
  -   * Default constructor.  Note that the default 
  +   * Default constructor.  Note that the default
      * block size is very small, for small lists.
      */
     public StringToStringTable()
     {
  +
       m_blocksize = 16;
       m_mapSize = m_blocksize;
  -    m_map = new String[m_blocksize]; 
  +    m_map = new String[m_blocksize];
     }
   
     /**
      * Construct a StringToStringTable, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public StringToStringTable(int blocksize)
     {
  +
       m_blocksize = blocksize;
       m_mapSize = blocksize;
  -    m_map = new String[blocksize]; 
  +    m_map = new String[blocksize];
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int getLength()
     {
  @@ -99,117 +113,164 @@
   
     /**
      * Append a string onto the vector.
  +   *
  +   * NEEDSDOC @param key
  +   * NEEDSDOC @param value
      */
     public final void put(String key, String value)
     {
  -    if((m_firstFree+2) >= m_mapSize)
  +
  +    if ((m_firstFree + 2) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         String newMap[] = new String[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
  +
       m_map[m_firstFree] = key;
  +
       m_firstFree++;
  +
       m_map[m_firstFree] = value;
  +
       m_firstFree++;
     }
  -  
  +
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String get(String key)
     {
  -    for(int i = 0; i < m_firstFree; i+=2)
  +
  +    for (int i = 0; i < m_firstFree; i += 2)
       {
  -      if(m_map[i].equals(key))
  -        return m_map[i+1];
  +      if (m_map[i].equals(key))
  +        return m_map[i + 1];
       }
  +
       return null;
     }
  -  
  +
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param key
      */
     public final void remove(String key)
     {
  -    for(int i = 0; i < m_firstFree; i+=2)
  +
  +    for (int i = 0; i < m_firstFree; i += 2)
       {
  -      if(m_map[i].equals(key))
  +      if (m_map[i].equals(key))
         {
  -        if((i+2) < m_firstFree)
  -          System.arraycopy(m_map, i+2, m_map, i, m_firstFree-(i+2));
  +        if ((i + 2) < m_firstFree)
  +          System.arraycopy(m_map, i + 2, m_map, i, m_firstFree - (i + 2));
  +
           m_firstFree -= 2;
           m_map[m_firstFree] = null;
  -        m_map[m_firstFree+1] = null;
  +        m_map[m_firstFree + 1] = null;
  +
           break;
         }
       }
     }
   
  -
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String getIgnoreCase(String key)
     {
  -    if(null == key)
  +
  +    if (null == key)
         return null;
  -    
  -    for(int i = 0; i < m_firstFree; i+=2)
  +
  +    for (int i = 0; i < m_firstFree; i += 2)
       {
  -      if(m_map[i].equalsIgnoreCase(key))
  -        return m_map[i+1];
  +      if (m_map[i].equalsIgnoreCase(key))
  +        return m_map[i + 1];
       }
  +
       return null;
     }
   
     /**
      * Tell if the table contains the given string in the value.
  +   *
  +   * NEEDSDOC @param val
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String getByValue(String val)
     {
  -    for(int i = 1; i < m_firstFree; i+=2)
  +
  +    for (int i = 1; i < m_firstFree; i += 2)
       {
  -      if(m_map[i].equals(val))
  -        return m_map[i-1];
  +      if (m_map[i].equals(val))
  +        return m_map[i - 1];
       }
  +
       return null;
     }
   
  -  
     /**
      * Get the nth element.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String elementAt(int i)
     {
       return m_map[i];
     }
  -  
  +
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean contains(String key)
     {
  -    for(int i = 0; i < m_firstFree; i+=2)
  +
  +    for (int i = 0; i < m_firstFree; i += 2)
       {
  -      if(m_map[i].equals(key))
  +      if (m_map[i].equals(key))
           return true;
       }
  +
       return false;
     }
   
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param val
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean containsValue(String val)
     {
  -    for(int i = 1; i < m_firstFree; i+=2)
  +
  +    for (int i = 1; i < m_firstFree; i += 2)
       {
  -      if(m_map[i].equals(val))
  +      if (m_map[i].equals(val))
           return true;
       }
  +
       return false;
     }
  -
   }
  
  
  
  1.2       +65 -18    xml-xalan/java/src/org/apache/xalan/utils/StringToStringTableVector.java
  
  Index: StringToStringTableVector.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/StringToStringTableVector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringToStringTableVector.java	2000/06/19 16:53:13	1.1
  +++ StringToStringTableVector.java	2000/10/30 18:57:23	1.2
  @@ -58,39 +58,53 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * A very simple table that stores a list of StringToStringTables, optimized 
  + * A very simple table that stores a list of StringToStringTables, optimized
    * for small lists.
    */
   public class StringToStringTableVector
   {
  +
  +  /** NEEDSDOC Field m_blocksize          */
     private int m_blocksize;
  +
  +  /** NEEDSDOC Field m_map[]          */
     private StringToStringTable m_map[];
  +
  +  /** NEEDSDOC Field m_firstFree          */
     private int m_firstFree = 0;
  +
  +  /** NEEDSDOC Field m_mapSize          */
     private int m_mapSize;
   
     /**
  -   * Default constructor.  Note that the default 
  +   * Default constructor.  Note that the default
      * block size is very small, for small lists.
      */
     public StringToStringTableVector()
     {
  +
       m_blocksize = 8;
       m_mapSize = m_blocksize;
  -    m_map = new StringToStringTable[m_blocksize]; 
  +    m_map = new StringToStringTable[m_blocksize];
     }
   
     /**
      * Construct a StringToStringTableVector, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public StringToStringTableVector(int blocksize)
     {
  +
       m_blocksize = blocksize;
       m_mapSize = blocksize;
  -    m_map = new StringToStringTable[blocksize]; 
  +    m_map = new StringToStringTable[blocksize];
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int getLength()
     {
  @@ -99,6 +113,8 @@
   
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int size()
     {
  @@ -107,46 +123,67 @@
   
     /**
      * Append a string onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public final void addElement(StringToStringTable value)
     {
  -    if((m_firstFree+1) >= m_mapSize)
  +
  +    if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         StringToStringTable newMap[] = new StringToStringTable[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
  +
       m_map[m_firstFree] = value;
  +
       m_firstFree++;
     }
  -  
  +
     /**
      * Given a string, find the last added occurance value
      * that matches the key.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String get(String key)
     {
  -    for(int i=m_firstFree-1; i >= 0; --i)
  +
  +    for (int i = m_firstFree - 1; i >= 0; --i)
       {
         String nsuri = m_map[i].get(key);
  +
         if (nsuri != null)
           return nsuri;
       }
  +
       return null;
     }
   
     /**
      * Given a string, find the last added occurance value
      * that matches the key.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean containsKey(String key)
     {
  -    for(int i=m_firstFree-1; i >= 0; --i)
  +
  +    for (int i = m_firstFree - 1; i >= 0; --i)
       {
         if (m_map[i].get(key) != null)
           return true;
       }
  +
       return false;
     }
   
  @@ -155,33 +192,43 @@
      */
     public final void removeLastElem()
     {
  -    if(m_firstFree > 0)
  +
  +    if (m_firstFree > 0)
       {
         m_map[m_firstFree] = null;
  +
         m_firstFree--;
       }
     }
  -  
  +
     /**
      * Get the nth element.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final StringToStringTable elementAt(int i)
     {
       return m_map[i];
     }
  -  
  +
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean contains(StringToStringTable s)
     {
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i].equals(s))
  +      if (m_map[i].equals(s))
           return true;
       }
  +
       return false;
     }
  -
  -
   }
  
  
  
  1.2       +80 -23    xml-xalan/java/src/org/apache/xalan/utils/StringVector.java
  
  Index: StringVector.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/StringVector.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- StringVector.java	2000/06/19 16:53:13	1.1
  +++ StringVector.java	2000/10/30 18:57:24	1.2
  @@ -58,39 +58,53 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * A very simple table that stores a list of strings, optimized 
  + * A very simple table that stores a list of strings, optimized
    * for small lists.
    */
   public class StringVector
   {
  +
  +  /** NEEDSDOC Field m_blocksize          */
     protected int m_blocksize;
  +
  +  /** NEEDSDOC Field m_map[]          */
     protected String m_map[];
  +
  +  /** NEEDSDOC Field m_firstFree          */
     protected int m_firstFree = 0;
  +
  +  /** NEEDSDOC Field m_mapSize          */
     protected int m_mapSize;
   
     /**
  -   * Default constructor.  Note that the default 
  +   * Default constructor.  Note that the default
      * block size is very small, for small lists.
      */
     public StringVector()
     {
  +
       m_blocksize = 8;
       m_mapSize = m_blocksize;
  -    m_map = new String[m_blocksize]; 
  +    m_map = new String[m_blocksize];
     }
   
     /**
      * Construct a StringVector, using the given block size.
  +   *
  +   * NEEDSDOC @param blocksize
      */
     public StringVector(int blocksize)
     {
  +
       m_blocksize = blocksize;
       m_mapSize = blocksize;
  -    m_map = new String[blocksize]; 
  +    m_map = new String[blocksize];
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getLength()
     {
  @@ -99,6 +113,8 @@
   
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final int size()
     {
  @@ -107,94 +123,135 @@
   
     /**
      * Append a string onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public final void addElement(String value)
     {
  -    if((m_firstFree+1) >= m_mapSize)
  +
  +    if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         String newMap[] = new String[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
  +
       m_map[m_firstFree] = value;
  +
       m_firstFree++;
     }
  -  
  +
     /**
      * Get the nth element.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String elementAt(int i)
     {
       return m_map[i];
     }
  -  
  +
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean contains(String s)
     {
  -    if(null == s)
  +
  +    if (null == s)
         return false;
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i].equals(s))
  +      if (m_map[i].equals(s))
           return true;
       }
  +
       return false;
     }
   
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final boolean containsIgnoreCase(String s)
     {
  -    if(null == s)
  +
  +    if (null == s)
         return false;
  -    for(int i = 0; i < m_firstFree; i++)
  +
  +    for (int i = 0; i < m_firstFree; i++)
       {
  -      if(m_map[i].equalsIgnoreCase(s))
  +      if (m_map[i].equalsIgnoreCase(s))
           return true;
       }
  +
       return false;
     }
   
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC @param s
      */
     public final void push(String s)
     {
  -    if((m_firstFree+1) >= m_mapSize)
  +
  +    if ((m_firstFree + 1) >= m_mapSize)
       {
  -      m_mapSize+=m_blocksize;
  +      m_mapSize += m_blocksize;
  +
         String newMap[] = new String[m_mapSize];
  -      System.arraycopy(m_map, 0, newMap, 0, m_firstFree+1);
  +
  +      System.arraycopy(m_map, 0, newMap, 0, m_firstFree + 1);
  +
         m_map = newMap;
       }
  +
       m_map[m_firstFree] = s;
  +
       m_firstFree++;
     }
   
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String pop()
     {
  -    if(m_firstFree <= 0)
  +
  +    if (m_firstFree <= 0)
         return null;
  -    
  +
       m_firstFree--;
  +
       String s = m_map[m_firstFree];
  +
       m_map[m_firstFree] = null;
  +
       return s;
     }
   
     /**
      * Tell if the table contains the given string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final String peek()
     {
  -    return (m_firstFree <= 0) ? null : m_map[m_firstFree-1];
  +    return (m_firstFree <= 0) ? null : m_map[m_firstFree - 1];
     }
  -
   }
  
  
  
  1.9       +48 -20    xml-xalan/java/src/org/apache/xalan/utils/SystemIDResolver.java
  
  Index: SystemIDResolver.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/SystemIDResolver.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SystemIDResolver.java	2000/10/18 16:18:17	1.8
  +++ SystemIDResolver.java	2000/10/30 18:57:24	1.9
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,72 +57,100 @@
   package org.apache.xalan.utils;
   
   import org.xml.sax.SAXException;
  +
   import org.apache.xalan.utils.URI;
   import org.apache.xalan.utils.URI.MalformedURIException;
   
   import java.io.*;
  +
   import java.lang.StringBuffer;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class SystemIDResolver <needs-comment/>
  + */
   public class SystemIDResolver
  -{  
  -  
  +{
  +
  +  /**
  +   * NEEDSDOC Method getAbsoluteURIFromRelative 
  +   *
  +   *
  +   * NEEDSDOC @param uri
  +   *
  +   * NEEDSDOC (getAbsoluteURIFromRelative) @return
  +   */
     public static String getAbsoluteURIFromRelative(String uri)
     {
  +
       String curdir = System.getProperty("user.dir");
  -    if(null != curdir)
  +
  +    if (null != curdir)
       {
  -      uri = "file:///"+curdir+System.getProperty("file.separator")+uri;
  +      uri = "file:///" + curdir + System.getProperty("file.separator") + uri;
       }
  -    if(null != uri  && (uri.indexOf('\\') > -1))
  +
  +    if (null != uri && (uri.indexOf('\\') > -1))
         uri = uri.replace('\\', '/');
  +
       return uri;
     }
  -  
  +
     /**
      * Take a SystemID string and try and turn it into a good absolute URL.
  +   *
  +   * NEEDSDOC @param urlString
  +   * NEEDSDOC @param base
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception SAXException thrown if the string can't be turned into a URL.
      */
     public static String getAbsoluteURI(String urlString, String base)
  -    throws SAXException 
  +          throws SAXException
     {
  -    if((urlString.indexOf(':') < 0) && (null != base) && 
  -       (base.indexOf(':') < 0))
  +
  +    if ((urlString.indexOf(':') < 0) && (null != base)
  +            && (base.indexOf(':') < 0))
       {
         base = getAbsoluteURIFromRelative(base);
       }
   
       // bit of a hack here.  Need to talk to URI person to see if this can be fixed.
  -    if((null != base) && 
  -       urlString.startsWith("file:") && (urlString.charAt(5) != '/'))
  +    if ((null != base) && urlString.startsWith("file:")
  +            && (urlString.charAt(5) != '/'))
       {
         urlString = urlString.substring(5);
       }
  -    
  +
       // This is probably a bad idea, we should at least check for quotes...
  -    if(null != base  && (base.indexOf('\\') > -1))
  +    if (null != base && (base.indexOf('\\') > -1))
         base = base.replace('\\', '/');
  -    if(null != urlString  && (urlString.indexOf('\\') > -1))
  +
  +    if (null != urlString && (urlString.indexOf('\\') > -1))
         urlString = urlString.replace('\\', '/');
  -    
  +
       URI uri;
  +
       try
       {
  -      if((null == base) || (base.length() == 0))
  +      if ((null == base) || (base.length() == 0))
         {
           uri = new URI(urlString);
         }
         else
         {
           URI baseURI = new URI(base);
  +
           uri = new URI(baseURI, urlString);
         }
       }
  -    catch(MalformedURIException mue)
  +    catch (MalformedURIException mue)
       {
         throw new SAXException(mue);
       }
  +
       String uriStr = uri.toString();
  -    
  +
       return uriStr;
     }
   }
  
  
  
  1.9       +217 -136  xml-xalan/java/src/org/apache/xalan/utils/TreeWalker.java
  
  Index: TreeWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/TreeWalker.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- TreeWalker.java	2000/10/13 02:33:14	1.8
  +++ TreeWalker.java	2000/10/30 18:57:25	1.9
  @@ -57,12 +57,13 @@
   package org.apache.xalan.utils;
   
   import org.w3c.dom.*;
  +
   import org.xml.sax.*;
   import org.xml.sax.ext.LexicalHandler;
  +
   import org.apache.xpath.DOM2Helper;
   import org.apache.xpath.DOMHelper;
   import org.apache.xalan.utils.NodeConsumer;
  -
   import org.apache.serialize.SerializerHandler;
   
   /**
  @@ -72,94 +73,128 @@
    */
   public class TreeWalker
   {
  -  private ContentHandler m_contentHandler =   null;
  -  
  +
  +  /** NEEDSDOC Field m_contentHandler          */
  +  private ContentHandler m_contentHandler = null;
  +
     // ARGHH!!  JAXP Uses Xerces without setting the namespace processing to ON!
     // DOM2Helper m_dh = new DOM2Helper();
  +
  +  /** NEEDSDOC Field m_dh          */
     protected DOMHelper m_dh = new DOM2Helper();
  -  
  +
     /**
      * Get the ContentHandler used for the tree walk.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public ContentHandler getFormatterListener()
     {
       return m_contentHandler;
     }
  -  
  +
     /**
      * Constructor.
  -   * @param   formatterListener The implemention of the 
  +   * @param   formatterListener The implemention of the
      * FormatterListener operation (toXMLString, digest, ...)
      */
  -  public TreeWalker(ContentHandler formatterListener) 
  +  public TreeWalker(ContentHandler formatterListener)
     {
       this.m_contentHandler = formatterListener;
     }
   
     /**
      * Perform a pre-order traversal non-recursive style.
  +   *
  +   * NEEDSDOC @param pos
  +   *
  +   * @throws SAXException
      */
  -  public void traverse(Node pos) throws SAXException 
  +  public void traverse(Node pos) throws SAXException
     {
  -    Node top = pos;
    while(null != pos)
  -    {     
  +
  +    Node top = pos;
  +
  +    while (null != pos)
  +    {
         startNode(pos);
  -      
  +
         Node nextNode = pos.getFirstChild();
  -      while(null == nextNode)
  +
  +      while (null == nextNode)
         {
           endNode(pos);
  -        if(top.equals( pos ))
  +
  +        if (top.equals(pos))
             break;
  +
           nextNode = pos.getNextSibling();
  -        if(null == nextNode)
  +
  +        if (null == nextNode)
           {
             pos = pos.getParentNode();
  -          if((null == pos) || (top.equals( pos )))
  +
  +          if ((null == pos) || (top.equals(pos)))
             {
  -            if(null != pos)
  +            if (null != pos)
                 endNode(pos);
  +
               nextNode = null;
  +
               break;
             }
           }
         }
  +
         pos = nextNode;
       }
     }
   
     /**
      * Perform a pre-order traversal non-recursive style.
  +   *
  +   * NEEDSDOC @param pos
  +   * NEEDSDOC @param top
  +   *
  +   * @throws SAXException
      */
  -  public void traverse(Node pos, Node top) throws SAXException 
  +  public void traverse(Node pos, Node top) throws SAXException
     {
  -    while(null != pos)
  -    {     
  +
  +    while (null != pos)
  +    {
         startNode(pos);
  -      
  +
         Node nextNode = pos.getFirstChild();
  -      while(null == nextNode)
  +
  +      while (null == nextNode)
         {
           endNode(pos);
  -        if((null != top) && top.equals( pos ))
  +
  +        if ((null != top) && top.equals(pos))
             break;
  +
           nextNode = pos.getNextSibling();
  -        if(null == nextNode)
  +
  +        if (null == nextNode)
           {
             pos = pos.getParentNode();
  -          if((null == pos) || ((null != top) && top.equals( pos )))
  +
  +          if ((null == pos) || ((null != top) && top.equals(pos)))
             {
               nextNode = null;
  +
               break;
             }
           }
         }
  +
         pos = nextNode;
       }
     }
  -  
  +
     /*
  -  public void traverse(Node pos) throws SAXException 
  +  public void traverse(Node pos) throws SAXException
     {
       startNode(pos);
       NodeList children = pos.getChildNodes();
  @@ -174,174 +209,220 @@
       endNode(pos);
     }
     */
  -  
  +
  +  /** NEEDSDOC Field nextIsRaw          */
     boolean nextIsRaw = false;
  -  
  -  protected void startNode(Node node)
  -    throws SAXException 
  +
  +  /**
  +   * NEEDSDOC Method startNode 
  +   *
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * @throws SAXException
  +   */
  +  protected void startNode(Node node) throws SAXException
     {
  -    if(m_contentHandler instanceof NodeConsumer)
  +
  +    if (m_contentHandler instanceof NodeConsumer)
       {
  -      ((NodeConsumer)m_contentHandler).setOriginatingNode(node);
  +      ((NodeConsumer) m_contentHandler).setOriginatingNode(node);
       }
  -    switch(node.getNodeType())
  +
  +    switch (node.getNodeType())
       {
  -    case Node.COMMENT_NODE:
  +    case Node.COMMENT_NODE :
  +    {
  +      String data = ((Comment) node).getData();
  +
  +      if (m_contentHandler instanceof LexicalHandler)
         {
  -        String data = ((Comment)node).getData();
  -        if(m_contentHandler instanceof LexicalHandler)
  -        {
  -          LexicalHandler lh = ((LexicalHandler)this.m_contentHandler);
  -          lh.comment(data.toCharArray(), 0, data.length());
  -        }
  +        LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);
  +
  +        lh.comment(data.toCharArray(), 0, data.length());
         }
  -      break;
  -    case Node.DOCUMENT_FRAGMENT_NODE:
  +    }
  +    break;
  +    case Node.DOCUMENT_FRAGMENT_NODE :
  +
         // ??;
         break;
  -    case Node.DOCUMENT_NODE:
  +    case Node.DOCUMENT_NODE :
         this.m_contentHandler.startDocument();
         break;
  -    case Node.ELEMENT_NODE:
  -      NamedNodeMap atts = ((Element)node).getAttributes();
  +    case Node.ELEMENT_NODE :
  +      NamedNodeMap atts = ((Element) node).getAttributes();
         int nAttrs = atts.getLength();
  -      for(int i = 0; i < nAttrs; i++)
  +
  +      for (int i = 0; i < nAttrs; i++)
         {
           Node attr = atts.item(i);
           String attrName = attr.getNodeName();
  -        if(attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
  +
  +        if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
           {
             int index;
  -          String prefix 
  -            = (index = attrName.indexOf(":"))< 0 
  -              ? null : attrName.substring(index+1);
  -          this.m_contentHandler.startPrefixMapping ( prefix, 
  -                                                     attr.getNodeValue());
  +          String prefix = (index = attrName.indexOf(":")) < 0
  +                          ? null : attrName.substring(index + 1);
  +
  +          this.m_contentHandler.startPrefixMapping(prefix,
  +                                                   attr.getNodeValue());
           }
         }
  +
         // System.out.println("m_dh.getNamespaceOfNode(node): "+m_dh.getNamespaceOfNode(node));
         // System.out.println("m_dh.getLocalNameOfNode(node): "+m_dh.getLocalNameOfNode(node));
  -      this.m_contentHandler.startElement (m_dh.getNamespaceOfNode(node), 
  -                                          m_dh.getLocalNameOfNode(node), 
  -                                          node.getNodeName(), 
  -                                          new AttList(atts, m_dh));
  +      this.m_contentHandler.startElement(m_dh.getNamespaceOfNode(node),
  +                                         m_dh.getLocalNameOfNode(node),
  +                                         node.getNodeName(),
  +                                         new AttList(atts, m_dh));
         break;
  -    case Node.PROCESSING_INSTRUCTION_NODE:
  +    case Node.PROCESSING_INSTRUCTION_NODE :
  +    {
  +      ProcessingInstruction pi = (ProcessingInstruction) node;
  +      String name = pi.getNodeName();
  +
  +      // String data = pi.getData();
  +      if (name.equals("xslt-next-is-raw"))
         {
  -        ProcessingInstruction pi = (ProcessingInstruction)node;
  -        String name = pi.getNodeName();
  -        // String data = pi.getData();
  -        if(name.equals("xslt-next-is-raw"))
  -        {
  -          nextIsRaw = true;
  -        }
  -        else
  +        nextIsRaw = true;
  +      }
  +      else
  +      {
  +        this.m_contentHandler.processingInstruction(pi.getNodeName(),
  +                                                    pi.getData());
  +      }
  +    }
  +    break;
  +    case Node.CDATA_SECTION_NODE :
  +    {
  +      String data = ((Text) node).getData();
  +      boolean isLexH = (m_contentHandler instanceof LexicalHandler);
  +      LexicalHandler lh = isLexH
  +                          ? ((LexicalHandler) this.m_contentHandler) : null;
  +
  +      if (isLexH)
  +      {
  +        lh.startCDATA();
  +      }
  +
  +      this.m_contentHandler.characters(data.toCharArray(), 0, data.length());
  +
  +      {
  +        if (isLexH)
           {
  -          this.m_contentHandler.processingInstruction(pi.getNodeName(), pi.getData());
  +          lh.endCDATA();
           }
         }
  -      break;
  -    case Node.CDATA_SECTION_NODE:
  +    }
  +    break;
  +    case Node.TEXT_NODE :
  +    {
  +      String data = ((Text) node).getData();
  +
  +      if (nextIsRaw)
         {
  -        String data = ((Text)node).getData();
  -        boolean isLexH = (m_contentHandler instanceof LexicalHandler);
  -        LexicalHandler lh = isLexH ? ((LexicalHandler)this.m_contentHandler) : null;
  -        if(isLexH)
  +        nextIsRaw = false;
  +
  +        boolean isSerH = (m_contentHandler instanceof SerializerHandler);
  +        SerializerHandler serH =
  +          isSerH ? ((SerializerHandler) this.m_contentHandler) : null;
  +
  +        if (isSerH)
           {
  -          lh.startCDATA();
  +          serH.startNonEscaping();
           }
  -        this.m_contentHandler.characters(data.toCharArray(), 0, data.length());
  +
  +        this.m_contentHandler.characters(data.toCharArray(), 0,
  +                                         data.length());
  +
           {
  -          if(isLexH)
  +          if (isSerH)
             {
  -            lh.endCDATA();
  +            serH.endNonEscaping();
             }
           }
         }
  -      break;
  -    case Node.TEXT_NODE:
  +      else
         {
  -        String data = ((Text)node).getData();
  -        if(nextIsRaw)
  -        {
  -          nextIsRaw = false;
  -          boolean isSerH = (m_contentHandler instanceof SerializerHandler);
  -          SerializerHandler serH = isSerH ? ((SerializerHandler)this.m_contentHandler) : null;
  -          if(isSerH)
  -          {
  -            serH.startNonEscaping();
  -          }
  -          this.m_contentHandler.characters(data.toCharArray(), 0, data.length());
  -          {
  -            if(isSerH)
  -            {
  -              serH.endNonEscaping();
  -            }
  -          }
  -        }
  -        else
  -        {
  -          this.m_contentHandler.characters(data.toCharArray(), 0, data.length());
  -        }
  +        this.m_contentHandler.characters(data.toCharArray(), 0,
  +                                         data.length());
         }
  -      break;
  -    case Node.ENTITY_REFERENCE_NODE:
  +    }
  +    break;
  +    case Node.ENTITY_REFERENCE_NODE :
  +    {
  +      EntityReference eref = (EntityReference) node;
  +
  +      if (m_contentHandler instanceof LexicalHandler)
         {
  -        EntityReference eref = (EntityReference)node;
  -        if(m_contentHandler instanceof LexicalHandler)
  -        {
  -          ((LexicalHandler)this.m_contentHandler).startEntity(eref.getNodeName());
  -        }
  -        else
  -        {
  -          // warning("Can not output entity to a pure SAX ContentHandler");
  -        }
  +        ((LexicalHandler) this.m_contentHandler).startEntity(
  +          eref.getNodeName());
         }
  -      break;
  -    default:
  +      else
  +      {
  +
  +        // warning("Can not output entity to a pure SAX ContentHandler");
  +      }
  +    }
  +    break;
  +    default :
       }
     }
   
  -  protected void endNode(Node node)
  -    throws SAXException 
  +  /**
  +   * NEEDSDOC Method endNode 
  +   *
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * @throws SAXException
  +   */
  +  protected void endNode(Node node) throws SAXException
     {
  -    switch(node.getNodeType())
  +
  +    switch (node.getNodeType())
       {
  -    case Node.DOCUMENT_NODE:
  +    case Node.DOCUMENT_NODE :
         this.m_contentHandler.endDocument();
         break;
  -    case Node.ELEMENT_NODE:
  +    case Node.ELEMENT_NODE :
         this.m_contentHandler.endElement("", "", node.getNodeName());
  -       NamedNodeMap atts = ((Element)node).getAttributes();
  +
  +      NamedNodeMap atts = ((Element) node).getAttributes();
         int nAttrs = atts.getLength();
  -      for(int i = 0; i < nAttrs; i++)
  +
  +      for (int i = 0; i < nAttrs; i++)
         {
           Node attr = atts.item(i);
           String attrName = attr.getNodeName();
  -        if(attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
  +
  +        if (attrName.equals("xmlns") || attrName.startsWith("xmlns:"))
           {
             int index;
  -          String prefix 
  -            = (index = attrName.indexOf(":"))< 0 
  -              ? null : attrName.substring(index+1);
  +          String prefix = (index = attrName.indexOf(":")) < 0
  +                          ? null : attrName.substring(index + 1);
  +
             this.m_contentHandler.endPrefixMapping(prefix);
           }
         }
  -     break;
  -    case Node.CDATA_SECTION_NODE:
         break;
  -    case Node.ENTITY_REFERENCE_NODE:
  +    case Node.CDATA_SECTION_NODE :
  +      break;
  +    case Node.ENTITY_REFERENCE_NODE :
  +    {
  +      EntityReference eref = (EntityReference) node;
  +
  +      if (m_contentHandler instanceof LexicalHandler)
         {
  -        EntityReference eref = (EntityReference)node;
  -        if(m_contentHandler instanceof LexicalHandler)
  -        {
  -          LexicalHandler lh = ((LexicalHandler)this.m_contentHandler);
  -          lh.endEntity(eref.getNodeName());
  -        }
  +        LexicalHandler lh = ((LexicalHandler) this.m_contentHandler);
  +
  +        lh.endEntity(eref.getNodeName());
         }
  -      break;
  -    default:
  +    }
  +    break;
  +    default :
       }
     }
  -  
   }  //TreeWalker
  +
  
  
  
  1.2       +117 -82   xml-xalan/java/src/org/apache/xalan/utils/Trie.java
  
  Index: Trie.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/Trie.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Trie.java	2000/06/19 16:53:14	1.1
  +++ Trie.java	2000/10/30 18:57:26	1.2
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -54,10 +54,9 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -
   package org.apache.xalan.utils;
   
  -/** 
  +/**
    * <meta name="usage" content="internal"/>
    * A digital search trie for 7-bit ASCII text
    * The API is a subset of java.util.Hashtable
  @@ -66,85 +65,121 @@
    */
   public class Trie
   {
  -	public static final int ALPHA_SIZE = 128;
  -
  -	Node m_Root;
   
  -	public Trie()
  -	{
  -		m_Root = new Node();
  -	}
  -
  -	public Object put(String key, Object value)
  -	{
  -  		final int len = key.length();
  -
  -		Node node = m_Root;
  -
  -		for (int i = 0; i< len; i++)
  -		{
  -			Node nextNode = node.m_nextChar[Character.toUpperCase(key.charAt(i))];
  -
  -			if (nextNode != null)
  -			{
  -				node = nextNode;
  -			}
  -			else
  -			{
  -				for (;i<len; i++)
  -				{
  -					Node newNode = new Node();
  -					node.m_nextChar[Character.toUpperCase(key.charAt(i))] = newNode;
  -					node = newNode;
  -				}
  -
  -				break;
  -			}
  -		}
  -
  -		Object ret = node.m_Value;
  -		node.m_Value = value;
  -
  -		return ret;
  -	}
  -
  -	public Object get(String key)
  -	{
  -		final int len = key.length();
  -
  -		Node node = m_Root;
  -
  -		for (int i = 0; i< len; i++)
  -		{
  -			try
  -			{
  -				node = node.m_nextChar[Character.toUpperCase(key.charAt(i))];
  -			}
  -
  -			catch (ArrayIndexOutOfBoundsException e)
  -			{
  -				// the key is not 7-bit ASCII so we won't find it here
  -				node = null;					
  -			}
  -
  -			if (node == null)
  -  				return null;
  -  		}
  -
  -		return node.m_Value;
  -	}
  -
  -  	class Node
  -	{
  -		Node()
  -		{
  -			m_nextChar = new Node[ALPHA_SIZE];
  -			m_Value = null;
  -		}
  -
  -		Node m_nextChar[];
  -		Object m_Value;
  -	}
  -}
  +  /** NEEDSDOC Field ALPHA_SIZE          */
  +  public static final int ALPHA_SIZE = 128;
   
  +  /** NEEDSDOC Field m_Root          */
  +  Node m_Root;
   
  +  /**
  +   * Constructor Trie
  +   *
  +   */
  +  public Trie()
  +  {
  +    m_Root = new Node();
  +  }
  +
  +  /**
  +   * NEEDSDOC Method put 
  +   *
  +   *
  +   * NEEDSDOC @param key
  +   * NEEDSDOC @param value
  +   *
  +   * NEEDSDOC (put) @return
  +   */
  +  public Object put(String key, Object value)
  +  {
  +
  +    final int len = key.length();
  +    Node node = m_Root;
  +
  +    for (int i = 0; i < len; i++)
  +    {
  +      Node nextNode = node.m_nextChar[Character.toUpperCase(key.charAt(i))];
  +
  +      if (nextNode != null)
  +      {
  +        node = nextNode;
  +      }
  +      else
  +      {
  +        for (; i < len; i++)
  +        {
  +          Node newNode = new Node();
  +
  +          node.m_nextChar[Character.toUpperCase(key.charAt(i))] = newNode;
  +          node = newNode;
  +        }
  +
  +        break;
  +      }
  +    }
  +
  +    Object ret = node.m_Value;
  +
  +    node.m_Value = value;
  +
  +    return ret;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method get 
  +   *
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC (get) @return
  +   */
  +  public Object get(String key)
  +  {
  +
  +    final int len = key.length();
  +    Node node = m_Root;
  +
  +    for (int i = 0; i < len; i++)
  +    {
  +      try
  +      {
  +        node = node.m_nextChar[Character.toUpperCase(key.charAt(i))];
  +      }
  +      catch (ArrayIndexOutOfBoundsException e)
  +      {
  +
  +        // the key is not 7-bit ASCII so we won't find it here
  +        node = null;
  +      }
  +
  +      if (node == null)
  +        return null;
  +    }
  +
  +    return node.m_Value;
  +  }
  +
  +  /**
  +   * <meta name="usage" content="internal"/>
  +   * NEEDSDOC Class Node <needs-comment/>
  +   */
  +  class Node
  +  {
  +
  +    /**
  +     * Constructor Node
  +     *
  +     */
  +    Node()
  +    {
  +      m_nextChar = new Node[ALPHA_SIZE];
  +      m_Value = null;
  +    }
  +
  +    /** NEEDSDOC Field m_nextChar[]          */
  +    Node m_nextChar[];
  +
  +    /** NEEDSDOC Field m_Value          */
  +    Object m_Value;
  +  }
  +}
  
  
  
  1.3       +1021 -735 xml-xalan/java/src/org/apache/xalan/utils/URI.java
  
  Index: URI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/URI.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- URI.java	2000/10/06 07:46:41	1.2
  +++ URI.java	2000/10/30 18:57:26	1.3
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999,2000 The Apache Software Foundation.  All rights 
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -24,7 +24,7 @@
    *    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
  + * 4. The names "Xalan" 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.
  @@ -49,73 +49,77 @@
    *
    * 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, iClick Inc., 
  - * http://www.apache.org.  For more information on the Apache Software 
  - * Foundation, please see <http://www.apache.org/>.
  + * originally based on software copyright (c) 1999, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
    */
  -
   package org.apache.xalan.utils;
   
   import java.io.IOException;
   import java.io.Serializable;
  +
  +/**
  + * A class to represent a Uniform Resource Identifier (URI). This class
  + * is designed to handle the parsing of URIs and provide access to
  + * the various components (scheme, host, port, userinfo, path, query
  + * string and fragment) that may constitute a URI.
  + * <p>
  + * Parsing of a URI specification is done according to the URI
  + * syntax described in RFC 2396
  + * <http://www.ietf.org/rfc/rfc2396.txt?number=2396>. Every URI consists
  + * of a scheme, followed by a colon (':'), followed by a scheme-specific
  + * part. For URIs that follow the "generic URI" syntax, the scheme-
  + * specific part begins with two slashes ("//") and may be followed
  + * by an authority segment (comprised of user information, host, and
  + * port), path segment, query segment and fragment. Note that RFC 2396
  + * no longer specifies the use of the parameters segment and excludes
  + * the "user:password" syntax as part of the authority segment. If
  + * "user:password" appears in a URI, the entire user/password string
  + * is stored as userinfo.
  + * <p>
  + * For URIs that do not follow the "generic URI" syntax (e.g. mailto),
  + * the entire scheme-specific part is treated as the "path" portion
  + * of the URI.
  + * <p>
  + * Note that, unlike the java.net.URL class, this class does not provide
  + * any built-in network access functionality nor does it provide any
  + * scheme-specific functionality (for example, it does not know a
  + * default port for a specific scheme). Rather, it only knows the
  + * grammar and basic set of operations that can be applied to a URI.
  + *
  + * @version  $Id: URI.java,v 1.3 2000/10/30 18:57:26 sboag Exp $
  + *
  + */
  +public class URI implements Serializable
  +{
   
  -/**********************************************************************
  -* A class to represent a Uniform Resource Identifier (URI). This class
  -* is designed to handle the parsing of URIs and provide access to 
  -* the various components (scheme, host, port, userinfo, path, query
  -* string and fragment) that may constitute a URI. 
  -* <p>
  -* Parsing of a URI specification is done according to the URI 
  -* syntax described in RFC 2396 
  -* <http://www.ietf.org/rfc/rfc2396.txt?number=2396>. Every URI consists 
  -* of a scheme, followed by a colon (':'), followed by a scheme-specific
  -* part. For URIs that follow the "generic URI" syntax, the scheme-
  -* specific part begins with two slashes ("//") and may be followed
  -* by an authority segment (comprised of user information, host, and 
  -* port), path segment, query segment and fragment. Note that RFC 2396
  -* no longer specifies the use of the parameters segment and excludes
  -* the "user:password" syntax as part of the authority segment. If 
  -* "user:password" appears in a URI, the entire user/password string
  -* is stored as userinfo.
  -* <p>
  -* For URIs that do not follow the "generic URI" syntax (e.g. mailto),
  -* the entire scheme-specific part is treated as the "path" portion
  -* of the URI.
  -* <p>
  -* Note that, unlike the java.net.URL class, this class does not provide
  -* any built-in network access functionality nor does it provide any 
  -* scheme-specific functionality (for example, it does not know a 
  -* default port for a specific scheme). Rather, it only knows the 
  -* grammar and basic set of operations that can be applied to a URI.
  -*
  -* @version  $Id: URI.java,v 1.2 2000/10/06 07:46:41 sboag Exp $
  -*
  -**********************************************************************/
  -public class URI implements Serializable {
  -
  -  /*******************************************************************
  -  * MalformedURIExceptions are thrown in the process of building a URI
  -  * or setting fields on a URI when an operation would result in an 
  -  * invalid URI specification. 
  -  *
  -  ********************************************************************/
  -  public static class MalformedURIException extends IOException {
  -
  -   /******************************************************************
  -    * Constructs a <code>MalformedURIException</code> with no specified
  -    * detail message.
  -    ******************************************************************/
  -    public MalformedURIException() {
  +  /**
  +   * MalformedURIExceptions are thrown in the process of building a URI
  +   * or setting fields on a URI when an operation would result in an
  +   * invalid URI specification.
  +   *
  +   */
  +  public static class MalformedURIException extends IOException
  +  {
  +
  +    /**
  +     * Constructs a <code>MalformedURIException</code> with no specified
  +     * detail message.
  +     */
  +    public MalformedURIException()
  +    {
         super();
       }
   
  -    /*****************************************************************
  -    * Constructs a <code>MalformedURIException</code> with the 
  -    * specified detail message. 
  -    *
  -    * @param p_msg the detail message.
  -    ******************************************************************/
  -    public MalformedURIException(String p_msg) {
  +    /**
  +     * Constructs a <code>MalformedURIException</code> with the
  +     * specified detail message.
  +     *
  +     * @param p_msg the detail message.
  +     */
  +    public MalformedURIException(String p_msg)
  +    {
         super(p_msg);
       }
     }
  @@ -123,15 +127,19 @@
     /** reserved characters */
     private static final String RESERVED_CHARACTERS = ";/?:@&=+$,";
   
  -  /** URI punctuation mark characters - these, combined with 
  -      alphanumerics, constitute the "unreserved" characters */
  +  /**
  +   * URI punctuation mark characters - these, combined with
  +   *   alphanumerics, constitute the "unreserved" characters 
  +   */
     private static final String MARK_CHARACTERS = "-_.!~*'() ";
   
     /** scheme can be composed of alphanumerics and these characters */
     private static final String SCHEME_CHARACTERS = "+-.";
   
  -  /** userinfo can be composed of unreserved, escaped and these 
  -      characters */
  +  /**
  +   * userinfo can be composed of unreserved, escaped and these
  +   *   characters 
  +   */
     private static final String USERINFO_CHARACTERS = ";:&=+$,";
   
     /** Stores the scheme (usually the protocol) for this URI. */
  @@ -149,171 +157,190 @@
     /** If specified, stores the path for this URI; otherwise null */
     private String m_path = null;
   
  -  /** If specified, stores the query string for this URI; otherwise 
  -      null.  */
  +  /**
  +   * If specified, stores the query string for this URI; otherwise
  +   *   null.  
  +   */
     private String m_queryString = null;
   
     /** If specified, stores the fragment for this URI; otherwise null */
     private String m_fragment = null;
   
  +  /** NEEDSDOC Field DEBUG          */
     private static boolean DEBUG = false;
   
     /**
  -  * Construct a new and uninitialized URI.
  -  */
  -  public URI() {
  -  }
  +   * Construct a new and uninitialized URI.
  +   */
  +  public URI(){}
   
  - /**
  -  * Construct a new URI from another URI. All fields for this URI are 
  -  * set equal to the fields of the URI passed in.
  -  *
  -  * @param p_other the URI to copy (cannot be null)
  -  */
  -  public URI(URI p_other) {
  +  /**
  +   * Construct a new URI from another URI. All fields for this URI are
  +   * set equal to the fields of the URI passed in.
  +   *
  +   * @param p_other the URI to copy (cannot be null)
  +   */
  +  public URI(URI p_other)
  +  {
       initialize(p_other);
     }
   
  - /**
  -  * Construct a new URI from a URI specification string. If the 
  -  * specification follows the "generic URI" syntax, (two slashes 
  -  * following the first colon), the specification will be parsed 
  -  * accordingly - setting the scheme, userinfo, host,port, path, query
  -  * string and fragment fields as necessary. If the specification does 
  -  * not follow the "generic URI" syntax, the specification is parsed 
  -  * into a scheme and scheme-specific part (stored as the path) only.
  -  *
  -  * @param p_uriSpec the URI specification string (cannot be null or
  -  *                  empty)
  -  *
  -  * @exception MalformedURIException if p_uriSpec violates any syntax
  -  *                                   rules
  -  */
  -  public URI(String p_uriSpec) throws MalformedURIException {
  -    this((URI)null, p_uriSpec);
  -  }
  -
  - /**
  -  * Construct a new URI from a base URI and a URI specification string.
  -  * The URI specification string may be a relative URI. 
  -  *
  -  * @param p_base the base URI (cannot be null if p_uriSpec is null or
  -  *               empty)
  -  * @param p_uriSpec the URI specification string (cannot be null or
  -  *                  empty if p_base is null)
  -  *
  -  * @exception MalformedURIException if p_uriSpec violates any syntax
  -  *                                  rules
  -  */
  -  public URI(URI p_base, String p_uriSpec) throws MalformedURIException {
  +  /**
  +   * Construct a new URI from a URI specification string. If the
  +   * specification follows the "generic URI" syntax, (two slashes
  +   * following the first colon), the specification will be parsed
  +   * accordingly - setting the scheme, userinfo, host,port, path, query
  +   * string and fragment fields as necessary. If the specification does
  +   * not follow the "generic URI" syntax, the specification is parsed
  +   * into a scheme and scheme-specific part (stored as the path) only.
  +   *
  +   * @param p_uriSpec the URI specification string (cannot be null or
  +   *                  empty)
  +   *
  +   * @exception MalformedURIException if p_uriSpec violates any syntax
  +   *                                   rules
  +   */
  +  public URI(String p_uriSpec) throws MalformedURIException
  +  {
  +    this((URI) null, p_uriSpec);
  +  }
  +
  +  /**
  +   * Construct a new URI from a base URI and a URI specification string.
  +   * The URI specification string may be a relative URI.
  +   *
  +   * @param p_base the base URI (cannot be null if p_uriSpec is null or
  +   *               empty)
  +   * @param p_uriSpec the URI specification string (cannot be null or
  +   *                  empty if p_base is null)
  +   *
  +   * @exception MalformedURIException if p_uriSpec violates any syntax
  +   *                                  rules
  +   */
  +  public URI(URI p_base, String p_uriSpec) throws MalformedURIException
  +  {
       initialize(p_base, p_uriSpec);
     }
  +
  +  /**
  +   * Construct a new URI that does not follow the generic URI syntax.
  +   * Only the scheme and scheme-specific part (stored as the path) are
  +   * initialized.
  +   *
  +   * @param p_scheme the URI scheme (cannot be null or empty)
  +   * @param p_schemeSpecificPart the scheme-specific part (cannot be
  +   *                             null or empty)
  +   *
  +   * @exception MalformedURIException if p_scheme violates any
  +   *                                  syntax rules
  +   */
  +  public URI(String p_scheme, String p_schemeSpecificPart)
  +          throws MalformedURIException
  +  {
   
  - /**
  -  * Construct a new URI that does not follow the generic URI syntax.
  -  * Only the scheme and scheme-specific part (stored as the path) are
  -  * initialized.
  -  *
  -  * @param p_scheme the URI scheme (cannot be null or empty)
  -  * @param p_schemeSpecificPart the scheme-specific part (cannot be
  -  *                             null or empty)
  -  *
  -  * @exception MalformedURIException if p_scheme violates any 
  -  *                                  syntax rules
  -  */
  -  public URI(String p_scheme, String p_schemeSpecificPart) 
  -             throws MalformedURIException {
  -    if (p_scheme == null || p_scheme.trim().length() == 0) {
  +    if (p_scheme == null || p_scheme.trim().length() == 0)
  +    {
         throw new MalformedURIException(
  -            "Cannot construct URI with null/empty scheme!");
  +        "Cannot construct URI with null/empty scheme!");
       }
  -    if (p_schemeSpecificPart == null || 
  -        p_schemeSpecificPart.trim().length() == 0) {
  +
  +    if (p_schemeSpecificPart == null
  +            || p_schemeSpecificPart.trim().length() == 0)
  +    {
         throw new MalformedURIException(
  -          "Cannot construct URI with null/empty scheme-specific part!");
  +        "Cannot construct URI with null/empty scheme-specific part!");
       }
  +
       setScheme(p_scheme);
       setPath(p_schemeSpecificPart);
     }
   
  - /**
  -  * Construct a new URI that follows the generic URI syntax from its
  -  * component parts. Each component is validated for syntax and some
  -  * basic semantic checks are performed as well.  See the individual
  -  * setter methods for specifics.
  -  *
  -  * @param p_scheme the URI scheme (cannot be null or empty)
  -  * @param p_host the hostname or IPv4 address for the URI
  -  * @param p_path the URI path - if the path contains '?' or '#',
  -  *               then the query string and/or fragment will be
  -  *               set from the path; however, if the query and 
  -  *               fragment are specified both in the path and as 
  -  *               separate parameters, an exception is thrown
  -  * @param p_queryString the URI query string (cannot be specified
  -  *                      if path is null)
  -  * @param p_fragment the URI fragment (cannot be specified if path
  -  *                   is null)
  -  *
  -  * @exception MalformedURIException if any of the parameters violates 
  -  *                                  syntax rules or semantic rules
  -  */
  -  public URI(String p_scheme, String p_host, String p_path,
  -             String p_queryString, String p_fragment) 
  -         throws MalformedURIException {
  +  /**
  +   * Construct a new URI that follows the generic URI syntax from its
  +   * component parts. Each component is validated for syntax and some
  +   * basic semantic checks are performed as well.  See the individual
  +   * setter methods for specifics.
  +   *
  +   * @param p_scheme the URI scheme (cannot be null or empty)
  +   * @param p_host the hostname or IPv4 address for the URI
  +   * @param p_path the URI path - if the path contains '?' or '#',
  +   *               then the query string and/or fragment will be
  +   *               set from the path; however, if the query and
  +   *               fragment are specified both in the path and as
  +   *               separate parameters, an exception is thrown
  +   * @param p_queryString the URI query string (cannot be specified
  +   *                      if path is null)
  +   * @param p_fragment the URI fragment (cannot be specified if path
  +   *                   is null)
  +   *
  +   * @exception MalformedURIException if any of the parameters violates
  +   *                                  syntax rules or semantic rules
  +   */
  +  public URI(String p_scheme, String p_host, String p_path, String p_queryString, String p_fragment)
  +          throws MalformedURIException
  +  {
       this(p_scheme, null, p_host, -1, p_path, p_queryString, p_fragment);
     }
  +
  +  /**
  +   * Construct a new URI that follows the generic URI syntax from its
  +   * component parts. Each component is validated for syntax and some
  +   * basic semantic checks are performed as well.  See the individual
  +   * setter methods for specifics.
  +   *
  +   * @param p_scheme the URI scheme (cannot be null or empty)
  +   * @param p_userinfo the URI userinfo (cannot be specified if host
  +   *                   is null)
  +   * @param p_host the hostname or IPv4 address for the URI
  +   * @param p_port the URI port (may be -1 for "unspecified"; cannot
  +   *               be specified if host is null)
  +   * @param p_path the URI path - if the path contains '?' or '#',
  +   *               then the query string and/or fragment will be
  +   *               set from the path; however, if the query and
  +   *               fragment are specified both in the path and as
  +   *               separate parameters, an exception is thrown
  +   * @param p_queryString the URI query string (cannot be specified
  +   *                      if path is null)
  +   * @param p_fragment the URI fragment (cannot be specified if path
  +   *                   is null)
  +   *
  +   * @exception MalformedURIException if any of the parameters violates
  +   *                                  syntax rules or semantic rules
  +   */
  +  public URI(String p_scheme, String p_userinfo, String p_host, int p_port, String p_path, String p_queryString, String p_fragment)
  +          throws MalformedURIException
  +  {
   
  - /**
  -  * Construct a new URI that follows the generic URI syntax from its
  -  * component parts. Each component is validated for syntax and some
  -  * basic semantic checks are performed as well.  See the individual
  -  * setter methods for specifics.
  -  *
  -  * @param p_scheme the URI scheme (cannot be null or empty)
  -  * @param p_userinfo the URI userinfo (cannot be specified if host 
  -  *                   is null)
  -  * @param p_host the hostname or IPv4 address for the URI
  -  * @param p_port the URI port (may be -1 for "unspecified"; cannot 
  -  *               be specified if host is null)
  -  * @param p_path the URI path - if the path contains '?' or '#',
  -  *               then the query string and/or fragment will be
  -  *               set from the path; however, if the query and 
  -  *               fragment are specified both in the path and as 
  -  *               separate parameters, an exception is thrown
  -  * @param p_queryString the URI query string (cannot be specified
  -  *                      if path is null)
  -  * @param p_fragment the URI fragment (cannot be specified if path
  -  *                   is null)
  -  *
  -  * @exception MalformedURIException if any of the parameters violates 
  -  *                                  syntax rules or semantic rules
  -  */
  -  public URI(String p_scheme, String p_userinfo, 
  -             String p_host, int p_port, String p_path,
  -             String p_queryString, String p_fragment) 
  -         throws MalformedURIException {
  -    if (p_scheme == null || p_scheme.trim().length() == 0) {
  +    if (p_scheme == null || p_scheme.trim().length() == 0)
  +    {
         throw new MalformedURIException("Scheme is required!");
       }
   
  -    if (p_host == null) {
  -      if (p_userinfo != null) {
  +    if (p_host == null)
  +    {
  +      if (p_userinfo != null)
  +      {
           throw new MalformedURIException(
  -             "Userinfo may not be specified if host is not specified!");
  +          "Userinfo may not be specified if host is not specified!");
         }
  -      if (p_port != -1) {
  -        throw new MalformedURIException(      
  -             "Port may not be specified if host is not specified!");
  +
  +      if (p_port != -1)
  +      {
  +        throw new MalformedURIException(
  +          "Port may not be specified if host is not specified!");
         }
       }
   
  -    if (p_path != null) { 
  -      if (p_path.indexOf('?') != -1 && p_queryString != null) {
  +    if (p_path != null)
  +    {
  +      if (p_path.indexOf('?') != -1 && p_queryString != null)
  +      {
           throw new MalformedURIException(
             "Query string cannot be specified in path and query string!");
         }
   
  -      if (p_path.indexOf('#') != -1 && p_fragment != null) {
  +      if (p_path.indexOf('#') != -1 && p_fragment != null)
  +      {
           throw new MalformedURIException(
             "Fragment cannot be specified in both the path and fragment!");
         }
  @@ -327,13 +354,15 @@
       setQueryString(p_queryString);
       setFragment(p_fragment);
     }
  +
  +  /**
  +   * Initialize all fields of this URI from another URI.
  +   *
  +   * @param p_other the URI to copy (cannot be null)
  +   */
  +  private void initialize(URI p_other)
  +  {
   
  - /**
  -  * Initialize all fields of this URI from another URI.
  -  *
  -  * @param p_other the URI to copy (cannot be null)
  -  */
  -  private void initialize(URI p_other) {
       m_scheme = p_other.getScheme();
       m_userinfo = p_other.getUserinfo();
       m_host = p_other.getHost();
  @@ -343,33 +372,38 @@
       m_fragment = p_other.getFragment();
     }
   
  - /**
  -  * Initializes this URI from a base URI and a URI specification string.
  -  * See RFC 2396 Section 4 and Appendix B for specifications on parsing
  -  * the URI and Section 5 for specifications on resolving relative URIs
  -  * and relative paths.
  -  *
  -  * @param p_base the base URI (may be null if p_uriSpec is an absolute
  -  *               URI)
  -  * @param p_uriSpec the URI spec string which may be an absolute or
  -  *                  relative URI (can only be null/empty if p_base
  -  *                  is not null)
  -  *
  -  * @exception MalformedURIException if p_base is null and p_uriSpec
  -  *                                  is not an absolute URI or if
  -  *                                  p_uriSpec violates syntax rules 
  -  */
  -  private void initialize(URI p_base, String p_uriSpec) 
  -                         throws MalformedURIException {
  -    if (p_base == null && 
  -        (p_uriSpec == null || p_uriSpec.trim().length() == 0)) {
  +  /**
  +   * Initializes this URI from a base URI and a URI specification string.
  +   * See RFC 2396 Section 4 and Appendix B for specifications on parsing
  +   * the URI and Section 5 for specifications on resolving relative URIs
  +   * and relative paths.
  +   *
  +   * @param p_base the base URI (may be null if p_uriSpec is an absolute
  +   *               URI)
  +   * @param p_uriSpec the URI spec string which may be an absolute or
  +   *                  relative URI (can only be null/empty if p_base
  +   *                  is not null)
  +   *
  +   * @exception MalformedURIException if p_base is null and p_uriSpec
  +   *                                  is not an absolute URI or if
  +   *                                  p_uriSpec violates syntax rules
  +   */
  +  private void initialize(URI p_base, String p_uriSpec)
  +          throws MalformedURIException
  +  {
  +
  +    if (p_base == null
  +            && (p_uriSpec == null || p_uriSpec.trim().length() == 0))
  +    {
         throw new MalformedURIException(
  -                  "Cannot initialize URI with empty parameters.");
  -      }
  +        "Cannot initialize URI with empty parameters.");
  +    }
   
       // just make a copy of the base if spec is empty
  -    if (p_uriSpec == null || p_uriSpec.trim().length() == 0) {
  +    if (p_uriSpec == null || p_uriSpec.trim().length() == 0)
  +    {
         initialize(p_base);
  +
         return;
       }
   
  @@ -378,38 +412,51 @@
       int index = 0;
   
       // check for scheme
  -    if (uriSpec.indexOf(':') == -1) {
  -      if (p_base == null) {
  +    if (uriSpec.indexOf(':') == -1)
  +    {
  +      if (p_base == null)
  +      {
           throw new MalformedURIException("No scheme found in URI.");
         }
       }
  -    else {
  +    else
  +    {
         initializeScheme(uriSpec);
  -      index = m_scheme.length()+1;
  +
  +      index = m_scheme.length() + 1;
       }
   
       // two slashes means generic URI syntax, so we get the authority
  -    if (((index+1) < uriSpecLen) && 
  -        (uriSpec.substring(index).startsWith("//"))) {
  +    if (((index + 1) < uriSpecLen)
  +            && (uriSpec.substring(index).startsWith("//")))
  +    {
         index += 2;
  +
         int startPos = index;
   
         // get authority - everything up to path, query or fragment
         char testChar = '\0';
  -      while (index < uriSpecLen) {
  +
  +      while (index < uriSpecLen)
  +      {
           testChar = uriSpec.charAt(index);
  -        if (testChar == '/' || testChar == '?' || testChar == '#') {
  +
  +        if (testChar == '/' || testChar == '?' || testChar == '#')
  +        {
             break;
           }
  +
           index++;
         }
   
         // if we found authority, parse it out, otherwise we set the
         // host to empty string
  -      if (index > startPos) {
  +      if (index > startPos)
  +      {
           initializeAuthority(uriSpec.substring(startPos, index));
         }
  -      else {
  +      else
  +      {
           m_host = "";
         }
       }
  @@ -421,7 +468,8 @@
       // (when scheme is specified is the string spec and the base URI
       // is also specified, for example), but we're just following the
       // RFC specifications 
  -    if (p_base != null) {
  +    if (p_base != null)
  +    {
   
         // check to see if this is the current doc - RFC 2396 5.2 #2
         // note that this is slightly different from the RFC spec in that
  @@ -430,43 +478,49 @@
         // string or a fragment (e.g. "?y" or "#s") - 
         // see <http://www.ics.uci.edu/~fielding/url/test1.html> which
         // identified this as a bug in the RFC
  -      if (m_path.length() == 0 && m_scheme == null && 
  -          m_host == null) {
  +      if (m_path.length() == 0 && m_scheme == null && m_host == null)
  +      {
           m_scheme = p_base.getScheme();
           m_userinfo = p_base.getUserinfo();
           m_host = p_base.getHost();
           m_port = p_base.getPort();
           m_path = p_base.getPath();
   
  -        if (m_queryString == null) {
  +        if (m_queryString == null)
  +        {
             m_queryString = p_base.getQueryString();
           }
  +
           return;
         }
   
         // check for scheme - RFC 2396 5.2 #3
         // if we found a scheme, it means absolute URI, so we're done
  -      if (m_scheme == null) {
  +      if (m_scheme == null)
  +      {
           m_scheme = p_base.getScheme();
         }
  -      else {
  +      else
  +      {
           return;
         }
   
         // check for authority - RFC 2396 5.2 #4
         // if we found a host, then we've got a network path, so we're done
  -      if (m_host == null) {
  +      if (m_host == null)
  +      {
           m_userinfo = p_base.getUserinfo();
           m_host = p_base.getHost();
           m_port = p_base.getPort();
         }
  -      else {
  +      else
  +      {
           return;
         }
   
         // check for absolute path - RFC 2396 5.2 #5
  -      if (m_path.length() > 0 && 
  -          m_path.startsWith("/")) {
  +      if (m_path.length() > 0 && m_path.startsWith("/"))
  +      {
           return;
         }
   
  @@ -476,10 +530,13 @@
         String basePath = p_base.getPath();
   
         // 6a - get all but the last segment of the base URI path
  -      if (basePath != null) {
  +      if (basePath != null)
  +      {
           int lastSlash = basePath.lastIndexOf('/');
  -        if (lastSlash != -1) {
  -          path = basePath.substring(0, lastSlash+1);
  +
  +        if (lastSlash != -1)
  +        {
  +          path = basePath.substring(0, lastSlash + 1);
           }
         }
   
  @@ -488,87 +545,110 @@
   
         // 6c - remove all "./" where "." is a complete path segment
         index = -1;
  -      while ((index = path.indexOf("/./")) != -1) {
  -        path = path.substring(0, index+1).concat(path.substring(index+3));
  +
  +      while ((index = path.indexOf("/./")) != -1)
  +      {
  +        path = path.substring(0, index + 1).concat(path.substring(index + 3));
         }
   
         // 6d - remove "." if path ends with "." as a complete path segment
  -      if (path.endsWith("/.")) {
  -        path = path.substring(0, path.length()-1);
  +      if (path.endsWith("/."))
  +      {
  +        path = path.substring(0, path.length() - 1);
         }
   
         // 6e - remove all "<segment>/../" where "<segment>" is a complete 
         // path segment not equal to ".."
         index = -1;
  +
         int segIndex = -1;
         String tempString = null;
   
  -      while ((index = path.indexOf("/../")) > 0) {
  +      while ((index = path.indexOf("/../")) > 0)
  +      {
           tempString = path.substring(0, path.indexOf("/../"));
           segIndex = tempString.lastIndexOf('/');
  -        if (segIndex != -1) {
  -          if (!tempString.substring(segIndex++).equals("..")) {
  -            path = path.substring(0, segIndex).concat(path.substring(index+4));
  -           }
  +
  +        if (segIndex != -1)
  +        {
  +          if (!tempString.substring(segIndex++).equals(".."))
  +          {
  +            path = path.substring(0, segIndex).concat(path.substring(index
  +                    + 4));
  +          }
           }
         }
   
         // 6f - remove ending "<segment>/.." where "<segment>" is a 
         // complete path segment
  -      if (path.endsWith("/..")) {
  -        tempString = path.substring(0, path.length()-3);
  +      if (path.endsWith("/.."))
  +      {
  +        tempString = path.substring(0, path.length() - 3);
           segIndex = tempString.lastIndexOf('/');
  -        if (segIndex != -1) {
  -          path = path.substring(0, segIndex+1);
  +
  +        if (segIndex != -1)
  +        {
  +          path = path.substring(0, segIndex + 1);
           }
         }
  +
         m_path = path;
       }
     }
  +
  +  /**
  +   * Initialize the scheme for this URI from a URI string spec.
  +   *
  +   * @param p_uriSpec the URI specification (cannot be null)
  +   *
  +   * @exception MalformedURIException if URI does not have a conformant
  +   *                                  scheme
  +   */
  +  private void initializeScheme(String p_uriSpec) throws MalformedURIException
  +  {
   
  - /**
  -  * Initialize the scheme for this URI from a URI string spec.
  -  *
  -  * @param p_uriSpec the URI specification (cannot be null)
  -  *
  -  * @exception MalformedURIException if URI does not have a conformant
  -  *                                  scheme
  -  */
  -  private void initializeScheme(String p_uriSpec) 
  -                 throws MalformedURIException {
       int uriSpecLen = p_uriSpec.length();
       int index = 0;
       String scheme = null;
       char testChar = '\0';
   
  -    while (index < uriSpecLen) {
  +    while (index < uriSpecLen)
  +    {
         testChar = p_uriSpec.charAt(index);
  -      if (testChar == ':' || testChar == '/' || 
  -          testChar == '?' || testChar == '#') {
  +
  +      if (testChar == ':' || testChar == '/' || testChar == '?'
  +              || testChar == '#')
  +      {
           break;
         }
  +
         index++;
       }
  +
       scheme = p_uriSpec.substring(0, index);
   
  -    if (scheme.length() == 0) {
  +    if (scheme.length() == 0)
  +    {
         throw new MalformedURIException("No scheme found in URI.");
       }
  -    else {
  +    else
  +    {
         setScheme(scheme);
       }
     }
  +
  +  /**
  +   * Initialize the authority (userinfo, host and port) for this
  +   * URI from a URI string spec.
  +   *
  +   * @param p_uriSpec the URI specification (cannot be null)
  +   *
  +   * @exception MalformedURIException if p_uriSpec violates syntax rules
  +   */
  +  private void initializeAuthority(String p_uriSpec)
  +          throws MalformedURIException
  +  {
   
  - /**
  -  * Initialize the authority (userinfo, host and port) for this 
  -  * URI from a URI string spec.
  -  *
  -  * @param p_uriSpec the URI specification (cannot be null)
  -  *
  -  * @exception MalformedURIException if p_uriSpec violates syntax rules
  -  */
  -  private void initializeAuthority(String p_uriSpec) 
  -                 throws MalformedURIException {
       int index = 0;
       int start = 0;
       int end = p_uriSpec.length();
  @@ -576,73 +656,106 @@
       String userinfo = null;
   
       // userinfo is everything up @
  -    if (p_uriSpec.indexOf('@', start) != -1) {
  -      while (index < end) {
  +    if (p_uriSpec.indexOf('@', start) != -1)
  +    {
  +      while (index < end)
  +      {
           testChar = p_uriSpec.charAt(index);
  -        if (testChar == '@') {
  +
  +        if (testChar == '@')
  +        {
             break;
           }
  +
           index++;
         }
  +
         userinfo = p_uriSpec.substring(start, index);
  +
         index++;
       }
   
       // host is everything up to ':'
       String host = null;
  +
       start = index;
  -    while (index < end) { 
  +
  +    while (index < end)
  +    {
         testChar = p_uriSpec.charAt(index);
  -      if (testChar == ':') {
  +
  +      if (testChar == ':')
  +      {
           break;
         }
  +
         index++;
       }
  +
       host = p_uriSpec.substring(start, index);
  +
       int port = -1;
  -    if (host.length() > 0) {
  +
  +    if (host.length() > 0)
  +    {
  +
         // port
  -      if (testChar == ':') {
  +      if (testChar == ':')
  +      {
           index++;
  +
           start = index;
  -        while (index < end) {
  +
  +        while (index < end)
  +        {
             index++;
           }
  +
           String portStr = p_uriSpec.substring(start, index);
  -        if (portStr.length() > 0) {
  -          for (int i = 0; i < portStr.length(); i++) {
  -            if (!isDigit(portStr.charAt(i))) {
  +
  +        if (portStr.length() > 0)
  +        {
  +          for (int i = 0; i < portStr.length(); i++)
  +          {
  +            if (!isDigit(portStr.charAt(i)))
  +            {
                 throw new MalformedURIException(
  -                   portStr + 
  -                   " is invalid. Port should only contain digits!");
  +                portStr + " is invalid. Port should only contain digits!");
               }
  -          } 
  -          try {
  +          }
  +
  +          try
  +          {
               port = Integer.parseInt(portStr);
             }
  -          catch (NumberFormatException nfe) {
  +          catch (NumberFormatException nfe)
  +          {
  +
               // can't happen
             }
           }
         }
       }
  +
       setHost(host);
       setPort(port);
       setUserinfo(userinfo);
     }
  +
  +  /**
  +   * Initialize the path for this URI from a URI string spec.
  +   *
  +   * @param p_uriSpec the URI specification (cannot be null)
  +   *
  +   * @exception MalformedURIException if p_uriSpec violates syntax rules
  +   */
  +  private void initializePath(String p_uriSpec) throws MalformedURIException
  +  {
   
  - /**
  -  * Initialize the path for this URI from a URI string spec.
  -  *
  -  * @param p_uriSpec the URI specification (cannot be null)
  -  *
  -  * @exception MalformedURIException if p_uriSpec violates syntax rules
  -  */
  -  private void initializePath(String p_uriSpec) 
  -                 throws MalformedURIException {
  -    if (p_uriSpec == null) {
  +    if (p_uriSpec == null)
  +    {
         throw new MalformedURIException(
  -                "Cannot initialize path from null string!");
  +        "Cannot initialize path from null string!");
       }
   
       int index = 0;
  @@ -651,129 +764,166 @@
       char testChar = '\0';
   
       // path - everything up to query string or fragment
  -    while (index < end) {
  +    while (index < end)
  +    {
         testChar = p_uriSpec.charAt(index);
  -      if (testChar == '?' || testChar == '#') {
  +
  +      if (testChar == '?' || testChar == '#')
  +      {
           break;
         }
  +
         // check for valid escape sequence
  -      if (testChar == '%') { 
  -         if (index+2 >= end ||
  -            !isHex(p_uriSpec.charAt(index+1)) ||
  -            !isHex(p_uriSpec.charAt(index+2))) {
  +      if (testChar == '%')
  +      {
  +        if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1))
  +                ||!isHex(p_uriSpec.charAt(index + 2)))
  +        {
             throw new MalformedURIException(
  -                "Path contains invalid escape sequence!");
  -         }
  +            "Path contains invalid escape sequence!");
  +        }
         }
  -      else if (!isReservedCharacter(testChar) && 
  -               !isUnreservedCharacter(testChar)) {
  -        if('\\' != testChar)
  -        throw new MalformedURIException(
  -                  "Path contains invalid character: " + testChar);
  +      else if (!isReservedCharacter(testChar)
  +               &&!isUnreservedCharacter(testChar))
  +      {
  +        if ('\\' != testChar)
  +          throw new MalformedURIException("Path contains invalid character: "
  +                                          + testChar);
         }
  +
         index++;
       }
  +
       m_path = p_uriSpec.substring(start, index);
   
       // query - starts with ? and up to fragment or end
  -    if (testChar == '?') { 
  +    if (testChar == '?')
  +    {
         index++;
  +
         start = index;
  -      while (index < end) {
  +
  +      while (index < end)
  +      {
           testChar = p_uriSpec.charAt(index);
  -        if (testChar == '#') {
  +
  +        if (testChar == '#')
  +        {
             break;
           }
  -        if (testChar == '%') { 
  -           if (index+2 >= end ||
  -              !isHex(p_uriSpec.charAt(index+1)) ||
  -              !isHex(p_uriSpec.charAt(index+2))) {
  +
  +        if (testChar == '%')
  +        {
  +          if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1))
  +                  ||!isHex(p_uriSpec.charAt(index + 2)))
  +          {
               throw new MalformedURIException(
  -                    "Query string contains invalid escape sequence!");
  -           }
  +              "Query string contains invalid escape sequence!");
  +          }
           }
  -        else if (!isReservedCharacter(testChar) && 
  -                 !isUnreservedCharacter(testChar)) {
  +        else if (!isReservedCharacter(testChar)
  +                 &&!isUnreservedCharacter(testChar))
  +        {
             throw new MalformedURIException(
  -                "Query string contains invalid character:" + testChar);
  +            "Query string contains invalid character:" + testChar);
           }
  +
           index++;
         }
  +
         m_queryString = p_uriSpec.substring(start, index);
       }
   
       // fragment - starts with #
  -    if (testChar == '#') { 
  +    if (testChar == '#')
  +    {
         index++;
  +
         start = index;
  -      while (index < end) {
  +
  +      while (index < end)
  +      {
           testChar = p_uriSpec.charAt(index);
   
  -        if (testChar == '%') { 
  -           if (index+2 >= end ||
  -              !isHex(p_uriSpec.charAt(index+1)) ||
  -              !isHex(p_uriSpec.charAt(index+2))) {
  +        if (testChar == '%')
  +        {
  +          if (index + 2 >= end ||!isHex(p_uriSpec.charAt(index + 1))
  +                  ||!isHex(p_uriSpec.charAt(index + 2)))
  +          {
               throw new MalformedURIException(
  -                    "Fragment contains invalid escape sequence!");
  -           }
  +              "Fragment contains invalid escape sequence!");
  +          }
           }
  -        else if (!isReservedCharacter(testChar) && 
  -                 !isUnreservedCharacter(testChar)) {
  +        else if (!isReservedCharacter(testChar)
  +                 &&!isUnreservedCharacter(testChar))
  +        {
             throw new MalformedURIException(
  -                "Fragment contains invalid character:"+testChar);
  +            "Fragment contains invalid character:" + testChar);
           }
  +
           index++;
         }
  +
         m_fragment = p_uriSpec.substring(start, index);
       }
     }
   
  - /**
  -  * Get the scheme for this URI.
  -  *
  -  * @return the scheme for this URI
  -  */
  -  public String getScheme() {
  +  /**
  +   * Get the scheme for this URI.
  +   *
  +   * @return the scheme for this URI
  +   */
  +  public String getScheme()
  +  {
       return m_scheme;
     }
   
  - /**
  -  * Get the scheme-specific part for this URI (everything following the
  -  * scheme and the first colon). See RFC 2396 Section 5.2 for spec.
  -  *
  -  * @return the scheme-specific part for this URI
  -  */
  -  public String getSchemeSpecificPart() {
  +  /**
  +   * Get the scheme-specific part for this URI (everything following the
  +   * scheme and the first colon). See RFC 2396 Section 5.2 for spec.
  +   *
  +   * @return the scheme-specific part for this URI
  +   */
  +  public String getSchemeSpecificPart()
  +  {
  +
       StringBuffer schemespec = new StringBuffer();
   
  -    if (m_userinfo != null || m_host != null || m_port != -1) {
  +    if (m_userinfo != null || m_host != null || m_port != -1)
  +    {
         schemespec.append("//");
       }
   
  -    if (m_userinfo != null) {
  +    if (m_userinfo != null)
  +    {
         schemespec.append(m_userinfo);
         schemespec.append('@');
       }
   
  -    if (m_host != null) {
  +    if (m_host != null)
  +    {
         schemespec.append(m_host);
       }
   
  -    if (m_port != -1) {
  +    if (m_port != -1)
  +    {
         schemespec.append(':');
         schemespec.append(m_port);
       }
   
  -    if (m_path != null) {
  +    if (m_path != null)
  +    {
         schemespec.append((m_path));
       }
   
  -    if (m_queryString != null) {
  +    if (m_queryString != null)
  +    {
         schemespec.append('?');
         schemespec.append(m_queryString);
       }
   
  -    if (m_fragment != null) {
  +    if (m_fragment != null)
  +    {
         schemespec.append('#');
         schemespec.append(m_fragment);
       }
  @@ -781,133 +931,153 @@
       return schemespec.toString();
     }
   
  - /**
  -  * Get the userinfo for this URI.
  -  *
  -  * @return the userinfo for this URI (null if not specified).
  -  */
  -  public String getUserinfo() {
  +  /**
  +   * Get the userinfo for this URI.
  +   *
  +   * @return the userinfo for this URI (null if not specified).
  +   */
  +  public String getUserinfo()
  +  {
       return m_userinfo;
     }
   
     /**
  -  * Get the host for this URI.
  -  *
  -  * @return the host for this URI (null if not specified).
  -  */
  -  public String getHost() {
  +   * Get the host for this URI.
  +   *
  +   * @return the host for this URI (null if not specified).
  +   */
  +  public String getHost()
  +  {
       return m_host;
     }
   
  - /**
  -  * Get the port for this URI.
  -  *
  -  * @return the port for this URI (-1 if not specified).
  -  */
  -  public int getPort() {
  +  /**
  +   * Get the port for this URI.
  +   *
  +   * @return the port for this URI (-1 if not specified).
  +   */
  +  public int getPort()
  +  {
       return m_port;
     }
  +
  +  /**
  +   * Get the path for this URI (optionally with the query string and
  +   * fragment).
  +   *
  +   * @param p_includeQueryString if true (and query string is not null),
  +   *                             then a "?" followed by the query string
  +   *                             will be appended
  +   * @param p_includeFragment if true (and fragment is not null),
  +   *                             then a "#" followed by the fragment
  +   *                             will be appended
  +   *
  +   * @return the path for this URI possibly including the query string
  +   *         and fragment
  +   */
  +  public String getPath(boolean p_includeQueryString,
  +                        boolean p_includeFragment)
  +  {
   
  - /**
  -  * Get the path for this URI (optionally with the query string and
  -  * fragment). 
  -  *
  -  * @param p_includeQueryString if true (and query string is not null),
  -  *                             then a "?" followed by the query string 
  -  *                             will be appended 
  -  * @param p_includeFragment if true (and fragment is not null),
  -  *                             then a "#" followed by the fragment
  -  *                             will be appended
  -  *
  -  * @return the path for this URI possibly including the query string
  -  *         and fragment
  -  */
  -  public String getPath(boolean p_includeQueryString, 
  -                        boolean p_includeFragment) {
       StringBuffer pathString = new StringBuffer(m_path);
   
  -    if (p_includeQueryString && m_queryString != null) {
  +    if (p_includeQueryString && m_queryString != null)
  +    {
         pathString.append('?');
         pathString.append(m_queryString);
       }
   
  -    if (p_includeFragment && m_fragment != null) {
  +    if (p_includeFragment && m_fragment != null)
  +    {
         pathString.append('#');
         pathString.append(m_fragment);
       }
  +
       return pathString.toString();
     }
   
  - /**
  -  * Get the path for this URI. Note that the value returned is the path
  -  * only and does not include the query string or fragment.
  -  *
  -  * @return the path for this URI.
  -  */
  -  public String getPath() {
  +  /**
  +   * Get the path for this URI. Note that the value returned is the path
  +   * only and does not include the query string or fragment.
  +   *
  +   * @return the path for this URI.
  +   */
  +  public String getPath()
  +  {
       return m_path;
     }
   
  - /**
  -  * Get the query string for this URI.
  -  *
  -  * @return the query string for this URI. Null is returned if there
  -  *         was no "?" in the URI spec, empty string if there was a 
  -  *         "?" but no query string following it.
  -  */
  -  public String getQueryString() {
  +  /**
  +   * Get the query string for this URI.
  +   *
  +   * @return the query string for this URI. Null is returned if there
  +   *         was no "?" in the URI spec, empty string if there was a
  +   *         "?" but no query string following it.
  +   */
  +  public String getQueryString()
  +  {
       return m_queryString;
     }
   
  - /**
  -  * Get the fragment for this URI.
  -  *
  -  * @return the fragment for this URI. Null is returned if there
  -  *         was no "#" in the URI spec, empty string if there was a 
  -  *         "#" but no fragment following it.
  -  */
  -  public String getFragment() {
  +  /**
  +   * Get the fragment for this URI.
  +   *
  +   * @return the fragment for this URI. Null is returned if there
  +   *         was no "#" in the URI spec, empty string if there was a
  +   *         "#" but no fragment following it.
  +   */
  +  public String getFragment()
  +  {
       return m_fragment;
     }
   
  - /**
  -  * Set the scheme for this URI. The scheme is converted to lowercase
  -  * before it is set.
  -  *
  -  * @param p_scheme the scheme for this URI (cannot be null)
  -  *
  -  * @exception MalformedURIException if p_scheme is not a conformant
  -  *                                  scheme name
  -  */
  -  public void setScheme(String p_scheme) throws MalformedURIException {
  -    if (p_scheme == null) {
  -      throw new MalformedURIException(
  -                "Cannot set scheme from null string!");
  +  /**
  +   * Set the scheme for this URI. The scheme is converted to lowercase
  +   * before it is set.
  +   *
  +   * @param p_scheme the scheme for this URI (cannot be null)
  +   *
  +   * @exception MalformedURIException if p_scheme is not a conformant
  +   *                                  scheme name
  +   */
  +  public void setScheme(String p_scheme) throws MalformedURIException
  +  {
  +
  +    if (p_scheme == null)
  +    {
  +      throw new MalformedURIException("Cannot set scheme from null string!");
       }
  -    if (!isConformantSchemeName(p_scheme)) {
  +
  +    if (!isConformantSchemeName(p_scheme))
  +    {
         throw new MalformedURIException("The scheme is not conformant.");
       }
   
       m_scheme = p_scheme.toLowerCase();
     }
   
  - /**
  -  * Set the userinfo for this URI. If a non-null value is passed in and 
  -  * the host value is null, then an exception is thrown.
  -  *
  -  * @param p_userinfo the userinfo for this URI
  -  *
  -  * @exception MalformedURIException if p_userinfo contains invalid
  -  *                                  characters
  -  */
  -  public void setUserinfo(String p_userinfo) throws MalformedURIException {
  -    if (p_userinfo == null) {
  +  /**
  +   * Set the userinfo for this URI. If a non-null value is passed in and
  +   * the host value is null, then an exception is thrown.
  +   *
  +   * @param p_userinfo the userinfo for this URI
  +   *
  +   * @exception MalformedURIException if p_userinfo contains invalid
  +   *                                  characters
  +   */
  +  public void setUserinfo(String p_userinfo) throws MalformedURIException
  +  {
  +
  +    if (p_userinfo == null)
  +    {
         m_userinfo = null;
       }
  -    else {
  -      if (m_host == null) {
  +    else
  +    {
  +      if (m_host == null)
  +      {
           throw new MalformedURIException(
  -                     "Userinfo cannot be set when host is null!");
  +          "Userinfo cannot be set when host is null!");
         }
   
         // userinfo can contain alphanumerics, mark characters, escaped
  @@ -915,327 +1085,392 @@
         int index = 0;
         int end = p_userinfo.length();
         char testChar = '\0';
  -      while (index < end) {
  +
  +      while (index < end)
  +      {
           testChar = p_userinfo.charAt(index);
  -        if (testChar == '%') {
  -          if (index+2 >= end ||
  -              !isHex(p_userinfo.charAt(index+1)) ||
  -              !isHex(p_userinfo.charAt(index+2))) {
  +
  +        if (testChar == '%')
  +        {
  +          if (index + 2 >= end ||!isHex(p_userinfo.charAt(index + 1))
  +                  ||!isHex(p_userinfo.charAt(index + 2)))
  +          {
               throw new MalformedURIException(
  -                  "Userinfo contains invalid escape sequence!");
  +              "Userinfo contains invalid escape sequence!");
             }
           }
  -        else if (!isUnreservedCharacter(testChar) &&
  -                 USERINFO_CHARACTERS.indexOf(testChar) == -1) {
  +        else if (!isUnreservedCharacter(testChar)
  +                 && USERINFO_CHARACTERS.indexOf(testChar) == -1)
  +        {
             throw new MalformedURIException(
  -                  "Userinfo contains invalid character:"+testChar);
  +            "Userinfo contains invalid character:" + testChar);
           }
  +
           index++;
         }
       }
  +
       m_userinfo = p_userinfo;
     }
   
     /**
  -  * Set the host for this URI. If null is passed in, the userinfo
  -  * field is also set to null and the port is set to -1.
  -  *
  -  * @param p_host the host for this URI
  -  *
  -  * @exception MalformedURIException if p_host is not a valid IP 
  -  *                                  address or DNS hostname.
  -  */
  -  public void setHost(String p_host) throws MalformedURIException {
  -    if (p_host == null || p_host.trim().length() == 0) {
  +   * Set the host for this URI. If null is passed in, the userinfo
  +   * field is also set to null and the port is set to -1.
  +   *
  +   * @param p_host the host for this URI
  +   *
  +   * @exception MalformedURIException if p_host is not a valid IP
  +   *                                  address or DNS hostname.
  +   */
  +  public void setHost(String p_host) throws MalformedURIException
  +  {
  +
  +    if (p_host == null || p_host.trim().length() == 0)
  +    {
         m_host = p_host;
         m_userinfo = null;
         m_port = -1;
       }
  -    else if (!isWellFormedAddress(p_host)) {
  +    else if (!isWellFormedAddress(p_host))
  +    {
         throw new MalformedURIException("Host is not a well formed address!");
  -    } 
  +    }
  +
       m_host = p_host;
     }
   
  - /**
  -  * Set the port for this URI. -1 is used to indicate that the port is
  -  * not specified, otherwise valid port numbers are  between 0 and 65535.
  -  * If a valid port number is passed in and the host field is null,
  -  * an exception is thrown.
  -  *
  -  * @param p_port the port number for this URI
  -  *
  -  * @exception MalformedURIException if p_port is not -1 and not a 
  -  *                                  valid port number 
  -  */
  -  public void setPort(int p_port) throws MalformedURIException {
  -    if (p_port >= 0 && p_port <= 65535) {
  -      if (m_host == null) {
  +  /**
  +   * Set the port for this URI. -1 is used to indicate that the port is
  +   * not specified, otherwise valid port numbers are  between 0 and 65535.
  +   * If a valid port number is passed in and the host field is null,
  +   * an exception is thrown.
  +   *
  +   * @param p_port the port number for this URI
  +   *
  +   * @exception MalformedURIException if p_port is not -1 and not a
  +   *                                  valid port number
  +   */
  +  public void setPort(int p_port) throws MalformedURIException
  +  {
  +
  +    if (p_port >= 0 && p_port <= 65535)
  +    {
  +      if (m_host == null)
  +      {
           throw new MalformedURIException(
  -                      "Port cannot be set when host is null!");
  +          "Port cannot be set when host is null!");
         }
       }
  -    else if (p_port != -1) {
  +    else if (p_port != -1)
  +    {
         throw new MalformedURIException("Invalid port number!");
       }
  +
       m_port = p_port;
     }
   
  - /**
  -  * Set the path for this URI. If the supplied path is null, then the
  -  * query string and fragment are set to null as well. If the supplied 
  -  * path includes a query string and/or fragment, these fields will be
  -  * parsed and set as well. Note that, for URIs following the "generic
  -  * URI" syntax, the path specified should start with a slash.
  -  * For URIs that do not follow the generic URI syntax, this method 
  -  * sets the scheme-specific part.
  -  *
  -  * @param p_path the path for this URI (may be null)
  -  *
  -  * @exception MalformedURIException if p_path contains invalid
  -  *                                  characters
  -  */
  -  public void setPath(String p_path) throws MalformedURIException {
  -    if (p_path == null) {
  +  /**
  +   * Set the path for this URI. If the supplied path is null, then the
  +   * query string and fragment are set to null as well. If the supplied
  +   * path includes a query string and/or fragment, these fields will be
  +   * parsed and set as well. Note that, for URIs following the "generic
  +   * URI" syntax, the path specified should start with a slash.
  +   * For URIs that do not follow the generic URI syntax, this method
  +   * sets the scheme-specific part.
  +   *
  +   * @param p_path the path for this URI (may be null)
  +   *
  +   * @exception MalformedURIException if p_path contains invalid
  +   *                                  characters
  +   */
  +  public void setPath(String p_path) throws MalformedURIException
  +  {
  +
  +    if (p_path == null)
  +    {
         m_path = null;
         m_queryString = null;
         m_fragment = null;
       }
  -    else {
  +    else
  +    {
         initializePath(p_path);
       }
     }
  +
  +  /**
  +   * Append to the end of the path of this URI. If the current path does
  +   * not end in a slash and the path to be appended does not begin with
  +   * a slash, a slash will be appended to the current path before the
  +   * new segment is added. Also, if the current path ends in a slash
  +   * and the new segment begins with a slash, the extra slash will be
  +   * removed before the new segment is appended.
  +   *
  +   * @param p_addToPath the new segment to be added to the current path
  +   *
  +   * @exception MalformedURIException if p_addToPath contains syntax
  +   *                                  errors
  +   */
  +  public void appendPath(String p_addToPath) throws MalformedURIException
  +  {
   
  - /**
  -  * Append to the end of the path of this URI. If the current path does
  -  * not end in a slash and the path to be appended does not begin with 
  -  * a slash, a slash will be appended to the current path before the 
  -  * new segment is added. Also, if the current path ends in a slash
  -  * and the new segment begins with a slash, the extra slash will be
  -  * removed before the new segment is appended.
  -  *
  -  * @param p_addToPath the new segment to be added to the current path
  -  *
  -  * @exception MalformedURIException if p_addToPath contains syntax
  -  *                                  errors
  -  */
  -  public void appendPath(String p_addToPath) 
  -                         throws MalformedURIException {
  -    if (p_addToPath == null || p_addToPath.trim().length() == 0) {
  +    if (p_addToPath == null || p_addToPath.trim().length() == 0)
  +    {
         return;
       }
   
  -    if (!isURIString(p_addToPath)) {
  -      throw new MalformedURIException(
  -              "Path contains invalid character!");
  +    if (!isURIString(p_addToPath))
  +    {
  +      throw new MalformedURIException("Path contains invalid character!");
       }
   
  -    if (m_path == null || m_path.trim().length() == 0) {
  -      if (p_addToPath.startsWith("/")) {
  +    if (m_path == null || m_path.trim().length() == 0)
  +    {
  +      if (p_addToPath.startsWith("/"))
  +      {
           m_path = p_addToPath;
         }
  -      else {
  +      else
  +      {
           m_path = "/" + p_addToPath;
         }
       }
  -    else if (m_path.endsWith("/")) {
  -      if (p_addToPath.startsWith("/")) {
  +    else if (m_path.endsWith("/"))
  +    {
  +      if (p_addToPath.startsWith("/"))
  +      {
           m_path = m_path.concat(p_addToPath.substring(1));
         }
  -      else {
  +      else
  +      {
           m_path = m_path.concat(p_addToPath);
         }
       }
  -    else {
  -      if (p_addToPath.startsWith("/")) {
  +    else
  +    {
  +      if (p_addToPath.startsWith("/"))
  +      {
           m_path = m_path.concat(p_addToPath);
         }
  -      else {
  +      else
  +      {
           m_path = m_path.concat("/" + p_addToPath);
         }
       }
     }
  +
  +  /**
  +   * Set the query string for this URI. A non-null value is valid only
  +   * if this is an URI conforming to the generic URI syntax and
  +   * the path value is not null.
  +   *
  +   * @param p_queryString the query string for this URI
  +   *
  +   * @exception MalformedURIException if p_queryString is not null and this
  +   *                                  URI does not conform to the generic
  +   *                                  URI syntax or if the path is null
  +   */
  +  public void setQueryString(String p_queryString)
  +          throws MalformedURIException
  +  {
   
  - /**
  -  * Set the query string for this URI. A non-null value is valid only
  -  * if this is an URI conforming to the generic URI syntax and 
  -  * the path value is not null.
  -  *
  -  * @param p_queryString the query string for this URI
  -  *
  -  * @exception MalformedURIException if p_queryString is not null and this  
  -  *                                  URI does not conform to the generic
  -  *                                  URI syntax or if the path is null
  -  */
  -  public void setQueryString(String p_queryString) throws MalformedURIException {
  -    if (p_queryString == null) {
  +    if (p_queryString == null)
  +    {
         m_queryString = null;
       }
  -    else if (!isGenericURI()) {
  +    else if (!isGenericURI())
  +    {
         throw new MalformedURIException(
  -              "Query string can only be set for a generic URI!");
  +        "Query string can only be set for a generic URI!");
       }
  -    else if (getPath() == null) {
  +    else if (getPath() == null)
  +    {
         throw new MalformedURIException(
  -              "Query string cannot be set when path is null!");
  +        "Query string cannot be set when path is null!");
       }
  -    else if (!isURIString(p_queryString)) {
  +    else if (!isURIString(p_queryString))
  +    {
         throw new MalformedURIException(
  -              "Query string contains invalid character!");
  +        "Query string contains invalid character!");
       }
  -    else {
  +    else
  +    {
         m_queryString = p_queryString;
       }
     }
  +
  +  /**
  +   * Set the fragment for this URI. A non-null value is valid only
  +   * if this is a URI conforming to the generic URI syntax and
  +   * the path value is not null.
  +   *
  +   * @param p_fragment the fragment for this URI
  +   *
  +   * @exception MalformedURIException if p_fragment is not null and this
  +   *                                  URI does not conform to the generic
  +   *                                  URI syntax or if the path is null
  +   */
  +  public void setFragment(String p_fragment) throws MalformedURIException
  +  {
   
  - /**
  -  * Set the fragment for this URI. A non-null value is valid only
  -  * if this is a URI conforming to the generic URI syntax and 
  -  * the path value is not null.
  -  *
  -  * @param p_fragment the fragment for this URI
  -  *
  -  * @exception MalformedURIException if p_fragment is not null and this  
  -  *                                  URI does not conform to the generic
  -  *                                  URI syntax or if the path is null
  -  */
  -  public void setFragment(String p_fragment) throws MalformedURIException {
  -    if (p_fragment == null) {
  +    if (p_fragment == null)
  +    {
         m_fragment = null;
       }
  -    else if (!isGenericURI()) {
  +    else if (!isGenericURI())
  +    {
         throw new MalformedURIException(
  -         "Fragment can only be set for a generic URI!");
  +        "Fragment can only be set for a generic URI!");
       }
  -    else if (getPath() == null) {
  +    else if (getPath() == null)
  +    {
         throw new MalformedURIException(
  -              "Fragment cannot be set when path is null!");
  +        "Fragment cannot be set when path is null!");
       }
  -    else if (!isURIString(p_fragment)) {
  -      throw new MalformedURIException(
  -              "Fragment contains invalid character!");
  +    else if (!isURIString(p_fragment))
  +    {
  +      throw new MalformedURIException("Fragment contains invalid character!");
       }
  -    else {
  +    else
  +    {
         m_fragment = p_fragment;
       }
     }
  +
  +  /**
  +   * Determines if the passed-in Object is equivalent to this URI.
  +   *
  +   * @param p_test the Object to test for equality.
  +   *
  +   * @return true if p_test is a URI with all values equal to this
  +   *         URI, false otherwise
  +   */
  +  public boolean equals(Object p_test)
  +  {
   
  - /**
  -  * Determines if the passed-in Object is equivalent to this URI.
  -  *
  -  * @param p_test the Object to test for equality.
  -  *
  -  * @return true if p_test is a URI with all values equal to this
  -  *         URI, false otherwise
  -  */
  -  public boolean equals(Object p_test) {
  -    if (p_test instanceof URI) {
  +    if (p_test instanceof URI)
  +    {
         URI testURI = (URI) p_test;
  -      if (((m_scheme == null && testURI.m_scheme == null) ||
  -           (m_scheme != null && testURI.m_scheme != null &&
  -            m_scheme.equals(testURI.m_scheme))) &&
  -          ((m_userinfo == null && testURI.m_userinfo == null) ||
  -           (m_userinfo != null && testURI.m_userinfo != null &&
  -            m_userinfo.equals(testURI.m_userinfo))) &&
  -          ((m_host == null && testURI.m_host == null) ||
  -           (m_host != null && testURI.m_host != null &&
  -            m_host.equals(testURI.m_host))) &&
  -            m_port == testURI.m_port &&
  -          ((m_path == null && testURI.m_path == null) ||
  -           (m_path != null && testURI.m_path != null &&
  -            m_path.equals(testURI.m_path))) &&
  -          ((m_queryString == null && testURI.m_queryString == null) ||
  -           (m_queryString != null && testURI.m_queryString != null &&
  -            m_queryString.equals(testURI.m_queryString))) &&
  -          ((m_fragment == null && testURI.m_fragment == null) ||
  -           (m_fragment != null && testURI.m_fragment != null &&
  -            m_fragment.equals(testURI.m_fragment)))) {
  +
  +      if (((m_scheme == null && testURI.m_scheme == null) || (m_scheme != null && testURI.m_scheme != null && m_scheme.equals(
  +              testURI.m_scheme))) && ((m_userinfo == null && testURI.m_userinfo == null) || (m_userinfo != null && testURI.m_userinfo != null && m_userinfo.equals(
  +              testURI.m_userinfo))) && ((m_host == null && testURI.m_host == null) || (m_host != null && testURI.m_host != null && m_host.equals(
  +              testURI.m_host))) && m_port == testURI.m_port && ((m_path == null && testURI.m_path == null) || (m_path != null && testURI.m_path != null && m_path.equals(
  +              testURI.m_path))) && ((m_queryString == null && testURI.m_queryString == null) || (m_queryString != null && testURI.m_queryString != null && m_queryString.equals(
  +              testURI.m_queryString))) && ((m_fragment == null && testURI.m_fragment == null) || (m_fragment != null && testURI.m_fragment != null && m_fragment.equals(
  +              testURI.m_fragment))))
  +      {
           return true;
         }
       }
  +
       return false;
     }
   
  - /**
  -  * Get the URI as a string specification. See RFC 2396 Section 5.2.
  -  *
  -  * @return the URI string specification
  -  */
  -  public String toString() {
  +  /**
  +   * Get the URI as a string specification. See RFC 2396 Section 5.2.
  +   *
  +   * @return the URI string specification
  +   */
  +  public String toString()
  +  {
  +
       StringBuffer uriSpecString = new StringBuffer();
   
  -    if (m_scheme != null) {
  +    if (m_scheme != null)
  +    {
         uriSpecString.append(m_scheme);
         uriSpecString.append(':');
       }
  +
       uriSpecString.append(getSchemeSpecificPart());
  +
       return uriSpecString.toString();
     }
  +
  +  /**
  +   * Get the indicator as to whether this URI uses the "generic URI"
  +   * syntax.
  +   *
  +   * @return true if this URI uses the "generic URI" syntax, false
  +   *         otherwise
  +   */
  +  public boolean isGenericURI()
  +  {
   
  - /**
  -  * Get the indicator as to whether this URI uses the "generic URI"
  -  * syntax.
  -  *
  -  * @return true if this URI uses the "generic URI" syntax, false
  -  *         otherwise
  -  */
  -  public boolean isGenericURI() {
       // presence of the host (whether valid or empty) means 
       // double-slashes which means generic uri
       return (m_host != null);
     }
   
  - /**
  -  * Determine whether a scheme conforms to the rules for a scheme name.
  -  * A scheme is conformant if it starts with an alphanumeric, and 
  -  * contains only alphanumerics, '+','-' and '.'.
  -  *
  -  * @return true if the scheme is conformant, false otherwise
  -  */
  -  public static boolean isConformantSchemeName(String p_scheme) {
  -    if (p_scheme == null || p_scheme.trim().length() == 0) {
  +  /**
  +   * Determine whether a scheme conforms to the rules for a scheme name.
  +   * A scheme is conformant if it starts with an alphanumeric, and
  +   * contains only alphanumerics, '+','-' and '.'.
  +   *
  +   *
  +   * NEEDSDOC @param p_scheme
  +   * @return true if the scheme is conformant, false otherwise
  +   */
  +  public static boolean isConformantSchemeName(String p_scheme)
  +  {
  +
  +    if (p_scheme == null || p_scheme.trim().length() == 0)
  +    {
         return false;
       }
   
  -    if (!isAlpha(p_scheme.charAt(0))) {
  +    if (!isAlpha(p_scheme.charAt(0)))
  +    {
         return false;
       }
   
       char testChar;
  -    for (int i = 1; i < p_scheme.length(); i++) {
  +
  +    for (int i = 1; i < p_scheme.length(); i++)
  +    {
         testChar = p_scheme.charAt(i);
  -      if (!isAlphanum(testChar) && 
  -          SCHEME_CHARACTERS.indexOf(testChar) == -1) {
  +
  +      if (!isAlphanum(testChar) && SCHEME_CHARACTERS.indexOf(testChar) == -1)
  +      {
           return false;
         }
       }
   
       return true;
     }
  +
  +  /**
  +   * Determine whether a string is syntactically capable of representing
  +   * a valid IPv4 address or the domain name of a network host. A valid
  +   * IPv4 address consists of four decimal digit groups separated by a
  +   * '.'. A hostname consists of domain labels (each of which must
  +   * begin and end with an alphanumeric but may contain '-') separated
  +   * & by a '.'. See RFC 2396 Section 3.2.2.
  +   *
  +   *
  +   * NEEDSDOC @param p_address
  +   * @return true if the string is a syntactically valid IPv4 address
  +   *              or hostname
  +   */
  +  public static boolean isWellFormedAddress(String p_address)
  +  {
   
  - /**
  -  * Determine whether a string is syntactically capable of representing
  -  * a valid IPv4 address or the domain name of a network host. A valid
  -  * IPv4 address consists of four decimal digit groups separated by a
  -  * '.'. A hostname consists of domain labels (each of which must 
  -  * begin and end with an alphanumeric but may contain '-') separated
  -  & by a '.'. See RFC 2396 Section 3.2.2.
  -  *
  -  * @return true if the string is a syntactically valid IPv4 address 
  -  *              or hostname
  -  */
  -  public static boolean isWellFormedAddress(String p_address) {
  -    if (p_address == null) {
  +    if (p_address == null)
  +    {
         return false;
       }
   
       String address = p_address.trim();
       int addrLength = address.length();
  -    if (addrLength == 0 || addrLength > 255) {
  +
  +    if (addrLength == 0 || addrLength > 255)
  +    {
         return false;
       }
   
  -    if (address.startsWith(".") || address.startsWith("-")) {
  +    if (address.startsWith(".") || address.startsWith("-"))
  +    {
         return false;
       }
   
  @@ -1243,152 +1478,203 @@
       // since top level domain label can only start with an alpha
       // see RFC 2396 Section 3.2.2
       int index = address.lastIndexOf('.');
  -    if (address.endsWith(".")) {
  +
  +    if (address.endsWith("."))
  +    {
         index = address.substring(0, index).lastIndexOf('.');
       }
   
  -    if (index+1 < addrLength && isDigit(p_address.charAt(index+1))) {
  +    if (index + 1 < addrLength && isDigit(p_address.charAt(index + 1)))
  +    {
         char testChar;
         int numDots = 0;
   
         // make sure that 1) we see only digits and dot separators, 2) that
         // any dot separator is preceded and followed by a digit and 
         // 3) that we find 3 dots
  -      for (int i = 0; i < addrLength; i++) {
  +      for (int i = 0; i < addrLength; i++)
  +      {
           testChar = address.charAt(i);
  -        if (testChar == '.') {
  -          if (!isDigit(address.charAt(i-1)) || 
  -              (i+1 < addrLength && !isDigit(address.charAt(i+1)))) {
  +
  +        if (testChar == '.')
  +        {
  +          if (!isDigit(address.charAt(i - 1))
  +                  || (i + 1 < addrLength &&!isDigit(address.charAt(i + 1))))
  +          {
               return false;
             }
  +
             numDots++;
           }
  -        else if (!isDigit(testChar)) {
  +        else if (!isDigit(testChar))
  +        {
             return false;
           }
         }
  -      if (numDots != 3) {
  +
  +      if (numDots != 3)
  +      {
           return false;
         }
       }
  -    else {
  +    else
  +    {
  +
         // domain labels can contain alphanumerics and '-"
         // but must start and end with an alphanumeric
         char testChar;
  -  
  -      for (int i = 0; i < addrLength; i++) {
  +
  +      for (int i = 0; i < addrLength; i++)
  +      {
           testChar = address.charAt(i);
  -        if (testChar == '.') {
  -          if (!isAlphanum(address.charAt(i-1))) {
  +
  +        if (testChar == '.')
  +        {
  +          if (!isAlphanum(address.charAt(i - 1)))
  +          {
               return false;
  -          } 
  -          if (i+1 < addrLength && !isAlphanum(address.charAt(i+1))) {
  +          }
  +
  +          if (i + 1 < addrLength &&!isAlphanum(address.charAt(i + 1)))
  +          {
               return false;
             }
           }
  -        else if (!isAlphanum(testChar) && testChar != '-') {
  +        else if (!isAlphanum(testChar) && testChar != '-')
  +        {
             return false;
           }
         }
       }
  +
       return true;
     }
   
  -
  - /**
  -  * Determine whether a char is a digit.
  -  *
  -  * @return true if the char is betweeen '0' and '9', false otherwise
  -  */
  -  private static boolean isDigit(char p_char) {
  +  /**
  +   * Determine whether a char is a digit.
  +   *
  +   *
  +   * NEEDSDOC @param p_char
  +   * @return true if the char is betweeen '0' and '9', false otherwise
  +   */
  +  private static boolean isDigit(char p_char)
  +  {
       return p_char >= '0' && p_char <= '9';
     }
   
  - /**
  -  * Determine whether a character is a hexadecimal character.
  -  *
  -  * @return true if the char is betweeen '0' and '9', 'a' and 'f'
  -  *         or 'A' and 'F', false otherwise
  -  */
  -  private static boolean isHex(char p_char) {
  -    return (isDigit(p_char) || 
  -            (p_char >= 'a' && p_char <= 'f') || 
  -            (p_char >= 'A' && p_char <= 'F'));
  -  }
  -
  - /**
  -  * Determine whether a char is an alphabetic character: a-z or A-Z
  -  *
  -  * @return true if the char is alphabetic, false otherwise
  -  */
  -  private static boolean isAlpha(char p_char) {
  -    return ((p_char >= 'a' && p_char <= 'z') || 
  -            (p_char >= 'A' && p_char <= 'Z' )); 
  -  }
  -
  - /**
  -  * Determine whether a char is an alphanumeric: 0-9, a-z or A-Z
  -  *
  -  * @return true if the char is alphanumeric, false otherwise
  -  */
  -  private static boolean isAlphanum(char p_char) {
  -    return (isAlpha(p_char) || isDigit(p_char)); 
  -  }
  -
  - /**
  -  * Determine whether a character is a reserved character:
  -  * ';', '/', '?', ':', '@', '&', '=', '+', '$' or ',' 
  -  *
  -  * @return true if the string contains any reserved characters
  -  */
  -  private static boolean isReservedCharacter(char p_char) {
  +  /**
  +   * Determine whether a character is a hexadecimal character.
  +   *
  +   *
  +   * NEEDSDOC @param p_char
  +   * @return true if the char is betweeen '0' and '9', 'a' and 'f'
  +   *         or 'A' and 'F', false otherwise
  +   */
  +  private static boolean isHex(char p_char)
  +  {
  +    return (isDigit(p_char) || (p_char >= 'a' && p_char <= 'f')
  +            || (p_char >= 'A' && p_char <= 'F'));
  +  }
  +
  +  /**
  +   * Determine whether a char is an alphabetic character: a-z or A-Z
  +   *
  +   *
  +   * NEEDSDOC @param p_char
  +   * @return true if the char is alphabetic, false otherwise
  +   */
  +  private static boolean isAlpha(char p_char)
  +  {
  +    return ((p_char >= 'a' && p_char <= 'z')
  +            || (p_char >= 'A' && p_char <= 'Z'));
  +  }
  +
  +  /**
  +   * Determine whether a char is an alphanumeric: 0-9, a-z or A-Z
  +   *
  +   *
  +   * NEEDSDOC @param p_char
  +   * @return true if the char is alphanumeric, false otherwise
  +   */
  +  private static boolean isAlphanum(char p_char)
  +  {
  +    return (isAlpha(p_char) || isDigit(p_char));
  +  }
  +
  +  /**
  +   * Determine whether a character is a reserved character:
  +   * ';', '/', '?', ':', '@', '&', '=', '+', '$' or ','
  +   *
  +   *
  +   * NEEDSDOC @param p_char
  +   * @return true if the string contains any reserved characters
  +   */
  +  private static boolean isReservedCharacter(char p_char)
  +  {
       return RESERVED_CHARACTERS.indexOf(p_char) != -1;
     }
  +
  +  /**
  +   * Determine whether a char is an unreserved character.
  +   *
  +   *
  +   * NEEDSDOC @param p_char
  +   * @return true if the char is unreserved, false otherwise
  +   */
  +  private static boolean isUnreservedCharacter(char p_char)
  +  {
  +    return (isAlphanum(p_char) || MARK_CHARACTERS.indexOf(p_char) != -1);
  +  }
  +
  +  /**
  +   * Determine whether a given string contains only URI characters (also
  +   * called "uric" in RFC 2396). uric consist of all reserved
  +   * characters, unreserved characters and escaped characters.
  +   *
  +   *
  +   * NEEDSDOC @param p_uric
  +   * @return true if the string is comprised of uric, false otherwise
  +   */
  +  private static boolean isURIString(String p_uric)
  +  {
   
  - /**
  -  * Determine whether a char is an unreserved character.
  -  *
  -  * @return true if the char is unreserved, false otherwise
  -  */
  -  private static boolean isUnreservedCharacter(char p_char) {
  -    return (isAlphanum(p_char) || 
  -            MARK_CHARACTERS.indexOf(p_char) != -1);
  -  }
  -
  - /**
  -  * Determine whether a given string contains only URI characters (also
  -  * called "uric" in RFC 2396). uric consist of all reserved
  -  * characters, unreserved characters and escaped characters.
  -  *
  -  * @return true if the string is comprised of uric, false otherwise
  -  */
  -  private static boolean isURIString(String p_uric) {
  -    if (p_uric == null) {
  +    if (p_uric == null)
  +    {
         return false;
       }
  +
       int end = p_uric.length();
       char testChar = '\0';
  -    for (int i = 0; i < end; i++) {
  +
  +    for (int i = 0; i < end; i++)
  +    {
         testChar = p_uric.charAt(i);
  -      if (testChar == '%') {
  -        if (i+2 >= end ||
  -            !isHex(p_uric.charAt(i+1)) ||
  -            !isHex(p_uric.charAt(i+2))) {
  +
  +      if (testChar == '%')
  +      {
  +        if (i + 2 >= end ||!isHex(p_uric.charAt(i + 1))
  +                ||!isHex(p_uric.charAt(i + 2)))
  +        {
             return false;
           }
  -        else {
  +        else
  +        {
             i += 2;
  +
             continue;
           }
         }
  -      if (isReservedCharacter(testChar) || 
  -          isUnreservedCharacter(testChar)) {
  -          continue;
  +
  +      if (isReservedCharacter(testChar) || isUnreservedCharacter(testChar))
  +      {
  +        continue;
         }
  -      else {
  +      else
  +      {
           return false;
         }
       }
  +
       return true;
     }
   }
  
  
  
  1.5       +756 -245  xml-xalan/java/src/org/apache/xalan/utils/UnImplNode.java
  
  Index: UnImplNode.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/UnImplNode.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UnImplNode.java	2000/10/17 19:23:04	1.4
  +++ UnImplNode.java	2000/10/30 18:57:27	1.5
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -57,6 +57,7 @@
   package org.apache.xalan.utils;
   
   import org.w3c.dom.*;
  +
   import org.apache.xalan.res.XSLTErrorResources;
   import org.apache.xalan.res.XSLMessages;
   
  @@ -66,533 +67,1043 @@
    */
   public class UnImplNode implements Node, Element, NodeList, Document
   {
  -  public UnImplNode()
  -  {
  -  }
  +
  +  /**
  +   * Constructor UnImplNode
  +   *
  +   */
  +  public UnImplNode(){}
   
     /**
      * Throw an error.
  +   *
  +   * NEEDSDOC @param msg
      */
     public void error(int msg)
     {
  -    System.out.println("DOM ERROR! class: "+this.getClass().getName());
  +
  +    System.out.println("DOM ERROR! class: " + this.getClass().getName());
  +
       throw new RuntimeException(XSLMessages.createMessage(msg, null));
     }
   
     /**
      * Throw an error.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
      */
  -  public void error(int msg, Object[]args)
  +  public void error(int msg, Object[] args)
     {
  -    System.out.println("DOM ERROR! class: "+this.getClass().getName());
  -    throw new RuntimeException(XSLMessages.createMessage(msg, args)); //"UnImplNode error: "+msg);
  +
  +    System.out.println("DOM ERROR! class: " + this.getClass().getName());
  +
  +    throw new RuntimeException(XSLMessages.createMessage(msg, args));  //"UnImplNode error: "+msg);
     }
   
  -  /** Unimplemented. */
  -  public Node               appendChild(Node newChild)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param newChild
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node appendChild(Node newChild) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"appendChild not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"appendChild not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public boolean            hasChildNodes()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public boolean hasChildNodes()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasChildNodes not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasChildNodes not supported!");
  +
       return false;
     }
   
  -  /** Unimplemented. */
  -  public short              getNodeType()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public short getNodeType()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeType not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNodeType not supported!");
  +
       return 0;
     }
   
  -  /** Unimplemented. */
  -  public Node               getParentNode()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getParentNode()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getParentNode not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getParentNode not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public NodeList           getChildNodes()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public NodeList getChildNodes()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getChildNodes not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getChildNodes not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               getFirstChild()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getFirstChild()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getFirstChild not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getFirstChild not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               getLastChild()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getLastChild()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLastChild not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getLastChild not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               getNextSibling()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getNextSibling()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNextSibling not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNextSibling not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public int getLength()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLength not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getLength not supported!");
  +
       return 0;
  -  } // getLength():int
  +  }  // getLength():int
   
  -  /** Unimplemented. */
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param index
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Node item(int index)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"item not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"item not supported!");
  +
       return null;
  -  } // item(int):Node
  +  }  // item(int):Node
   
  -  /** Unimplemented. */
  -  public Document           getOwnerDocument()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Document getOwnerDocument()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerDocument not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getOwnerDocument not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getTagName()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getTagName not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getTagName not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getNodeName()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeName not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNodeName not supported!");
  +
       return null;
     }
   
     /** Unimplemented. */
  -  public void               normalize()
  +  public void normalize()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"normalize not supported!");
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"normalize not supported!");
     }
   
  -  /** Unimplemented. */
  -  public NodeList           getElementsByTagName(String name)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public NodeList getElementsByTagName(String name)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagName not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getElementsByTagName not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Attr               removeAttributeNode(Attr oldAttr)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param oldAttr
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Attr removeAttributeNode(Attr oldAttr) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNode not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"removeAttributeNode not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Attr               setAttributeNode(Attr newAttr)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param newAttr
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Attr setAttributeNode(Attr newAttr) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNode not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttributeNode not supported!");
  +
       return null;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method hasAttribute 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (hasAttribute) @return
  +   */
     public boolean hasAttribute(String name)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttribute not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasAttribute not supported!");
  +
       return false;
     }
   
  +  /**
  +   * NEEDSDOC Method hasAttributeNS 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param x
  +   *
  +   * NEEDSDOC (hasAttributeNS) @return
  +   */
     public boolean hasAttributeNS(String name, String x)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributeNS not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasAttributeNS not supported!");
  +
       return false;
     }
   
  -  public Attr               getAttributeNode(String name)
  +  /**
  +   * NEEDSDOC Method getAttributeNode 
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC (getAttributeNode) @return
  +   */
  +  public Attr getAttributeNode(String name)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNode not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributeNode not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public void               removeAttribute(String name)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * @throws DOMException
  +   */
  +  public void removeAttribute(String name) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttribute not supported!");
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"removeAttribute not supported!");
     }
   
  -  /** Unimplemented. */
  -  public void               setAttribute(String name,
  -                                         String value)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
  +   */
  +  public void setAttribute(String name, String value) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttribute not supported!");
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttribute not supported!");
     }
   
  -  /** Unimplemented. */
  -  public String             getAttribute(String name)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getAttribute(String name)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttribute not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttribute not supported!");
  +
       return null;
     }
  -  
  +
     /**
      * Introduced in DOM Level 2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean hasAttributes() 
  +  public boolean hasAttributes()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"hasAttributes not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"hasAttributes not supported!");
  +
       return false;
     }
   
  -  /** Unimplemented. */
  -  public NodeList           getElementsByTagNameNS(String namespaceURI,
  -                                                   String localName)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public NodeList getElementsByTagNameNS(String namespaceURI,
  +                                         String localName)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getElementsByTagNameNS not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getElementsByTagNameNS not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Attr               setAttributeNodeNS(Attr newAttr)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param newAttr
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Attr setAttributeNodeNS(Attr newAttr) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNodeNS not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttributeNodeNS not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Attr               getAttributeNodeNS(String namespaceURI,
  -                                               String localName)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Attr getAttributeNodeNS(String namespaceURI, String localName)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNodeNS not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributeNodeNS not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public void               removeAttributeNS(String namespaceURI,
  -                                              String localName)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * @throws DOMException
  +   */
  +  public void removeAttributeNS(String namespaceURI, String localName)
  +          throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"removeAttributeNS not supported!");
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"removeAttributeNS not supported!");
     }
   
  -  /** Unimplemented. */
  -  public void               setAttributeNS(String namespaceURI,
  -                                           String qualifiedName,
  -                                           String value)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
  +   */
  +  public void setAttributeNS(
  +          String namespaceURI, String qualifiedName, String value)
  +            throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setAttributeNS not supported!");
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setAttributeNS not supported!");
     }
   
  -  /** Unimplemented. */
  -  public String             getAttributeNS(String namespaceURI,
  -                                           String localName)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param localName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getAttributeNS(String namespaceURI, String localName)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributeNS not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributeNS not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               getPreviousSibling()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node getPreviousSibling()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPreviousSibling not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getPreviousSibling not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               cloneNode(boolean deep)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param deep
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Node cloneNode(boolean deep)
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"cloneNode not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"cloneNode not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public String             getNodeValue()
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public String getNodeValue() throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNodeValue not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNodeValue not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public void               setNodeValue(String nodeValue)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param nodeValue
  +   *
  +   * @throws DOMException
  +   */
  +  public void setNodeValue(String nodeValue) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setNodeValue not supported!");
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setNodeValue not supported!");
     }
  -  
  -  /** Unimplemented. */
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param value
  +   *
  +   * @throws DOMException
  +   */
  +
     // public String getValue ()
     // {      
     //  error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getValue not supported!");
     //  return null;
     // } 
  -  
  +
     /** Unimplemented. */
  -  public void setValue (String value) throws DOMException
  -  {      
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!");
  +  public void setValue(String value) throws DOMException
  +  {
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setValue not supported!");
     }
  -  
  +
     /**
  -   *  Returns the name of this attribute. 
  +   *  Returns the name of this attribute.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  +
     // public String getName()
     // {
     //  return this.getNodeName();
     // }
  -  
     public Element getOwnerElement()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getOwnerElement not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getOwnerElement not supported!");
  +
       return null;
     }
  -  
  -  /** Unimplemented. */
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public boolean getSpecified()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setValue not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setValue not supported!");
  +
       return false;
     }
   
  -  /** Unimplemented. */
  -  public NamedNodeMap       getAttributes()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public NamedNodeMap getAttributes()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getAttributes not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getAttributes not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               insertBefore(Node newChild,
  -                                         Node refChild)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param newChild
  +   * NEEDSDOC @param refChild
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node insertBefore(Node newChild, Node refChild) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"insertBefore not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"insertBefore not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               replaceChild(Node newChild,
  -                                         Node oldChild)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param newChild
  +   * NEEDSDOC @param oldChild
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node replaceChild(Node newChild, Node oldChild) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"replaceChild not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               removeChild(Node oldChild)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param oldChild
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node removeChild(Node oldChild) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"replaceChild not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"replaceChild not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public boolean            supports(String feature,
  -                                     String version)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param feature
  +   * NEEDSDOC @param version
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public boolean supports(String feature, String version)
     {
       return false;
     }
   
  -  /** Unimplemented. */
  -  public String             getNamespaceURI()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getNamespaceURI()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getNamespaceURI not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getNamespaceURI not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public String             getPrefix()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getPrefix()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getPrefix not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getPrefix not supported!");
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public void               setPrefix(String prefix)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param prefix
  +   *
  +   * @throws DOMException
  +   */
  +  public void setPrefix(String prefix) throws DOMException
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"setPrefix not supported!");
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"setPrefix not supported!");
     }
   
  -  /** Unimplemented. */
  -  public String       getLocalName()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public String getLocalName()
     {
  -    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED); //"getLocalName not supported!");
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);  //"getLocalName not supported!");
  +
       return null;
     }
  -  
  -  /** Unimplemented. */
  -  public DocumentType       getDoctype()
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public DocumentType getDoctype()
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public DOMImplementation  getImplementation()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public DOMImplementation getImplementation()
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Element            getDocumentElement()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Element getDocumentElement()
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Element            createElement(String tagName)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param tagName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Element createElement(String tagName) throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public DocumentFragment   createDocumentFragment()
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public DocumentFragment createDocumentFragment()
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Text               createTextNode(String data)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Text createTextNode(String data)
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Comment            createComment(String data)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Comment createComment(String data)
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public CDATASection       createCDATASection(String data)
  -    throws DOMException
  -
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public CDATASection createCDATASection(String data) throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public ProcessingInstruction createProcessingInstruction(String target,
  -                                                           String data)
  -    throws DOMException
  -
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param target
  +   * NEEDSDOC @param data
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public ProcessingInstruction createProcessingInstruction(
  +          String target, String data) throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Attr               createAttribute(String name)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Attr createAttribute(String name) throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public EntityReference    createEntityReference(String name)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public EntityReference createEntityReference(String name)
  +          throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Node               importNode(Node importedNode,
  -                                       boolean deep)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param importedNode
  +   * NEEDSDOC @param deep
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Node importNode(Node importedNode, boolean deep) throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Element            createElementNS(String namespaceURI,
  -                                            String qualifiedName)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Element createElementNS(String namespaceURI, String qualifiedName)
  +          throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Attr               createAttributeNS(String namespaceURI,
  -                                              String qualifiedName)
  -    throws DOMException
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param namespaceURI
  +   * NEEDSDOC @param qualifiedName
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Attr createAttributeNS(String namespaceURI, String qualifiedName)
  +          throws DOMException
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
   
  -  /** Unimplemented. */
  -  public Element            getElementById(String elementId)
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param elementId
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public Element getElementById(String elementId)
     {
  +
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
     }
  -  
  -  public void         setData(String data)
  -    throws DOMException
  {
    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
  +  /**
  +   * NEEDSDOC Method setData 
  +   *
  +   *
  +   * NEEDSDOC @param data
  +   *
  +   * @throws DOMException
  +   */
  +  public void setData(String data) throws DOMException
  +  {
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
   
  -  /** Unimplemented. */
  -  public String       substringData(int offset, 
  -                                    int count)
  -    throws DOMException
  {
    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param count
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public String substringData(int offset, int count) throws DOMException
  +  {
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
       return null;
  -  }
  
  -  /** Unimplemented. */
  -  public void         appendData(String arg)
  -    throws DOMException
  {
    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  -  }
  
  -  /** Unimplemented. */
  -  public void         insertData(int offset, 
  -                                 String arg)
  -    throws DOMException
  {
    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  -  }
  
  -  /** Unimplemented. */
  -  public void         deleteData(int offset, 
  -                                 int count)
  -    throws DOMException
  {
    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  -  }
  
  -  /** Unimplemented. */
  -  public void         replaceData(int offset, 
  -                                  int count, 
  -                                  String arg)
  -    throws DOMException
  {
  +  }
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param arg
  +   *
  +   * @throws DOMException
  +   */
  +  public void appendData(String arg) throws DOMException
  +  {
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
     }
   
  -  /** Unimplemented. */
  -  public Text         splitText(int offset)
  -    throws DOMException
  {
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param arg
  +   *
  +   * @throws DOMException
  +   */
  +  public void insertData(int offset, String arg) throws DOMException
  +  {
       error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  -    return null;
  }
  +  }
   
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param count
  +   *
  +   * @throws DOMException
  +   */
  +  public void deleteData(int offset, int count) throws DOMException
  +  {
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +  }
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param offset
  +   * NEEDSDOC @param count
  +   * NEEDSDOC @param arg
  +   *
  +   * @throws DOMException
  +   */
  +  public void replaceData(int offset, int count, String arg)
  +          throws DOMException
  +  {
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +  }
  +
  +  /**
  +   * Unimplemented. 
  +   *
  +   * NEEDSDOC @param offset
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws DOMException
  +   */
  +  public Text splitText(int offset) throws DOMException
  +  {
  +
  +    error(XSLTErrorResources.ER_FUNCTION_NOT_SUPPORTED);
  +
  +    return null;
  +  }
   }
  
  
  
  1.2       +69 -5     xml-xalan/java/src/org/apache/xalan/utils/WrappedRuntimeException.java
  
  Index: WrappedRuntimeException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/WrappedRuntimeException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WrappedRuntimeException.java	2000/10/06 07:48:55	1.1
  +++ WrappedRuntimeException.java	2000/10/30 18:57:28	1.2
  @@ -1,26 +1,90 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.utils;
   
   /**
  - * This class is for throwing important checked exceptions 
  - * over non-checked methods.  It should be used with care, 
  + * This class is for throwing important checked exceptions
  + * over non-checked methods.  It should be used with care,
    * and in limited circumstances.
    */
   public class WrappedRuntimeException extends RuntimeException
   {
  +
  +  /** NEEDSDOC Field m_exception          */
     private Exception m_exception;
  -  
  +
     /**
  -   * Construct a WrappedRuntimeException from a 
  +   * Construct a WrappedRuntimeException from a
      * checked exception.
  +   *
  +   * NEEDSDOC @param e
      */
     public WrappedRuntimeException(Exception e)
     {
  +
       super(e.getMessage());
  +
       m_exception = e;
     }
  -  
  +
     /**
      * Get the checked exception that this runtime exception wraps.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Exception getException()
     {
  
  
  
  1.2       +4 -3      xml-xalan/java/src/org/apache/xalan/utils/WrongParserException.java
  
  Index: WrongParserException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/WrongParserException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WrongParserException.java	2000/06/19 16:53:14	1.1
  +++ WrongParserException.java	2000/10/30 18:57:29	1.2
  @@ -58,17 +58,18 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * Certain functions may throw this error if they are paired with 
  + * Certain functions may throw this error if they are paired with
    * the incorrect parser.
    */
   public class WrongParserException extends RuntimeException
   {
  +
     /**
      * Create a WrongParserException object.
      * @param message The error message that should be reported to the user.
      */
  -  public WrongParserException(String message) 
  +  public WrongParserException(String message)
     {
  -     super(message);
  +    super(message);
     }
   }
  
  
  
  1.3       +77 -5     xml-xalan/java/src/org/apache/xalan/utils/XMLCharacterRecognizer.java
  
  Index: XMLCharacterRecognizer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/XMLCharacterRecognizer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XMLCharacterRecognizer.java	2000/10/17 19:51:31	1.2
  +++ XMLCharacterRecognizer.java	2000/10/30 18:57:29	1.3
  @@ -1,7 +1,68 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xalan.utils;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class XMLCharacterRecognizer <needs-comment/>
  + */
   public class XMLCharacterRecognizer
   {
  +
     /**
      * Returns whether the specified <var>ch</var> conforms to the XML 1.0 definition
      * of whitespace.  Refer to <A href="http://www.w3.org/TR/1998/REC-xml-19980210#NT-S">
  @@ -17,33 +78,44 @@
     /**
      * Tell if the string is whitespace.
      * @param   string      String to be trimmed.
  +   *
  +   * NEEDSDOC @param ch
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param length
      * @return              The trimmed string.
      */
     public static boolean isWhiteSpace(char ch[], int start, int length)
     {
  -    int end = start+length;
  -    for(int s = start;  s < end;  s++)
  +
  +    int end = start + length;
  +
  +    for (int s = start; s < end; s++)
       {
         if (!isWhiteSpace(ch[s]))
           return false;
       }
  +
       return true;
     }
  -  
  +
     /**
      * Tell if the string is whitespace.
      * @param   string      String to be trimmed.
  +   *
  +   * NEEDSDOC @param buf
      * @return              The trimmed string.
      */
     public static boolean isWhiteSpace(StringBuffer buf)
     {
  +
       int n = buf.length();
  -    for(int i = 0;  i < n;  i++)
  +
  +    for (int i = 0; i < n; i++)
       {
         if (!isWhiteSpace(buf.charAt(i)))
           return false;
       }
  +
       return true;
     }
  -  
   }
  
  
  
  1.2       +1614 -1208xml-xalan/java/src/org/apache/xalan/utils/synthetic/Class.java
  
  Index: Class.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/Class.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Class.java	2000/10/13 02:33:14	1.1
  +++ Class.java	2000/10/30 18:57:54	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,7 +52,7 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   package org.apache.xalan.utils.synthetic;
   
  @@ -60,92 +60,121 @@
   import org.apache.xalan.utils.synthetic.reflection.Constructor;
   import org.apache.xalan.utils.synthetic.reflection.Method;
   import org.apache.xalan.utils.synthetic.reflection.Field;
  +
   import java.lang.reflect.Modifier;
   
   /* ***** WORK NEEDED:
       Factories/Libraries: We currently have forClass and
  -    forName(request reified, complain if no real class), 
  +    forName(request reified, complain if no real class),
       and declareClass (request unreified, create unreified
       if it doesn't exist). What about ther user expectations
  -    -- should we have a full matrix, rather than asking 
  +    -- should we have a full matrix, rather than asking
       users to write wrappers?
  -    
  +
       Reflection doesn't tell us about deprecation. If we want
       that info, MFC advises mousing our way into the bytecodes.
       (Ugh). Should we at least model that for synthetics?
   */
   
  -
   /**
  -  org.apache.xalan.utils.synthetic.Class is a mutable equivalent of java.lang.Class.
  -  Instances represent classes and interfaces in a running Java
  -  application, or class descriptions under construction. In the
  -  former case, org.apache.xalan.utils.synthetic.Class operates as a proxy for the
  -  "real" java.lang.Class object; in the latter, it consults 
  -  data structures defined in the org.apache.xalan.utils.synthetic.reflection.* package.
  -  <p>
  -  Unlike java.lang.Class, org.apache.xalan.utils.synthetic.Class has a pair of factories
  -  (fromName and fromClass). It can also be switched from synthetic
  -  to proxy operation after construction, by setting the realClass 
  -  property; this is intended to allow these definitions to be 
  -  "compiled in place".
  -  <p>
  -  For convenient use, org.apache.xalan.utils.synthetic.Class implements an extended
  -  version of the java.lang.Class API -- but is not a subclass
  -  thereof, since java.lang.Class is Final (presumably for
  -  security reasons).
  -  <p>
  -  DEVELOPMENT NOTE: Methods not yet implemented will throw 
  -  IllegalStateException
  -  <p>
  -    I've added code to convert primitive names into their TYPEs,
  -    to accept foo[] as a synonym for [Lfoo, and to generate 
  -    the right thing on output (getJava[Short]Name).
  -    Useful extension for code generation from Java-like
  -    source. We may want to factor these and toSource out, making
  -    org.apache.xalan.utils.synthetic.Class addess only the JVM level and providing
  -    subclasses or access tools that handle language syntax
  -    (Java source, NetRexx source, etc.)
  -
  -  @since  2000/2/10
  -  @see    java.lang.class
  -  @see    defineClass 
  -  */
  -
  + * org.apache.xalan.utils.synthetic.Class is a mutable equivalent of java.lang.Class.
  + * Instances represent classes and interfaces in a running Java
  + * application, or class descriptions under construction. In the
  + * former case, org.apache.xalan.utils.synthetic.Class operates as a proxy for the
  + * "real" java.lang.Class object; in the latter, it consults
  + * data structures defined in the org.apache.xalan.utils.synthetic.reflection.* package.
  + * <p>
  + * Unlike java.lang.Class, org.apache.xalan.utils.synthetic.Class has a pair of factories
  + * (fromName and fromClass). It can also be switched from synthetic
  + * to proxy operation after construction, by setting the realClass
  + * property; this is intended to allow these definitions to be
  + * "compiled in place".
  + * <p>
  + * For convenient use, org.apache.xalan.utils.synthetic.Class implements an extended
  + * version of the java.lang.Class API -- but is not a subclass
  + * thereof, since java.lang.Class is Final (presumably for
  + * security reasons).
  + * <p>
  + * DEVELOPMENT NOTE: Methods not yet implemented will throw
  + * IllegalStateException
  + * <p>
  + *   I've added code to convert primitive names into their TYPEs,
  + *   to accept foo[] as a synonym for [Lfoo, and to generate
  + *   the right thing on output (getJava[Short]Name).
  + *   Useful extension for code generation from Java-like
  + *   source. We may want to factor these and toSource out, making
  + *   org.apache.xalan.utils.synthetic.Class addess only the JVM level and providing
  + *   subclasses or access tools that handle language syntax
  + *   (Java source, NetRexx source, etc.)
  + *
  + * @since  2000/2/10
  + * @see    java.lang.class
  + * @see    defineClass
  + */
   public class Class extends Object implements java.io.Serializable
   {
  -  /** Class descriptions currently existing.*/
  -  private static java.util.Hashtable global_classtable=new java.util.Hashtable();
  -  
  -  /**fully-qualified path.classname */
  +
  +  /** Class descriptions currently existing. */
  +  private static java.util.Hashtable global_classtable =
  +    new java.util.Hashtable();
  +
  +  /** fully-qualified path.classname */
     private java.lang.String name;
  -  
  -  /** Actual Java class object. When present, all interactions
  -    are redirected to it. Allows our Class to function as a
  -    wrapper for the Java version (in lieu of subclassing or
  -    a shared Interface), and allows "in-place compilation"
  -    to replace a generated description with an
  -    directly runnable class.
  -    */
  +
  +  /**
  +   * Actual Java class object. When present, all interactions
  +   * are redirected to it. Allows our Class to function as a
  +   * wrapper for the Java version (in lieu of subclassing or
  +   * a shared Interface), and allows "in-place compilation"
  +   * to replace a generated description with an
  +   * directly runnable class.
  +   */
     private java.lang.Class realclass = null;
  -  
  +
  +  /** NEEDSDOC Field modifiers          */
     private int modifiers;
  -  private boolean isInterface=false;
  -  private Class superclass=null;
  -  private Class declaringclass=null;
  -  private Class[] interfaces=new Class[0];
  -  private Class[] allclasses=new Class[0];
  -  private Class[] declaredclasses=new Class[0];
  -  private Constructor[] allconstructors=new Constructor[0];
  -  private Constructor[] declaredconstructors=new Constructor[0];
  -  private Method[] allmethods=new Method[0];
  -  private Method[] declaredmethods=new Method[0];
  -  private Field[] allfields=new Field[0];
  -  private Field[] declaredfields=new Field[0];
  -  private Class[] innerclasses=new Class[0];
  -  
  +
  +  /** NEEDSDOC Field isInterface          */
  +  private boolean isInterface = false;
  +
  +  /** NEEDSDOC Field superclass          */
  +  private Class superclass = null;
  +
  +  /** NEEDSDOC Field declaringclass          */
  +  private Class declaringclass = null;
  +
  +  /** NEEDSDOC Field interfaces          */
  +  private Class[] interfaces = new Class[0];
  +
  +  /** NEEDSDOC Field allclasses          */
  +  private Class[] allclasses = new Class[0];
  +
  +  /** NEEDSDOC Field declaredclasses          */
  +  private Class[] declaredclasses = new Class[0];
  +
  +  /** NEEDSDOC Field allconstructors          */
  +  private Constructor[] allconstructors = new Constructor[0];
  +
  +  /** NEEDSDOC Field declaredconstructors          */
  +  private Constructor[] declaredconstructors = new Constructor[0];
  +
  +  /** NEEDSDOC Field allmethods          */
  +  private Method[] allmethods = new Method[0];
  +
  +  /** NEEDSDOC Field declaredmethods          */
  +  private Method[] declaredmethods = new Method[0];
  +
  +  /** NEEDSDOC Field allfields          */
  +  private Field[] allfields = new Field[0];
  +
  +  /** NEEDSDOC Field declaredfields          */
  +  private Field[] declaredfields = new Field[0];
  +
  +  /** NEEDSDOC Field innerclasses          */
  +  private Class[] innerclasses = new Class[0];
  +
     /**
  -   * Construct a synthetic class as proxy/wrapper for an existing 
  +   * Construct a synthetic class as proxy/wrapper for an existing
      * Java Class. Non-public; most folks should use
      * .forName and .forClass to request these wrappers, so they
      * get the shared instances.
  @@ -155,17 +184,19 @@
      */
     Class(java.lang.Class realclass)
     {
  +
       this(realclass.getName());
  +
       try
  -      {
  -	setRealClass(realclass);
  -      } 
  -    catch(SynthesisException e)
  -      {
  -	e.printStackTrace();
  -      }
  +    {
  +      setRealClass(realclass);
  +    }
  +    catch (SynthesisException e)
  +    {
  +      e.printStackTrace();
  +    }
     }
  -  
  +
     /**
      * Construct a named-but-empty synthetic Class object.
      * Non-public; most folks should use
  @@ -174,715 +205,871 @@
      * <p>
      * Creation date: (12-25-99 12:15:23 PM)
      * @param name java.lang.String
  +   *
  +   * NEEDSDOC @param fullname
      */
     Class(String fullname)
     {
  -    this.name=fullname;
  -    global_classtable.put(fullname,this);
  +
  +    this.name = fullname;
  +
  +    global_classtable.put(fullname, this);
     }
  -  
  +
     /**
  -    Returns the synthetic Class object associated with the "real"
  -    class specified, creating one if it didn't already exist.
  -    <p>
  -    For example, the following code fragment returns
  -    the runtime Class descriptor for the class named
  -    mypackage.MyClass.
  -    <code>
  -    Class t =
  -    Class.forName(java.lang.Class.forName("mypackage.MyClass"))
  -    </code>
  -    <p>
  -    Note that if the user has manually created a org.apache.xalan.utils.synthetic.Class
  -    with the same name before this call is issued, that object
  -    will be found instead. See also the declareClass call.
  -    <p>
  -    ***** We need a better way to declare/define array classes,
  -    given a class object (synthetic or not).
  -   
  -    @param cls the desired Java class. 
  -    @return the synthetic Class descriptor for the specified class. 
  -    */
  +   * Returns the synthetic Class object associated with the "real"
  +   * class specified, creating one if it didn't already exist.
  +   * <p>
  +   * For example, the following code fragment returns
  +   * the runtime Class descriptor for the class named
  +   * mypackage.MyClass.
  +   * <code>
  +   * Class t =
  +   * Class.forName(java.lang.Class.forName("mypackage.MyClass"))
  +   * </code>
  +   * <p>
  +   * Note that if the user has manually created a org.apache.xalan.utils.synthetic.Class
  +   * with the same name before this call is issued, that object
  +   * will be found instead. See also the declareClass call.
  +   * <p>
  +   *  We need a better way to declare/define array classes,
  +   * given a class object (synthetic or not).
  +   *
  +   * @param cls the desired Java class.
  +   * @return the synthetic Class descriptor for the specified class.
  +   */
     public static Class forClass(java.lang.Class cls)
     {
  -    if(cls==null)
  +
  +    if (cls == null)
         return null;
  -    Class ret=(Class)(global_classtable.get(cls.getName()));
  -    if(null==ret)
  -      ret=new Class(cls);
  +
  +    Class ret = (Class) (global_classtable.get(cls.getName()));
  +
  +    if (null == ret)
  +      ret = new Class(cls);
  +
       return ret;
     }
   
  -  /** Like forName, but if the classname doesn't have a package
  -    prefix we first attempt to look it up as one of our own
  -    inner clases. As with forName, if this can not be resolved
  -    we throw an exception.
  -  */
  +  /**
  +   * Like forName, but if the classname doesn't have a package
  +   * prefix we first attempt to look it up as one of our own
  +   * inner clases. As with forName, if this can not be resolved
  +   * we throw an exception.
  +   *
  +   * NEEDSDOC @param classname
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws ClassNotFoundException
  +   */
     public Class forNameInContext(String classname)
  -  throws ClassNotFoundException
  +          throws ClassNotFoundException
     {
  -    for(int i=innerclasses.length-1;i>=0;--i)
  -        if(classname.equals(innerclasses[i].getShortName()) )
  -            return innerclasses[i];
  +
  +    for (int i = innerclasses.length - 1; i >= 0; --i)
  +    {
  +      if (classname.equals(innerclasses[i].getShortName()))
  +        return innerclasses[i];
  +    }
  +
       return forName(classname);
     }
  -  
  +
     /**
  -    Returns the synthetic Class object associated with the class
  -    with the given fully-qualified name. If there isn't one, this
  -    method attempts to locate, load and link the standard java Class.
  -    If it succeeds, it returns a wrapped version of the Class object 
  -    representing the class. If it fails, the method throws a
  -    ClassNotFoundException. 
  -    <p>
  -    For example, the following code fragment returns
  -    the runtime Class descriptor for the class named
  -    mypackage.MyClass -- either as a synthetic or as
  -    a standard Java class.
  -    <code>
  -    Class t =
  -    Class.forName("mypackage.MyClass")
  -    </code>
  -    <p>
  -    ***** I've added support for arrays -- assuming any name
  -    that ends with ']' is an array. It probably needs to be
  -    made smarter, possibly via a subclass of org.apache.xalan.utils.synthetic.Class.
  -    
  -    @param className the fully qualified name of the desired class. 
  -    @return the synthetic Class descriptor for the class with the specified name. 
  -    @throws ClassNotFoundException if the class could not be found. 
  -    */
  +   * Returns the synthetic Class object associated with the class
  +   * with the given fully-qualified name. If there isn't one, this
  +   * method attempts to locate, load and link the standard java Class.
  +   * If it succeeds, it returns a wrapped version of the Class object
  +   * representing the class. If it fails, the method throws a
  +   * ClassNotFoundException.
  +   * <p>
  +   * For example, the following code fragment returns
  +   * the runtime Class descriptor for the class named
  +   * mypackage.MyClass -- either as a synthetic or as
  +   * a standard Java class.
  +   * <code>
  +   * Class t =
  +   * Class.forName("mypackage.MyClass")
  +   * </code>
  +   * <p>
  +   *  I've added support for arrays -- assuming any name
  +   * that ends with ']' is an array. It probably needs to be
  +   * made smarter, possibly via a subclass of org.apache.xalan.utils.synthetic.Class.
  +   *
  +   * @param className the fully qualified name of the desired class.
  +   * @return the synthetic Class descriptor for the class with the specified name.
  +   * @throws ClassNotFoundException if the class could not be found.
  +   */
     public static Class forName(String className) throws ClassNotFoundException
     {
  +
       // ***** Experimental support for array syntax expressed
       // per Java source rather than per JVM type formalism.
       // Simpleminded, asssumes balanced []'s.
  -    if(className.endsWith("]"))
  +    if (className.endsWith("]"))
       {
  -      StringBuffer arrayname=new StringBuffer();
  -      for(int i=className.indexOf('[');
  -          i!=-1;
  -          i=className.indexOf('[',i+1) )
  -          arrayname.append('[');
  -          
  +      StringBuffer arrayname = new StringBuffer();
  +
  +      for (int i = className.indexOf('['); i != -1;
  +              i = className.indexOf('[', i + 1))
  +      {
  +        arrayname.append('[');
  +      }
  +
         // Convert the classname to array-formalism
         // Primitives have letters; objects are Lname;
         // (Don't ask why long is spelled with a J and
         // object is spelled with an L...)
  -      String classname=className.substring(0,className.indexOf('['));
  -      
  -      if("byte".equals(classname))
  +      String classname = className.substring(0, className.indexOf('['));
  +
  +      if ("byte".equals(classname))
           arrayname.append('B');
  -      else if("char".equals(classname))
  +      else if ("char".equals(classname))
           arrayname.append('C');
  -      else if("double".equals(classname))
  +      else if ("double".equals(classname))
           arrayname.append('D');
  -      else if("float".equals(classname))
  +      else if ("float".equals(classname))
           arrayname.append('F');
  -      else if("int".equals(classname))
  +      else if ("int".equals(classname))
           arrayname.append('I');
  -      else if("long".equals(classname))
  +      else if ("long".equals(classname))
           arrayname.append('J');
  -      else if("short".equals(classname))
  +      else if ("short".equals(classname))
           arrayname.append('S');
  -      else if("boolean".equals(classname))
  +      else if ("boolean".equals(classname))
           arrayname.append('Z');
         else
  -        arrayname.append('L')
  -              .append(classname)
  -            .append(';');
  -            
  +        arrayname.append('L').append(classname).append(';');
  +
         // Tail-call.
         return forName(arrayname.toString());
       }
  -    
  -    Class ret=(Class)(global_classtable.get(className));
  -    if(null==ret)
  +
  +    Class ret = (Class) (global_classtable.get(className));
  +
  +    if (null == ret)
       {
  +
         // ***** Experimental support for Java primitives
         // Seems to me that mapping them into the "Type" is
         // probably most useful
  -      if("boolean".equals(className))
  +      if ("boolean".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Boolean.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Boolean.TYPE;
         }
  -      else if("byte".equals(className))
  +      else if ("byte".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Byte.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Byte.TYPE;
         }
  -      else if("char".equals(className))
  +      else if ("char".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Character.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Character.TYPE;
         }
  -      else if("short".equals(className))
  +      else if ("short".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Short.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Short.TYPE;
         }
  -      else if("int".equals(className))
  +      else if ("int".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Integer.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Integer.TYPE;
         }
  -      else if("long".equals(className))
  +      else if ("long".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Long.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Long.TYPE;
         }
  -      else if("float".equals(className))
  +      else if ("float".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Float.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Float.TYPE;
         }
  -      else if("double".equals(className))
  +      else if ("double".equals(className))
         {
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Double.TYPE;
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Double.TYPE;
         }
  -      else if("void".equals(className))
  +      else if ("void".equals(className))
         {
  -	// ***** Void is an "absence of type". We might want to create
  -	// a special object to represent it. This is a placeholder.
  -        ret=new Class(className);
  -        ret.realclass=java.lang.Class.forName("java.lang.Object");
  +
  +        // ***** Void is an "absence of type". We might want to create
  +        // a special object to represent it. This is a placeholder.
  +        ret = new Class(className);
  +        ret.realclass = java.lang.Class.forName("java.lang.Object");
         }
  - 
  +
         // Other classes are just wrappered. Unknown classes throw a
         // ClassNotFoundException; the user can switch to declareClass()
         // if they're sure that an unreified class is OK. 
         else
  -        ret=new Class(java.lang.Class.forName(className));
  +        ret = new Class(java.lang.Class.forName(className));
       }
   
       return ret;
     }
  -  /** Start to create a synthetic Class with the given fully-qualified
  -    name.  If a Class by that name already exists, and it is not
  -    reified, it will be returned instead. If a reified Class _does_
  -    exist, we throw a synthesis exception.
  -    
  -    @param className the fully qualified name of the desired class. 
  -    @return the synthetic Class descriptor for the class with the specified name. 
  -    @throws SynthesisException
  -    if the class has been reified.  */
  +
  +  /**
  +   * Start to create a synthetic Class with the given fully-qualified
  +   * name.  If a Class by that name already exists, and it is not
  +   * reified, it will be returned instead. If a reified Class _does_
  +   * exist, we throw a synthesis exception.
  +   *
  +   * @param className the fully qualified name of the desired class.
  +   * @return the synthetic Class descriptor for the class with the specified name.
  +   * @throws SynthesisException
  +   * if the class has been reified.  
  +   */
     public static Class declareClass(String className) throws SynthesisException
     {
  -    Class ret=(Class)(global_classtable.get(className));
  -    if(null==ret)
  -      ret=new Class(className);
  -    if(ret.realclass!=null)
  +
  +    Class ret = (Class) (global_classtable.get(className));
  +
  +    if (null == ret)
  +      ret = new Class(className);
  +
  +    if (ret.realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    
  +
       return ret;
     }
  -  /** Start to create a synthetic Class with the given fully-qualified
  -    name.  If a Class by that name already exists,whether reified or
  -    not, it will be removed from the table and replaced by the new synthesis.
  -    
  -    ***** NOTE THAT the replacement will not affect classes which
  -    have already refernced the old version. We could change that by
  -    having everyone reference everyone else via an indirection table.
  -    
  -    @param className the fully qualified name of the desired class. 
  -    @return the synthetic Class descriptor for the class with the specified name. 
  -  */
  +
  +  /**
  +   * Start to create a synthetic Class with the given fully-qualified
  +   * name.  If a Class by that name already exists,whether reified or
  +   * not, it will be removed from the table and replaced by the new synthesis.
  +   *
  +   *  NOTE THAT the replacement will not affect classes which
  +   * have already refernced the old version. We could change that by
  +   * having everyone reference everyone else via an indirection table.
  +   *
  +   * @param className the fully qualified name of the desired class.
  +   * @return the synthetic Class descriptor for the class with the specified name.
  +   */
     public static Class reallyDeclareClass(String className)
     {
  -    Class ret=(Class)(global_classtable.get(className));
  -    if(null!=ret)
  +
  +    Class ret = (Class) (global_classtable.get(className));
  +
  +    if (null != ret)
         global_classtable.remove(ret);
  -    ret=new Class(className);
  +
  +    ret = new Class(className);
  +
       return ret;
     }
  +
     /**
  -    Returns an array containing Class objects
  -    representing all the public classes and interfaces
  -    that are members of the class represented by this
  -    Class object. This includes public class and
  -    interface members inherited from superclasses and
  -    public class and interface members declared by the
  -    class. Returns an array of length 0 if the class has
  -    no public member classes or interfaces, or if this
  -    Class object represents a primitive type. 
  -    <p>
  -    NOTE: In a significant number of existing Java environments,
  -    this method is not implemented by the official Class object
  -    and always returns an empty array. So if you don't get any
  -    useful information from a proxied java.lang.Class, don't
  -    be surprised. I'm not sure if someone decided it was a 
  -    potential security issue, or if Sun was lazy and everyone
  -    else followed suit.
  -    <p>
  -    ALSO NOTE: The above spec, as taken from java.lang.Class,
  -    doesn't provide any good way to distinguish the immediate
  -    superclass from all other superclasses. That makes it only
  -    marginally useful, which is no doubt one of the reasons folks
  -    have declined to implement it. 
  -    */
  +   * Returns an array containing Class objects
  +   * representing all the public classes and interfaces
  +   * that are members of the class represented by this
  +   * Class object. This includes public class and
  +   * interface members inherited from superclasses and
  +   * public class and interface members declared by the
  +   * class. Returns an array of length 0 if the class has
  +   * no public member classes or interfaces, or if this
  +   * Class object represents a primitive type.
  +   * <p>
  +   * NOTE: In a significant number of existing Java environments,
  +   * this method is not implemented by the official Class object
  +   * and always returns an empty array. So if you don't get any
  +   * useful information from a proxied java.lang.Class, don't
  +   * be surprised. I'm not sure if someone decided it was a
  +   * potential security issue, or if Sun was lazy and everyone
  +   * else followed suit.
  +   * <p>
  +   * ALSO NOTE: The above spec, as taken from java.lang.Class,
  +   * doesn't provide any good way to distinguish the immediate
  +   * superclass from all other superclasses. That makes it only
  +   * marginally useful, which is no doubt one of the reasons folks
  +   * have declined to implement it.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Class[] getClasses()
     {
  -    if(realclass!=null && allclasses==null)
  +
  +    if (realclass != null && allclasses == null)
  +    {
  +      java.lang.Class[] realDE = realclass.getClasses();
  +
  +      allclasses = new Class[realDE.length];
  +
  +      for (int i = 0; i < realDE.length; ++i)
         {
  -	java.lang.Class[] realDE=realclass.getClasses();
  -	allclasses=new Class[realDE.length];
  -	for(int i=0;i<realDE.length;++i)
  -	  allclasses[i]=forClass(realDE[i]);
  +        allclasses[i] = forClass(realDE[i]);
         }
  -    
  +    }
  +
       return allclasses;
     }
  +
     /**
  -    Determines the class loader for the class. 
  -    
  -    @return
  -    the class loader that created the class or
  -    interface represented by this object, or null
  -    if the org.apache.xalan.utils.synthetic.Class was not created by a class loader. 
  -    @see
  -    ClassLoader
  -    */
  +   * Determines the class loader for the class.
  +   *
  +   * @return
  +   * the class loader that created the class or
  +   * interface represented by this object, or null
  +   * if the org.apache.xalan.utils.synthetic.Class was not created by a class loader.
  +   * @see
  +   * ClassLoader
  +   */
     public ClassLoader getClassLoader()
     {
  -    return (realclass==null) ? null : realclass.getClassLoader();
  +    return (realclass == null) ? null : realclass.getClassLoader();
     }
  +
     /**
  -    If this class represents an array type, returns the
  -    Class object representing the component type of
  -    the array; otherwise returns null. 
  -    <p>
  -    NOTE: Since org.apache.xalan.utils.synthetic.Class doesn't yet attempt to model array
  -    types, this will currently return false unless we are
  -    proxying such a type.
  -    
  -    @see  Array 
  -    */
  +   * If this class represents an array type, returns the
  +   * Class object representing the component type of
  +   * the array; otherwise returns null.
  +   * <p>
  +   * NOTE: Since org.apache.xalan.utils.synthetic.Class doesn't yet attempt to model array
  +   * types, this will currently return false unless we are
  +   * proxying such a type.
  +   *
  +   * @see  Array
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Class getComponentType()
     {
       return realclass == null ? null : new Class(realclass.getComponentType());
     }
  +
     /**
  -    Returns a Constructor object that reflects the
  -    specified public constructor of the class
  -    represented by this Class object. The
  -    parameterTypes parameter is an array of Class
  -    objects that identify the constructor's formal
  -    parameter types, in declared order. 
  -    <p>
  -    The constructor to reflect is located by searching
  -    all the constructors of the class represented by this
  -    Class object for a public constructor with the
  -    exactly the same formal parameter types. 
  -    
  -    @throws NoSuchMethodException 
  -    if a matching method is not found. 
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Constructor 
  -    */
  -  public Constructor getConstructor(Class parameterTypes[]) 
  -       throws NoSuchMethodException, SecurityException, SynthesisException
  +   * Returns a Constructor object that reflects the
  +   * specified public constructor of the class
  +   * represented by this Class object. The
  +   * parameterTypes parameter is an array of Class
  +   * objects that identify the constructor's formal
  +   * parameter types, in declared order.
  +   * <p>
  +   * The constructor to reflect is located by searching
  +   * all the constructors of the class represented by this
  +   * Class object for a public constructor with the
  +   * exactly the same formal parameter types.
  +   *
  +   *
  +   * NEEDSDOC @param parameterTypes
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NoSuchMethodException
  +   * if a matching method is not found.
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Constructor
  +   * @throws SynthesisException
  +   */
  +  public Constructor getConstructor(Class parameterTypes[])
  +          throws NoSuchMethodException, SecurityException, SynthesisException
     {
  -    if(realclass==null)
  +
  +    if (realclass == null)
         throw new SynthesisException(SynthesisException.UNREIFIED);
  -    java.lang.Class[] real=new java.lang.Class[parameterTypes.length];
  -    for(int i=0;i<parameterTypes.length;++i)
  -        if( (real[i]=parameterTypes[i].getRealClass()) == null)
  -          throw new SynthesisException(SynthesisException.UNREIFIED);
  -    return new Constructor(realclass.getConstructor(real),this);
  -  }
  -  /**
  -    Returns an array containing Constructor objects
  -    reflecting all the public constructors of the class
  -    represented by this Class object. An array of length
  -    0 is returned if the class has no public
  -    constructors. 
  -    
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see
  -    Constructor 
  -    */
  +
  +    java.lang.Class[] real = new java.lang.Class[parameterTypes.length];
  +
  +    for (int i = 0; i < parameterTypes.length; ++i)
  +    {
  +      if ((real[i] = parameterTypes[i].getRealClass()) == null)
  +        throw new SynthesisException(SynthesisException.UNREIFIED);
  +    }
  +
  +    return new Constructor(realclass.getConstructor(real), this);
  +  }
  +
  +  /**
  +   * Returns an array containing Constructor objects
  +   * reflecting all the public constructors of the class
  +   * represented by this Class object. An array of length
  +   * 0 is returned if the class has no public
  +   * constructors.
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Constructor
  +   */
     public Constructor[] getConstructors() throws SecurityException
     {
  -    if(realclass!=null && allconstructors==null)
  +
  +    if (realclass != null && allconstructors == null)
  +    {
  +      java.lang.reflect.Constructor[] realDC = realclass.getConstructors();
  +
  +      allconstructors = new Constructor[realDC.length];
  +
  +      for (int i = 0; i < realDC.length; ++i)
         {
  -	java.lang.reflect.Constructor[] realDC=realclass.getConstructors();
  -	allconstructors=new Constructor[realDC.length];
  -	for(int i=0;i<realDC.length;++i)
  -	  allconstructors[i]=new Constructor(realDC[i],this);
  +        allconstructors[i] = new Constructor(realDC[i], this);
         }
  -    
  +    }
  +
       return allconstructors;
     }
  +
     /**
  -    This method is not implemented in VAJAVA 3.0
  -    <p>
  -    Returns an array of Class objects reflecting all the
  -    classes and interfaces declared as members of the
  -    class represented by this Class object. This
  -    includes public, protected, default (package)
  -    access, and private classes and interfaces declared
  -    by the class, but excludes inherited classes and
  -    interfaces. Returns an array of length 0 if the class
  -    declares no classes or interfaces as members, or if
  -    this Class object represents a primitive type. 
  -    
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    */
  +   * This method is not implemented in VAJAVA 3.0
  +   * <p>
  +   * Returns an array of Class objects reflecting all the
  +   * classes and interfaces declared as members of the
  +   * class represented by this Class object. This
  +   * includes public, protected, default (package)
  +   * access, and private classes and interfaces declared
  +   * by the class, but excludes inherited classes and
  +   * interfaces. Returns an array of length 0 if the class
  +   * declares no classes or interfaces as members, or if
  +   * this Class object represents a primitive type.
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   */
     public Class[] getDeclaredClasses() throws SecurityException
     {
  +
       // ***** This should really be a single class plus declared interfaces.
  -    
  -    if(realclass!=null && declaredclasses==null)
  +    if (realclass != null && declaredclasses == null)
  +    {
  +      java.lang.Class[] realDE = realclass.getDeclaredClasses();
  +
  +      declaredclasses = new Class[realDE.length];
  +
  +      for (int i = 0; i < realDE.length; ++i)
         {
  -	java.lang.Class[] realDE=realclass.getDeclaredClasses();
  -	declaredclasses=new Class[realDE.length];
  -	for(int i=0;i<realDE.length;++i)
  -	  {
  -	    declaredclasses[i]=forClass(realDE[i]);
  -	    if(!realDE[i].isInterface())
  -	      superclass=declaredclasses[i];
  -	  }
  +        declaredclasses[i] = forClass(realDE[i]);
  +
  +        if (!realDE[i].isInterface())
  +          superclass = declaredclasses[i];
         }
  +    }
  +
       return declaredclasses;
     }
  -  
  +
     /**
  -    Adds an "extends" description for the class or
  -    interface represented by this Class object
  -    
  -    @throws SynthesisException
  -    if the class has been reified.
  -    @see 
  -    class 
  -    */
  -  public void addExtends(Class newclass) 
  -       throws SynthesisException
  +   * Adds an "extends" description for the class or
  +   * interface represented by this Class object
  +   *
  +   *
  +   * NEEDSDOC @param newclass
  +   * @throws SynthesisException
  +   * if the class has been reified.
  +   * @see
  +   * class
  +   */
  +  public void addExtends(Class newclass) throws SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    Class[] scratch=new Class[declaredclasses.length+1];
  -    System.arraycopy(declaredclasses,0,scratch,0,declaredclasses.length);
  -    scratch[declaredclasses.length]=newclass;
  -    declaredclasses=scratch;
  -  }
  -  
  -  
  -  /**
  -    Returns a Constructor object that reflects the
  -    specified declared constructor of the class or
  -    interface represented by this Class object. The
  -    parameterTypes parameter is an array of Class
  -    objects that identify the constructor's formal
  -    parameter types, in declared order. 
  -    
  -    @throws NoSuchMethodException 
  -    if a matching method is not found. 
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Constructor 
  -    */
  -  public Constructor getDeclaredConstructor(Class parameterTypes[]) throws NoSuchMethodException, SecurityException
  +
  +    Class[] scratch = new Class[declaredclasses.length + 1];
  +
  +    System.arraycopy(declaredclasses, 0, scratch, 0, declaredclasses.length);
  +
  +    scratch[declaredclasses.length] = newclass;
  +    declaredclasses = scratch;
  +  }
  +
  +  /**
  +   * Returns a Constructor object that reflects the
  +   * specified declared constructor of the class or
  +   * interface represented by this Class object. The
  +   * parameterTypes parameter is an array of Class
  +   * objects that identify the constructor's formal
  +   * parameter types, in declared order.
  +   *
  +   *
  +   * NEEDSDOC @param parameterTypes
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NoSuchMethodException
  +   * if a matching method is not found.
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Constructor
  +   */
  +  public Constructor getDeclaredConstructor(Class parameterTypes[])
  +          throws NoSuchMethodException, SecurityException
     {
       throw new java.lang.IllegalStateException();
     }
  -  
  +
     /**
  -    Adds a Constructor description for  the class or
  -    interface represented by this Class object
  -    
  -    @throws SynthesisException
  -    if the class has been reified.
  -    @see 
  -    Constructor 
  -    */
  -  public Constructor declareConstructor() 
  -       throws SynthesisException
  +   * Adds a Constructor description for  the class or
  +   * interface represented by this Class object
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SynthesisException
  +   * if the class has been reified.
  +   * @see
  +   * Constructor
  +   */
  +  public Constructor declareConstructor() throws SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    Constructor newctor=new Constructor(this);
  -    
  -    Constructor[] scratch=new Constructor[declaredconstructors.length+1];
  -    System.arraycopy(declaredconstructors,0,scratch,0,declaredconstructors.length);
  -    scratch[declaredconstructors.length]=newctor;
  -    declaredconstructors=scratch;
  -    
  -    scratch=new Constructor[allconstructors.length+1];
  -    System.arraycopy(allconstructors,0,scratch,0,allconstructors.length);
  -    scratch[allconstructors.length]=newctor;
  -    allconstructors=scratch;
  -    
  +
  +    Constructor newctor = new Constructor(this);
  +    Constructor[] scratch = new Constructor[declaredconstructors.length + 1];
  +
  +    System.arraycopy(declaredconstructors, 0, scratch, 0,
  +                     declaredconstructors.length);
  +
  +    scratch[declaredconstructors.length] = newctor;
  +    declaredconstructors = scratch;
  +    scratch = new Constructor[allconstructors.length + 1];
  +
  +    System.arraycopy(allconstructors, 0, scratch, 0, allconstructors.length);
  +
  +    scratch[allconstructors.length] = newctor;
  +    allconstructors = scratch;
  +
       return newctor;
     }
  -  
  +
     /**
      * State that this class implements a specified interface.
      * This does not yet update allMethods or otherwise
      * attempt to inherit data.
  -   * 
  +   *
      * @param newifce org.apache.xalan.utils.synthetic.Class representing the interface we want to add.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception org.apache.xalan.utils.synthetic.SynthesisException if the Class isn't an interface
      * @see setSuperClass
      * @see declareConstructor
      * @see declareMethod
      * @see declareField
  +   *
  +   * @throws SynthesisException
      */
  -  public Class declareInterface(Class newifce) 
  -       throws SynthesisException
  +  public Class declareInterface(Class newifce) throws SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    if(!newifce.isInterface())
  -      throw new SynthesisException(SynthesisException.SYNTAX,newifce.getName()+" isn't an interface");
  -      
  -    Class[] scratch=new Class[interfaces.length+1];
  -    System.arraycopy(interfaces,0,scratch,0,interfaces.length);
  -    scratch[interfaces.length]=newifce;
  -    interfaces=scratch;
  -    
  -    scratch=new Class[allclasses.length+1];
  -    System.arraycopy(allclasses,0,scratch,0,allclasses.length);
  -    scratch[allclasses.length]=newifce;
  -    allclasses=scratch;
  -    
  +
  +    if (!newifce.isInterface())
  +      throw new SynthesisException(SynthesisException.SYNTAX,
  +                                   newifce.getName() + " isn't an interface");
  +
  +    Class[] scratch = new Class[interfaces.length + 1];
  +
  +    System.arraycopy(interfaces, 0, scratch, 0, interfaces.length);
  +
  +    scratch[interfaces.length] = newifce;
  +    interfaces = scratch;
  +    scratch = new Class[allclasses.length + 1];
  +
  +    System.arraycopy(allclasses, 0, scratch, 0, allclasses.length);
  +
  +    scratch[allclasses.length] = newifce;
  +    allclasses = scratch;
  +
       return newifce;
     }
  -  
  -  
  +
     /**
  -    Returns an array of Constructor objects reflecting
  -    all the constructors declared by the class
  -    represented by this Class object. These are public,
  -    protected, default (package) access, and private
  -    constructors. Returns an array of length 0 if this
  -    Class object represents an interface or a primitive
  -    type. 
  -    <p>
  -    See The Java Language Specification, section 8.2. 
  -    
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Constructor 
  -    */
  +   * Returns an array of Constructor objects reflecting
  +   * all the constructors declared by the class
  +   * represented by this Class object. These are public,
  +   * protected, default (package) access, and private
  +   * constructors. Returns an array of length 0 if this
  +   * Class object represents an interface or a primitive
  +   * type.
  +   * <p>
  +   * See The Java Language Specification, section 8.2.
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Constructor
  +   */
     public Constructor[] getDeclaredConstructors() throws SecurityException
     {
  -    if(realclass!=null && declaredconstructors==null)
  +
  +    if (realclass != null && declaredconstructors == null)
  +    {
  +      java.lang.reflect.Constructor[] realDC =
  +        realclass.getDeclaredConstructors();
  +
  +      declaredconstructors = new Constructor[realDC.length];
  +
  +      for (int i = 0; i < realDC.length; ++i)
         {
  -	java.lang.reflect.Constructor[] realDC=realclass.getDeclaredConstructors();
  -	declaredconstructors=new Constructor[realDC.length];
  -	for(int i=0;i<realDC.length;++i)
  -	  declaredconstructors[i]=new Constructor(realDC[i],this);
  +        declaredconstructors[i] = new Constructor(realDC[i], this);
         }
  -    
  +    }
  +
       return declaredconstructors;
     }
  +
     /**
  -    Returns a Field object that reflects the specified
  -    declared field of the class or interface represented
  -    by this Class object. The name parameter is a
  -    String that specifies the simple name of the desired
  -    field. 
  -    
  -    @throws NoSuchFieldException 
  -    if a field with the specified name is not found. 
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Field 
  -    */
  -  public Field getDeclaredField(String name) throws NoSuchFieldException, SecurityException
  +   * Returns a Field object that reflects the specified
  +   * declared field of the class or interface represented
  +   * by this Class object. The name parameter is a
  +   * String that specifies the simple name of the desired
  +   * field.
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NoSuchFieldException
  +   * if a field with the specified name is not found.
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Field
  +   */
  +  public Field getDeclaredField(String name)
  +          throws NoSuchFieldException, SecurityException
     {
       throw new java.lang.IllegalStateException();
     }
  -  
  +
     /**
  -    Adds a Field description for  the class or
  -    interface represented by this Class object
  -    
  -    @throws SynthesisException
  -    if the class has been reified.
  -    @see 
  -    Constructor 
  -    */
  -  public Field declareField(String name) 
  -       throws SynthesisException
  +   * Adds a Field description for  the class or
  +   * interface represented by this Class object
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SynthesisException
  +   * if the class has been reified.
  +   * @see
  +   * Constructor
  +   */
  +  public Field declareField(String name) throws SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    Field newfield=new Field(name,this);
  -    
  -    Field[] scratch=new Field[declaredfields.length+1];
  -    System.arraycopy(declaredfields,0,scratch,0,declaredfields.length);
  -    scratch[declaredfields.length]=newfield;
  -    declaredfields=scratch;
  -    
  -    scratch=new Field[allfields.length+1];
  -    System.arraycopy(allfields,0,scratch,0,allfields.length);
  -    scratch[allfields.length]=newfield;
  -    allfields=scratch;
  -    
  +
  +    Field newfield = new Field(name, this);
  +    Field[] scratch = new Field[declaredfields.length + 1];
  +
  +    System.arraycopy(declaredfields, 0, scratch, 0, declaredfields.length);
  +
  +    scratch[declaredfields.length] = newfield;
  +    declaredfields = scratch;
  +    scratch = new Field[allfields.length + 1];
  +
  +    System.arraycopy(allfields, 0, scratch, 0, allfields.length);
  +
  +    scratch[allfields.length] = newfield;
  +    allfields = scratch;
  +
       return newfield;
     }
  -  
  +
     /**
  -    Returns an array of Field objects reflecting all the
  -    fields declared by the class or interface represented
  -    by this Class object. This includes public,
  -    protected, default (package) access, and private
  -    fields, but excludes inherited fields. Returns an
  -    array of length 0 if the class or interface declares
  -    no fields, or if this Class object represents a
  -    primitive type. See The Java Language
  -    Specification, sections 8.2 and 8.3. 
  -    
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Field 
  -    */
  +   * Returns an array of Field objects reflecting all the
  +   * fields declared by the class or interface represented
  +   * by this Class object. This includes public,
  +   * protected, default (package) access, and private
  +   * fields, but excludes inherited fields. Returns an
  +   * array of length 0 if the class or interface declares
  +   * no fields, or if this Class object represents a
  +   * primitive type. See The Java Language
  +   * Specification, sections 8.2 and 8.3.
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Field
  +   */
     public Field[] getDeclaredFields() throws SecurityException
     {
  -    if(realclass!=null && declaredfields==null)
  +
  +    if (realclass != null && declaredfields == null)
  +    {
  +      java.lang.reflect.Field[] realDF = realclass.getDeclaredFields();
  +
  +      declaredfields = new Field[realDF.length];
  +
  +      for (int i = 0; i < realDF.length; ++i)
         {
  -	java.lang.reflect.Field[] realDF=realclass.getDeclaredFields();
  -	declaredfields=new Field[realDF.length];
  -	for(int i=0;i<realDF.length;++i)
  -	  declaredfields[i]=new Field(realDF[i],this);
  +        declaredfields[i] = new Field(realDF[i], this);
         }
  -    
  +    }
  +
       return declaredfields;
     }
  +
     /**
  -    Returns a Method object that reflects the specified
  -    declared method of the class or interface
  -    represented by this Class object. The name
  -    parameter is a String that specifies the simple
  -    name of the desired method, and the
  -    parameterTypes parameter is an array of Class
  -    objects that identify the method's formal parameter
  -    types, in declared order. 
  -    
  -    @throws NoSuchMethodException 
  -    if a matching method is not found. 
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Method 
  -    */
  -  public Method getDeclaredMethod(String name, Class parameterTypes[]) 
  -       throws NoSuchMethodException, SecurityException
  +   * Returns a Method object that reflects the specified
  +   * declared method of the class or interface
  +   * represented by this Class object. The name
  +   * parameter is a String that specifies the simple
  +   * name of the desired method, and the
  +   * parameterTypes parameter is an array of Class
  +   * objects that identify the method's formal parameter
  +   * types, in declared order.
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param parameterTypes
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NoSuchMethodException
  +   * if a matching method is not found.
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Method
  +   */
  +  public Method getDeclaredMethod(String name, Class parameterTypes[])
  +          throws NoSuchMethodException, SecurityException
     {
       throw new java.lang.IllegalStateException();
     }
  -  
  -  
  +
     /**
  -    Adds a Method description for  the class or
  -    interface represented by this Class object
  -    
  -    @throws SynthesisException
  -    if the class has been reified.
  -    @see 
  -    Constructor 
  -    */
  -  public Method declareMethod(String name) 
  -       throws SynthesisException
  +   * Adds a Method description for  the class or
  +   * interface represented by this Class object
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SynthesisException
  +   * if the class has been reified.
  +   * @see
  +   * Constructor
  +   */
  +  public Method declareMethod(String name) throws SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    Method newMethod=new Method(name,this);
  -    
  -    Method[] scratch=new Method[declaredmethods.length+1];
  -    System.arraycopy(declaredmethods,0,scratch,0,declaredmethods.length);
  -    scratch[declaredmethods.length]=newMethod;
  -    declaredmethods=scratch;
  -    
  -    scratch=new Method[allmethods.length+1];
  -    System.arraycopy(allmethods,0,scratch,0,allmethods.length);
  -    scratch[allmethods.length]=newMethod;
  -    allmethods=scratch;
  -    
  +
  +    Method newMethod = new Method(name, this);
  +    Method[] scratch = new Method[declaredmethods.length + 1];
  +
  +    System.arraycopy(declaredmethods, 0, scratch, 0, declaredmethods.length);
  +
  +    scratch[declaredmethods.length] = newMethod;
  +    declaredmethods = scratch;
  +    scratch = new Method[allmethods.length + 1];
  +
  +    System.arraycopy(allmethods, 0, scratch, 0, allmethods.length);
  +
  +    scratch[allmethods.length] = newMethod;
  +    allmethods = scratch;
  +
       return newMethod;
     }
  -  
  +
     /**
  -    Returns an array of Method objects reflecting all
  -    the methods declared by the class or interface
  -    represented by this Class object. This includes
  -    public, protected, default (package) access, and
  -    private methods, but excludes inherited methods.
  -    Returns an array of length 0 if the class or interface
  -    declares no methods, or if this Class object
  -    represents a primitive type. 
  -    <p>
  -    See The Java Language Specification, section 8.2. 
  -    
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Method 
  -    */
  +   * Returns an array of Method objects reflecting all
  +   * the methods declared by the class or interface
  +   * represented by this Class object. This includes
  +   * public, protected, default (package) access, and
  +   * private methods, but excludes inherited methods.
  +   * Returns an array of length 0 if the class or interface
  +   * declares no methods, or if this Class object
  +   * represents a primitive type.
  +   * <p>
  +   * See The Java Language Specification, section 8.2.
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Method
  +   */
     public Method[] getDeclaredMethods() throws SecurityException
     {
  -    if(realclass!=null && declaredmethods==null)
  +
  +    if (realclass != null && declaredmethods == null)
  +    {
  +      java.lang.reflect.Method[] realDM = realclass.getDeclaredMethods();
  +
  +      declaredmethods = new Method[realDM.length];
  +
  +      for (int i = 0; i < realDM.length; ++i)
         {
  -	java.lang.reflect.Method[] realDM=realclass.getDeclaredMethods();
  -	declaredmethods=new Method[realDM.length];
  -	for(int i=0;i<realDM.length;++i)
  -	  declaredmethods[i]=new Method(realDM[i],this);
  +        declaredmethods[i] = new Method(realDM[i], this);
         }
  -    
  +    }
  +
       return declaredmethods;
     }
  +
     /**
  -    This method is not implemented in VAJava 3.0
  -    <p>
  -    If the class or interface represented by this Class
  -    object is a member of another class, returns the
  -    Class object representing the class of which it is a
  -    member (its declaring class). Returns null if this
  -    class or interface is not a member of any other
  -    class.
  -    */
  +   * This method is not implemented in VAJava 3.0
  +   * <p>
  +   * If the class or interface represented by this Class
  +   * object is a member of another class, returns the
  +   * Class object representing the class of which it is a
  +   * member (its declaring class). Returns null if this
  +   * class or interface is not a member of any other
  +   * class.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Class getDeclaringClass()
     {
  -    if(realclass!=null && declaringclass==null)
  +
  +    if (realclass != null && declaringclass == null)
       {
  -      java.lang.Class dc=realclass.getDeclaringClass();
  -      if(dc==null)
  -        declaringclass=null;
  +      java.lang.Class dc = realclass.getDeclaringClass();
  +
  +      if (dc == null)
  +        declaringclass = null;
         else
  -        declaringclass=forClass(dc);
  +        declaringclass = forClass(dc);
       }
  +
       return declaringclass;
     }
  -    
  +
     /**
  -    Declare that this class is an inner class of another.
  -    */
  -  private void addInnerClass(Class newclass)
  -       throws SynthesisException
  +   * Declare that this class is an inner class of another.
  +   *
  +   * NEEDSDOC @param newclass
  +   *
  +   * @throws SynthesisException
  +   */
  +  private void addInnerClass(Class newclass) throws SynthesisException
     {
  +
       if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    
  -    if(newclass.getDeclaringClass()!=this)
  -        throw new SynthesisException(SynthesisException.WRONG_OWNER);
  -    
  -    Class[] scratch=new Class[innerclasses.length+1];
  -    System.arraycopy(innerclasses,0,scratch,0,innerclasses.length);
  -    scratch[innerclasses.length]=newclass;
  -    innerclasses=scratch;
  +
  +    if (newclass.getDeclaringClass() != this)
  +      throw new SynthesisException(SynthesisException.WRONG_OWNER);
  +
  +    Class[] scratch = new Class[innerclasses.length + 1];
  +
  +    System.arraycopy(innerclasses, 0, scratch, 0, innerclasses.length);
  +
  +    scratch[innerclasses.length] = newclass;
  +    innerclasses = scratch;
     }
  -  
  +
     /**
      * Declare a class contained within this class. This doesn't
      * address anonymous classes (those go inside method bodies
  @@ -890,7 +1077,7 @@
      * <p>
      * ***** This requires lookup methods that operate in the
      * context of a specific class, and per-class registries!
  -   * 
  +   *
      * @param className Local name of inner class to create. This should _not_ be a
      * qualified name, unlike the normal forName() call. Its
      * hierarchy is established by the class within which it is
  @@ -899,32 +1086,40 @@
      * @exception org.apache.xalan.utils.synthetic.SynthesisException if class could not be created.
      * @since 2/2000
      * @see forName
  +   *
  +   * @throws SynthesisException
      */
  -  public Class declareInnerClass(String className)
  -       throws SynthesisException
  +  public Class declareInnerClass(String className) throws SynthesisException
     {
  +
       if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -      
  -    String relativeName=getName()+"$"+className;
  -    Class newclass=(Class)(global_classtable.get(relativeName));
  -    if(newclass!=null)
  -        throw new SynthesisException(SynthesisException.SYNTAX,"Inner class "+name+" already exists");
  -    newclass=new Class(className);
  -    newclass.declaringclass=this;
  -
  -    Class[] scratch=new Class[innerclasses.length+1];
  -    System.arraycopy(innerclasses,0,scratch,0,innerclasses.length);
  -    scratch[innerclasses.length]=newclass;
  -    innerclasses=scratch;
  +
  +    String relativeName = getName() + "$" + className;
  +    Class newclass = (Class) (global_classtable.get(relativeName));
  +
  +    if (newclass != null)
  +      throw new SynthesisException(SynthesisException.SYNTAX,
  +                                   "Inner class " + name + " already exists");
  +
  +    newclass = new Class(className);
  +    newclass.declaringclass = this;
  +
  +    Class[] scratch = new Class[innerclasses.length + 1];
  +
  +    System.arraycopy(innerclasses, 0, scratch, 0, innerclasses.length);
  +
  +    scratch[innerclasses.length] = newclass;
  +    innerclasses = scratch;
  +
       return newclass;
     }
  -  
  +
     /**
  -   * Fetch a list of classes contained within this class. 
  -   * This doesn't address anonymous classes (those go 
  +   * Fetch a list of classes contained within this class.
  +   * This doesn't address anonymous classes (those go
      * inside method bodies and similar code), just local classes.
  -   * 
  +   *
      * @return org.apache.xalan.utils.synthetic.Class[] object for the contained classes.
      * This may be empty if none such exist, or if the class is
      * reified (since reflection doesn't report this information).
  @@ -935,276 +1130,330 @@
     {
       return innerclasses;
     }
  -  
  +
     /**
  -    Returns a Field object that reflects the specified
  -    public member field of the class or interface
  -    represented by this Class object. The name
  -    parameter is a String specifying the simple name of
  -    the desired field. 
  -    <p>
  -    The field to be reflected is located by searching all
  -    the member fields of the class or interface
  -    represented by this Class object for a public field
  -    with the specified name. 
  -    <p>
  -    See The Java Language Specification, sections 8.2
  -    and 8.3. 
  -    
  -    @throws NoSuchFieldException 
  -    if a field with the specified name is not
  -    found. 
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Field 
  -    */
  -  public Field getField(String name) throws NoSuchFieldException, SecurityException
  +   * Returns a Field object that reflects the specified
  +   * public member field of the class or interface
  +   * represented by this Class object. The name
  +   * parameter is a String specifying the simple name of
  +   * the desired field.
  +   * <p>
  +   * The field to be reflected is located by searching all
  +   * the member fields of the class or interface
  +   * represented by this Class object for a public field
  +   * with the specified name.
  +   * <p>
  +   * See The Java Language Specification, sections 8.2
  +   * and 8.3.
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NoSuchFieldException
  +   * if a field with the specified name is not
  +   * found.
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Field
  +   */
  +  public Field getField(String name)
  +          throws NoSuchFieldException, SecurityException
     {
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Returns an array containing Field objects
  -    reflecting all the accessible public fields of the
  -    class or interface represented by this Class object.
  -    Returns an array of length 0 if the class or interface
  -    has no accessible public fields, or if it represents
  -    an array type or a primitive type. 
  -    <p>
  -    Specifically, if this Class object represents a class,
  -    returns the public fields of this class and of all its
  -    superclasses. If this Class object represents an
  -    interface, returns the fields of this interface and of
  -    all its superinterfaces. If this Class object
  -    represents an array type or a primitive type, returns
  -    an array of length 0. 
  -    <p>
  -    The implicit length field for array types is not
  -    reflected by this method. User code should use the
  -    methods of class Array to manipulate arrays. 
  -    <p>
  -    See The Java Language Specification, sections 8.2
  -    and 8.3. 
  -    
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see Field 
  -    */
  +   * Returns an array containing Field objects
  +   * reflecting all the accessible public fields of the
  +   * class or interface represented by this Class object.
  +   * Returns an array of length 0 if the class or interface
  +   * has no accessible public fields, or if it represents
  +   * an array type or a primitive type.
  +   * <p>
  +   * Specifically, if this Class object represents a class,
  +   * returns the public fields of this class and of all its
  +   * superclasses. If this Class object represents an
  +   * interface, returns the fields of this interface and of
  +   * all its superinterfaces. If this Class object
  +   * represents an array type or a primitive type, returns
  +   * an array of length 0.
  +   * <p>
  +   * The implicit length field for array types is not
  +   * reflected by this method. User code should use the
  +   * methods of class Array to manipulate arrays.
  +   * <p>
  +   * See The Java Language Specification, sections 8.2
  +   * and 8.3.
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see Field
  +   */
     public Field[] getFields() throws SecurityException
     {
  -    if(realclass!=null && allfields==null)
  +
  +    if (realclass != null && allfields == null)
  +    {
  +      java.lang.reflect.Field[] realDF = realclass.getFields();
  +
  +      allfields = new Field[realDF.length];
  +
  +      for (int i = 0; i < realDF.length; ++i)
         {
  -	java.lang.reflect.Field[] realDF=realclass.getFields();
  -	allfields=new Field[realDF.length];
  -	for(int i=0;i<realDF.length;++i)
  -	  allfields[i]=new Field(realDF[i],this);
  +        allfields[i] = new Field(realDF[i], this);
         }
  -    
  +    }
  +
       return allfields;
     }
  +
     /**
  -    Determines the interfaces implemented by the
  -    class or interface represented by this object. 
  -    <p>
  -    If this object represents a class, the return value is
  -    an array containing objects representing all
  -    interfaces implemented by the class. The order of
  -    the interface objects in the array corresponds to the
  -    order of the interface names in the implements
  -    clause of the declaration of the class represented by
  -    this object. 
  -    <p>
  -    If this object represents an interface, the array
  -    contains objects representing all interfaces
  -    extended by the interface. The order of the
  -    interface objects in the array corresponds to the
  -    order of the interface names in the extends clause
  -    of the declaration of the interface represented by
  -    this object. 
  -    <p>
  -    If the class or interface implements no interfaces,
  -    the method returns an array of length 0. 
  -    
  -    @return
  -    an array of interfaces implemented by this
  -    class. 
  -    */
  +   * Determines the interfaces implemented by the
  +   * class or interface represented by this object.
  +   * <p>
  +   * If this object represents a class, the return value is
  +   * an array containing objects representing all
  +   * interfaces implemented by the class. The order of
  +   * the interface objects in the array corresponds to the
  +   * order of the interface names in the implements
  +   * clause of the declaration of the class represented by
  +   * this object.
  +   * <p>
  +   * If this object represents an interface, the array
  +   * contains objects representing all interfaces
  +   * extended by the interface. The order of the
  +   * interface objects in the array corresponds to the
  +   * order of the interface names in the extends clause
  +   * of the declaration of the interface represented by
  +   * this object.
  +   * <p>
  +   * If the class or interface implements no interfaces,
  +   * the method returns an array of length 0.
  +   *
  +   * @return
  +   * an array of interfaces implemented by this
  +   * class.
  +   */
     public Class[] getInterfaces()
     {
  -    if(realclass!=null && interfaces==null)
  +
  +    if (realclass != null && interfaces == null)
  +    {
  +      java.lang.Class[] realI = realclass.getInterfaces();
  +
  +      interfaces = new Class[realI.length];
  +
  +      for (int i = 0; i < realI.length; ++i)
         {
  -	java.lang.Class[] realI=realclass.getInterfaces();
  -	interfaces=new Class[realI.length];
  -	for(int i=0;i<realI.length;++i)
  -	  interfaces[i]=forClass(realI[i]);
  +        interfaces[i] = forClass(realI[i]);
         }
  -    
  +    }
  +
       return interfaces;
     }
  -  
  +
     /**
  -    Adds an "implements" description for the class or
  -    interface represented by this Class object
  -    
  -    @throws SynthesisException
  -    if the class has been reified.
  -    @see 
  -    class 
  -    */
  -  public void addImplements(Class newclass) 
  -       throws SynthesisException
  +   * Adds an "implements" description for the class or
  +   * interface represented by this Class object
  +   *
  +   *
  +   * NEEDSDOC @param newclass
  +   * @throws SynthesisException
  +   * if the class has been reified.
  +   * @see
  +   * class
  +   */
  +  public void addImplements(Class newclass) throws SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    Class[] scratch=new Class[interfaces.length+1];
  -    System.arraycopy(interfaces,0,scratch,0,interfaces.length);
  -    scratch[interfaces.length]=newclass;
  -    interfaces=scratch;
  -  }
  -  
  -  
  -  
  -  /**
  -    Returns a Method object that reflects the specified
  -    public member method of the class or interface
  -    represented by this Class object. The name
  -    parameter is a String specifying the simple name
  -    the desired method, and the parameterTypes
  -    parameter is an array of Class objects that identify
  -    the method's formal parameter types, in declared
  -    order. 
  -    <p>
  -    The method to reflect is located by searching all
  -    the member methods of the class or interface
  -    represented by this Class object for a public
  -    method with the specified name and exactly the
  -    same formal parameter types. 
  -    <p>
  -    See The Java Language Specification, sections 8.2
  -    and 8.4. 
  -    
  -    @throws NoSuchMethodException 
  -    if a matching method is not found. 
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see 
  -    Method 
  -    */
  -  public Method getMethod(String name, Class parameterTypes[]) throws NoSuchMethodException, SecurityException
  +
  +    Class[] scratch = new Class[interfaces.length + 1];
  +
  +    System.arraycopy(interfaces, 0, scratch, 0, interfaces.length);
  +
  +    scratch[interfaces.length] = newclass;
  +    interfaces = scratch;
  +  }
  +
  +  /**
  +   * Returns a Method object that reflects the specified
  +   * public member method of the class or interface
  +   * represented by this Class object. The name
  +   * parameter is a String specifying the simple name
  +   * the desired method, and the parameterTypes
  +   * parameter is an array of Class objects that identify
  +   * the method's formal parameter types, in declared
  +   * order.
  +   * <p>
  +   * The method to reflect is located by searching all
  +   * the member methods of the class or interface
  +   * represented by this Class object for a public
  +   * method with the specified name and exactly the
  +   * same formal parameter types.
  +   * <p>
  +   * See The Java Language Specification, sections 8.2
  +   * and 8.4.
  +   *
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param parameterTypes
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NoSuchMethodException
  +   * if a matching method is not found.
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see
  +   * Method
  +   */
  +  public Method getMethod(String name, Class parameterTypes[])
  +          throws NoSuchMethodException, SecurityException
     {
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Returns an array containing Method objects
  -    reflecting all the public member methods of the
  -    class or interface represented by this Class object,
  -    including those declared by the class or interface
  -    and and those inherited from superclasses and
  -    superinterfaces. Returns an array of length 0 if the
  -    class or interface has no public member methods. 
  -    <p>
  -    See The Java Language Specification, sections 8.2
  -    and 8.4. 
  -    
  -    @throws SecurityException 
  -    if access to the information is denied. 
  -    @see Method 
  -    **/
  +   * Returns an array containing Method objects
  +   * reflecting all the public member methods of the
  +   * class or interface represented by this Class object,
  +   * including those declared by the class or interface
  +   * and and those inherited from superclasses and
  +   * superinterfaces. Returns an array of length 0 if the
  +   * class or interface has no public member methods.
  +   * <p>
  +   * See The Java Language Specification, sections 8.2
  +   * and 8.4.
  +   *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws SecurityException
  +   * if access to the information is denied.
  +   * @see Method
  +   */
     public Method[] getMethods() throws SecurityException
     {
  -    if(realclass!=null && allmethods==null)
  +
  +    if (realclass != null && allmethods == null)
  +    {
  +      java.lang.reflect.Method[] realDM = realclass.getMethods();
  +
  +      allmethods = new Method[realDM.length];
  +
  +      for (int i = 0; i < realDM.length; ++i)
         {
  -	java.lang.reflect.Method[] realDM=realclass.getMethods();
  -	allmethods=new Method[realDM.length];
  -	for(int i=0;i<realDM.length;++i)
  -	  allmethods[i]=new Method(realDM[i],this);
  +        allmethods[i] = new Method(realDM[i], this);
         }
  -    
  +    }
  +
       return allmethods;
     }
  +
     /**
  -    Returns the Java language modifiers for this class
  -    or interface, encoded in an integer. The modifiers
  -    consist of the Java Virtual Machine's constants for
  -    public, protected, private, final, and interface; they
  -    should be decoded using the methods of class
  -    Modifier. 
  -    
  -    The modifier encodings are defined in The Java
  -    Virtual Machine Specification, table 4.1. 
  -    
  -    See Also: 
  -    java.lang.reflect.Modifier 
  -    */
  +   * Returns the Java language modifiers for this class
  +   * or interface, encoded in an integer. The modifiers
  +   * consist of the Java Virtual Machine's constants for
  +   * public, protected, private, final, and interface; they
  +   * should be decoded using the methods of class
  +   * Modifier.
  +   *
  +   * The modifier encodings are defined in The Java
  +   * Virtual Machine Specification, table 4.1.
  +   *
  +   * See Also:
  +   * java.lang.reflect.Modifier
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public int getModifiers()
     {
       return modifiers;
     }
  -/**
  -    Set the Java language modifiers for this class
  -    or interface, encoded in an integer. The modifiers
  -    consist of the Java Virtual Machine's constants for
  -    public, protected, private, final, and interface; they
  -    should be decoded using the methods of class
  -    Modifier. 
  -    
  -    The modifier encodings are defined in The Java
  -    Virtual Machine Specification, table 4.1. 
  -    
  -    See Also: 
  -    java.lang.reflect.Modifier 
  -    */
  +
  +  /**
  +   *   Set the Java language modifiers for this class
  +   *   or interface, encoded in an integer. The modifiers
  +   *   consist of the Java Virtual Machine's constants for
  +   *   public, protected, private, final, and interface; they
  +   *   should be decoded using the methods of class
  +   *   Modifier.
  +   *
  +   *   The modifier encodings are defined in The Java
  +   *   Virtual Machine Specification, table 4.1.
  +   *
  +   *   See Also:
  +   *   java.lang.reflect.Modifier
  +   *
  +   * NEEDSDOC @param modifiers
  +   *
  +   * @throws SynthesisException
  +   */
     public void setModifiers(int modifiers) throws SynthesisException
     {
  -    if(this.realclass!=null)
  +
  +    if (this.realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    this.modifiers=modifiers;
  +
  +    this.modifiers = modifiers;
     }
  -  
  +
     /**
      * Retrieve the fully-qualified classname. If it's an array,
      * it will be returned in JVM syntax, not Java syntax.
  -   * 
  +   *
      * @return java.lang.String
      * @since 12/95
      * @see getShortName
      * @see getJavaName
      * @see getJavaShortName
      */
  -  public java.lang.String getName() {
  +  public java.lang.String getName()
  +  {
       return name;
     }
  -  
  +
     /**
      * Like getName, but back-convert array notation escapes.
      * ***** DOESN'T YET HANDLE ARRAYS OF PRIMITIVES!
  -   * 
  +   *
      * @return java.lang.String
      * @since 3/2000
      * @see getName
      * @see getJavaShortName
      */
  -  public java.lang.String getJavaName() {
  -    if(name.charAt(0)!='[')
  -        return name;
  -    
  +  public java.lang.String getJavaName()
  +  {
  +
  +    if (name.charAt(0) != '[')
  +      return name;
  +
       // Object array syntax is [Ltypename; 
       // add another [ for each level of array
  -    int count=name.lastIndexOf('[');
  -    StringBuffer jname=new StringBuffer(name.substring(count+2));
  +    int count = name.lastIndexOf('[');
  +    StringBuffer jname = new StringBuffer(name.substring(count + 2));
  +
       // Trim the trailing ';'
  -    jname.setLength(jname.length()-1);
  -    while(count-->=0)
  -       jname.append("[]");
  +    jname.setLength(jname.length() - 1);
  +
  +    while (count-- >= 0)
  +    {
  +      jname.append("[]");
  +    }
  +
       return jname.toString();
     }
  -  
  +
     /**
      * Extract just the local name of this class, minus the package
      * prefix.
  -   * 
  +   *
      * ***** I don't think this handles array types properly yet.
  -   * 
  +   *
      * @return java.lang.String
      * @since 12/99
      * @see getName
  @@ -1212,50 +1461,62 @@
      * @see getJavaName
      * @see getJavaShortName
      */
  -  public java.lang.String getShortName() {
  -    int start=name.lastIndexOf(".");
  -    if(start!=0 || name.charAt(0)=='.')
  +  public java.lang.String getShortName()
  +  {
  +
  +    int start = name.lastIndexOf(".");
  +
  +    if (start != 0 || name.charAt(0) == '.')
         ++start;
  -      
  -    if(declaringclass!=null)
  +
  +    if (declaringclass != null)
       {
  -        int d=name.lastIndexOf('$', start);
  -        if(d!=0)
  -            start=d+1;
  +      int d = name.lastIndexOf('$', start);
  +
  +      if (d != 0)
  +        start = d + 1;
       }
  +
       return name.substring(start);
     }
  +
     /**
      * Like getShortName, but back-convert array notation escapes.
      * ***** DOESN'T YET HANDLE ARRAYS OF PRIMITIVES!
  -   * 
  +   *
      * @return java.lang.String
      * @since 3/2000
      * @see getJavaName
      * @see getShortName
      */
  -  public java.lang.String getJavaShortName() {
  -    String shortname=getShortName();
  -    if(shortname.charAt(0)!='[')
  -        return shortname;
  -    
  +  public java.lang.String getJavaShortName()
  +  {
  +
  +    String shortname = getShortName();
  +
  +    if (shortname.charAt(0) != '[')
  +      return shortname;
  +
       // Object array syntax is [Ltypename; 
       // add another [ for each level of array
  -    int count=shortname.lastIndexOf('[');
  -    StringBuffer jname=new StringBuffer(shortname.substring(count+2));
  +    int count = shortname.lastIndexOf('[');
  +    StringBuffer jname = new StringBuffer(shortname.substring(count + 2));
  +
       // Trim the trailing ';'
  -    jname.setLength(jname.length()-1);
  -    while(count-->=0)
  -       jname.append("[]");
  +    jname.setLength(jname.length() - 1);
  +
  +    while (count-- >= 0)
  +    {
  +      jname.append("[]");
  +    }
  +
       return jname.toString();
     }
  -  
  -  
  -  
  +
     /**
      * Extract the package name for this class.
      * ***** I don't think this handles array classes properly yet.
  -   * 
  +   *
      * @return java.lang.String
      * @since 12/95
      * @see getName
  @@ -1263,24 +1524,27 @@
      * @see getJavaName
      * @see getJavaShortName
      */
  -  public java.lang.String getPackageName() {
  -    int start=name.lastIndexOf(".");
  -    return name.substring(0,start);
  +  public java.lang.String getPackageName()
  +  {
  +
  +    int start = name.lastIndexOf(".");
  +
  +    return name.substring(0, start);
     }
  -  
  -  
  +
     /**
  -   * If this synthetic class is a wrapper for a "real" 
  +   * If this synthetic class is a wrapper for a "real"
      * java.lang.Class -- either because it was instantiated as such
      * or because it has been compiled -- this method will return
      * that class. Otherwise it returns null.
      * Creation date: (12-25-99 12:26:01 PM)
      * @return org.apache.xalan.utils.synthetic.Class
      */
  -  public java.lang.Class getRealClass() {
  +  public java.lang.Class getRealClass()
  +  {
       return realclass;
     }
  -  
  +
     /**
      * This call is intended to allow an existing org.apache.xalan.utils.synthetic.Class
      * to be switched from purely descriptive mode to proxy mode
  @@ -1301,477 +1565,619 @@
      * <p>
      * Creation date: (12-25-99 12:26:01 PM)
      * @param java.lang.class realclass nonsynthetic Class object to proxy
  +   *
  +   * NEEDSDOC @param realclass
  +   *
  +   * @throws SynthesisException
      */
  -  public void setRealClass(java.lang.Class realclass) 
  -       throws SynthesisException
  +  public void setRealClass(java.lang.Class realclass)
  +          throws SynthesisException
     {
  -    if(this.realclass!=null)
  +
  +    if (this.realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    
  -    this.realclass=realclass;
  -    this.modifiers=realclass.getModifiers();
  -    this.isInterface=realclass.isInterface();
  -    
  +
  +    this.realclass = realclass;
  +    this.modifiers = realclass.getModifiers();
  +    this.isInterface = realclass.isInterface();
  +
       // DEFERRED -- set them null now, reconstruct when requested
  -    this.declaringclass=null;
  -    this.interfaces=null;
  -    this.declaredconstructors=null;
  -    this.allconstructors=null;
  -    this.declaredmethods=null;
  -    this.allmethods=null;
  -    this.declaredfields=null;
  -    this.allfields=null;
  -    this.declaredclasses=null;
  -    this.allclasses=null;
  -    this.superclass=null;
  -  }
  -  
  -  
  -  
  +    this.declaringclass = null;
  +    this.interfaces = null;
  +    this.declaredconstructors = null;
  +    this.allconstructors = null;
  +    this.declaredmethods = null;
  +    this.allmethods = null;
  +    this.declaredfields = null;
  +    this.allfields = null;
  +    this.declaredclasses = null;
  +    this.allclasses = null;
  +    this.superclass = null;
  +  }
  +
     /**
      * Set the superclass for this synthetic class.
      * Object is equivalent to Null.
      * Creation date: (12-25-99 12:26:01 PM)
  +   *
  +   * NEEDSDOC @param superclass
      * @return org.apache.xalan.utils.synthetic.Class
  +   *
  +   * @throws SynthesisException
      */
  -  public void setSuperClass(Class superclass)
  -       throws SynthesisException
  +  public void setSuperClass(Class superclass) throws SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    this.superclass=superclass;
  +
  +    this.superclass = superclass;
     }
  +
     /**
      * Set the superclass for this synthetic class.
      * Creation date: (12-25-99 12:26:01 PM)
  +   *
  +   * NEEDSDOC @param superclass
      * @return org.apache.xalan.utils.synthetic.Class
  +   *
  +   * @throws ClassNotFoundException
  +   * @throws SynthesisException
      */
  -  public void setSuperClass(java.lang.Class superclass) 
  -       throws ClassNotFoundException,SynthesisException
  +  public void setSuperClass(java.lang.Class superclass)
  +          throws ClassNotFoundException, SynthesisException
     {
  -    if(realclass!=null)
  +
  +    if (realclass != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    this.superclass=Class.forClass(superclass);
  +
  +    this.superclass = Class.forClass(superclass);
     }
  -  
  +
     /**
  -    Finds a resource with the specified name. The
  -    rules for searching for resources associated with a
  -    given class are implemented by the class loader of
  -    the class. 
  -    <p>
  -    The Class methods delegate to ClassLoader
  -    methods, after applying a naming convention: if
  -    the resource name starts with "/", it is used as is.
  -    Otherwise, the name of the package is prepended,
  -    after converting "." to "/". 
  -    
  -    @param 
  -    name - the string representing the resource to
  -    be found. 
  -    @return 
  -    the URL object having the specified name, or
  -    null if no resource with the specified name
  -    is found. 
  -    @see  ClassLoader  
  -    @see  getResourceAsStream 
  -    */
  +   * Finds a resource with the specified name. The
  +   * rules for searching for resources associated with a
  +   * given class are implemented by the class loader of
  +   * the class.
  +   * <p>
  +   * The Class methods delegate to ClassLoader
  +   * methods, after applying a naming convention: if
  +   * the resource name starts with "/", it is used as is.
  +   * Otherwise, the name of the package is prepended,
  +   * after converting "." to "/".
  +   *
  +   * @param
  +   * name - the string representing the resource to
  +   * be found.
  +   * @return
  +   * the URL object having the specified name, or
  +   * null if no resource with the specified name
  +   * is found.
  +   * @see  ClassLoader
  +   * @see  getResourceAsStream
  +   */
     public java.net.URL getResource(String name)
     {
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Finds a resource with a given name. Will return
  -    null if no resource with this name is found. The
  -    rules for searching a resources associated with a
  -    given class are implemented by the ClassLoader of
  -    the class.
  -    <p>
  -    The Class methods delegate to ClassLoader
  -    methods, after applying a naming convention: if
  -    the resource name starts with "/", it is used as is.
  -    Otherwise, the name of the package is prepended,
  -    after converting "." to "/". 
  -    
  -    @param 
  -    name - the string representing the resource to
  -    be found 
  -    @return 
  -    the InputStream object having the
  -    specified name, or null if no resource with
  -    the specified name is found. 
  -    @see ClassLoader  
  -    @see  getResource 
  -    */
  +   * Finds a resource with a given name. Will return
  +   * null if no resource with this name is found. The
  +   * rules for searching a resources associated with a
  +   * given class are implemented by the ClassLoader of
  +   * the class.
  +   * <p>
  +   * The Class methods delegate to ClassLoader
  +   * methods, after applying a naming convention: if
  +   * the resource name starts with "/", it is used as is.
  +   * Otherwise, the name of the package is prepended,
  +   * after converting "." to "/".
  +   *
  +   * @param
  +   * name - the string representing the resource to
  +   * be found
  +   * @return
  +   * the InputStream object having the
  +   * specified name, or null if no resource with
  +   * the specified name is found.
  +   * @see ClassLoader
  +   * @see  getResource
  +   */
     public java.io.InputStream getResourceAsStream(String name)
     {
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the signers of this class.
  -    */
  +   * Get the signers of this class.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Object[] getSigners()
     {
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    If this object represents any class other than the
  -    class Object, then the object that represents the
  -    superclass of that class is returned. 
  -    <p>
  -    If this object is the one that represents the class
  -    Object or this object represents an interface, null is
  -    returned. 
  -    
  -    @return
  -    the superclass of the class represented by this
  -    object. 
  -    */
  +   * If this object represents any class other than the
  +   * class Object, then the object that represents the
  +   * superclass of that class is returned.
  +   * <p>
  +   * If this object is the one that represents the class
  +   * Object or this object represents an interface, null is
  +   * returned.
  +   *
  +   * @return
  +   * the superclass of the class represented by this
  +   * object.
  +   */
     public Class getSuperclass()
     {
  -   if(realclass!=null && superclass==null)
  -   {
  -        superclass=forClass(realclass.getSuperclass()); 
  -    	// getDeclaredClasses(); // Sets superclass as a side-effect
  -   }
  -   if(superclass==null)
  -    superclass=forClass(Object.class);
  -   return superclass;
  +
  +    if (realclass != null && superclass == null)
  +    {
  +      superclass = forClass(realclass.getSuperclass());
  +
  +      // getDeclaredClasses(); // Sets superclass as a side-effect
  +    }
  +
  +    if (superclass == null)
  +      superclass = forClass(Object.class);
  +
  +    return superclass;
     }
  +
     /**
  -    If this Class object represents an array type, returns
  -    true, otherwise returns false.
  -    */
  +   * If this Class object represents an array type, returns
  +   * true, otherwise returns false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public boolean isArray()
     {
  -    return realclass!=null && realclass.isArray();
  +    return realclass != null && realclass.isArray();
     }
  +
     /**
  -    Determines if the class or interface represented by
  -    this Class object is either the same as, or is a
  -    superclass or superinterface of, the class or
  -    interface represented by the specified Class
  -    parameter. It returns true if so, false otherwise. If
  -    this Class object represents a primitive type,
  -    returns true if the specified Class parameter is
  -    exactly this Class object, false otherwise. 
  -    <p>
  -    Specifically, this method tests whether the type
  -    represented by the specified Class parameter can
  -    be converted to the type represented by this Class
  -    object via an identity conversion or via a widening
  -    reference conversion. See The Java Language
  -    Specification, sections 5.1.1 and 5.1.4 , for details. 
  -    
  -    @throws NullPointerException if the specified Class parameter is null.
  -    */
  +   * Determines if the class or interface represented by
  +   * this Class object is either the same as, or is a
  +   * superclass or superinterface of, the class or
  +   * interface represented by the specified Class
  +   * parameter. It returns true if so, false otherwise. If
  +   * this Class object represents a primitive type,
  +   * returns true if the specified Class parameter is
  +   * exactly this Class object, false otherwise.
  +   * <p>
  +   * Specifically, this method tests whether the type
  +   * represented by the specified Class parameter can
  +   * be converted to the type represented by this Class
  +   * object via an identity conversion or via a widening
  +   * reference conversion. See The Java Language
  +   * Specification, sections 5.1.1 and 5.1.4 , for details.
  +   *
  +   *
  +   * NEEDSDOC @param cls
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NullPointerException if the specified Class parameter is null.
  +   */
     public boolean isAssignableFrom(Class cls)
     {
  -    if(realclass!=null && cls.realclass!=null)
  +
  +    if (realclass != null && cls.realclass != null)
         return realclass.isAssignableFrom(cls.realclass);
  -    
  -    throw new java.lang.IllegalStateException ();
  +
  +    throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Determines if the class or interface represented by
  -    this Class object is either the same as, or is a
  -    superclass or superinterface of, the class or
  -    interface represented by the specified Class
  -    parameter. It returns true if so, false otherwise. If
  -    this Class object represents a primitive type,
  -    returns true if the specified Class parameter is
  -    exactly this Class object, false otherwise. 
  -    <p>
  -    Specifically, this method tests whether the type
  -    represented by the specified Class parameter can
  -    be converted to the type represented by this Class
  -    object via an identity conversion or via a widening
  -    reference conversion. See The Java Language
  -    Specification, sections 5.1.1 and 5.1.4 , for details. 
  -    
  -    @throws NullPointerException if the specified Class parameter is null.
  -    */
  +   * Determines if the class or interface represented by
  +   * this Class object is either the same as, or is a
  +   * superclass or superinterface of, the class or
  +   * interface represented by the specified Class
  +   * parameter. It returns true if so, false otherwise. If
  +   * this Class object represents a primitive type,
  +   * returns true if the specified Class parameter is
  +   * exactly this Class object, false otherwise.
  +   * <p>
  +   * Specifically, this method tests whether the type
  +   * represented by the specified Class parameter can
  +   * be converted to the type represented by this Class
  +   * object via an identity conversion or via a widening
  +   * reference conversion. See The Java Language
  +   * Specification, sections 5.1.1 and 5.1.4 , for details.
  +   *
  +   *
  +   * NEEDSDOC @param cls
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws NullPointerException if the specified Class parameter is null.
  +   */
     public boolean isAssignableFrom(java.lang.Class cls)
     {
  -    if(realclass!=null)
  -      return realclass.isAssignableFrom((java.lang.Class)cls);
  -    
  -    throw new java.lang.IllegalStateException ();
  -  }
  -  /**
  -    This method is the dynamic equivalent of the Java
  -    language instanceof operator. The method
  -    returns true if the specified Object argument is
  -    non-null and can be cast to the reference type
  -    represented by this Class object without raising a
  -    ClassCastException. It returns false otherwise. 
  -    <p>
  -    Specifically, if this Class object represents a
  -    declared class, returns true if the specified Object
  -    argument is an instance of the represented class (or
  -    of any of its subclasses); false otherwise. If this
  -    Class object represents an array class, returns true
  -    if the specified Object argument can be converted
  -    to an object of the array type by an identity
  -    conversion or by a widening reference conversion;
  -    false otherwise. If this Class object represents an
  -    interface, returns true if the class or any superclass
  -    of the specified Object argument implements this
  -    interface; false otherwise. If this Class object
  -    represents a primitive type, returns false. 
  -    
  -    @param obj The object to check 
  -    */
  +
  +    if (realclass != null)
  +      return realclass.isAssignableFrom((java.lang.Class) cls);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
  +   * This method is the dynamic equivalent of the Java
  +   * language instanceof operator. The method
  +   * returns true if the specified Object argument is
  +   * non-null and can be cast to the reference type
  +   * represented by this Class object without raising a
  +   * ClassCastException. It returns false otherwise.
  +   * <p>
  +   * Specifically, if this Class object represents a
  +   * declared class, returns true if the specified Object
  +   * argument is an instance of the represented class (or
  +   * of any of its subclasses); false otherwise. If this
  +   * Class object represents an array class, returns true
  +   * if the specified Object argument can be converted
  +   * to an object of the array type by an identity
  +   * conversion or by a widening reference conversion;
  +   * false otherwise. If this Class object represents an
  +   * interface, returns true if the class or any superclass
  +   * of the specified Object argument implements this
  +   * interface; false otherwise. If this Class object
  +   * represents a primitive type, returns false.
  +   *
  +   * @param obj The object to check
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public boolean isInstance(Object obj)
     {
  -    if (realclass!=null) 
  +
  +    if (realclass != null)
         return realclass.isInstance(obj);
  -    
  +
       // Scan inheritances? (reliable).
       // Check name? (not reliable).
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Determines if the specified Class object represents
  -    an interface type. 
  -    
  -    @return
  -    true if this object represents an interface;
  -    false otherwise. 
  -    */
  +   * Determines if the specified Class object represents
  +   * an interface type.
  +   *
  +   * @return
  +   * true if this object represents an interface;
  +   * false otherwise.
  +   */
     public boolean isInterface()
     {
       return (realclass != null) ? realclass.isInterface() : isInterface;
     }
  +
     /**
  -    Assert that the specified Class object represents
  -    an interface type. Can't be changed after real class loaded.
  -    
  -    @param
  -    true if this object represents an interface;
  -    false otherwise. 
  -    */
  -  public void isInterface(boolean isInterface)
  -  throws SynthesisException
  -  {
  -    if(realclass == null)
  -      this.isInterface=isInterface;
  -    else if (realclass.isInterface()!=isInterface)
  +   * Assert that the specified Class object represents
  +   * an interface type. Can't be changed after real class loaded.
  +   *
  +   * @param
  +   * true if this object represents an interface;
  +   * false otherwise.
  +   *
  +   * NEEDSDOC @param isInterface
  +   *
  +   * @throws SynthesisException
  +   */
  +  public void isInterface(boolean isInterface) throws SynthesisException
  +  {
  +
  +    if (realclass == null)
  +      this.isInterface = isInterface;
  +    else if (realclass.isInterface() != isInterface)
         throw new SynthesisException(SynthesisException.REIFIED);
     }
  +
     /**
  -    Determines if the specified Class object represents
  -    a primitive Java type. 
  -    <p>
  -    There are nine predefined Class objects to
  -    represent the eight primitive Java types and void.
  -    These are created by the Java Virtual Machine, and
  -    have the same names as the primitive types that
  -    they represent, namely boolean, byte, char, short,
  -    int, long, float, and double, and void. 
  -    <p>
  -    These objects may only be accessed via the
  -    following public static final variables, and are the
  -    only Class objects for which this method returns
  -    true. 
  -    */
  +   * Determines if the specified Class object represents
  +   * a primitive Java type.
  +   * <p>
  +   * There are nine predefined Class objects to
  +   * represent the eight primitive Java types and void.
  +   * These are created by the Java Virtual Machine, and
  +   * have the same names as the primitive types that
  +   * they represent, namely boolean, byte, char, short,
  +   * int, long, float, and double, and void.
  +   * <p>
  +   * These objects may only be accessed via the
  +   * following public static final variables, and are the
  +   * only Class objects for which this method returns
  +   * true.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public boolean isPrimitive()
     {
  -    return realclass!=null && realclass.isPrimitive();
  +    return realclass != null && realclass.isPrimitive();
     }
  +
     /**
  -    Creates a new instance of a class. 
  -    
  -    @return 
  -    a newly allocated instance of the class
  -    represented by this object. This is done
  -    exactly as if by a new expression with an
  -    empty argument list. 
  -    @throws IllegalAccessException 
  -    if the class or initializer is not accessible. 
  -    @throws InstantiationException 
  -    if an application tries to instantiate an
  -    abstract class or an interface, or if the
  -    instantiation fails for some other reason. 
  -    */
  -  public Object newInstance() throws InstantiationException, IllegalAccessException
  +   * Creates a new instance of a class.
  +   *
  +   * @return
  +   * a newly allocated instance of the class
  +   * represented by this object. This is done
  +   * exactly as if by a new expression with an
  +   * empty argument list.
  +   * @throws IllegalAccessException
  +   * if the class or initializer is not accessible.
  +   * @throws InstantiationException
  +   * if an application tries to instantiate an
  +   * abstract class or an interface, or if the
  +   * instantiation fails for some other reason.
  +   */
  +  public Object newInstance()
  +          throws InstantiationException, IllegalAccessException
     {
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Converts the object to a string. The string
  -    representation is the string "class" or
  -    "interface" followed by a space and then the
  -    fully qualified name of the class. If this Class
  -    object represents a primitive type, returns the
  -    name of the primitive type.
  -    <p>
  -    ***** Should this say "synthetic" as well as "class" or
  -    "interface"? Or should that be gated on whether we're proxy
  -    to a realclass?
  -    
  -    @return a string representation of this class object. 
  -    */
  +   * Converts the object to a string. The string
  +   * representation is the string "class" or
  +   * "interface" followed by a space and then the
  +   * fully qualified name of the class. If this Class
  +   * object represents a primitive type, returns the
  +   * name of the primitive type.
  +   * <p>
  +   *  Should this say "synthetic" as well as "class" or
  +   * "interface"? Or should that be gated on whether we're proxy
  +   * to a realclass?
  +   *
  +   * @return a string representation of this class object.
  +   */
     public String toString()
     {
  +
       if (realclass != null)
         return realclass.toString();
  +    else if (isInterface())
  +      return "interface " + name;
       else
  -      if (isInterface())
  -	return "interface " + name;
  -      else
  -	return "class " + name;
  +      return "class " + name;
     }
  -  
  -  /** Convenience for writing to, eg, System.out */
  -  public void toSource(java.io.OutputStream out,int depth)
  -  {
  -    java.io.PrintWriter writer=new java.io.PrintWriter(out);
  -    toSource(writer,depth);
  -  }
  -  
  -  /**
  -    Converts the object to a Java code stream. The string
  -    representation is as full a Java definition of the class
  -    as we are able to achieve. If this Class
  -    object represents a primitive type, returns the
  -    name of the primitive type.
  -    */
  -  public void toSource(java.io.PrintWriter out,int depth)
  +
  +  /**
  +   * Convenience for writing to, eg, System.out 
  +   *
  +   * NEEDSDOC @param out
  +   * NEEDSDOC @param depth
  +   */
  +  public void toSource(java.io.OutputStream out, int depth)
     {
  -    String tab=tabset(depth);
  -    
  +
  +    java.io.PrintWriter writer = new java.io.PrintWriter(out);
  +
  +    toSource(writer, depth);
  +  }
  +
  +  /**
  +   * Converts the object to a Java code stream. The string
  +   * representation is as full a Java definition of the class
  +   * as we are able to achieve. If this Class
  +   * object represents a primitive type, returns the
  +   * name of the primitive type.
  +   *
  +   * NEEDSDOC @param out
  +   * NEEDSDOC @param depth
  +   */
  +  public void toSource(java.io.PrintWriter out, int depth)
  +  {
  +
  +    String tab = tabset(depth);
  +
       if (realclass != null)
  -      out.println(tab+"/** Code back-generated from a \"real\" Class; accuracy limited by reflection APIs. */");
  +      out.println(
  +        tab
  +        + "/** Code back-generated from a \"real\" Class; accuracy limited by reflection APIs. */");
       else
  -      out.println(tab+"/** Code generated via org.apache.xalan.utils.synthetic.Class */");
  -    
  +      out.println(
  +        tab
  +        + "/** Code generated via org.apache.xalan.utils.synthetic.Class */");
  +
       /* Package should not be printed for inner classes */
  -    if (getDeclaringClass()==null)
  -        out.println(tab+"package "+getPackageName()+";");
  +    if (getDeclaringClass() == null)
  +      out.println(tab + "package " + getPackageName() + ";");
  +
  +    out.print(tab + Modifier.toString(getModifiers()));
   
  -    out.print(tab+Modifier.toString(getModifiers()));
       if (isInterface())
         out.print(" interface ");
       else
         out.print(" class ");
  +
       out.println(getJavaShortName());
  -    if(superclass!=null)
  +
  +    if (superclass != null)
  +    {
  +      out.print('\n' + tab + " extends " + superclass.getJavaName());
  +    }
  +
  +    Class[] ext = getInterfaces();
  +
  +    if (ext != null & ext.length > 0)
  +    {
  +
  +      // Interfaces extend other interfaces,
  +      // Classes implement interfaces.
  +      out.print('\n' + tab + (isInterface ? " extends " : " implements ")
  +                + ext[0].getName());
  +
  +      for (int i = 1; i < ext.length; ++i)
         {
  -	out.print('\n'+tab+" extends "+superclass.getJavaName());
  +        out.print(", " + ext[i].getJavaName());
         }
  -    Class[] ext=getInterfaces();
  -    if(ext!=null & ext.length>0)
  -      {
  -	// Interfaces extend other interfaces,
  -	// Classes implement interfaces.
  -	out.print('\n'+tab+
  -		  (isInterface ? " extends " : " implements ")+
  -		  ext[0].getName());
  -	for(int i=1;i<ext.length;++i)
  -	  {
  -	    out.print(", "+ext[i].getJavaName());
  -	  }
  -	out.print("\n");
  -      }
  -
  -    out.print(tab+"{\n");
  -    tab=tabset(++depth);
  -    
  +
  +      out.print("\n");
  +    }
  +
  +    out.print(tab + "{\n");
  +
  +    tab = tabset(++depth);
  +
       // Fields--------------------------------
  -    Field[] fields=null;
  +    Field[] fields = null;
  +
       try
  +    {
  +      fields = getDeclaredFields();
  +    }
  +    catch (SecurityException e)
  +    {
  +      out.println(tab + "//SecurityException retrieving fields");
  +    }
  +
  +    if (fields != null)
  +    {
  +      for (int i = 0; i < fields.length; ++i)
  +      {
  +        out.println(tab + fields[i].toSource());
  +      }
  +    }
  +
  +    // Constructors--------------------------
  +    Constructor[] ctors = null;
  +
  +    try
  +    {
  +      ctors = getDeclaredConstructors();
  +    }
  +    catch (SecurityException e)
  +    {
  +      out.println(tab + "//SecurityException retrieving ctors");
  +    }
  +
  +    if (ctors != null)
  +    {
  +      for (int i = 0; i < ctors.length; ++i)
  +      {
  +        out.print(ctors[i].toSource(tab));
  +      }
  +    }
  +
  +    // Methods-------------------------------
  +    Method[] methods = null;
  +
  +    try
  +    {
  +      methods = getDeclaredMethods();
  +    }
  +    catch (SecurityException e)
  +    {
  +      out.println(tab + "//SecurityException retrieving methods");
  +    }
  +
  +    if (methods != null)
  +    {
  +      for (int i = 0; i < methods.length; ++i)
  +      {
  +        out.print('\n');
  +        out.print(methods[i].toSource(tab));
  +      }
  +    }
  +
  +    // Inner classes --------------------------------
  +    Class[] inners = getInnerClasses();
  +
  +    if (inners != null)
  +    {
  +      for (int i = 0; i < inners.length; ++i)
         {
  -	fields=getDeclaredFields();
  -      } catch(SecurityException e)
  -	{ out.println(tab+"//SecurityException retrieving fields"); }
  -      if(fields!=null)
  -	{
  -	  for(int i=0;i<fields.length;++i)
  -	    out.println(tab+fields[i].toSource());
  -	}
  -      
  -      // Constructors--------------------------
  -      Constructor[] ctors=null;
  -      try
  -	{
  -	  ctors=getDeclaredConstructors();
  -	} catch(SecurityException e)
  -	  { out.println(tab+"//SecurityException retrieving ctors"); }
  -	if(ctors!=null)
  -	  {
  -	    for(int i=0;i<ctors.length;++i)
  -	      out.print(ctors[i].toSource(tab));
  -	  }
  -	
  -	// Methods-------------------------------
  -	Method[] methods=null;
  -	try
  -	  {
  -	    methods=getDeclaredMethods();
  -	  } catch(SecurityException e)
  -	    { out.println(tab+"//SecurityException retrieving methods"); }
  -	  if(methods!=null)
  -	    {
  -	      for(int i=0;i<methods.length;++i)
  -	      {
  -    	    out.print('\n');
  -	    	out.print(methods[i].toSource(tab));
  -	      }
  -	    }
  -	  
  -	  // Inner classes --------------------------------
  -	  Class[] inners=getInnerClasses();
  -	  if(inners!=null)
  -	  {
  -	      for(int i=0;i<inners.length;++i)
  -	      {
  -    	    out.print('\n');
  -	    	inners[i].toSource(out,depth);
  -	      }
  -	  }
  -	  
  -	  // Done------------------------------
  -	  tab=tabset(--depth);
  -	  out.print(tab+"}\n");
  -	  out.flush();
  +        out.print('\n');
  +        inners[i].toSource(out, depth);
  +      }
  +    }
  +
  +    // Done------------------------------
  +    tab = tabset(--depth);
  +
  +    out.print(tab + "}\n");
  +    out.flush();
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method tabset 
  +   *
  +   *
  +   * NEEDSDOC @param depth
  +   *
  +   * NEEDSDOC (tabset) @return
  +   */
     private String tabset(int depth)
     {
  -    StringBuffer t=new StringBuffer();
  -    while(depth-- >0)
  +
  +    StringBuffer t = new StringBuffer();
  +
  +    while (depth-- > 0)
  +    {
         t.append("    ");
  +    }
  +
       return t.toString();
     }
   
     // Ignores any keywords we don't recognize
  -  static final int[] val=
  -    {Modifier.ABSTRACT,Modifier.FINAL,Modifier.INTERFACE,
  -    Modifier.NATIVE,Modifier.PRIVATE,Modifier.PROTECTED,
  -    Modifier.PUBLIC,Modifier.STATIC,Modifier.SYNCHRONIZED,
  -    Modifier.TRANSIENT,Modifier.VOLATILE};
  -  static final String[] kwd=
  -    {"abstract","final","interface",
  -    "native","private","protected",
  -    "public","static","synchronized",
  -    "transient","volatile"};
  +
  +  /** NEEDSDOC Field val          */
  +  static final int[] val = { Modifier.ABSTRACT, Modifier.FINAL,
  +                             Modifier.INTERFACE, Modifier.NATIVE,
  +                             Modifier.PRIVATE, Modifier.PROTECTED,
  +                             Modifier.PUBLIC, Modifier.STATIC,
  +                             Modifier.SYNCHRONIZED, Modifier.TRANSIENT,
  +                             Modifier.VOLATILE };
  +
  +  /** NEEDSDOC Field kwd          */
  +  static final String[] kwd = { "abstract", "final", "interface", "native",
  +                                "private", "protected", "public", "static",
  +                                "synchronized", "transient", "volatile" };
  +
  +  /**
  +   * NEEDSDOC Method modifierFromString 
  +   *
  +   *
  +   * NEEDSDOC @param t
  +   *
  +   * NEEDSDOC (modifierFromString) @return
  +   */
     static public int modifierFromString(String t)
     {
  -        for(int i=0;i<kwd.length;++i)
  -            if(kwd[i].equals(t))
  -                return val[i];
  -        return 0;
  +
  +    for (int i = 0; i < kwd.length; ++i)
  +    {
  +      if (kwd[i].equals(t))
  +        return val[i];
  +    }
  +
  +    return 0;
     }
  +
  +  /**
  +   * NEEDSDOC Method modifiersFromString 
  +   *
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC (modifiersFromString) @return
  +   */
     static public int modifiersFromString(String s)
     {
  -    int mods=0;
  -    java.util.StringTokenizer parts=new java.util.StringTokenizer(s);
  -    while(parts.hasMoreTokens())
  +
  +    int mods = 0;
  +    java.util.StringTokenizer parts = new java.util.StringTokenizer(s);
  +
  +    while (parts.hasMoreTokens())
       {
  -        String t=parts.nextToken();
  -        mods|=modifierFromString(t);
  +      String t = parts.nextToken();
  +
  +      mods |= modifierFromString(t);
       }
  +
       return mods;
     }
   }
  
  
  
  1.2       +74 -35    xml-xalan/java/src/org/apache/xalan/utils/synthetic/SynthesisException.java
  
  Index: SynthesisException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/SynthesisException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SynthesisException.java	2000/10/13 02:33:14	1.1
  +++ SynthesisException.java	2000/10/30 18:57:55	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,43 +52,82 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   package org.apache.xalan.utils.synthetic;
   
  -public class SynthesisException
  -extends Exception
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class SynthesisException <needs-comment/>
  + */
  +public class SynthesisException extends Exception
   {
  -    int code;
  -    
  -    // Manefest constants
  -    public static final int SYNTAX=0;
  -    public static final int UNSUPPORTED=1;
  -    public static final int REIFIED=2;
  -    public static final int UNREIFIED=3;
  -    public static final int WRONG_OWNER=4;
  -    public static final String[] errToString = 
  -    { 
  -        "(Syntax error; specific message should be passed in)",
  -        "Feature not yet supported",
  -        "Can't change features of 'real' class",
  -        "Can't yet instantiate/invoke without 'real' class",
  -        "Can't add Member to an object other than its declarer",
  -    };
  -    
  -    
  -    public SynthesisException(int code)
  -    {
  -        super(errToString[code]);
  -        this.code=code;
  -    }
  -    
  -    public SynthesisException(int code, String msg)
  -    {
  -        super(msg);
  -        this.code=code;
  -    }
  +
  +  /** NEEDSDOC Field code          */
  +  int code;
  +
  +  // Manefest constants
  +
  +  /** NEEDSDOC Field SYNTAX          */
  +  public static final int SYNTAX = 0;
  +
  +  /** NEEDSDOC Field UNSUPPORTED          */
  +  public static final int UNSUPPORTED = 1;
  +
  +  /** NEEDSDOC Field REIFIED          */
  +  public static final int REIFIED = 2;
  +
  +  /** NEEDSDOC Field UNREIFIED          */
  +  public static final int UNREIFIED = 3;
  +
  +  /** NEEDSDOC Field WRONG_OWNER          */
  +  public static final int WRONG_OWNER = 4;
  +
  +  /** NEEDSDOC Field errToString          */
  +  public static final String[] errToString = {
  +    "(Syntax error; specific message should be passed in)",
  +    "Feature not yet supported",
  +    "Can't change features of 'real' class",
  +    "Can't yet instantiate/invoke without 'real' class",
  +    "Can't add Member to an object other than its declarer", };
  +
  +  /**
  +   * Constructor SynthesisException
  +   *
  +   *
  +   * NEEDSDOC @param code
  +   */
  +  public SynthesisException(int code)
  +  {
  +
  +    super(errToString[code]);
  +
  +    this.code = code;
  +  }
  +
  +  /**
  +   * Constructor SynthesisException
  +   *
  +   *
  +   * NEEDSDOC @param code
  +   * NEEDSDOC @param msg
  +   */
  +  public SynthesisException(int code, String msg)
  +  {
  +
  +    super(msg);
  +
  +    this.code = code;
  +  }
   
  -    int getCode() {return code;}
  -    
  +  /**
  +   * NEEDSDOC Method getCode 
  +   *
  +   *
  +   * NEEDSDOC (getCode) @return
  +   */
  +  int getCode()
  +  {
  +    return code;
  +  }
   }
  
  
  
  1.2       +140 -83   xml-xalan/java/src/org/apache/xalan/utils/synthetic/TestDriver.java
  
  Index: TestDriver.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/TestDriver.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TestDriver.java	2000/10/13 02:33:14	1.1
  +++ TestDriver.java	2000/10/30 18:57:55	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,95 +52,152 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   
  -/** Test driver for org.apache.xalan.utils.synthetic.Class and org.apache.xalan.utils.synthetic.reflection.*
  -    <p>
  -    toSource should probably be factored out into a separate
  -    java generator class, so we could generate other languages as well.
  -*/
  -
  +/**
  + * Test driver for org.apache.xalan.utils.synthetic.Class and org.apache.xalan.utils.synthetic.reflection.
  + *   <p>
  + *   toSource should probably be factored out into a separate
  + *   java generator class, so we could generate other languages as well.
  + */
   package org.apache.xalan.utils.synthetic;
  +
   import org.apache.xalan.utils.synthetic.Class;
   import org.apache.xalan.utils.synthetic.reflection.*;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class TestDriver <needs-comment/>
  + */
   public class TestDriver
   {
  -    public static int sampleField=32;
  -    private boolean inTest=false;
  -    
  -    public static void main(String[] args)
  -    {
  -        // Proxy a class
  -        try
  -        {
  -            System.out.println("Proxying java.awt.Frame...");
  -            Class myC=Class.forName("java.awt.Frame");
  -            myC.toSource(System.out,0);
  -            System.out.println("\nProxying org.apache.xalan.utils.synthetic.TestDriver...");
  -            myC=Class.forName("com.ibm.org.apache.xalan.utils.synthetic.TestDriver");
  -            myC.toSource(System.out,0);
  -        }
  -        catch(ClassNotFoundException e)
  -        {
  -            System.out.println("Couldn't proxy: ");
  -            e.printStackTrace();
  -        }
  -
  -        
  -        // Start getting serious
  -        try
  -        {
  -            System.out.println("\nBuild a new beast...");
  -            Class myC=Class.declareClass("com.ibm.org.apache.xalan.utils.synthetic.BuildMe");
  -            Class inner=myC.declareInnerClass("island");
  -            inner.addExtends(Class.forName("java.lang.String"));
  -            Method m=inner.declareMethod("getValue");
  -            m.setReturnType(Class.forName("java.lang.String"));
  -            m.getBody().append("return toString();");
  -            myC.toSource(System.out,0);
  -        }
  -        catch(ClassNotFoundException e)
  -        {
  -            e.printStackTrace();
  -        }
  -        catch(SynthesisException e)
  -        {
  -            e.printStackTrace();
  -        }
  -        catch(IllegalStateException e)
  -        {
  -            System.out.println("Unwritten function: "+e);
  -            e.printStackTrace();
  -        }
  -    }
  -
  -    public static void dumpClass(Class C)
  -    {
  -        System.out.println("toString(): "+C);
  -        System.out.println("\tisPrimitive(): "+C.isPrimitive());
  -        System.out.println("\tisInterface(): "+C.isInterface());
  -        System.out.println("\tisInstance(\"foo\"): "+C.isInstance("foo"));
  -        System.out.println("\tisArray(): "+C.isArray());
  -        System.out.println("\tgetRealClass(): "+C.getRealClass());
  -    }
  -
  -    public void quickcheck()
  -    {
  -        Inner a=new Inner();
  -        a.setTest(!a.getTest());
  -    }
  -    private class Inner
  -    {
  -        public boolean getTest()
  -        {
  -            return inTest;
  -        }
  -        public void setTest(boolean test)
  -        {
  -            inTest=test;
  -        }
  +
  +  /** NEEDSDOC Field sampleField          */
  +  public static int sampleField = 32;
  +
  +  /** NEEDSDOC Field inTest          */
  +  private boolean inTest = false;
  +
  +  /**
  +   * NEEDSDOC Method main 
  +   *
  +   *
  +   * NEEDSDOC @param args
  +   */
  +  public static void main(String[] args)
  +  {
  +
  +    // Proxy a class
  +    try
  +    {
  +      System.out.println("Proxying java.awt.Frame...");
  +
  +      Class myC = Class.forName("java.awt.Frame");
  +
  +      myC.toSource(System.out, 0);
  +      System.out.println(
  +        "\nProxying org.apache.xalan.utils.synthetic.TestDriver...");
  +
  +      myC =
  +        Class.forName("com.ibm.org.apache.xalan.utils.synthetic.TestDriver");
  +
  +      myC.toSource(System.out, 0);
  +    }
  +    catch (ClassNotFoundException e)
  +    {
  +      System.out.println("Couldn't proxy: ");
  +      e.printStackTrace();
  +    }
  +
  +    // Start getting serious
  +    try
  +    {
  +      System.out.println("\nBuild a new beast...");
  +
  +      Class myC = Class.declareClass(
  +        "com.ibm.org.apache.xalan.utils.synthetic.BuildMe");
  +      Class inner = myC.declareInnerClass("island");
  +
  +      inner.addExtends(Class.forName("java.lang.String"));
  +
  +      Method m = inner.declareMethod("getValue");
  +
  +      m.setReturnType(Class.forName("java.lang.String"));
  +      m.getBody().append("return toString();");
  +      myC.toSource(System.out, 0);
  +    }
  +    catch (ClassNotFoundException e)
  +    {
  +      e.printStackTrace();
  +    }
  +    catch (SynthesisException e)
  +    {
  +      e.printStackTrace();
  +    }
  +    catch (IllegalStateException e)
  +    {
  +      System.out.println("Unwritten function: " + e);
  +      e.printStackTrace();
  +    }
  +  }
  +
  +  /**
  +   * NEEDSDOC Method dumpClass 
  +   *
  +   *
  +   * NEEDSDOC @param C
  +   */
  +  public static void dumpClass(Class C)
  +  {
  +
  +    System.out.println("toString(): " + C);
  +    System.out.println("\tisPrimitive(): " + C.isPrimitive());
  +    System.out.println("\tisInterface(): " + C.isInterface());
  +    System.out.println("\tisInstance(\"foo\"): " + C.isInstance("foo"));
  +    System.out.println("\tisArray(): " + C.isArray());
  +    System.out.println("\tgetRealClass(): " + C.getRealClass());
  +  }
  +
  +  /**
  +   * NEEDSDOC Method quickcheck 
  +   *
  +   */
  +  public void quickcheck()
  +  {
  +
  +    Inner a = new Inner();
  +
  +    a.setTest(!a.getTest());
  +  }
  +
  +  /**
  +   * <meta name="usage" content="internal"/>
  +   * NEEDSDOC Class Inner <needs-comment/>
  +   */
  +  private class Inner
  +  {
  +
  +    /**
  +     * NEEDSDOC Method getTest 
  +     *
  +     *
  +     * NEEDSDOC (getTest) @return
  +     */
  +    public boolean getTest()
  +    {
  +      return inTest;
  +    }
  +
  +    /**
  +     * NEEDSDOC Method setTest 
  +     *
  +     *
  +     * NEEDSDOC @param test
  +     */
  +    public void setTest(boolean test)
  +    {
  +      inTest = test;
       }
  -    
  +  }
   }
  
  
  
  1.2       +143 -114  xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Constructor.java
  
  Index: Constructor.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Constructor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Constructor.java	2000/10/13 02:33:15	1.1
  +++ Constructor.java	2000/10/30 18:57:58	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,168 +52,197 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   package org.apache.xalan.utils.synthetic.reflection;
   
   import java.lang.reflect.InvocationTargetException;
  +
   import org.apache.xalan.utils.synthetic.SynthesisException;
   
   /**
  -  Constructor provides information about, and access to, a
  -  single constructor for a class. 
  -  
  -  Constructor permits widening conversions to occur when
  -  matching the actual parameters to newInstance() with
  -  the underlying constructor's formal parameters, but
  -  throws an IllegalArgumentException if a narrowing
  -  conversion would occur. 
  -
  -  @see Member  
  -  @see Class  
  -  @see getConstructors  
  -  @see getConstructor  
  -  @see getDeclaredConstructors 
  -  */
  -public class Constructor 
  -extends EntryPoint
  -implements Member 
  + * Constructor provides information about, and access to, a
  + * single constructor for a class.
  + *
  + * Constructor permits widening conversions to occur when
  + * matching the actual parameters to newInstance() with
  + * the underlying constructor's formal parameters, but
  + * throws an IllegalArgumentException if a narrowing
  + * conversion would occur.
  + *
  + * @see Member
  + * @see Class
  + * @see getConstructors
  + * @see getConstructor
  + * @see getDeclaredConstructors
  + */
  +public class Constructor extends EntryPoint implements Member
   {
  +
     /**
  -    Actual Java class object. When present, all interactions
  -    are redirected to it. Allows our Class to function as a
  -    wrapper for the Java version (in lieu of subclassing or
  -    a shared Interface), and allows "in-place compilation"
  -    to replace a generated description with an
  -    directly runnable class.
  -    */
  +   * Actual Java class object. When present, all interactions
  +   * are redirected to it. Allows our Class to function as a
  +   * wrapper for the Java version (in lieu of subclassing or
  +   * a shared Interface), and allows "in-place compilation"
  +   * to replace a generated description with an
  +   * directly runnable class.
  +   */
     private org.apache.xalan.utils.synthetic.Class declaringclass = null;
  +
  +  /** NEEDSDOC Field realconstructor          */
     private java.lang.reflect.Constructor realconstructor = null;
  -  
  +
  +  /** NEEDSDOC Field parametertypes          */
     private org.apache.xalan.utils.synthetic.Class[] parametertypes;
  +
  +  /** NEEDSDOC Field parameternames          */
     private String[] parameternames;
  +
  +  /** NEEDSDOC Field exceptiontypes          */
     private org.apache.xalan.utils.synthetic.Class[] exceptiontypes;
  +
  +  /** NEEDSDOC Field modifiers          */
     private int modifiers;
  +
     /**
      * Insert the method's description here.
      * <p>
      * Creation date: (12-27-99 2:31:39 PM)
      * @param realConstructor java.lang.reflect.Constructor
  +   *
  +   * NEEDSDOC @param declaringclass
      */
     public Constructor(org.apache.xalan.utils.synthetic.Class declaringclass)
     {
       super(declaringclass);
     }
  +
     /**
      * Insert the method's description here.
      * <p>
      * Creation date: (12-27-99 2:31:39 PM)
      * @param realConstructor java.lang.reflect.Constructor
  +   *
  +   * NEEDSDOC @param ctor
  +   * NEEDSDOC @param declaringclass
      */
  -  public Constructor(java.lang.reflect.Constructor ctor,org.apache.xalan.utils.synthetic.Class declaringclass)
  +  public Constructor(java.lang.reflect.Constructor ctor,
  +                     org.apache.xalan.utils.synthetic.Class declaringclass)
     {
  -    super(ctor,declaringclass);
  +    super(ctor, declaringclass);
     }
  +
     /**
      * Insert the method's description here.
      * <p>
      * Creation date: (12-27-99 2:31:39 PM)
      * @param realConstructor java.lang.reflect.Constructor
  +   *
  +   * NEEDSDOC @param realconstructor
      */
     public Constructor(java.lang.reflect.Constructor realconstructor)
     {
       super(realconstructor);
     }
  +
     /**
  -    Returns a hashcode for this Constructor. The
  -    hashcode is the same as the hashcode for the
  -    underlying constructor's declaring class name. 
  -    */
  +   * Returns a hashcode for this Constructor. The
  +   * hashcode is the same as the hashcode for the
  +   * underlying constructor's declaring class name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public int hashCode()
     {
       return getDeclaringClass().getName().hashCode();
     }
  -  
  +
     /**
  -    Uses the constructor represented by this
  -    Constructor object to create and initialize a new
  -    instance of the constructor's declaring class, with
  -    the specified initialization parameters. Individual
  -    parameters are automatically unwrapped to match
  -    primitive formal parameters, and both primitive
  -    and reference parameters are subject to widening
  -    conversions as necessary. Returns the newly
  -    created and initialized object. 
  -    <p>
  -    Creation proceeds with the following steps, in
  -    order: 
  -    <p>
  -    If the class that declares the underlying constructor
  -    represents an abstract class, the creation throws an
  -    InstantiationException. 
  -    <p>
  -    If this Constructor object enforces Java language
  -    access control and the underlying constructor is
  -    inaccessible, the creation throws an
  -    IllegalAccessException. 
  -    <p>
  -    If the number of actual parameters supplied via
  -    initargs is different from the number of formal
  -    parameters required by the underlying constructor,
  -    the creation throws an IllegalArgumentException. 
  -    <p>
  -    A new instance of the constructor's declaring class
  -    is created, and its fields are initialized to their
  -    default initial values. 
  -    <p>
  -    For each actual parameter in the supplied initargs
  -    array: 
  -    <p>
  -    If the corresponding formal parameter has a
  -    primitive type, an unwrapping conversion is
  -    attempted to convert the object value to a value of
  -    the primitive type. If this attempt fails, the
  -    creation throws an IllegalArgumentException. 
  -    <p>
  -    
  -    If, after possible unwrapping, the parameter value
  -    cannot be converted to the corresponding formal
  -    parameter type by an identity or widening
  -    conversion, the creation throws an
  -    IllegalArgumentException. 
  -    <p>
  -    Control transfers to the underlying constructor to
  -    initialize the new instance. If the constructor
  -    completes abruptly by throwing an exception, the
  -    exception is placed in an
  -    InvocationTargetException and thrown in turn to
  -    the caller of newInstance. 
  -    <p>
  -    If the constructor completes normally, returns the
  -    newly created and initialized instance. 
  -    
  -    @throws  IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws  IllegalArgumentException 
  -    if the number of actual and formal
  -    parameters differ, or if an unwrapping
  -    conversion fails. 
  -    @throws  InstantiationException 
  -    if the class that declares the underlying
  -    constructor represents an abstract class. 
  -    @throws  InvocationTargetException 
  -    if the underlying constructor throws an
  -    exception. 
  -    */
  -  public Object newInstance(Object initargs[]) 
  -       throws InstantiationException, IllegalAccessException,
  -	 IllegalArgumentException,
  -	 java.lang.reflect.InvocationTargetException
  +   * Uses the constructor represented by this
  +   * Constructor object to create and initialize a new
  +   * instance of the constructor's declaring class, with
  +   * the specified initialization parameters. Individual
  +   * parameters are automatically unwrapped to match
  +   * primitive formal parameters, and both primitive
  +   * and reference parameters are subject to widening
  +   * conversions as necessary. Returns the newly
  +   * created and initialized object.
  +   * <p>
  +   * Creation proceeds with the following steps, in
  +   * order:
  +   * <p>
  +   * If the class that declares the underlying constructor
  +   * represents an abstract class, the creation throws an
  +   * InstantiationException.
  +   * <p>
  +   * If this Constructor object enforces Java language
  +   * access control and the underlying constructor is
  +   * inaccessible, the creation throws an
  +   * IllegalAccessException.
  +   * <p>
  +   * If the number of actual parameters supplied via
  +   * initargs is different from the number of formal
  +   * parameters required by the underlying constructor,
  +   * the creation throws an IllegalArgumentException.
  +   * <p>
  +   * A new instance of the constructor's declaring class
  +   * is created, and its fields are initialized to their
  +   * default initial values.
  +   * <p>
  +   * For each actual parameter in the supplied initargs
  +   * array:
  +   * <p>
  +   * If the corresponding formal parameter has a
  +   * primitive type, an unwrapping conversion is
  +   * attempted to convert the object value to a value of
  +   * the primitive type. If this attempt fails, the
  +   * creation throws an IllegalArgumentException.
  +   * <p>
  +   *
  +   * If, after possible unwrapping, the parameter value
  +   * cannot be converted to the corresponding formal
  +   * parameter type by an identity or widening
  +   * conversion, the creation throws an
  +   * IllegalArgumentException.
  +   * <p>
  +   * Control transfers to the underlying constructor to
  +   * initialize the new instance. If the constructor
  +   * completes abruptly by throwing an exception, the
  +   * exception is placed in an
  +   * InvocationTargetException and thrown in turn to
  +   * the caller of newInstance.
  +   * <p>
  +   * If the constructor completes normally, returns the
  +   * newly created and initialized instance.
  +   *
  +   *
  +   * NEEDSDOC @param initargs
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws  IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws  IllegalArgumentException
  +   * if the number of actual and formal
  +   * parameters differ, or if an unwrapping
  +   * conversion fails.
  +   * @throws  InstantiationException
  +   * if the class that declares the underlying
  +   * constructor represents an abstract class.
  +   * @throws  InvocationTargetException
  +   * if the underlying constructor throws an
  +   * exception.
  +   * @throws java.lang.reflect.InvocationTargetException
  +   */
  +  public Object newInstance(Object initargs[])
  +          throws InstantiationException, IllegalAccessException,
  +                 IllegalArgumentException,
  +                 java.lang.reflect.InvocationTargetException
     {
  -    if(realep!=null)
  -      return ((java.lang.reflect.Constructor)realep).newInstance(initargs);
  -    else    
  -      throw new InstantiationException("Un-reified org.apache.xalan.utils.synthetic.Class doesn't yet support invocation");
  +
  +    if (realep != null)
  +      return ((java.lang.reflect.Constructor) realep).newInstance(initargs);
  +    else
  +      throw new InstantiationException(
  +        "Un-reified org.apache.xalan.utils.synthetic.Class doesn't yet support invocation");
     }
  -  
   }
  
  
  
  1.2       +475 -294  xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/EntryPoint.java
  
  Index: EntryPoint.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/EntryPoint.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EntryPoint.java	2000/10/13 02:33:15	1.1
  +++ EntryPoint.java	2000/10/30 18:57:59	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,433 +52,614 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   package org.apache.xalan.utils.synthetic.reflection;
   
   import java.lang.reflect.InvocationTargetException;
  +
   import org.apache.xalan.utils.synthetic.SynthesisException;
   
  -/***** OPEN ISSUES:
  -    Reflection doesn't tell us about deprecation; if we want
  -    that info, MFC advises mousing our way into the class (ugh).
  -    Should we at least model that for synthetics?
  -*/
  +/**
  + * *** OPEN ISSUES:
  + *   Reflection doesn't tell us about deprecation; if we want
  + *   that info, MFC advises mousing our way into the class (ugh).
  + *   Should we at least model that for synthetics?
  + */
   
   /**
  -  API/behaviors shared between Constructors and Methods.
  -  They're mostly similar, except for what they proxy and
  -  a few specific calls (name, invoke/getInstance).
  -  */
  -abstract public class EntryPoint
  -implements Member 
  + * API/behaviors shared between Constructors and Methods.
  + * They're mostly similar, except for what they proxy and
  + * a few specific calls (name, invoke/getInstance).
  + */
  +abstract public class EntryPoint implements Member
   {
  +
  +  /** NEEDSDOC Field realep          */
     protected Object realep;
  -  
  +
  +  /** NEEDSDOC Field declaringclass          */
     private org.apache.xalan.utils.synthetic.Class declaringclass = null;
  +
  +  /** NEEDSDOC Field returntype          */
     protected org.apache.xalan.utils.synthetic.Class returntype = null;
  -  private String[] parameternames=new String[0];
  -  private org.apache.xalan.utils.synthetic.Class[] parametertypes=new org.apache.xalan.utils.synthetic.Class[0];
  -  private org.apache.xalan.utils.synthetic.Class[] exceptiontypes=new org.apache.xalan.utils.synthetic.Class[0];;
  +
  +  /** NEEDSDOC Field parameternames          */
  +  private String[] parameternames = new String[0];
  +
  +  /** NEEDSDOC Field parametertypes          */
  +  private org.apache.xalan.utils.synthetic.Class[] parametertypes =
  +    new org.apache.xalan.utils.synthetic.Class[0];
  +
  +  /** NEEDSDOC Field exceptiontypes          */
  +  private org.apache.xalan.utils.synthetic.Class[] exceptiontypes =
  +    new org.apache.xalan.utils.synthetic.Class[0];
  +  ;
  +
  +  /** NEEDSDOC Field modifiers          */
     private int modifiers;
  -  protected String name=null; // for Methods
  -  
  +
  +  /** NEEDSDOC Field name          */
  +  protected String name = null;  // for Methods
  +
     // For synthesis:
  -  private StringBuffer body=null;
  -  private String language=null;
  -  
  +
  +  /** NEEDSDOC Field body          */
  +  private StringBuffer body = null;
  +
  +  /** NEEDSDOC Field language          */
  +  private String language = null;
  +
     // For reifying:
  -  Class[] realE,realP;
   
  +  /** NEEDSDOC Field realE, realP          */
  +  Class[] realE, realP;
  +
     /**
      * Insert the method's description here.
      * <p>
      * Creation date: (12-27-99 2:31:39 PM)
      * @param realConstructor java.lang.reflect.Constructor
  +   *
  +   * NEEDSDOC @param declaringclass
      */
     public EntryPoint(org.apache.xalan.utils.synthetic.Class declaringclass)
     {
  -    this.declaringclass=declaringclass;
  +    this.declaringclass = declaringclass;
     }
  -  
  -  /** Nonpublic constructor. Wrap this to appropriate "real" type */
  -  protected EntryPoint(Object ep,org.apache.xalan.utils.synthetic.Class declaringclass) 
  -       throws IllegalArgumentException
  -  {
  -    
  -    realep=ep;
  -    this.declaringclass=declaringclass;
  -    if(ep instanceof java.lang.reflect.Method)
  +
  +  /**
  +   * Nonpublic constructor. Wrap this to appropriate "real" type 
  +   *
  +   * NEEDSDOC @param ep
  +   * NEEDSDOC @param declaringclass
  +   *
  +   * @throws IllegalArgumentException
  +   */
  +  protected EntryPoint(
  +          Object ep, org.apache.xalan.utils.synthetic.Class declaringclass)
  +            throws IllegalArgumentException
  +  {
  +
  +    realep = ep;
  +    this.declaringclass = declaringclass;
  +
  +    if (ep instanceof java.lang.reflect.Method)
  +    {
  +      java.lang.reflect.Method m = (java.lang.reflect.Method) ep;
  +
  +      if (declaringclass == null)
         {
  -        java.lang.reflect.Method m=(java.lang.reflect.Method)ep;
  -        if(declaringclass==null)
  -	  {
  -            declaringclass=org.apache.xalan.utils.synthetic.Class.forClass(m.getDeclaringClass());
  -	  }
  -	name=m.getName();
  -	modifiers=m.getModifiers();
  -	returntype=org.apache.xalan.utils.synthetic.Class.forClass(m.getReturnType());
  -	realP=m.getParameterTypes();
  -	realE=m.getExceptionTypes();
  +        declaringclass = org.apache.xalan.utils.synthetic.Class.forClass(
  +          m.getDeclaringClass());
         }
  -    else if(ep instanceof java.lang.reflect.Constructor)
  +
  +      name = m.getName();
  +      modifiers = m.getModifiers();
  +      returntype =
  +        org.apache.xalan.utils.synthetic.Class.forClass(m.getReturnType());
  +      realP = m.getParameterTypes();
  +      realE = m.getExceptionTypes();
  +    }
  +    else if (ep instanceof java.lang.reflect.Constructor)
  +    {
  +      java.lang.reflect.Constructor c = (java.lang.reflect.Constructor) ep;
  +
  +      if (declaringclass == null)
         {
  -        java.lang.reflect.Constructor c=(java.lang.reflect.Constructor)ep;
  -        if(declaringclass==null)
  -	  {
  -            declaringclass=org.apache.xalan.utils.synthetic.Class.forClass(c.getDeclaringClass());
  -	  }
  -	name=declaringclass.getShortName();
  -	modifiers=c.getModifiers();
  -	returntype=declaringclass;
  -	realP=c.getParameterTypes();
  -	realE=c.getExceptionTypes();
  +        declaringclass = org.apache.xalan.utils.synthetic.Class.forClass(
  +          c.getDeclaringClass());
         }
  +
  +      name = declaringclass.getShortName();
  +      modifiers = c.getModifiers();
  +      returntype = declaringclass;
  +      realP = c.getParameterTypes();
  +      realE = c.getExceptionTypes();
  +    }
       else
         throw new IllegalArgumentException();
     }
  -  
  -  /** Nonpublic constructor. Wrap this to appropriate "real" type */
  -  protected EntryPoint(Object ep) 
  -       throws IllegalArgumentException
  -  {
  -    this(ep,null);
  -  }
  -  
  -  /**
  -    Compares this against the specified
  -    object. Returns true if the objects are the same.
  -    Two EntryPoints are the same if they were
  -    declared by the same class, have the same name
  -    (or are both ctors) and have the same
  -    formal parameter types. 
  -    */
  +
  +  /**
  +   * Nonpublic constructor. Wrap this to appropriate "real" type 
  +   *
  +   * NEEDSDOC @param ep
  +   *
  +   * @throws IllegalArgumentException
  +   */
  +  protected EntryPoint(Object ep) throws IllegalArgumentException
  +  {
  +    this(ep, null);
  +  }
  +
  +  /**
  +   * Compares this against the specified
  +   * object. Returns true if the objects are the same.
  +   * Two EntryPoints are the same if they were
  +   * declared by the same class, have the same name
  +   * (or are both ctors) and have the same
  +   * formal parameter types.
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public boolean equals(Object obj)
     {
  -    EntryPoint otherep=null;
  +
  +    EntryPoint otherep = null;
  +
       if (obj instanceof EntryPoint)
  -      otherep=(EntryPoint)obj;
  -    else if (obj instanceof java.lang.reflect.Constructor ||
  -	     obj instanceof java.lang.reflect.Method)
  -      otherep = (EntryPoint)obj;
  -    
  -    return (otherep!=null 
  -	    && ((this instanceof Constructor && otherep instanceof Constructor)
  -		||
  -		(this instanceof Method && otherep instanceof Method &&
  -		 this.getName().equals(otherep.getName()) ))
  -	    && otherep.getDeclaringClass().equals(declaringclass) 
  -	    && otherep.getParameterTypes().equals(parametertypes));
  -  }
  -  
  -  /**
  -    Returns the Class object representing the class that
  -    declares the constructor represented by this
  -    Constructor object. 
  -    */
  +      otherep = (EntryPoint) obj;
  +    else if (obj instanceof java.lang.reflect.Constructor
  +             || obj instanceof java.lang.reflect.Method)
  +      otherep = (EntryPoint) obj;
  +
  +    return (otherep != null && ((this instanceof Constructor && otherep instanceof Constructor) || (this instanceof Method && otherep instanceof Method && this.getName().equals(
  +      otherep.getName()))) && otherep.getDeclaringClass().equals(
  +        declaringclass) && otherep.getParameterTypes().equals(
  +        parametertypes));
  +  }
  +
  +  /**
  +   * Returns the Class object representing the class that
  +   * declares the constructor represented by this
  +   * Constructor object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public org.apache.xalan.utils.synthetic.Class getDeclaringClass()
     {
       return declaringclass;
     }
  -  
  +
     /**
  -    Returns the Class object representing the class that
  -    will be returned by this EntryPoint. Needed by the Method
  -    API, but made meaningful for Constructors as well.
  -    */
  +   * Returns the Class object representing the class that
  +   * will be returned by this EntryPoint. Needed by the Method
  +   * API, but made meaningful for Constructors as well.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public org.apache.xalan.utils.synthetic.Class getReturnType()
     {
       return returntype;
     }
  -  
  +
     /**
  -    Returns an array of Class objects that represent the
  -    types of the checked exceptions thrown by the
  -    underlying constructor represented by this
  -    Constructor object. Returns an array of length 0 if
  -    the constructor throws no checked exceptions. 
  -    */
  +   * Returns an array of Class objects that represent the
  +   * types of the checked exceptions thrown by the
  +   * underlying constructor represented by this
  +   * Constructor object. Returns an array of length 0 if
  +   * the constructor throws no checked exceptions.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public org.apache.xalan.utils.synthetic.Class[] getExceptionTypes()
     {
  -    if(realep!=null && exceptiontypes==null)
  +
  +    if (realep != null && exceptiontypes == null)
  +    {
  +      exceptiontypes =
  +        new org.apache.xalan.utils.synthetic.Class[realE.length];
  +
  +      for (int i = 0; i < realE.length; ++i)
         {
  -	exceptiontypes=new org.apache.xalan.utils.synthetic.Class[realE.length];
  -	for(int i=0;i<realE.length;++i)
  -	  exceptiontypes[i]=org.apache.xalan.utils.synthetic.Class.forClass(realE[i]);
  -	realE=null;
  +        exceptiontypes[i] =
  +          org.apache.xalan.utils.synthetic.Class.forClass(realE[i]);
         }
   
  +      realE = null;
  +    }
  +
       return exceptiontypes;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method addExceptionType 
  +   *
  +   *
  +   * NEEDSDOC @param exception
  +   *
  +   * @throws SynthesisException
  +   */
  +  public void addExceptionType(
  +          org.apache.xalan.utils.synthetic.Class exception)
  +            throws SynthesisException
  +  {
  +
  +    if (realep != null)
  +      throw new SynthesisException(SynthesisException.REIFIED);
  +
  +    org.apache.xalan.utils.synthetic.Class[] e =
  +      new org.apache.xalan.utils.synthetic.Class[exceptiontypes.length + 1];
  +
  +    System.arraycopy(exceptiontypes, 0, e, 0, exceptiontypes.length);
  +
  +    e[exceptiontypes.length] = exception;
  +    exceptiontypes = e;
     }
  -  
  -  public void addExceptionType(org.apache.xalan.utils.synthetic.Class exception)
  -  throws SynthesisException
  -  {
  -    if(realep!=null)
  -        throw new SynthesisException(SynthesisException.REIFIED);
  -        
  -    org.apache.xalan.utils.synthetic.Class[] e=new org.apache.xalan.utils.synthetic.Class[exceptiontypes.length+1];
  -    System.arraycopy(exceptiontypes,0,e,0,exceptiontypes.length);
  -    e[exceptiontypes.length]=exception;
  -	exceptiontypes=e;
  -  }
  -  
  -  /**
  -    Returns the Java language modifiers for the
  -    constructor represented by this Constructor object,
  -    as an integer. The Modifier class should be used to
  -    decode the modifiers. 
  -    
  -    @see 
  -    Modifier 
  -    */
  +
  +  /**
  +   * Returns the Java language modifiers for the
  +   * constructor represented by this Constructor object,
  +   * as an integer. The Modifier class should be used to
  +   * decode the modifiers.
  +   *
  +   * @see
  +   * Modifier
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public int getModifiers()
     {
       return modifiers;
     }
  +
     /**
      * Member method. C'tor's name is always that of the defining class.
      * Methods have a "real" name.
      * Creation date: (12-25-99 1:32:06 PM)
      * @return java.lang.String
      */
  -  public java.lang.String getName() {
  -    if(this instanceof Constructor)
  -        return declaringclass.getShortName();
  +  public java.lang.String getName()
  +  {
  +
  +    if (this instanceof Constructor)
  +      return declaringclass.getShortName();
  +
       return name;
     }
  -  
  +
     /**
      * Member method. C'tor's name is always that of the defining class.
      * Methods have a "real" name.
      * Creation date: (12-25-99 1:32:06 PM)
  +   *
  +   * NEEDSDOC @param name
      * @return java.lang.String
  +   *
  +   * @throws SynthesisException
      */
  -  public void setName(String name) 
  -       throws SynthesisException
  +  public void setName(String name) throws SynthesisException
     {
  -    if(realep!=null)
  +
  +    if (realep != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    
  -    this.name=name;
  +
  +    this.name = name;
     }
  +
     /**
  -    Returns an array of Class objects that represent the
  -    formal parameter types, in declaration order, of the
  -    constructor represented by this Constructor object.
  -    Returns an array of length 0 if the underlying
  -    constructor takes no parameters. 
  -    */
  +   * Returns an array of Class objects that represent the
  +   * formal parameter types, in declaration order, of the
  +   * constructor represented by this Constructor object.
  +   * Returns an array of length 0 if the underlying
  +   * constructor takes no parameters.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public org.apache.xalan.utils.synthetic.Class[] getParameterTypes()
     {
  -    if(realep!=null && parametertypes==null)
  +
  +    if (realep != null && parametertypes == null)
  +    {
  +      parametertypes =
  +        new org.apache.xalan.utils.synthetic.Class[realP.length];
  +
  +      for (int i = 0; i < realP.length; ++i)
         {
  -	    parametertypes=new org.apache.xalan.utils.synthetic.Class[realP.length];
  -	    for(int i=0;i<realP.length;++i)
  -	    parametertypes[i]=org.apache.xalan.utils.synthetic.Class.forClass(realP[i]);
  -	    realP=null;
  +        parametertypes[i] =
  +          org.apache.xalan.utils.synthetic.Class.forClass(realP[i]);
         }
  -  
  +
  +      realP = null;
  +    }
  +
       return parametertypes;
     }
   
  +  /**
  +   * NEEDSDOC Method getParameterNames 
  +   *
  +   *
  +   * NEEDSDOC (getParameterNames) @return
  +   */
     public String[] getParameterNames()
     {
       return parameternames;
     }
  +
  +  /**
  +   * NEEDSDOC Method addParameter 
  +   *
  +   *
  +   * NEEDSDOC @param type
  +   * NEEDSDOC @param name
  +   *
  +   * @throws SynthesisException
  +   */
  +  public void addParameter(
  +          org.apache.xalan.utils.synthetic.Class type, String name)
  +            throws SynthesisException
  +  {
  +
  +    if (realep != null)
  +      throw new SynthesisException(SynthesisException.REIFIED);
  +
  +    org.apache.xalan.utils.synthetic.Class[] types =
  +      new org.apache.xalan.utils.synthetic.Class[parametertypes.length + 1];
  +
  +    System.arraycopy(parametertypes, 0, types, 0, parametertypes.length);
  +
  +    types[parametertypes.length] = type;
  +    parametertypes = types;
  +
  +    String[] names = new String[parameternames.length + 1];
   
  -  
  -  public void addParameter(org.apache.xalan.utils.synthetic.Class type,String name)
  -  throws SynthesisException
  -  {
  -    if(realep!=null)
  -        throw new SynthesisException(SynthesisException.REIFIED);
  -
  -    org.apache.xalan.utils.synthetic.Class[] types=new org.apache.xalan.utils.synthetic.Class[parametertypes.length+1];
  -    System.arraycopy(parametertypes,0,types,0,parametertypes.length);
  -    types[parametertypes.length]=type;
  -    parametertypes=types;
  -    
  -    String[] names=new String[parameternames.length+1];
  -    System.arraycopy(parameternames,0,names,0,parameternames.length);
  -    names[parameternames.length]=name;
  -    parameternames=names;
  -  }
  -  /**
  -    Returns a hashcode for this Constructor. The
  -    hashcode is the same as the hashcode for the
  -    underlying constructor's declaring class name,
  -    xor'ed (for Methods) with the method name.
  -    (Implemented in the subclasses rather than here.)
  -    */
  +    System.arraycopy(parameternames, 0, names, 0, parameternames.length);
  +
  +    names[parameternames.length] = name;
  +    parameternames = names;
  +  }
  +
  +  /**
  +   * Returns a hashcode for this Constructor. The
  +   * hashcode is the same as the hashcode for the
  +   * underlying constructor's declaring class name,
  +   * xor'ed (for Methods) with the method name.
  +   * (Implemented in the subclasses rather than here.)
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     abstract public int hashCode();
  -  
  +
     /**
  -    Assert the Class object representing the class that
  -    declares the constructor represented by this
  -    Constructor object.
  -    */
  -  public void setDeclaringClass(org.apache.xalan.utils.synthetic.Class declaringClass)
  -       throws SynthesisException
  +   * Assert the Class object representing the class that
  +   * declares the constructor represented by this
  +   * Constructor object.
  +   *
  +   * NEEDSDOC @param declaringClass
  +   *
  +   * @throws SynthesisException
  +   */
  +  public void setDeclaringClass(
  +          org.apache.xalan.utils.synthetic.Class declaringClass)
  +            throws SynthesisException
     {
  -    if(realep!=null)
  +
  +    if (realep != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    this.declaringclass=declaringClass;
  +
  +    this.declaringclass = declaringClass;
     }
  +
     /**
  -  ***** Should only be accepted before a "real" entrypoint is bound.
  -  * Creation date: (12-25-99 1:28:28 PM)
  -  * @return int
  -  * @param modifiers int
  -  */
  -  public void setModifiers(int modifiers) 
  -       throws SynthesisException
  +   * Should only be accepted before a "real" entrypoint is bound.
  +   * Creation date: (12-25-99 1:28:28 PM)
  +   * @return int
  +   * @param modifiers int
  +   *
  +   * @throws SynthesisException
  +   */
  +  public void setModifiers(int modifiers) throws SynthesisException
     {
  -    if(realep!=null)
  +
  +    if (realep != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    
  -    this.modifiers=modifiers;
  +
  +    this.modifiers = modifiers;
     }
  +
     /**
  -    Return a string describing this Constructor. The
  -    string is formatted as the constructor access
  -    modifiers, if any, followed by the fully-qualified
  -    name of the declaring class, followed by a
  -    parenthesized, comma-separated list of the
  -    constructor's formal parameter types. For example:
  -    <code>
  -    public java.util.Hashtable(int,float)
  -    </code>
  -    <p>
  -    The only possible modifiers for constructors are
  -    the access modifiers public, protected or
  -    private. Only one of these may appear, or none
  -    if the constructor has default (package) access. 
  -    <p>
  -    Methods will also display their checked exceptions.
  -    */
  +   * Return a string describing this Constructor. The
  +   * string is formatted as the constructor access
  +   * modifiers, if any, followed by the fully-qualified
  +   * name of the declaring class, followed by a
  +   * parenthesized, comma-separated list of the
  +   * constructor's formal parameter types. For example:
  +   * <code>
  +   * public java.util.Hashtable(int,float)
  +   * </code>
  +   * <p>
  +   * The only possible modifiers for constructors are
  +   * the access modifiers public, protected or
  +   * private. Only one of these may appear, or none
  +   * if the constructor has default (package) access.
  +   * <p>
  +   * Methods will also display their checked exceptions.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String toString()
     {
  -    StringBuffer sb=
  +
  +    StringBuffer sb =
         new StringBuffer(java.lang.reflect.Modifier.toString(getModifiers()));
  -    
  -    if(this instanceof org.apache.xalan.utils.synthetic.reflection.Method)	    
  -      sb.append(' ').append(getReturnType())
  -	.append(getDeclaringClass().getName())
  -	.append('.').append(getName());
  +
  +    if (this instanceof org.apache.xalan.utils.synthetic.reflection.Method)
  +      sb.append(' ').append(getReturnType()).append(
  +        getDeclaringClass().getName()).append('.').append(getName());
       else
         sb.append(getDeclaringClass().getName());
  +
       sb.append('(');
  -    org.apache.xalan.utils.synthetic.Class[] p=getParameterTypes();
  -    if(p!=null && p.length>0)
  +
  +    org.apache.xalan.utils.synthetic.Class[] p = getParameterTypes();
  +
  +    if (p != null && p.length > 0)
  +    {
  +      sb.append(p[0].getName());
  +
  +      for (int i = 1; i < p.length; ++i)
         {
  -	sb.append(p[0].getName());
  -	for(int i=1;i<p.length;++i)
  -	  sb.append(',').append(p[i].getName());
  +        sb.append(',').append(p[i].getName());
         }
  +    }
  +
       sb.append(')');
  -    if(this instanceof org.apache.xalan.utils.synthetic.reflection.Method)	    
  +
  +    if (this instanceof org.apache.xalan.utils.synthetic.reflection.Method)
  +    {
  +      p = getExceptionTypes();
  +
  +      if (p != null && p.length > 0)
         {
  -	p=getExceptionTypes();
  -	if(p!=null && p.length>0)
  -	  {
  -	    sb.append(" throws ").append(p[0].getName());
  -	    for(int i=1;i<p.length;++i)
  -	      sb.append(',').append(p[i].getName());
  -	  }
  +        sb.append(" throws ").append(p[0].getName());
  +
  +        for (int i = 1; i < p.length; ++i)
  +        {
  +          sb.append(',').append(p[i].getName());
  +        }
         }
  +    }
  +
       return sb.toString();
     }
  -  
  -  /** Extension: For synthesis, we need a place to hang a
  -    method body.
  -    */
  -  public void setBody(String language,StringBuffer body)
  -       throws SynthesisException
  +
  +  /**
  +   * Extension: For synthesis, we need a place to hang a
  +   * method body.
  +   *
  +   * NEEDSDOC @param language
  +   * NEEDSDOC @param body
  +   *
  +   * @throws SynthesisException
  +   */
  +  public void setBody(String language, StringBuffer body)
  +          throws SynthesisException
     {
  -    if(realep!=null)
  +
  +    if (realep != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    this.language=language;
  -    this.body=body;
  +
  +    this.language = language;
  +    this.body = body;
     }
  -  /** Extension: For synthesis, we need a place to hang a
  -    method body. Note that this returns a mutable object,
  -    for editing etc. Slightly sloppy first cut.
  -    */
  +
  +  /**
  +   * Extension: For synthesis, we need a place to hang a
  +   * method body. Note that this returns a mutable object,
  +   * for editing etc. Slightly sloppy first cut.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public StringBuffer getBody()
     {
  -    if(body==null)
  -        body=new StringBuffer();
  +
  +    if (body == null)
  +      body = new StringBuffer();
  +
       return body;
     }
  -  /** Extension: For synthesis, we need a place to hang a
  -    method body.
  -    */
  +
  +  /**
  +   * Extension: For synthesis, we need a place to hang a
  +   * method body.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getLanguage()
     {
       return language;
     }
  -  
  -  /** Generate Java code
  +
  +  /**
  +   * Generate Java code
  +   *
  +   * NEEDSDOC @param basetab
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String toSource(String basetab)
     {
  -    StringBuffer sb=new StringBuffer();
  -    sb.append(basetab)
  -      .append(java.lang.reflect.Modifier.toString(getModifiers()));
  -    if(this instanceof org.apache.xalan.utils.synthetic.reflection.Method)
  +
  +    StringBuffer sb = new StringBuffer();
  +
  +    sb.append(basetab).append(
  +      java.lang.reflect.Modifier.toString(getModifiers()));
  +
  +    if (this instanceof org.apache.xalan.utils.synthetic.reflection.Method)
       {
  -        if (returntype!=null)
  -          sb.append(" ").append(getReturnType().getJavaName());
  -        else
  -          sb.append(" void");
  +      if (returntype != null)
  +        sb.append(" ").append(getReturnType().getJavaName());
  +      else
  +        sb.append(" void");
       }
  -    sb.append(" ").append(getName())
  -      .append("(");
  -    
  -    org.apache.xalan.utils.synthetic.Class[] types=getParameterTypes();
  -    if(types!=null & types.length>0)
  +
  +    sb.append(" ").append(getName()).append("(");
  +
  +    org.apache.xalan.utils.synthetic.Class[] types = getParameterTypes();
  +
  +    if (types != null & types.length > 0)
  +    {
  +      sb.append(types[0].getJavaName());
  +
  +      if (parameternames != null)
  +        sb.append(' ').append(parameternames[0]);
  +
  +      for (int i = 1; i < types.length; ++i)
         {
  -        sb.append(types[0].getJavaName());
  -        if(parameternames!=null)
  -	  sb.append(' ').append(parameternames[0]);
  -        for(int i=1;i<types.length;++i)
  -	  {
  -            sb.append(',').append(types[i].getJavaName());
  -            if(parameternames!=null)
  -	      sb.append(' ').append(parameternames[i]);
  -	  }
  +        sb.append(',').append(types[i].getJavaName());
  +
  +        if (parameternames != null)
  +          sb.append(' ').append(parameternames[i]);
         }
  +    }
  +
       sb.append(')');
  -    
  -    types=getExceptionTypes();
  -    if(types!=null & types.length>0)
  +
  +    types = getExceptionTypes();
  +
  +    if (types != null & types.length > 0)
  +    {
  +      sb.append(" throws ").append(types[0].getJavaName());
  +
  +      for (int i = 1; i < types.length; ++i)
         {
  -        sb.append(" throws ").append(types[0].getJavaName());
  -        for(int i=1;i<types.length;++i)
  -	  {
  -            sb.append(',').append(types[i].getJavaName());
  -	  }
  +        sb.append(',').append(types[i].getJavaName());
         }
  -    
  -    if(body==null)
  +    }
  +
  +    if (body == null)
         sb.append("; // No method body available\n");
       else
  +    {
  +      sb.append("\n" + basetab + "{\n");
  +
  +      if (language == null || "java".equals(language))
         {
  -        sb.append("\n"+basetab+"{\n");
  -        if(language==null || "java".equals(language))
  -	  {
  -            sb.append(basetab+"// ***** Should prettyprint this code...\n");
  -            sb.append(basetab+body+"\n");
  -	  }
  -        else
  -	  {
  -            sb.append(basetab+"// ***** Generate BSF invocation!?\n");
  -	  }
  -        sb.append(basetab+"}\n");
  -        
  +        sb.append(basetab + "// ***** Should prettyprint this code...\n");
  +        sb.append(basetab + body + "\n");
         }
  +      else
  +      {
  +        sb.append(basetab + "// ***** Generate BSF invocation!?\n");
  +      }
  +
  +      sb.append(basetab + "}\n");
  +    }
  +
       return sb.toString();
     }
  -  
   }
  
  
  
  1.2       +721 -529  xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Field.java
  
  Index: Field.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Field.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Field.java	2000/10/13 02:33:15	1.1
  +++ Field.java	2000/10/30 18:58:00	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,647 +52,839 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   package org.apache.xalan.utils.synthetic.reflection;
  +
   import org.apache.xalan.utils.synthetic.Class;
   import org.apache.xalan.utils.synthetic.SynthesisException;
   
   /**
  -  A Field provides information about, and dynamic access
  -  to, a single field of a class or an interface. The reflected
  -  field may be a class (static) field or an instance field. 
  -  <p>
  -  A Field permits widening conversions to occur during a
  -  get or set access operation, but throws an
  -  IllegalArgumentException if a narrowing conversion
  -  would occur. 
  -  
  -  @see Member  
  -  @see  Class  
  -  @see  getFields  
  -  @see  getField  
  -  @see  getDeclaredFields  
  -  @see  getDeclaredField 
  -  **/
  -public class Field 
  -extends Object 
  -implements Member 
  + * A Field provides information about, and dynamic access
  + * to, a single field of a class or an interface. The reflected
  + * field may be a class (static) field or an instance field.
  + * <p>
  + * A Field permits widening conversions to occur during a
  + * get or set access operation, but throws an
  + * IllegalArgumentException if a narrowing conversion
  + * would occur.
  + *
  + * @see Member
  + * @see  Class
  + * @see  getFields
  + * @see  getField
  + * @see  getDeclaredFields
  + * @see  getDeclaredField
  + */
  +public class Field extends Object implements Member
   {
  -  public String name, initializer=null;
  +
  +  /** NEEDSDOC Field name, initializer          */
  +  public String name, initializer = null;
  +
  +  /** NEEDSDOC Field modifiers          */
     int modifiers;
  -  java.lang.reflect.Field realfield=null;
  -  Class declaringClass,type;
  -  
  -  /** Proxy constructor */
  -  public Field(java.lang.reflect.Field realfield, org.apache.xalan.utils.synthetic.Class declaringClass)
  -  { 
  -    this(realfield.getName(),declaringClass);
  -    this.realfield=realfield;
  -    this.type=org.apache.xalan.utils.synthetic.Class.forClass(realfield.getType());
  -  }
  -  
  -  /** Synthesis constructor */
  -  public Field(String name,org.apache.xalan.utils.synthetic.Class declaringClass)
  -  { 
  -    this.name=name;
  -    this.declaringClass=declaringClass;
  -  }
  -  
  -  
  -  /**
  -    Compares this Field against the specified object.
  -    Returns true if the objects are the same. Two
  -    Fields are the same if they were declared by the
  -    same class and have the same name and type. 
  -    */
  +
  +  /** NEEDSDOC Field realfield          */
  +  java.lang.reflect.Field realfield = null;
  +
  +  /** NEEDSDOC Field declaringClass, type          */
  +  Class declaringClass, type;
  +
  +  /**
  +   * Proxy constructor 
  +   *
  +   * NEEDSDOC @param realfield
  +   * NEEDSDOC @param declaringClass
  +   */
  +  public Field(java.lang.reflect.Field realfield,
  +               org.apache.xalan.utils.synthetic.Class declaringClass)
  +  {
  +
  +    this(realfield.getName(), declaringClass);
  +
  +    this.realfield = realfield;
  +    this.type =
  +      org.apache.xalan.utils.synthetic.Class.forClass(realfield.getType());
  +  }
  +
  +  /**
  +   * Synthesis constructor 
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param declaringClass
  +   */
  +  public Field(String name,
  +               org.apache.xalan.utils.synthetic.Class declaringClass)
  +  {
  +    this.name = name;
  +    this.declaringClass = declaringClass;
  +  }
  +
  +  /**
  +   * Compares this Field against the specified object.
  +   * Returns true if the objects are the same. Two
  +   * Fields are the same if they were declared by the
  +   * same class and have the same name and type.
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public boolean equals(Object obj)
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.equals(obj);
  -    
  -    else if(obj instanceof Field)
  -      {
  -        Field objf=(Field)obj;
  -        return(declaringClass.equals(objf.declaringClass) &&
  -	       name.equals(objf.name) && type.equals(objf.type) );
  -      }
  -    
  -    else return false;
  -  }
  -  /**
  -    Returns the value of the field represented by this
  -    Field, on the specified object. The value is
  -    automatically wrapped in an object if it has a
  -    primitive type. 
  -    <p>
  -    The underlying field's value is obtained as follows:
  -    <p>
  -    If the underlying field is a static field, the object
  -    argument is ignored; it may be null. 
  -    <p>
  -    Otherwise, the underlying field is an instance
  -    field. If the specified object argument is null, the
  -    method throws a NullPointerException. If the
  -    specified object is not an instance of the class or
  -    interface declaring the underlying field, the
  -    method throws an IllegalArgumentException. 
  -    <p>
  -    If this Field object enforces Java language access
  -    control, and the underlying field is inaccessible,
  -    the method throws an IllegalAccessException. 
  -    <p>
  -    Otherwise, the value is retrieved from the
  -    underlying instance or static field. If the field has a
  -    primitive type, the value is wrapped in an object
  -    before being returned, otherwise it is returned as
  -    is. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field. 
  -    @throws NullPointerException 
  -    if the specified object is null. 
  -    */
  -  public Object get(Object obj) throws IllegalArgumentException, IllegalAccessException
  +    else if (obj instanceof Field)
  +    {
  +      Field objf = (Field) obj;
  +
  +      return (declaringClass.equals(objf.declaringClass)
  +              && name.equals(objf.name) && type.equals(objf.type));
  +    }
  +    else
  +      return false;
  +  }
  +
  +  /**
  +   * Returns the value of the field represented by this
  +   * Field, on the specified object. The value is
  +   * automatically wrapped in an object if it has a
  +   * primitive type.
  +   * <p>
  +   * The underlying field's value is obtained as follows:
  +   * <p>
  +   * If the underlying field is a static field, the object
  +   * argument is ignored; it may be null.
  +   * <p>
  +   * Otherwise, the underlying field is an instance
  +   * field. If the specified object argument is null, the
  +   * method throws a NullPointerException. If the
  +   * specified object is not an instance of the class or
  +   * interface declaring the underlying field, the
  +   * method throws an IllegalArgumentException.
  +   * <p>
  +   * If this Field object enforces Java language access
  +   * control, and the underlying field is inaccessible,
  +   * the method throws an IllegalAccessException.
  +   * <p>
  +   * Otherwise, the value is retrieved from the
  +   * underlying instance or static field. If the field has a
  +   * primitive type, the value is wrapped in an object
  +   * before being returned, otherwise it is returned as
  +   * is.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field.
  +   * @throws NullPointerException
  +   * if the specified object is null.
  +   */
  +  public Object get(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.get(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the value of a field as a boolean on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public boolean getBoolean(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a boolean on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public boolean getBoolean(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getBoolean(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the value of a field as a byte on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public byte getByte(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a byte on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public byte getByte(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getByte(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the value of a field as a char on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public char getChar(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a char on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public char getChar(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getChar(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Returns the Class object representing the class or
  -    interface that declares the field represented by this
  -    Field object. 
  -    */
  +   * Returns the Class object representing the class or
  +   * interface that declares the field represented by this
  +   * Field object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public org.apache.xalan.utils.synthetic.Class getDeclaringClass()
     {
  -    if(realfield!=null)
  -      return org.apache.xalan.utils.synthetic.Class.forClass(realfield.getDeclaringClass());
  -    
  +
  +    if (realfield != null)
  +      return org.apache.xalan.utils.synthetic.Class.forClass(
  +        realfield.getDeclaringClass());
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the value of a field as a double on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public double getDouble(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a double on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public double getDouble(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getDouble(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the value of a field as a float on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public float getFloat(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a float on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public float getFloat(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getFloat(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the value of a field as a int on specified object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public int getInt(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a int on specified object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public int getInt(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getInt(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Get the value of a field as a long on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public long getLong(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a long on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public long getLong(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getLong(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Returns the Java language modifiers for the field
  -    represented by this Field object, as an integer. The
  -    Modifier class should be used to decode the
  -    modifiers. 
  -    
  -    @see 
  -    Modifier 
  -    */
  +   * Returns the Java language modifiers for the field
  +   * represented by this Field object, as an integer. The
  +   * Modifier class should be used to decode the
  +   * modifiers.
  +   *
  +   * @see
  +   * Modifier
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public int getModifiers()
     {
  -    if(realfield!=null)
  -      modifiers=realfield.getModifiers();
  -    
  +
  +    if (realfield != null)
  +      modifiers = realfield.getModifiers();
  +
       return modifiers;
     }
   
  +  /**
  +   * NEEDSDOC Method getInitializer 
  +   *
  +   *
  +   * NEEDSDOC (getInitializer) @return
  +   */
     public String getInitializer()
     {
       return initializer;
     }
  -  public void setInitializer(String i)
  -  throws SynthesisException
  +
  +  /**
  +   * NEEDSDOC Method setInitializer 
  +   *
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * @throws SynthesisException
  +   */
  +  public void setInitializer(String i) throws SynthesisException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    
  -    initializer=i;
  +
  +    initializer = i;
     }
  - 
  +
     /**
      * Insert the method's description here.
      * Creation date: (12-25-99 2:02:26 PM)
      * @return java.lang.String
      */
  -  public java.lang.String getName() {
  +  public java.lang.String getName()
  +  {
       return name;
     }
  +
     /**
  -    Get the value of a field as a short on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the field value cannot be converted to the
  -    return type by a widening conversion. 
  -    @see 
  -    get 
  -    */
  -  public short getShort(Object obj) throws IllegalArgumentException, IllegalAccessException
  +   * Get the value of a field as a short on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the field value cannot be converted to the
  +   * return type by a widening conversion.
  +   * @see
  +   * get
  +   */
  +  public short getShort(Object obj)
  +          throws IllegalArgumentException, IllegalAccessException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.getShort(obj);
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  +
     /**
  -    Returns a Class object that identifies the declared
  -    type for the field represented by this Field object. 
  -    */
  +   * Returns a Class object that identifies the declared
  +   * type for the field represented by this Field object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public Class getType()
     {
  -    if(realfield!=null)
  -      type=Class.forClass(realfield.getType());
  -    
  +
  +    if (realfield != null)
  +      type = Class.forClass(realfield.getType());
  +
       return type;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setType 
  +   *
  +   *
  +   * NEEDSDOC @param type
  +   *
  +   * @throws SynthesisException
  +   */
     public void setType(org.apache.xalan.utils.synthetic.Class type)
  -  throws SynthesisException
  +          throws SynthesisException
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         throw new SynthesisException(SynthesisException.REIFIED);
  -    
  -    this.type=type;
  +
  +    this.type = type;
     }
  -  
  +
     /**
  -    Returns a hashcode for this Field. This is
  -    computed as the exclusive-or of the hashcodes for
  -    the underlying field's declaring class name and its
  -    name. 
  -    */
  +   * Returns a hashcode for this Field. This is
  +   * computed as the exclusive-or of the hashcodes for
  +   * the underlying field's declaring class name and its
  +   * name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public int hashCode()
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.hashCode();
       else
  -      return declaringClass.getName().hashCode() ^ 
  -	name.hashCode();
  +      return declaringClass.getName().hashCode() ^ name.hashCode();
     }
  +
  +  /**
  +   * Sets the field represented by this Field object on
  +   * the specified object argument to the specified new
  +   * value. The new value is automatically unwrapped
  +   * if the underlying field has a primitive type.
  +   *
  +   * The operation proceeds as follows:
  +   *
  +   * If the underlying field is static, the object
  +   * argument is ignored; it may be null.
  +   *
  +   * Otherwise the underlying field is an instance field.
  +   * If the specified object argument is null, the
  +   * method throws a NullPointerException. If the
  +   * specified object argument is not an instance of the
  +   * class or interface declaring the underlying field,
  +   * the method throws an IllegalArgumentException.
  +   *
  +   * If this Field object enforces Java language access
  +   * control, and the underlying field is inaccessible,
  +   * the method throws an IllegalAccessException.
  +   *
  +   * If the underlying field is final, the method throws
  +   * an IllegalAccessException.
  +   *
  +   * If the underlying field is of a primitive type, an
  +   * unwrapping conversion is attempted to convert the
  +   * new value to a value of a primitive type. If this
  +   * attempt fails, the method throws an
  +   * IllegalArgumentException.
  +   *
  +   * If, after possible unwrapping, the new value
  +   * cannot be converted to the type of the underlying
  +   * field by an identity or widening conversion, the
  +   * method throws an IllegalArgumentException.
  +   *
  +   * The field is set to the possibly unwrapped and
  +   * widened new value.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param value
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @throws NullPointerException
  +   * if the specified object is null.
  +   */
  +  public void set(Object obj, Object value)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.set(obj, value);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
  +   * Set the value of a field as a boolean on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param z
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setBoolean(Object obj, boolean z)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setBoolean(obj, z);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
  +   * Set the value of a field as a byte on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param b
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setByte(Object obj, byte b)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setByte(obj, b);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
     /**
  -    Sets the field represented by this Field object on
  -    the specified object argument to the specified new
  -    value. The new value is automatically unwrapped
  -    if the underlying field has a primitive type. 
  -    
  -    The operation proceeds as follows: 
  -    
  -    If the underlying field is static, the object
  -    argument is ignored; it may be null. 
  -    
  -    Otherwise the underlying field is an instance field.
  -    If the specified object argument is null, the
  -    method throws a NullPointerException. If the
  -    specified object argument is not an instance of the
  -    class or interface declaring the underlying field,
  -    the method throws an IllegalArgumentException. 
  -    
  -    If this Field object enforces Java language access
  -    control, and the underlying field is inaccessible,
  -    the method throws an IllegalAccessException. 
  -    
  -    If the underlying field is final, the method throws
  -    an IllegalAccessException. 
  -    
  -    If the underlying field is of a primitive type, an
  -    unwrapping conversion is attempted to convert the
  -    new value to a value of a primitive type. If this
  -    attempt fails, the method throws an
  -    IllegalArgumentException. 
  -    
  -    If, after possible unwrapping, the new value
  -    cannot be converted to the type of the underlying
  -    field by an identity or widening conversion, the
  -    method throws an IllegalArgumentException. 
  -    
  -    The field is set to the possibly unwrapped and
  -    widened new value. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @throws NullPointerException 
  -    if the specified object is null. 
  -    */
  -  public  void set(Object obj,Object value) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.set(obj,value);
  -    
  -    throw new java.lang.IllegalStateException();
  -    
  -  }
  -  /**
  -    Set the value of a field as a boolean on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setBoolean(Object obj,boolean z) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setBoolean(obj,z);
  -    
  -    throw new java.lang.IllegalStateException();
  -  }  
  -  /**
  -    Set the value of a field as a byte on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setByte(Object obj, byte b) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setByte(obj,b);
  -    
  -    throw new java.lang.IllegalStateException();
  -  }  
  -  /**
  -    Set the value of a field as a char on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setChar(Object obj, char c) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setChar(obj,c);
  -    
  -    throw new java.lang.IllegalStateException();
  -  }  
  -  /**
  -    Returns the Class object representing the class that
  -    declares the constructor represented by this
  -    Constructor object. 
  -    */
  -  public void setDeclaringClass(org.apache.xalan.utils.synthetic.Class declaringClass)
  -  {
  -    this.declaringClass=declaringClass;
  -  }
  -  /**
  -    Set the value of a field as a double on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setDouble(Object obj, double d) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setDouble(obj,d);
  -    
  -    
  -    throw new java.lang.IllegalStateException();
  -  }  
  -  /**
  -    Set the value of a field as a float on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setFloat(Object obj, float f) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setFloat(obj,f);
  -    
  -    throw new java.lang.IllegalStateException();
  -  }  
  -  /**
  -    Set the value of a field as an int on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setInt(Object obj, int i) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setInt(obj,i);
  -    
  -    throw new java.lang.IllegalStateException();
  -  }  
  -  /**
  -    Set the value of a field as a long on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setLong(Object obj, long l) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setLong(obj,l);
  -    
  +   * Set the value of a field as a char on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param c
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setChar(Object obj, char c)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setChar(obj, c);
  +
       throw new java.lang.IllegalStateException();
  -  }  
  +  }
  +
     /**
  +   * Returns the Class object representing the class that
  +   * declares the constructor represented by this
  +   * Constructor object.
  +   *
  +   * NEEDSDOC @param declaringClass
  +   */
  +  public void setDeclaringClass(
  +          org.apache.xalan.utils.synthetic.Class declaringClass)
  +  {
  +    this.declaringClass = declaringClass;
  +  }
  +
  +  /**
  +   * Set the value of a field as a double on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param d
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setDouble(Object obj, double d)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setDouble(obj, d);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
  +   * Set the value of a field as a float on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param f
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setFloat(Object obj, float f)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setFloat(obj, f);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
  +   * Set the value of a field as an int on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param i
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setInt(Object obj, int i)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setInt(obj, i);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
  +   * Set the value of a field as a long on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param l
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setLong(Object obj, long l)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setLong(obj, l);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
      * Insert the method's description here.
      * Creation date: (12-25-99 1:28:28 PM)
      * @return int
      * @param modifiers int
  +   *
  +   * @throws SynthesisException
      */
  -  public void setModifiers(int modifiers)
  -  throws SynthesisException
  +  public void setModifiers(int modifiers) throws SynthesisException
     {
  -    if(realfield!=null)
  -        throw new SynthesisException(SynthesisException.REIFIED);
  -    
  -    this.modifiers=modifiers;
  -  }
  -  
  -  /**
  -    Set the value of a field as a short on specified
  -    object. 
  -    
  -    @throws IllegalAccessException 
  -    if the underlying constructor is inaccessible. 
  -    @throws IllegalArgumentException 
  -    if the specified object is not an instance of
  -    the class or interface declaring the
  -    underlying field, or if an unwrapping
  -    conversion fails. 
  -    @see 
  -    set 
  -    */
  -  public  void setShort(Object obj, short s) throws IllegalArgumentException, IllegalAccessException
  -  {
  -    if(realfield!=null)
  -      realfield.setShort(obj,s);
  -    
  -    throw new java.lang.IllegalStateException();
  -  }  
  -  /**
  -    Return a string describing this Field. The format is
  -    the access modifiers for the field, if any, followed
  -    by the field type, followed by a space, followed by
  -    the fully-qualified name of the class declaring the
  -    field, followed by a period, followed by the name
  -    of the field. For example: 
  -    <code>
  -    public static final int java.lang.Thread.MIN_PRIORITY
  -    private int java.io.FileDescriptor.fd
  -    </code>
  -    
  -    The modifiers are placed in canonical order as
  -    specified by "The Java Language Specification".
  -    This is public, protected or private first,
  -    and then other modifiers in the following order:
  -    static, final, transient, volatile. 
  -    */
  +
  +    if (realfield != null)
  +      throw new SynthesisException(SynthesisException.REIFIED);
  +
  +    this.modifiers = modifiers;
  +  }
  +
  +  /**
  +   * Set the value of a field as a short on specified
  +   * object.
  +   *
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param s
  +   * @throws IllegalAccessException
  +   * if the underlying constructor is inaccessible.
  +   * @throws IllegalArgumentException
  +   * if the specified object is not an instance of
  +   * the class or interface declaring the
  +   * underlying field, or if an unwrapping
  +   * conversion fails.
  +   * @see
  +   * set
  +   */
  +  public void setShort(Object obj, short s)
  +          throws IllegalArgumentException, IllegalAccessException
  +  {
  +
  +    if (realfield != null)
  +      realfield.setShort(obj, s);
  +
  +    throw new java.lang.IllegalStateException();
  +  }
  +
  +  /**
  +   * Return a string describing this Field. The format is
  +   * the access modifiers for the field, if any, followed
  +   * by the field type, followed by a space, followed by
  +   * the fully-qualified name of the class declaring the
  +   * field, followed by a period, followed by the name
  +   * of the field. For example:
  +   * <code>
  +   * public static final int java.lang.Thread.MIN_PRIORITY
  +   * private int java.io.FileDescriptor.fd
  +   * </code>
  +   *
  +   * The modifiers are placed in canonical order as
  +   * specified by "The Java Language Specification".
  +   * This is public, protected or private first,
  +   * and then other modifiers in the following order:
  +   * static, final, transient, volatile.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String toString()
     {
  -    if(realfield!=null)
  +
  +    if (realfield != null)
         return realfield.toString();
  -    
  +
       throw new java.lang.IllegalStateException();
     }
  -  
  -  /** Output the Field as Java sourcecode
  +
  +  /**
  +   * Output the Field as Java sourcecode
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String toSource()
     {
  -    StringBuffer sb=
  -        new StringBuffer(java.lang.reflect.Modifier.toString(getModifiers()) )
  -        .append(' ')
  -        .append(getType().getJavaName())
  -        .append(' ')
  -        .append(getName());
  -    String i=getInitializer();
  -    if(i!=null && i.length()>0)
  -        sb.append('=').append(i);
  +
  +    StringBuffer sb = new StringBuffer(
  +      java.lang.reflect.Modifier.toString(getModifiers())).append(' ').append(
  +      getType().getJavaName()).append(' ').append(getName());
  +    String i = getInitializer();
  +
  +    if (i != null && i.length() > 0)
  +      sb.append('=').append(i);
  +
       sb.append(';');
  -      
  +
       return sb.toString();
     }
  -  
  -  
   }
  
  
  
  1.2       +65 -48    xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Member.java
  
  Index: Member.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Member.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Member.java	2000/10/13 02:33:15	1.1
  +++ Member.java	2000/10/30 18:58:00	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,58 +52,75 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   package org.apache.xalan.utils.synthetic.reflection;
  +
   import org.apache.xalan.utils.synthetic.SynthesisException;
   
   /**
  -Member is an interface that reflects identifying
  -information about a single member (a field or a method)
  -or a constructor.
  -<p>
  -Note that this is <strong>not</strong> currently derived from
  -java.lang.reflect.Member, due to questions about how to handle
  -declarignClass.
  -
  -@see Field
  -@see Method
  -@see Constructor
  -@see org.apache.xalan.utils.synthetic.Class
  -@see java.lang.reflect.Member
  -*/
  + * Member is an interface that reflects identifying
  + * information about a single member (a field or a method)
  + * or a constructor.
  + * <p>
  + * Note that this is <strong>not</strong> currently derived from
  + * java.lang.reflect.Member, due to questions about how to handle
  + * declarignClass.
  + *
  + * @see Field
  + * @see Method
  + * @see Constructor
  + * @see org.apache.xalan.utils.synthetic.Class
  + * @see java.lang.reflect.Member
  + */
   public interface Member
   {
  -/**
  -Returns the Class object representing the class or
  -interface that declares the member or constructor
  -represented by this Member.
  -*/
  -public abstract org.apache.xalan.utils.synthetic.Class getDeclaringClass();
  -/**
  -Returns the Java language modifiers for the
  -member or constructor represented by this
  -Member, as an integer. The Modifier class should
  -be used to decode the modifiers in the integer. 
  -
  -@see Modifier
  -**/
  -public abstract int getModifiers();
  -/**
  -Returns the Class object representing the class or
  -interface that declares the member or constructor
  -represented by this Member. 
  -*/
  -public abstract void setDeclaringClass(org.apache.xalan.utils.synthetic.Class declaringClass)
  -throws SynthesisException;
  -/**
  -Returns the Java language modifiers for the
  -member or constructor represented by this
  -Member, as an integer. The Modifier class should
  -be used to decode the modifiers in the integer. 
  -
  -@see Modifier
  -**/
  -public abstract void setModifiers(int modifiers) 
  -throws SynthesisException;
  +
  +  /**
  +   * Returns the Class object representing the class or
  +   * interface that declares the member or constructor
  +   * represented by this Member.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public abstract org.apache.xalan.utils.synthetic.Class getDeclaringClass();
  +
  +  /**
  +   * Returns the Java language modifiers for the
  +   * member or constructor represented by this
  +   * Member, as an integer. The Modifier class should
  +   * be used to decode the modifiers in the integer.
  +   *
  +   * @see Modifier
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +  public abstract int getModifiers();
  +
  +  /**
  +   * Returns the Class object representing the class or
  +   * interface that declares the member or constructor
  +   * represented by this Member.
  +   *
  +   * NEEDSDOC @param declaringClass
  +   *
  +   * @throws SynthesisException
  +   */
  +  public abstract void setDeclaringClass(
  +    org.apache.xalan.utils.synthetic.Class declaringClass)
  +      throws SynthesisException;
  +
  +  /**
  +   * Returns the Java language modifiers for the
  +   * member or constructor represented by this
  +   * Member, as an integer. The Modifier class should
  +   * be used to decode the modifiers in the integer.
  +   *
  +   * @see Modifier
  +   *
  +   * NEEDSDOC @param modifiers
  +   *
  +   * @throws SynthesisException
  +   */
  +  public abstract void setModifiers(int modifiers) throws SynthesisException;
   }
  
  
  
  1.2       +181 -146  xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Method.java
  
  Index: Method.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/utils/synthetic/reflection/Method.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Method.java	2000/10/13 02:33:15	1.1
  +++ Method.java	2000/10/30 18:58:01	1.2
  @@ -1,5 +1,5 @@
   /*
  - * The Apache Software License, Version 1.1 
  + * The Apache Software License, Version 1.1
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  @@ -52,190 +52,225 @@
    * originally based on software copyright (c) 1999, Lotus
    * Development Corporation., http://www.lotus.com.  For more
    * information on the Apache Software Foundation, please see
  - * <http://www.apache.org/>. 
  + * <http://www.apache.org/>.
    */
   package org.apache.xalan.utils.synthetic.reflection;
   
   import java.lang.reflect.InvocationTargetException;
  +
   import org.apache.xalan.utils.synthetic.SynthesisException;
   
   /**
  -  A Method provides information about, and access to, a
  -  single method on a class or interface. The reflected
  -  method may be a class method or an instance method
  -  (including an abstract method). 
  -  <p>
  -  A Method permits widening conversions to occur when
  -  matching the actual parameters to invokewith the
  -  underlying method's formal parameters, but it throws an
  -  IllegalArgumentException if a narrowing conversion
  -  would occur.
  -  <p>
  -  ***** Need to add method body, a la Matt's codebuffer.
  -  That may or may not imply retaining the final return value
  -  separately and passing in a how-to-use-it mechanism...?
  -  
  -  @see Member  
  -  @see Class  
  -  @see getMethods  
  -  @see getMethod  
  -  @see getDeclaredMethods  
  -  @see getDeclaredMethod 
  -  */
  -public  class Method 
  -extends EntryPoint 
  -implements Member 
  + * A Method provides information about, and access to, a
  + * single method on a class or interface. The reflected
  + * method may be a class method or an instance method
  + * (including an abstract method).
  + * <p>
  + * A Method permits widening conversions to occur when
  + * matching the actual parameters to invokewith the
  + * underlying method's formal parameters, but it throws an
  + * IllegalArgumentException if a narrowing conversion
  + * would occur.
  + * <p>
  + *  Need to add method body, a la Matt's codebuffer.
  + * That may or may not imply retaining the final return value
  + * separately and passing in a how-to-use-it mechanism...?
  + *
  + * @see Member
  + * @see Class
  + * @see getMethods
  + * @see getMethod
  + * @see getDeclaredMethods
  + * @see getDeclaredMethod
  + */
  +public class Method extends EntryPoint implements Member
   {
  -  
  -  
  +
     /**
      * Insert the method's description here.
      * <p>
      * Creation date: (12-27-99 2:31:39 PM)
      * @param realConstructor java.lang.reflect.Constructor
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param declaringclass
      */
  -  public Method(String name,org.apache.xalan.utils.synthetic.Class declaringclass)
  +  public Method(String name,
  +                org.apache.xalan.utils.synthetic.Class declaringclass)
     {
  +
       super(declaringclass);
  -    this.name=name;
  +
  +    this.name = name;
     }
  +
     /**
      * Insert the method's description here.
      * <p>
      * Creation date: (12-27-99 2:31:39 PM)
      * @param realConstructor java.lang.reflect.Constructor
  +   *
  +   * NEEDSDOC @param ctor
  +   * NEEDSDOC @param declaringclass
      */
  -  public Method(java.lang.reflect.Method ctor,org.apache.xalan.utils.synthetic.Class declaringclass)
  +  public Method(java.lang.reflect.Method ctor,
  +                org.apache.xalan.utils.synthetic.Class declaringclass)
     {
  -    super(ctor,declaringclass);
  +    super(ctor, declaringclass);
     }
  +
     /**
      * Insert the method's description here.
      * <p>
      * Creation date: (12-27-99 2:31:39 PM)
      * @param realConstructor java.lang.reflect.Constructor
  +   *
  +   * NEEDSDOC @param realmethod
      */
     public Method(java.lang.reflect.Method realmethod)
     {
       super(realmethod);
     }
  +
  +  /**
  +   * Returns a hashcode for this Method. The hashcode
  +   * is computed as the exclusive-or of the hashcodes
  +   * for the underlying method's declaring class name
  +   * and the method's name.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
  +
     /**
  -    Returns a hashcode for this Method. The hashcode
  -    is computed as the exclusive-or of the hashcodes
  -    for the underlying method's declaring class name
  -    and the method's name. 
  -    */
  -  /**
  -    Returns a hashcode for this Constructor. The
  -    hashcode for a Method is the hashcode for the
  -    underlying constructor's declaring class name,
  -    XORed with the name of this method.
  -    */
  +   * Returns a hashcode for this Constructor. The
  +   * hashcode for a Method is the hashcode for the
  +   * underlying constructor's declaring class name,
  +   * XORed with the name of this method.
  +   */
     public int hashCode()
     {
  -    return getDeclaringClass().getName().hashCode()
  -      ^
  -      getName().hashCode();
  -  }
  -  /**
  -    Invokes the underlying method represented by this
  -    Method object, on the specified object with the
  -    specified parameters. Individual parameters are
  -    automatically unwrapped to match primitive
  -    formal parameters, and both primitive and
  -    reference parameters are subject to widening
  -    conversions as necessary. The value returned by
  -    the underlying method is automatically wrapped
  -    in an object if it has a primitive type. 
  -    
  -    Method invocation proceeds with the following
  -    steps, in order: 
  -    
  -    If the underlying method is static, then the
  -    specified object argument is ignored. It may be
  -    null. 
  -    
  -    Otherwise, the method is an instance method. If
  -    the specified object argument is null, the
  -    invocation throws a NullPointerException.
  -    Otherwise, if the specified object argument is not
  -    an instance of the class or interface declaring the
  -    underlying method, the invocation throws an
  -    IllegalArgumentException. 
  -    
  -    If this Method object enforces Java language access
  -    control and the underlying method is inaccessible,
  -    the invocation throws an IllegalAccessException. 
  -    
  -    If the number of actual parameters supplied via
  -    args is different from the number of formal
  -    parameters required by the underlying method, the
  -    invocation throws an IllegalArgumentException. 
  -    
  -    For each actual parameter in the supplied args
  -    array: 
  -    
  -    If the corresponding formal parameter has a
  -    primitive type, an unwrapping conversion is
  -    attempted to convert the object value to a value of
  -    a primitive type. If this attempt fails, the
  -    invocation throws an IllegalArgumentException. 
  -    
  -    If, after possible unwrapping, the parameter value
  -    cannot be converted to the corresponding formal
  -    parameter type by an identity or widening
  -    conversion, the invocation throws an
  -    IllegalArgumentException. 
  -    
  -    If the underlying method is an instance method, it
  -    is invoked using dynamic method lookup as
  -    documented in The Java Language Specification,
  -    section 15.11.4.4; in particular, overriding based
  -    on the runtime type of the target object will occur. 
  -    
  -    If the underlying method is static, it is invoked as
  -    exactly the method on the declaring class. 
  -    
  -    Control transfers to the underlying method. If the
  -    method completes abruptly by throwing an
  -    exception, the exception is placed in an
  -    InvocationTargetException and thrown in turn to
  -    the caller of invoke. 
  -    
  -    If the method completes normally, the value it
  -    returns is returned to the caller of invoke; if the
  -    value has a primitive type, it is first appropriately
  -    wrapped in an object. If the underlying method
  -    return type is void, the invocation returns null. 
  -    
  -    Throws: IllegalAccessException 
  -    if the underlying method is inaccessible. 
  -    Throws: IllegalArgumentException 
  -    if the number of actual and formal
  -    parameters differ, or if an unwrapping
  -    conversion fails. 
  -    Throws: InvocationTargetException 
  -    if the underlying method throws an
  -    exception. 
  -    Throws: NullPointerException 
  -    if the specified object is null. 
  -    */
  -  public Object invoke(Object obj, Object args[]) 
  -       throws IllegalAccessException, IllegalArgumentException, 
  -	 java.lang.reflect.InvocationTargetException
  -  {
  -    if(realep!=null)
  -      return ((java.lang.reflect.Method)realep).invoke(obj,args);
  -    else    
  -      throw new IllegalAccessException("Un-reified org.apache.xalan.utils.synthetic.Class doesn't yet support invocation");
  -  } 
  -  
  +    return getDeclaringClass().getName().hashCode() ^ getName().hashCode();
  +  }
  +
  +  /**
  +   * Invokes the underlying method represented by this
  +   * Method object, on the specified object with the
  +   * specified parameters. Individual parameters are
  +   * automatically unwrapped to match primitive
  +   * formal parameters, and both primitive and
  +   * reference parameters are subject to widening
  +   * conversions as necessary. The value returned by
  +   * the underlying method is automatically wrapped
  +   * in an object if it has a primitive type.
  +   *
  +   * Method invocation proceeds with the following
  +   * steps, in order:
  +   *
  +   * If the underlying method is static, then the
  +   * specified object argument is ignored. It may be
  +   * null.
  +   *
  +   * Otherwise, the method is an instance method. If
  +   * the specified object argument is null, the
  +   * invocation throws a NullPointerException.
  +   * Otherwise, if the specified object argument is not
  +   * an instance of the class or interface declaring the
  +   * underlying method, the invocation throws an
  +   * IllegalArgumentException.
  +   *
  +   * If this Method object enforces Java language access
  +   * control and the underlying method is inaccessible,
  +   * the invocation throws an IllegalAccessException.
  +   *
  +   * If the number of actual parameters supplied via
  +   * args is different from the number of formal
  +   * parameters required by the underlying method, the
  +   * invocation throws an IllegalArgumentException.
  +   *
  +   * For each actual parameter in the supplied args
  +   * array:
  +   *
  +   * If the corresponding formal parameter has a
  +   * primitive type, an unwrapping conversion is
  +   * attempted to convert the object value to a value of
  +   * a primitive type. If this attempt fails, the
  +   * invocation throws an IllegalArgumentException.
  +   *
  +   * If, after possible unwrapping, the parameter value
  +   * cannot be converted to the corresponding formal
  +   * parameter type by an identity or widening
  +   * conversion, the invocation throws an
  +   * IllegalArgumentException.
  +   *
  +   * If the underlying method is an instance method, it
  +   * is invoked using dynamic method lookup as
  +   * documented in The Java Language Specification,
  +   * section 15.11.4.4; in particular, overriding based
  +   * on the runtime type of the target object will occur.
  +   *
  +   * If the underlying method is static, it is invoked as
  +   * exactly the method on the declaring class.
  +   *
  +   * Control transfers to the underlying method. If the
  +   * method completes abruptly by throwing an
  +   * exception, the exception is placed in an
  +   * InvocationTargetException and thrown in turn to
  +   * the caller of invoke.
  +   *
  +   * If the method completes normally, the value it
  +   * returns is returned to the caller of invoke; if the
  +   * value has a primitive type, it is first appropriately
  +   * wrapped in an object. If the underlying method
  +   * return type is void, the invocation returns null.
  +   *
  +   * Throws: IllegalAccessException
  +   * if the underlying method is inaccessible.
  +   * Throws: IllegalArgumentException
  +   * if the number of actual and formal
  +   * parameters differ, or if an unwrapping
  +   * conversion fails.
  +   * Throws: InvocationTargetException
  +   * if the underlying method throws an
  +   * exception.
  +   * Throws: NullPointerException
  +   * if the specified object is null.
  +   *
  +   * NEEDSDOC @param obj
  +   * NEEDSDOC @param args
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws IllegalAccessException
  +   * @throws IllegalArgumentException
  +   * @throws java.lang.reflect.InvocationTargetException
  +   */
  +  public Object invoke(Object obj, Object args[])
  +          throws IllegalAccessException, IllegalArgumentException,
  +                 java.lang.reflect.InvocationTargetException
  +  {
  +
  +    if (realep != null)
  +      return ((java.lang.reflect.Method) realep).invoke(obj, args);
  +    else
  +      throw new IllegalAccessException(
  +        "Un-reified org.apache.xalan.utils.synthetic.Class doesn't yet support invocation");
  +  }
  +
  +  /**
  +   * NEEDSDOC Method setReturnType 
  +   *
  +   *
  +   * NEEDSDOC @param returntype
  +   *
  +   * @throws SynthesisException
  +   */
     public void setReturnType(org.apache.xalan.utils.synthetic.Class returntype)
  -  throws SynthesisException
  +          throws SynthesisException
     {
  -    if(realep!=null)
  -        throw new SynthesisException(SynthesisException.REIFIED);
  -    this.returntype=returntype;
  +
  +    if (realep != null)
  +      throw new SynthesisException(SynthesisException.REIFIED);
  +
  +    this.returntype = returntype;
     }
  -  
   }
  
  
  
  1.13      +228 -152  xml-xalan/java/src/org/apache/xalan/xslt/Process.java
  
  Index: Process.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xalan/xslt/Process.java,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -r1.12 -r1.13
  --- Process.java	2000/10/17 19:24:58	1.12
  +++ Process.java	2000/10/30 18:58:06	1.13
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -75,23 +75,17 @@
   import java.util.Vector;
   import java.util.Properties;
   import java.util.Enumeration;
  -
   import java.util.Date;
   
   // Needed Xalan classes
   import org.apache.xalan.res.XSLMessages;
  -
   import org.apache.xalan.processor.XSLProcessorVersion;
  -
   import org.apache.xalan.res.XSLTErrorResources;
  -
   import org.apache.xalan.templates.Constants;
   import org.apache.xalan.templates.ElemTemplateElement;
   import org.apache.xalan.templates.StylesheetRoot;
  -
   import org.apache.xalan.transformer.TransformerImpl;
   import org.apache.xalan.processor.StylesheetProcessor;
  -
   import org.apache.xalan.trace.PrintTraceListener;
   import org.apache.xalan.trace.TraceListener;
   import org.apache.xalan.trace.TraceManager;
  @@ -121,40 +115,47 @@
   import org.apache.serialize.Serializer;
   import org.apache.serialize.SerializerFactory;
   
  -
   /**
    * <meta name="usage" content="general"/>
    * The main() method handles the Xalan command-line interface.
    */
   public class Process
   {
  +
     /**
      * Prints argument options.
  +   *
  +   * NEEDSDOC @param resbundle
      */
     protected static void printArgOptions(XSLTErrorResources resbundle)
     {
  -    System.out.println(resbundle.getString("xslProc_option")); //"xslproc options: ");
  -    System.out.println(resbundle.getString("optionIN")); //"    -IN inputXMLURL");
  -    System.out.println(resbundle.getString("optionXSL")); //"   [-XSL XSLTransformationURL]");
  -    System.out.println(resbundle.getString("optionOUT")); //"   [-OUT outputFileName]");
  +
  +    System.out.println(resbundle.getString("xslProc_option"));  //"xslproc options: ");
  +    System.out.println(resbundle.getString("optionIN"));  //"    -IN inputXMLURL");
  +    System.out.println(resbundle.getString("optionXSL"));  //"   [-XSL XSLTransformationURL]");
  +    System.out.println(resbundle.getString("optionOUT"));  //"   [-OUT outputFileName]");
  +
       // System.out.println(resbundle.getString("optionE")); //"   [-E (Do not expand entity refs)]");
  -    System.out.println(resbundle.getString("optionV")); //"   [-V (Version info)]");
  -    System.out.println(resbundle.getString("optionQC")); //"   [-QC (Quiet Pattern Conflicts Warnings)]");
  -    System.out.println(resbundle.getString("optionQ")); //"   [-Q  (Quiet Mode)]");
  -    System.out.println(resbundle.getString("optionTT")); //"   [-TT (Trace the templates as they are being called.)]");
  -    System.out.println(resbundle.getString("optionTG")); //"   [-TG (Trace each generation event.)]");
  -    System.out.println(resbundle.getString("optionTS")); //"   [-TS (Trace each selection event.)]");
  -    System.out.println(resbundle.getString("optionTTC")); //"   [-TTC (Trace the template children as they are being processed.)]");
  -    System.out.println(resbundle.getString("optionTCLASS")); //"   [-TCLASS (TraceListener class for trace extensions.)]");
  +    System.out.println(resbundle.getString("optionV"));  //"   [-V (Version info)]");
  +    System.out.println(resbundle.getString("optionQC"));  //"   [-QC (Quiet Pattern Conflicts Warnings)]");
  +    System.out.println(resbundle.getString("optionQ"));  //"   [-Q  (Quiet Mode)]");
  +    System.out.println(resbundle.getString("optionTT"));  //"   [-TT (Trace the templates as they are being called.)]");
  +    System.out.println(resbundle.getString("optionTG"));  //"   [-TG (Trace each generation event.)]");
  +    System.out.println(resbundle.getString("optionTS"));  //"   [-TS (Trace each selection event.)]");
  +    System.out.println(resbundle.getString("optionTTC"));  //"   [-TTC (Trace the template children as they are being processed.)]");
  +    System.out.println(resbundle.getString("optionTCLASS"));  //"   [-TCLASS (TraceListener class for trace extensions.)]");
  +
       // System.out.println(resbundle.getString("optionVALIDATE")); //"   [-VALIDATE (Set whether validation occurs.  Validation is off by default.)]");
  -    System.out.println(resbundle.getString("optionEDUMP")); //"   [-EDUMP {optional filename} (Do stackdump on error.)]");
  -    System.out.println(resbundle.getString("optionXML")); //"   [-XML (Use XML formatter and add XML header.)]");
  -    System.out.println(resbundle.getString("optionTEXT")); //"   [-TEXT (Use simple Text formatter.)]");
  -    System.out.println(resbundle.getString("optionHTML")); //"   [-HTML (Use HTML formatter.)]");
  -    System.out.println(resbundle.getString("optionPARAM")); //"   [-PARAM name expression (Set a stylesheet parameter)]");
  -    System.out.println("[-MEDIA use media attribute to find stylesheet associated with a document.]"); //"   [-PARAM name expression (Set a stylesheet parameter)]");
  +    System.out.println(resbundle.getString("optionEDUMP"));  //"   [-EDUMP {optional filename} (Do stackdump on error.)]");
  +    System.out.println(resbundle.getString("optionXML"));  //"   [-XML (Use XML formatter and add XML header.)]");
  +    System.out.println(resbundle.getString("optionTEXT"));  //"   [-TEXT (Use simple Text formatter.)]");
  +    System.out.println(resbundle.getString("optionHTML"));  //"   [-HTML (Use HTML formatter.)]");
  +    System.out.println(resbundle.getString("optionPARAM"));  //"   [-PARAM name expression (Set a stylesheet parameter)]");
  +    System.out.println(
  +      "[-MEDIA use media attribute to find stylesheet associated with a document.]");  //"   [-PARAM name expression (Set a stylesheet parameter)]");
     }
  -  
  +
  +  /** NEEDSDOC Field XSLT_PROPERTIES          */
     static String XSLT_PROPERTIES = "/org/apache/xalan/res/XSLTInfo.properties";
   
     /**
  @@ -162,9 +163,12 @@
      * the instructions found in the XSL stylesheet.
      *  <p>To set stylesheet parameters from the command line, use -PARAM name expression. If
      *  you want to set the parameter to a string value, enclose the string in single quotes (') to
  +   *
  +   * NEEDSDOC @param argv
      */
  -  public static void main( String argv[] )
  +  public static void main(String argv[])
     {
  +
       // Runtime.getRuntime().traceMethodCalls(false); // turns Java tracing off
       boolean doStackDumpOnError = false;
       boolean setQuietMode = false;
  @@ -172,33 +176,41 @@
   
       // Runtime.getRuntime().traceMethodCalls(false);
       // Runtime.getRuntime().traceInstructions(false);
  +
       /**
  -    * The default diagnostic writer...
  -    */
  +     * The default diagnostic writer...
  +     */
       java.io.PrintWriter diagnosticsWriter = new PrintWriter(System.err, true);
       java.io.PrintWriter dumpWriter = diagnosticsWriter;
  +    XSLTErrorResources resbundle =
  +      (XSLTErrorResources) (XSLMessages.loadResourceBundle(
  +        Constants.ERROR_RESOURCES));
   
  -    XSLTErrorResources resbundle = (XSLTErrorResources)(XSLMessages.loadResourceBundle(Constants.ERROR_RESOURCES));
       // loadPropertyFileToSystem(XSLT_PROPERTIES);
  -
  -    if(argv.length < 1)
  +    if (argv.length < 1)
       {
         printArgOptions(resbundle);
       }
       else
       {
         Processor processor;
  +
         try
         {
           processor = Processor.newInstance("xslt");
         }
  -      catch(ProcessorFactoryException pfe)
  +      catch (ProcessorFactoryException pfe)
         {
           pfe.printStackTrace(dumpWriter);
  -        diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful.");
  -        processor = null; // shut up compiler
  +        diagnosticsWriter.println(
  +          XSLMessages.createMessage(
  +            XSLTErrorResources.ER_NOT_SUCCESSFUL, null));  //"XSL Process was not successful.");
  +
  +        processor = null;  // shut up compiler
  +
           System.exit(-1);
         }
  +
         boolean formatOutput = false;
         String inFileName = null;
         String outFileName = null;
  @@ -212,127 +224,155 @@
         boolean quietConflictWarnings = false;
         boolean isSAX = false;
   
  -      for (int i = 0;  i < argv.length;  i ++)
  +      for (int i = 0; i < argv.length; i++)
         {
  -        if("-TT".equalsIgnoreCase(argv[i]))
  +        if ("-TT".equalsIgnoreCase(argv[i]))
           {
  -          if(null == tracer)
  +          if (null == tracer)
               tracer = new PrintTraceListener(diagnosticsWriter);
  +
             tracer.m_traceTemplates = true;
  +
             // processor.setTraceTemplates(true);
           }
  -        else if("-TG".equalsIgnoreCase(argv[i]))
  +        else if ("-TG".equalsIgnoreCase(argv[i]))
           {
  -          if(null == tracer)
  +          if (null == tracer)
               tracer = new PrintTraceListener(diagnosticsWriter);
  +
             tracer.m_traceGeneration = true;
  +
             // processor.setTraceSelect(true);
           }
  -        else if("-TS".equalsIgnoreCase(argv[i]))
  +        else if ("-TS".equalsIgnoreCase(argv[i]))
           {
  -          if(null == tracer)
  +          if (null == tracer)
               tracer = new PrintTraceListener(diagnosticsWriter);
  +
             tracer.m_traceSelection = true;
  +
             // processor.setTraceTemplates(true);
           }
  -        else if("-TTC".equalsIgnoreCase(argv[i]))
  +        else if ("-TTC".equalsIgnoreCase(argv[i]))
           {
  -          if(null == tracer)
  +          if (null == tracer)
               tracer = new PrintTraceListener(diagnosticsWriter);
  +
             tracer.m_traceElements = true;
  +
             // processor.setTraceTemplateChildren(true);
           }
           else if ("-INDENT".equalsIgnoreCase(argv[i]))
           {
             int indentAmount;
  -          if(((i+1) < argv.length) && (argv[i+1].charAt(0) != '-'))
  +
  +          if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-'))
             {
  -            indentAmount = Integer.parseInt( argv[++i] );
  +            indentAmount = Integer.parseInt(argv[++i]);
             }
             else
             {
               indentAmount = 0;
             }
  +
             // TBD:
             // xmlProcessorLiaison.setIndent(indentAmount);
           }
           else if ("-IN".equalsIgnoreCase(argv[i]))
           {
  -          if ( i+1 < argv.length)
  +          if (i + 1 < argv.length)
               inFileName = argv[++i];
             else
  -            System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-IN"})); //"Missing argument for);
  -
  +            System.err.println(
  +              XSLMessages.createMessage(
  +                XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                new Object[]{ "-IN" }));  //"Missing argument for);
           }
           else if ("-MEDIA".equalsIgnoreCase(argv[i]))
           {
  -          if ( i+1 < argv.length)
  +          if (i + 1 < argv.length)
               media = argv[++i];
             else
  -            System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-MEDIA"})); //"Missing argument for);
  -
  +            System.err.println(
  +              XSLMessages.createMessage(
  +                XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                new Object[]{ "-MEDIA" }));  //"Missing argument for);
           }
           else if ("-OUT".equalsIgnoreCase(argv[i]))
           {
  -          if ( i+1 < argv.length)
  +          if (i + 1 < argv.length)
               outFileName = argv[++i];
             else
  -            System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-OUT"})); //"Missing argument for);
  -
  +            System.err.println(
  +              XSLMessages.createMessage(
  +                XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                new Object[]{ "-OUT" }));  //"Missing argument for);
           }
           else if ("-XSL".equalsIgnoreCase(argv[i]))
           {
  -          if ( i+1 < argv.length)
  +          if (i + 1 < argv.length)
               xslFileName = argv[++i];
             else
  -            System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-XSL"})); //"Missing argument for);
  -
  +            System.err.println(
  +              XSLMessages.createMessage(
  +                XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                new Object[]{ "-XSL" }));  //"Missing argument for);
           }
           else if ("-PARAM".equalsIgnoreCase(argv[i]))
           {
  -          if ( i+2 < argv.length)
  +          if (i + 2 < argv.length)
             {
               String name = argv[++i];
  +
               params.addElement(name);
  +
               String expression = argv[++i];
  +
               params.addElement(expression);
             }
             else
  -            System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-PARAM"})); //"Missing argument for);
  -
  +            System.err.println(
  +              XSLMessages.createMessage(
  +                XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                new Object[]{ "-PARAM" }));  //"Missing argument for);
           }
           else if ("-treedump".equalsIgnoreCase(argv[i]))
           {
  -          if ( i+1 < argv.length)
  +          if (i + 1 < argv.length)
               treedumpFileName = argv[++i];
             else
  -            System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION, new Object[] {"-treedump"})); //"Missing argument for);
  -
  +            System.err.println(
  +              XSLMessages.createMessage(
  +                XSLTErrorResources.ER_MISSING_ARG_FOR_OPTION,
  +                new Object[]{ "-treedump" }));  //"Missing argument for);
           }
  -        else if("-F".equalsIgnoreCase(argv[i]))
  +        else if ("-F".equalsIgnoreCase(argv[i]))
           {
             formatOutput = true;
           }
  -        else if("-E".equalsIgnoreCase(argv[i]))
  +        else if ("-E".equalsIgnoreCase(argv[i]))
           {
  +
             // TBD:
             // xmlProcessorLiaison.setShouldExpandEntityRefs(false);
           }
  -        else if("-V".equalsIgnoreCase(argv[i]))
  +        else if ("-V".equalsIgnoreCase(argv[i]))
           {
  -          diagnosticsWriter.println(resbundle.getString("version") //">>>>>>> Xalan Version "
  -                                    +XSLProcessorVersion.S_VERSION+", "+
  -                                    /* xmlProcessorLiaison.getParserDescription()+ */
  -                                    resbundle.getString("version2"));// "<<<<<<<");
  +          diagnosticsWriter.println(resbundle.getString("version")  //">>>>>>> Xalan Version "
  +                                    + XSLProcessorVersion.S_VERSION + ", " +
  +
  +          /* xmlProcessorLiaison.getParserDescription()+ */
  +          resbundle.getString("version2"));  // "<<<<<<<");
           }
  -        else if("-QC".equalsIgnoreCase(argv[i]))
  +        else if ("-QC".equalsIgnoreCase(argv[i]))
           {
             quietConflictWarnings = true;
           }
  -        else if("-Q".equalsIgnoreCase(argv[i]))
  +        else if ("-Q".equalsIgnoreCase(argv[i]))
           {
             setQuietMode = true;
           }
  +
           /*
           else if("-VALIDATE".equalsIgnoreCase(argv[i]))
           {
  @@ -349,191 +389,227 @@
             // xmlProcessorLiaison.setUseValidation(shouldValidate.equalsIgnoreCase("yes"));
           }
           */
  -        else if("-DIAG".equalsIgnoreCase(argv[i]))
  +        else if ("-DIAG".equalsIgnoreCase(argv[i]))
           {
             doDiag = true;
           }
  -        else if("-XML".equalsIgnoreCase(argv[i]))
  +        else if ("-XML".equalsIgnoreCase(argv[i]))
           {
             outputType = "xml";
           }
  -        else if("-TEXT".equalsIgnoreCase(argv[i]))
  +        else if ("-TEXT".equalsIgnoreCase(argv[i]))
           {
             outputType = "text";
           }
  -        else if("-HTML".equalsIgnoreCase(argv[i]))
  +        else if ("-HTML".equalsIgnoreCase(argv[i]))
           {
             outputType = "html";
           }
  -        else if("-SAX".equalsIgnoreCase(argv[i]))
  +        else if ("-SAX".equalsIgnoreCase(argv[i]))
           {
             isSAX = true;
  -        }      
  -        else if("-EDUMP".equalsIgnoreCase(argv[i]))
  +        }
  +        else if ("-EDUMP".equalsIgnoreCase(argv[i]))
           {
             doStackDumpOnError = true;
  -          if(((i+1) < argv.length) && (argv[i+1].charAt(0) != '-'))
  +
  +          if (((i + 1) < argv.length) && (argv[i + 1].charAt(0) != '-'))
             {
               dumpFileName = argv[++i];
             }
           }
           else
  -          System.err.println(XSLMessages.createMessage(XSLTErrorResources.ER_INVALID_OPTION, new Object[] {argv[i]})); //"Invalid argument:);
  -
  +          System.err.println(
  +            XSLMessages.createMessage(
  +              XSLTErrorResources.ER_INVALID_OPTION, new Object[]{ argv[i] }));  //"Invalid argument:);
         }
   
         // The main XSL transformation occurs here!
         try
         {
           long start = System.currentTimeMillis();
  -        if(null != dumpFileName)
  +
  +        if (null != dumpFileName)
           {
  -          dumpWriter = new PrintWriter( new FileWriter(dumpFileName) );
  +          dumpWriter = new PrintWriter(new FileWriter(dumpFileName));
           }
  -
  -        Templates stylesheet = (null != xslFileName) 
  -                               ? processor.process(new InputSource(xslFileName))
  -                                 : null;
   
  +        Templates stylesheet =
  +          (null != xslFileName)
  +          ? processor.process(new InputSource(xslFileName)) : null;
           PrintWriter resultWriter;
  +        OutputStream outputStream = (null != outFileName)
  +                                    ? new FileOutputStream(outFileName)
  +                                    : (OutputStream) System.out;
   
  -        OutputStream outputStream = (null != outFileName) ? 
  -                                    new FileOutputStream(outFileName) :
  -                                    (OutputStream)System.out;
  -
           // Did they pass in a stylesheet, or should we get it from the 
           // document?
  -        if(null == stylesheet)
  +        if (null == stylesheet)
           {
  -          InputSource[] sources 
  -            = processor.getAssociatedStylesheets(new InputSource(inFileName),
  -                                                 media, null, null);
  -          if((null != sources) && (sources.length > 0))
  +          InputSource[] sources =
  +            processor.getAssociatedStylesheets(new InputSource(inFileName),
  +                                               media, null, null);
  +
  +          if ((null != sources) && (sources.length > 0))
               stylesheet = processor.processMultiple(sources);
             else
             {
  -            if(null != media)
  -              throw new SAXException("No stylesheet found in: "+inFileName+", media="+media);
  +            if (null != media)
  +              throw new SAXException("No stylesheet found in: " + inFileName
  +                                     + ", media=" + media);
               else
  -              throw new SAXException("No xml-stylesheet PI found in: "+inFileName);
  +              throw new SAXException("No xml-stylesheet PI found in: "
  +                                     + inFileName);
             }
           }
   
  -        if(null != stylesheet)
  +        if (null != stylesheet)
           {
             Transformer transformer = stylesheet.newTransformer();
  -          
  +
             // Override the output format?
  -          if(null != outputType)
  +          if (null != outputType)
             {
               OutputFormat of = stylesheet.getOutputFormat();
  +
               of.setMethod(outputType);
               transformer.setOutputFormat(of);
             }
  -          
  -          if(transformer instanceof TransformerImpl)
  +
  +          if (transformer instanceof TransformerImpl)
             {
  -            TransformerImpl impl = ((TransformerImpl)transformer);
  +            TransformerImpl impl = ((TransformerImpl) transformer);
               TraceManager tm = impl.getTraceManager();
  -            
  -            if(null != tracer)
  +
  +            if (null != tracer)
                 tm.addTraceListener(tracer);
  -            
  +
               impl.setQuietConflictWarnings(quietConflictWarnings);
  -            // impl.setDiagnosticsOutput( setQuietMode ? null : diagnosticsWriter );
   
  +            // impl.setDiagnosticsOutput( setQuietMode ? null : diagnosticsWriter );
             }
  +
             int nParams = params.size();
  -          for(int i = 0; i < nParams; i+=2)
  -            transformer.setParameter((String)params.elementAt(i), null,
  -                                     (String)params.elementAt(i+1));
  -          
  -          if(null != inFileName)
  +
  +          for (int i = 0; i < nParams; i += 2)
  +          {
  +            transformer.setParameter((String) params.elementAt(i), null,
  +                                     (String) params.elementAt(i + 1));
  +          }
  +
  +          if (null != inFileName)
             {
  -            if(isSAX)
  +            if (isSAX)
               {
                 OutputFormat format = stylesheet.getOutputFormat();
  -              if(null != outputType)
  +
  +              if (null != outputType)
                   format.setMethod(outputType);
  +
                 Serializer serializer = SerializerFactory.getSerializer(format);
  +
                 serializer.setOutputStream(outputStream);
                 transformer.setContentHandler(serializer.asContentHandler());
                 transformer.setProperty("http://xml.apache.org/xslt/sourcebase",
                                         inFileName);
   
                 XMLReader reader = XMLReaderFactory.createXMLReader();
  -              
  -              reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
  -              reader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
  -              
  +
  +              reader.setFeature(
  +                "http://xml.org/sax/features/namespace-prefixes", true);
  +              reader.setFeature(
  +                "http://apache.org/xml/features/validation/dynamic", true);
  +
                 ContentHandler chandler = transformer.getInputContentHandler();
  +
                 reader.setContentHandler(chandler);
  -              
  -              if(chandler instanceof org.xml.sax.ext.LexicalHandler)
  -                reader.setProperty("http://xml.org/sax/properties/lexical-handler", chandler);
  +
  +              if (chandler instanceof org.xml.sax.ext.LexicalHandler)
  +                reader.setProperty(
  +                  "http://xml.org/sax/properties/lexical-handler", chandler);
                 else
  -                reader.setProperty("http://xml.org/sax/properties/lexical-handler", null);
  +                reader.setProperty(
  +                  "http://xml.org/sax/properties/lexical-handler", null);
   
                 reader.parse(inFileName);
               }
               else
               {
  -              transformer.transform(new InputSource(inFileName), new Result(outputStream));
  +              transformer.transform(new InputSource(inFileName),
  +                                    new Result(outputStream));
               }
             }
             else
             {
  -            StringReader reader = new StringReader("<?xml version=\"1.0\"?> <doc/>");
  -            transformer.transform(new InputSource(reader), new Result(outputStream));
  +            StringReader reader =
  +              new StringReader("<?xml version=\"1.0\"?> <doc/>");
  +
  +            transformer.transform(new InputSource(reader),
  +                                  new Result(outputStream));
             }
           }
           else
           {
  -          diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful.");
  +          diagnosticsWriter.println(
  +            XSLMessages.createMessage(
  +              XSLTErrorResources.ER_NOT_SUCCESSFUL, null));  //"XSL Process was not successful.");
             System.exit(-1);
           }
  +
           long stop = System.currentTimeMillis();
           long millisecondsDuration = stop - start;
  -        if(doDiag)
  -          diagnosticsWriter.println("\n\n========\nTransform of "+inFileName+" via "+xslFileName+" took "+millisecondsDuration+" ms");
  +
  +        if (doDiag)
  +          diagnosticsWriter.println("\n\n========\nTransform of "
  +                                    + inFileName + " via " + xslFileName
  +                                    + " took " + millisecondsDuration
  +                                    + " ms");
         }
  -      catch(Throwable throwable)
  +      catch (Throwable throwable)
         {
  -        while(throwable instanceof org.apache.xalan.utils.WrappedRuntimeException)
  -          throwable = ((org.apache.xalan.utils.WrappedRuntimeException)throwable).getException();
  +        while (throwable
  +               instanceof org.apache.xalan.utils.WrappedRuntimeException)
  +        {
  +          throwable =
  +            ((org.apache.xalan.utils.WrappedRuntimeException) throwable).getException();
  +        }
   
  -        if((throwable instanceof NullPointerException) ||
  -           (throwable instanceof ClassCastException)
  -           )
  +        if ((throwable instanceof NullPointerException)
  +                || (throwable instanceof ClassCastException))
             doStackDumpOnError = true;
  -        
  -        if(doStackDumpOnError)
  +
  +        if (doStackDumpOnError)
             throwable.printStackTrace(dumpWriter);
           else
  -          diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_XSLT_ERROR, null)
  -                                    +" ("+throwable.getClass().getName()+"): " 
  -                                    + throwable.getMessage());        
  -        
  +          diagnosticsWriter.println(
  +            XSLMessages.createMessage(XSLTErrorResources.ER_XSLT_ERROR, null)
  +            + " (" + throwable.getClass().getName() + "): "
  +            + throwable.getMessage());
  +
           // diagnosticsWriter.println(XSLMessages.createMessage(XSLTErrorResources.ER_NOT_SUCCESSFUL, null)); //"XSL Process was not successful.");
  -        if(null != dumpFileName)
  +        if (null != dumpFileName)
           {
             dumpWriter.close();
           }
  +
           System.exit(-1);
         }
   
  -      if(null != dumpFileName)
  +      if (null != dumpFileName)
         {
           dumpWriter.close();
         }
  -      if(null != diagnosticsWriter)
  +
  +      if (null != diagnosticsWriter)
         {
  +
           // diagnosticsWriter.close();
         }
  +
         // if(!setQuietMode)
         //  diagnosticsWriter.println(resbundle.getString("xsldone")); //"Xalan: done");
         // else
  -        diagnosticsWriter.println(""); //"Xalan: done");
  +      diagnosticsWriter.println("");  //"Xalan: done");
       }
     }
   }
  
  
  
  1.2       +75 -34    xml-xalan/java/src/org/apache/xpath/Arg.java
  
  Index: Arg.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/Arg.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Arg.java	2000/07/05 14:44:17	1.1
  +++ Arg.java	2000/10/30 18:58:20	1.2
  @@ -61,73 +61,92 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * This class holds an instance of an argument on 
  + * This class holds an instance of an argument on
    * the stack.
    */
   public class Arg
   {
  +
  +  /** NEEDSDOC Field m_qname          */
     private QName m_qname;
  -  
  +
     /**
      * Get the qualified name for this argument.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public QName getQName()
     {
  -	  return m_qname;
  +    return m_qname;
     }
   
     /**
      * Set the qualified name for this argument.
  +   *
  +   * NEEDSDOC @param name
      */
     public void setQName(QName name)
     {
  -	  m_qname = name;
  +    m_qname = name;
     }
  -  
  +
  +  /** NEEDSDOC Field m_val          */
     private XObject m_val;
  -  
  +
     /**
      * Get the value for this argument.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public XObject getVal()
     {
  -	  return m_val;
  +    return m_val;
     }
   
     /**
      * Set the value for this argument.
  +   *
  +   * NEEDSDOC @param val
      */
     public void setVal(XObject val)
     {
  -	  m_val = val;
  +    m_val = val;
     }
  -  
  +
  +  /** NEEDSDOC Field m_expression          */
     private String m_expression;
  -  
  +
     /**
      * Get the value expression for this argument.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getExpression()
     {
  -	  return m_expression;
  +    return m_expression;
     }
   
     /**
      * Set the value expression for this argument.
  +   *
  +   * NEEDSDOC @param expr
      */
     public void setExpression(String expr)
     {
  -	  m_expression = expr;
  +    m_expression = expr;
     }
   
  +  /** NEEDSDOC Field m_isParamVar          */
     private boolean m_isParamVar;
  -  
  +
     /**
      * Construct a dummy parameter argument.
      */
     public Arg()
     {
  -    m_qname = new QName("");; // so that string compares can be done.
  +
  +    m_qname = new QName("");
  +    ;  // so that string compares can be done.
       m_val = null;
       m_expression = null;
       m_isParamVar = false;
  @@ -135,9 +154,14 @@
   
     /**
      * Construct a parameter argument.
  +   *
  +   * NEEDSDOC @param qname
  +   * NEEDSDOC @param expression
  +   * NEEDSDOC @param isParamVar
      */
     public Arg(QName qname, String expression, boolean isParamVar)
     {
  +
       m_qname = qname;
       m_val = null;
       m_expression = expression;
  @@ -146,21 +170,29 @@
   
     /**
      * Construct a parameter argument.
  +   *
  +   * NEEDSDOC @param qname
  +   * NEEDSDOC @param val
      */
     public Arg(QName qname, XObject val)
     {
  +
       m_qname = qname;
       m_val = val;
       m_isParamVar = false;
       m_expression = null;
     }
   
  -
     /**
      * Construct a parameter argument.
  +   *
  +   * NEEDSDOC @param qname
  +   * NEEDSDOC @param val
  +   * NEEDSDOC @param isParamVar
      */
     public Arg(QName qname, XObject val, boolean isParamVar)
     {
  +
       m_qname = qname;
       m_val = val;
       m_isParamVar = isParamVar;
  @@ -168,45 +200,54 @@
     }
   
     /**
  -   * Override equals and agree that we're equal if 
  -   * the passed object is a string and it matches 
  +   * Override equals and agree that we're equal if
  +   * the passed object is a string and it matches
      * the name of the arg.
  +   *
  +   * NEEDSDOC @param obj
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean equals(Object obj)
     {
  +
       try
       {
  -      if(m_qname != null)
  +      if (m_qname != null)
         {
  -        QName qname = (QName)obj;
  -        return m_qname.equals(qname.getLocalPart()) 
  -               && ((null != m_qname.getNamespace()) && (null != qname.getNamespace())) 
  +        QName qname = (QName) obj;
  +
  +        return m_qname.equals(qname.getLocalPart()) && ((null != m_qname.getNamespace()) && (null != qname.getNamespace()))
                  ? m_qname.getNamespace().equals(qname.getNamespace())
  -                 : ((null == m_qname.getNamespace()) && (null == qname.getNamespace()));
  +               : ((null == m_qname.getNamespace()) && (null == qname.getNamespace()));
         }
  -    }
  -    catch(ClassCastException cce)
  -    {
       }
  -    
  +    catch (ClassCastException cce){}
  +
       return false;
     }
   
     /**
  -   * Override equals and agree that we're equal if 
  -   * the passed object is a QName and it matches 
  +   * Override equals and agree that we're equal if
  +   * the passed object is a QName and it matches
      * the name of the arg.
  +   *
  +   * NEEDSDOC @param qname
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean equals(QName qname)
     {
  -    if(m_qname != null)
  +
  +    if (m_qname != null)
       {
  -      return m_qname.getLocalPart().equals(qname.getLocalPart()) 
  -             && (((null != m_qname.getNamespace()) && (null != qname.getNamespace())) 
  +      return m_qname.getLocalPart().equals(qname.getLocalPart())
  +             && (((null != m_qname.getNamespace()) && (null != qname.getNamespace()))
                    ? m_qname.getNamespace().equals(qname.getNamespace())
  -                   : ((null == m_qname.getNamespace()) && (null == qname.getNamespace())));
  +                 : ((null == m_qname.getNamespace())
  +                    && (null == qname.getNamespace())));
       }
  +
       return false;
     }
  -
  -}
  \ No newline at end of file
  +}
  
  
  
  1.8       +101 -44   xml-xalan/java/src/org/apache/xpath/DOM2Helper.java
  
  Index: DOM2Helper.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/DOM2Helper.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOM2Helper.java	2000/10/05 18:56:52	1.7
  +++ DOM2Helper.java	2000/10/30 18:58:20	1.8
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -57,6 +57,7 @@
   package org.apache.xpath;
   
   import java.io.IOException;
  +
   import java.util.StringTokenizer;
   
   import org.apache.xpath.res.XPATHErrorResources;
  @@ -77,52 +78,77 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * Provides XSLTProcessor an interface to the Xerces XML parser.  This 
  - * liaison should be used if Xerces DOM nodes are being process as 
  + * Provides XSLTProcessor an interface to the Xerces XML parser.  This
  + * liaison should be used if Xerces DOM nodes are being process as
    * the source tree or as the result tree.
    * @see org.apache.xalan.xslt.XSLTProcessor
    * @see org.apache.xml.parsers
    */
   public class DOM2Helper extends DOMHelper
   {
  +
     /**
      * Construct an instance.
      */
  -  public DOM2Helper()
  -  {
  -  }
  +  public DOM2Helper(){}
   
     /**
      * <meta name="usage" content="internal"/>
      * Check node to see if it matches this liaison.
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * @throws SAXException
      */
  -  public void checkNode(Node node)
  -    throws SAXException
  +  public void checkNode(Node node) throws SAXException
     {
  +
       // if(!(node instanceof org.apache.xerces.dom.NodeImpl))
       //  throw new SAXException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_XERCES_CANNOT_HANDLE_NODES, new Object[]{((Object)node).getClass()})); //"DOM2Helper can not handle nodes of type"
  -        //+((Object)node).getClass());
  +    //+((Object)node).getClass());
     }
   
     /**
      * Returns true that this implementation does support
      * the SAX ContentHandler interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean supportsSAX()
     {
       return true;
     }
  -  
  +
  +  /** NEEDSDOC Field m_doc          */
     private Document m_doc;
  -  
  -  public void setDocument(Document doc) {m_doc = doc;}
  -  public Document getDocument() {return m_doc;}
  +
  +  /**
  +   * NEEDSDOC Method setDocument 
  +   *
  +   *
  +   * NEEDSDOC @param doc
  +   */
  +  public void setDocument(Document doc)
  +  {
  +    m_doc = doc;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method getDocument 
  +   *
  +   *
  +   * NEEDSDOC (getDocument) @return
  +   */
  +  public Document getDocument()
  +  {
  +    return m_doc;
  +  }
   
     /**
      * <meta name="usage" content="internal"/>
      * Parse an XML document.
  -   * 
  -   * <p>Right now the Xerces DOMParser class is used.  This needs 
  +   *
  +   * <p>Right now the Xerces DOMParser class is used.  This needs
      * fixing, either via jaxp, or via some other, standard method.</p>
      *
      * <p>The application can use this method to instruct the SAX parser
  @@ -148,21 +174,26 @@
      * @see #setDTDHandler
      * @see #setContentHandler
      * @see #setErrorHandler
  +   *
  +   * @throws SAXException
      */
  -  public void parse (InputSource source)
  -    throws SAXException
  +  public void parse(InputSource source) throws SAXException
     {
  +
       try
       {
  +
         // I guess I should use JAXP factory here... when it's legal.
         // org.apache.xerces.parsers.DOMParser parser 
         //  = new org.apache.xerces.parsers.DOMParser();
  -      DocumentBuilderFactory builderFactory 
  -        = DocumentBuilderFactory.newInstance();
  +      DocumentBuilderFactory builderFactory =
  +        DocumentBuilderFactory.newInstance();
  +
         builderFactory.setNamespaceAware(true);
         builderFactory.setValidating(true);
  +
         DocumentBuilder parser = builderFactory.newDocumentBuilder();
  -      
  +
         /*
         // domParser.setFeature("http://apache.org/xml/features/dom/create-entity-ref-nodes", getShouldExpandEntityRefs()? false : true);
         if(m_useDOM2getNamespaceURI)
  @@ -174,96 +205,122 @@
         {
         parser.setFeature("http://apache.org/xml/features/dom/defer-node-expansion", false);
         }
  -      
  +
         parser.setFeature("http://apache.org/xml/features/allow-java-encodings", true);
         */
         String ident = (null == source.getSystemId())
                        ? "Input XSL" : source.getSystemId();
  -      parser.setErrorHandler(new org.apache.xalan.utils.DefaultErrorHandler(ident));
  +
  +      parser.setErrorHandler(
  +        new org.apache.xalan.utils.DefaultErrorHandler(ident));
   
         // if(null != m_entityResolver)
         // {
         // System.out.println("Setting the entity resolver.");
         //  parser.setEntityResolver(m_entityResolver);
         // }
  -
         setDocument(parser.parse(source));
       }
  -    catch(ParserConfigurationException pce)
  +    catch (ParserConfigurationException pce)
       {
         throw new SAXException(pce);
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
         throw new SAXException(ioe);
       }
  +
       // setDocument(((org.apache.xerces.parsers.DOMParser)parser).getDocument());
     }
   
     /**
      * Given an ID, return the element.
  +   *
  +   * NEEDSDOC @param id
  +   * NEEDSDOC @param doc
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Element getElementByID(String id, Document doc)
     {
       return doc.getElementById(id);
     }
  -  
  +
     /**
  -   * Figure out if node2 should be placed after node1 when 
  -   * placing nodes in a list that is to be sorted in 
  +   * Figure out if node2 should be placed after node1 when
  +   * placing nodes in a list that is to be sorted in
      * document order.
      * NOTE: Make sure this does the right thing with attribute nodes!!!
  -   * @return true if node2 should be placed 
  -   * after node1, and false if node2 should be placed 
  +   *
  +   * NEEDSDOC @param node1
  +   * NEEDSDOC @param node2
  +   * @return true if node2 should be placed
  +   * after node1, and false if node2 should be placed
      * before node1.
      */
     public boolean isNodeAfter(Node node1, Node node2)
     {
  +
       // Assume first that the nodes are DTM nodes, since discovering node 
       // order is massivly faster for the DTM.
       try
       {
  -      int index1 = ((DOMOrder)node1).getUid();
  -      int index2 = ((DOMOrder)node2).getUid();
  +      int index1 = ((DOMOrder) node1).getUid();
  +      int index2 = ((DOMOrder) node2).getUid();
  +
         return index1 <= index2;
       }
  -    catch(ClassCastException cce)
  +    catch (ClassCastException cce)
       {
  +
         // isNodeAfter will return true if node is after countedNode 
         // in document order. isDOMNodeAfter is sloooow (relativly).
         return super.isNodeAfter(node1, node2);
       }
  -  }   
  +  }
   
     /**
      * Get the parent of a node.
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws RuntimeException
      */
  -  public Node getParentOfNode(Node node)
  -    throws RuntimeException
  +  public Node getParentOfNode(Node node) throws RuntimeException
     {
       return (Node.ATTRIBUTE_NODE == node.getNodeType())
  -           ? ((Attr)node).getOwnerElement() : node.getParentNode();
  +           ? ((Attr) node).getOwnerElement() : node.getParentNode();
     }
  -    
  +
     /**
      * Returns the local name of the given node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getLocalNameOfNode(Node n)
     {
  +
       String name = n.getLocalName();
  +
       return (null == name) ? super.getLocalNameOfNode(n) : name;
     }
   
     /**
      * Returns the namespace of the given node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNamespaceOfNode(Node n)
     {
       return n.getNamespaceURI();
     }
   
  +  /** NEEDSDOC Field m_useDOM2getNamespaceURI          */
     private boolean m_useDOM2getNamespaceURI = false;
  -
   }
  -
  -
  
  
  
  1.8       +531 -227  xml-xalan/java/src/org/apache/xpath/DOMHelper.java
  
  Index: DOMHelper.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/DOMHelper.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- DOMHelper.java	2000/10/18 04:36:47	1.7
  +++ DOMHelper.java	2000/10/30 18:58:21	1.8
  @@ -1,9 +1,68 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath;
   
   import java.util.Hashtable;
   import java.util.Vector;
  +
   import org.w3c.dom.*;
  +
   import org.xml.sax.SAXException;
  +
   import org.apache.xalan.utils.NSInfo;
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.utils.StringBufferPool;
  @@ -14,83 +73,111 @@
   // Imported JAVA API for XML Parsing 1.0 classes
   import javax.xml.parsers.DocumentBuilder;
   import javax.xml.parsers.DocumentBuilderFactory;
  -import javax.xml.parsers.ParserConfigurationException; 
  +import javax.xml.parsers.ParserConfigurationException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class DOMHelper <needs-comment/>
  + */
   public class DOMHelper
   {
  +
     /**
  -   * Used as a helper for handling DOM issues.  May be subclassed to take advantage 
  +   * Used as a helper for handling DOM issues.  May be subclassed to take advantage
      * of specific DOM implementations.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Document createDocument()
     {
  +
       try
       {
  +
         // Use an implementation of the JAVA API for XML Parsing 1.0 to
         // create a DOM Document node to contain the result.
         DocumentBuilderFactory dfactory = DocumentBuilderFactory.newInstance();
  +
         dfactory.setNamespaceAware(true);
         dfactory.setValidating(true);
  +
         DocumentBuilder docBuilder = dfactory.newDocumentBuilder();
         Document outNode = docBuilder.newDocument();
  +
         return outNode;
       }
  -    catch(ParserConfigurationException pce)
  +    catch (ParserConfigurationException pce)
       {
  -      throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED, null));//"createDocument() not supported in XPathContext!");
  +      throw new RuntimeException(
  +        XSLMessages.createXPATHMessage(
  +          XPATHErrorResources.ER_CREATEDOCUMENT_NOT_SUPPORTED, null));  //"createDocument() not supported in XPathContext!");
  +
         // return null;
       }
     }
   
     /**
      * <meta name="usage" content="advanced"/>
  -   * Tells, through the combination of the default-space attribute 
  +   * Tells, through the combination of the default-space attribute
      * on xsl:stylesheet, xsl:strip-space, xsl:preserve-space, and the
  -   * xml:space attribute, whether or not extra whitespace should be stripped 
  -   * from the node.  Literal elements from template elements should 
  +   * xml:space attribute, whether or not extra whitespace should be stripped
  +   * from the node.  Literal elements from template elements should
      * <em>not</em> be tested with this function.
      * @param textNode A text node from the source tree.
      * @return true if the text node should be stripped of extra whitespace.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public boolean shouldStripSourceNode(Node textNode)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       // return (null == m_envSupport) ? false : m_envSupport.shouldStripSourceNode(textNode);
       return false;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getUniqueID 
  +   *
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC (getUniqueID) @return
  +   */
     public String getUniqueID(Node node)
     {
  -    return "N"+Integer.toHexString(node.hashCode());
  +    return "N" + Integer.toHexString(node.hashCode());
     }
  -  
  +
     /**
  -   * Figure out if node2 should be placed after node1 in 
  +   * Figure out if node2 should be placed after node1 in
      * document order (returns node1 &lt;= node2).
      * NOTE: Make sure this does the right thing with attribute nodes!!!
  -   * @return true if node2 should be placed 
  -   * after node1, and false if node2 should be placed 
  +   *
  +   * NEEDSDOC @param node1
  +   * NEEDSDOC @param node2
  +   * @return true if node2 should be placed
  +   * after node1, and false if node2 should be placed
      * before node1.
      */
     public boolean isNodeAfter(Node node1, Node node2)
     {
  -    if(node1 == node2)
  +
  +    if (node1 == node2)
         return true;
   
  -    boolean isNodeAfter = false; // return value.
  -    
  +    boolean isNodeAfter = false;  // return value.
       Node parent1 = getParentOfNode(node1);
       Node parent2 = getParentOfNode(node2);
  -    
  +
       // Optimize for most common case
  -    if(parent1 == parent2) // then we know they are siblings
  +    if (parent1 == parent2)  // then we know they are siblings
       {
         if (null != parent1)
  -        isNodeAfter = isNodeAfterSibling(
  -                                       parent1, node1, node2);
  +        isNodeAfter = isNodeAfterSibling(parent1, node1, node2);
         else
         {
  -        if(node1 == node2) // Same document?
  +        if (node1 == node2)  // Same document?
             return false;
           else
             return true;
  @@ -98,199 +185,245 @@
       }
       else
       {
  +
         // General strategy: Figure out the lengths of the two 
         // ancestor chains, and walk up them looking for the 
         // first common ancestor, at which point we can do a 
         // sibling compare.  Edge condition where one is the 
         // ancestor of the other.
  -      
         // Count parents, so we can see if one of the chains 
         // needs to be equalized.
  -      int nParents1 = 2, nParents2 = 2; // count node & parent obtained above
  -      while(parent1 != null)
  +      int nParents1 = 2, nParents2 = 2;  // count node & parent obtained above
  +
  +      while (parent1 != null)
         {
           nParents1++;
  +
           parent1 = getParentOfNode(parent1);
         }
  -      
  -      while(parent2 != null)
  +
  +      while (parent2 != null)
         {
           nParents2++;
  +
           parent2 = getParentOfNode(parent2);
         }
  -      
  -      Node startNode1 = node1, startNode2 = node2; // adjustable starting points
  -      
  +
  +      Node startNode1 = node1, startNode2 = node2;  // adjustable starting points
  +
         // Do I have to adjust the start point in one of 
         // the ancesor chains?
  -      if(nParents1 < nParents2)
  +      if (nParents1 < nParents2)
         {
  +
           // adjust startNode2
           int adjust = nParents2 - nParents1;
  -        for(int i = 0; i < adjust; i++)
  +
  +        for (int i = 0; i < adjust; i++)
           {
             startNode2 = getParentOfNode(startNode2);
           }
         }
  -      else if(nParents1 > nParents2)
  +      else if (nParents1 > nParents2)
         {
  +
           // adjust startNode1
           int adjust = nParents1 - nParents2;
  -        for(int i = 0; i < adjust; i++)
  +
  +        for (int i = 0; i < adjust; i++)
           {
             startNode1 = getParentOfNode(startNode1);
           }
         }
  -      
  -      Node prevChild1 = null, prevChild2 = null; // so we can "back up"
  -      
  +
  +      Node prevChild1 = null, prevChild2 = null;  // so we can "back up"
  +
         // Loop up the ancestor chain looking for common parent.
  -      while(null != startNode1)
  +      while (null != startNode1)
         {
  -        if(startNode1 == startNode2) // common parent?
  +        if (startNode1 == startNode2)  // common parent?
           {
  -          if(null == prevChild1) // first time in loop?
  +          if (null == prevChild1)  // first time in loop?
             {
  +
               // Edge condition: one is the ancestor of the other.
               isNodeAfter = (nParents1 < nParents2) ? true : false;
  -            break; // from while loop
  +
  +            break;  // from while loop
             }
             else
             {
  -            isNodeAfter = isNodeAfterSibling(
  -                                             startNode1, prevChild1, prevChild2);
  -            break; // from while loop
  +            isNodeAfter = isNodeAfterSibling(startNode1, prevChild1,
  +                                             prevChild2);
  +
  +            break;  // from while loop
             }
  -        } // end if(startNode1 == startNode2)
  +        }  // end if(startNode1 == startNode2)
  +
           prevChild1 = startNode1;
           startNode1 = getParentOfNode(startNode1);
           prevChild2 = startNode2;
           startNode2 = getParentOfNode(startNode2);
  -      } // end while
  -    } // end big else
  -    
  +      }  // end while
  +    }  // end big else
  +
       /* -- please do not remove... very useful for diagnostics --
       System.out.println("node1 = "+node1.getNodeName()+"("+node1.getNodeType()+")"+
       ", node2 = "+node2.getNodeName()
       +"("+node2.getNodeType()+")"+
       ", isNodeAfter = "+isNodeAfter); */
  -    
       return isNodeAfter;
  -  } // end isNodeAfter(Node node1, Node node2)
  -  
  +  }  // end isNodeAfter(Node node1, Node node2)
  +
     /**
      * Figure out if child2 is after child1 in document order.
      * @param parent Must be the parent of child1 and child2.
      * @param child1 Must be the child of parent and not equal to child2.
      * @param child2 Must be the child of parent and not equal to child1.
      * @returns true if child 2 is after child1 in document order.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private static boolean isNodeAfterSibling(
  -                                     Node parent, Node child1, Node child2)
  +  private static boolean isNodeAfterSibling(Node parent, Node child1,
  +                                            Node child2)
     {
  +
       boolean isNodeAfterSibling = false;
  -    int child1type = child1.getNodeType();
  -    int child2type = child2.getNodeType();
  -    if((Node.ATTRIBUTE_NODE != child1type) && (Node.ATTRIBUTE_NODE == child2type))
  +    short child1type = child1.getNodeType();
  +    short child2type = child2.getNodeType();
  +
  +    if ((Node.ATTRIBUTE_NODE != child1type)
  +            && (Node.ATTRIBUTE_NODE == child2type))
       {
  +
         // always sort attributes before non-attributes.
         isNodeAfterSibling = false;
       }
  -    else if((Node.ATTRIBUTE_NODE == child1type) && (Node.ATTRIBUTE_NODE != child2type))
  +    else if ((Node.ATTRIBUTE_NODE == child1type)
  +             && (Node.ATTRIBUTE_NODE != child2type))
       {
  +
         // always sort attributes before non-attributes.
         isNodeAfterSibling = true;
       }
  -    else if(Node.ATTRIBUTE_NODE == child1type)
  +    else if (Node.ATTRIBUTE_NODE == child1type)
       {
         NamedNodeMap children = parent.getAttributes();
         int nNodes = children.getLength();
         boolean found1 = false, found2 = false;
  -      for(int i = 0; i < nNodes; i++)
  +
  +      for (int i = 0; i < nNodes; i++)
         {
           Node child = children.item(i);
  -        if(child1 == child)
  +
  +        if (child1 == child)
           {
  -          if(found2)
  +          if (found2)
             {
               isNodeAfterSibling = false;
  +
               break;
             }
  +
             found1 = true;
           }
  -        else if(child2 == child)
  +        else if (child2 == child)
           {
  -          if(found1)
  +          if (found1)
             {
               isNodeAfterSibling = true;
  +
               break;
             }
  +
             found2 = true;
           }
         }
       }
       else
       {
  +
         // NodeList children = parent.getChildNodes();
         // int nNodes = children.getLength();
         Node child = parent.getFirstChild();
         boolean found1 = false, found2 = false;
  -      while(null != child)
  +
  +      while (null != child)
         {
  +
           // Node child = children.item(i);
  -        if(child1 == child)
  +        if (child1 == child)
           {
  -          if(found2)
  +          if (found2)
             {
               isNodeAfterSibling = false;
  +
               break;
             }
  +
             found1 = true;
           }
  -        else if(child2 == child)
  +        else if (child2 == child)
           {
  -          if(found1)
  +          if (found1)
             {
               isNodeAfterSibling = true;
  +
               break;
             }
  +
             found2 = true;
           }
  +
           child = child.getNextSibling();
         }
       }
  +
       return isNodeAfterSibling;
  -  } // end isNodeAfterSibling(Node parent, Node child1, Node child2)
  -  
  -  
  +  }  // end isNodeAfterSibling(Node parent, Node child1, Node child2)
  +
     //==========================================================
     // SECTION: Namespace resolution
     //==========================================================
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get the depth level of this node in the tree (count from 1).
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public short getLevel(Node n)
     {
  +
       short level = 1;
  -    while(null != (n = getParentOfNode(n)))
  +
  +    while (null != (n = getParentOfNode(n)))
       {
         level++;
       }
  +
       return level;
     }
  -  
  +
     /**
      * Given a prefix and a namespace context, return the expanded namespace.
  -   * Default handling: 
  +   * Default handling:
  +   *
  +   * NEEDSDOC @param prefix
  +   * NEEDSDOC @param namespaceContext
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNamespaceForPrefix(String prefix, Element namespaceContext)
     {
  +
       int type;
       Node parent = namespaceContext;
       String namespace = null;
  -    if(prefix.equals("xml"))
  +
  +    if (prefix.equals("xml"))
       {
         namespace = QName.S_XMLNAMESPACEURI;
       }
  @@ -298,61 +431,92 @@
       {
         while ((null != parent) && (null == namespace)
                && (((type = parent.getNodeType()) == Node.ELEMENT_NODE)
  -                 || (type == Node.ENTITY_REFERENCE_NODE))) 
  +                 || (type == Node.ENTITY_REFERENCE_NODE)))
         {
  -        if (type == Node.ELEMENT_NODE) 
  +        if (type == Node.ELEMENT_NODE)
           {
             NamedNodeMap nnm = parent.getAttributes();
  -          for (int i = 0;  i < nnm.getLength();  i ++) 
  +
  +          for (int i = 0; i < nnm.getLength(); i++)
             {
               Node attr = nnm.item(i);
               String aname = attr.getNodeName();
               boolean isPrefix = aname.startsWith("xmlns:");
  -            if (isPrefix || aname.equals("xmlns")) 
  +
  +            if (isPrefix || aname.equals("xmlns"))
               {
                 int index = aname.indexOf(':');
  -              String p = isPrefix ? aname.substring(index+1) : "";
  -              if (p.equals(prefix)) 
  +              String p = isPrefix ? aname.substring(index + 1) : "";
  +
  +              if (p.equals(prefix))
                 {
                   namespace = attr.getNodeValue();
  +
                   break;
                 }
               }
             }
           }
  +
           parent = getParentOfNode(parent);
         }
       }
  +
       return namespace;
     }
  -  
  +
     /**
      * An experiment for the moment.
      */
     Hashtable m_NSInfos = new Hashtable();
  -  
  -  protected static final NSInfo m_NSInfoUnProcWithXMLNS = new NSInfo(false, true);
  -  protected static final NSInfo m_NSInfoUnProcWithoutXMLNS = new NSInfo(false, false);
  -  protected static final NSInfo m_NSInfoUnProcNoAncestorXMLNS = new NSInfo(false, false, NSInfo.ANCESTORNOXMLNS);
  -  protected static final NSInfo m_NSInfoNullWithXMLNS = new NSInfo(true, true);
  -  protected static final NSInfo m_NSInfoNullWithoutXMLNS = new NSInfo(true, false);
  -  protected static final NSInfo m_NSInfoNullNoAncestorXMLNS = new NSInfo(true, false, NSInfo.ANCESTORNOXMLNS);
  -  
  -  protected Vector m_candidateNoAncestorXMLNS =  new Vector();
  -  
  +
  +  /** NEEDSDOC Field m_NSInfoUnProcWithXMLNS          */
  +  protected static final NSInfo m_NSInfoUnProcWithXMLNS = new NSInfo(false,
  +                                                            true);
  +
  +  /** NEEDSDOC Field m_NSInfoUnProcWithoutXMLNS          */
  +  protected static final NSInfo m_NSInfoUnProcWithoutXMLNS = new NSInfo(false,
  +                                                               false);
  +
  +  /** NEEDSDOC Field m_NSInfoUnProcNoAncestorXMLNS          */
  +  protected static final NSInfo m_NSInfoUnProcNoAncestorXMLNS =
  +    new NSInfo(false, false, NSInfo.ANCESTORNOXMLNS);
  +
  +  /** NEEDSDOC Field m_NSInfoNullWithXMLNS          */
  +  protected static final NSInfo m_NSInfoNullWithXMLNS = new NSInfo(true,
  +                                                          true);
  +
  +  /** NEEDSDOC Field m_NSInfoNullWithoutXMLNS          */
  +  protected static final NSInfo m_NSInfoNullWithoutXMLNS = new NSInfo(true,
  +                                                             false);
  +
  +  /** NEEDSDOC Field m_NSInfoNullNoAncestorXMLNS          */
  +  protected static final NSInfo m_NSInfoNullNoAncestorXMLNS =
  +    new NSInfo(true, false, NSInfo.ANCESTORNOXMLNS);
  +
  +  /** NEEDSDOC Field m_candidateNoAncestorXMLNS          */
  +  protected Vector m_candidateNoAncestorXMLNS = new Vector();
  +
     /**
      * Returns the namespace of the given node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNamespaceOfNode(Node n)
     {
  +
       String namespaceOfPrefix;
       boolean hasProcessedNS;
       NSInfo nsInfo;
  -    int ntype = n.getNodeType();
  -    if(Node.ATTRIBUTE_NODE != ntype)
  +    short ntype = n.getNodeType();
  +
  +    if (Node.ATTRIBUTE_NODE != ntype)
       {
  -      Object nsObj = m_NSInfos.get(n); // return value
  -      nsInfo = (nsObj == null) ? null : (NSInfo)nsObj;
  +      Object nsObj = m_NSInfos.get(n);  // return value
  +
  +      nsInfo = (nsObj == null) ? null : (NSInfo) nsObj;
         hasProcessedNS = (nsInfo == null) ? false : nsInfo.m_hasProcessedNS;
       }
       else
  @@ -360,25 +524,28 @@
         hasProcessedNS = false;
         nsInfo = null;
       }
  -    if(hasProcessedNS)
  +
  +    if (hasProcessedNS)
       {
         namespaceOfPrefix = nsInfo.m_namespace;
       }
       else
       {
         namespaceOfPrefix = null;
  +
         String nodeName = n.getNodeName();
         int indexOfNSSep = nodeName.indexOf(':');
         String prefix;
   
  -      if(Node.ATTRIBUTE_NODE == ntype)
  +      if (Node.ATTRIBUTE_NODE == ntype)
         {
  -        if(indexOfNSSep > 0)
  +        if (indexOfNSSep > 0)
           {
             prefix = nodeName.substring(0, indexOfNSSep);
           }
           else
           {
  +
             // Attributes don't use the default namespace, so if 
             // there isn't a prefix, we're done.
             return namespaceOfPrefix;
  @@ -386,11 +553,14 @@
         }
         else
         {
  -        prefix = (indexOfNSSep >= 0) ? nodeName.substring(0, indexOfNSSep) : "";
  +        prefix = (indexOfNSSep >= 0)
  +                 ? nodeName.substring(0, indexOfNSSep) : "";
         }
  +
         boolean ancestorsHaveXMLNS = false;
         boolean nHasXMLNS = false;
  -      if(prefix.equals("xml"))
  +
  +      if (prefix.equals("xml"))
         {
           namespaceOfPrefix = QName.S_XMLNAMESPACEURI;
         }
  @@ -398,50 +568,67 @@
         {
           int parentType;
           Node parent = n;
  -        while ((null != parent) && (null == namespaceOfPrefix)) 
  +
  +        while ((null != parent) && (null == namespaceOfPrefix))
           {
  -          if((null != nsInfo) 
  -             && (nsInfo.m_ancestorHasXMLNSAttrs == nsInfo.ANCESTORNOXMLNS))
  +          if ((null != nsInfo)
  +                  && (nsInfo.m_ancestorHasXMLNSAttrs
  +                      == nsInfo.ANCESTORNOXMLNS))
             {
               break;
             }
  +
             parentType = parent.getNodeType();
  -          if((null == nsInfo) || nsInfo.m_hasXMLNSAttrs)
  +
  +          if ((null == nsInfo) || nsInfo.m_hasXMLNSAttrs)
             {
               boolean elementHasXMLNS = false;
  -            if (parentType == Node.ELEMENT_NODE) 
  +
  +            if (parentType == Node.ELEMENT_NODE)
               {
                 NamedNodeMap nnm = parent.getAttributes();
  -              for (int i = 0;  i < nnm.getLength();  i ++) 
  +
  +              for (int i = 0; i < nnm.getLength(); i++)
                 {
                   Node attr = nnm.item(i);
                   String aname = attr.getNodeName();
  -                if(aname.charAt(0) == 'x')
  +
  +                if (aname.charAt(0) == 'x')
                   {
                     boolean isPrefix = aname.startsWith("xmlns:");
  -                  if (aname.equals("xmlns") || isPrefix) 
  +
  +                  if (aname.equals("xmlns") || isPrefix)
                     {
  -                    if(n == parent)
  +                    if (n == parent)
                         nHasXMLNS = true;
  +
                       elementHasXMLNS = true;
                       ancestorsHaveXMLNS = true;
  +
                       String p = isPrefix ? aname.substring(6) : "";
  -                    if (p.equals(prefix)) 
  +
  +                    if (p.equals(prefix))
                       {
                         namespaceOfPrefix = attr.getNodeValue();
  +
                         break;
                       }
                     }
                   }
                 }
               }
  -            if((Node.ATTRIBUTE_NODE != parentType) && (null == nsInfo) && (n != parent))
  +
  +            if ((Node.ATTRIBUTE_NODE != parentType) && (null == nsInfo)
  +                    && (n != parent))
               {
  -              nsInfo = elementHasXMLNS ? m_NSInfoUnProcWithXMLNS : m_NSInfoUnProcWithoutXMLNS;
  +              nsInfo = elementHasXMLNS
  +                       ? m_NSInfoUnProcWithXMLNS : m_NSInfoUnProcWithoutXMLNS;
  +
                 m_NSInfos.put(parent, nsInfo);
               }
             }
  -          if(Node.ATTRIBUTE_NODE == parentType)
  +
  +          if (Node.ATTRIBUTE_NODE == parentType)
             {
               parent = getParentOfNode(parent);
             }
  @@ -449,163 +636,222 @@
             {
               m_candidateNoAncestorXMLNS.addElement(parent);
               m_candidateNoAncestorXMLNS.addElement(nsInfo);
  +
               parent = parent.getParentNode();
             }
  -          if(null != parent)
  +
  +          if (null != parent)
             {
  -            Object nsObj = m_NSInfos.get(parent); // return value
  -            nsInfo = (nsObj == null) ? null : (NSInfo)nsObj;
  +            Object nsObj = m_NSInfos.get(parent);  // return value
  +
  +            nsInfo = (nsObj == null) ? null : (NSInfo) nsObj;
             }
           }
  +
           int nCandidates = m_candidateNoAncestorXMLNS.size();
  -        if(nCandidates > 0)
  +
  +        if (nCandidates > 0)
           {
  -          if((false == ancestorsHaveXMLNS) && (null == parent))
  +          if ((false == ancestorsHaveXMLNS) && (null == parent))
             {
  -            for(int i = 0; i < nCandidates; i+=2)
  +            for (int i = 0; i < nCandidates; i += 2)
               {
  -              Object candidateInfo = m_candidateNoAncestorXMLNS.elementAt(i+1);
  -              if(candidateInfo == m_NSInfoUnProcWithoutXMLNS)
  +              Object candidateInfo = m_candidateNoAncestorXMLNS.elementAt(i
  +                                       + 1);
  +
  +              if (candidateInfo == m_NSInfoUnProcWithoutXMLNS)
                 {
  -                m_NSInfos.put(m_candidateNoAncestorXMLNS.elementAt(i), 
  -                              m_NSInfoUnProcNoAncestorXMLNS );
  +                m_NSInfos.put(m_candidateNoAncestorXMLNS.elementAt(i),
  +                              m_NSInfoUnProcNoAncestorXMLNS);
                 }
  -              else if(candidateInfo == m_NSInfoNullWithoutXMLNS)
  +              else if (candidateInfo == m_NSInfoNullWithoutXMLNS)
                 {
  -                m_NSInfos.put(m_candidateNoAncestorXMLNS.elementAt(i), 
  -                              m_NSInfoNullNoAncestorXMLNS );
  +                m_NSInfos.put(m_candidateNoAncestorXMLNS.elementAt(i),
  +                              m_NSInfoNullNoAncestorXMLNS);
                 }
               }
             }
  +
             m_candidateNoAncestorXMLNS.removeAllElements();
           }
         }
  -      
  -      if(Node.ATTRIBUTE_NODE != ntype)
  +
  +      if (Node.ATTRIBUTE_NODE != ntype)
         {
  -        if(null == namespaceOfPrefix)
  +        if (null == namespaceOfPrefix)
           {
  -          if(ancestorsHaveXMLNS)
  +          if (ancestorsHaveXMLNS)
             {
  -            if(nHasXMLNS)
  -              m_NSInfos.put(n, m_NSInfoNullWithXMLNS );
  +            if (nHasXMLNS)
  +              m_NSInfos.put(n, m_NSInfoNullWithXMLNS);
               else
  -              m_NSInfos.put(n, m_NSInfoNullWithoutXMLNS );
  +              m_NSInfos.put(n, m_NSInfoNullWithoutXMLNS);
             }
             else
             {
  -            m_NSInfos.put(n, m_NSInfoNullNoAncestorXMLNS );
  +            m_NSInfos.put(n, m_NSInfoNullNoAncestorXMLNS);
             }
           }
           else
           {
  -          m_NSInfos.put(n,  new NSInfo(namespaceOfPrefix, nHasXMLNS));
  +          m_NSInfos.put(n, new NSInfo(namespaceOfPrefix, nHasXMLNS));
           }
         }
       }
  +
       return namespaceOfPrefix;
     }
   
     /**
      * Returns the local name of the given node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getLocalNameOfNode(Node n)
     {
  +
       String qname = n.getNodeName();
       int index = qname.indexOf(':');
  -    return (index < 0) ? qname : qname.substring(index+1);
  +
  +    return (index < 0) ? qname : qname.substring(index + 1);
     }
   
     /**
      * Returns the element name with the namespace expanded.
  +   *
  +   * NEEDSDOC @param elem
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getExpandedElementName(Element elem)
     {
  +
       String namespace = getNamespaceOfNode(elem);
  -    return (null != namespace) ? namespace+":"+ getLocalNameOfNode(elem) 
  -                                 : getLocalNameOfNode(elem);
  +
  +    return (null != namespace)
  +           ? namespace + ":" + getLocalNameOfNode(elem)
  +           : getLocalNameOfNode(elem);
     }
   
     /**
      * Returns the attribute name with the namespace expanded.
  +   *
  +   * NEEDSDOC @param attr
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getExpandedAttributeName(Attr attr)
     {
  +
       String namespace = getNamespaceOfNode(attr);
  -    return (null != namespace) ? namespace+":"+ getLocalNameOfNode(attr) 
  -                                 : getLocalNameOfNode(attr);
  +
  +    return (null != namespace)
  +           ? namespace + ":" + getLocalNameOfNode(attr)
  +           : getLocalNameOfNode(attr);
     }
   
     //==========================================================
     // SECTION: DOM Helper Functions
     //==========================================================
   
  -  /** 
  +  /**
      * Tell if the node is ignorable whitespace.
      * @deprecated
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isIgnorableWhitespace(Text node)
     {
  -    boolean isIgnorable = false; // return value
  +
  +    boolean isIgnorable = false;  // return value
  +
       // TODO: I can probably do something to figure out if this 
       // space is ignorable from just the information in
       // the DOM tree.
       return isIgnorable;
     }
  -  
  +
     /**
      * Get the first unparented node in the ancestor chain.
      * @deprecated
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRoot(Node node)
     {
  +
       Node root = null;
  -    while(node != null)
  +
  +    while (node != null)
       {
         root = node;
         node = getParentOfNode(node);
       }
  +
       return root;
     }
  -  
  +
     /**
  -   * Get the root node of the document tree, regardless of 
  +   * Get the root node of the document tree, regardless of
      * whether or not the node passed in is a document node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRootNode(Node n)
     {
  -    return (Node.DOCUMENT_NODE == n.getNodeType()) ? 
  -           n : n.getOwnerDocument();
  +    return (Node.DOCUMENT_NODE == n.getNodeType()) ? n : n.getOwnerDocument();
     }
  -  
  +
     /**
      * Tell if the given node is a namespace decl node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isNamespaceNode(Node n)
     {
  -    if(Node.ATTRIBUTE_NODE == n.getNodeType())
  +
  +    if (Node.ATTRIBUTE_NODE == n.getNodeType())
       {
         String attrName = n.getNodeName();
  +
         return (attrName.startsWith("xmlns:") || attrName.equals("xmlns"));
       }
  +
       return false;
     }
  -  
  +
     /**
  -   * I have to write this silly, and expensive function, 
  -   * because the DOM WG decided that attributes don't 
  +   * I have to write this silly, and expensive function,
  +   * because the DOM WG decided that attributes don't
      * have parents.  If Xalan is used with a DOM implementation
      * that reuses attribute nodes, this will not work correctly.
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws RuntimeException
      */
  -  public Node getParentOfNode(Node node)
  -    throws RuntimeException
  +  public Node getParentOfNode(Node node) throws RuntimeException
     {
  +
       Node parent;
  -    int nodeType = node.getNodeType();
  -    if(Node.ATTRIBUTE_NODE == nodeType)
  +    short nodeType = node.getNodeType();
  +
  +    if (Node.ATTRIBUTE_NODE == nodeType)
       {
         Document doc = node.getOwnerDocument();
  -      
  +
         /*
         TBD:
         if(null == doc)
  @@ -613,56 +859,74 @@
           throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT, null));//"Attribute child does not have an owner document!");
         }
         */
  -      
         Element rootElem = doc.getDocumentElement();
  -      
  -      if(null == rootElem)
  +
  +      if (null == rootElem)
         {
  -        throw new RuntimeException(XSLMessages.createXPATHMessage(XPATHErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT, null));//"Attribute child does not have an owner document element!");
  +        throw new RuntimeException(
  +          XSLMessages.createXPATHMessage(
  +            XPATHErrorResources.ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT,
  +            null));  //"Attribute child does not have an owner document element!");
         }
  -      
  +
         parent = locateAttrParent(rootElem, node);
       }
       else
       {
         parent = node.getParentNode();
  +
         // if((Node.DOCUMENT_NODE != nodeType) && (null == parent))
         // {
         //   throw new RuntimeException("Child does not have parent!");
         // }
       }
  +
       return parent;
     }
  -  
  +
     /**
      * Given an ID, return the element.
  +   *
  +   * NEEDSDOC @param id
  +   * NEEDSDOC @param doc
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Element getElementByID(String id, Document doc)
     {
       return null;
     }
  -  
  +
     /**
  -   * The getUnparsedEntityURI function returns the URI of the unparsed 
  -   * entity with the specified name in the same document as the context 
  -   * node (see [3.3 Unparsed Entities]). It returns the empty string if 
  +   * The getUnparsedEntityURI function returns the URI of the unparsed
  +   * entity with the specified name in the same document as the context
  +   * node (see [3.3 Unparsed Entities]). It returns the empty string if
      * there is no such entity.
  -   * Since it states in the DOM draft: "An XML processor may choose to 
  -   * completely expand entities before the structure model is passed 
  +   * Since it states in the DOM draft: "An XML processor may choose to
  +   * completely expand entities before the structure model is passed
      * to the DOM; in this case, there will be no EntityReferences in the DOM tree."
      * So I'm not sure how well this is going to work.
  +   *
  +   * NEEDSDOC @param name
  +   * NEEDSDOC @param doc
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getUnparsedEntityURI(String name, Document doc)
     {
  -    String url = ""; 
  -    DocumentType doctype = doc.getDoctype(); 
  -    if(null != doctype)
  +
  +    String url = "";
  +    DocumentType doctype = doc.getDoctype();
  +
  +    if (null != doctype)
       {
         NamedNodeMap entities = doctype.getEntities();
  -      Entity entity = (Entity)entities.getNamedItem(name);
  +      Entity entity = (Entity) entities.getNamedItem(name);
         String notationName = entity.getNotationName();
  -      if(null != notationName) // then it's unparsed
  +
  +      if (null != notationName)  // then it's unparsed
         {
  +
           // The draft says: "The XSLT processor may use the public 
           // identifier to generate a URI for the entity instead of the URI 
           // specified in the system identifier. If the XSLT processor does 
  @@ -673,147 +937,187 @@
           // URI [RFC2396]."
           // So I'm falling a bit short here.
           url = entity.getSystemId();
  -        if(null == url)
  +
  +        if (null == url)
           {
             url = entity.getPublicId();
           }
           else
           {
  +
             // This should be resolved to an absolute URL, but that's hard 
             // to do from here.
           }
         }
       }
  +
       return url;
  -  }  
  +  }
  +
     /**
      * Support for getParentOfNode.
  +   *
  +   * NEEDSDOC @param elem
  +   * NEEDSDOC @param attr
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     private Node locateAttrParent(Element elem, Node attr)
     {
  +
       Node parent = null;
       NamedNodeMap attrs = elem.getAttributes();
  -    if(null != attrs)
  +
  +    if (null != attrs)
       {
         int nAttrs = attrs.getLength();
  -      for(int i = 0; i < nAttrs; i++)
  +
  +      for (int i = 0; i < nAttrs; i++)
         {
  -        if(attr == attrs.item(i))
  +        if (attr == attrs.item(i))
           {
             parent = elem;
  +
             break;
           }
         }
       }
  -    if(null == parent)
  +
  +    if (null == parent)
       {
  -      for(Node node = elem.getFirstChild(); null != node; node = node.getNextSibling())
  +      for (Node node = elem.getFirstChild(); null != node;
  +              node = node.getNextSibling())
         {
  -        if(Node.ELEMENT_NODE == node.getNodeType())
  +        if (Node.ELEMENT_NODE == node.getNodeType())
           {
  -          parent = locateAttrParent((Element)node, attr);
  -          if(null != parent) break;
  +          parent = locateAttrParent((Element) node, attr);
  +
  +          if (null != parent)
  +            break;
           }
         }
       }
  +
       return parent;
     }
  -    
  +
     /**
  -   * The factory object used for creating nodes 
  +   * The factory object used for creating nodes
      * in the result tree.
      */
     protected Document m_DOMFactory = null;
  -  
  +
     /**
  -   * Get the factory object required to create DOM nodes 
  +   * Get the factory object required to create DOM nodes
      * in the result tree.
  +   *
  +   * NEEDSDOC @param domFactory
      */
     public void setDOMFactory(Document domFactory)
     {
       this.m_DOMFactory = domFactory;
     }
   
  -  
     /**
  -   * Get the factory object required to create DOM nodes 
  +   * Get the factory object required to create DOM nodes
      * in the result tree.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Document getDOMFactory()
     {
  -    if(null == this.m_DOMFactory)
  +
  +    if (null == this.m_DOMFactory)
       {
         this.m_DOMFactory = createDocument();
       }
  -    
  +
       return this.m_DOMFactory;
     }
  -  
  +
     /**
  -   * Get the textual contents of the node. If the node 
  -   * is an element, apply whitespace stripping rules, 
  -   * though I'm not sure if this is right (I'll fix 
  -   * or declare victory when I review the entire 
  +   * Get the textual contents of the node. If the node
  +   * is an element, apply whitespace stripping rules,
  +   * though I'm not sure if this is right (I'll fix
  +   * or declare victory when I review the entire
      * whitespace handling).
  +   *
  +   * NEEDSDOC @param node
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static String getNodeData(Node node)
     {
  +
       FastStringBuffer buf = StringBufferPool.get();
       String s;
  +
       try
       {
         getNodeData(node, buf);
  +
         s = (buf.length() > 0) ? buf.toString() : "";
       }
       finally
       {
         StringBufferPool.free(buf);
       }
  +
       return s;
     }
  -  
  +
     /**
  -   * Get the textual contents of the node. If the node 
  -   * is an element, apply whitespace stripping rules, 
  -   * though I'm not sure if this is right (I'll fix 
  -   * or declare victory when I review the entire 
  +   * Get the textual contents of the node. If the node
  +   * is an element, apply whitespace stripping rules,
  +   * though I'm not sure if this is right (I'll fix
  +   * or declare victory when I review the entire
      * whitespace handling).
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param buf
      */
     public static void getNodeData(Node node, FastStringBuffer buf)
     {
  -    // String data = null;
   
  -    switch(node.getNodeType())
  +    // String data = null;
  +    switch (node.getNodeType())
       {
  -    case Node.DOCUMENT_FRAGMENT_NODE:
  +    case Node.DOCUMENT_FRAGMENT_NODE :
  +    {
  +      NodeList mnl = node.getChildNodes();
  +      int n = mnl.getLength();
  +
  +      for (int i = 0; i < n; i++)
         {
  -        NodeList mnl = node.getChildNodes();
  -        int n = mnl.getLength();
  -        for(int i = 0; i < n; i++)
  -          getNodeData(mnl.item(i), buf);
  -      }	  
  -      break;
  -    case Node.DOCUMENT_NODE:
  -    case Node.ELEMENT_NODE:
  +        getNodeData(mnl.item(i), buf);
  +      }
  +    }
  +    break;
  +    case Node.DOCUMENT_NODE :
  +    case Node.ELEMENT_NODE :
  +    {
  +      for (Node child = node.getFirstChild(); null != child;
  +              child = child.getNextSibling())
         {
  -        for(Node child = node.getFirstChild(); null != child; child = child.getNextSibling())
  -          getNodeData(child, buf);
  +        getNodeData(child, buf);
         }
  -      break;
  -    case Node.TEXT_NODE:
  -    case Node.CDATA_SECTION_NODE:
  -      buf.append( node.getNodeValue() );
  +    }
  +    break;
  +    case Node.TEXT_NODE :
  +    case Node.CDATA_SECTION_NODE :
  +      buf.append(node.getNodeValue());
         break;
  -    case Node.ATTRIBUTE_NODE:
  -      buf.append( node.getNodeValue() );
  +    case Node.ATTRIBUTE_NODE :
  +      buf.append(node.getNodeValue());
         break;
  -    case Node.PROCESSING_INSTRUCTION_NODE:      
  +    case Node.PROCESSING_INSTRUCTION_NODE :
  +
         // warning(XPATHErrorResources.WG_PARSING_AND_PREPARING);        
         break;
  -    default:
  +    default :
  +
         // ignore
         break;
       }
     }
  -
   }
  
  
  
  1.2       +59 -1     xml-xalan/java/src/org/apache/xpath/DOMOrder.java
  
  Index: DOMOrder.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/DOMOrder.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DOMOrder.java	2000/08/11 02:57:20	1.1
  +++ DOMOrder.java	2000/10/30 18:58:21	1.2
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath;
   
   /**
  @@ -6,9 +62,11 @@
    */
   public interface DOMOrder
   {
  +
     /**
      * Get the UID (document order index).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getUid();
  -
   }
  
  
  
  1.4       +118 -23   xml-xalan/java/src/org/apache/xpath/Expression.java
  
  Index: Expression.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/Expression.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Expression.java	2000/10/23 15:24:38	1.3
  +++ Expression.java	2000/10/30 18:58:22	1.4
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath;
   
   import org.w3c.dom.Node;
  @@ -5,69 +61,108 @@
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xalan.res.XSLMessages;
  +
   import org.xml.sax.ErrorHandler;
  +
   import org.apache.trax.ProcessorException;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Expression <needs-comment/>
  + */
   public abstract class Expression
   	implements java.io.Serializable
   {
  +
  +  /** NEEDSDOC Field m_xpath          */
     protected XPath m_xpath;
  -  
  +
  +  /**
  +   * NEEDSDOC Method execute 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (execute) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public abstract XObject execute(XPathContext xctxt)
       throws org.xml.sax.SAXException;
  -  
  +
     /**
      * Warn the user of an problem.
  +   *
  +   * NEEDSDOC @param xctxt
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public void warn(XPathContext xctxt, int msg, Object[] args)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args); 
  -    
  +
  +    java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args);
       ErrorHandler eh = xctxt.getPrimaryReader().getErrorHandler();
  -    if(null != eh)
  +
  +    if (null != eh)
       {
  +
         // TO DO: Need to get stylesheet Locator from here.
         eh.warning(new ProcessorException(fmsg));
       }
     }
   
     /**
  -   * Tell the user of an assertion error, and probably throw an 
  +   * Tell the user of an assertion error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param b
  +   * NEEDSDOC @param msg
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public void assert(boolean b, java.lang.String msg)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    if(!b)
  +
  +    if (!b)
       {
  -      java.lang.String fMsg 
  -        = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, 
  -                                         new Object[] {msg}); 
  +      java.lang.String fMsg = XSLMessages.createXPATHMessage(
  +        XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
  +        new Object[]{ msg });
  +
         throw new RuntimeException(fMsg);
       }
     }
   
     /**
  -   * Tell the user of an error, and probably throw an 
  +   * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param xctxt
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public void error(XPathContext xctxt, int msg, Object[] args)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args); 
  -    
  -    ProcessorException te = new ProcessorException(fmsg, m_xpath.getLocator());
  -    
  +
  +    java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
  +    ProcessorException te = new ProcessorException(fmsg,
  +                              m_xpath.getLocator());
       ErrorHandler eh = xctxt.getPrimaryReader().getErrorHandler();
  -    if(null != eh)
  +
  +    if (null != eh)
         eh.fatalError(te);
       else
       {
  -      System.out.println(te.getMessage()
  -                         +"; file "+te.getSystemId()
  -                         +"; line "+te.getLineNumber()
  -                         +"; column "+te.getColumnNumber());
  +      System.out.println(te.getMessage() + "; file " + te.getSystemId()
  +                         + "; line " + te.getLineNumber() + "; column "
  +                         + te.getColumnNumber());
       }
     }
   }
  
  
  
  1.2       +7 -4      xml-xalan/java/src/org/apache/xpath/FoundIndex.java
  
  Index: FoundIndex.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/FoundIndex.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FoundIndex.java	2000/07/05 14:44:26	1.1
  +++ FoundIndex.java	2000/10/30 18:58:22	1.2
  @@ -58,12 +58,15 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * Class to let us know when it's time to do 
  + * Class to let us know when it's time to do
    * a search from the parent because of indexing.
    */
   public class FoundIndex extends RuntimeException
   {
  -  public FoundIndex()
  -  {
  -  }
  +
  +  /**
  +   * Constructor FoundIndex
  +   *
  +   */
  +  public FoundIndex(){}
   }
  
  
  
  1.3       +430 -222  xml-xalan/java/src/org/apache/xpath/NodeSet.java
  
  Index: NodeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/NodeSet.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- NodeSet.java	2000/10/02 02:43:14	1.2
  +++ NodeSet.java	2000/10/30 18:58:23	1.3
  @@ -62,111 +62,141 @@
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.traversal.NodeFilter;
   import org.w3c.dom.DOMException;
  +
   import org.apache.xalan.utils.NodeVector;
   import org.apache.xpath.axes.ContextNodeList;
   
   /**
    * <meta name="usage" content="advanced"/>
  - * The NodeSet class can act as either a NodeVector, 
  - * NodeList, or NodeIterator.  However, in order for it to 
  - * act as a NodeVector or NodeList, it's required that 
  - * setShouldCacheNodes(true) be called before the first 
  - * nextNode() is called, in order that nodes can be added 
  - * as they are fetched.  Derived classes that implement iterators 
  - * must override runTo(int index), in order that they may 
  + * The NodeSet class can act as either a NodeVector,
  + * NodeList, or NodeIterator.  However, in order for it to
  + * act as a NodeVector or NodeList, it's required that
  + * setShouldCacheNodes(true) be called before the first
  + * nextNode() is called, in order that nodes can be added
  + * as they are fetched.  Derived classes that implement iterators
  + * must override runTo(int index), in order that they may
    * run the iteration to the given index.
    */
  -public class NodeSet extends 
  -  NodeVector implements NodeList, NodeIterator, Cloneable, ContextNodeList
  -{    
  -  /** 
  +public class NodeSet extends NodeVector
  +        implements NodeList, NodeIterator, Cloneable, ContextNodeList
  +{
  +
  +  /**
      * Create an empty nodelist.
      */
  -  public NodeSet() 
  +  public NodeSet()
     {
       super();
     }
   
     /**
      * Create an empty nodelist.
  +   *
  +   * NEEDSDOC @param blocksize
      */
  -  public NodeSet(int blocksize) 
  +  public NodeSet(int blocksize)
     {
       super(blocksize);
     }
   
     /**
  -   * Create a NodeSet, and copy the members of the 
  +   * Create a NodeSet, and copy the members of the
      * given nodelist into it.
  +   *
  +   * NEEDSDOC @param nodelist
      */
  -  public NodeSet(NodeList nodelist) 
  +  public NodeSet(NodeList nodelist)
     {
  +
       super();
  +
       addNodes(nodelist);
     }
  -  
  +
     /**
  -   * Create a NodeSet, and copy the members of the 
  +   * Create a NodeSet, and copy the members of the
      * given NodeSet into it.
  +   *
  +   * NEEDSDOC @param nodelist
      */
  -  public NodeSet(NodeSet nodelist) 
  +  public NodeSet(NodeSet nodelist)
     {
  +
       super();
  -    addNodes((NodeIterator)nodelist);
  +
  +    addNodes((NodeIterator) nodelist);
     }
   
  -  
     /**
  -   * Create a NodeSet, and copy the members of the 
  +   * Create a NodeSet, and copy the members of the
      * given nodelist into it.
  +   *
  +   * NEEDSDOC @param ni
      */
  -  public NodeSet(NodeIterator ni) 
  +  public NodeSet(NodeIterator ni)
     {
  +
       super();
  +
       addNodes(ni);
     }
   
  -
     /**
  -   * Create a NodeSet, and copy the members of the 
  +   * Create a NodeSet, and copy the members of the
      * given nodelist into it.
  +   *
  +   * NEEDSDOC @param node
      */
  -  public NodeSet(Node node) 
  +  public NodeSet(Node node)
     {
  +
       super();
  +
       addNode(node);
     }
  -  
  +
     /**
      *  The root node of the Iterator, as specified when it was created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRoot()
     {
       return null;
     }
  -  
  +
     /**
      * Get a cloned LocPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  public Object clone() throws CloneNotSupportedException
     {
  -    NodeSet clone = (NodeSet)super.clone();
  +
  +    NodeSet clone = (NodeSet) super.clone();
  +
       return clone;
     }
  -  
  +
     /**
      * Get a cloned Iterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset()
  -    throws CloneNotSupportedException
  +  public NodeIterator cloneWithReset() throws CloneNotSupportedException
     {
  -    NodeSet clone = (NodeSet)clone();
  +
  +    NodeSet clone = (NodeSet) clone();
  +
       clone.reset();
  +
       return clone;
     }
   
  -  
     /**
      * Reset the iterator.
      */
  @@ -176,9 +206,11 @@
     }
   
     /**
  -   *  This attribute determines which node types are presented via the 
  -   * iterator. The available set of constants is defined in the 
  +   *  This attribute determines which node types are presented via the
  +   * iterator. The available set of constants is defined in the
      * <code>NodeFilter</code> interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getWhatToShow()
     {
  @@ -187,6 +219,8 @@
   
     /**
      *  The filter used to screen nodes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeFilter getFilter()
     {
  @@ -194,16 +228,18 @@
     }
   
     /**
  -   *  The value of this flag determines whether the children of entity 
  -   * reference nodes are visible to the iterator. If false, they will be 
  +   *  The value of this flag determines whether the children of entity
  +   * reference nodes are visible to the iterator. If false, they will be
      * skipped over.
  -   * <br> To produce a view of the document that has entity references 
  -   * expanded and does not expose the entity reference node itself, use the 
  -   * whatToShow flags to hide the entity reference node and set 
  -   * expandEntityReferences to true when creating the iterator. To produce 
  -   * a view of the document that has entity reference nodes but no entity 
  -   * expansion, use the whatToShow flags to show the entity reference node 
  +   * <br> To produce a view of the document that has entity references
  +   * expanded and does not expose the entity reference node itself, use the
  +   * whatToShow flags to hide the entity reference node and set
  +   * expandEntityReferences to true when creating the iterator. To produce
  +   * a view of the document that has entity reference nodes but no entity
  +   * expansion, use the whatToShow flags to show the entity reference node
      * and set expandEntityReferences to false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean getExpandEntityReferences()
     {
  @@ -211,8 +247,8 @@
     }
   
     /**
  -   *  Returns the next node in the set and advances the position of the 
  -   * iterator in the set. After a NodeIterator is created, the first call 
  +   *  Returns the next node in the set and advances the position of the
  +   * iterator in the set. After a NodeIterator is created, the first call
      * to nextNode() returns the first node in the set.
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  @@ -220,13 +256,15 @@
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode()
  -    throws DOMException
  +  public Node nextNode() throws DOMException
     {
  -    if((m_next) < this.size())
  +
  +    if ((m_next) < this.size())
       {
         Node next = this.elementAt(m_next);
  +
         m_next++;
  +
         return next;
       }
       else
  @@ -234,23 +272,25 @@
     }
   
     /**
  -   *  Returns the previous node in the set and moves the position of the 
  +   *  Returns the previous node in the set and moves the position of the
      * iterator backwards in the set.
  -   * @return  The previous <code>Node</code> in the set being iterated over, 
  -   *   or<code>null</code> if there are no more members in that set. 
  +   * @return  The previous <code>Node</code> in the set being iterated over,
  +   *   or<code>null</code> if there are no more members in that set.
      * @exception DOMException
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node previousNode()
  -    throws DOMException
  +  public Node previousNode() throws DOMException
     {
  -    if(!m_cacheNodes)
  -      throw new RuntimeException("This NodeSet can not iterate to a previous node!");
  -    
  -    if((m_next-1) > 0)
  +
  +    if (!m_cacheNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not iterate to a previous node!");
  +
  +    if ((m_next - 1) > 0)
       {
         m_next--;
  +
         return this.elementAt(m_next);
       }
       else
  @@ -258,85 +298,102 @@
     }
   
     /**
  -   *  Detaches the iterator from the set which it iterated over, releasing 
  -   * any computational resources and placing the iterator in the INVALID 
  -   * state. After<code>detach</code> has been invoked, calls to 
  -   * <code>nextNode</code> or<code>previousNode</code> will raise the 
  +   *  Detaches the iterator from the set which it iterated over, releasing
  +   * any computational resources and placing the iterator in the INVALID
  +   * state. After<code>detach</code> has been invoked, calls to
  +   * <code>nextNode</code> or<code>previousNode</code> will raise the
      * exception INVALID_STATE_ERR.
      */
  -  public void detach()
  -  {
  -  }
  -  
  +  public void detach(){}
  +
     /**
  -   * Tells if this NodeSet is "fresh", in other words, if 
  -   * the first nextNode() that is called will return the 
  +   * Tells if this NodeSet is "fresh", in other words, if
  +   * the first nextNode() that is called will return the
      * first node in the set.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isFresh()
     {
       return (m_next == 0);
     }
  -    
  +
     /**
  -   * If an index is requested, NodeSet will call this method 
  -   * to run the iterator to the index.  By default this sets 
  -   * m_next to the index.  If the index argument is -1, this 
  +   * If an index is requested, NodeSet will call this method
  +   * to run the iterator to the index.  By default this sets
  +   * m_next to the index.  If the index argument is -1, this
      * signals that the iterator should be run to the end.
  +   *
  +   * NEEDSDOC @param index
      */
     public void runTo(int index)
     {
  -    if(!m_cacheNodes)
  -      throw new RuntimeException("This NodeSet can not do indexing or counting functions!");
  -    if((index >= 0) && (m_next < m_firstFree))
  +
  +    if (!m_cacheNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not do indexing or counting functions!");
  +
  +    if ((index >= 0) && (m_next < m_firstFree))
         m_next = index;
       else
  -      m_next = m_firstFree-1;
  +      m_next = m_firstFree - 1;
     }
  -  
  +
     /**
  -   * Returns the <code>index</code>th item in the collection. If 
  -   * <code>index</code> is greater than or equal to the number of nodes in 
  +   * Returns the <code>index</code>th item in the collection. If
  +   * <code>index</code> is greater than or equal to the number of nodes in
      * the list, this returns <code>null</code>.
      * @param index Index into the collection.
  -   * @return The node at the <code>index</code>th position in the 
  -   *   <code>NodeList</code>, or <code>null</code> if that is not a valid 
  +   * @return The node at the <code>index</code>th position in the
  +   *   <code>NodeList</code>, or <code>null</code> if that is not a valid
      *   index.
      */
     public Node item(int index)
     {
  +
       runTo(index);
  -    return (Node)this.elementAt(index);
  +
  +    return (Node) this.elementAt(index);
     }
  -  
  +
     /**
  -   * The number of nodes in the list. The range of valid child node indices is 
  -   * 0 to <code>length-1</code> inclusive. 
  +   * The number of nodes in the list. The range of valid child node indices is
  +   * 0 to <code>length-1</code> inclusive.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getLength()
     {
  +
       runTo(-1);
  +
       return this.size();
     }
   
     /**
      * Add a node.
  +   *
  +   * NEEDSDOC @param n
      */
     public void addNode(Node n)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
       this.addElement(n);
  -
     }
   
     /**
      * Insert a node at a given position.
  +   *
  +   * NEEDSDOC @param n
  +   * NEEDSDOC @param pos
      */
     public void insertNode(Node n, int pos)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
       insertElementAt(n, pos);
  @@ -344,225 +401,297 @@
   
     /**
      * Remove a node.
  +   *
  +   * NEEDSDOC @param n
      */
     public void removeNode(Node n)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
       this.removeElement(n);
     }
   
     /**
  -   * Copy NodeList members into this nodelist, adding in 
  +   * Copy NodeList members into this nodelist, adding in
      * document order.  If a node is null, don't add it.
  +   *
  +   * NEEDSDOC @param nodelist
      */
     public void addNodes(NodeList nodelist)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
  -    if(null != nodelist) // defensive to fix a bug that Sanjiva reported.
  +    if (null != nodelist)  // defensive to fix a bug that Sanjiva reported.
       {
         int nChildren = nodelist.getLength();
  -      for(int i = 0; i < nChildren; i++)
  +
  +      for (int i = 0; i < nChildren; i++)
         {
           Node obj = nodelist.item(i);
  -        if(null != obj)
  +
  +        if (null != obj)
           {
             addElement(obj);
           }
         }
       }
  +
       // checkDups();
     }
  -  
  +
     /**
  -   * Copy NodeList members into this nodelist, adding in 
  +   * Copy NodeList members into this nodelist, adding in
      * document order.  If a node is null, don't add it.
  +   *
  +   * NEEDSDOC @param ns
      */
     public void addNodes(NodeSet ns)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
  -    addNodes((NodeIterator)ns);
  +    addNodes((NodeIterator) ns);
     }
   
  -  
     /**
  -   * Copy NodeList members into this nodelist, adding in 
  +   * Copy NodeList members into this nodelist, adding in
      * document order.  If a node is null, don't add it.
  +   *
  +   * NEEDSDOC @param iterator
      */
     public void addNodes(NodeIterator iterator)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
  -    if(null != iterator) // defensive to fix a bug that Sanjiva reported.
  +    if (null != iterator)  // defensive to fix a bug that Sanjiva reported.
       {
         Node obj;
  -      while(null != (obj = iterator.nextNode()))
  +
  +      while (null != (obj = iterator.nextNode()))
  +      {
           addElement(obj);
  +      }
       }
  +
       // checkDups();
     }
   
  -
     /**
  -   * Copy NodeList members into this nodelist, adding in 
  +   * Copy NodeList members into this nodelist, adding in
      * document order.  If a node is null, don't add it.
  +   *
  +   * NEEDSDOC @param nodelist
  +   * NEEDSDOC @param support
      */
     public void addNodesInDocOrder(NodeList nodelist, XPathContext support)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
       int nChildren = nodelist.getLength();
  -    for(int i = 0; i < nChildren; i++)
  +
  +    for (int i = 0; i < nChildren; i++)
       {
         Node node = nodelist.item(i);
  -      if(null != node)
  +
  +      if (null != node)
         {
           addNodeInDocOrder(node, support);
         }
       }
     }
  -  
  +
     /**
  -   * Copy NodeList members into this nodelist, adding in 
  +   * Copy NodeList members into this nodelist, adding in
      * document order.  If a node is null, don't add it.
  +   *
  +   * NEEDSDOC @param iterator
  +   * NEEDSDOC @param support
      */
     public void addNodesInDocOrder(NodeIterator iterator, XPathContext support)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
       Node node;
  -    while(null != (node = iterator.nextNode()))
  +
  +    while (null != (node = iterator.nextNode()))
  +    {
         addNodeInDocOrder(node, support);
  +    }
     }
   
  -  
     /**
      * Not yet ready for prime time.
      * I can't use recursion in this.
  +   *
  +   * NEEDSDOC @param start
  +   * NEEDSDOC @param end
  +   * NEEDSDOC @param testIndex
  +   * NEEDSDOC @param nodelist
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private boolean addNodesInDocOrder(int start, int end, int testIndex, 
  +  private boolean addNodesInDocOrder(int start, int end, int testIndex,
                                        NodeList nodelist, XPathContext support)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
   
       boolean foundit = false;
       int i;
       Node node = nodelist.item(testIndex);
  -    for(i = end; i >= start; i--)
  +
  +    for (i = end; i >= start; i--)
       {
  -      Node child = (Node)elementAt(i);
  -      if(child == node)
  +      Node child = (Node) elementAt(i);
  +
  +      if (child == node)
         {
  -        i = -2; // Duplicate, suppress insert
  -        break; 
  +        i = -2;  // Duplicate, suppress insert
  +
  +        break;
         }
  -      if(!support.getDOMHelper().isNodeAfter(node, child))
  +
  +      if (!support.getDOMHelper().isNodeAfter(node, child))
         {
  -        insertElementAt(node, i+1);
  +        insertElementAt(node, i + 1);
  +
           testIndex--;
  -        if(testIndex > 0)
  +
  +        if (testIndex > 0)
           {
  -          boolean foundPrev 
  -            = addNodesInDocOrder(0, i, testIndex, nodelist, support);
  -          if(!foundPrev)
  +          boolean foundPrev = addNodesInDocOrder(0, i, testIndex, nodelist,
  +                                                 support);
  +
  +          if (!foundPrev)
             {
  -            addNodesInDocOrder(i, size()-1, testIndex, nodelist, support);
  +            addNodesInDocOrder(i, size() - 1, testIndex, nodelist, support);
             }
           }
  +
           break;
         }
       }
  -    if(i == -1)
  +
  +    if (i == -1)
       {
         insertElementAt(node, 0);
       }
  +
       return foundit;
     }
  -  
   
     /**
  -   * Add the node into a vector of nodes where it should occur in 
  +   * Add the node into a vector of nodes where it should occur in
      * document order.
      * @param v Vector of nodes, presumably containing Nodes
      * @param obj Node object.
  +   *
  +   * NEEDSDOC @param node
      * @param test true if we should test for doc order
  +   * NEEDSDOC @param support
      * @return insertIndex.
      */
     public int addNodeInDocOrder(Node node, boolean test, XPathContext support)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  -    
  +
       int insertIndex = -1;
  -    if(test)
  +
  +    if (test)
       {
  +
         // This needs to do a binary search, but a binary search 
         // is somewhat tough because the sequence test involves 
         // two nodes.
         int size = size(), i;
  -      for(i = size-1; i >= 0; i--)
  +
  +      for (i = size - 1; i >= 0; i--)
         {
  -        Node child = (Node)elementAt(i);
  -        if(child == node)
  +        Node child = (Node) elementAt(i);
  +
  +        if (child == node)
           {
  -          i = -2; // Duplicate, suppress insert
  -          break; 
  +          i = -2;  // Duplicate, suppress insert
  +
  +          break;
           }
  -        if(!support.getDOMHelper().isNodeAfter(node, child))
  +
  +        if (!support.getDOMHelper().isNodeAfter(node, child))
           {
             break;
           }
         }
  -      if(i != -2)
  +
  +      if (i != -2)
         {
  -        insertIndex = i+1;
  +        insertIndex = i + 1;
  +
           insertElementAt(node, insertIndex);
         }
       }
       else
       {
         insertIndex = this.size();
  +
         boolean foundit = false;
  -      for(int i = 0; i < insertIndex; i++)
  +
  +      for (int i = 0; i < insertIndex; i++)
         {
  -        if(this.item(i).equals(node))
  +        if (this.item(i).equals(node))
           {
             foundit = true;
  +
             break;
           }
         }
  -      if(!foundit)
  +
  +      if (!foundit)
           addElement(node);
       }
  +
       // checkDups();
       return insertIndex;
  -  } // end addNodeInDocOrder(Vector v, Object obj)
  +  }  // end addNodeInDocOrder(Vector v, Object obj)
   
     /**
  -   * Add the node into a vector of nodes where it should occur in 
  +   * Add the node into a vector of nodes where it should occur in
      * document order.
      * @param v Vector of nodes, presumably containing Nodes
      * @param obj Node object.
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int addNodeInDocOrder(Node node, XPathContext support)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       return addNodeInDocOrder(node, true, support);
  -  } // end addNodeInDocOrder(Vector v, Object obj)
  -  
  -  
  +  }  // end addNodeInDocOrder(Vector v, Object obj)
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int size()
     {
  @@ -571,185 +700,264 @@
   
     /**
      * Append a Node onto the vector.
  +   *
  +   * NEEDSDOC @param value
      */
     public void addElement(Node value)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       super.addElement(value);
     }
   
     /**
  -   * Inserts the specified node in this vector at the specified index. 
  -   * Each component in this vector with an index greater or equal to 
  -   * the specified index is shifted upward to have an index one greater 
  -   * than the value it had previously. 
  +   * Inserts the specified node in this vector at the specified index.
  +   * Each component in this vector with an index greater or equal to
  +   * the specified index is shifted upward to have an index one greater
  +   * than the value it had previously.
  +   *
  +   * NEEDSDOC @param value
  +   * NEEDSDOC @param at
      */
     public void insertElementAt(Node value, int at)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       super.insertElementAt(value, at);
     }
  -  
  +
     /**
  -   * Append the nodes to the list. 
  +   * Append the nodes to the list.
  +   *
  +   * NEEDSDOC @param nodes
      */
     public void appendNodes(NodeVector nodes)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       super.appendNodes(nodes);
     }
   
  -
     /**
  -   * Inserts the specified node in this vector at the specified index. 
  -   * Each component in this vector with an index greater or equal to 
  -   * the specified index is shifted upward to have an index one greater 
  -   * than the value it had previously. 
  +   * Inserts the specified node in this vector at the specified index.
  +   * Each component in this vector with an index greater or equal to
  +   * the specified index is shifted upward to have an index one greater
  +   * than the value it had previously.
      */
     public void removeAllElements()
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       super.removeAllElements();
     }
  -  
  +
     /**
  -   * Removes the first occurrence of the argument from this vector. 
  -   * If the object is found in this vector, each component in the vector 
  -   * with an index greater or equal to the object's index is shifted 
  -   * downward to have an index one smaller than the value it had 
  -   * previously. 
  +   * Removes the first occurrence of the argument from this vector.
  +   * If the object is found in this vector, each component in the vector
  +   * with an index greater or equal to the object's index is shifted
  +   * downward to have an index one smaller than the value it had
  +   * previously.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean removeElement(Node s)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       return super.removeElement(s);
     }
  -  
  +
     /**
  -   * Deletes the component at the specified index. Each component in 
  -   * this vector with an index greater or equal to the specified 
  -   * index is shifted downward to have an index one smaller than 
  -   * the value it had previously. 
  +   * Deletes the component at the specified index. Each component in
  +   * this vector with an index greater or equal to the specified
  +   * index is shifted downward to have an index one smaller than
  +   * the value it had previously.
  +   *
  +   * NEEDSDOC @param i
      */
     public void removeElementAt(int i)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       super.removeElementAt(i);
     }
  -  
  +
     /**
  -   * Sets the component at the specified index of this vector to be the 
  -   * specified object. The previous component at that position is discarded. 
  -   * 
  -   * The index must be a value greater than or equal to 0 and less 
  -   * than the current size of the vector. 
  +   * Sets the component at the specified index of this vector to be the
  +   * specified object. The previous component at that position is discarded.
  +   *
  +   * The index must be a value greater than or equal to 0 and less
  +   * than the current size of the vector.
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param index
      */
     public void setElementAt(Node node, int index)
     {
  -    if(!m_mutable)
  +
  +    if (!m_mutable)
         throw new RuntimeException("This NodeSet is not mutable!");
  +
       super.setElementAt(node, index);
     }
   
     /**
      * Get the nth element.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node elementAt(int i)
     {
  +
       runTo(i);
  +
       return super.elementAt(i);
     }
  -  
  +
     /**
      * Tell if the table contains the given node.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean contains(Node s)
     {
  +
       runTo(-1);
  +
       return super.contains(s);
     }
  -  
  +
     /**
  -   * Searches for the first occurence of the given argument, 
  -   * beginning the search at index, and testing for equality 
  -   * using the equals method. 
  -   * @return the index of the first occurrence of the object 
  -   * argument in this vector at position index or later in the 
  -   * vector; returns -1 if the object is not found. 
  +   * Searches for the first occurence of the given argument,
  +   * beginning the search at index, and testing for equality
  +   * using the equals method.
  +   *
  +   * NEEDSDOC @param elem
  +   * NEEDSDOC @param index
  +   * @return the index of the first occurrence of the object
  +   * argument in this vector at position index or later in the
  +   * vector; returns -1 if the object is not found.
      */
     public int indexOf(Node elem, int index)
     {
  +
       runTo(-1);
  +
       return super.indexOf(elem, index);
     }
   
     /**
  -   * Searches for the first occurence of the given argument, 
  -   * beginning the search at index, and testing for equality 
  -   * using the equals method. 
  -   * @return the index of the first occurrence of the object 
  -   * argument in this vector at position index or later in the 
  -   * vector; returns -1 if the object is not found. 
  +   * Searches for the first occurence of the given argument,
  +   * beginning the search at index, and testing for equality
  +   * using the equals method.
  +   *
  +   * NEEDSDOC @param elem
  +   * @return the index of the first occurrence of the object
  +   * argument in this vector at position index or later in the
  +   * vector; returns -1 if the object is not found.
      */
     public int indexOf(Node elem)
     {
  +
       runTo(-1);
  +
       return super.indexOf(elem);
     }
   
  +  /** NEEDSDOC Field m_next          */
     protected int m_next = 0;
  -  
  +
     /**
  -   * Get the current position, which is one less than 
  -   * the next nextNode() call will retreave.  i.e. if 
  -   * you call getCurrentPos() and the return is 0, the next 
  +   * Get the current position, which is one less than
  +   * the next nextNode() call will retreave.  i.e. if
  +   * you call getCurrentPos() and the return is 0, the next
      * fetch will take place at index 1.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getCurrentPos() { return m_next;  }
  -  
  +  public int getCurrentPos()
  +  {
  +    return m_next;
  +  }
  +
     /**
      * Set the current position in the node set.
      * @param i Must be a valid index.
      */
  -  public void setCurrentPos(int i) 
  -  { 
  -    if(!m_cacheNodes)
  -      throw new RuntimeException("This NodeSet can not do indexing or counting functions!");
  -    m_next = i; 
  +  public void setCurrentPos(int i)
  +  {
  +
  +    if (!m_cacheNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not do indexing or counting functions!");
  +
  +    m_next = i;
     }
  -  
  +
     /**
      * Return the last fetched node.  Needed to support the UnionPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getCurrentNode()
     {
  -    if(!m_cacheNodes)
  -      throw new RuntimeException("This NodeSet can not do indexing or counting functions!");
  +
  +    if (!m_cacheNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not do indexing or counting functions!");
  +
       return elementAt(m_next);
     }
  -  
  +
  +  /** NEEDSDOC Field m_mutable          */
     protected boolean m_mutable = true;
  -  
  +
  +  /** NEEDSDOC Field m_cacheNodes          */
     protected boolean m_cacheNodes = true;
  -  public boolean getShouldCacheNodes() { return m_cacheNodes; }
   
     /**
  -   * If setShouldCacheNodes(true) is called, then nodes will 
  +   * NEEDSDOC Method getShouldCacheNodes 
  +   *
  +   *
  +   * NEEDSDOC (getShouldCacheNodes) @return
  +   */
  +  public boolean getShouldCacheNodes()
  +  {
  +    return m_cacheNodes;
  +  }
  +
  +  /**
  +   * If setShouldCacheNodes(true) is called, then nodes will
      * be cached.  They are not cached by default.
  +   *
  +   * NEEDSDOC @param b
      */
     public void setShouldCacheNodes(boolean b)
     {
  -    if(!isFresh())
  -      throw new RuntimeException("Can not call setShouldCacheNodes after nextNode has been called!");
  +
  +    if (!isFresh())
  +      throw new RuntimeException(
  +        "Can not call setShouldCacheNodes after nextNode has been called!");
  +
       m_cacheNodes = b;
       m_mutable = true;
     }
  -
   }
  -
  
  
  
  1.2       +13 -2     xml-xalan/java/src/org/apache/xpath/SourceTree.java
  
  Index: SourceTree.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/SourceTree.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SourceTree.java	2000/07/05 14:44:26	1.1
  +++ SourceTree.java	2000/10/30 18:58:23	1.2
  @@ -60,17 +60,28 @@
   
   /**
    * <meta name="usage" content="internal"/>
  - * This object represents a Source Tree, and any associated 
  + * This object represents a Source Tree, and any associated
    * information.
    */
   public class SourceTree
   {
  +
  +  /**
  +   * Constructor SourceTree
  +   *
  +   *
  +   * NEEDSDOC @param root
  +   * NEEDSDOC @param url
  +   */
     public SourceTree(Node root, String url)
     {
       m_root = root;
       m_url = url;
     }
  -  
  +
  +  /** NEEDSDOC Field m_url          */
     public String m_url;
  +
  +  /** NEEDSDOC Field m_root          */
     public Node m_root;
   }
  
  
  
  1.9       +253 -128  xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java
  
  Index: SourceTreeManager.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/SourceTreeManager.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- SourceTreeManager.java	2000/10/13 02:33:19	1.8
  +++ SourceTreeManager.java	2000/10/30 18:58:24	1.9
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,8 +57,10 @@
   package org.apache.xpath;
   
   import java.net.MalformedURLException;
  +
   import java.io.File;
   import java.io.IOException;
  +
   import java.util.StringTokenizer;
   import java.util.Vector;
   
  @@ -80,24 +82,26 @@
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.stree.SourceTreeHandler;
   import org.apache.xalan.utils.SystemIDResolver;
  -
   import org.apache.xpath.res.XPATHErrorResources;
   
   /**
    * This class bottlenecks all management of source trees.  The methods
  - * in this class should allow easy garbage collection of source 
  + * in this class should allow easy garbage collection of source
    * trees, and should centralize parsing for those source trees.
    */
   public class SourceTreeManager
   {
  +
  +  /** NEEDSDOC Field m_sourceTree          */
     private Vector m_sourceTree = new Vector();
  -  
  +
  +  /** NEEDSDOC Field m_uriResolver          */
     URIResolver m_uriResolver;
  -  
  +
     /**
  -   * Set an object that will be used to resolve URIs used in 
  +   * Set an object that will be used to resolve URIs used in
      * document(), etc.
  -   * @param resolver An object that implements the URIResolver interface, 
  +   * @param resolver An object that implements the URIResolver interface,
      * or null.
      */
     public void setURIResolver(URIResolver resolver)
  @@ -105,152 +109,276 @@
       m_uriResolver = resolver;
     }
   
  +  /** NEEDSDOC Field m_entityResolver          */
     EntityResolver m_entityResolver;
  -    
  +
     /*
     * Allow an application to register an entity resolver.
     */
  -  public void setEntityResolver (EntityResolver resolver)
  +
  +  /**
  +   * NEEDSDOC Method setEntityResolver 
  +   *
  +   *
  +   * NEEDSDOC @param resolver
  +   */
  +  public void setEntityResolver(EntityResolver resolver)
     {
       m_entityResolver = resolver;
     }
  -    
  +
     /**
      * Given a document, find the URL associated with that document.
      * @param owner Document that was previously processed by this liaison.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String findURIFromDoc(Document owner)
     {
  +
       Node root = owner.getOwnerDocument();
  -    if(null == root)
  +
  +    if (null == root)
         root = owner;
  +
       String url = null;
       int n = m_sourceTree.size();
  -    for(int i = 0; i < n; i++)
  +
  +    for (int i = 0; i < n; i++)
       {
  -      SourceTree sTree = (SourceTree)m_sourceTree.elementAt(i);
  -      if(root == sTree.m_root)
  +      SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
  +
  +      if (root == sTree.m_root)
         {
           url = sTree.m_url;
  +
           break;
         }
       }
  +
       return url;
     }
  -    
  +
     /**
  -   * This will be called by the processor when it encounters 
  +   * This will be called by the processor when it encounters
      * an xsl:include, xsl:import, or document() function.
  -   * 
  +   *
      * @param base The base URI that should be used.
  -   * @param uri Value from an xsl:import or xsl:include's href attribute, 
  +   * @param uri Value from an xsl:import or xsl:include's href attribute,
      * or a URI specified in the document() function.
      * @returns a InputSource that can be used to process the resource.
  +   * NEEDSDOC @param urlString
  +   * NEEDSDOC @param locator
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws IOException
  +   * @throws TransformException
      */
  -  public InputSource resolveURI (String base, String urlString, Locator locator)
  -    throws TransformException, IOException
  +  public InputSource resolveURI(
  +          String base, String urlString, Locator locator)
  +            throws TransformException, IOException
     {
  +
       String uri;
  +
       try
       {
         uri = SystemIDResolver.getAbsoluteURI(urlString, base);
       }
  -    catch(SAXException se)
  +    catch (SAXException se)
       {
  +
         // Try and see if the entity resolver can do the job. 
         // If not, throw an exception.
  -      if(null != m_entityResolver)
  +      if (null != m_entityResolver)
         {
           try
           {
             return m_entityResolver.resolveEntity(null, urlString);
           }
  -        catch(SAXException se2)
  +        catch (SAXException se2)
           {
  -          throw new TransformException("URL of base: "+base+
  -          " and url: "+urlString+" can't be resolved", locator, se2);
  +          throw new TransformException("URL of base: " + base + " and url: "
  +                                       + urlString + " can't be resolved",
  +                                         locator, se2);
           }
         }
         else
  -        throw new TransformException("URL of base: "+base+
  -          " and url: "+urlString+" can't be resolved", locator, se);
  +        throw new TransformException("URL of base: " + base + " and url: "
  +                                     + urlString + " can't be resolved",
  +                                       locator, se);
       }
  -    
  +
       InputSource source;
  +
       try
       {
  -      if(null != m_entityResolver)
  +      if (null != m_entityResolver)
           source = m_entityResolver.resolveEntity(null, urlString);
         else
           source = new InputSource(uri);
       }
  -    catch(SAXException se2)
  +    catch (SAXException se2)
       {
  -      throw new TransformException("URL: "+urlString
  -        +" can't be resolved", locator, se2);
  +      throw new TransformException("URL: " + urlString
  +                                   + " can't be resolved", locator, se2);
       }
   
       return source;
     }
  -  
  +
     /**
      * Put the source tree root node in the document cache.
      * TODO: This function needs to be a LOT more sophisticated.
  +   *
  +   * NEEDSDOC @param n
  +   * NEEDSDOC @param source
      */
     public void putDocumentInCache(Node n, InputSource source)
     {
  -    if(null != source.getSystemId())
  +
  +    try
       {
  -      m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));        
  -    }      
  +      Node cachedNode = findNodeFromURL(source);
  +
  +      if (null != cachedNode)
  +      {
  +        if (!cachedNode.equals(n))
  +          throw new RuntimeException(
  +            "Programmer's Error!  "
  +            + "putDocumentInCache found reparse of doc: "
  +            + source.getSystemId());
  +
  +        return;
  +      }
  +
  +      if (null != source.getSystemId())
  +      {
  +        m_sourceTree.addElement(new SourceTree(n, source.getSystemId()));
  +      }
  +    }
  +    catch (TransformException te)
  +    {
  +      throw new org.apache.xalan.utils.WrappedRuntimeException(te);
  +    }
     }
  -  
  -  
  -  
  +
     /**
      * Given a URL, find the node associated with that document.
  -   * @param url 
  +   * @param url
  +   *
  +   * NEEDSDOC @param source
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
      */
  +  public Node findNodeFromURL(InputSource source) throws TransformException
  +  {
  +
  +    String url = source.getSystemId();
  +
  +    if (null == url)
  +      return null;
  +
  +    Node node = null;
  +    int n = m_sourceTree.size();
  +    ;
  +
  +    // System.out.println("findNodeFromURL: "+n);
  +    for (int i = 0; i < n; i++)
  +    {
  +      SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
  +
  +      // System.out.println("findNodeFromURL -         url: "+url);
  +      // System.out.println("findNodeFromURL - sTree.m_url: "+sTree.m_url);
  +      if (url.equals(sTree.m_url))
  +      {
  +        node = sTree.m_root;
  +
  +        break;
  +      }
  +    }
  +
  +    // System.out.println("findNodeFromURL - returning: "+node);
  +    return node;
  +  }
  +
  +  /**
  +   * Given a URL, find the node associated with that document.
  +   *
  +   * NEEDSDOC @param base
  +   * @param url
  +   * NEEDSDOC @param locator
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
  +   */
     public Node findNodeFromURL(String base, String url, Locator locator)
  -    throws TransformException
  +          throws TransformException
     {
  +
       try
       {
         InputSource source = this.resolveURI(base, url, locator);
  -      if(null != source.getSystemId())
  +
  +      if (null != source.getSystemId())
           url = source.getSystemId();
  +
         Node node = null;
  -      int n = m_sourceTree.size();;
  -      for(int i = 0; i < n; i++)
  +      int n = m_sourceTree.size();
  +      ;
  +
  +      // System.out.println("findNodeFromURL: "+n);
  +      for (int i = 0; i < n; i++)
         {
  -        SourceTree sTree = (SourceTree)m_sourceTree.elementAt(i);
  -        if(url.equals(sTree.m_url))
  +        SourceTree sTree = (SourceTree) m_sourceTree.elementAt(i);
  +
  +        // System.out.println("findNodeFromURL -         url: "+url);
  +        // System.out.println("findNodeFromURL - sTree.m_url: "+sTree.m_url);
  +        if (url.equals(sTree.m_url))
           {
             node = sTree.m_root;
  +
             break;
           }
         }
  +
  +      // System.out.println("findNodeFromURL - returning: "+node);
         return node;
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
         throw new TransformException(ioe, locator);
       }
     }
  -  
  +
     /**
      * Get the source tree from the a base URL and a URL string.
  +   *
  +   * NEEDSDOC @param base
  +   * NEEDSDOC @param urlString
  +   * NEEDSDOC @param locator
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
      */
  -  public Node getSourceTree (String base, String urlString, Locator locator) 
  -    throws TransformException
  +  public Node getSourceTree(String base, String urlString, Locator locator)
  +          throws TransformException
     {
  +
  +    // System.out.println("getSourceTree");
       try
       {
         InputSource source = this.resolveURI(base, urlString, locator);
  -      // System.out.println("base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
  +
  +      // System.out.println("getSourceTree - base: "+base+", urlString: "+urlString+", source: "+source.getSystemId());
         return getSourceTree(source, locator);
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
         throw new TransformException(ioe, locator);
       }
  @@ -258,152 +386,149 @@
   
     /**
      * Get the source tree from the input source.
  +   *
  +   * NEEDSDOC @param source
  +   * NEEDSDOC @param locator
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
      */
  -  public Node getSourceTree (InputSource source, Locator locator) 
  -    throws TransformException
  +  public Node getSourceTree(InputSource source, Locator locator)
  +          throws TransformException
     {
  +
       // Try first to see if we have a node cached that matches this 
       // systemID.
  -    if(null != source.getSystemId())
  +    if (null != source.getSystemId())
       {
         Node n = findNodeFromURL(null, source.getSystemId(), locator);
  -      if(null != n)
  +
  +      if (null != n)
           return n;
       }
  -    
  +
       Node root = null;
  -        
  -    if(null != m_uriResolver)
  +
  +    if (null != m_uriResolver)
         root = m_uriResolver.getDOMNode(source);
  -    
  -    if(null == root)
  +
  +    if (null == root)
         root = getDOMNode(source, locator);
  -    
  -    if(null != root)
  +
  +    if (null != root)
         putDocumentInCache(root, source);
  +
       return root;
     }
  -  
  +
     /**
      * Try to create a DOM source tree from the input source.
  +   *
  +   * NEEDSDOC @param source
  +   * NEEDSDOC @param locator
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
      */
  -  public Node getDOMNode (InputSource source, Locator locator) 
  -    throws TransformException
  +  public Node getDOMNode(InputSource source, Locator locator)
  +          throws TransformException
     {
  +
       Node doc = null;
  -    String liaisonClassName = System.getProperty("org.apache.xalan.source.liaison");
   
  -    if(null != liaisonClassName)
  -    {
  -      try 
  -      {
  -        DOM2Helper liaison =  (DOM2Helper)(Class.forName(liaisonClassName).newInstance());
  -        liaison.parse(source);
  -        doc = liaison.getDocument();
  -      } 
  -      catch (SAXException se) 
  -      {
  -        throw new TransformException(se, locator);
  -      } 
  -      catch (ClassNotFoundException e1) 
  -      {
  -        throw new TransformException("XML Liaison class " + liaisonClassName +
  -          " specified but not found", locator, e1);
  -      } 
  -      catch (IllegalAccessException e2) 
  -      {
  -          throw new TransformException("XML Liaison class " + liaisonClassName +
  -            " found but cannot be loaded", locator, e2);
  -      } 
  -      catch (InstantiationException e3) 
  -      {
  -          throw new TransformException("XML Liaison class " + liaisonClassName +
  -            " loaded but cannot be instantiated (no empty public constructor?)",
  -            locator, e3);
  -      } 
  -      catch (ClassCastException e4) 
  -      {
  -          throw new TransformException("XML Liaison class " + liaisonClassName +
  -            " does not implement DOM2Helper", locator, e4);
  -      }
  -    }
  -    else
  -    {
       try
       {
  -      XMLReader reader = getXMLReader(source, locator) ;
  -      
  +
  +      // System.out.println("reading: "+source.getSystemId());
  +      XMLReader reader = getXMLReader(source, locator);
  +
         // TODO: Need to use factory of some kind to create the ContentHandler
         // (Also, try using JAXP if need be...)
         ContentHandler handler = new SourceTreeHandler();
  -      if(handler instanceof org.apache.xalan.stree.SourceTreeHandler)
  +
  +      if (handler instanceof org.apache.xalan.stree.SourceTreeHandler)
         {
  +
           // temp hack
  -        ((org.apache.xalan.stree.SourceTreeHandler)handler).setUseMultiThreading(false);
  +        ((org.apache.xalan.stree.SourceTreeHandler) handler).setUseMultiThreading(
  +          false);
         }
  +
         reader.setContentHandler(handler);
   
         try
         {
  -        reader.setProperty("http://xml.org/sax/properties/lexical-handler", 
  +        reader.setProperty("http://xml.org/sax/properties/lexical-handler",
                              handler);
         }
  -      catch(SAXException se){}
  -      
  +      catch (SAXException se){}
  +
         reader.parse(source);
   
  -      if(handler instanceof org.apache.xalan.stree.SourceTreeHandler)
  +      if (handler instanceof org.apache.xalan.stree.SourceTreeHandler)
         {
  -        doc = ((org.apache.xalan.stree.SourceTreeHandler)handler).getRoot();
  +        doc = ((org.apache.xalan.stree.SourceTreeHandler) handler).getRoot();
         }
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
         throw new TransformException(ioe, locator);
       }
  -    catch(SAXException se)
  +    catch (SAXException se)
       {
         throw new TransformException(se, locator);
       }
  -    }
  +
       return doc;
     }
   
     /**
  -   * This method returns the SAX2 parser to use with the InputSource 
  +   * This method returns the SAX2 parser to use with the InputSource
      * obtained from this URI.
      * It may return null if any SAX2-conformant XML parser can be used,
  -   * or if getInputSource() will also return null. The parser must 
  +   * or if getInputSource() will also return null. The parser must
      * be free for use (i.e.
      * not currently in use for another parse().
  -   * 
  +   *
      * @param inputSource The value returned from the EntityResolver.
      * @returns a SAX2 parser to use with the InputSource.
  +   * NEEDSDOC @param locator
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws TransformException
      */
  -  public XMLReader getXMLReader(InputSource inputSource, Locator locator) 
  -    throws TransformException
  +  public XMLReader getXMLReader(InputSource inputSource, Locator locator)
  +          throws TransformException
     {
  +
       try
       {
  -      XMLReader reader = (null != m_uriResolver) 
  +      XMLReader reader = (null != m_uriResolver)
                            ? m_uriResolver.getXMLReader(inputSource) : null;
  -      if(null == reader)
  +
  +      if (null == reader)
           reader = XMLReaderFactory.createXMLReader();
  -      
  +
         try
         {
  -        reader.setFeature("http://xml.org/sax/features/namespace-prefixes", true);
  -        reader.setFeature("http://apache.org/xml/features/validation/dynamic", true);
  +        reader.setFeature("http://xml.org/sax/features/namespace-prefixes",
  +                          true);
  +        reader.setFeature("http://apache.org/xml/features/validation/dynamic",
  +                          true);
         }
  -      catch(SAXException se)
  +      catch (SAXException se)
         {
  +
           // What can we do?
           // TODO: User diagnostics.
         }
   
         return reader;
       }
  -    catch(SAXException se)
  +    catch (SAXException se)
       {
         throw new TransformException(se, locator);
       }
  
  
  
  1.6       +78 -123   xml-xalan/java/src/org/apache/xpath/VariableStack.java
  
  Index: VariableStack.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/VariableStack.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- VariableStack.java	2000/10/17 19:30:55	1.5
  +++ VariableStack.java	2000/10/30 18:58:24	1.6
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -58,35 +58,39 @@
   
   import java.util.Stack;
   import java.util.Vector;
  +
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.utils.IntStack;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XRTreeFrag;
  +
   import org.w3c.dom.DocumentFragment;
   import org.w3c.dom.Element;
   import org.w3c.dom.Node;
  +
   import org.xml.sax.SAXException;
   
   /**
    * <meta name="usage" content="internal"/>
    * Defines a class to keep track of a stack for
  - * template arguments and variables, since we can't 
  - * simply bind the variables to templates and walk 
  - * the preceding children and ancestors.  The stack 
  - * is delimited by context markers which bound call 
  - * frames, and which you can't search past for a variable, 
  - * and by element frames, which are Arg objects with 
  - * the given ElemTemplateElement instead of a qname. You 
  + * template arguments and variables, since we can't
  + * simply bind the variables to templates and walk
  + * the preceding children and ancestors.  The stack
  + * is delimited by context markers which bound call
  + * frames, and which you can't search past for a variable,
  + * and by element frames, which are Arg objects with
  + * the given ElemTemplateElement instead of a qname. You
    * can search past element frames, and they accumulate
    * until they are popped.
  - * 
  - * Note: Someone recently made the suggestion that the 
  - * globals should not be kept at the bottom of the stack, 
  + *
  + * Note: Someone recently made the suggestion that the
  + * globals should not be kept at the bottom of the stack,
    * but should be implemented in a hash table.
    */
   public class VariableStack extends Stack
   {
  +
     /**
      * Constructor for a variable stack.
      */
  @@ -95,16 +99,14 @@
       pushContextMarker();
     }
   
  -  private static final Integer contextMarker = new Integer(0);
  -  private int m_globalStackFrameIndex = -1;
  -
     /**
  -   * This is the top of the stack frame from where a search 
  -   * for a variable or param should take place.  It may not 
  -   * be the real stack top.
  +   * Hold the position of the start of the current element contexts.
      */
  -  private int m_currentStackFrameIndex = 0;
  -  
  +  private IntStack m_contextPositions = new IntStack();
  +
  +  /** NEEDSDOC Field m_globalStackFrameIndex          */
  +  private int m_globalStackFrameIndex = -1;
  +
     /**
      * Hold the position of the start of the current element frame.
      */
  @@ -116,66 +118,18 @@
     public void markGlobalStackFrame()
     {
       m_globalStackFrameIndex = this.size();
  -    push(contextMarker);
  -  }
  -    
  -  /**
  -   * Set the top of the stack frame from where a search 
  -   * for a variable or param should take place.
  -   */
  -  public void setCurrentStackFrameIndex(int currentStackFrameIndex)
  -  {
  -    m_currentStackFrameIndex = currentStackFrameIndex;
  -  }
  -  
  -  /**
  -   * Get the top of the stack frame from where a search 
  -   * for a variable or param should take place.
  -   */
  -  public int getCurrentStackFrameIndex()
  -  {
  -    return m_currentStackFrameIndex;
     }
  -  
  +
     // Push a context marker onto the stack to let us know when
     // to stop searching for a var.
  -  public void pushContextMarker()
  -  {
  -    push(contextMarker);
  -  }
  -  
  -  /**
  -   * Override the push in order to track the 
  -   * m_currentStackFrameIndex correctly.
  -   */
  -  public Object push(Object o)
  -  {
  -    if(m_currentStackFrameIndex == this.size())
  -      m_currentStackFrameIndex+=1;
  -    return super.push(o);
  -  }
  -
  -  /**
  -   * Override the pop in order to track the 
  -   * m_currentStackFrameIndex correctly.
  -   */
  -  public Object pop()
  -  {
  -    if(m_currentStackFrameIndex == this.size())
  -      m_currentStackFrameIndex-=1;
  -    return super.pop();
  -  }
   
     /**
  -   * Override the setSize in order to track the 
  -   * m_currentStackFrameIndex correctly.
  +   * NEEDSDOC Method pushContextMarker 
  +   *
      */
  -  public void setStackSize(int sz)
  +  public void pushContextMarker()
     {
  -    boolean b = (m_currentStackFrameIndex == this.size());
  -    setSize(sz);
  -    if(b)
  -      m_currentStackFrameIndex = sz;
  +    m_contextPositions.push(this.size());
     }
   
     /**
  @@ -183,22 +137,19 @@
      */
     public void popCurrentContext()
     {
  -    int nElems = size();
  -    // Sub 1 extra for the context marker.
  -    for(int i = (nElems - 1); i >= 0; i--)
  -    {
  -      if(this.elementAt(i) == contextMarker)
  -      {
  -        this.setStackSize(i);
  -        break;
  -      }
  -    }
  +
  +    int newSize = m_contextPositions.pop();
  +
  +    setSize(newSize);
     }
  -  
  +
     /**
      * Push an argument onto the stack.  Don't forget
      * to call startContext before pushing a series of
      * arguments for a given macro call.
  +   *
  +   * NEEDSDOC @param qname
  +   * NEEDSDOC @param val
      */
     public void pushVariable(QName qname, XObject val)
     {
  @@ -208,66 +159,71 @@
     /**
      * Same as getVariable, except don't look in the
      * global space.
  +   *
  +   * NEEDSDOC @param qname
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws SAXException
      */
  -  public XObject getParamVariable(QName qname)
  -    throws SAXException
  +  public XObject getParamVariable(QName qname) throws SAXException
     {
  +
       XObject val = null;
  -    int nElems = getCurrentStackFrameIndex();
  +    int nElems = this.size();
  +    int endContextPos = m_contextPositions.peek();
   
  -    for(int i = (nElems - 1); i >= 0; i--)
  +    for (int i = (nElems - 1); i >= endContextPos; i--)
       {
         Object obj = elementAt(i);
  -      
  -      if(obj == contextMarker)
  -      {
  -        break;
  -      }
  -      else if(((Arg)obj).equals(qname))
  +
  +      if (((Arg) obj).equals(qname))
         {
  -        val = ((Arg)obj).getVal();
  +        val = ((Arg) obj).getVal();
  +
           break;
         }
       }
  +
       return val;
     }
   
  -
     /**
      * Given a name, return a string representing
      * the value.
  +   *
  +   * NEEDSDOC @param name
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws SAXException
      */
  -  public Object getVariable(QName name)
  -    throws SAXException
  +  public Object getVariable(QName name) throws SAXException
     {
  -    int nElems = getCurrentStackFrameIndex();
  -    // Sub 1 extra for the context marker.
  -    for(int i = (nElems - 1); i >= 0; i--)
  +
  +    int nElems = this.size();
  +    int endContextPos = m_contextPositions.peek();
  +
  +    for (int i = (nElems - 1); i >= endContextPos; i--)
       {
  -      Object obj = elementAt(i);
  -      if(obj == contextMarker)
  -      {
  -        break;
  -      }
  -      else if(((Arg)obj).equals(name))
  -      {
  -        return ((Arg)obj).getVal();
  -      }
  +      Arg arg = (Arg) elementAt(i);
  +
  +      if (arg.equals(name))
  +        return arg.getVal();
       }
   
       // Look in the global space
  -    for(int i = (m_globalStackFrameIndex-1); i >= 1; i--)
  +    for (int i = (m_globalStackFrameIndex - 1); i >= 0; i--)
       {
         Object obj = elementAt(i);
  -      if(obj == contextMarker)
  -        break;
  -      else if(((Arg)obj).equals(name))
  -        return ((Arg)obj).getVal();
  +
  +      if (((Arg) obj).equals(name))
  +        return ((Arg) obj).getVal();
       }
  -    
  +
       return null;
     }
  -      
  +
     /**
      * Push an argument onto the stack.  Don't forget
      * to call startContext before pushing a series of
  @@ -277,17 +233,16 @@
     {
       m_elemFramePos.push(this.size());
     }
  -  
  +
     /**
      * Pop the current context from the current context stack.
      */
     public void popElemFrame()
     {
  +
       int newSize = m_elemFramePos.pop();
  -    boolean b = (m_currentStackFrameIndex == this.size());
  +
       setSize(newSize);
  -    if(b)
  -      m_currentStackFrameIndex = newSize;
     }
  -  
  -} // end XSLArgStack
  \ No newline at end of file
  +}  // end XSLArgStack
  +
  
  
  
  1.8       +246 -128  xml-xalan/java/src/org/apache/xpath/XPath.java
  
  Index: XPath.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPath.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XPath.java	2000/10/23 15:24:38	1.7
  +++ XPath.java	2000/10/30 18:58:25	1.8
  @@ -55,191 +55,265 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xpath;
  - 
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.Document;
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.DocumentFragment;
  +
   import java.util.Vector;
  +
   import java.io.Serializable;
   import java.io.ObjectInputStream;
   import java.io.IOException;
  +
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.utils.QName;
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xpath.functions.Function;
  +
   // import org.apache.xpath.functions.FuncLoader;
   import org.apache.xpath.compiler.Compiler;
   import org.apache.xpath.compiler.XPathParser;
  -import org.apache.xpath.compiler.OpMap; // temp
  -import org.apache.xpath.compiler.OpCodes; // temp
  -import org.apache.xpath.compiler.PsuedoNames; // temp
  -import org.apache.xpath.compiler.FunctionTable; // temp
  +import org.apache.xpath.compiler.OpMap;  // temp
  +import org.apache.xpath.compiler.OpCodes;  // temp
  +import org.apache.xpath.compiler.PsuedoNames;  // temp
  +import org.apache.xpath.compiler.FunctionTable;  // temp
   import org.apache.xpath.objects.XObject;
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xpath.objects.*;
  +
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.Locator;
  +
   import org.apache.trax.TransformException;
   import org.apache.xpath.patterns.NodeTest;
   
  -/** 
  +/**
    * <meta name="usage" content="general"/>
    * The XPath class represents the semantic parse tree of the XPath pattern.
    * It is the representation of the grammar which filters out
    * the choice for replacement order of the production rules.
  - * In order to conserve memory and reduce object creation, the 
  + * In order to conserve memory and reduce object creation, the
    * tree is represented as an array of integers:
    *    [op code][length][...]
  - * where strings are represented within the array as 
  + * where strings are represented within the array as
    * indexes into the token tree.
    */
  -public class XPath
  -  implements Serializable
  -{      
  +public class XPath implements Serializable
  +{
  +
  +  /** NEEDSDOC Field m_mainExp          */
     private Expression m_mainExp;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getExpression 
  +   *
  +   *
  +   * NEEDSDOC (getExpression) @return
  +   */
     public Expression getExpression()
     {
       return m_mainExp;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setExpression 
  +   *
  +   *
  +   * NEEDSDOC @param exp
  +   */
     public void setExpression(Expression exp)
     {
       m_mainExp = exp;
     }
  -  
  +
  +  /** NEEDSDOC Field m_locator          */
     private Locator m_locator;
   
  +  /**
  +   * NEEDSDOC Method getLocator 
  +   *
  +   *
  +   * NEEDSDOC (getLocator) @return
  +   */
     public Locator getLocator()
     {
       return m_locator;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setLocator 
  +   *
  +   *
  +   * NEEDSDOC @param l
  +   */
     public void setLocator(Locator l)
     {
   	// Note potential hazards -- l may not be serializable, or may be changed
   	  // after being assigned here.
   	m_locator = l;
     }
  -  
  +
  +  /** NEEDSDOC Field m_patternString          */
     String m_patternString;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getPatternString 
  +   *
  +   *
  +   * NEEDSDOC (getPatternString) @return
  +   */
     public String getPatternString()
     {
       return m_patternString;
     }
   
  +  /** NEEDSDOC Field SELECT          */
     public static final int SELECT = 0;
  +
  +  /** NEEDSDOC Field MATCH          */
     public static final int MATCH = 1;
  -   
  +
     /**
  -   * Construct an XPath object.  The object must be initialized by the 
  +   * Construct an XPath object.  The object must be initialized by the
      * XPathParser.initXPath method.
  -   */
  -  public XPath(String exprString, Locator locator,
  -               PrefixResolver prefixResolver, int type)
  -    throws org.xml.sax.SAXException
  +   *
  +   * NEEDSDOC @param exprString
  +   * NEEDSDOC @param locator
  +   * NEEDSDOC @param prefixResolver
  +   * NEEDSDOC @param type
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XPath(
  +          String exprString, Locator locator, PrefixResolver prefixResolver, int type)
  +            throws org.xml.sax.SAXException
     {
  +
       // TODO: would like not to clone the locator...
  -	  // but it may not be serializable, and it may be changed after being
  -	  // passed in.
  +	// but it may not be serializable, and it may be changed after being
  +	// passed in.
       if(null != locator)
         m_locator = new org.apache.xalan.utils.SerializableLocatorImpl(locator); 
         
       m_patternString = exprString;
  +
       XPathParser parser = new XPathParser();
  -    
       Compiler compiler = new Compiler(null, locator);
  -    if(SELECT == type)
  +
  +    if (SELECT == type)
         parser.initXPath(compiler, exprString, prefixResolver);
  -    else if(MATCH == type)
  +    else if (MATCH == type)
         parser.initMatchPattern(compiler, exprString, prefixResolver);
       else
  -      throw new RuntimeException("Can not deal with XPath type: "+type);
  +      throw new RuntimeException("Can not deal with XPath type: " + type);
  +
       // System.out.println("----------------");
       Expression expr = compiler.compile(0);
  +
       // System.out.println("expr: "+expr);
       this.setExpression(expr);
  -    if(MATCH == type)
  +
  +    if (MATCH == type)
         calcTargetStrings(compiler);
     }
   
  -
     /**
      * <meta name="usage" content="experimental"/>
  -   * Given an expression and a context, evaluate the XPath 
  -   * and call the callback as nodes are found.  Only some simple 
  -   * types of expresions right now can call back, so if this 
  +   * Given an expression and a context, evaluate the XPath
  +   * and call the callback as nodes are found.  Only some simple
  +   * types of expresions right now can call back, so if this
      * method returns null, then the callbacks have been called, otherwise
      * a valid XObject will be returned.
      * @param xctxt The execution context.
      * @param contextNode The node that "." expresses.
  -   * @param namespaceContext The context in which namespaces in the 
  +   * @param namespaceContext The context in which namespaces in the
      * XPath are supposed to be expanded.
  -   * @exception SAXException thrown if the active ProblemListener decides 
  +   * @exception SAXException thrown if the active ProblemListener decides
      * the error condition is severe enough to halt processing.
      * @param callback Interface that implements the processLocatedNode method.
      * @param callbackInfo Object that will be passed to the processLocatedNode method.
  -   * @param stopAtFirst True if the search should stop once the first node in document 
  +   * @param stopAtFirst True if the search should stop once the first node in document
      * order is found.
      * @return The result of the XPath or null if callbacks are used.
  -   * @exception SAXException thrown if 
  +   * @exception SAXException thrown if
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt, Node contextNode, 
  -                         PrefixResolver namespaceContext)
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(
  +          XPathContext xctxt, Node contextNode, PrefixResolver namespaceContext)
  +            throws org.xml.sax.SAXException
  +  {
  +
       PrefixResolver savedPrefixResolver = xctxt.getNamespaceContext();
  -    xctxt.setNamespaceContext(namespaceContext);
  -    xctxt.pushCurrentNode(contextNode);
  -    xctxt.pushCurrentExpressionNode(contextNode);
  +
  +    xctxt.m_currentPrefixResolver = namespaceContext;
  +
  +    xctxt.pushCurrentNodeAndExpression(contextNode, contextNode);
  +
       XObject xobj = null;
  +
       try
       {
         xobj = m_mainExp.execute(xctxt);
       }
  -    catch(Exception e)
  +    catch (Exception e)
       {
  -      if(e instanceof org.apache.trax.TransformException)
  -        throw (org.apache.trax.TransformException)e;
  +      if (e instanceof org.apache.trax.TransformException)
  +        throw (org.apache.trax.TransformException) e;
         else
         {
  -        while(e instanceof org.apache.xalan.utils.WrappedRuntimeException)
  -          e = ((org.apache.xalan.utils.WrappedRuntimeException)e).getException();
  -        throw new org.apache.trax.TransformException("Error in XPath", m_locator, e);
  +        while (e instanceof org.apache.xalan.utils.WrappedRuntimeException)
  +        {
  +          e = ((org.apache.xalan.utils.WrappedRuntimeException) e).getException();
  +        }
  +
  +        throw new org.apache.trax.TransformException("Error in XPath",
  +                m_locator, e);
         }
       }
       finally
       {
  -      xctxt.setNamespaceContext(savedPrefixResolver);
  -      xctxt.popCurrentNode();
  -      xctxt.popCurrentExpressionNode();
  +      xctxt.m_currentPrefixResolver = savedPrefixResolver;
  +
  +      xctxt.popCurrentNodeAndExpression();
       }
  +
       return xobj;
     }
  -  
  +
  +  /** NEEDSDOC Field DEBUG_MATCHES          */
     private static final boolean DEBUG_MATCHES = false;
  -  
  +
     /**
      * Get the match score of the given node.
  +   *
  +   * NEEDSDOC @param xctxt
      * @param context The current source tree context node.
  -   * @returns score, one of MATCH_SCORE_NODETEST, 
  +   * @returns score, one of MATCH_SCORE_NODETEST,
      * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public double getMatchScore(XPathContext xctxt, Node context) 
  -    throws org.xml.sax.SAXException
  +  public double getMatchScore(XPathContext xctxt, Node context)
  +          throws org.xml.sax.SAXException
     {
  +
       xctxt.pushCurrentNode(context);
       xctxt.pushCurrentExpressionNode(context);
  +
       try
       {
         XObject score = m_mainExp.execute(xctxt);
  -      if(DEBUG_MATCHES)
  -        System.out.println("score: "+score.num()
  -                           +" for "+context.getNodeName()+" for xpath "+
  -                           this.getPatternString());
  +
  +      if (DEBUG_MATCHES)
  +        System.out.println("score: " + score.num() + " for "
  +                           + context.getNodeName() + " for xpath "
  +                           + this.getPatternString());
   
         return score.num();
       }
  @@ -248,9 +322,10 @@
         xctxt.popCurrentNode();
         xctxt.popCurrentExpressionNode();
       }
  +
       // return XPath.MATCH_SCORE_NONE;
     }
  -  
  +
     /**
      * Install a built-in function.
      * @param name The unqualified name of the function.
  @@ -258,71 +333,89 @@
      * @param func A Implementation of an XPath Function object.
      * @return the position of the function in the internal index.
      */
  -  public void installFunction (String name, int funcIndex, Function func)
  -  {            
  -    FunctionTable.installFunction(func, funcIndex);    
  +  public void installFunction(String name, int funcIndex, Function func)
  +  {
  +    FunctionTable.installFunction(func, funcIndex);
     }
  -  
  +
  +  /** NEEDSDOC Field m_targetStrings          */
     private Vector m_targetStrings;
  -  
  +
  +  /**
  +   * NEEDSDOC Method calcTargetStrings 
  +   *
  +   *
  +   * NEEDSDOC @param compiler
  +   */
     private void calcTargetStrings(Compiler compiler)
     {
  +
       Vector targetStrings = new Vector();
       int opPos = 2;
   
  -    while(compiler.getOp(opPos) == OpCodes.OP_LOCATIONPATHPATTERN)
  +    while (compiler.getOp(opPos) == OpCodes.OP_LOCATIONPATHPATTERN)
       {
         int nextOpPos = compiler.getNextOpPos(opPos);
  +
         opPos = compiler.getFirstChildPos(opPos);
  -      
  -      while( compiler.getOp(opPos) != OpCodes.ENDOP )
  +
  +      while (compiler.getOp(opPos) != OpCodes.ENDOP)
         {
           int nextStepPos = compiler.getNextOpPos(opPos);
           int nextOp = compiler.getOp(nextStepPos);
  -        if((nextOp == OpCodes.OP_PREDICATE) || (nextOp == OpCodes.ENDOP))
  +
  +        if ((nextOp == OpCodes.OP_PREDICATE) || (nextOp == OpCodes.ENDOP))
           {
             int stepType = compiler.getOp(opPos);
  +
             opPos += 3;
  -          switch(stepType)
  +
  +          switch (stepType)
             {
  -          case OpCodes.OP_FUNCTION:
  +          case OpCodes.OP_FUNCTION :
               targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
               break;
  -          case OpCodes.FROM_ROOT:
  +          case OpCodes.FROM_ROOT :
               targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT);
               break;
  -          case OpCodes.MATCH_ATTRIBUTE:
  -          case OpCodes.MATCH_ANY_ANCESTOR:
  -          case OpCodes.MATCH_IMMEDIATE_ANCESTOR:
  +          case OpCodes.MATCH_ATTRIBUTE :
  +          case OpCodes.MATCH_ANY_ANCESTOR :
  +          case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
               int tok = compiler.getOp(opPos);
  +
               opPos++;
  -            switch(tok)
  +
  +            switch (tok)
               {
  -            case OpCodes.NODETYPE_COMMENT:
  +            case OpCodes.NODETYPE_COMMENT :
                 targetStrings.addElement(PsuedoNames.PSEUDONAME_COMMENT);
                 break;
  -            case OpCodes.NODETYPE_TEXT:
  +            case OpCodes.NODETYPE_TEXT :
                 targetStrings.addElement(PsuedoNames.PSEUDONAME_TEXT);
                 break;
  -            case OpCodes.NODETYPE_NODE:
  +            case OpCodes.NODETYPE_NODE :
                 targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
                 break;
  -            case OpCodes.NODETYPE_ROOT:
  +            case OpCodes.NODETYPE_ROOT :
                 targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT);
                 break;
  -            case OpCodes.NODETYPE_ANYELEMENT:
  +            case OpCodes.NODETYPE_ANYELEMENT :
                 targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
                 break;
  -            case OpCodes.NODETYPE_PI:
  +            case OpCodes.NODETYPE_PI :
                 targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
                 break;
  -            case OpCodes.NODENAME:
  +            case OpCodes.NODENAME :
  +
                 // Skip the namespace
  -              int tokenIndex = compiler.getOp(opPos+1);
  -              if(tokenIndex >= 0)
  +              int tokenIndex = compiler.getOp(opPos + 1);
  +
  +              if (tokenIndex >= 0)
                 {
  -                String targetName = (String)compiler.m_tokenQueue[tokenIndex];
  -                if(targetName.equals("*"))
  +                String targetName =
  +                  (String) compiler.m_tokenQueue[tokenIndex];
  +
  +                if (targetName.equals("*"))
                   {
                     targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
                   }
  @@ -336,92 +429,118 @@
                   targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
                 }
                 break;
  -            default:
  +            default :
                 targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
                 break;
               }
               break;
             }
           }
  +
           opPos = nextStepPos;
         }
  -      
  +
         opPos = nextOpPos;
       }
  +
       m_targetStrings = targetStrings;
  +
       // for(int i = 0; i < m_targetStrings.size(); i++)
       //  System.out.println("targetStrings["+i+"]="+m_targetStrings.elementAt(i));
     }
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * This method is for building indexes of match patterns for fast lookup.
  -   * This allows a caller to get the name or type of a node, and quickly 
  +   * This allows a caller to get the name or type of a node, and quickly
      * find the likely candidates that may match.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Vector getTargetElementStrings()
     {
       return m_targetStrings;
     }
  -    
  -  
  +
     /**
      * Warn the user of an problem.
  -   */
  -  public void warn(XPathContext xctxt,
  -                   Node sourceNode, int msg, Object[] args)
  -    throws org.xml.sax.SAXException
  +   *
  +   * NEEDSDOC @param xctxt
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public void warn(
  +          XPathContext xctxt, Node sourceNode, int msg, Object[] args)
  +            throws org.xml.sax.SAXException
     {
  -    String fmsg = XSLMessages.createXPATHWarning(msg, args); 
  -    
  +
  +    String fmsg = XSLMessages.createXPATHWarning(msg, args);
       ErrorHandler ehandler = xctxt.getPrimaryReader().getErrorHandler();
   
  -    if(null != ehandler)
  +    if (null != ehandler)
       {
  +
         // TO DO: Need to get stylesheet Locator from here.
         ehandler.warning(new TransformException(fmsg));
       }
     }
   
     /**
  -   * Tell the user of an assertion error, and probably throw an 
  +   * Tell the user of an assertion error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param b
  +   * NEEDSDOC @param msg
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void assert(boolean b, String msg)
  -    throws org.xml.sax.SAXException
  +  public void assert(boolean b, String msg) throws org.xml.sax.SAXException
     {
  -    if(!b)
  +
  +    if (!b)
       {
  -      String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] {msg}); 
  +      String fMsg = XSLMessages.createXPATHMessage(
  +        XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
  +        new Object[]{ msg });
  +
         throw new RuntimeException(fMsg);
       }
     }
   
     /**
  -   * Tell the user of an error, and probably throw an 
  +   * Tell the user of an error, and probably throw an
      * exception.
  -   */
  -  public void error(XPathContext xctxt, Node sourceNode, int msg, Object[] args)
  -    throws org.xml.sax.SAXException
  +   *
  +   * NEEDSDOC @param xctxt
  +   * NEEDSDOC @param sourceNode
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public void error(
  +          XPathContext xctxt, Node sourceNode, int msg, Object[] args)
  +            throws org.xml.sax.SAXException
     {
  -    String fmsg = XSLMessages.createXPATHMessage(msg, args); 
  -    
  +
  +    String fmsg = XSLMessages.createXPATHMessage(msg, args);
       ErrorHandler ehandler = xctxt.getPrimaryReader().getErrorHandler();
  +    TransformException te = new TransformException(fmsg,
  +                              xctxt.getSAXLocator());
   
  -    TransformException te = new TransformException(fmsg, 
  -                                                   xctxt.getSAXLocator());
  -                                                   
  -    if(null != ehandler)
  +    if (null != ehandler)
         ehandler.fatalError(te);
       else
       {
  -      System.out.println(te.getMessage()
  -                         +"; file "+te.getSystemId()
  -                         +"; line "+te.getLineNumber()
  -                         +"; column "+te.getColumnNumber());
  +      System.out.println(te.getMessage() + "; file " + te.getSystemId()
  +                         + "; line " + te.getLineNumber() + "; column "
  +                         + te.getColumnNumber());
       }
     }
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * The match score if no match is made.
  @@ -430,11 +549,11 @@
   
     /**
      * <meta name="usage" content="advanced"/>
  -   * The match score if the pattern has the form 
  +   * The match score if the pattern has the form
      * of a QName optionally preceded by an @ character.
      */
     public static final double MATCH_SCORE_QNAME = 0.0;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * The match score if the pattern pattern has the form NCName:*.
  @@ -449,9 +568,8 @@
   
     /**
      * <meta name="usage" content="advanced"/>
  -   * The match score if the pattern consists of something 
  +   * The match score if the pattern consists of something
      * other than just a NodeTest or just a qname.
      */
     public static final double MATCH_SCORE_OTHER = 0.5;
  -
   }
  
  
  
  1.4       +127 -102  xml-xalan/java/src/org/apache/xpath/XPathAPI.java
  
  Index: XPathAPI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathAPI.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XPathAPI.java	2000/10/05 02:43:04	1.3
  +++ XPathAPI.java	2000/10/30 18:58:26	1.4
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,15 +10,15 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  + *    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:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -57,10 +57,12 @@
   package org.apache.xpath;
   
   import org.xml.sax.SAXException;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.Document;
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.NodeList;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.compiler.XPathParser;
  @@ -69,10 +71,9 @@
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xpath.objects.XObject;
   
  -
   /**
    * The methods in this class are convenience methods into the
  - * low-level XPath API.  
  + * low-level XPath API.
    * These functions tend to be a little slow, since a number of objects must be
    * created for each evaluation.  A faster way is to precompile the
    * XPaths using the low-level API, and then just use the XPaths
  @@ -81,6 +82,7 @@
    */
   public class XPathAPI
   {
  +
     /**
      * Use an XPath string to select a single node. XPath namespace
      * prefixes are resolved from the context node, which may not
  @@ -89,9 +91,11 @@
      * @param contextNode The node to start searching from.
      * @param str A valid XPath string.
      * @return The first node found that matches the XPath, or null.
  +   *
  +   * @throws SAXException
      */
     public static Node selectSingleNode(Node contextNode, String str)
  -    throws SAXException
  +          throws SAXException
     {
       return selectSingleNode(contextNode, str, contextNode);
     }
  @@ -104,10 +108,14 @@
      * @param str A valid XPath string.
      * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
      * @return The first node found that matches the XPath, or null.
  +   *
  +   * @throws SAXException
      */
  -  public static Node selectSingleNode(Node contextNode, String str, Node namespaceNode)
  -    throws SAXException
  +  public static Node selectSingleNode(
  +          Node contextNode, String str, Node namespaceNode)
  +            throws SAXException
     {
  +
       // Have the XObject return its result as a NodeSet.
       NodeIterator nl = selectNodeIterator(contextNode, str, namespaceNode);
   
  @@ -115,116 +123,129 @@
       return nl.nextNode();
     }
   
  - /**
  -   * Use an XPath string to select a nodelist.
  -   * XPath namespace prefixes are resolved from the contextNode.
  +  /**
  +   *  Use an XPath string to select a nodelist.
  +   *  XPath namespace prefixes are resolved from the contextNode.
  +   * 
  +   *  @param contextNode The node to start searching from.
  +   *  @param str A valid XPath string.
  +   *  @return A NodeIterator, should never be null.
      *
  -   * @param contextNode The node to start searching from.
  -   * @param str A valid XPath string.
  -   * @return A NodeIterator, should never be null.
  +   * @throws SAXException
      */
     public static NodeIterator selectNodeIterator(Node contextNode, String str)
  -    throws SAXException
  +          throws SAXException
     {
       return selectNodeIterator(contextNode, str, contextNode);
     }
   
  - /**
  -   * Use an XPath string to select a nodelist.
  -   * XPath namespace prefixes are resolved from the namespaceNode.
  +  /**
  +   *  Use an XPath string to select a nodelist.
  +   *  XPath namespace prefixes are resolved from the namespaceNode.
  +   * 
  +   *  @param contextNode The node to start searching from.
  +   *  @param str A valid XPath string.
  +   *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  +   *  @return A NodeIterator, should never be null.
      *
  -   * @param contextNode The node to start searching from.
  -   * @param str A valid XPath string.
  -   * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  -   * @return A NodeIterator, should never be null.
  +   * @throws SAXException
      */
  -  public static NodeIterator selectNodeIterator(Node contextNode, String str, Node namespaceNode)
  -    throws SAXException
  +  public static NodeIterator selectNodeIterator(
  +          Node contextNode, String str, Node namespaceNode)
  +            throws SAXException
     {
  +
       // Execute the XPath, and have it return the result
       XObject list = eval(contextNode, str, namespaceNode);
   
       // Have the XObject return its result as a NodeSet.
       return list.nodeset();
  -
     }
  -  
  - /**
  -   * Use an XPath string to select a nodelist.
  -   * XPath namespace prefixes are resolved from the contextNode.
  +
  +  /**
  +   *  Use an XPath string to select a nodelist.
  +   *  XPath namespace prefixes are resolved from the contextNode.
  +   * 
  +   *  @param contextNode The node to start searching from.
  +   *  @param str A valid XPath string.
  +   *  @return A NodeIterator, should never be null.
      *
  -   * @param contextNode The node to start searching from.
  -   * @param str A valid XPath string.
  -   * @return A NodeIterator, should never be null.
  +   * @throws SAXException
      */
     public static NodeList selectNodeList(Node contextNode, String str)
  -    throws SAXException
  +          throws SAXException
     {
       return selectNodeList(contextNode, str, contextNode);
     }
   
  - /**
  -   * Use an XPath string to select a nodelist.
  -   * XPath namespace prefixes are resolved from the namespaceNode.
  +  /**
  +   *  Use an XPath string to select a nodelist.
  +   *  XPath namespace prefixes are resolved from the namespaceNode.
  +   * 
  +   *  @param contextNode The node to start searching from.
  +   *  @param str A valid XPath string.
  +   *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  +   *  @return A NodeIterator, should never be null.
      *
  -   * @param contextNode The node to start searching from.
  -   * @param str A valid XPath string.
  -   * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  -   * @return A NodeIterator, should never be null.
  +   * @throws SAXException
      */
  -  public static NodeList selectNodeList(Node contextNode, String str, Node namespaceNode)
  -    throws SAXException
  +  public static NodeList selectNodeList(
  +          Node contextNode, String str, Node namespaceNode)
  +            throws SAXException
     {
  +
       // Execute the XPath, and have it return the result
       XObject list = eval(contextNode, str, namespaceNode);
   
       // Have the XObject return its result as a NodeSet.
  -    return (NodeList)list.nodeset();
  -
  +    return (NodeList) list.nodeset();
     }
   
  -
  - /**
  -   * Evaluate XPath string to an XObject.  Using this method,
  -   * XPath namespace prefixes will be resolved from the namespaceNode.
  -   * @param contextNode The node to start searching from.
  -   * @param str A valid XPath string.
  -   * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  -   * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
  -   * @see org.apache.xpath.objects.XObject
  -   * @see org.apache.xpath.objects.XNull
  -   * @see org.apache.xpath.objects.XBoolean
  -   * @see org.apache.xpath.objects.XNumber
  -   * @see org.apache.xpath.objects.XString
  -   * @see org.apache.xpath.objects.XRTreeFrag
  +  /**
  +   *  Evaluate XPath string to an XObject.  Using this method,
  +   *  XPath namespace prefixes will be resolved from the namespaceNode.
  +   *  @param contextNode The node to start searching from.
  +   *  @param str A valid XPath string.
  +   *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  +   *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
  +   *  @see org.apache.xpath.objects.XObject
  +   *  @see org.apache.xpath.objects.XNull
  +   *  @see org.apache.xpath.objects.XBoolean
  +   *  @see org.apache.xpath.objects.XNumber
  +   *  @see org.apache.xpath.objects.XString
  +   *  @see org.apache.xpath.objects.XRTreeFrag
  +   *
  +   * @throws SAXException
      */
  -  public static XObject eval(Node contextNode, String str)
  -    throws SAXException
  +  public static XObject eval(Node contextNode, String str) throws SAXException
     {
       return eval(contextNode, str, contextNode);
     }
   
  - /**
  -   * Evaluate XPath string to an XObject.
  -   * XPath namespace prefixes are resolved from the namespaceNode.
  -   * The implementation of this is a little slow, since it creates
  -   * a number of objects each time it is called.  This could be optimized
  -   * to keep the same objects around, but then thread-safety issues would arise.
  +  /**
  +   *  Evaluate XPath string to an XObject.
  +   *  XPath namespace prefixes are resolved from the namespaceNode.
  +   *  The implementation of this is a little slow, since it creates
  +   *  a number of objects each time it is called.  This could be optimized
  +   *  to keep the same objects around, but then thread-safety issues would arise.
  +   * 
  +   *  @param contextNode The node to start searching from.
  +   *  @param str A valid XPath string.
  +   *  @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  +   *  @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
  +   *  @see org.apache.xpath.objects.XObject
  +   *  @see org.apache.xpath.objects.XNull
  +   *  @see org.apache.xpath.objects.XBoolean
  +   *  @see org.apache.xpath.objects.XNumber
  +   *  @see org.apache.xpath.objects.XString
  +   *  @see org.apache.xpath.objects.XRTreeFrag
      *
  -   * @param contextNode The node to start searching from.
  -   * @param str A valid XPath string.
  -   * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  -   * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
  -   * @see org.apache.xpath.objects.XObject
  -   * @see org.apache.xpath.objects.XNull
  -   * @see org.apache.xpath.objects.XBoolean
  -   * @see org.apache.xpath.objects.XNumber
  -   * @see org.apache.xpath.objects.XString
  -   * @see org.apache.xpath.objects.XRTreeFrag
  +   * @throws SAXException
      */
     public static XObject eval(Node contextNode, String str, Node namespaceNode)
  -    throws SAXException
  +          throws SAXException
     {
  +
       // Since we don't have a XML Parser involved here, install some default support
       // for things like namespaces, etc.
       // (Changed from: XPathContext xpathSupport = new XPathContext();
  @@ -236,9 +257,9 @@
       // XPath namespaces are resolved from the input context node's document element
       // if it is a root node, or else the current context node (for lack of a better
       // resolution space, given the simplicity of this sample code).
  -    PrefixResolverDefault prefixResolver = new PrefixResolverDefault((namespaceNode.getNodeType() == Node.DOCUMENT_NODE)
  -                                                         ? ((Document)namespaceNode).getDocumentElement() :
  -                                                           namespaceNode);
  +    PrefixResolverDefault prefixResolver = new PrefixResolverDefault(
  +      (namespaceNode.getNodeType() == Node.DOCUMENT_NODE)
  +      ? ((Document) namespaceNode).getDocumentElement() : namespaceNode);
   
       // Create the XPath object.
       XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT);
  @@ -246,34 +267,38 @@
       // Execute the XPath, and have it return the result
       return xpath.execute(xpathSupport, contextNode, prefixResolver);
     }
  -  
  -/**
  -   * Evaluate XPath string to an XObject.
  -   * XPath namespace prefixes are resolved from the namespaceNode.
  -   * The implementation of this is a little slow, since it creates
  -   * a number of objects each time it is called.  This could be optimized
  -   * to keep the same objects around, but then thread-safety issues would arise.
  +
  +  /**
  +   *   Evaluate XPath string to an XObject.
  +   *   XPath namespace prefixes are resolved from the namespaceNode.
  +   *   The implementation of this is a little slow, since it creates
  +   *   a number of objects each time it is called.  This could be optimized
  +   *   to keep the same objects around, but then thread-safety issues would arise.
  +   *  
  +   *   @param contextNode The node to start searching from.
  +   *   @param str A valid XPath string.
  +   *   @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  +   * NEEDSDOC @param prefixResolver
  +   *   @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
  +   *   @see org.apache.xpath.objects.XObject
  +   *   @see org.apache.xpath.objects.XNull
  +   *   @see org.apache.xpath.objects.XBoolean
  +   *   @see org.apache.xpath.objects.XNumber
  +   *   @see org.apache.xpath.objects.XString
  +   *   @see org.apache.xpath.objects.XRTreeFrag
      *
  -   * @param contextNode The node to start searching from.
  -   * @param str A valid XPath string.
  -   * @param namespaceNode The node from which prefixes in the XPath will be resolved to namespaces.
  -   * @return An XObject, which can be used to obtain a string, number, nodelist, etc, should never be null.
  -   * @see org.apache.xpath.objects.XObject
  -   * @see org.apache.xpath.objects.XNull
  -   * @see org.apache.xpath.objects.XBoolean
  -   * @see org.apache.xpath.objects.XNumber
  -   * @see org.apache.xpath.objects.XString
  -   * @see org.apache.xpath.objects.XRTreeFrag
  +   * @throws SAXException
      */
  -  public static XObject eval(Node contextNode, String str, PrefixResolver prefixResolver)
  -    throws SAXException
  +  public static XObject eval(
  +          Node contextNode, String str, PrefixResolver prefixResolver)
  +            throws SAXException
     {
  +
       // Since we don't have a XML Parser involved here, install some default support
       // for things like namespaces, etc.
       // (Changed from: XPathContext xpathSupport = new XPathContext();
       //    because XPathContext is weak in a number of areas... perhaps
       //    XPathContext should be done away with.)
  -
       // Create the XPath object.
       XPath xpath = new XPath(str, null, prefixResolver, XPath.SELECT);
   
  
  
  
  1.9       +205 -107  xml-xalan/java/src/org/apache/xpath/XPathContext.java
  
  Index: XPathContext.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathContext.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XPathContext.java	2000/10/18 04:36:47	1.8
  +++ XPathContext.java	2000/10/30 18:58:26	1.9
  @@ -72,11 +72,9 @@
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xpath.axes.ContextNodeList;
   import org.apache.xpath.axes.SubContextList;
  -
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNodeSet;
   
  -
   // DOM Imports
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.traversal.TreeWalker;
  @@ -104,12 +102,11 @@
    */
   public class XPathContext implements ExpressionContext
   {
  +
     /**
      * Create an XPathContext instance.
      */
  -  public XPathContext()
  -  {
  -  }
  +  public XPathContext(){}
   
     /**
      * Create an XPathContext instance.
  @@ -123,36 +120,49 @@
   
     /**
      * Copy attributes from another liaison.
  +   *
  +   * NEEDSDOC @param from
  +   *
  +   * @throws SAXException
      */
  -  public void copyFromOtherLiaison(XPathContext from)
  -    throws SAXException
  -  {
  -  }
  +  public void copyFromOtherLiaison(XPathContext from) throws SAXException{}
   
     /**
      * Reset for new run.
      */
  -  public void reset()
  -  {
  -  }
  -  
  +  public void reset(){}
  +
  +  /** NEEDSDOC Field m_saxLocation          */
     Locator m_saxLocation;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setSAXLocator 
  +   *
  +   *
  +   * NEEDSDOC @param location
  +   */
     public void setSAXLocator(Locator location)
     {
       m_saxLocation = location;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getSAXLocator 
  +   *
  +   *
  +   * NEEDSDOC (getSAXLocator) @return
  +   */
     public Locator getSAXLocator()
     {
       return m_saxLocation;
     }
  -  
  +
  +  /** NEEDSDOC Field m_owner          */
     private Object m_owner;
  -  
  +
     /**
  -   * Get the "owner" context of this context, which should be, 
  -   * in the case of XSLT, the Transformer object.  This is needed 
  +   * Get the "owner" context of this context, which should be,
  +   * in the case of XSLT, the Transformer object.  This is needed
      * so that XSLT functions can get the Transformer.
      * @return The owner object passed into the constructor, or null.
      */
  @@ -162,25 +172,33 @@
     }
   
     // ================ extensionsTable ===================
  -  
  +
     /**
      * The table of Extension Handlers.
      */
     private ExtensionsTable m_extensionsTable = new ExtensionsTable();
  -  
  +
     /**
      * Get the extensions table object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public ExtensionsTable getExtensionsTable()
     {
       return m_extensionsTable;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setExtensionsTable 
  +   *
  +   *
  +   * NEEDSDOC @param table
  +   */
     void setExtensionsTable(ExtensionsTable table)
     {
       m_extensionsTable = table;
     }
  -  
  +
     // ================ VarStack ===================
   
     /**
  @@ -188,111 +206,150 @@
      * pushed onto this stack for each template invocation.
      */
     private VariableStack m_variableStacks = new VariableStack();
  -  
  +
     /**
      * Get the variable stack, which is in charge of variables and
      * parameters.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public VariableStack getVarStack() { return m_variableStacks; }
  +  public VariableStack getVarStack()
  +  {
  +    return m_variableStacks;
  +  }
   
     /**
      * Get the variable stack, which is in charge of variables and
      * parameters.
  +   *
  +   * NEEDSDOC @param varStack
      */
  -  public void setVarStack(VariableStack varStack) { m_variableStacks = varStack; }
  +  public void setVarStack(VariableStack varStack)
  +  {
  +    m_variableStacks = varStack;
  +  }
   
     /**
      * Given a name, locate a variable in the current context, and return
      * the Object.
  +   *
  +   * NEEDSDOC @param qname
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject getVariable(QName qname)
  -    throws org.xml.sax.SAXException
  +  public XObject getVariable(QName qname) throws org.xml.sax.SAXException
     {
  +
       Object obj = getVarStack().getVariable(qname);
  -    if((null != obj) && !(obj instanceof XObject))
  +
  +    if ((null != obj) &&!(obj instanceof XObject))
       {
         obj = new XObject(obj);
       }
  -    return (XObject)obj;
  +
  +    return (XObject) obj;
     }
  -  
  -  
  +
     // ================ DOMHelper ===================
   
  +  /** NEEDSDOC Field m_domHelper          */
     private DOMHelper m_domHelper;
  -  
  +
     /**
      * Get the DOMHelper associated with this execution context.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final DOMHelper getDOMHelper()
     {
  -    if(null == m_domHelper)
  +
  +    if (null == m_domHelper)
         m_domHelper = new DOM2Helper();
  +
       return m_domHelper;
     }
  -  
  +
     /**
      * Set the DOMHelper associated with this execution context.
  +   *
  +   * NEEDSDOC @param helper
      */
     public void setDOMHelper(DOMHelper helper)
     {
       m_domHelper = helper;
     }
  -                                                
  +
     // ================ SourceTreeManager ===================
   
  +  /** NEEDSDOC Field m_sourceTreeManager          */
     private SourceTreeManager m_sourceTreeManager = new SourceTreeManager();
  -  
  +
     /**
      * Get the DOMHelper associated with this execution context.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final SourceTreeManager getSourceTreeManager()
     {
       return m_sourceTreeManager;
     }
  -  
  +
     /**
      * Set the DOMHelper associated with this execution context.
  +   *
  +   * NEEDSDOC @param mgr
      */
     public void setSourceTreeManager(SourceTreeManager mgr)
     {
       m_sourceTreeManager = mgr;
     }
  -  
  +
     // =================================================
   
  +  /** NEEDSDOC Field m_uriResolver          */
     private URIResolver m_uriResolver;
  -  
  +
     /**
      * Get the URIResolver associated with this execution context.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final URIResolver getURIResolver()
     {
       return m_uriResolver;
     }
  -  
  +
     /**
      * Set the URIResolver associated with this execution context.
  +   *
  +   * NEEDSDOC @param resolver
      */
     public void setURIResolver(URIResolver resolver)
     {
       m_uriResolver = resolver;
     }
  -  
  +
     // =================================================
  -   
  +
  +  /** NEEDSDOC Field m_primaryReader          */
     public XMLReader m_primaryReader;
  -  
  +
     /**
      * Get primary XMLReader associated with this execution context.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final XMLReader getPrimaryReader()
     {
       return m_primaryReader;
     }
  -  
  +
     /**
      * Set primary XMLReader associated with this execution context.
  +   *
  +   * NEEDSDOC @param reader
      */
     public void setPrimaryReader(XMLReader reader)
     {
  @@ -300,69 +357,98 @@
     }
   
     // =================================================
  -  
  +
     /**
      * Take a user string (system ID) return the url.
  -   * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide 
  +   *
  +   * NEEDSDOC @param urlString
  +   * NEEDSDOC @param base
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws SAXException
      */
     public final String getAbsoluteURI(String urlString, String base)
  -    throws SAXException 
  +          throws SAXException
     {
  +
       InputSource inputSource;
  +
       try
       {
  -      inputSource = getSourceTreeManager().resolveURI(base, urlString, getSAXLocator());
  +      inputSource = getSourceTreeManager().resolveURI(base, urlString,
  +              getSAXLocator());
       }
  -    catch(IOException ioe)
  +    catch (IOException ioe)
       {
  -      inputSource = null; // shutup compiler.
  +      inputSource = null;  // shutup compiler.
  +
         throw new SAXException(ioe);
       }
  +
       // System.out.println("url: "+url.toString());
       return inputSource.getSystemId();
     }
  -  
  +
  +  /** NEEDSDOC Field m_XSLMessages          */
     private static XSLMessages m_XSLMessages = new XSLMessages();
   
     /**
  -   * Tell the user of an assertion error, and probably throw an 
  +   * Tell the user of an assertion error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param b
  +   * NEEDSDOC @param msg
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  private void assert(boolean b, String msg)
  -    throws org.xml.sax.SAXException
  +  private void assert(boolean b, String msg) throws org.xml.sax.SAXException
     {
  +
       ErrorHandler errorHandler = getPrimaryReader().getErrorHandler();
  -    if (errorHandler != null) {
  -      errorHandler.fatalError(new TransformException(m_XSLMessages.createMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] {msg})));
  +
  +    if (errorHandler != null)
  +    {
  +      errorHandler.fatalError(
  +        new TransformException(
  +          m_XSLMessages.createMessage(
  +            XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
  +            new Object[]{ msg })));
       }
     }
  -  
  +
     //==========================================================
     // SECTION: Execution context state tracking
     //==========================================================
  -           
  +
     /**
      * The current context node list.
      */
     private Stack m_contextNodeLists = new Stack();
  -        
  +
     /**
      * Get the current context node list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final ContextNodeList getContextNodeList()
     {
  -    if (m_contextNodeLists.size()>0)
  -      return (ContextNodeList)m_contextNodeLists.peek();
  -    else 
  +
  +    if (m_contextNodeLists.size() > 0)
  +      return (ContextNodeList) m_contextNodeLists.peek();
  +    else
         return null;
     }
  - 
  +
     /**
      * <meta name="usage" content="internal"/>
      * Set the current context node list.
  -   * @param A nodelist that represents the current context 
  +   * @param A nodelist that represents the current context
      * list as defined by XPath.
  +   *
  +   * NEEDSDOC @param nl
      */
     public final void pushContextNodeList(ContextNodeList nl)
     {
  @@ -377,50 +463,58 @@
     {
       m_contextNodeLists.pop();
     }
  -  
  +
     /**
      * The current prefixResolver for the execution context (not
      * the source tree context).
      * (Is this really needed?)
      */
  -  private PrefixResolver m_currentPrefixResolver = null;
  -  
  +  PrefixResolver m_currentPrefixResolver = null;
  +
  +  /** NEEDSDOC Field m_currentNodes          */
     private NodeVector m_currentNodes = new NodeVector();
  -  
  +
     /**
      * Get the current context node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final Node getCurrentNode()
     {
       return m_currentNodes.peepOrNull();
     }
  -  
  +
     /**
      * Set the current context node.
  +   *
  +   * NEEDSDOC @param cn
  +   * NEEDSDOC @param en
      */
     public final void pushCurrentNodeAndExpression(Node cn, Node en)
     {
       m_currentNodes.push(cn);
       m_currentExpressionNodes.push(en);
     }
  -  
  +
     /**
      * Set the current context node.
      */
     public final void popCurrentNodeAndExpression()
     {
  -    m_currentNodes.pop();
  -    m_currentExpressionNodes.pop();
  +    m_currentNodes.popQuick();
  +    m_currentExpressionNodes.popQuick();
     }
   
     /**
      * Set the current context node.
  +   *
  +   * NEEDSDOC @param n
      */
     public final void pushCurrentNode(Node n)
     {
       m_currentNodes.push(n);
     }
  -  
  +
     /**
      * Pop the current context node.
      */
  @@ -428,43 +522,42 @@
     {
       m_currentNodes.popQuick();
     }
  -  
  -  private Stack m_currentExpressionNodes = new Stack();
  -  
  +
  +  /** NEEDSDOC Field m_currentExpressionNodes          */
  +  private NodeVector m_currentExpressionNodes = new NodeVector();
  +
     /**
      * Get the current node that is the expression's context (i.e. for current() support).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final Node getCurrentExpressionNode()
     {
  -    try
  -    {
  -      return (Node)m_currentExpressionNodes.peek();
  -    }
  -    catch(java.util.EmptyStackException ese)
  -    {
  -    }
  -    return null;
  +    return m_currentExpressionNodes.peepOrNull();
     }
   
     /**
      * Set the current node that is the expression's context (i.e. for current() support).
  +   *
  +   * NEEDSDOC @param n
      */
     public final void pushCurrentExpressionNode(Node n)
     {
       m_currentExpressionNodes.push(n);
     }
  -  
  +
     /**
      * Pop the current node that is the expression's context (i.e. for current() support).
      */
     public final void popCurrentExpressionNode()
     {
  -    m_currentExpressionNodes.pop();
  +    m_currentExpressionNodes.popQuick();
     }
   
  -  
     /**
      * Get the current namespace context for the xpath.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public final PrefixResolver getNamespaceContext()
     {
  @@ -473,12 +566,14 @@
   
     /**
      * Get the current namespace context for the xpath.
  +   *
  +   * NEEDSDOC @param pr
      */
     public final void setNamespaceContext(PrefixResolver pr)
     {
       m_currentPrefixResolver = pr;
  -  } 
  -  
  +  }
  +
     //==========================================================
     // SECTION: Current TreeWalker contexts (for internal use)
     //==========================================================
  @@ -487,16 +582,18 @@
      * Stack of AxesIterators.
      */
     private Stack m_axesIteratorStack = new Stack();
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Push a TreeWalker on the stack.
  +   *
  +   * NEEDSDOC @param iter
      */
     public final void pushSubContextList(SubContextList iter)
     {
       m_axesIteratorStack.push(iter);
     }
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Pop the last pushed axes iterator.
  @@ -505,16 +602,17 @@
     {
       m_axesIteratorStack.pop();
     }
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * Get the current axes iterator, or return null if none.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public SubContextList getSubContextList()
     {
  -    return m_axesIteratorStack.isEmpty() 
  -           ? null : (SubContextList)m_axesIteratorStack.peek();
  -                                           
  +    return m_axesIteratorStack.isEmpty()
  +           ? null : (SubContextList) m_axesIteratorStack.peek();
     }
   
     //==========================================================
  @@ -529,25 +627,27 @@
     {
       return this.getCurrentNode();
     }
  -  
  +
     /**
      * Get the current context node list.
  -   * @return An iterator for the current context list, as 
  +   * @return An iterator for the current context list, as
      * defined in XSLT.
      */
     public final NodeIterator getContextNodes()
     {
  +
       try
       {
  -    ContextNodeList cnl = getContextNodeList();
  -    if(null != cnl)
  -      return cnl.cloneWithReset();
  -    else
  -      return null; // for now... this might ought to be an empty iterator.
  +      ContextNodeList cnl = getContextNodeList();
  +
  +      if (null != cnl)
  +        return cnl.cloneWithReset();
  +      else
  +        return null;  // for now... this might ought to be an empty iterator.
       }
  -    catch(CloneNotSupportedException cnse)
  +    catch (CloneNotSupportedException cnse)
       {
  -      return null; // error reporting?
  +      return null;  // error reporting?
       }
     }
   
  @@ -570,6 +670,4 @@
     {
       return XNodeSet.getStringFromNode(n);
     }
  -
  -
   }
  
  
  
  1.2       +87 -53    xml-xalan/java/src/org/apache/xpath/XPathException.java
  
  Index: XPathException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPathException.java	2000/07/05 14:44:27	1.1
  +++ XPathException.java	2000/10/30 18:58:27	1.2
  @@ -55,22 +55,26 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xpath;
  +
   import org.w3c.dom.Node;
  +
   import org.xml.sax.SAXException;
   
   /**
    * <meta name="usage" content="general"/>
  - * This class implements an exception object that all 
  + * This class implements an exception object that all
    * XPath classes will throw in case of an error.  This class
  - * extends SAXException, and may hold other exceptions. In the 
  - * case of nested exceptions, printStackTrace will dump 
  - * all the traces of the nested exceptions, not just the trace 
  + * extends SAXException, and may hold other exceptions. In the
  + * case of nested exceptions, printStackTrace will dump
  + * all the traces of the nested exceptions, not just the trace
    * of this object.
    */
   public class XPathException extends SAXException
   {
  +
  +  /** NEEDSDOC Field m_styleNode          */
     Object m_styleNode = null;
  -  
  +
     /**
      * Get the stylesheet node from where this error originated.
      * @return The stylesheet node from where this error originated, or null.
  @@ -79,87 +83,101 @@
     {
       return m_styleNode;
     }
  -  
  +
  +  /** NEEDSDOC Field m_exception          */
     protected Exception m_exception;
  -  
  +
     /**
  -   * Create an XPathException object that holds 
  +   * Create an XPathException object that holds
      * an error message.
      * @param message The error message.
      */
  -  public XPathException(String message) 
  +  public XPathException(String message)
     {
       super(message);
     }
  -  
  +
     /**
  -   * Create an XPathException object that holds 
  +   * Create an XPathException object that holds
      * an error message and the stylesheet node that
      * the error originated from.
      * @param message The error message.
      * @param styleNode The stylesheet node that the error originated from.
      */
  -  public XPathException(String message, Object styleNode) 
  +  public XPathException(String message, Object styleNode)
     {
  +
       super(message);
  +
       m_styleNode = styleNode;
     }
   
     /**
  -   * Create an XPathException object that holds 
  +   * Create an XPathException object that holds
      * an error message, the stylesheet node that
  -   * the error originated from, and another exception 
  +   * the error originated from, and another exception
      * that caused this exception.
      * @param message The error message.
      * @param styleNode The stylesheet node that the error originated from.
      * @param e The exception that caused this exception.
      */
  -  public XPathException (String message, Node styleNode, Exception e)
  +  public XPathException(String message, Node styleNode, Exception e)
     {
  +
       super(message);
  +
       m_styleNode = styleNode;
       this.m_exception = e;
     }
   
     /**
  -   * Create an XPathException object that holds 
  -   * an error message, and another exception 
  +   * Create an XPathException object that holds
  +   * an error message, and another exception
      * that caused this exception.
      * @param message The error message.
      * @param e The exception that caused this exception.
      */
  -  public XPathException (String message, Exception e)
  +  public XPathException(String message, Exception e)
     {
  +
       super(message);
  +
       this.m_exception = e;
     }
  -  
  +
     /**
  -   * Print the the trace of methods from where the error 
  -   * originated.  This will trace all nested exception 
  +   * Print the the trace of methods from where the error
  +   * originated.  This will trace all nested exception
      * objects, as well as this object.
      * @param s The stream where the dump will be sent to.
      */
  -  public void printStackTrace(java.io.PrintStream s) 
  +  public void printStackTrace(java.io.PrintStream s)
     {
  -    if(s == null)
  +
  +    if (s == null)
         s = System.err;
  +
       try
       {
         super.printStackTrace(s);
       }
  -    catch(Exception e){}
  +    catch (Exception e){}
  +
       Exception exception = m_exception;
  -    for(int i = 0; (i < 10) && (null != exception); i++)
  +
  +    for (int i = 0; (i < 10) && (null != exception); i++)
       {
         s.println("---------");
         exception.printStackTrace(s);
  -      if(exception instanceof SAXException)
  +
  +      if (exception instanceof SAXException)
         {
  -        SAXException se = (SAXException)exception;
  +        SAXException se = (SAXException) exception;
           Exception prev = exception;
  +
           exception = se.getException();
  -        if(prev == exception)
  +
  +        if (prev == exception)
             break;
         }
         else
  @@ -168,26 +186,34 @@
         }
       }
     }
  -  
  +
     /**
      * Find the most contained message.
      * @returns The error message of the originating exception.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public String getMessage() 
  +  public String getMessage()
     {
  +
       String lastMessage = super.getMessage();
       Exception exception = m_exception;
  -    while(null != exception)
  +
  +    while (null != exception)
       {
         String nextMessage = exception.getMessage();
  -      if(null != nextMessage)
  +
  +      if (null != nextMessage)
           lastMessage = nextMessage;
  -      if(exception instanceof SAXException)
  +
  +      if (exception instanceof SAXException)
         {
  -        SAXException se = (SAXException)exception;
  +        SAXException se = (SAXException) exception;
           Exception prev = exception;
  +
           exception = se.getException();
  -        if(prev == exception)
  +
  +        if (prev == exception)
             break;
         }
         else
  @@ -195,45 +221,54 @@
           exception = null;
         }
       }
  +
       return (null != lastMessage) ? lastMessage : "";
     }
   
     /**
  -   * Print the the trace of methods from where the error 
  -   * originated.  This will trace all nested exception 
  +   * Print the the trace of methods from where the error
  +   * originated.  This will trace all nested exception
      * objects, as well as this object.
      * @param s The writer where the dump will be sent to.
      */
  -  public void printStackTrace(java.io.PrintWriter s) 
  +  public void printStackTrace(java.io.PrintWriter s)
     {
  -    if(s == null)
  +
  +    if (s == null)
         s = new java.io.PrintWriter(System.err);
  +
       try
       {
         super.printStackTrace(s);
       }
  -    catch(Exception e){}
  +    catch (Exception e){}
  +
       Exception exception = m_exception;
  -    
  -    for(int i = 0; (i < 10) && (null != exception); i++)
  +
  +    for (int i = 0; (i < 10) && (null != exception); i++)
       {
         s.println("---------");
  +
         try
         {
           exception.printStackTrace(s);
         }
  -      catch(Exception e)
  +      catch (Exception e)
         {
           s.println("Could not print stack trace...");
         }
  -      if(exception instanceof SAXException)
  +
  +      if (exception instanceof SAXException)
         {
  -        SAXException se = (SAXException)exception;
  +        SAXException se = (SAXException) exception;
           Exception prev = exception;
  +
           exception = se.getException();
  -        if(prev == exception)
  +
  +        if (prev == exception)
           {
             exception = null;
  +
             break;
           }
         }
  @@ -245,14 +280,13 @@
     }
   
     /**
  -    * Return the embedded exception, if any.
  -    * Overrides org.xml.sax.SAXException.getException().
  -    *
  -    * @return The embedded exception, or null if there is none.
  -    */
  -  public Exception getException ()
  +   *  Return the embedded exception, if any.
  +   *  Overrides org.xml.sax.SAXException.getException().
  +   * 
  +   *  @return The embedded exception, or null if there is none.
  +   */
  +  public Exception getException()
     {
       return m_exception;
     }
  -
   }
  
  
  
  1.2       +9 -2      xml-xalan/java/src/org/apache/xpath/XPathFactory.java
  
  Index: XPathFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPathFactory.java	2000/07/05 14:44:27	1.1
  +++ XPathFactory.java	2000/10/30 18:58:27	1.2
  @@ -57,6 +57,7 @@
   package org.apache.xpath;
   
   import org.xml.sax.Locator;
  +
   import org.apache.xalan.utils.PrefixResolver;
   
   /**
  @@ -66,11 +67,17 @@
    */
   public interface XPathFactory
   {
  +
     /**
      * Create an XPath.
  +   *
  +   * NEEDSDOC @param exprString
  +   * NEEDSDOC @param locator
  +   * NEEDSDOC @param prefixResolver
  +   * NEEDSDOC @param type
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     XPath create(String exprString, Locator locator,
                  PrefixResolver prefixResolver, int type);
  -  
  -  
   }
  
  
  
  1.2       +7 -6      xml-xalan/java/src/org/apache/xpath/XPathProcessorException.java
  
  Index: XPathProcessorException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/XPathProcessorException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPathProcessorException.java	2000/07/05 14:44:27	1.1
  +++ XPathProcessorException.java	2000/10/30 18:58:29	1.2
  @@ -58,29 +58,30 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * Derived from XPathException in order that XPath processor 
  + * Derived from XPathException in order that XPath processor
    * exceptions may be specifically caught.
    */
   public class XPathProcessorException extends XPathException
   {
  +
     /**
  -   * Create an XPathProcessorException object that holds 
  +   * Create an XPathProcessorException object that holds
      * an error message.
      * @param message The error message.
      */
  -  public XPathProcessorException(String message) 
  +  public XPathProcessorException(String message)
     {
       super(message);
     }
   
     /**
  -   * Create an XPathProcessorException object that holds 
  -   * an error message, and another exception 
  +   * Create an XPathProcessorException object that holds
  +   * an error message, and another exception
      * that caused this exception.
      * @param message The error message.
      * @param e The exception that caused this exception.
      */
  -  public XPathProcessorException (String message, Exception e)
  +  public XPathProcessorException(String message, Exception e)
     {
       super(message, e);
     }
  
  
  
  1.2       +72 -58    xml-xalan/java/src/org/apache/xpath/axes/AncestorOrSelfWalker.java
  
  Index: AncestorOrSelfWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AncestorOrSelfWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AncestorOrSelfWalker.java	2000/07/05 14:45:10	1.1
  +++ AncestorOrSelfWalker.java	2000/10/30 18:58:41	1.2
  @@ -1,59 +1,59 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import java.util.Stack;
  @@ -62,6 +62,7 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -70,8 +71,11 @@
    */
   public class AncestorOrSelfWalker extends AncestorWalker
   {
  +
     /**
      * Construct an AncestorOrSelfWalker using a LocPathWalker.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public AncestorOrSelfWalker(LocPathIterator locPathIterator)
     {
  @@ -80,23 +84,33 @@
   
     /**
      * Push the ancestor nodes.
  +   *
  +   * NEEDSDOC @param n
      */
     protected void pushAncestors(Node n)
     {
  +
       m_ancestors = new Stack();
  +
       m_ancestors.push(n);
  +
       DOMHelper dh = m_lpi.getDOMHelper();
  -    while(null != (n = dh.getParentOfNode(n)))
  +
  +    while (null != (n = dh.getParentOfNode(n)))
  +    {
         m_ancestors.push(n);
  +    }
  +
       m_nextLevelAmount = m_ancestors.isEmpty() ? 0 : 1;
     }
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return m_lpi.getDOMHelper().getLevel(m_root);
     }
  -
   }
  
  
  
  1.2       +87 -70    xml-xalan/java/src/org/apache/xpath/axes/AncestorWalker.java
  
  Index: AncestorWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AncestorWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AncestorWalker.java	2000/07/05 14:45:11	1.1
  +++ AncestorWalker.java	2000/10/30 18:58:42	1.2
  @@ -1,59 +1,59 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import java.util.Stack;
  @@ -62,6 +62,7 @@
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -70,28 +71,41 @@
    */
   public class AncestorWalker extends ReverseAxesWalker
   {
  +
     /**
      * Construct an AncestorWalker using a LocPathWalker.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public AncestorWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -    
  +
     /**
      * Push the ancestor nodes.
  +   *
  +   * NEEDSDOC @param n
      */
     protected void pushAncestors(Node n)
     {
  +
       m_ancestors = new Stack();
  +
       DOMHelper dh = m_lpi.getDOMHelper();
  -    while(null != (n = dh.getParentOfNode(n)))
  +
  +    while (null != (n = dh.getParentOfNode(n)))
  +    {
         m_ancestors.push(n);
  +    }
  +
       m_nextLevelAmount = m_ancestors.isEmpty() ? 0 : 1;
     }
  -  
  +
     /**
      *  The root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  @@ -99,35 +113,38 @@
       super.setRoot(root);
     }
   
  -  
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  -    Node next = m_ancestors.isEmpty() ? null : (Node)m_ancestors.pop();
  +
  +    Node next = m_ancestors.isEmpty() ? null : (Node) m_ancestors.pop();
  +
       m_nextLevelAmount = m_ancestors.isEmpty() ? 0 : 1;
  +
       return setCurrentIfNotNull(next);
     }
  -  
  +
  +  /** NEEDSDOC Field m_ancestors          */
     protected Stack m_ancestors;
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
  +
       DOMHelper dh = m_lpi.getDOMHelper();
       Node p = dh.getParentOfNode(m_root);
  -    
  +
       return (null == p) ? 1 : dh.getLevel(p);
     }
  -
  -
   }
  -  
  
  
  
  1.3       +94 -73    xml-xalan/java/src/org/apache/xpath/axes/AttributeWalker.java
  
  Index: AttributeWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AttributeWalker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- AttributeWalker.java	2000/08/07 02:49:52	1.2
  +++ AttributeWalker.java	2000/10/30 18:58:43	1.3
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.NamedNodeMap;
   
  @@ -68,82 +69,102 @@
    */
   public class AttributeWalker extends AxesWalker
   {
  +
     /**
      * Construct an AttributeWalker using a LocPathWalker.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public AttributeWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      *  The root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_attrListPos = -1;
       m_attributeList = null;
       m_nAttrs = -2;
       m_nextLevelAmount = 1;
  +
       super.setRoot(root);
     }
  -  
  +
     /**
  -   * Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   * Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  -    if(m_currentNode.getNodeType() == Node.ELEMENT_NODE)
  +
  +    if (m_currentNode.getNodeType() == Node.ELEMENT_NODE)
       {
         m_attrListPos = -1;
         m_attributeList = m_currentNode.getAttributes();
  -      if(null != m_attributeList)
  +
  +      if (null != m_attributeList)
           m_nAttrs = m_attributeList.getLength();
         else
           m_nAttrs = -2;
       }
  +
       m_nextLevelAmount = 0;
  +
       return nextSibling();
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  +
       // Attributes don't really have siblings, but we'll fake it.
  -    if(null != m_attributeList)
  +    if (null != m_attributeList)
       {
         m_attrListPos++;
  -      if(m_attrListPos < m_nAttrs)
  +
  +      if (m_attrListPos < m_nAttrs)
         {
           return setCurrentIfNotNull(m_attributeList.item(m_attrListPos));
         }
         else
           m_attributeList = null;
       }
  -    return null; 
  +
  +    return null;
     }
  -  
  +
  +  /** NEEDSDOC Field m_attributeList          */
     NamedNodeMap m_attributeList;
  +
  +  /** NEEDSDOC Field m_attrListPos          */
     int m_attrListPos;
  +
  +  /** NEEDSDOC Field m_nAttrs          */
     int m_nAttrs;
  -    
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return m_lpi.getDOMHelper().getLevel(m_root);
     }
  -
   }
  
  
  
  1.2       +98 -72    xml-xalan/java/src/org/apache/xpath/axes/AttributeWalkerOneStep.java
  
  Index: AttributeWalkerOneStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AttributeWalkerOneStep.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- AttributeWalkerOneStep.java	2000/10/17 19:40:13	1.1
  +++ AttributeWalkerOneStep.java	2000/10/30 18:58:43	1.2
  @@ -1,83 +1,99 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.NamedNodeMap;
   import org.w3c.dom.traversal.NodeFilter;
  +
   import org.apache.xpath.patterns.NodeTestFilter;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class AttributeWalkerOneStep <needs-comment/>
  + */
   public class AttributeWalkerOneStep extends AxesWalker
   {
  +
  +  /** NEEDSDOC Field m_attributeList          */
     NamedNodeMap m_attributeList;
  +
  +  /** NEEDSDOC Field m_attrListPos          */
     int m_attrListPos;
  +
  +  /** NEEDSDOC Field m_nAttrs          */
     int m_nAttrs;
   
     /**
      *  The root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       super.setRoot(root);
  -    if(root.getNodeType() == Node.ELEMENT_NODE)
  +
  +    if (root.getNodeType() == Node.ELEMENT_NODE)
       {
         m_attrListPos = -1;
         m_attributeList = m_currentNode.getAttributes();
  -      if(null != m_attributeList)
  +
  +      if (null != m_attributeList)
           m_nAttrs = m_attributeList.getLength();
         else
           m_nAttrs = -2;
  @@ -86,15 +102,19 @@
   
     /**
      * Construct an AxesWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public AttributeWalkerOneStep(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -    
  +
     /**
      * Set the analysis ID.
      * @see org.apache.xpath.axes.WalkerFactory
  +   *
  +   * NEEDSDOC @param a
      */
     void setAnalysis(int a)
     {
  @@ -103,28 +123,34 @@
   
     /**
      * Get the next node in document order on the axes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node nextNode()
     {
  -    if(m_isFresh)
  +
  +    if (m_isFresh)
         m_isFresh = false;
  -    
  +
       Node current = this.getCurrentNode();
   
  -    if(current.supports("NodeTestFilter", "1.0"))
  -      ((NodeTestFilter)current).setNodeTest(this);
  +    if (current.supports(FEATURE_NODETESTFILTER, "1.0"))
  +      ((NodeTestFilter) current).setNodeTest(this);
   
  -    Node next =null;
  -    
  -    while(null != m_attributeList)
  +    Node next = null;
  +
  +    while (null != m_attributeList)
       {
         m_attrListPos++;
  -      if(m_attrListPos < m_nAttrs)
  +
  +      if (m_attrListPos < m_nAttrs)
         {
           next = m_attributeList.item(m_attrListPos);
  -        if(null != next)
  -          m_currentNode = next; 
  -        if(acceptNode(next) == NodeFilter.FILTER_ACCEPT)
  +
  +        if (null != next)
  +          m_currentNode = next;
  +
  +        if (acceptNode(next) == NodeFilter.FILTER_ACCEPT)
             break;
         }
         else
  @@ -133,10 +159,10 @@
           m_attributeList = null;
         }
       }
  -        
  -    if(null == next)
  +
  +    if (null == next)
         this.m_isDone = true;
  -    
  +
       return next;
     }
   }
  
  
  
  1.6       +827 -445  xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java
  
  Index: AxesWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/AxesWalker.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- AxesWalker.java	2000/10/17 19:40:13	1.5
  +++ AxesWalker.java	2000/10/30 18:58:44	1.6
  @@ -1,59 +1,59 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import java.util.Stack;
  @@ -70,89 +70,144 @@
   import org.apache.xpath.Expression;
   import org.apache.xpath.patterns.NodeTest;
   import org.apache.xpath.patterns.NodeTestFilter;
  -
   import org.apache.xalan.utils.PrefixResolver;
   
   // DOM2 imports
   import org.w3c.dom.Node;
   import org.w3c.dom.NamedNodeMap;
  -
   import org.w3c.dom.traversal.TreeWalker;
   import org.w3c.dom.traversal.NodeFilter;
   import org.w3c.dom.DOMException;
   
   /**
  - * Serves as common interface for axes Walkers, and stores common 
  + * Serves as common interface for axes Walkers, and stores common
    * state variables.
    */
   public abstract class AxesWalker extends NodeTest
  -  implements Cloneable, TreeWalker, NodeFilter, SubContextList
  +        implements Cloneable, TreeWalker, NodeFilter, SubContextList
   {
  -  boolean DEBUG = false;
  -  boolean DEBUG_WAITING = false;
  -  boolean DEBUG_TRAVERSAL = false;
  -  boolean DEBUG_LOCATED = false;
  -  boolean DEBUG_PREDICATECOUNTING = false;
   
  +  /** NEEDSDOC Field DEBUG          */
  +  static final boolean DEBUG = false;
  +
  +  /** NEEDSDOC Field DEBUG_WAITING          */
  +  static final boolean DEBUG_WAITING = false;
  +
  +  /** NEEDSDOC Field DEBUG_TRAVERSAL          */
  +  static final boolean DEBUG_TRAVERSAL = false;
  +
  +  /** NEEDSDOC Field DEBUG_LOCATED          */
  +  static final boolean DEBUG_LOCATED = false;
  +
  +  /** NEEDSDOC Field DEBUG_PREDICATECOUNTING          */
  +  static final boolean DEBUG_PREDICATECOUNTING = false;
  +
  +  /** NEEDSDOC Field FEATURE_NODETESTFILTER          */
  +  public static final String FEATURE_NODETESTFILTER = "NodeTestFilter";
  +
  +  /** NEEDSDOC Field m_lpi          */
     protected LocPathIterator m_lpi;
  -  public LocPathIterator getLocPathIterator() { return m_lpi; }
  -  public void setLocPathIterator(LocPathIterator li) { m_lpi = li; }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getLocPathIterator 
  +   *
  +   *
  +   * NEEDSDOC (getLocPathIterator) @return
  +   */
  +  public LocPathIterator getLocPathIterator()
  +  {
  +    return m_lpi;
  +  }
  +
  +  /**
  +   * NEEDSDOC Method setLocPathIterator 
  +   *
  +   *
  +   * NEEDSDOC @param li
  +   */
  +  public void setLocPathIterator(LocPathIterator li)
  +  {
  +    m_lpi = li;
  +  }
  +
     /**
      * Construct an AxesWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public AxesWalker(LocPathIterator locPathIterator)
     {
       m_lpi = locPathIterator;
     }
  -  
  +
     /**
      * Init an AxesWalker.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   * NEEDSDOC @param stepType
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public void init(Compiler compiler, int opPos, int stepType)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       // int nodeTestOpPos = compiler.getFirstChildPosOfStep(opPos);
       m_stepType = stepType;
  -    switch(stepType)
  +
  +    switch (stepType)
       {
  -    case OpCodes.OP_VARIABLE:
  -    case OpCodes.OP_EXTFUNCTION:
  -    case OpCodes.OP_FUNCTION:
  -    case OpCodes.OP_GROUP:
  +    case OpCodes.OP_VARIABLE :
  +    case OpCodes.OP_EXTFUNCTION :
  +    case OpCodes.OP_FUNCTION :
  +    case OpCodes.OP_GROUP :
         m_argLen = compiler.getArgLength(opPos);
         break;
  -    default:
  +    default :
         m_argLen = compiler.getArgLengthOfStep(opPos);
       }
  +
       initPredicateInfo(compiler, opPos);
  -    
  +
       // int testType = compiler.getOp(nodeTestOpPos);
     }
  -  
  +
     /**
      * Get a cloned AxesWalker.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  public Object clone() throws CloneNotSupportedException
     {
  -    AxesWalker clone = (AxesWalker)super.clone();
  +
  +    AxesWalker clone = (AxesWalker) super.clone();
   
  -    if((null != this.m_proximityPositions) && (this.m_proximityPositions == clone.m_proximityPositions))
  +    if ((null != this.m_proximityPositions)
  +            && (this.m_proximityPositions == clone.m_proximityPositions))
       {
         clone.m_proximityPositions = new int[this.m_proximityPositions.length];
  -      System.arraycopy(this.m_proximityPositions, 0, clone.m_proximityPositions, 0, this.m_proximityPositions.length);
  +
  +      System.arraycopy(this.m_proximityPositions, 0,
  +                       clone.m_proximityPositions, 0,
  +                       this.m_proximityPositions.length);
       }
  +
       m_testedForNTF = false;
  +
       return clone;
     }
  -  
  +
     /**
      * Reset the Walker.
      */
     public void reset()
     {
  +
       setCurrentNode(m_root);
  +
       m_isFresh = true;
     }
   
  @@ -160,151 +215,227 @@
      * The step type of the XPath step. Does not change after the constructor.
      */
     private int m_stepType;
  -  protected int getStepType() { return m_stepType; }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getStepType 
  +   *
  +   *
  +   * NEEDSDOC (getStepType) @return
  +   */
  +  protected int getStepType()
  +  {
  +    return m_stepType;
  +  }
  +
     /**
      * The arg length of the XPath step. Does not change after the constructor.
      */
     private int m_argLen;
  -  protected int getArgLen() { return m_argLen; }
   
     /**
  +   * NEEDSDOC Method getArgLen 
  +   *
  +   *
  +   * NEEDSDOC (getArgLen) @return
  +   */
  +  protected int getArgLen()
  +  {
  +    return m_argLen;
  +  }
  +
  +  /**
      * The type of this walker based on the pattern analysis.
      * @see org.apache.xpath.axes.WalkerFactory
      */
     protected int m_analysis = WalkerFactory.NO_OPTIMIZE;
  -  int getAnalysis() { return m_analysis; }
  -  void setAnalysis(int a) { m_analysis = a; }
  +
  +  /**
  +   * NEEDSDOC Method getAnalysis 
  +   *
  +   *
  +   * NEEDSDOC (getAnalysis) @return
  +   */
  +  int getAnalysis()
  +  {
  +    return m_analysis;
  +  }
   
     /**
  -   * An array of counts that correspond to the number 
  +   * NEEDSDOC Method setAnalysis 
  +   *
  +   *
  +   * NEEDSDOC @param a
  +   */
  +  void setAnalysis(int a)
  +  {
  +    m_analysis = a;
  +  }
  +
  +  /**
  +   * An array of counts that correspond to the number
      * of predicates the step contains.
      */
     protected int[] m_proximityPositions;
  -  
  +
     /**
      * Get the current sub-context position.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getProximityPosition()
     {
  +
       // System.out.println("getProximityPosition - m_predicateIndex: "+m_predicateIndex);
       return getProximityPosition(m_predicateIndex);
     }
  -  
  +
     /**
      * Get the current sub-context position.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getProximityPosition(XPathContext xctxt)
     {
       return getProximityPosition();
     }
  -  
  +
     /**
      * Get the current sub-context position.
  +   *
  +   * NEEDSDOC @param predicateIndex
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getProximityPosition(int predicateIndex)
     {
  -    return (predicateIndex >= 0) ?
  -           m_proximityPositions[predicateIndex] : 0;
  +    return (predicateIndex >= 0) ? m_proximityPositions[predicateIndex] : 0;
     }
  -  
  +
     /**
      * Reset the proximity positions counts.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void resetProximityPositions()
  -    throws org.xml.sax.SAXException
  +  public void resetProximityPositions() throws org.xml.sax.SAXException
     {
  -    if(m_predicateCount > 0)
  +
  +    if (m_predicateCount > 0)
       {
  -      if(null == m_proximityPositions)
  +      if (null == m_proximityPositions)
           m_proximityPositions = new int[m_predicateCount];
  -      for(int i = 0; i < m_predicateCount; i++)
  +
  +      for (int i = 0; i < m_predicateCount; i++)
         {
           initProximityPosition(i);
         }
       }
     }
  -  
  +
     /**
      * Init the proximity position to zero for a forward axes.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void initProximityPosition(int i)
  -    throws org.xml.sax.SAXException
  +  public void initProximityPosition(int i) throws org.xml.sax.SAXException
     {
       m_proximityPositions[i] = 0;
     }
   
     /**
      * Count forward one proximity position.
  +   *
  +   * NEEDSDOC @param i
      */
     protected void countProximityPosition(int i)
     {
  -    if(i < m_proximityPositions.length)
  +    if (i < m_proximityPositions.length)
         m_proximityPositions[i]++;
     }
  -  
  +
     /**
      * Tells if this is a reverse axes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isReverseAxes()
     {
       return false;
     }
  -  
  +
     /**
      * Which predicate we are executing.
      */
     int m_predicateIndex = -1;
  -  
  +
     /**
  -   * Get which predicate is executing.  Returns 
  +   * Get which predicate is executing.  Returns
      * -1 if no predicate is executing.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getPredicateIndex()
     {
       return m_predicateIndex;
     }
  -  
  +
     /**
      * Process the predicates.
  +   *
  +   * NEEDSDOC @param context
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     boolean executePredicates(Node context, XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  -  {    
  +          throws org.xml.sax.SAXException
  +  {
  +
       m_predicateIndex = 0;
  +
       int nPredicates = m_predicateCount;
  -    if(nPredicates == 0)
  +
  +    if (nPredicates == 0)
         return true;
  -    
  +
       PrefixResolver savedResolver = xctxt.getNamespaceContext();
  -    int savedStackframeIndex = xctxt.getVarStack().getCurrentStackFrameIndex();
  +
       try
       {
         xctxt.pushSubContextList(this);
  -      xctxt.getVarStack().setCurrentStackFrameIndex(m_lpi.getStackFrameIndex());
         xctxt.setNamespaceContext(m_lpi.getPrefixResolver());
         xctxt.pushCurrentNode(context);
  -      for(int i = 0; i < nPredicates; i++)
  +
  +      for (int i = 0; i < nPredicates; i++)
         {
           XObject pred;
  +
           pred = m_predicates[i].execute(xctxt);
  -        if(XObject.CLASS_NUMBER == pred.getType())
  +
  +        if (XObject.CLASS_NUMBER == pred.getType())
           {
  -          if(DEBUG_PREDICATECOUNTING)
  +          if (DEBUG_PREDICATECOUNTING)
             {
               System.out.println("=============");
  -            System.out.println("m_predicateIndex: "+m_predicateIndex);
  -            System.out.println("getProximityPosition(m_predicateIndex): "+getProximityPosition(m_predicateIndex));
  -            System.out.println("pred.num(): "+pred.num());
  +            System.out.println("m_predicateIndex: " + m_predicateIndex);
  +            System.out.println("getProximityPosition(m_predicateIndex): "
  +                               + getProximityPosition(m_predicateIndex));
  +            System.out.println("pred.num(): " + pred.num());
             }
  -          if(this.getProximityPosition(m_predicateIndex) != (int)pred.num())
  +
  +          if (this.getProximityPosition(m_predicateIndex) != (int) pred.num())
             {
               return false;
             }
           }
  -        else if(!pred.bool())
  +        else if (!pred.bool())
             return false;
  -        
  +
           countProximityPosition(++m_predicateIndex);
         }
       }
  @@ -313,110 +444,147 @@
         xctxt.popCurrentNode();
         xctxt.setNamespaceContext(savedResolver);
         xctxt.popSubContextList();
  -      xctxt.getVarStack().setCurrentStackFrameIndex(savedStackframeIndex);
       }
   
       m_predicateIndex = -1;
  +
       return true;
     }
  -  
  +
     /**
      * Number of predicates (in effect).
      */
     int m_predicateCount;
  -  
  +
     /**
      * Get the number of predicates that this walker has.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getPredicateCount()
     {
       return m_predicateCount;
     }
  -  
  +
     /**
      * Set the number of predicates that this walker has.
  +   *
  +   * NEEDSDOC @param count
      */
     public void setPredicateCount(int count)
     {
       m_predicateCount = count;
     }
  -  
  +
     /**
      * Init predicate info.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     private void initPredicateInfo(Compiler compiler, int opPos)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       int pos = compiler.getFirstPredicateOpPos(opPos);
  +
       m_predicates = compiler.getCompiledPredicates(pos);
       m_predicateCount = (null == m_predicates) ? 0 : m_predicates.length;
     }
  -  
  +
  +  /** NEEDSDOC Field m_predicates          */
     private Expression[] m_predicates;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getPredicate 
  +   *
  +   *
  +   * NEEDSDOC @param index
  +   *
  +   * NEEDSDOC (getPredicate) @return
  +   */
     Expression getPredicate(int index)
     {
       return m_predicates[index];
     }
  -  
  +
     /**
  -   * Tell if the given node is a parent of the 
  +   * Tell if the given node is a parent of the
      * step context, or the step context node itself.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     boolean isAncestorOfRootContext(Node n)
     {
  +
       Node parent = m_root;
  -    while(null != (parent = parent.getParentNode()))
  +
  +    while (null != (parent = parent.getParentNode()))
       {
  -      if(parent.equals( n ))
  +      if (parent.equals(n))
           return true;
       }
  +
       return false;
     }
  -  
  +
     //=============== TreeWalker Implementation ===============
  -  
  +
     /**
      *  The root node of the TreeWalker, as specified when it was created.
      */
     Node m_root;
  -  
  +
     /**
      * The root node of the TreeWalker, as specified in setRoot(Node root).
      * Note that this may actually be below the current node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRoot()
     {
       return m_root;
     }
  -  
  +
  +  /** NEEDSDOC Field m_isFresh          */
     boolean m_isFresh;
   
     /**
      * Set the root node of the TreeWalker.
      * (Not part of the DOM2 TreeWalker interface).
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_isFresh = true;
       m_root = root;
       m_currentNode = root;
       m_prevReturned = null;
  -    if(null == root)
  +
  +    if (null == root)
       {
  -      throw new RuntimeException("\n !!!! Error! Setting the root of a walker to null!!!");
  +      throw new RuntimeException(
  +        "\n !!!! Error! Setting the root of a walker to null!!!");
       }
  +
       try
       {
         resetProximityPositions();
       }
  -    catch(org.xml.sax.SAXException se)
  +    catch (org.xml.sax.SAXException se)
       {
  +
         // TODO: Fix this...
         throw new RuntimeException(se.getMessage());
       }
     }
  -  
  +
     /**
      *  The node at which the TreeWalker is currently positioned.
      */
  @@ -424,46 +592,58 @@
   
     /**
      * The node at which the TreeWalker is currently positioned.
  -   * <br> The value must not be null. Alterations to the DOM tree may cause 
  -   * the current node to no longer be accepted by the TreeWalker's 
  -   * associated filter. currentNode may also be explicitly set to any node, 
  -   * whether or not it is within the subtree specified by the root node or 
  -   * would be accepted by the filter and whatToShow flags. Further 
  -   * traversal occurs relative to currentNode even if it is not part of the 
  -   * current view by applying the filters in the requested direction (not 
  -   * changing currentNode where no traversal is possible). 
  +   * <br> The value must not be null. Alterations to the DOM tree may cause
  +   * the current node to no longer be accepted by the TreeWalker's
  +   * associated filter. currentNode may also be explicitly set to any node,
  +   * whether or not it is within the subtree specified by the root node or
  +   * would be accepted by the filter and whatToShow flags. Further
  +   * traversal occurs relative to currentNode even if it is not part of the
  +   * current view by applying the filters in the requested direction (not
  +   * changing currentNode where no traversal is possible).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      * @exception DOMException
  -   *    NOT_SUPPORTED_ERR: Raised if the specified <code>currentNode</code> 
  +   *    NOT_SUPPORTED_ERR: Raised if the specified <code>currentNode</code>
      *   is<code>null</code> .
      */
     public final Node getCurrentNode()
  -  { 
  -    return m_currentNode; 
  +  {
  +    return m_currentNode;
     }
  -  
  +
     /**
      * Set the current node.
  +   *
  +   * NEEDSDOC @param currentNode
  +   *
  +   * @throws DOMException
      */
  -  public void setCurrentNode(Node currentNode)
  -    throws DOMException
  -  { 
  -    m_currentNode = currentNode; 
  +  public void setCurrentNode(Node currentNode) throws DOMException
  +  {
  +    m_currentNode = currentNode;
     }
  -  
  +
     /**
      * Set the current node if it's not null.
  +   *
  +   * NEEDSDOC @param currentNode
      * @return The node passed in.
  +   *
  +   * @throws DOMException
      */
  -  protected Node setCurrentIfNotNull(Node currentNode)
  -    throws DOMException
  -  { 
  -    if(null != currentNode)
  -      m_currentNode = currentNode; 
  +  protected Node setCurrentIfNotNull(Node currentNode) throws DOMException
  +  {
  +
  +    if (null != currentNode)
  +      m_currentNode = currentNode;
  +
       return currentNode;
     }
  -  
  +
     /**
      *  The filter used to screen nodes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeFilter getFilter()
     {
  @@ -471,28 +651,30 @@
     }
   
     /**
  -   *  The value of this flag determines whether the children of entity 
  -   * reference nodes are visible to the TreeWalker. If false, they will be 
  +   *  The value of this flag determines whether the children of entity
  +   * reference nodes are visible to the TreeWalker. If false, they will be
      * skipped over.
  -   * <br> To produce a view of the document that has entity references 
  -   * expanded and does not expose the entity reference node itself, use the 
  -   * whatToShow flags to hide the entity reference node and set 
  -   * expandEntityReferences to true when creating the TreeWalker. To 
  -   * produce a view of the document that has entity reference nodes but no 
  -   * entity expansion, use the whatToShow flags to show the entity 
  +   * <br> To produce a view of the document that has entity references
  +   * expanded and does not expose the entity reference node itself, use the
  +   * whatToShow flags to hide the entity reference node and set
  +   * expandEntityReferences to true when creating the TreeWalker. To
  +   * produce a view of the document that has entity reference nodes but no
  +   * entity expansion, use the whatToShow flags to show the entity
      * reference node and set expandEntityReferences to false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean getExpandEntityReferences()
     {
       return true;
     }
  -  
  +
     /**
  -   *  Moves to and returns the closest visible ancestor node of the current 
  -   * node. If the search for parentNode attempts to step upward from the 
  -   * TreeWalker's root node, or if it fails to find a visible ancestor 
  +   *  Moves to and returns the closest visible ancestor node of the current
  +   * node. If the search for parentNode attempts to step upward from the
  +   * TreeWalker's root node, or if it fails to find a visible ancestor
      * node, this method retains the current position and returns null.
  -   * @return  The new parent node, or null if the current node has no parent 
  +   * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
     public Node parentNode()
  @@ -501,23 +683,23 @@
     }
   
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
       return null;
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
  @@ -526,25 +708,26 @@
     }
   
     /**
  -   *  Moves the <code>TreeWalker</code> to the last visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the last visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   children  in the TreeWalker's logical view.
      */
     public Node lastChild()
     {
  +
       // We may need to support this...
       throw new RuntimeException("lastChild not supported!");
     }
   
     /**
  -   *  Moves the <code>TreeWalker</code> to the previous sibling of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible previous sibling, returns <code>null</code> , and retains the 
  +   *  Moves the <code>TreeWalker</code> to the previous sibling of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible previous sibling, returns <code>null</code> , and retains the
      * current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   previous sibling in the TreeWalker's logical view.
      */
     public Node previousSibling()
  @@ -553,192 +736,264 @@
     }
   
     /**
  -   *  Moves the <code>TreeWalker</code> to the previous visible node in 
  -   * document order relative to the current node, and returns the new node. 
  -   * If the current node has no previous node,  or if the search for 
  -   * previousNode attempts to step upward from the TreeWalker's root node, 
  -   * returns <code>null</code> , and retains the current node. 
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   *  Moves the <code>TreeWalker</code> to the previous visible node in
  +   * document order relative to the current node, and returns the new node.
  +   * If the current node has no previous node,  or if the search for
  +   * previousNode attempts to step upward from the TreeWalker's root node,
  +   * returns <code>null</code> , and retains the current node.
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   previous node in the TreeWalker's logical view.
      */
     public Node previousNode()
     {
       throw new RuntimeException("previousNode not supported!");
     }
  -  
  +
  +  /** NEEDSDOC Field m_nextWalker          */
     protected AxesWalker m_nextWalker;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setNextWalker 
  +   *
  +   *
  +   * NEEDSDOC @param walker
  +   */
     public void setNextWalker(AxesWalker walker)
     {
       m_nextWalker = walker;
     }
   
  +  /**
  +   * NEEDSDOC Method getNextWalker 
  +   *
  +   *
  +   * NEEDSDOC (getNextWalker) @return
  +   */
     public AxesWalker getNextWalker()
     {
       return m_nextWalker;
     }
   
  +  /** NEEDSDOC Field m_prevWalker          */
     AxesWalker m_prevWalker;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setPrevWalker 
  +   *
  +   *
  +   * NEEDSDOC @param walker
  +   */
     public void setPrevWalker(AxesWalker walker)
     {
       m_prevWalker = walker;
     }
   
  +  /**
  +   * NEEDSDOC Method getPrevWalker 
  +   *
  +   *
  +   * NEEDSDOC (getPrevWalker) @return
  +   */
     public AxesWalker getPrevWalker()
     {
       return m_prevWalker;
     }
  -  
  +
     /**
      * Diagnostics.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String toString()
     {
  +
       Class cl = this.getClass();
       String clName = cl.getName();
  -    java.util.StringTokenizer tokenizer 
  -      = new java.util.StringTokenizer(clName, ".");
  -    while(tokenizer.hasMoreTokens())
  +    java.util.StringTokenizer tokenizer =
  +      new java.util.StringTokenizer(clName, ".");
  +
  +    while (tokenizer.hasMoreTokens())
  +    {
         clName = tokenizer.nextToken();
  +    }
  +
       String rootName;
       String currentNodeName;
  +
       try
       {
  -      rootName = (null == m_root) 
  -                 ? "null" 
  -                   : m_root.getNodeName() 
  -                     + "{"+((org.apache.xalan.stree.Child)m_root).getUid()+"}";
  -      currentNodeName = (null == m_root) 
  -                        ? "null" 
  -                          : m_currentNode.getNodeName()
  -                            + "{"+((org.apache.xalan.stree.Child)m_currentNode).getUid()+"}";
  -    }
  -    catch(ClassCastException cce)
  -    {
  -      rootName = (null == m_root) 
  -                 ? "null" 
  -                   : m_root.getNodeName();
  -      currentNodeName = (null == m_root) 
  -                        ? "null" 
  -                          : m_currentNode.getNodeName();
  +      rootName = (null == m_root)
  +                 ? "null"
  +                 : m_root.getNodeName() + "{"
  +                   + ((org.apache.xalan.stree.Child) m_root).getUid() + "}";
  +      currentNodeName =
  +        (null == m_root)
  +        ? "null"
  +        : m_currentNode.getNodeName() + "{"
  +          + ((org.apache.xalan.stree.Child) m_currentNode).getUid() + "}";
  +    }
  +    catch (ClassCastException cce)
  +    {
  +      rootName = (null == m_root) ? "null" : m_root.getNodeName();
  +      currentNodeName = (null == m_root)
  +                        ? "null" : m_currentNode.getNodeName();
       }
   
  -    return clName+"["+rootName+"]["+currentNodeName+"]";
  +    return clName + "[" + rootName + "][" + currentNodeName + "]";
     }
  -  
  +
     /**
      * Diagnostics.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected String nodeToString(Node n)
     {
  +
       try
       {
  -      return (null != n) 
  -             ? n.getNodeName()+"{"+ ((org.apache.xalan.stree.Child)n).getUid() + "}"
  -               : "null";
  +      return (null != n)
  +             ? n.getNodeName() + "{" + ((org.apache.xalan.stree.Child) n).getUid() + "}"
  +             : "null";
       }
  -    catch(ClassCastException cce)
  +    catch (ClassCastException cce)
       {
  -      return (null != n) 
  -             ? n.getNodeName()
  -               : "null";
  +      return (null != n) ? n.getNodeName() : "null";
       }
     }
  -  
  +
     /**
      * Diagnostics.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     private Node returnNextNode(Node n)
     {
  -    if(DEBUG_LOCATED && (null != n))
  +
  +    if (DEBUG_LOCATED && (null != n))
       {
  -      printDebug("RETURN --->"+nodeToString(n));
  +      printDebug("RETURN --->" + nodeToString(n));
       }
  -    else if(DEBUG_LOCATED)
  +    else if (DEBUG_LOCATED)
       {
         printDebug("RETURN --->null");
       }
  +
       return n;
     }
  -  
  +
     /**
      * Diagnostics.
  +   *
  +   * NEEDSDOC @param s
      */
     private void printDebug(String s)
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
       {
         System.out.print("\n");
  -      if(null != m_currentNode)
  +
  +      if (null != m_currentNode)
         {
           try
           {
  -          org.apache.xalan.stree.Child n = ((org.apache.xalan.stree.Child)m_currentNode);
  +          org.apache.xalan.stree.Child n =
  +            ((org.apache.xalan.stree.Child) m_currentNode);
             int depth = n.getLevel();
  -          for(int i = 0; i < depth; i++)
  +
  +          for (int i = 0; i < depth; i++)
  +          {
               System.out.print(" ");
  -        }
  -        catch(ClassCastException cce)
  -        {
  +          }
           }
  +        catch (ClassCastException cce){}
         }
  +
         System.out.print(s);
       }
     }
  -  
  +
     /**
      * Do a diagnostics dump of the entire document.
  +   *
  +   * NEEDSDOC @param node
  +   * NEEDSDOC @param indent
      */
     private void dumpAll(Node node, int indent)
     {
  -    for(int i = 0; i < indent; i++)
  +
  +    for (int i = 0; i < indent; i++)
  +    {
         System.out.print(" ");
  +    }
   
       System.out.print(nodeToString(node));
  -    if(Node.TEXT_NODE == node.getNodeType())
  +
  +    if (Node.TEXT_NODE == node.getNodeType())
       {
         String value = node.getNodeValue();
  -      if(null != value)
  +
  +      if (null != value)
         {
  -        System.out.print("+= -->"+value.trim());
  +        System.out.print("+= -->" + value.trim());
         }
       }
  +
       System.out.println("");
  +
       NamedNodeMap map = node.getAttributes();
  -    if(null != map)
  +
  +    if (null != map)
       {
         int n = map.getLength();
  -      for(int i = 0; i < n; i++)
  +
  +      for (int i = 0; i < n; i++)
         {
  -        for(int k = 0; k < indent; k++)
  +        for (int k = 0; k < indent; k++)
  +        {
             System.out.print(" ");
  +        }
  +
           System.out.print("attr -->");
           System.out.print(nodeToString(map.item(i)));
  +
           String value = map.item(i).getNodeValue();
  -        if(null != value)
  +
  +        if (null != value)
           {
  -          System.out.print("+= -->"+value.trim());
  +          System.out.print("+= -->" + value.trim());
           }
  +
           System.out.println("");
         }
       }
  +
       Node child = node.getFirstChild();
  -    while(null != child)
  +
  +    while (null != child)
       {
  -      dumpAll(child, indent+1);
  +      dumpAll(child, indent + 1);
  +
         child = child.getNextSibling();
       }
     }
   
     /**
      * Diagnostics.
  +   *
  +   * NEEDSDOC @param s
      */
     private void printDebugAdd(String s)
     {
  -    if(DEBUG)
  +
  +    if (DEBUG)
       {
  -      System.out.print("; "+s);
  +      System.out.print("; " + s);
       }
     }
   
  @@ -747,109 +1002,140 @@
      */
     private void printEntryDebug()
     {
  -    if(true && DEBUG_TRAVERSAL)
  +
  +    if (true && DEBUG_TRAVERSAL)
       {
         System.out.print("\n============================\n");
  -      if(null != m_currentNode)
  +
  +      if (null != m_currentNode)
         {
           try
           {
  -          org.apache.xalan.stree.Child n = ((org.apache.xalan.stree.Child)m_currentNode);
  +          org.apache.xalan.stree.Child n =
  +            ((org.apache.xalan.stree.Child) m_currentNode);
             int depth = n.getLevel();
  -          for(int i = 0; i < depth; i++)
  +
  +          for (int i = 0; i < depth; i++)
  +          {
               System.out.print("+");
  -        }
  -        catch(ClassCastException cce)
  -        {
  +          }
           }
  +        catch (ClassCastException cce){}
         }
  -      System.out.print(" "+this.toString()+", "+nodeToString(this.m_currentNode));
  +
  +      System.out.print(" " + this.toString() + ", "
  +                       + nodeToString(this.m_currentNode));
         printWaiters();
       }
     }
  -  
  +
     /**
      * Diagnostics.
      */
     private void printWaiters()
     {
  -    if(DEBUG_WAITING)
  +
  +    if (DEBUG_WAITING)
       {
         int nWaiting = m_lpi.m_waiting.size();
  -      for(int i = 0; i < nWaiting; i++)
  -      { 
  -        AxesWalker ws = (AxesWalker)m_lpi.m_waiting.elementAt(i);
  -        printDebug("["+ws.toString()
  -                   +" WAITING... ]");
  +
  +      for (int i = 0; i < nWaiting; i++)
  +      {
  +        AxesWalker ws = (AxesWalker) m_lpi.m_waiting.elementAt(i);
  +
  +        printDebug("[" + ws.toString() + " WAITING... ]");
         }
  -      printDebug("Waiting count: "+nWaiting);
  +
  +      printDebug("Waiting count: " + nWaiting);
       }
     }
  -  
  +
     // short-lived flag.
  +
  +  /** NEEDSDOC Field m_waitingForNext          */
     private boolean m_waitingForNext = false;
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return 0;
     }
  -  
  +
  +  /** NEEDSDOC Field m_nextLevelAmount          */
     protected int m_nextLevelAmount;
  -  
  +
     /**
      * Tell what's the next level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getNextLevelAmount()
     {
       return m_nextLevelAmount;
     }
  -  
  +
     /**
  -   * Tell if it's OK to traverse to the next node, following document 
  +   * Tell if it's OK to traverse to the next node, following document
      * order, or if the walker should wait for a condition to occur.
      * @prevStepWalker The previous walker in the location path.
  -   * @testWalker The walker being tested, but the state may not be intact, 
  +   * @testWalker The walker being tested, but the state may not be intact,
      * so only static information can be obtained from it.
  +   *
  +   * NEEDSDOC @param prevStepWalker
  +   * NEEDSDOC @param testWalker
  +   * NEEDSDOC @param currentTestNode
  +   * NEEDSDOC @param nextLevelAmount
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  protected boolean checkOKToTraverse(AxesWalker prevStepWalker, 
  -                                      AxesWalker testWalker, 
  +  protected boolean checkOKToTraverse(AxesWalker prevStepWalker,
  +                                      AxesWalker testWalker,
                                         Node currentTestNode,
                                         int nextLevelAmount)
     {
  +
       DOMHelper dh = m_lpi.getDOMHelper();
  -    
       int level = dh.getLevel(currentTestNode);
  -    
  +
       // Is this always the context node of the test walker?
       Node prevNode = prevStepWalker.m_currentNode;
   
       // Can the previous walker go past the one being tested?
  -    if(DEBUG_WAITING)
  -      printDebug("[prevStepWalker.getLevelMax():"+prevStepWalker.getLevelMax()
  -                 +" > level:"+level+"?]");
  +    if (DEBUG_WAITING)
  +      printDebug("[prevStepWalker.getLevelMax():"
  +                 + prevStepWalker.getLevelMax() + " > level:" + level + "?]");
  +
       boolean ok;
  -    if(!prevStepWalker.m_isDone && prevStepWalker.getLevelMax() > level) 
  +
  +    if (!prevStepWalker.m_isDone && prevStepWalker.getLevelMax() > level)
       {
  +
         // Is (prevStepWalker.m_currentNode > the currentTestNode)?
         // (Sorry about the reverse logic).
  -      boolean isNodeAfter 
  -        = !dh.isNodeAfter(prevNode, currentTestNode);
  -      if(DEBUG_WAITING)
  -        printDebug("[isNodeAfter:"+isNodeAfter+"?]");
  -      if(isNodeAfter)
  +      boolean isNodeAfter = !dh.isNodeAfter(prevNode, currentTestNode);
  +
  +      if (DEBUG_WAITING)
  +        printDebug("[isNodeAfter:" + isNodeAfter + "?]");
  +
  +      if (isNodeAfter)
         {
           int prevStepLevel = dh.getLevel(prevNode);
  +
           // If the previous step walker is below us in the tree, 
           // then we have to wait until it pops back up to our level, 
           // (if it ever does).
  -        if(DEBUG_WAITING)
  -          printDebug("[prevStepLevel:"+prevStepLevel
  -                     +" <= (level:"+level+"+nextLevelAmount:"+nextLevelAmount+"):"+(level+nextLevelAmount)+"?]");
  -        if(prevStepLevel > (level+nextLevelAmount))
  +        if (DEBUG_WAITING)
  +          printDebug("[prevStepLevel:" + prevStepLevel + " <= (level:"
  +                     + level + "+nextLevelAmount:" + nextLevelAmount + "):"
  +                     + (level + nextLevelAmount) + "?]");
  +
  +        if (prevStepLevel > (level + nextLevelAmount))
           {
  +
             // if next step is down, then ok = true, else
             // if next step is horizontal, then we have to wait.
             ok = false;
  @@ -862,413 +1148,510 @@
       }
       else
         ok = true;
  -    if(DEBUG_WAITING)
  -      printDebug("checkOKToTraverse = "+ok);
  -    
  +
  +    if (DEBUG_WAITING)
  +      printDebug("checkOKToTraverse = " + ok);
  +
       return ok;
     }
  -  
  +
  +  /** NEEDSDOC Field m_didSwitch          */
     private boolean m_didSwitch = false;
  -  
  +
     /**
  -   * Check if any walkers need to fire before the given walker.  If they 
  -   * do, then the given walker will be put on the waiting list, and the 
  +   * Check if any walkers need to fire before the given walker.  If they
  +   * do, then the given walker will be put on the waiting list, and the
      * waiting walker will be returned.
      * @param walker The walker that is about to call nextNode(), or null.
      * @return walker argument or new walker.
      */
     AxesWalker checkWaiting(AxesWalker walker)
     {
  +
       // printDebug("checkWaiting: "+walker.toString()+", "+nodeToString(walker.m_currentNode));
  -    if((null != walker) && (null == walker.m_currentNode))
  +    if ((null != walker) && (null == walker.m_currentNode))
         return walker;
  -    
  +
       int nWaiting = m_lpi.m_waiting.size();
  -    for(int i = 0; i < nWaiting; i++)
  -    { 
  -      AxesWalker ws = (AxesWalker)m_lpi.m_waiting.elementAt(i);
  +
  +    for (int i = 0; i < nWaiting; i++)
  +    {
  +      AxesWalker ws = (AxesWalker) m_lpi.m_waiting.elementAt(i);
         AxesWalker prevStepWalker = ws.m_prevWalker;
  -      if(null != prevStepWalker)
  +
  +      if (null != prevStepWalker)
         {
  -        if(DEBUG_WAITING)
  -          printDebug("Calling checkOKToTraverse("+prevStepWalker.toString()+", "+
  -                     ws.toString()+", .);");
  +        if (DEBUG_WAITING)
  +          printDebug("Calling checkOKToTraverse(" + prevStepWalker.toString()
  +                     + ", " + ws.toString() + ", .);");
   
  -        if(checkOKToTraverse(prevStepWalker, ws, 
  -                             ws.m_currentNode, ws.m_nextLevelAmount))
  +        if (checkOKToTraverse(prevStepWalker, ws, ws.m_currentNode,
  +                              ws.m_nextLevelAmount))
           {
  -          if(null != walker)
  +          if (null != walker)
             {
               AxesWalker deferedWalker = walker;
  -            
  -            if(DEBUG_WAITING)
  -              printDebug("[Moving "+deferedWalker.toString()
  -                         +", "+nodeToString(deferedWalker.m_currentNode)+" to WAITING list]");
  -            if(!isWaiting(deferedWalker))
  +
  +            if (DEBUG_WAITING)
  +              printDebug("[Moving " + deferedWalker.toString() + ", "
  +                         + nodeToString(deferedWalker.m_currentNode)
  +                         + " to WAITING list]");
  +
  +            if (!isWaiting(deferedWalker))
                 m_lpi.addToWaitList(deferedWalker);
             }
   
             walker = ws;
  +
             m_lpi.removeFromWaitList(walker);
  -          if(DEBUG_WAITING)
  -            printDebug("[And using WAITING on "+ws.toString());
  -          
  +
  +          if (DEBUG_WAITING)
  +            printDebug("[And using WAITING on " + ws.toString());
  +
             walker.printEntryDebug();
  +
             m_didSwitch = true;
  +
             break;
           }
         }
       }
  -    
  +
       return walker;
     }
  -  
  +
     /**
  -   * We have to do something to get things moving along, 
  +   * We have to do something to get things moving along,
      * so get the earliest (in doc order) waiter.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     private AxesWalker getEarliestWaiting()
     {
  +
       DOMHelper dh = m_lpi.getDOMHelper();
       AxesWalker first = null;
       int nWaiting = m_lpi.m_waiting.size();
  -    for(int i = 0; i < nWaiting; i++)
  +
  +    for (int i = 0; i < nWaiting; i++)
       {
  -      AxesWalker ws = (AxesWalker)m_lpi.m_waiting.elementAt(i);
  -      if(first == null)
  +      AxesWalker ws = (AxesWalker) m_lpi.m_waiting.elementAt(i);
  +
  +      if (first == null)
           first = ws;
         else
         {
  -        if(!dh.isNodeAfter(ws.m_currentNode, first.m_currentNode))
  +        if (!dh.isNodeAfter(ws.m_currentNode, first.m_currentNode))
             first = ws;
         }
       }
  -    if(null != first)
  +
  +    if (null != first)
       {
         m_lpi.removeFromWaitList(first);
  -      if(DEBUG_WAITING)
  -        printDebug("[(getEarliestWaiting)Using WAITING on "+first.toString());
  -      
  +
  +      if (DEBUG_WAITING)
  +        printDebug("[(getEarliestWaiting)Using WAITING on "
  +                   + first.toString());
  +
         first.printEntryDebug();
       }
  +
       return first;
     }
  -  
  +
     /**
      * Tell if the given walker is already on the waiting list.
  +   *
  +   * NEEDSDOC @param walker
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     boolean isWaiting(AxesWalker walker)
     {
  +
       int nWaiting = m_lpi.m_waiting.size();
  -    for(int i = 0; i < nWaiting; i++)
  -    { 
  -      AxesWalker ws = (AxesWalker)m_lpi.m_waiting.elementAt(i);
  -      if(ws == walker)
  +
  +    for (int i = 0; i < nWaiting; i++)
  +    {
  +      AxesWalker ws = (AxesWalker) m_lpi.m_waiting.elementAt(i);
  +
  +      if (ws == walker)
           return true;
       }
  +
       return false;
     }
  -  
  +
     /**
  -   * Check if a given walker needs to wait for the previous walker to 
  +   * Check if a given walker needs to wait for the previous walker to
      * catch up.
  +   *
  +   * NEEDSDOC @param walker
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     AxesWalker checkNeedsToWait(AxesWalker walker)
     {
  +
       AxesWalker prevWalker = walker.m_prevWalker;
  -    if(null != prevWalker)
  +
  +    if (null != prevWalker)
       {
  -      if(DEBUG_WAITING)
  -        printDebug("Calling checkOKToTraverse("+prevWalker.toString()+", "+
  -                   walker.toString()+", .);");
  -      if(!checkOKToTraverse(prevWalker, walker, 
  -                            walker.m_currentNode, walker.m_nextLevelAmount))
  +      if (DEBUG_WAITING)
  +        printDebug("Calling checkOKToTraverse(" + prevWalker.toString()
  +                   + ", " + walker.toString() + ", .);");
  +
  +      if (!checkOKToTraverse(prevWalker, walker, walker.m_currentNode,
  +                             walker.m_nextLevelAmount))
         {
  -        if(DEBUG_WAITING)
  -          printDebug("[Adding "+walker.toString()+" to WAITING list");
  -        if(isWaiting(walker))
  +        if (DEBUG_WAITING)
  +          printDebug("[Adding " + walker.toString() + " to WAITING list");
  +
  +        if (isWaiting(walker))
           {
             try
             {
  -            if(DEBUG_WAITING)
  -              printDebug("checkNeedsToWait.clone: "+walker.toString());
  -            m_lpi.addToWaitList((AxesWalker)walker.clone());
  -          }
  -          catch(CloneNotSupportedException cnse)
  -          {
  +            if (DEBUG_WAITING)
  +              printDebug("checkNeedsToWait.clone: " + walker.toString());
  +
  +            m_lpi.addToWaitList((AxesWalker) walker.clone());
             }
  +          catch (CloneNotSupportedException cnse){}
           }
           else
             m_lpi.addToWaitList(walker);
  +
           walker = walker.m_prevWalker;
  +
           walker.printEntryDebug();
         }
       }
  +
       return walker;
     }
  -  
  +
  +  /** NEEDSDOC Field m_isDone          */
     boolean m_isDone = false;
  -  
  +
     // See note where this is used about this variable.
  +
  +  /** NEEDSDOC Field m_testedForNTF          */
     protected boolean m_testedForNTF = false;
  -  
  +
     /**
      * Get the next node in document order on the axes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected Node getNextNode()
     {
  -    if(m_isFresh)
  +
  +    if (m_isFresh)
         m_isFresh = false;
  -    
  +
       Node current = this.getCurrentNode();
  -    if(current.supports("NodeTestFilter", "1.0"))
  -      ((NodeTestFilter)current).setNodeTest(this);
  -    
  +
  +    if (current.supports(FEATURE_NODETESTFILTER, "1.0"))
  +      ((NodeTestFilter) current).setNodeTest(this);
  +
       Node next = this.firstChild();
   
  -    while(null == next)
  -    {     
  +    while (null == next)
  +    {
         next = this.nextSibling();
  -      
  -      if(null == next)
  +
  +      if (null == next)
         {
           Node p = this.parentNode();
  -        if(null == p)
  +
  +        if (null == p)
             break;
         }
       }
  -    if(null == next)
  +
  +    if (null == next)
         this.m_isDone = true;
  +
       return next;
     }
  -  
  +
  +  /** NEEDSDOC Field m_prevReturned          */
     Node m_prevReturned;
  -  
  +
  +  /** NEEDSDOC Field m_didDumpAll          */
     static boolean m_didDumpAll = false;
   
     /**
  -   *  Moves the <code>TreeWalker</code> to the next visible node in document 
  -   * order relative to the current node, and returns the new node. If the 
  -   * current node has no next node,  or if the search for nextNode attempts 
  -   * to step upward from the TreeWalker's root node, returns 
  +   *  Moves the <code>TreeWalker</code> to the next visible node in document
  +   * order relative to the current node, and returns the new node. If the
  +   * current node has no next node,  or if the search for nextNode attempts
  +   * to step upward from the TreeWalker's root node, returns
      * <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next node  in the TreeWalker's logical view.
      */
     public Node nextNode()
     {
  -    if(DEBUG_TRAVERSAL && !m_didDumpAll)
  +
  +    if (DEBUG_TRAVERSAL &&!m_didDumpAll)
       {
         m_didDumpAll = true;
  +
         // Node doc = (Node.DOCUMENT_NODE == m_root.getNodeType()) ? m_root : m_root.getOwnerDocument();
         // dumpAll(doc, 0);
       }
  -    
  +
       Node nextNode = null;
       AxesWalker walker = m_lpi.getLastUsedWalker();
  +
       // DOMHelper dh = m_lpi.getDOMHelper();
       // walker.printEntryDebug();
       m_didSwitch = false;
  +
       boolean processWaiters = true;
   
       do
       {
  -      while(true)
  +      while (true)
         {
  +
           // Check to see if there's any walkers that need to execute first.
  -        if(processWaiters)
  +        if (processWaiters)
           {
             AxesWalker waiting = checkWaiting(walker);
  -          if(m_didSwitch)
  +
  +          if (m_didSwitch)
             {
               m_didSwitch = false;
               walker = waiting;
             }
  -          else if(null != walker)
  +          else if (null != walker)
             {
               waiting = checkNeedsToWait(walker);
  -            if(waiting != walker)
  +
  +            if (waiting != walker)
               {
                 walker = waiting;
  +
                 continue;
               }
             }
           }
           else
             processWaiters = true;
  -        
  -        if(null == walker)
  +
  +        if (null == walker)
             break;
  -        
  +
           nextNode = walker.getNextNode();
  -        
  -        if(DEBUG_TRAVERSAL)
  -          walker.printDebug(walker.toString()+"--NEXT->"+nodeToString(nextNode)+")");
  -        
  -        if(null == nextNode)
  +
  +        if (DEBUG_TRAVERSAL)
  +          walker.printDebug(walker.toString() + "--NEXT->"
  +                            + nodeToString(nextNode) + ")");
  +
  +        if (null == nextNode)
           {
  +
             // AxesWalker prev = walker; ?? -sb
             walker = walker.m_prevWalker;
  -          if(null != walker)
  +
  +          if (null != walker)
               walker.printEntryDebug();
             else
             {
               walker = getEarliestWaiting();
  -            if(null != walker)
  +
  +            if (null != walker)
               {
                 processWaiters = false;
  +
                 continue;
               }
             }
           }
           else
           {
  -          if(walker.acceptNode(nextNode) != NodeFilter.FILTER_ACCEPT)
  +          if (walker.acceptNode(nextNode) != NodeFilter.FILTER_ACCEPT)
             {
  -            if(DEBUG_TRAVERSAL)
  +            if (DEBUG_TRAVERSAL)
                 printDebugAdd("[FILTER_SKIP]");
  +
               continue;
             }
             else
             {
  -            if(DEBUG_TRAVERSAL)
  +            if (DEBUG_TRAVERSAL)
                 printDebugAdd("[FILTER_ACCEPT]");
             }
  -          
  -          if(null == walker.m_nextWalker)
  +
  +          if (null == walker.m_nextWalker)
             {
  +
               // walker.pushState();
  -            if(DEBUG_TRAVERSAL)
  -              printDebug("May be returning: "+nodeToString(nextNode));
  -            if(DEBUG_TRAVERSAL && (null != m_prevReturned))
  -              printDebugAdd(", m_prevReturned: "+nodeToString(m_prevReturned));
  -            
  +            if (DEBUG_TRAVERSAL)
  +              printDebug("May be returning: " + nodeToString(nextNode));
  +
  +            if (DEBUG_TRAVERSAL && (null != m_prevReturned))
  +              printDebugAdd(", m_prevReturned: "
  +                            + nodeToString(m_prevReturned));
  +
               m_lpi.setLastUsedWalker(walker);
  +
               // return walker.returnNextNode(nextNode);
               break;
             }
             else
             {
               AxesWalker prev = walker;
  +
               walker = walker.m_nextWalker;
  +
               /*
               if((walker.getRoot() != null) &&
               prev.getLevelMax() >= walker.getLevelMax()) // bogus, but might be ok
               */
  -            if(isWaiting(walker))
  +            if (isWaiting(walker))
               {
                 try
                 {
  -                walker = (AxesWalker)walker.clone();
  +                walker = (AxesWalker) walker.clone();
  +
                   // walker.pushState();
                   // System.out.println("AxesWalker - Calling setRoot(1)");
                   walker.setRoot(nextNode);
  -                if(DEBUG_WAITING)
  -                  printDebug("clone: "+walker.toString());
  -              }
  -              catch(CloneNotSupportedException cnse)
  -              {
  +
  +                if (DEBUG_WAITING)
  +                  printDebug("clone: " + walker.toString());
                 }
  +              catch (CloneNotSupportedException cnse){}
               }
               else
               {
  +
                 // System.out.println("AxesWalker - Calling setRoot(2)");
                 walker.setRoot(nextNode);
               }
  +
               walker.m_prevWalker = prev;
  +
               walker.printEntryDebug();
   
               continue;
             }
  -        } // if(null != nextNode)
  -        
  -      } // while(null != walker)
  -      
  +        }  // if(null != nextNode)
  +      }  // while(null != walker)
       }
  +
       // Not sure what is going on here, but we were loosing
       // the next node in the nodeset because it's coming from a 
       // different document. 
  -    while((null != nextNode) && (null != m_prevReturned)
  -          && nextNode.getOwnerDocument() == m_prevReturned.getOwnerDocument()                   
  -          && m_lpi.getDOMHelper().isNodeAfter(nextNode, m_prevReturned));
  -    
  +    while (
  +      (null != nextNode) && (null != m_prevReturned)
  +      && nextNode.getOwnerDocument() == m_prevReturned.getOwnerDocument()
  +      && m_lpi.getDOMHelper().isNodeAfter(nextNode, m_prevReturned));
  +
       m_prevReturned = nextNode;
  -    if(DEBUG_LOCATED)
  +
  +    if (DEBUG_LOCATED)
         return returnNextNode(nextNode);
       else
         return nextNode;
     }
  -  
  +
     //============= End TreeWalker Implementation =============
  -  
  +
  +  /**
  +   * NEEDSDOC Method getLastPos 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getLastPos) @return
  +   */
     public int getLastPos(XPathContext xctxt)
     {
  +
       int pos = getProximityPosition();
  -    
       AxesWalker walker;
  +
       try
       {
  -      walker = (AxesWalker)clone();
  +      walker = (AxesWalker) clone();
       }
  -    catch(CloneNotSupportedException cnse)
  +    catch (CloneNotSupportedException cnse)
       {
         return -1;
       }
  +
       walker.setPredicateCount(walker.getPredicateCount() - 1);
       walker.setNextWalker(null);
       walker.setPrevWalker(null);
  +
       LocPathIterator lpi = walker.getLocPathIterator();
       AxesWalker savedWalker = lpi.getLastUsedWalker();
  +
       try
       {
         lpi.setLastUsedWalker(walker);
  +
         Node next;
  +
         while (null != (next = walker.nextNode()))
  +      {
           pos++;
  +      }
  +
         // TODO: Should probably save this in the iterator.
       }
       finally
       {
         lpi.setLastUsedWalker(savedWalker);
       }
  +
       // System.out.println("pos: "+pos);
       return pos;
     }
   
     //=============== NodeFilter Implementation ===============
  -  
  +
     /**
  -   *  Test whether a specified node is visible in the logical view of a 
  -   * TreeWalker or NodeIterator. This function will be called by the 
  -   * implementation of TreeWalker and NodeIterator; it is not intended to 
  +   *  Test whether a specified node is visible in the logical view of a
  +   * TreeWalker or NodeIterator. This function will be called by the
  +   * implementation of TreeWalker and NodeIterator; it is not intended to
      * be called directly from user code.
      * @param n  The node to check to see if it passes the filter or not.
  -   * @return  a constant to determine whether the node is accepted, 
  +   * @return  a constant to determine whether the node is accepted,
      *   rejected, or skipped, as defined  above .
      */
     public short acceptNode(Node n)
  -  { 
  +  {
  +
       XPathContext xctxt = m_lpi.getXPathContext();
  +
       try
       {
         xctxt.pushCurrentNode(n);
  +
         XObject score = execute(xctxt);
  +
         // System.out.println("::acceptNode - score: "+score.num()+"::");
  -      
  -      if(score != NodeTest.SCORE_NONE)
  -      {                    
  -        if(m_predicateCount > 0)
  +      if (score != NodeTest.SCORE_NONE)
  +      {
  +        if (m_predicateCount > 0)
           {
             countProximityPosition(0);
  -          
  -          if(!executePredicates(n, xctxt))
  +
  +          if (!executePredicates(n, xctxt))
               return NodeFilter.FILTER_SKIP;
           }
  +
           return NodeFilter.FILTER_ACCEPT;
         }
       }
  -    catch(org.xml.sax.SAXException se)
  +    catch (org.xml.sax.SAXException se)
       {
  +
         // TODO: Fix this.
         throw new RuntimeException(se.getMessage());
       }
  @@ -1276,10 +1659,9 @@
       {
         xctxt.popCurrentNode();
       }
  +
       return NodeFilter.FILTER_SKIP;
     }
   
  -  
     //============= End NodeFilter Implementation =============
  -  
   }
  
  
  
  1.3       +86 -74    xml-xalan/java/src/org/apache/xpath/axes/ChildWalker.java
  
  Index: ChildWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildWalker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ChildWalker.java	2000/08/07 02:49:53	1.2
  +++ ChildWalker.java	2000/10/30 18:58:45	1.3
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -66,71 +67,82 @@
    * @see <a href="http://www.w3.org/TR/xpath#axes">XPath axes descriptions</a>
    */
   public class ChildWalker extends AxesWalker
  -{    
  +{
  +
     /**
      * Construct an ChildWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public ChildWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      *  The root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       // System.out.println("ChildWalker.setRoot");
       m_nextLevelAmount = root.hasChildNodes() ? 1 : 0;
  +
       // System.out.println("Back from calling hasChildNodes");
       super.setRoot(root);
  +
       // System.out.println("Exiting ChildWalker.setRoot");
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       // System.out.println("ChildWalker.firstChild");
       m_nextLevelAmount = 0;
  -    if(m_root == m_currentNode)
  +
  +    if (m_root == m_currentNode)
       {
  +
         // System.out.println("ChildWalker - Calling getFirstChild");
         return setCurrentIfNotNull(this.m_root.getFirstChild());
       }
  -    else 
  +    else
         return null;
     }
  -    
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  -    if(m_root != m_currentNode)
  +
  +    if (m_root != m_currentNode)
         return setCurrentIfNotNull(m_currentNode.getNextSibling());
  -    else 
  +    else
         return null;
     }
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return m_lpi.getDOMHelper().getLevel(m_root);
     }
  -
  -
   }
  -
  
  
  
  1.2       +77 -73    xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerMultiStep.java
  
  Index: ChildWalkerMultiStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerMultiStep.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChildWalkerMultiStep.java	2000/10/17 19:40:13	1.1
  +++ ChildWalkerMultiStep.java	2000/10/30 18:58:47	1.2
  @@ -1,59 +1,59 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.w3c.dom.Node;
  @@ -94,12 +94,12 @@
   
       Node current = this.getCurrentNode();
   
  -    if (current.supports("NodeTestFilter", "1.0"))
  +    if (current.supports(FEATURE_NODETESTFILTER, "1.0"))
         ((NodeTestFilter) current).setNodeTest(this);
   
  -    Node next = (m_root == m_currentNode) ?
  -                m_currentNode.getFirstChild() :
  -                m_currentNode.getNextSibling();
  +    Node next = (m_root == m_currentNode)
  +                ? m_currentNode.getFirstChild()
  +                : m_currentNode.getNextSibling();
   
       if (null != next)
       {
  @@ -121,29 +121,32 @@
   
       return next;
     }
  -  
  +
     /**
  -   * Moves the <code>TreeWalker</code> to the next visible node in document 
  -   * order relative to the current node, and returns the new node. If the 
  -   * current node has no next node,  or if the search for nextNode attempts 
  -   * to step upward from the TreeWalker's root node, returns 
  +   * Moves the <code>TreeWalker</code> to the next visible node in document
  +   * order relative to the current node, and returns the new node. If the
  +   * current node has no next node,  or if the search for nextNode attempts
  +   * to step upward from the TreeWalker's root node, returns
      * <code>null</code> , and retains the current node.
  -   * 
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   *
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next node  in the TreeWalker's logical view.
      */
     public Node nextNode()
  -  {    
  +  {
  +
       AxesWalker walker = m_lpi.getLastUsedWalker();
  -    
  -    while(null != walker)
  +
  +    while (null != walker)
       {
         Node next = walker.getNextNode();
  -      if(null != next) 
  +
  +      if (null != next)
         {
  -        if(null != walker.m_nextWalker)
  +        if (null != walker.m_nextWalker)
           {
             walker = walker.m_nextWalker;
  +
             walker.setRoot(next);
             m_lpi.setLastUsedWalker(walker);
           }
  @@ -153,11 +156,12 @@
         else
         {
           walker = walker.m_prevWalker;
  -        if(null != walker)
  +
  +        if (null != walker)
             m_lpi.setLastUsedWalker(walker);
         }
       }
  -    
  +
       return null;
     }
   }
  
  
  
  1.2       +87 -72    xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerOneStep.java
  
  Index: ChildWalkerOneStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ChildWalkerOneStep.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ChildWalkerOneStep.java	2000/10/17 19:40:13	1.1
  +++ ChildWalkerOneStep.java	2000/10/30 18:58:47	1.2
  @@ -1,77 +1,87 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeFilter;
  +
   import org.apache.xpath.patterns.NodeTestFilter;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class ChildWalkerOneStep <needs-comment/>
  + */
   public class ChildWalkerOneStep extends AxesWalker
   {
  +
     /**
      * Construct an AxesWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public ChildWalkerOneStep(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
  @@ -81,6 +91,8 @@
     /**
      * Set the analysis ID.
      * @see org.apache.xpath.axes.WalkerFactory
  +   *
  +   * NEEDSDOC @param a
      */
     void setAnalysis(int a)
     {
  @@ -89,40 +101,43 @@
   
     /**
      * Get the next node in document order on the axes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node nextNode()
     {
  -    if(m_isFresh)
  -      m_isFresh = false;
  -    
  -    Node current = this.getCurrentNode();
  -    
  -    if(current.supports("NodeTestFilter", "1.0"))
  -      ((NodeTestFilter)current).setNodeTest(this);
   
       Node next;
  -    if(m_root == m_currentNode)
  +
  +    if (m_root == m_currentNode)
  +    {
         next = m_currentNode.getFirstChild();
  +      m_isFresh = false;
  +    }
       else
         next = m_currentNode.getNextSibling();
   
  -    if(null != next)
  +    if (null != next)
       {
         m_currentNode = next;
  -      while(acceptNode(next) != NodeFilter.FILTER_ACCEPT)
  +
  +      while (acceptNode(next) != NodeFilter.FILTER_ACCEPT)
         {
           next = next.getNextSibling();
  -        if(null != next)
  -          m_currentNode = next; 
  +
  +        if (null != next)
  +          m_currentNode = next;
           else
  +        {
  +          this.m_isDone = true;
  +
             break;
  +        }
         }
       }
  -    
  -    if(null == next)
  +    else
         this.m_isDone = true;
  -    
  +
       return next;
     }
  -
   }
  
  
  
  1.2       +108 -21   xml-xalan/java/src/org/apache/xpath/axes/ContextNodeList.java
  
  Index: ContextNodeList.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ContextNodeList.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ContextNodeList.java	2000/07/05 14:45:11	1.1
  +++ ContextNodeList.java	2000/10/30 18:58:47	1.2
  @@ -1,63 +1,150 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Interface ContextNodeList
  + */
   public interface ContextNodeList
   {
  +
  +  /**
  +   * NEEDSDOC Method getCurrentNode 
  +   *
  +   *
  +   * NEEDSDOC (getCurrentNode) @return
  +   */
     public Node getCurrentNode();
  -  
  +
     /**
  -   * Get the current position, which is one less than 
  -   * the next nextNode() call will retreave.  i.e. if 
  -   * you call getCurrentPos() and the return is 0, the next 
  +   * Get the current position, which is one less than
  +   * the next nextNode() call will retreave.  i.e. if
  +   * you call getCurrentPos() and the return is 0, the next
      * fetch will take place at index 1.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getCurrentPos();
  -  
  +
     /**
      * Reset the iterator.
      */
     public void reset();
  -  
  +
     /**
  -   * If setShouldCacheNodes(true) is called, then nodes will 
  +   * If setShouldCacheNodes(true) is called, then nodes will
      * be cached.  They are not cached by default.
  +   *
  +   * NEEDSDOC @param b
      */
     public void setShouldCacheNodes(boolean b);
  -  
  +
     /**
  -   * If an index is requested, NodeSet will call this method 
  -   * to run the iterator to the index.  By default this sets 
  -   * m_next to the index.  If the index argument is -1, this 
  +   * If an index is requested, NodeSet will call this method
  +   * to run the iterator to the index.  By default this sets
  +   * m_next to the index.  If the index argument is -1, this
      * signals that the iterator should be run to the end.
  +   *
  +   * NEEDSDOC @param index
      */
     public void runTo(int index);
  -  
  +
     /**
      * Set the current position in the node set.
      * @param i Must be a valid index.
      */
     public void setCurrentPos(int i);
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int size();
  -  
  +
     /**
  -   * Tells if this NodeSet is "fresh", in other words, if 
  -   * the first nextNode() that is called will return the 
  +   * Tells if this NodeSet is "fresh", in other words, if
  +   * the first nextNode() that is called will return the
      * first node in the set.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isFresh();
  -  
  +
     /**
      * Get a cloned Iterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset()
  -    throws CloneNotSupportedException;
  +  public NodeIterator cloneWithReset() throws CloneNotSupportedException;
   
  -  public Object clone()
  -    throws CloneNotSupportedException;
  +  /**
  +   * NEEDSDOC Method clone 
  +   *
  +   *
  +   * NEEDSDOC (clone) @return
  +   *
  +   * @throws CloneNotSupportedException
  +   */
  +  public Object clone() throws CloneNotSupportedException;
   }
  
  
  
  1.2       +75 -63    xml-xalan/java/src/org/apache/xpath/axes/DescendantOrSelfWalker.java
  
  Index: DescendantOrSelfWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/DescendantOrSelfWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DescendantOrSelfWalker.java	2000/07/05 14:45:14	1.1
  +++ DescendantOrSelfWalker.java	2000/10/30 18:58:48	1.2
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -67,8 +68,11 @@
    */
   public class DescendantOrSelfWalker extends DescendantWalker
   {
  +
     /**
      * Construct a DescendantOrSelfWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public DescendantOrSelfWalker(LocPathIterator locPathIterator)
     {
  @@ -77,32 +81,40 @@
   
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_processedSelf = false;
  +
       super.setRoot(root);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       // Follow my made-up rule about returning the self node as a child.
       // (only in this case, it isn't the self).
  -    if(!m_processedSelf)
  +    if (!m_processedSelf)
       {
         m_processedSelf = true;
  +
         return setCurrentIfNotNull(m_root);
       }
  +
       return super.firstChild();
     }
  -      
  -  boolean m_processedSelf;  
  +
  +  /** NEEDSDOC Field m_processedSelf          */
  +  boolean m_processedSelf;
   }
  
  
  
  1.2       +95 -75    xml-xalan/java/src/org/apache/xpath/axes/DescendantWalker.java
  
  Index: DescendantWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/DescendantWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DescendantWalker.java	2000/07/05 14:45:14	1.1
  +++ DescendantWalker.java	2000/10/30 18:58:48	1.2
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -67,83 +68,102 @@
    */
   public class DescendantWalker extends AxesWalker
   {
  +
     /**
      * Construct an DescendantWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public DescendantWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_nextLevelAmount = root.hasChildNodes() ? 1 : 0;
  +
       super.setRoot(root);
     }
   
     /**
  -   *  Moves to and returns the closest visible ancestor node of the current 
  -   * node. If the search for parentNode attempts to step upward from the 
  -   * TreeWalker's root node, or if it fails to find a visible ancestor 
  +   *  Moves to and returns the closest visible ancestor node of the current
  +   * node. If the search for parentNode attempts to step upward from the
  +   * TreeWalker's root node, or if it fails to find a visible ancestor
      * node, this method retains the current position and returns null.
  -   * @return  The new parent node, or null if the current node has no parent 
  +   * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
     public Node parentNode()
     {
  +
       Node n;
  -    if(m_root.equals(m_currentNode))
  +
  +    if (m_root.equals(m_currentNode))
       {
         n = null;
       }
       else
       {
         Node p = m_currentNode.getParentNode();
  -      n = m_root.equals( p ) ? null : p;
  +
  +      n = m_root.equals(p) ? null : p;
       }
  +
       m_nextLevelAmount = 0;
  +
       return setCurrentIfNotNull(n);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       Node next = m_currentNode.getFirstChild();
  +
       m_nextLevelAmount = (null == next) ? 0 : (next.hasChildNodes() ? 1 : 0);
  +
       return setCurrentIfNotNull(next);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  -    Node next 
  -      = m_root.equals(m_currentNode) ? null : m_currentNode.getNextSibling();
  +
  +    Node next = m_root.equals(m_currentNode)
  +                ? null : m_currentNode.getNextSibling();
  +
       m_nextLevelAmount = (null == next) ? 0 : (next.hasChildNodes() ? 1 : 0);
  +
       return setCurrentIfNotNull(next);
     }
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return Short.MAX_VALUE;
     }
  -
   }
  
  
  
  1.5       +147 -105  xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java
  
  Index: FilterExprWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FilterExprWalker.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- FilterExprWalker.java	2000/10/17 19:40:13	1.4
  +++ FilterExprWalker.java	2000/10/30 18:58:49	1.5
  @@ -1,59 +1,59 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
  @@ -80,8 +80,11 @@
    */
   public class FilterExprWalker extends AxesWalker
   {
  +
     /**
      * Construct a FilterExprWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public FilterExprWalker(LocPathIterator locPathIterator)
     {
  @@ -90,146 +93,176 @@
   
     /**
      * Init a FilterExprWalker.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   * NEEDSDOC @param stepType
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public void init(Compiler compiler, int opPos, int stepType)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       super.init(compiler, opPos, stepType);
  +
       // Smooth over an anomily in the opcode map...
  -    switch(stepType)
  +    switch (stepType)
       {
  -    case OpCodes.OP_VARIABLE:
  -    case OpCodes.OP_EXTFUNCTION:
  -    case OpCodes.OP_FUNCTION:
  -    case OpCodes.OP_GROUP:
  +    case OpCodes.OP_VARIABLE :
  +    case OpCodes.OP_EXTFUNCTION :
  +    case OpCodes.OP_FUNCTION :
  +    case OpCodes.OP_GROUP :
         m_expr = compiler.compile(opPos);
         break;
  -    default:
  -      m_expr = compiler.compile(opPos+2);
  +    default :
  +      m_expr = compiler.compile(opPos + 2);
       }
     }
   
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       // System.out.println("root: "+root);
       XPathContext xctxt = m_lpi.getXPathContext();
       PrefixResolver savedResolver = xctxt.getNamespaceContext();
  -    int savedStackframeIndex = xctxt.getVarStack().getCurrentStackFrameIndex();
  +
       try
       {
         xctxt.pushCurrentNode(root);
  -      xctxt.getVarStack().setCurrentStackFrameIndex(m_lpi.getStackFrameIndex());
         xctxt.setNamespaceContext(m_lpi.getPrefixResolver());
  +
         // System.out.println("calling m_expr.execute(m_lpi.getXPathContext())");
         XObject obj = m_expr.execute(m_lpi.getXPathContext());
  +
         // System.out.println("Back from m_expr.execute(m_lpi.getXPathContext()): "+obj);
  -      m_nodeSet = (null != obj) ? obj.nodeset() : null;      
  +      m_nodeSet = (null != obj) ? obj.nodeset() : null;
         m_peek = null;
       }
  -    catch(org.xml.sax.SAXException se)
  +    catch (org.xml.sax.SAXException se)
       {
  +
         // TODO: Fix...
         throw new RuntimeException(se.getMessage());
       }
       finally
       {
         xctxt.popCurrentNode();
  -      xctxt.getVarStack().setCurrentStackFrameIndex(savedStackframeIndex);
         xctxt.setNamespaceContext(savedResolver);
       }
  -    
  +
       super.setRoot(root);
     }
  -  
  +
     /**
      * Get a cloned FilterExprWalker.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  public Object clone() throws CloneNotSupportedException
     {
  -    FilterExprWalker clone = (FilterExprWalker)super.clone();
  +
  +    FilterExprWalker clone = (FilterExprWalker) super.clone();
  +
       // clone.m_expr = (Expression)((Expression)m_expr).clone();
  -    if(null != m_nodeSet)
  -      clone.m_nodeSet = (NodeIterator)((ContextNodeList)m_nodeSet).clone();
  +    if (null != m_nodeSet)
  +      clone.m_nodeSet = (NodeIterator) ((ContextNodeList) m_nodeSet).clone();
  +
       return clone;
     }
  -  
  -  public void setLocPathIterator(LocPathIterator li) 
  -  { 
  -    super.setLocPathIterator(li); 
  +
  +  /**
  +   * NEEDSDOC Method setLocPathIterator 
  +   *
  +   *
  +   * NEEDSDOC @param li
  +   */
  +  public void setLocPathIterator(LocPathIterator li)
  +  {
  +    super.setLocPathIterator(li);
     }
  -  
  +
     /**
  -   * This method needs to override AxesWalker.acceptNode because FilterExprWalkers 
  +   * This method needs to override AxesWalker.acceptNode because FilterExprWalkers
      * don't need to, and shouldn't, do a node test.
      * @param n  The node to check to see if it passes the filter or not.
  -   * @return  a constant to determine whether the node is accepted, 
  +   * @return  a constant to determine whether the node is accepted,
      *   rejected, or skipped, as defined  above .
      */
     public short acceptNode(Node n)
     {
  +
       try
       {
  -      if(m_predicateCount > 0)
  +      if (m_predicateCount > 0)
         {
           countProximityPosition(0);
  -        
  -        if(!executePredicates(n, m_lpi.getXPathContext()))
  +
  +        if (!executePredicates(n, m_lpi.getXPathContext()))
             return NodeFilter.FILTER_SKIP;
         }
  -      
  +
         return NodeFilter.FILTER_ACCEPT;
       }
  -    catch(org.xml.sax.SAXException se)
  +    catch (org.xml.sax.SAXException se)
       {
         throw new RuntimeException(se.getMessage());
       }
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next visible node in document 
  -   * order relative to the current node, and returns the new node. If the 
  -   * current node has no next node,  or if the search for nextNode attempts 
  -   * to step upward from the TreeWalker's root node, returns 
  +   *  Moves the <code>TreeWalker</code> to the next visible node in document
  +   * order relative to the current node, and returns the new node. If the
  +   * current node has no next node,  or if the search for nextNode attempts
  +   * to step upward from the TreeWalker's root node, returns
      * <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next node  in the TreeWalker's logical view.
      */
     public Node getNextNode()
     {
  +
       Node next;
  -    if(null != m_peek)
  +
  +    if (null != m_peek)
       {
         next = m_peek;
         m_peek = null;
       }
       else
       {
  -      if(null != m_nodeSet)
  +      if (null != m_nodeSet)
         {
           Node current = this.getCurrentNode();
  -        if(current instanceof NodeTestFilter)
  -          ((NodeTestFilter)current).setNodeTest(this);
  +
  +        if (current instanceof NodeTestFilter)
  +          ((NodeTestFilter) current).setNodeTest(this);
   
           next = m_nodeSet.nextNode();
         }
         else
           next = null;
       }
  -    
  +
       // Bogus, I think, but probably OK for right now since a filterExpr 
       // can only occur at the head of a location path.
  -    if(null == next)
  +    if (null == next)
       {
         m_nextLevelAmount = 0;
       }
       else
       {
  -     // System.out.println("FilterExprWalker.getNextNode");
  -     m_nextLevelAmount = (next.hasChildNodes() ? 1 : 0);
  +
  +      // System.out.println("FilterExprWalker.getNextNode");
  +      m_nextLevelAmount = (next.hasChildNodes() ? 1 : 0);
  +
         /* ...WAIT TO SEE IF WE REALLY NEED THIS...
         m_peek = m_nodeSet.nextNode();
         if(null == m_peek)
  @@ -241,23 +274,32 @@
         }
         */
       }
  +
       // System.out.println("FilterExprWalker.getNextNode - Returning: "+next);
       return setCurrentIfNotNull(next);
     }
  -  
  +
  +  /** NEEDSDOC Field m_expr          */
     Expression m_expr;
  +
  +  /** NEEDSDOC Field m_nodeSet          */
     NodeIterator m_nodeSet;
  +
  +  /** NEEDSDOC Field m_peek          */
     Node m_peek = null;
  -    
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
  +
       // TODO: Oh, this is going to be a hell of a lot of fun...
       // return Short.MAX_VALUE;
  -    return 1; // bogus, will probably screw things up.
  +    return 1;  // bogus, will probably screw things up.
  +
       // return m_lpi.getDOMHelper().getLevel(this.m_currentNode)+1;
     }
  -
   }
  
  
  
  1.2       +70 -62    xml-xalan/java/src/org/apache/xpath/axes/FollowingSiblingWalker.java
  
  Index: FollowingSiblingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FollowingSiblingWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FollowingSiblingWalker.java	2000/07/05 14:45:15	1.1
  +++ FollowingSiblingWalker.java	2000/10/30 18:58:49	1.2
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -67,35 +68,42 @@
    */
   public class FollowingSiblingWalker extends AxesWalker
   {
  +
     /**
      * Construct a FollowingSiblingWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public FollowingSiblingWalker(LocPathIterator locPathIterator)
     {
  +
       super(locPathIterator);
  +
       m_nextLevelAmount = 0;
     }
  -      
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  +
       Node n = m_currentNode.getNextSibling();
  +
       return setCurrentIfNotNull(n);
     }
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return m_lpi.getDOMHelper().getLevel(m_root);
     }
  -
   }
  -
  
  
  
  1.2       +106 -87   xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java
  
  Index: FollowingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/FollowingWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FollowingWalker.java	2000/07/05 14:45:15	1.1
  +++ FollowingWalker.java	2000/10/30 18:58:49	1.2
  @@ -1,66 +1,68 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import java.util.Stack;
  +
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -69,107 +71,124 @@
    */
   public class FollowingWalker extends AxesWalker
   {
  +
     /**
      * Construct a FollowingWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public FollowingWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       super.setRoot(root);
  +
       m_currentAncestor = root;
  -    
  +
       // Following is always moving up the tree, 
       // so I think this should be OK.
       m_nextLevelAmount = 0;
     }
  -  
  +
  +  /** NEEDSDOC Field m_ancestors          */
     protected Stack m_ancestors = new Stack();
  -  
  -  
  +
     /**
  -   *  Moves to and returns the closest visible ancestor node of the current 
  -   * node. If the search for parentNode attempts to step upward from the 
  -   * TreeWalker's root node, or if it fails to find a visible ancestor 
  +   *  Moves to and returns the closest visible ancestor node of the current
  +   * node. If the search for parentNode attempts to step upward from the
  +   * TreeWalker's root node, or if it fails to find a visible ancestor
      * node, this method retains the current position and returns null.
  -   * @return  The new parent node, or null if the current node has no parent 
  +   * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
     public Node parentNode()
     {
  +
       Node n;
  -    Node nextAncestor = (null != m_currentAncestor) 
  +    Node nextAncestor = (null != m_currentAncestor)
                           ? m_currentAncestor.getParentNode() : null;
       Node nextParent = m_currentNode.getParentNode();
  -    if(nextParent == nextAncestor)
  +
  +    if (nextParent == nextAncestor)
       {
         n = null;
  +
         Node ancestor = m_currentAncestor;
  -      
  -      while((null != ancestor) && 
  -            (null != (ancestor = (Node)ancestor.getParentNode())))
  +
  +      while ((null != ancestor)
  +             && (null != (ancestor = (Node) ancestor.getParentNode())))
         {
           n = ancestor.getNextSibling();
  -        if((null != n) || (null == ancestor))
  +
  +        if ((null != n) || (null == ancestor))
             break;
         }
  +
         m_currentAncestor = ancestor;
       }
       else
       {
         n = nextParent;
       }
  -    
  +
       return setCurrentIfNotNull(n);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  -    Node n = (m_currentAncestor == m_currentNode) 
  -             ? m_currentNode.getNextSibling() 
  -               : m_currentNode.getFirstChild();
   
  +    Node n = (m_currentAncestor == m_currentNode)
  +             ? m_currentNode.getNextSibling() : m_currentNode.getFirstChild();
  +
       m_nextLevelAmount = (null == n) ? 0 : (n.hasChildNodes() ? 1 : 0);
  +
       return setCurrentIfNotNull(n);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  +
       Node n = m_currentNode.getNextSibling();
  +
       m_nextLevelAmount = (null == n) ? 0 : (n.hasChildNodes() ? 1 : 0);
  +
       return setCurrentIfNotNull(n);
     }
  -  
  +
  +  /** NEEDSDOC Field m_currentAncestor          */
     Node m_currentAncestor;
  -    
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return Short.MAX_VALUE;
     }
  -
  -
   }
  
  
  
  1.6       +395 -204  xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java
  
  Index: LocPathIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/LocPathIterator.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- LocPathIterator.java	2000/10/23 15:24:39	1.5
  +++ LocPathIterator.java	2000/10/30 18:58:50	1.6
  @@ -85,329 +85,476 @@
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.utils.ObjectPool;
   import org.apache.xpath.objects.XNodeSet;
  -
   import org.apache.xpath.axes.AxesWalker;
   
   /**
    * <meta name="usage" content="advanced"/>
  - * This class extends NodeSet, which implements NodeIterator, 
  + * This class extends NodeSet, which implements NodeIterator,
    * and fetches nodes one at a time in document order based on a XPath
    * <a href="http://www.w3.org/TR/xpath#NT-LocationPath>LocationPath</a>.
  - * 
  - * <p>If setShouldCacheNodes(true) is called, 
  - * as each node is iterated via nextNode(), the node is also stored 
  - * in the NodeVector, so that previousNode() can easily be done, except in 
  - * the case where the LocPathIterator is "owned" by a UnionPathIterator, 
  + *
  + * <p>If setShouldCacheNodes(true) is called,
  + * as each node is iterated via nextNode(), the node is also stored
  + * in the NodeVector, so that previousNode() can easily be done, except in
  + * the case where the LocPathIterator is "owned" by a UnionPathIterator,
    * in which case the UnionPathIterator will cache the nodes.</p>
    */
  -public class LocPathIterator extends Expression 
  -implements Cloneable, NodeIterator, ContextNodeList, java.io.Serializable, NodeList
  -{ 
  +public class LocPathIterator extends Expression
  +        implements Cloneable, NodeIterator, ContextNodeList, NodeList, java.io.Serializable 
  +{
  +
  +  /** NEEDSDOC Field m_pool          */
  +  ObjectPool m_pool = new ObjectPool();
  +
  +  /** NEEDSDOC Field m_lastFetched          */
  +  Node m_lastFetched;
  +
  +  /** NEEDSDOC Field m_cachedNodes          */
  +  NodeSet m_cachedNodes;
  +
  +  /** NEEDSDOC Field m_lastUsedWalker          */
  +  protected AxesWalker m_lastUsedWalker;
  +
  +  /** NEEDSDOC Field m_firstWalker          */
  +  protected AxesWalker m_firstWalker;
  +
  +  /** NEEDSDOC Field m_foundLast          */
  +  protected boolean m_foundLast = false;
  +
  +  /** NEEDSDOC Field m_dhelper          */
  +  protected DOMHelper m_dhelper;
  +
  +  /** NEEDSDOC Field m_context          */
  +  protected Node m_context;
  +
  +  /** NEEDSDOC Field m_currentContextNode          */
  +  protected Node m_currentContextNode;
  +
  +  /** NEEDSDOC Field m_prefixResolver          */
  +  protected PrefixResolver m_prefixResolver;
  +
  +  /** NEEDSDOC Field m_execContext          */
  +  protected XPathContext m_execContext;
  +
  +  /** NEEDSDOC Field m_next          */
  +  protected int m_next = 0;
  +
  +  /** NEEDSDOC Field m_waiting          */
  +  public Vector m_waiting = new Vector();
  +
     /**
      * Create a LocPathIterator object.
  +   *
  +   * NEEDSDOC @param nscontext
      */
     public LocPathIterator(PrefixResolver nscontext)
  -  {    
  +  {
       this.m_prefixResolver = nscontext;
     }
   
     /**
      * Create a LocPathIterator object.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public LocPathIterator(Compiler compiler, int opPos)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    int firstStepPos = compiler.getFirstChildPos(opPos);
  -    m_firstWalker = WalkerFactory.loadWalkers(this, compiler, firstStepPos, 0);
  -    m_lastUsedWalker = m_firstWalker;
  +    this(compiler, opPos, true);
     }
  -  
  +
     /**
  -   * Create a LocPathIterator object (for match patterns.
  -   */
  -  public LocPathIterator(Compiler compiler, int opPos,
  -                         boolean isMatchPattern)
  -    throws org.xml.sax.SAXException
  +   * Create a LocPathIterator object.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   * NEEDSDOC @param shouldLoadWalkers
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public LocPathIterator(
  +          Compiler compiler, int opPos, boolean shouldLoadWalkers)
  +            throws org.xml.sax.SAXException
     {
  -    m_firstWalker = WalkerFactory.loadOneWalker(this, compiler, opPos);
  +
  +    int firstStepPos = compiler.getFirstChildPos(opPos);
  +
  +    if (shouldLoadWalkers)
  +    {
  +      m_firstWalker = WalkerFactory.loadWalkers(this, compiler, firstStepPos,
  +                                                0);
  +      m_lastUsedWalker = m_firstWalker;
  +    }
     }
  -  
  -  ObjectPool m_pool = new ObjectPool();
  -  
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method execute 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (execute) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       try
       {
  -      
  -      LocPathIterator clone = (LocPathIterator)m_pool.getInstanceIfFree();
  -      if(null == clone)
  -        clone = (LocPathIterator)this.clone();
  +      LocPathIterator clone = (LocPathIterator) m_pool.getInstanceIfFree();
  +
  +      if (null == clone)
  +        clone = (LocPathIterator) this.clone();
  +
         clone.initContext(xctxt);
  -      return new XNodeSet( clone );
  -    }
  -    catch(CloneNotSupportedException ncse)
  -    {
  +
  +      return new XNodeSet(clone);
       }
  +    catch (CloneNotSupportedException ncse){}
  +
       return null;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method initContext 
  +   *
  +   *
  +   * NEEDSDOC @param execContext
  +   */
     public void initContext(XPathContext execContext)
     {
  +
       this.m_context = execContext.getCurrentNode();
       this.m_currentContextNode = execContext.getCurrentExpressionNode();
       this.m_execContext = execContext;
  -    this.m_stackFrameIndex = execContext.getVarStack().getCurrentStackFrameIndex();
       this.m_prefixResolver = execContext.getNamespaceContext();
       this.m_dhelper = execContext.getDOMHelper();
     }
  -  
  -  NodeSet m_cachedNodes = null;
  -  private int m_next = 0;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setNextPosition 
  +   *
  +   *
  +   * NEEDSDOC @param next
  +   */
     protected void setNextPosition(int next)
     {
  +
       m_next = next;
  +
       // System.out.println("setNextPosition to: "+m_next);
     }
  -  
  +
     /**
  -   * Get the current position, which is one less than 
  -   * the next nextNode() call will retreave.  i.e. if 
  -   * you call getCurrentPos() and the return is 0, the next 
  +   * Get the current position, which is one less than
  +   * the next nextNode() call will retreave.  i.e. if
  +   * you call getCurrentPos() and the return is 0, the next
      * fetch will take place at index 1.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getCurrentPos() { return m_next;  }
  +  public final int getCurrentPos()
  +  {
  +    return m_next;
  +  }
   
  +  /**
  +   * NEEDSDOC Method incrementNextPosition 
  +   *
  +   */
     void incrementNextPosition()
     {
  +
       m_next++;
  +
       // System.out.println("incrementNextPosition to: "+m_next);
     }
   
     /**
  -   * If setShouldCacheNodes(true) is called, then nodes will 
  +   * If setShouldCacheNodes(true) is called, then nodes will
      * be cached.  They are not cached by default.
  +   *
  +   * NEEDSDOC @param b
      */
     public void setShouldCacheNodes(boolean b)
     {
  -    if(b)
  +
  +    if (b)
         m_cachedNodes = new NodeSet();
       else
         m_cachedNodes = null;
     }
  -  
  +
     /**
      * Set the current position in the node set.
      * @param i Must be a valid index.
      */
  -  public void setCurrentPos(int i) 
  -  { 
  +  public void setCurrentPos(int i)
  +  {
  +
       // System.out.println("setCurrentPos: "+i);
  -    if(null == m_cachedNodes)
  -      throw new RuntimeException("This NodeSet can not do indexing or counting functions!");
  -    setNextPosition(i); 
  +    if (null == m_cachedNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not do indexing or counting functions!");
  +
  +    setNextPosition(i);
       m_cachedNodes.setCurrentPos(i);
  +
       // throw new RuntimeException("Who's resetting this thing?");
     }
   
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int size()
     {
  -    if(null == m_cachedNodes)
  +
  +    if (null == m_cachedNodes)
         return 0;
  +
       return m_cachedNodes.size();
     }
  -  
  +
     /**
  -   *  Returns the <code>index</code> th item in the collection. If 
  -   * <code>index</code> is greater than or equal to the number of nodes in 
  +   *  Returns the <code>index</code> th item in the collection. If
  +   * <code>index</code> is greater than or equal to the number of nodes in
      * the list, this returns <code>null</code> .
      * @param index  Index into the collection.
  -   * @return  The node at the <code>index</code> th position in the 
  -   *   <code>NodeList</code> , or <code>null</code> if that is not a valid 
  +   * @return  The node at the <code>index</code> th position in the
  +   *   <code>NodeList</code> , or <code>null</code> if that is not a valid
      *   index.
      */
     public Node item(int index)
     {
  +
       resetToCachedList();
  +
       return m_cachedNodes.item(index);
     }
   
     /**
  -   *  The number of nodes in the list. The range of valid child node indices 
  -   * is 0 to <code>length-1</code> inclusive. 
  +   *  The number of nodes in the list. The range of valid child node indices
  +   * is 0 to <code>length-1</code> inclusive.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getLength()
     {
  +
       resetToCachedList();
  +
       return m_cachedNodes.getLength();
     }
  -  
  +
     /**
      * In order to implement NodeList (for extensions), try to reset
      * to a cached list for random access.
      */
     private void resetToCachedList()
     {
  +
       int pos = this.getCurrentPos();
  -    if((null == m_cachedNodes) || (pos != 0))
  +
  +    if ((null == m_cachedNodes) || (pos != 0))
         this.setShouldCacheNodes(true);
  +
       runTo(-1);
       this.setCurrentPos(pos);
     }
   
  -  
     /**
  -   * Tells if this NodeSet is "fresh", in other words, if 
  -   * the first nextNode() that is called will return the 
  +   * Tells if this NodeSet is "fresh", in other words, if
  +   * the first nextNode() that is called will return the
      * first node in the set.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isFresh()
     {
  -    return (getCurrentPos() == 0);
  +    return (m_next == 0);
     }
  -  
  +
     /**
  -   *  Returns the previous node in the set and moves the position of the 
  +   *  Returns the previous node in the set and moves the position of the
      * iterator backwards in the set.
  -   * @return  The previous <code>Node</code> in the set being iterated over, 
  -   *   or<code>null</code> if there are no more members in that set. 
  +   * @return  The previous <code>Node</code> in the set being iterated over,
  +   *   or<code>null</code> if there are no more members in that set.
      * @exception DOMException
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node previousNode()
  -    throws DOMException
  +  public Node previousNode() throws DOMException
     {
  -    if(null == m_cachedNodes)
  -      throw new RuntimeException("This NodeSet can not iterate to a previous node!");
  -    
  +
  +    if (null == m_cachedNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not iterate to a previous node!");
  +
       return m_cachedNodes.previousNode();
     }
  -  
  +
     /**
  -   *  This attribute determines which node types are presented via the 
  -   * iterator. The available set of constants is defined in the 
  +   *  This attribute determines which node types are presented via the
  +   * iterator. The available set of constants is defined in the
      * <code>NodeFilter</code> interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getWhatToShow()
     {
  +
       // TODO: ??
       return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
     }
   
     /**
      *  The filter used to screen nodes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeFilter getFilter()
     {
       return null;
     }
  -  
  +
     /**
      *  The root node of the Iterator, as specified when it was created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRoot()
     {
       return m_context;
     }
  -  
  +
     /**
  -   *  The value of this flag determines whether the children of entity 
  -   * reference nodes are visible to the iterator. If false, they will be 
  +   *  The value of this flag determines whether the children of entity
  +   * reference nodes are visible to the iterator. If false, they will be
      * skipped over.
  -   * <br> To produce a view of the document that has entity references 
  -   * expanded and does not expose the entity reference node itself, use the 
  -   * whatToShow flags to hide the entity reference node and set 
  -   * expandEntityReferences to true when creating the iterator. To produce 
  -   * a view of the document that has entity reference nodes but no entity 
  -   * expansion, use the whatToShow flags to show the entity reference node 
  +   * <br> To produce a view of the document that has entity references
  +   * expanded and does not expose the entity reference node itself, use the
  +   * whatToShow flags to hide the entity reference node and set
  +   * expandEntityReferences to true when creating the iterator. To produce
  +   * a view of the document that has entity reference nodes but no entity
  +   * expansion, use the whatToShow flags to show the entity reference node
      * and set expandEntityReferences to false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean getExpandEntityReferences()
     {
       return true;
     }
  -  
  +
     /**
  -   *  Detaches the iterator from the set which it iterated over, releasing 
  -   * any computational resources and placing the iterator in the INVALID 
  -   * state. After<code>detach</code> has been invoked, calls to 
  -   * <code>nextNode</code> or<code>previousNode</code> will raise the 
  +   *  Detaches the iterator from the set which it iterated over, releasing
  +   * any computational resources and placing the iterator in the INVALID
  +   * state. After<code>detach</code> has been invoked, calls to
  +   * <code>nextNode</code> or<code>previousNode</code> will raise the
      * exception INVALID_STATE_ERR.
      */
     public void detach()
     {
  +
       this.m_context = null;
       this.m_execContext = null;
  -    this.m_stackFrameIndex = 0;
       this.m_prefixResolver = null;
       this.m_dhelper = null;
  +
       m_pool.freeInstance(this);
     }
  -  
  +
     /**
      * Get a cloned Iterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset()
  -    throws CloneNotSupportedException
  +  public NodeIterator cloneWithReset() throws CloneNotSupportedException
     {
  -    LocPathIterator clone = (LocPathIterator)clone();
  +
  +    LocPathIterator clone = (LocPathIterator) clone();
  +
       clone.reset();
  +
       return clone;
     }
  -  
  +
     /**
      * Get a cloned LocPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  public Object clone() throws CloneNotSupportedException
     {
  -    LocPathIterator clone = (LocPathIterator)super.clone();
  -    AxesWalker walker = m_firstWalker;
  -    AxesWalker prevClonedWalker = null;
  -    while(null != walker)
  +
  +    LocPathIterator clone = (LocPathIterator) super.clone();
  +
  +    if (null != m_firstWalker)
       {
  -      AxesWalker clonedWalker = (AxesWalker)walker.clone();
  -      clonedWalker.setLocPathIterator(clone);
  -      if(clone.m_lastUsedWalker == walker)
  -        clone.m_lastUsedWalker = clonedWalker;
  -      if(null == prevClonedWalker)
  -      {
  -        clone.m_firstWalker = clonedWalker;
  -        prevClonedWalker = clonedWalker;
  -      }
  -      else
  +      AxesWalker walker = m_firstWalker;
  +      AxesWalker prevClonedWalker = null;
  +
  +      while (null != walker)
         {
  -        prevClonedWalker.setNextWalker(clonedWalker);
  -        clonedWalker.setPrevWalker(prevClonedWalker);
  -        prevClonedWalker = clonedWalker;
  +        AxesWalker clonedWalker = (AxesWalker) walker.clone();
  +
  +        clonedWalker.setLocPathIterator(clone);
  +
  +        if (clone.m_lastUsedWalker == walker)
  +          clone.m_lastUsedWalker = clonedWalker;
  +
  +        if (null == prevClonedWalker)
  +        {
  +          clone.m_firstWalker = clonedWalker;
  +          prevClonedWalker = clonedWalker;
  +        }
  +        else
  +        {
  +          prevClonedWalker.setNextWalker(clonedWalker);
  +          clonedWalker.setPrevWalker(prevClonedWalker);
  +
  +          prevClonedWalker = clonedWalker;
  +        }
  +
  +        walker = walker.getNextWalker();
         }
  -      walker = walker.getNextWalker();
       }
   
       return clone;
     }
  -  
  +
     /**
      * Reset the iterator.
      */
     public void reset()
     {
  +
       // super.reset();
       m_foundLast = false;
       m_lastFetched = null;
  -    m_lastUsedWalker = m_firstWalker;
  -    m_firstWalker.setRoot(m_context);
  -    m_waiting.removeAllElements();
  +
  +    if (null != m_firstWalker)
  +    {
  +      m_lastUsedWalker = m_firstWalker;
  +
  +      m_firstWalker.setRoot(m_context);
  +      m_waiting.removeAllElements();
  +    }
     }
  -  
  +
     /**
  -   *  Returns the next node in the set and advances the position of the 
  -   * iterator in the set. After a NodeIterator is created, the first call 
  +   *  Returns the next node in the set and advances the position of the
  +   * iterator in the set. After a NodeIterator is created, the first call
      * to nextNode() returns the first node in the set.
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  @@ -415,177 +562,221 @@
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode()
  -    throws DOMException
  -  {  
  +  public Node nextNode() throws DOMException
  +  {
  +
       // If the cache is on, and the node has already been found, then 
       // just return from the list.
  -    if((null != m_cachedNodes) && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
  +    if ((null != m_cachedNodes)
  +            && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
       {
         Node next = m_cachedNodes.nextNode();
  -      this.setCurrentPos( m_cachedNodes.getCurrentPos() );
  +
  +      this.setCurrentPos(m_cachedNodes.getCurrentPos());
  +
         return next;
       }
   
  -    if(null == m_firstWalker.getRoot())
  +    if (null == m_firstWalker.getRoot())
       {
         this.setNextPosition(0);
         m_firstWalker.setRoot(m_context);
  +
         m_lastUsedWalker = m_firstWalker;
       }
  +
       return returnNextNode(m_firstWalker.nextNode());
     }
  -  
  +
     /**
  -   * Bottleneck the return of a next node, to make returns 
  +   * Bottleneck the return of a next node, to make returns
      * easier from nextNode().
  +   *
  +   * NEEDSDOC @param nextNode
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private Node returnNextNode(Node nextNode)
  +  protected Node returnNextNode(Node nextNode)
     {
  -    if(null != nextNode)
  +
  +    if (null != nextNode)
       {
  -      if(null != m_cachedNodes)
  +      if (null != m_cachedNodes)
           m_cachedNodes.addElement(nextNode);
  +
         this.incrementNextPosition();
       }
  +
       m_lastFetched = nextNode;
  -    if(null == nextNode)
  +
  +    if (null == nextNode)
         m_foundLast = true;
  +
       return nextNode;
     }
  -  
  +
     /**
      * Return the last fetched node.  Needed to support the UnionPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getCurrentNode()
     {
       return m_lastFetched;
     }
  -  
  +
     /**
  -   * If an index is requested, NodeSet will call this method 
  -   * to run the iterator to the index.  By default this sets 
  -   * m_next to the index.  If the index argument is -1, this 
  +   * If an index is requested, NodeSet will call this method
  +   * to run the iterator to the index.  By default this sets
  +   * m_next to the index.  If the index argument is -1, this
      * signals that the iterator should be run to the end.
  +   *
  +   * NEEDSDOC @param index
      */
     public void runTo(int index)
     {
  -    if(m_foundLast || ((index >= 0) && (index <= getCurrentPos())))
  +
  +    if (m_foundLast || ((index >= 0) && (index <= getCurrentPos())))
         return;
  -    
  +
       Node n;
  -    if(-1 == index)
  +
  +    if (-1 == index)
       {
  -      while(null != (n = nextNode()))
  -        ;
  +      while (null != (n = nextNode()));
       }
       else
       {
  -      while(null != (n = nextNode()))
  +      while (null != (n = nextNode()))
         {
  -        if(getCurrentPos() >= index)
  +        if (getCurrentPos() >= index)
             break;
         }
       }
     }
  -        
  -  /**
  -   * 
  -   */
  -  // protected AxesWalker[] m_axesWalkers;
  -  protected AxesWalker m_firstWalker;
  -  
  +
     /**
      * For internal use.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public AxesWalker getFirstWalker()
  +  public final AxesWalker getFirstWalker()
     {
       return m_firstWalker;
     }
   
     /**
  -   * For use by the AxesWalker.
  -   */
  -  private AxesWalker m_lastUsedWalker;
  -
  -  /**
      * For internal use.
  +   *
  +   * NEEDSDOC @param walker
      */
  -  public void setLastUsedWalker(AxesWalker walker)
  +  public final void setLastUsedWalker(AxesWalker walker)
     {
       m_lastUsedWalker = walker;
     }
   
     /**
      * For internal use.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public AxesWalker getLastUsedWalker()
  +  public final AxesWalker getLastUsedWalker()
     {
       return m_lastUsedWalker;
     }
  -  
  -  // Temp as vector.  This probably ought to be a heap/priority queue.
  -  public Vector m_waiting = new Vector();
  -  
  -  public void addToWaitList(AxesWalker walker)
  +
  +  /**
  +   * NEEDSDOC Method addToWaitList 
  +   *
  +   *
  +   * NEEDSDOC @param walker
  +   */
  +  public final void addToWaitList(AxesWalker walker)
     {
       m_waiting.addElement(walker);
     }
  -  
  -  public void removeFromWaitList(AxesWalker walker)
  +
  +  /**
  +   * NEEDSDOC Method removeFromWaitList 
  +   *
  +   *
  +   * NEEDSDOC @param walker
  +   */
  +  public final void removeFromWaitList(AxesWalker walker)
     {
       m_waiting.removeElement(walker);
     }
  -  
  -  /**
  -   * The last fetched node.
  -   */
  -  Node m_lastFetched;
  -    
  +
     /**
      * Tells if we've found the last node yet.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public boolean getFoundLast() { return m_foundLast; }
  -  protected boolean m_foundLast = false;
  -  
  +  public final boolean getFoundLast()
  +  {
  +    return m_foundLast;
  +  }
  +
     /**
      * The XPath execution context we are operating on.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  protected XPathContext m_execContext;
  -  public XPathContext getXPathContext() { return m_execContext; }
  -  
  +  public final XPathContext getXPathContext()
  +  {
  +    return m_execContext;
  +  }
  +
     /**
      * The DOM helper for the given context;
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  protected DOMHelper m_dhelper;
  -  public DOMHelper getDOMHelper() { return m_dhelper; }
  -  
  +  public final DOMHelper getDOMHelper()
  +  {
  +    return m_dhelper;
  +  }
  +
     /**
      * The node context for the expression.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  protected Node m_context;
  -  public Node getContext() { return m_context; }
  +  public final Node getContext()
  +  {
  +    return m_context;
  +  }
   
     /**
  -   * The node context for the expression.
  +   * The node context from where the expression is being
  +   * executed from (i.e. for current() support).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  protected int m_stackFrameIndex;
  -  public int getStackFrameIndex() { return m_stackFrameIndex; }
  +  public final Node getCurrentContextNode()
  +  {
  +    return m_currentContextNode;
  +  }
   
     /**
  -   * The node context from where the expression is being 
  -   * executed from (i.e. for current() support).
  +   * NEEDSDOC Method setCurrentContextNode 
  +   *
  +   *
  +   * NEEDSDOC @param n
      */
  -  protected Node m_currentContextNode;
  -  public Node getCurrentContextNode() { return m_currentContextNode; }
  -  public void setCurrentContextNode(Node n) { m_currentContextNode = n; }
  +  public final void setCurrentContextNode(Node n)
  +  {
  +    m_currentContextNode = n;
  +  }
   
     /**
  -   * Return the saved reference to the prefix resolver that 
  +   * Return the saved reference to the prefix resolver that
      * was in effect when this iterator was created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public PrefixResolver getPrefixResolver() { return m_prefixResolver; }
  -  protected PrefixResolver m_prefixResolver;
  +  public final PrefixResolver getPrefixResolver()
  +  {
  +    return m_prefixResolver;
  +  }
   }
  -
  -
  
  
  
  1.2       +106 -82   xml-xalan/java/src/org/apache/xpath/axes/NamespaceWalker.java
  
  Index: NamespaceWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/NamespaceWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NamespaceWalker.java	2000/07/05 14:45:15	1.1
  +++ NamespaceWalker.java	2000/10/30 18:58:50	1.2
  @@ -1,59 +1,59 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import java.util.Stack;
  @@ -61,6 +61,7 @@
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.NamedNodeMap;
   
  @@ -70,99 +71,122 @@
    */
   public class NamespaceWalker extends AxesWalker
   {
  +
     /**
      * Construct an NamespaceWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public NamespaceWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      * Get a cloned AxesWalker.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  public Object clone() throws CloneNotSupportedException
     {
  -    NamespaceWalker clone = (NamespaceWalker)super.clone();
   
  -    if(null != this.m_namespaces)
  +    NamespaceWalker clone = (NamespaceWalker) super.clone();
  +
  +    if (null != this.m_namespaces)
       {
  -      clone.m_namespaces = (Stack)this.m_namespaces.clone();
  +      clone.m_namespaces = (Stack) this.m_namespaces.clone();
       }
  +
       return clone;
     }
   
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_nextLevelAmount = 1;
       m_namespaces = new Stack();
  +
       Node nsContext = root;
  -    
  -    while(null != nsContext)
  -    {      
  +
  +    while (null != nsContext)
  +    {
         NamedNodeMap attributeList = nsContext.getAttributes();
  -      if(null != attributeList)
  +
  +      if (null != attributeList)
         {
           int nAttrs = attributeList.getLength();
  +
           // System.out.println("setRoot - nAttrs: "+nAttrs);
  -        for(int i = (nAttrs-1); i >= 0; i--)
  +        for (int i = (nAttrs - 1); i >= 0; i--)
           {
             Node attr = attributeList.item(i);
  -          if(m_lpi.getDOMHelper().isNamespaceNode(attr))
  +
  +          if (m_lpi.getDOMHelper().isNamespaceNode(attr))
             {
  +
               // System.out.println("setRoot - pushing namespace: "+attr.getNodeName());
               m_namespaces.push(attr);
             }
           }
         }
  -      
  +
         nsContext = nsContext.getParentNode();
       }
  -    
  +
       super.setRoot(root);
  +
       // System.out.println("============");
     }
  -        
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       m_nextLevelAmount = 0;
  +
       return nextSibling();
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  -    Node next = m_namespaces.isEmpty() ? null : (Node)m_namespaces.pop();
  +
  +    Node next = m_namespaces.isEmpty() ? null : (Node) m_namespaces.pop();
  +
       // System.out.println("nextSibling: "+this.nodeToString(next));
       return this.setCurrentIfNotNull(next);
     }
  -  
  +
  +  /** NEEDSDOC Field m_namespaces          */
     Stack m_namespaces;
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return m_lpi.getDOMHelper().getLevel(m_root);
     }
  -
   }
  
  
  
  1.3       +80 -66    xml-xalan/java/src/org/apache/xpath/axes/ParentWalker.java
  
  Index: ParentWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ParentWalker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ParentWalker.java	2000/10/12 14:19:18	1.2
  +++ ParentWalker.java	2000/10/30 18:58:51	1.3
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -67,8 +68,11 @@
    */
   public class ParentWalker extends AxesWalker
   {
  +
     /**
      * Construct a ParentWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public ParentWalker(LocPathIterator locPathIterator)
     {
  @@ -77,44 +81,54 @@
   
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_gotParent = false;
       m_nextLevelAmount = 0;
  +
       super.setRoot(root);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       // Follow rule about returning the first occuring in document order 
       // as the first child.  Strange but true.
  -    if(!m_gotParent)
  +    if (!m_gotParent)
       {
         m_gotParent = true;
  +
         // Patch from Merlin
  -      Node n = m_lpi.getDOMHelper().getParentOfNode(m_root); 
  +      Node n = m_lpi.getDOMHelper().getParentOfNode(m_root);
  +
         return setCurrentIfNotNull(n);
       }
  +
       return null;
     }
  -    
  +
  +  /** NEEDSDOC Field m_gotParent          */
     boolean m_gotParent;
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
  -    return m_lpi.getDOMHelper().getLevel(m_root)-1;
  +    return m_lpi.getDOMHelper().getLevel(m_root) - 1;
     }
  -
   }
  
  
  
  1.2       +76 -64    xml-xalan/java/src/org/apache/xpath/axes/PrecedingSiblingWalker.java
  
  Index: PrecedingSiblingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PrecedingSiblingWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PrecedingSiblingWalker.java	2000/07/05 14:45:15	1.1
  +++ PrecedingSiblingWalker.java	2000/10/30 18:58:52	1.2
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -67,48 +68,59 @@
    */
   public class PrecedingSiblingWalker extends ReverseAxesWalker
   {
  +
     /**
      * Construct a PrecedingSiblingWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public PrecedingSiblingWalker(LocPathIterator locPathIterator)
     {
  +
       super(locPathIterator);
  +
       m_nextLevelAmount = 0;
     }
   
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  +
       Node next;
  -    if(m_currentNode == m_root)
  +
  +    if (m_currentNode == m_root)
       {
         Node parent = m_lpi.getDOMHelper().getParentOfNode(m_currentNode);
  -      if(null == parent)
  +
  +      if (null == parent)
           return null;
  +
         next = parent.getFirstChild();
       }
       else
       {
         next = m_currentNode.getNextSibling();
       }
  -    if(next.equals(m_root))
  +
  +    if (next.equals(m_root))
         next = null;
  +
       return setCurrentIfNotNull(next);
     }
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return m_lpi.getDOMHelper().getLevel(m_root);
     }
  -
  -  
   }
  
  
  
  1.2       +125 -103  xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java
  
  Index: PrecedingWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/PrecedingWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PrecedingWalker.java	2000/07/05 14:45:15	1.1
  +++ PrecedingWalker.java	2000/10/30 18:58:52	1.2
  @@ -1,222 +1,244 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
  +
   import org.w3c.dom.Node;
   
   /**
    * Walker for the 'preceding' axes.
  - * <p>The walk is done from the root node, in depth-first order, 
  - * testing to see if a given vertice is an ancestor of the step 
  - * context, in which case that vertice, and all following vertices, 
  + * <p>The walk is done from the root node, in depth-first order,
  + * testing to see if a given vertice is an ancestor of the step
  + * context, in which case that vertice, and all following vertices,
    * are skipped.</p>
    * @see <a href="http://www.w3.org/TR/xpath#axes">XPath axes descriptions</a>
    */
   public class PrecedingWalker extends ReverseAxesWalker
   {
  +
     /**
      * Construct a PrecedingWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public PrecedingWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -      
  +
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       super.setRoot(root);
  +
       m_doc = m_lpi.getDOMHelper().getRootNode(root);
       m_currentNode = m_doc;
       m_nextLevelAmount = root.hasChildNodes() ? 1 : 0;
  +
       try
       {
         super.resetProximityPositions();
       }
  -    catch(org.xml.sax.SAXException se)
  +    catch (org.xml.sax.SAXException se)
       {
  +
         // TODO: Fix this...
         throw new RuntimeException(se.getMessage());
       }
     }
  -  
  +
     /**
      * Reset the proximity positions counts.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void resetProximityPositions()
  -    throws org.xml.sax.SAXException
  -  {
  -  }
  +  public void resetProximityPositions() throws org.xml.sax.SAXException{}
   
  -  
     /**
  -   *  Moves to and returns the closest visible ancestor node of the current 
  -   * node. If the search for parentNode attempts to step upward from the 
  -   * TreeWalker's root node, or if it fails to find a visible ancestor 
  +   *  Moves to and returns the closest visible ancestor node of the current
  +   * node. If the search for parentNode attempts to step upward from the
  +   * TreeWalker's root node, or if it fails to find a visible ancestor
      * node, this method retains the current position and returns null.
  -   * @return  The new parent node, or null if the current node has no parent 
  +   * @return  The new parent node, or null if the current node has no parent
      *   in the TreeWalker's logical view.
      */
     public Node parentNode()
     {
  +
       Node next = m_currentNode.getParentNode();
  -    
  +
       // If we're at the root of the tree, we're done.
  -    if((null == next) || m_doc.equals( next ))
  +    if ((null == next) || m_doc.equals(next))
         return null;
  -    
  +
       // If the parent vertice is an ancestor of the step 
       // context, then all siblings are to the left of the 
       // ancestor path, so we're done.
  -    if(isAncestorOfRootContext( next ))
  +    if (isAncestorOfRootContext(next))
         return null;
  -    
  +
       m_nextLevelAmount = 0;
  +
       return setCurrentIfNotNull(next);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       // Walk down the left edge of the current sub-tree.
       // Get the next child on the 'preceding' axes. This will 
       // skip any children nodes that are ancestors of the step context,
       // but will return children of those nodes.
  -    if(m_root.equals(m_currentNode))
  +    if (m_root.equals(m_currentNode))
         return null;
   
       Node nextNode = m_currentNode;
  -    while(null != nextNode)
  +
  +    while (null != nextNode)
       {
         Node n = nextNode.getFirstChild();
  -      
  -      if(null != n)
  +
  +      if (null != n)
         {
           nextNode = n;
         }
         else
         {
  +
           // If the next sibling is an ancestor, then continue 
           // on to get it's first child, otherwise nextSibling() 
           // will get it.
           nextNode = nextNode.getNextSibling();
  -        if(null != nextNode)
  +
  +        if (null != nextNode)
           {
  -          if(m_root.equals(nextNode) || !isAncestorOfRootContext(nextNode))
  +          if (m_root.equals(nextNode) ||!isAncestorOfRootContext(nextNode))
               return null;
             else
               continue;
           }
         }
  -      
  -      if(null != nextNode)
  +
  +      if (null != nextNode)
         {
  -        if(m_root.equals(nextNode))
  +        if (m_root.equals(nextNode))
             return null;
  -        else if(!isAncestorOfRootContext(nextNode))
  +        else if (!isAncestorOfRootContext(nextNode))
             break;
         }
       }
  -    m_nextLevelAmount = (null == nextNode) ? 0 : (nextNode.hasChildNodes() ? 1 : 0);
  +
  +    m_nextLevelAmount = (null == nextNode)
  +                        ? 0 : (nextNode.hasChildNodes() ? 1 : 0);
  +
       return setCurrentIfNotNull(nextNode);
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the next sibling of the current 
  -   * node, and returns the new node. If the current node has no visible 
  +   *  Moves the <code>TreeWalker</code> to the next sibling of the current
  +   * node, and returns the new node. If the current node has no visible
      * next sibling, returns <code>null</code> , and retains the current node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   next sibling in the TreeWalker's logical view.
      */
     public Node nextSibling()
     {
  -    if(m_root.equals(m_currentNode))
  +
  +    if (m_root.equals(m_currentNode))
         return null;
  -    
  +
       Node next = m_currentNode.getNextSibling();
  -      
  -    if((null == next) || m_root.equals(next) || isAncestorOfRootContext(next))
  +
  +    if ((null == next) || m_root.equals(next)
  +            || isAncestorOfRootContext(next))
         return null;
  -    
  +
       m_nextLevelAmount = (null == next) ? 0 : (next.hasChildNodes() ? 1 : 0);
  +
       return setCurrentIfNotNull(next);
     }
  -    
  +
  +  /** NEEDSDOC Field m_doc          */
     Node m_doc;
  -    
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return Short.MAX_VALUE;
     }
  -
   }
  
  
  
  1.2       +116 -75   xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java
  
  Index: ReverseAxesWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/ReverseAxesWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ReverseAxesWalker.java	2000/07/05 14:45:15	1.1
  +++ ReverseAxesWalker.java	2000/10/30 18:58:54	1.2
  @@ -1,67 +1,69 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import java.util.Vector;
  +
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.compiler.OpCodes;
   import org.apache.xpath.objects.XObject;
  +
   import org.xml.sax.SAXException;
   
   import org.w3c.dom.Node;
  @@ -73,47 +75,63 @@
    */
   public class ReverseAxesWalker extends AxesWalker
   {
  +
     /**
      * Construct an AxesWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public ReverseAxesWalker(LocPathIterator locPathIterator)
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      * Tells if this is a reverse axes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isReverseAxes()
     {
       return true;
     }
  -  
  +
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
       super.setRoot(root);
     }
  -  
  +
     /**
  -   * Get the current sub-context position.  In order to do the 
  -   * reverse axes count, for the moment this re-searches the axes 
  -   * up to the predicate.  An optimization on this is to cache 
  -   * the nodes searched, but, for the moment, this case is probably 
  +   * Get the current sub-context position.  In order to do the
  +   * reverse axes count, for the moment this re-searches the axes
  +   * up to the predicate.  An optimization on this is to cache
  +   * the nodes searched, but, for the moment, this case is probably
      * rare enough that the added complexity isn't worth it.
  +   *
  +   * NEEDSDOC @param predicateIndex
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getProximityPosition(int predicateIndex)
     {
  -    if(m_proximityPositions[predicateIndex] <= 0)
  +
  +    if (m_proximityPositions[predicateIndex] <= 0)
       {
         AxesWalker savedWalker = m_lpi.getLastUsedWalker();
  +
         try
         {
  -        ReverseAxesWalker clone = (ReverseAxesWalker)this.clone();
  +        ReverseAxesWalker clone = (ReverseAxesWalker) this.clone();
  +
           clone.setRoot(this.getRoot());
  +
           clone.m_predicateCount = predicateIndex;
  +
           clone.setPrevWalker(null);
           clone.setNextWalker(null);
           m_lpi.setLastUsedWalker(clone);
  @@ -121,12 +139,17 @@
           // Count 'em all
           int count = 1;
           Node next;
  -        while(null != (next = clone.nextNode()))
  +
  +        while (null != (next = clone.nextNode()))
  +        {
             count++;
  +        }
  +
           m_proximityPositions[predicateIndex] += count;
         }
  -      catch(CloneNotSupportedException cnse)
  +      catch (CloneNotSupportedException cnse)
         {
  +
           // can't happen
         }
         finally
  @@ -137,26 +160,40 @@
   
       return m_proximityPositions[predicateIndex];
     }
  -  
  +
     /**
      * Count backwards one proximity position.
  +   *
  +   * NEEDSDOC @param i
      */
     protected void countProximityPosition(int i)
     {
  -    if(i < m_proximityPositions.length)
  +    if (i < m_proximityPositions.length)
         m_proximityPositions[i]--;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getLastPos 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getLastPos) @return
  +   */
     public int getLastPos(XPathContext xctxt)
     {
  -    int count = 0;
   
  +    int count = 0;
       AxesWalker savedWalker = m_lpi.getLastUsedWalker();
  +
       try
       {
  -      ReverseAxesWalker clone = (ReverseAxesWalker)this.clone();
  +      ReverseAxesWalker clone = (ReverseAxesWalker) this.clone();
  +
         clone.setRoot(this.getRoot());
  -      clone.m_predicateCount = this.m_predicateCount-1;
  +
  +      clone.m_predicateCount = this.m_predicateCount - 1;
  +
         clone.setPrevWalker(null);
         clone.setNextWalker(null);
         m_lpi.setLastUsedWalker(clone);
  @@ -164,19 +201,23 @@
         // Count 'em all
         // count = 1;
         Node next;
  -      while(null != (next = clone.nextNode()))
  +
  +      while (null != (next = clone.nextNode()))
  +      {
           count++;
  +      }
       }
  -    catch(CloneNotSupportedException cnse)
  +    catch (CloneNotSupportedException cnse)
       {
  +
         // can't happen
       }
       finally
       {
         m_lpi.setLastUsedWalker(savedWalker);
       }
  +
       // System.out.println("getLastPos - pos: "+count);
       return count;
     }
  -
   }
  
  
  
  1.2       +76 -64    xml-xalan/java/src/org/apache/xpath/axes/RootWalker.java
  
  Index: RootWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/RootWalker.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RootWalker.java	2000/07/05 14:45:15	1.1
  +++ RootWalker.java	2000/10/30 18:58:55	1.2
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -69,44 +70,55 @@
    */
   public class RootWalker extends AxesWalker
   {
  +
     /**
      * Construct a RootWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public RootWalker(LocPathIterator locPathIterator)
     {
  +
       super(locPathIterator);
  +
       m_nextLevelAmount = 0;
     }
  -  
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       // Follow rule about returning the first occuring in document order 
       // as the first child.  Strange but true.
  -    if(!m_processedRoot)
  +    if (!m_processedRoot)
       {
         m_processedRoot = true;
  +
         Node n = m_lpi.getDOMHelper().getRootNode(m_currentNode);
  +
         return setCurrentIfNotNull(n);
       }
  +
       return null;
     }
  -    
  +
  +  /** NEEDSDOC Field m_processedRoot          */
     boolean m_processedRoot = false;
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return 1;
     }
  -
   }
  
  
  
  1.3       +80 -65    xml-xalan/java/src/org/apache/xpath/axes/SelfWalker.java
  
  Index: SelfWalker.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/SelfWalker.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SelfWalker.java	2000/10/23 15:24:39	1.2
  +++ SelfWalker.java	2000/10/30 18:58:55	1.3
  @@ -1,64 +1,65 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.axes.LocPathIterator;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  +
   import org.w3c.dom.Node;
   
   /**
  @@ -68,51 +69,65 @@
   public class SelfWalker extends AxesWalker
   	implements java.io.Serializable
   {
  +
     /**
      * Construct a SelfWalker using a LocPathIterator.
  +   *
  +   * NEEDSDOC @param locPathIterator
      */
     public SelfWalker(LocPathIterator locPathIterator)
     {
  +
       super(locPathIterator);
  +
       m_nextLevelAmount = 0;
     }
  -  
  +
     /**
      *  Set the root node of the TreeWalker.
  +   *
  +   * NEEDSDOC @param root
      */
     public void setRoot(Node root)
     {
  +
       m_processedSelf = false;
  +
       super.setRoot(root);
     }
  -    
  +
     /**
  -   *  Moves the <code>TreeWalker</code> to the first visible child of the 
  -   * current node, and returns the new node. If the current node has no 
  -   * visible children, returns <code>null</code> , and retains the current 
  +   *  Moves the <code>TreeWalker</code> to the first visible child of the
  +   * current node, and returns the new node. If the current node has no
  +   * visible children, returns <code>null</code> , and retains the current
      * node.
  -   * @return  The new node, or <code>null</code> if the current node has no 
  +   * @return  The new node, or <code>null</code> if the current node has no
      *   visible children in the TreeWalker's logical view.
      */
     public Node firstChild()
     {
  +
       // Follow my made-up rule about returning the self node as a child.
  -    if(!m_processedSelf)
  +    if (!m_processedSelf)
       {
         m_processedSelf = true;
  +
         return setCurrentIfNotNull(m_root);
       }
  +
       return null;
     }
  -    
  +
  +  /** NEEDSDOC Field m_processedSelf          */
     boolean m_processedSelf;
  -  
  +
     /**
      * Tell what's the maximum level this axes can descend to.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected int getLevelMax()
     {
       return m_lpi.getDOMHelper().getLevel(m_root);
     }
  -
   }
  
  
  
  1.2       +59 -57    xml-xalan/java/src/org/apache/xpath/axes/SelfWalkerOneStep.java
  
  Index: SelfWalkerOneStep.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/SelfWalkerOneStep.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SelfWalkerOneStep.java	2000/10/17 19:40:15	1.1
  +++ SelfWalkerOneStep.java	2000/10/30 18:58:55	1.2
  @@ -1,59 +1,59 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.w3c.dom.Node;
  @@ -78,7 +78,7 @@
     {
       super(locPathIterator);
     }
  -  
  +
     /**
      * Get the next node in document order on the axes.
      *
  @@ -86,10 +86,12 @@
      */
     public Node nextNode()
     {
  +
       if (m_isFresh)
       {
         m_isFresh = false;
  -      if(acceptNode(m_root) == NodeFilter.FILTER_ACCEPT)
  +
  +      if (acceptNode(m_root) == NodeFilter.FILTER_ACCEPT)
           return m_root;
         else
           return null;
  
  
  
  1.3       +75 -3     xml-xalan/java/src/org/apache/xpath/axes/SubContextList.java
  
  Index: SubContextList.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/SubContextList.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- SubContextList.java	2000/10/17 19:40:15	1.2
  +++ SubContextList.java	2000/10/30 18:58:56	1.3
  @@ -1,16 +1,88 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.XPathContext;
   
   import org.w3c.dom.Node;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Interface SubContextList
  + */
   public interface SubContextList
  -{  
  +{
  +
  +  /**
  +   * NEEDSDOC Method getLastPos 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getLastPos) @return
  +   */
     public int getLastPos(XPathContext xctxt);
  -  
  +
     /**
      * Get the current sub-context position.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getProximityPosition(XPathContext xctxt);
   }
  - 
  \ No newline at end of file
  
  
  
  1.5       +280 -146  xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java
  
  Index: UnionPathIterator.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/UnionPathIterator.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- UnionPathIterator.java	2000/08/31 17:23:57	1.4
  +++ UnionPathIterator.java	2000/10/30 18:58:57	1.5
  @@ -77,200 +77,257 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * This class extends NodeSet, which implements NodeIterator, 
  + * This class extends NodeSet, which implements NodeIterator,
    * and fetches nodes one at a time in document order based on a XPath
    * <a href="http://www.w3.org/TR/xpath#NT-UnionExpr">UnionExpr</a>.
  - * As each node is iterated via nextNode(), the node is also stored 
  + * As each node is iterated via nextNode(), the node is also stored
    * in the NodeVector, so that previousNode() can easily be done.
    */
  -public class UnionPathIterator extends Expression 
  -  implements Cloneable, NodeIterator, ContextNodeList
  -{ 
  +public class UnionPathIterator extends Expression
  +        implements Cloneable, NodeIterator, ContextNodeList
  +{
  +
     /**
      * Constructor to create an instance which you can add location paths to.
      */
     public UnionPathIterator()
     {
  +
       super();
  +
       // m_mutable = false;
       // m_cacheNodes = false;
       m_iterators = null;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method initContext 
  +   *
  +   *
  +   * NEEDSDOC @param execContext
  +   */
     public void initContext(XPathContext execContext)
     {
  +
       this.m_execContext = execContext;
       this.m_currentContextNode = execContext.getCurrentExpressionNode();
       this.m_context = execContext.getCurrentNode();
  -    
  +
       if (null != m_iterators)
  -    {  
  +    {
         int n = m_iterators.length;
  -      for(int i = 0; i < n; i++)
  +
  +      for (int i = 0; i < n; i++)
         {
           m_iterators[i].initContext(execContext);
           m_iterators[i].nextNode();
         }
       }
  -    
     }
  -  
  +
     /**
  -   *  Detaches the iterator from the set which it iterated over, releasing 
  -   * any computational resources and placing the iterator in the INVALID 
  -   * state. After<code>detach</code> has been invoked, calls to 
  -   * <code>nextNode</code> or<code>previousNode</code> will raise the 
  +   *  Detaches the iterator from the set which it iterated over, releasing
  +   * any computational resources and placing the iterator in the INVALID
  +   * state. After<code>detach</code> has been invoked, calls to
  +   * <code>nextNode</code> or<code>previousNode</code> will raise the
      * exception INVALID_STATE_ERR.
      */
     public void detach()
     {
  +
       this.m_context = null;
       this.m_execContext = null;
       this.m_context = null;
  +
       int n = m_iterators.length;
  -    for(int i = 0; i < n; i++)
  +
  +    for (int i = 0; i < n; i++)
       {
         m_iterators[i].detach();
       }
  +
       m_pool.freeInstance(this);
     }
  -    
  +
  +  /** NEEDSDOC Field m_pool          */
     ObjectPool m_pool = new ObjectPool();
  -  
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method execute 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (execute) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       try
       {
  -      UnionPathIterator clone = (UnionPathIterator)m_pool.getInstanceIfFree();
  -      if(null == clone)
  -        clone = (UnionPathIterator)this.clone();
  +      UnionPathIterator clone =
  +        (UnionPathIterator) m_pool.getInstanceIfFree();
  +
  +      if (null == clone)
  +        clone = (UnionPathIterator) this.clone();
  +
         clone.initContext(xctxt);
  -      return new XNodeSet( clone );
  -    }
  -    catch(CloneNotSupportedException ncse)
  -    {
  +
  +      return new XNodeSet(clone);
       }
  +    catch (CloneNotSupportedException ncse){}
  +
       return null;
     }
  -  
  +
  +  /** NEEDSDOC Field m_cachedNodes          */
     NodeSet m_cachedNodes = null;
  +
  +  /** NEEDSDOC Field m_next          */
     protected int m_next = 0;
  -  
  +
     /**
  -   * If setShouldCacheNodes(true) is called, then nodes will 
  +   * If setShouldCacheNodes(true) is called, then nodes will
      * be cached.  They are not cached by default.
  +   *
  +   * NEEDSDOC @param b
      */
     public void setShouldCacheNodes(boolean b)
     {
  -    if(b)
  +
  +    if (b)
         m_cachedNodes = new NodeSet();
       else
         m_cachedNodes = null;
     }
  -  
  +
     /**
      * Set the current position in the node set.
      * @param i Must be a valid index.
      */
  -  public void setCurrentPos(int i) 
  -  { 
  -    if(null == m_cachedNodes)
  -      throw new RuntimeException("This NodeSet can not do indexing or counting functions!");
  -    m_next = i; 
  +  public void setCurrentPos(int i)
  +  {
  +
  +    if (null == m_cachedNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not do indexing or counting functions!");
  +
  +    m_next = i;
  +
       m_cachedNodes.setCurrentPos(i);
     }
  -  
  +
     /**
      * Get the length of the list.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int size()
     {
  -    if(null == m_cachedNodes)
  +
  +    if (null == m_cachedNodes)
         return 0;
  +
       return m_cachedNodes.size();
     }
  -  
  +
     /**
  -   * Tells if this NodeSet is "fresh", in other words, if 
  -   * the first nextNode() that is called will return the 
  +   * Tells if this NodeSet is "fresh", in other words, if
  +   * the first nextNode() that is called will return the
      * first node in the set.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean isFresh()
     {
       return (m_next == 0);
     }
  -  
  +
     /**
  -   *  Returns the previous node in the set and moves the position of the 
  +   *  Returns the previous node in the set and moves the position of the
      * iterator backwards in the set.
  -   * @return  The previous <code>Node</code> in the set being iterated over, 
  -   *   or<code>null</code> if there are no more members in that set. 
  +   * @return  The previous <code>Node</code> in the set being iterated over,
  +   *   or<code>null</code> if there are no more members in that set.
      * @exception DOMException
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node previousNode()
  -    throws DOMException
  +  public Node previousNode() throws DOMException
     {
  -    if(null == m_cachedNodes)
  -      throw new RuntimeException("This NodeSet can not iterate to a previous node!");
  -    
  +
  +    if (null == m_cachedNodes)
  +      throw new RuntimeException(
  +        "This NodeSet can not iterate to a previous node!");
  +
       return m_cachedNodes.previousNode();
     }
  -  
  +
     /**
  -   *  This attribute determines which node types are presented via the 
  -   * iterator. The available set of constants is defined in the 
  +   *  This attribute determines which node types are presented via the
  +   * iterator. The available set of constants is defined in the
      * <code>NodeFilter</code> interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getWhatToShow()
     {
  +
       // TODO: ??
       return NodeFilter.SHOW_ALL & ~NodeFilter.SHOW_ENTITY_REFERENCE;
     }
  -  
  +
     /**
      *  The filter used to screen nodes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeFilter getFilter()
     {
       return null;
     }
  -  
  +
     /**
      *  The root node of the Iterator, as specified when it was created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getRoot()
     {
       return m_context;
     }
  -  
  +
     /**
  -   *  The value of this flag determines whether the children of entity 
  -   * reference nodes are visible to the iterator. If false, they will be 
  +   *  The value of this flag determines whether the children of entity
  +   * reference nodes are visible to the iterator. If false, they will be
      * skipped over.
  -   * <br> To produce a view of the document that has entity references 
  -   * expanded and does not expose the entity reference node itself, use the 
  -   * whatToShow flags to hide the entity reference node and set 
  -   * expandEntityReferences to true when creating the iterator. To produce 
  -   * a view of the document that has entity reference nodes but no entity 
  -   * expansion, use the whatToShow flags to show the entity reference node 
  +   * <br> To produce a view of the document that has entity references
  +   * expanded and does not expose the entity reference node itself, use the
  +   * whatToShow flags to hide the entity reference node and set
  +   * expandEntityReferences to true when creating the iterator. To produce
  +   * a view of the document that has entity reference nodes but no entity
  +   * expansion, use the whatToShow flags to show the entity reference node
      * and set expandEntityReferences to false.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean getExpandEntityReferences()
     {
       return true;
     }
  -    
  +
     /**
      * Add an iterator to the union list.
  +   *
  +   * NEEDSDOC @param iter
      */
     public void addIterator(LocPathIterator iter)
     {
  +
       // Increase array size by only 1 at a time.  Fix this
       // if it looks to be a problem.
  -    if(null == m_iterators)
  +    if (null == m_iterators)
       {
         m_iterators = new LocPathIterator[1];
         m_iterators[0] = iter;
  @@ -279,115 +336,163 @@
       {
         LocPathIterator[] iters = m_iterators;
         int len = m_iterators.length;
  -      m_iterators = new LocPathIterator[len+1];
  +
  +      m_iterators = new LocPathIterator[len + 1];
  +
         System.arraycopy(iters, 0, m_iterators, 0, len);
  +
         m_iterators[len] = iter;
       }
  -  
     }
   
     /**
      * Constructor.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public UnionPathIterator(Compiler compiler, int opPos)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       super();
   
  -    opPos = compiler.getFirstChildPos(opPos); 
  +    opPos = compiler.getFirstChildPos(opPos);
  +
       loadLocationPaths(compiler, opPos, 0);
     }
  -  
  +
     /**
      * Get a cloned UnionPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public NodeIterator cloneWithReset()
  -    throws CloneNotSupportedException
  +  public NodeIterator cloneWithReset() throws CloneNotSupportedException
     {
  -    UnionPathIterator clone = (UnionPathIterator)clone();
  +
  +    UnionPathIterator clone = (UnionPathIterator) clone();
  +
       clone.reset();
  +
       return clone;
     }
  -  
  +
     /**
      * Get a cloned UnionPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws CloneNotSupportedException
      */
  -  public Object clone()
  -    throws CloneNotSupportedException
  +  public Object clone() throws CloneNotSupportedException
     {
  -    UnionPathIterator clone = (UnionPathIterator)super.clone();
  +
  +    UnionPathIterator clone = (UnionPathIterator) super.clone();
       int n = m_iterators.length;
  +
       clone.m_iterators = new LocPathIterator[n];
  -    for(int i = 0; i < n; i++)
  -      clone.m_iterators[i] = (LocPathIterator)m_iterators[i].clone();
  +
  +    for (int i = 0; i < n; i++)
  +    {
  +      clone.m_iterators[i] = (LocPathIterator) m_iterators[i].clone();
  +    }
  +
       return clone;
     }
  -  
  +
     /**
      * Reset the iterator.
      */
     public void reset()
     {
  +
       // super.reset();
       m_foundLast = false;
  +
       int n = m_iterators.length;
  -    for(int i = 0; i < n; i++)
  +
  +    for (int i = 0; i < n; i++)
       {
         m_iterators[i].reset();
       }
     }
  -  
  +
     /**
      * Initialize the location path iterators.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   * NEEDSDOC @param count
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     protected void loadLocationPaths(Compiler compiler, int opPos, int count)
  -    throws org.xml.sax.SAXException
  -  {    
  +          throws org.xml.sax.SAXException
  +  {
  +
       // TODO: Handle unwrapped FilterExpr
       int steptype = compiler.getOpMap()[opPos];
  -    if(steptype == OpCodes.OP_LOCATIONPATH)
  +
  +    if (steptype == OpCodes.OP_LOCATIONPATH)
       {
  -      loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count+1);
  +      loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1);
  +
         m_iterators[count] = createLocPathIterator(compiler, opPos);
       }
       else
       {
  +
         // Have to check for unwrapped functions, which the LocPathIterator
         // doesn't handle. 
  -      switch(steptype)
  +      switch (steptype)
         {
  -      case OpCodes.OP_VARIABLE:
  -      case OpCodes.OP_EXTFUNCTION:
  -      case OpCodes.OP_FUNCTION:
  -      case OpCodes.OP_GROUP:
  -        loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count+1);
  -        LocPathIterator iter = new LocPathIterator(compiler.getNamespaceContext());
  +      case OpCodes.OP_VARIABLE :
  +      case OpCodes.OP_EXTFUNCTION :
  +      case OpCodes.OP_FUNCTION :
  +      case OpCodes.OP_GROUP :
  +        loadLocationPaths(compiler, compiler.getNextOpPos(opPos), count + 1);
  +
  +        LocPathIterator iter =
  +          new LocPathIterator(compiler.getNamespaceContext());
  +
           iter.m_firstWalker = new org.apache.xpath.axes.FilterExprWalker(iter);
  +
           iter.m_firstWalker.init(compiler, opPos, steptype);
  +
           m_iterators[count] = iter;
           break;
  -      default:
  +      default :
           m_iterators = new LocPathIterator[count];
         }
  -
  -      
       }
     }
  -  
  +
     /**
      * Create a new location path iterator.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected LocPathIterator createLocPathIterator(Compiler compiler, int opPos)
  -    throws org.xml.sax.SAXException
  +  protected LocPathIterator createLocPathIterator(
  +          Compiler compiler, int opPos) throws org.xml.sax.SAXException
     {
  -    return new LocPathIterator(compiler, opPos);
  +    return WalkerFactory.newLocPathIterator(compiler, opPos);
     }
  -  
  +
  +  /** NEEDSDOC Field m_lastFetched          */
     Node m_lastFetched;
   
     /**
  -   *  Returns the next node in the set and advances the position of the 
  -   * iterator in the set. After a NodeIterator is created, the first call 
  +   *  Returns the next node in the set and advances the position of the
  +   * iterator in the set. After a NodeIterator is created, the first call
      * to nextNode() returns the first node in the set.
      * @return  The next <code>Node</code> in the set being iterated over, or
      *   <code>null</code> if there are no more members in that set.
  @@ -395,132 +500,161 @@
      *    INVALID_STATE_ERR: Raised if this method is called after the
      *   <code>detach</code> method was invoked.
      */
  -  public Node nextNode()
  -    throws DOMException
  -  {    
  +  public Node nextNode() throws DOMException
  +  {
  +
       // If the cache is on, and the node has already been found, then 
       // just return from the list.
  -    if((null != m_cachedNodes) && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
  +    if ((null != m_cachedNodes)
  +            && (m_cachedNodes.getCurrentPos() < m_cachedNodes.size()))
       {
         return m_cachedNodes.nextNode();
       }
   
  -    if(m_foundLast)
  +    if (m_foundLast)
         return null;
  -    
  +
       // Loop through the iterators getting the current fetched 
       // node, and get the earliest occuring in document order
       Node earliestNode = null;
  +
       if (null != m_iterators)
  -    {  
  +    {
         int n = m_iterators.length;
         int iteratorUsed = -1;
  -      for(int i = 0; i < n; i++)
  +
  +      for (int i = 0; i < n; i++)
         {
           Node node = m_iterators[i].getCurrentNode();
  -        if(null == node)
  +
  +        if (null == node)
             continue;
  -        else if(null == earliestNode)
  +        else if (null == earliestNode)
           {
             iteratorUsed = i;
             earliestNode = node;
           }
           else
           {
  -          if(node.equals(earliestNode))
  +          if (node.equals(earliestNode))
             {
  +
               // Found a duplicate, so skip past it.
               m_iterators[i].nextNode();
             }
             else
             {
               DOMHelper dh = m_execContext.getDOMHelper();
  -            if(dh.isNodeAfter(node, earliestNode))
  +
  +            if (dh.isNodeAfter(node, earliestNode))
               {
                 iteratorUsed = i;
                 earliestNode = node;
               }
             }
           }
  -      }    
  -      
  -      if(null != earliestNode)
  +      }
  +
  +      if (null != earliestNode)
         {
           m_iterators[iteratorUsed].nextNode();
  -        if(null != m_cachedNodes)
  +
  +        if (null != m_cachedNodes)
             m_cachedNodes.addElement(earliestNode);
  +
           m_next++;
         }
         else
           m_foundLast = true;
       }
  -    
  +
       m_lastFetched = earliestNode;
  +
       return earliestNode;
     }
  -  
  +
     /**
  -   * If an index is requested, NodeSet will call this method 
  -   * to run the iterator to the index.  By default this sets 
  -   * m_next to the index.  If the index argument is -1, this 
  +   * If an index is requested, NodeSet will call this method
  +   * to run the iterator to the index.  By default this sets
  +   * m_next to the index.  If the index argument is -1, this
      * signals that the iterator should be run to the end.
  +   *
  +   * NEEDSDOC @param index
      */
     public void runTo(int index)
     {
  -    if(m_foundLast || ((index >= 0) && (index <= m_next)))
  +
  +    if (m_foundLast || ((index >= 0) && (index <= m_next)))
         return;
  -    
  +
       Node n;
  -    while(null == (n = nextNode()))
  +
  +    while (null == (n = nextNode()))
       {
  -      if(m_next >= index)
  +      if (m_next >= index)
           break;
       }
     }
  -  
  +
     /**
  -   * Get the current position, which is one less than 
  -   * the next nextNode() call will retreave.  i.e. if 
  -   * you call getCurrentPos() and the return is 0, the next 
  +   * Get the current position, which is one less than
  +   * the next nextNode() call will retreave.  i.e. if
  +   * you call getCurrentPos() and the return is 0, the next
      * fetch will take place at index 1.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public int getCurrentPos() { return m_next;  }
  -  
  +  public int getCurrentPos()
  +  {
  +    return m_next;
  +  }
  +
     /**
      * Return the last fetched node.  Needed to support the UnionPathIterator.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Node getCurrentNode()
     {
       return m_lastFetched;
     }
  -  
  +
     /**
      * Tells if we've found the last node yet.
      */
     protected boolean m_foundLast = false;
  -    
  +
     /**
      * The execution context for the expression.
      */
     protected XPathContext m_execContext;
  -  
  +
     /**
      * The node context for the expression.
      */
     protected Node m_context;
  -  
  +
     /**
  -   * The node context from where the Location Path is being 
  +   * The node context from where the Location Path is being
      * executed from (i.e. for current() support).
      */
     protected Node m_currentContextNode;
  -  public Node getCurrentContextNode() { return m_currentContextNode; }
  -    
  +
  +  /**
  +   * NEEDSDOC Method getCurrentContextNode 
  +   *
  +   *
  +   * NEEDSDOC (getCurrentContextNode) @return
  +   */
  +  public Node getCurrentContextNode()
  +  {
  +    return m_currentContextNode;
  +  }
  +
     /**
  -   * The location path iterators, one for each 
  -   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath">location 
  +   * The location path iterators, one for each
  +   * <a href="http://www.w3.org/TR/xpath#NT-LocationPath">location
      * path</a> contained in the union expression.
      */
     protected LocPathIterator[] m_iterators;
  -  
   }
  
  
  
  1.2       +352 -222  xml-xalan/java/src/org/apache/xpath/axes/WalkerFactory.java
  
  Index: WalkerFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/axes/WalkerFactory.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WalkerFactory.java	2000/10/17 19:40:15	1.1
  +++ WalkerFactory.java	2000/10/30 18:58:57	1.2
  @@ -1,116 +1,145 @@
   /*
  -* The Apache Software License, Version 1.1
  -*
  -*
  -* Copyright (c) 1999 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 "Xalan" 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, Lotus
  -* Development Corporation., http://www.lotus.com.  For more
  -* information on the Apache Software Foundation, please see
  -* <http://www.apache.org/>.
  -*/
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.axes;
   
   import org.apache.xpath.compiler.OpCodes;
   import org.apache.xpath.compiler.Compiler;
   import org.apache.xpath.patterns.NodeTest;
  +
   import org.w3c.dom.traversal.NodeFilter;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class WalkerFactory <needs-comment/>
  + */
   public class WalkerFactory
   {
  +
     /**
      * <meta name="usage" content="advanced"/>
      * This method is for building an array of possible levels
      * where the target element(s) could be found for a match.
      * @param xpath The xpath that is executing.
      * @param context The current source tree context node.
  +   *
  +   * NEEDSDOC @param lpi
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param stepOpCodePos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  static AxesWalker loadOneWalker(LocPathIterator lpi,
  -                                  Compiler compiler, int stepOpCodePos)
  -    throws org.xml.sax.SAXException
  +  static AxesWalker loadOneWalker(
  +          LocPathIterator lpi, Compiler compiler, int stepOpCodePos)
  +            throws org.xml.sax.SAXException
     {
  +
       AxesWalker firstWalker = null;
       int stepType = compiler.getOpMap()[stepOpCodePos];
  -    if( stepType != OpCodes.ENDOP )
  +
  +    if (stepType != OpCodes.ENDOP)
       {
  +
         // m_axesWalkers = new AxesWalker[1];
  -      
         // As we unwind from the recursion, create the iterators.
         firstWalker = createDefaultWalker(compiler, stepType, lpi, 0);
  +
         firstWalker.init(compiler, stepOpCodePos, stepType);
       }
  +
       return firstWalker;
     }
  -          
  +
     /**
      * <meta name="usage" content="advanced"/>
      * This method is for building an array of possible levels
      * where the target element(s) could be found for a match.
      * @param xpath The xpath that is executing.
      * @param context The current source tree context node.
  +   *
  +   * NEEDSDOC @param lpi
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param stepOpCodePos
  +   * NEEDSDOC @param stepIndex
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  static AxesWalker loadWalkers(LocPathIterator lpi,
  -                                Compiler compiler, int stepOpCodePos, 
  -                                int stepIndex)
  -    throws org.xml.sax.SAXException
  +  static AxesWalker loadWalkers(
  +          LocPathIterator lpi, Compiler compiler, int stepOpCodePos, int stepIndex)
  +            throws org.xml.sax.SAXException
     {
  +
       int stepType;
       AxesWalker firstWalker = null;
       AxesWalker walker, prevWalker = null;
       int ops[] = compiler.getOpMap();
       int analysis = analyze(compiler, stepOpCodePos, stepIndex);
  -    
  -    while( OpCodes.ENDOP != (stepType = ops[stepOpCodePos]) )
  -    {      
  +
  +    while (OpCodes.ENDOP != (stepType = ops[stepOpCodePos]))
  +    {
         walker = createDefaultWalker(compiler, stepOpCodePos, lpi, analysis);
  +
         walker.init(compiler, stepOpCodePos, stepType);
         walker.setAnalysis(analysis);
  -      if(null == firstWalker)
  +
  +      if (null == firstWalker)
         {
           firstWalker = walker;
         }
  @@ -119,169 +148,267 @@
           prevWalker.setNextWalker(walker);
           walker.setPrevWalker(prevWalker);
         }
  +
         prevWalker = walker;
         stepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
  -      if(stepOpCodePos < 0)
  +
  +      if (stepOpCodePos < 0)
           break;
       }
  +
       return firstWalker;
     }
   
  +  /**
  +   * NEEDSDOC Method newLocPathIterator 
  +   *
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC (newLocPathIterator) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public static LocPathIterator newLocPathIterator(
  +          Compiler compiler, int opPos) throws org.xml.sax.SAXException
  +  {
  +
  +    int firstStepPos = compiler.getFirstChildPos(opPos);
  +    int analysis = analyze(compiler, firstStepPos, 0);
  +
  +    if (ONESTEP_CHILDREN_ANY == analysis)
  +    {
  +      return new ChildIterator(compiler, opPos);
  +    }
  +    else
  +    {
  +      return new LocPathIterator(compiler, opPos, true);
  +    }
  +  }
  +
     // There is no optimized walker that can handle 
     // this pattern, so use the default.
  -  static final int NO_OPTIMIZE = 1; 
   
  +  /** NEEDSDOC Field NO_OPTIMIZE          */
  +  static final int NO_OPTIMIZE = 1;
  +
     // "."
  -  static final int ONESTEP_SELF = 2; 
  - 
  +
  +  /** NEEDSDOC Field ONESTEP_SELF          */
  +  static final int ONESTEP_SELF = 2;
  +
     // "*"
  -  static final int ONESTEP_CHILDREN = 3; 
  -  
  +
  +  /** NEEDSDOC Field ONESTEP_CHILDREN          */
  +  static final int ONESTEP_CHILDREN = 3;
  +
  +  // "*"
  +
  +  /** NEEDSDOC Field ONESTEP_CHILDREN_ANY          */
  +  static final int ONESTEP_CHILDREN_ANY = 7;
  +
     // "foo"
  +
  +  /** NEEDSDOC Field ONESTEP_ATTR          */
     static final int ONESTEP_ATTR = 4;
   
     // "//foo"
  +
  +  /** NEEDSDOC Field ONESTEP_DESCENDANTS          */
     static final int ONESTEP_DESCENDANTS = 5;
   
     // "foo/baz/boo"
  -  static final int MULTISTEP_CHILDREN = 6; 
  +
  +  /** NEEDSDOC Field MULTISTEP_CHILDREN          */
  +  static final int MULTISTEP_CHILDREN = 6;
   
     /**
      * <meta name="usage" content="advanced"/>
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param stepOpCodePos
  +   * NEEDSDOC @param stepIndex
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  private static int analyze(Compiler compiler, int stepOpCodePos, 
  -                                int stepIndex)
  -    throws org.xml.sax.SAXException
  +  private static int analyze(
  +          Compiler compiler, int stepOpCodePos, int stepIndex)
  +            throws org.xml.sax.SAXException
     {
  +
       int stepType;
       int ops[] = compiler.getOpMap();
       int stepCount = 0;
       int analysisResult = NO_OPTIMIZE;
  -    while( OpCodes.ENDOP != (stepType = ops[stepOpCodePos]) )
  -    {      
  +
  +    while (OpCodes.ENDOP != (stepType = ops[stepOpCodePos]))
  +    {
         stepCount++;
  +
         int whatToShow = compiler.getWhatToShow(stepOpCodePos);
  -      
  -      String namespace = compiler.getStepNS(stepOpCodePos);
  +
  +      // String namespace = compiler.getStepNS(stepOpCodePos);
         // boolean isNSWild = (null != namespace) 
         //                   ? namespace.equals(NodeTest.WILD) : false;
  -      String localname = compiler.getStepLocalName(stepOpCodePos);
  -      boolean isWild = (null != localname) ? localname.equals(NodeTest.WILD) : false;
  -      int predAnalysis = analyzePredicate(compiler, stepOpCodePos, stepType);
  -      
  -      switch(stepType)
  +      // String localname = compiler.getStepLocalName(stepOpCodePos);
  +      // boolean isWild = (null != localname) ? localname.equals(NodeTest.WILD) : false;
  +      // int predAnalysis = analyzePredicate(compiler, stepOpCodePos, stepType);
  +      switch (stepType)
         {
  -      case OpCodes.OP_VARIABLE:
  -      case OpCodes.OP_EXTFUNCTION:
  -      case OpCodes.OP_FUNCTION:
  -      case OpCodes.OP_GROUP:
  -        return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_ROOT: 
  -        return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_ANCESTORS: 
  -        return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_ANCESTORS_OR_SELF: 
  -        return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_ATTRIBUTES: 
  -        if(1 == stepCount)
  +      case OpCodes.OP_VARIABLE :
  +      case OpCodes.OP_EXTFUNCTION :
  +      case OpCodes.OP_FUNCTION :
  +      case OpCodes.OP_GROUP :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_ROOT :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_ANCESTORS :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_ANCESTORS_OR_SELF :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_ATTRIBUTES :
  +        if (1 == stepCount)
           {
             analysisResult = ONESTEP_ATTR;
           }
           else
           {
  -          return NO_OPTIMIZE; // at least for now
  +          return NO_OPTIMIZE;  // at least for now
           }
           break;
  -      case OpCodes.FROM_NAMESPACE: 
  -        return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_CHILDREN: 
  -        if(1 == stepCount)
  +      case OpCodes.FROM_NAMESPACE :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_CHILDREN :
  +        if (1 == stepCount)
           {
  +          if (whatToShow == NodeFilter.SHOW_ALL)
  +          {
  +
  +            // System.out.println("ONESTEP_CHILDREN_ANY");
  +            analysisResult = ONESTEP_CHILDREN_ANY;
  +          }
  +          else
               analysisResult = ONESTEP_CHILDREN;
           }
           else
           {
  -          if((analysisResult == ONESTEP_CHILDREN) ||
  -             (analysisResult == MULTISTEP_CHILDREN))
  +          if ((analysisResult == ONESTEP_CHILDREN)
  +                  || (analysisResult == MULTISTEP_CHILDREN))
               analysisResult = MULTISTEP_CHILDREN;
             else
               return NO_OPTIMIZE;
           }
           break;
  -      case OpCodes.FROM_DESCENDANTS: 
  -            return NO_OPTIMIZE; // TODO
  -      case OpCodes.FROM_DESCENDANTS_OR_SELF: 
  -            return NO_OPTIMIZE; // TODO
  -      case OpCodes.FROM_FOLLOWING: 
  -            return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_FOLLOWING_SIBLINGS: 
  -            return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_PRECEDING: 
  -            return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_PRECEDING_SIBLINGS: 
  -            return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_PARENT: 
  -            return NO_OPTIMIZE; // at least for now
  -      case OpCodes.FROM_SELF:
  -            if(1 == stepCount)
  -              analysisResult = ONESTEP_SELF;
  -            else
  -              return NO_OPTIMIZE; // at least for now
  +      case OpCodes.FROM_DESCENDANTS :
  +        return NO_OPTIMIZE;  // TODO
  +      case OpCodes.FROM_DESCENDANTS_OR_SELF :
  +        return NO_OPTIMIZE;  // TODO
  +      case OpCodes.FROM_FOLLOWING :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_FOLLOWING_SIBLINGS :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_PRECEDING :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_PRECEDING_SIBLINGS :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_PARENT :
  +        return NO_OPTIMIZE;  // at least for now
  +      case OpCodes.FROM_SELF :
  +        if (1 == stepCount)
  +          analysisResult = ONESTEP_SELF;
  +        else
  +          return NO_OPTIMIZE;  // at least for now
           break;
  -      case OpCodes.MATCH_ATTRIBUTE: 
  -        return NO_OPTIMIZE; // for now we shouldn't be dealing with match patterns here.
  -      case OpCodes.MATCH_ANY_ANCESTOR: 
  -        return NO_OPTIMIZE; // for now we shouldn't be dealing with match patterns here.
  -      case OpCodes.MATCH_IMMEDIATE_ANCESTOR: 
  -        return NO_OPTIMIZE; // for now we shouldn't be dealing with match patterns here.
  -      default: 
  -        throw new RuntimeException("Programmer's assertion: unknown opcode: "+stepType);
  +      case OpCodes.MATCH_ATTRIBUTE :
  +        return NO_OPTIMIZE;  // for now we shouldn't be dealing with match patterns here.
  +      case OpCodes.MATCH_ANY_ANCESTOR :
  +        return NO_OPTIMIZE;  // for now we shouldn't be dealing with match patterns here.
  +      case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
  +        return NO_OPTIMIZE;  // for now we shouldn't be dealing with match patterns here.
  +      default :
  +        throw new RuntimeException("Programmer's assertion: unknown opcode: "
  +                                   + stepType);
         }
  -    
  +
         stepOpCodePos = compiler.getNextStepPos(stepOpCodePos);
  -      if(stepOpCodePos < 0)
  +
  +      if (stepOpCodePos < 0)
           break;
       }
  +
       return analysisResult;
     }
  -  
  +
  +  /** NEEDSDOC Field HAS_PREDICATE          */
     static final int HAS_PREDICATE = 1;
  +
  +  /** NEEDSDOC Field HAS_NOPREDICATE          */
     static final int HAS_NOPREDICATE = 2;
  +
  +  /** NEEDSDOC Field HAS_BOOLEANPREDICATE          */
     static final int HAS_BOOLEANPREDICATE = 3;
  +
  +  /** NEEDSDOC Field MAYHAVE_INDEXPREDICATE          */
     static final int MAYHAVE_INDEXPREDICATE = 4;
   
  +  /**
  +   * NEEDSDOC Method analyzePredicate 
  +   *
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   * NEEDSDOC @param stepType
  +   *
  +   * NEEDSDOC (analyzePredicate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     static int analyzePredicate(Compiler compiler, int opPos, int stepType)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       int argLen;
  -    switch(stepType)
  +
  +    switch (stepType)
       {
  -    case OpCodes.OP_VARIABLE:
  -    case OpCodes.OP_EXTFUNCTION:
  -    case OpCodes.OP_FUNCTION:
  -    case OpCodes.OP_GROUP:
  +    case OpCodes.OP_VARIABLE :
  +    case OpCodes.OP_EXTFUNCTION :
  +    case OpCodes.OP_FUNCTION :
  +    case OpCodes.OP_GROUP :
         argLen = compiler.getArgLength(opPos);
         break;
  -    default:
  +    default :
         argLen = compiler.getArgLengthOfStep(opPos);
       }
  +
       int pos = compiler.getFirstPredicateOpPos(opPos);
       int nPredicates = compiler.countPredicates(pos);
  +
       return (nPredicates > 0) ? HAS_PREDICATE : HAS_NOPREDICATE;
     }
  -  
  +
     /**
      * Create the proper Walker from the axes type.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param opPos
  +   * NEEDSDOC @param lpi
  +   * NEEDSDOC @param analysis
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private static AxesWalker createDefaultWalker(Compiler compiler,
  -                                               int opPos, 
  -                                               LocPathIterator lpi,
  -                                               int analysis)
  +  private static AxesWalker createDefaultWalker(Compiler compiler, int opPos,
  +          LocPathIterator lpi, int analysis)
     {
  +
       AxesWalker ai;
       int whatToShow = compiler.getWhatToShow(opPos);
       int stepType = compiler.getOp(opPos);
       boolean debug = false;
  +
       /*
       System.out.println("0: "+compiler.getOp(opPos));
       System.out.println("1: "+compiler.getOp(opPos+1));
  @@ -291,121 +418,124 @@
       System.out.println("5: "+compiler.getOp(opPos+5));
       */
       boolean simpleInit = false;
  -    switch(stepType)
  +
  +    switch (stepType)
       {
  -    case OpCodes.OP_VARIABLE:
  -    case OpCodes.OP_EXTFUNCTION:
  -    case OpCodes.OP_FUNCTION:
  -    case OpCodes.OP_GROUP:
  +    case OpCodes.OP_VARIABLE :
  +    case OpCodes.OP_EXTFUNCTION :
  +    case OpCodes.OP_FUNCTION :
  +    case OpCodes.OP_GROUP :
         ai = new FilterExprWalker(lpi);
         simpleInit = true;
         break;
  -    case OpCodes.FROM_ROOT: 
  -      ai = new RootWalker(lpi); 
  +    case OpCodes.FROM_ROOT :
  +      ai = new RootWalker(lpi);
         simpleInit = true;
         break;
  -    case OpCodes.FROM_ANCESTORS: 
  -      ai = new AncestorWalker(lpi); 
  +    case OpCodes.FROM_ANCESTORS :
  +      ai = new AncestorWalker(lpi);
         break;
  -    case OpCodes.FROM_ANCESTORS_OR_SELF: 
  -      ai = new AncestorOrSelfWalker(lpi); 
  +    case OpCodes.FROM_ANCESTORS_OR_SELF :
  +      ai = new AncestorOrSelfWalker(lpi);
         break;
  -    case OpCodes.FROM_ATTRIBUTES: 
  -      switch(analysis)
  +    case OpCodes.FROM_ATTRIBUTES :
  +      switch (analysis)
         {
  -      case ONESTEP_ATTR:
  -        ai = new AttributeWalkerOneStep(lpi); 
  +      case ONESTEP_ATTR :
  +        ai = new AttributeWalkerOneStep(lpi);
           break;
  -      default:
  -        ai = new AttributeWalker(lpi); 
  +      default :
  +        ai = new AttributeWalker(lpi);
         }
         break;
  -    case OpCodes.FROM_NAMESPACE: 
  -      ai = new NamespaceWalker(lpi); 
  +    case OpCodes.FROM_NAMESPACE :
  +      ai = new NamespaceWalker(lpi);
         break;
  -    case OpCodes.FROM_CHILDREN: 
  -      switch(analysis)
  +    case OpCodes.FROM_CHILDREN :
  +      switch (analysis)
         {
  -      case ONESTEP_CHILDREN:
  -        {
  -          if(debug)
  -            System.out.println("analysis -- onestep child: "+analysis
  -                               +", "+compiler.toString());
  -          ai = new ChildWalkerOneStep(lpi);
  -        }
  +      case ONESTEP_CHILDREN :
  +      {
  +        if (debug)
  +          System.out.println("analysis -- onestep child: " + analysis + ", "
  +                             + compiler.toString());
  +
  +        ai = new ChildWalkerOneStep(lpi);
  +      }
  +      break;
  +      case MULTISTEP_CHILDREN :
  +        if (debug)
  +          System.out.println("analysis -- multi-step child: " + analysis
  +                             + ", " + compiler.toString());
  +
  +        ai = new ChildWalkerMultiStep(lpi);
           break;
  -      case MULTISTEP_CHILDREN:
  -        if(debug)
  -          System.out.println("analysis -- multi-step child: "+analysis
  -                             +", "+compiler.toString());
  -          ai = new ChildWalkerMultiStep(lpi);
  -          break;
  -      default:
  -        ai = new ChildWalker(lpi);  
  +      default :
  +        ai = new ChildWalker(lpi);
         }
         break;
  -    case OpCodes.FROM_DESCENDANTS: 
  -      ai = new DescendantWalker(lpi); 
  +    case OpCodes.FROM_DESCENDANTS :
  +      ai = new DescendantWalker(lpi);
         break;
  -    case OpCodes.FROM_DESCENDANTS_OR_SELF: 
  -      ai = new DescendantOrSelfWalker(lpi); 
  +    case OpCodes.FROM_DESCENDANTS_OR_SELF :
  +      ai = new DescendantOrSelfWalker(lpi);
         break;
  -    case OpCodes.FROM_FOLLOWING: 
  -      ai = new FollowingWalker(lpi); 
  +    case OpCodes.FROM_FOLLOWING :
  +      ai = new FollowingWalker(lpi);
         break;
  -    case OpCodes.FROM_FOLLOWING_SIBLINGS: 
  -      ai = new FollowingSiblingWalker(lpi); 
  +    case OpCodes.FROM_FOLLOWING_SIBLINGS :
  +      ai = new FollowingSiblingWalker(lpi);
         break;
  -    case OpCodes.FROM_PRECEDING: 
  -      ai = new PrecedingWalker(lpi); 
  +    case OpCodes.FROM_PRECEDING :
  +      ai = new PrecedingWalker(lpi);
         break;
  -    case OpCodes.FROM_PRECEDING_SIBLINGS: 
  -      ai = new PrecedingSiblingWalker(lpi); 
  +    case OpCodes.FROM_PRECEDING_SIBLINGS :
  +      ai = new PrecedingSiblingWalker(lpi);
         break;
  -    case OpCodes.FROM_PARENT: 
  -      ai = new ParentWalker(lpi); 
  +    case OpCodes.FROM_PARENT :
  +      ai = new ParentWalker(lpi);
         break;
  -    case OpCodes.FROM_SELF: 
  -      switch(analysis)
  +    case OpCodes.FROM_SELF :
  +      switch (analysis)
         {
  -      case ONESTEP_SELF:
  -        ai = new SelfWalkerOneStep(lpi); 
  +      case ONESTEP_SELF :
  +        ai = new SelfWalkerOneStep(lpi);
           break;
  -      default:
  -      ai = new SelfWalker(lpi); 
  +      default :
  +        ai = new SelfWalker(lpi);
         }
         break;
  -    case OpCodes.MATCH_ATTRIBUTE: 
  -      ai = new AttributeWalker(lpi); 
  +    case OpCodes.MATCH_ATTRIBUTE :
  +      ai = new AttributeWalker(lpi);
         break;
  -    case OpCodes.MATCH_ANY_ANCESTOR: 
  -      ai = new ChildWalker(lpi); 
  +    case OpCodes.MATCH_ANY_ANCESTOR :
  +      ai = new ChildWalker(lpi);
         break;
  -    case OpCodes.MATCH_IMMEDIATE_ANCESTOR: 
  -      ai = new ChildWalker(lpi); 
  +    case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
  +      ai = new ChildWalker(lpi);
         break;
  -    default: 
  -      throw new RuntimeException("Programmer's assertion: unknown opcode: "+stepType);
  +    default :
  +      throw new RuntimeException("Programmer's assertion: unknown opcode: "
  +                                 + stepType);
       }
  +
       /*
       System.out.print("construct: ");
       NodeTest.debugWhatToShow(whatToShow);
  -    System.out.println("or stuff: "+(whatToShow & (NodeFilter.SHOW_ATTRIBUTE 
  +    System.out.println("or stuff: "+(whatToShow & (NodeFilter.SHOW_ATTRIBUTE
                              | NodeFilter.SHOW_ELEMENT
                              | NodeFilter.SHOW_PROCESSING_INSTRUCTION)));
       */
  -    if((0 == (whatToShow & (NodeFilter.SHOW_ATTRIBUTE 
  -                            | NodeFilter.SHOW_ELEMENT
  -                            | NodeFilter.SHOW_PROCESSING_INSTRUCTION))) ||
  -       (whatToShow == NodeFilter.SHOW_ALL))
  +    if ((0 == (whatToShow
  +               & (NodeFilter.SHOW_ATTRIBUTE | NodeFilter.SHOW_ELEMENT
  +                  | NodeFilter.SHOW_PROCESSING_INSTRUCTION))) || (whatToShow == NodeFilter.SHOW_ALL))
         ai.initNodeTest(whatToShow);
       else
       {
  -      ai.initNodeTest(whatToShow, 
  -                      compiler.getStepNS(opPos), 
  +      ai.initNodeTest(whatToShow, compiler.getStepNS(opPos),
                         compiler.getStepLocalName(opPos));
       }
  +
       return ai;
     }
  -
   }
  
  
  
  1.8       +570 -253  xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java
  
  Index: Compiler.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/Compiler.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- Compiler.java	2000/10/17 19:42:40	1.7
  +++ Compiler.java	2000/10/30 18:59:18	1.8
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.compiler;
   
   import org.apache.xpath.operations.And;
  @@ -19,7 +75,6 @@
   import org.apache.xpath.operations.Quo;
   import org.apache.xpath.operations.UnaryOperation;
   import org.apache.xpath.operations.Variable;
  -
   import org.apache.xpath.objects.*;
   import org.apache.xpath.axes.*;
   import org.apache.xpath.patterns.*;
  @@ -29,10 +84,8 @@
   import org.apache.xpath.*;
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xalan.res.XSLMessages;
  -
   import org.apache.xalan.utils.QName;
   import org.apache.xalan.utils.PrefixResolver;
  -
   import org.apache.trax.ProcessorException;
   
   import org.xml.sax.ErrorHandler;
  @@ -41,21 +94,36 @@
   
   import org.w3c.dom.traversal.NodeFilter;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Compiler <needs-comment/>
  + */
   public class Compiler extends OpMap
  -{  
  -  public Compiler(ErrorHandler errorHandler,
  -                  Locator locator)
  +{
  +
  +  /**
  +   * Constructor Compiler
  +   *
  +   *
  +   * NEEDSDOC @param errorHandler
  +   * NEEDSDOC @param locator
  +   */
  +  public Compiler(ErrorHandler errorHandler, Locator locator)
     {
       m_errorHandler = errorHandler;
       m_locator = locator;
     }
   
  +  /**
  +   * Constructor Compiler
  +   *
  +   */
     public Compiler()
     {
       m_errorHandler = null;
       m_locator = null;
     }
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * Execute the XPath object from a given opcode position.
  @@ -65,81 +133,141 @@
      * @param callback Interface that implements the processLocatedNode method.
      * @param callbackInfo Object that will be passed to the processLocatedNode method.
      * @return The result of the XPath.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public Expression compile(int opPos)
  -    throws org.xml.sax.SAXException
  +  public Expression compile(int opPos) throws org.xml.sax.SAXException
     {
  +
       int op = m_opMap[opPos];
  +
       // System.out.println(getPatternString()+"op: "+op);
  -    switch(op)
  +    switch (op)
       {
  -    case OpCodes.OP_XPATH: return compile(opPos+2);
  -    case OpCodes.OP_OR: return or(opPos);
  -    case OpCodes.OP_AND: return and(opPos);
  -    case OpCodes.OP_NOTEQUALS: return notequals(opPos);
  -    case OpCodes.OP_EQUALS: return equals(opPos);
  -    case OpCodes.OP_LTE: return lte(opPos);
  -    case OpCodes.OP_LT: return lt(opPos);
  -    case OpCodes.OP_GTE: return gte(opPos);
  -    case OpCodes.OP_GT: return gt(opPos);
  -    case OpCodes.OP_PLUS: return plus(opPos);
  -    case OpCodes.OP_MINUS: return minus(opPos);
  -    case OpCodes.OP_MULT: return mult(opPos);
  -    case OpCodes.OP_DIV: return div(opPos);
  -    case OpCodes.OP_MOD: return mod(opPos);
  -    case OpCodes.OP_QUO: return quo(opPos);
  -    case OpCodes.OP_NEG: return neg(opPos);
  -    case OpCodes.OP_STRING: return string(opPos);
  -    case OpCodes.OP_BOOL: return bool(opPos);
  -    case OpCodes.OP_NUMBER: return number(opPos);
  -    case OpCodes.OP_UNION: return union(opPos);
  -    case OpCodes.OP_LITERAL: return literal(opPos);
  -    case OpCodes.OP_VARIABLE: return variable(opPos);
  -    case OpCodes.OP_GROUP: return group(opPos);
  -    case OpCodes.OP_NUMBERLIT: return numberlit(opPos);
  -    case OpCodes.OP_ARGUMENT: return arg(opPos);
  -    case OpCodes.OP_EXTFUNCTION: return compileExtension(opPos);
  -    case OpCodes.OP_FUNCTION: return compileFunction(opPos);
  -    case OpCodes.OP_LOCATIONPATH: return locationPath(opPos);
  -    case OpCodes.OP_PREDICATE: return null; // should never hit this here.
  -    case OpCodes.OP_MATCHPATTERN: return matchPattern(opPos+2);
  -    case OpCodes.OP_LOCATIONPATHPATTERN: return locationPathPattern(opPos);
  -    default:  error(XPATHErrorResources.ER_UNKNOWN_OPCODE, new Object[] {Integer.toString(m_opMap[opPos])}); //"ERROR! Unknown op code: "+m_opMap[opPos]);
  +    case OpCodes.OP_XPATH :
  +      return compile(opPos + 2);
  +    case OpCodes.OP_OR :
  +      return or(opPos);
  +    case OpCodes.OP_AND :
  +      return and(opPos);
  +    case OpCodes.OP_NOTEQUALS :
  +      return notequals(opPos);
  +    case OpCodes.OP_EQUALS :
  +      return equals(opPos);
  +    case OpCodes.OP_LTE :
  +      return lte(opPos);
  +    case OpCodes.OP_LT :
  +      return lt(opPos);
  +    case OpCodes.OP_GTE :
  +      return gte(opPos);
  +    case OpCodes.OP_GT :
  +      return gt(opPos);
  +    case OpCodes.OP_PLUS :
  +      return plus(opPos);
  +    case OpCodes.OP_MINUS :
  +      return minus(opPos);
  +    case OpCodes.OP_MULT :
  +      return mult(opPos);
  +    case OpCodes.OP_DIV :
  +      return div(opPos);
  +    case OpCodes.OP_MOD :
  +      return mod(opPos);
  +    case OpCodes.OP_QUO :
  +      return quo(opPos);
  +    case OpCodes.OP_NEG :
  +      return neg(opPos);
  +    case OpCodes.OP_STRING :
  +      return string(opPos);
  +    case OpCodes.OP_BOOL :
  +      return bool(opPos);
  +    case OpCodes.OP_NUMBER :
  +      return number(opPos);
  +    case OpCodes.OP_UNION :
  +      return union(opPos);
  +    case OpCodes.OP_LITERAL :
  +      return literal(opPos);
  +    case OpCodes.OP_VARIABLE :
  +      return variable(opPos);
  +    case OpCodes.OP_GROUP :
  +      return group(opPos);
  +    case OpCodes.OP_NUMBERLIT :
  +      return numberlit(opPos);
  +    case OpCodes.OP_ARGUMENT :
  +      return arg(opPos);
  +    case OpCodes.OP_EXTFUNCTION :
  +      return compileExtension(opPos);
  +    case OpCodes.OP_FUNCTION :
  +      return compileFunction(opPos);
  +    case OpCodes.OP_LOCATIONPATH :
  +      return locationPath(opPos);
  +    case OpCodes.OP_PREDICATE :
  +      return null;  // should never hit this here.
  +    case OpCodes.OP_MATCHPATTERN :
  +      return matchPattern(opPos + 2);
  +    case OpCodes.OP_LOCATIONPATHPATTERN :
  +      return locationPathPattern(opPos);
  +    default :
  +      error(XPATHErrorResources.ER_UNKNOWN_OPCODE,
  +            new Object[]{ Integer.toString(m_opMap[opPos]) });  //"ERROR! Unknown op code: "+m_opMap[opPos]);
       }
  +
       return null;
     }
  -  
  +
     /**
      * Bottle-neck compilation of an operation.
  +   *
  +   * NEEDSDOC @param operation
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws SAXException
      */
     private Expression compileOperation(Operation operation, int opPos)
  -    throws SAXException
  +          throws SAXException
     {
  +
       int leftPos = getFirstChildPos(opPos);
       int rightPos = getNextOpPos(leftPos);
  +
       operation.setLeftRight(compile(leftPos), compile(rightPos));
  +
       return operation;
     }
  -  
  +
     /**
      * Bottle-neck compilation of an operation.
  +   *
  +   * NEEDSDOC @param unary
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws SAXException
      */
     private Expression compileUnary(UnaryOperation unary, int opPos)
  -    throws SAXException
  +          throws SAXException
     {
  +
       int rightPos = getFirstChildPos(opPos);
  +
       unary.setRight(compile(rightPos));
  +
       return unary;
     }
  -  
  +
     /**
      * OR two expressions and return the boolean result.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if the one of the two arguments are true.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression or(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression or(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Or(), opPos);
     }
  @@ -149,9 +277,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if the two arguments are both true.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression and(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression and(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new And(), opPos);
     }
  @@ -161,34 +292,42 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if the two arguments are not equal.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression notequals(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression notequals(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new NotEquals(), opPos);
     }
   
  -
     /**
      * Tell if two expressions are functionally equal.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if the two arguments are equal.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression equals(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression equals(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Equals(), opPos);
     }
  -    
  +
     /**
      * Tell if one argument is less than or equal to the other argument.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if arg 1 is less than or equal to arg 2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression lte(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression lte(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Lte(), opPos);
     }
  @@ -198,9 +337,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if arg 1 is less than arg 2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression lt(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression lt(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Lt(), opPos);
     }
  @@ -210,22 +352,27 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if arg 1 is greater than or equal to arg 2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression gte(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression gte(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Gte(), opPos);
     }
   
  -
     /**
      * Tell if one argument is greater than the other argument.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns XBoolean set to true if arg 1 is greater than arg 2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression gt(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression gt(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Gt(), opPos);
     }
  @@ -235,9 +382,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns sum of arg1 and arg2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression plus(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression plus(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Plus(), opPos);
     }
  @@ -247,9 +397,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns difference of arg1 and arg2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression minus(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression minus(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Minus(), opPos);
     }
  @@ -259,9 +412,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns arg1 * arg2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression mult(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression mult(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Mult(), opPos);
     }
  @@ -270,10 +426,13 @@
      * Divide a number.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      * @returns arg1 / arg2.
      */
  -  protected Expression div(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression div(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Div(), opPos);
     }
  @@ -283,9 +442,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns arg1 mod arg2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression mod(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression mod(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Mod(), opPos);
     }
  @@ -296,9 +458,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns arg1 mod arg2.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression quo(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression quo(int opPos) throws org.xml.sax.SAXException
     {
       return compileOperation(new Quo(), opPos);
     }
  @@ -308,9 +473,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns -arg.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression neg(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression neg(int opPos) throws org.xml.sax.SAXException
     {
       return compileUnary(new Neg(), opPos);
     }
  @@ -320,9 +488,12 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns arg cast to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression string(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression string(int opPos) throws org.xml.sax.SAXException
     {
       return compileUnary(new org.apache.xpath.operations.String(), opPos);
     }
  @@ -332,94 +503,123 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns arg cast to a boolean.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression bool(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression bool(int opPos) throws org.xml.sax.SAXException
     {
       return compileUnary(new org.apache.xpath.operations.Bool(), opPos);
     }
  - 
  +
     /**
      * Cast an expression to a number.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns arg cast to a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression number(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression number(int opPos) throws org.xml.sax.SAXException
     {
       return compileUnary(new org.apache.xpath.operations.Number(), opPos);
     }
  -  
  +
     /**
      * Get a literal value.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns an XString object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  protected Expression literal(int opPos) 
  +  protected Expression literal(int opPos)
     {
  +
       opPos = getFirstChildPos(opPos);
  -    
  -    return (XString)m_tokenQueue[m_opMap[opPos]];
  +
  +    return (XString) m_tokenQueue[m_opMap[opPos]];
     }
  -  
  +
     /**
      * Get a literal value.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns an XString object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  protected Expression numberlit(int opPos) 
  +  protected Expression numberlit(int opPos)
     {
  +
       opPos = getFirstChildPos(opPos);
  -    return (XNumber)m_tokenQueue[m_opMap[opPos]];
  +
  +    return (XNumber) m_tokenQueue[m_opMap[opPos]];
     }
  -  
  +
     /**
      * Get a literal value.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns an XObject object.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression variable(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression variable(int opPos) throws org.xml.sax.SAXException
     {
  +
       Variable var = new Variable();
  +
       opPos = getFirstChildPos(opPos);
  -    java.lang.String varName = (java.lang.String)m_tokenQueue[m_opMap[opPos]];
  +
  +    java.lang.String varName =
  +      (java.lang.String) m_tokenQueue[m_opMap[opPos]];
       QName qname = new QName(varName, getNamespaceContext());
  +
       var.setQName(qname);
  +
       return var;
     }
   
  -
     /**
      * Execute an expression as a group.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns arg.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression group(int opPos) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  protected Expression group(int opPos) throws org.xml.sax.SAXException
  +  {
  +
       // no-op
  -    return compile(opPos+2);
  +    return compile(opPos + 2);
     }
  -  
  +
     /**
      * Execute a function argument.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns the result of the argument expression.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression arg(int opPos) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  protected Expression arg(int opPos) throws org.xml.sax.SAXException
  +  {
  +
       // no-op
  -    return compile(opPos+2);
  +    return compile(opPos + 2);
     }
  -  
  +
     /**
      * Computes the union of its operands which must be node-sets.
      * @param context The current source tree context node.
  @@ -427,11 +627,13 @@
      * @param callback Interface that implements the processLocatedNode method.
      * @param callbackInfo Object that will be passed to the processLocatedNode method.
      * @returns the union of node-set operands.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression union(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression union(int opPos) throws org.xml.sax.SAXException
     {
  -    
       return new UnionPathIterator(this, opPos);
     }
   
  @@ -443,11 +645,14 @@
      * @param callback Interface that implements the processLocatedNode method.
      * @param callbackInfo Object that will be passed to the processLocatedNode method.
      * @returns a node-set.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public Expression locationPath(int opPos) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    return new LocPathIterator(this, opPos);
  +  public Expression locationPath(int opPos) throws org.xml.sax.SAXException
  +  {
  +    return WalkerFactory.newLocPathIterator(this, opPos);
     }
   
     /**
  @@ -456,108 +661,127 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns either a boolean or a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public Expression predicate(int opPos) 
  -    throws org.xml.sax.SAXException
  +  public Expression predicate(int opPos) throws org.xml.sax.SAXException
     {
  -    return compile(opPos+2);
  +    return compile(opPos + 2);
     }
  -  
  +
     /**
      * Computes the union of its operands which must be node-sets.
      * @param context The current source tree context node.
      * @param opPos The current position in the m_opMap array.
      * @returns the match score in the form of an XObject.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected Expression matchPattern(int opPos) 
  -    throws org.xml.sax.SAXException
  +  protected Expression matchPattern(int opPos) throws org.xml.sax.SAXException
     {
  +
       // First, count...
       int nextOpPos = opPos;
       int i;
  -    for( i = 0; m_opMap[nextOpPos] == OpCodes.OP_LOCATIONPATHPATTERN; i++)
  +
  +    for (i = 0; m_opMap[nextOpPos] == OpCodes.OP_LOCATIONPATHPATTERN; i++)
  +    {
         nextOpPos = getNextOpPos(nextOpPos);
  -    
  -    if( i == 1 )
  +    }
  +
  +    if (i == 1)
         return compile(opPos);
   
       UnionPattern up = new UnionPattern();
  -    StepPattern[] patterns =  new StepPattern[i];
  +    StepPattern[] patterns = new StepPattern[i];
   
  -    for(i = 0; m_opMap[opPos] == OpCodes.OP_LOCATIONPATHPATTERN; i++)
  +    for (i = 0; m_opMap[opPos] == OpCodes.OP_LOCATIONPATHPATTERN; i++)
       {
         nextOpPos = getNextOpPos(opPos);
  -      patterns[i] = (StepPattern)compile(opPos);
  -      opPos =  nextOpPos;
  +      patterns[i] = (StepPattern) compile(opPos);
  +      opPos = nextOpPos;
       }
  +
       up.setPatterns(patterns);
  -    
  +
       return up;
     }
  -  
  +
     /**
      * Execute a a location path pattern.  This will return a score
  -   * of MATCH_SCORE_NONE, MATCH_SCORE_NODETEST, 
  +   * of MATCH_SCORE_NONE, MATCH_SCORE_NODETEST,
      * MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
      * @param xpath The xpath that is executing.
      * @param context The current source tree context node.
      * @param opPos The current position in the xpath.m_opMap array.
  -   * @returns score, one of MATCH_SCORE_NODETEST, 
  +   * @returns score, one of MATCH_SCORE_NODETEST,
      * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public Expression locationPathPattern(int opPos) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public Expression locationPathPattern(int opPos)
  +          throws org.xml.sax.SAXException
  +  {
  +
       opPos = getFirstChildPos(opPos);
  +
       return stepPattern(opPos, 0, null);
     }
  -    
  +
  +  /**
  +   * NEEDSDOC Method getWhatToShow 
  +   *
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC (getWhatToShow) @return
  +   */
     public int getWhatToShow(int opPos)
     {
  +
       int axesType = getOp(opPos);
  -    int testType = getOp(opPos+3);
  +    int testType = getOp(opPos + 3);
  +
       // System.out.println("testType: "+testType);
  -    switch(testType)
  +    switch (testType)
       {
  -    case OpCodes.NODETYPE_COMMENT:
  +    case OpCodes.NODETYPE_COMMENT :
         return NodeFilter.SHOW_COMMENT;
  -
  -    case OpCodes.NODETYPE_TEXT:
  +    case OpCodes.NODETYPE_TEXT :
         return NodeFilter.SHOW_TEXT | NodeFilter.SHOW_COMMENT;
  -
  -    case OpCodes.NODETYPE_PI:
  +    case OpCodes.NODETYPE_PI :
         return NodeFilter.SHOW_PROCESSING_INSTRUCTION;
  -
  -    case OpCodes.NODETYPE_NODE:
  +    case OpCodes.NODETYPE_NODE :
         return NodeFilter.SHOW_ALL;
  -      
  -    case OpCodes.NODETYPE_ROOT:
  +    case OpCodes.NODETYPE_ROOT :
         return NodeFilter.SHOW_DOCUMENT;
  -      
  -    case OpCodes.NODETYPE_FUNCTEST:
  +    case OpCodes.NODETYPE_FUNCTEST :
         return NodeTest.SHOW_BYFUNCTION;
  -      
  -    case OpCodes.NODENAME:
  -      switch(axesType)
  +    case OpCodes.NODENAME :
  +      switch (axesType)
         {
  -      case OpCodes.FROM_NAMESPACE: 
  +      case OpCodes.FROM_NAMESPACE :
           return NodeFilter.SHOW_ATTRIBUTE | NodeTest.SHOW_NAMESPACE;
  -        
  -      case OpCodes.FROM_ATTRIBUTES: 
  -      case OpCodes.MATCH_ATTRIBUTE:
  +      case OpCodes.FROM_ATTRIBUTES :
  +      case OpCodes.MATCH_ATTRIBUTE :
           return NodeFilter.SHOW_ATTRIBUTE;
  -        // break;
   
  -      case OpCodes.MATCH_ANY_ANCESTOR:
  -      case OpCodes.MATCH_IMMEDIATE_ANCESTOR:
  +      // break;
  +      case OpCodes.MATCH_ANY_ANCESTOR :
  +      case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
           return NodeFilter.SHOW_ELEMENT;
  -        // break;
  -        
  -      default:
  +
  +      // break;
  +      default :
           return NodeFilter.SHOW_ELEMENT;
         }
  -
  -    default:
  +    default :
         return NodeFilter.SHOW_ALL;
       }
     }
  @@ -568,109 +792,144 @@
      * @param context The current source tree context node.
      * @param opPos The current position in the xpath.m_opMap array.
      * @returns the last matched context node.
  -   */
  -  protected StepPattern stepPattern(int opPos, int stepCount, StepPattern ancestorPattern) 
  -    throws org.xml.sax.SAXException
  -  {    
  +   * NEEDSDOC @param stepCount
  +   * NEEDSDOC @param ancestorPattern
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  protected StepPattern stepPattern(
  +          int opPos, int stepCount, StepPattern ancestorPattern)
  +            throws org.xml.sax.SAXException
  +  {
  +
       int startOpPos = opPos;
       int stepType = getOpMap()[opPos];
  -    if(OpCodes.ENDOP == stepType)
  +
  +    if (OpCodes.ENDOP == stepType)
         return null;
  -    
  +
       int endStep = getNextOpPos(opPos);
  +
       // int nextStepType = getOpMap()[endStep];
  -    
       StepPattern pattern;
   
       // boolean isSimple = ((OpCodes.ENDOP == nextStepType) && (stepCount == 0));
  -    
       int argLen;
   
  -    switch(stepType)
  +    switch (stepType)
       {
  -    case OpCodes.OP_FUNCTION:
  -      argLen = m_opMap[opPos+OpMap.MAPINDEX_LENGTH];
  +    case OpCodes.OP_FUNCTION :
  +      argLen = m_opMap[opPos + OpMap.MAPINDEX_LENGTH];
         pattern = new FunctionPattern(compileFunction(opPos));
         break;
  -      
  -    case OpCodes.FROM_ROOT:
  +    case OpCodes.FROM_ROOT :
         argLen = getArgLengthOfStep(opPos);
         opPos = getFirstChildPosOfStep(opPos);
         pattern = new StepPattern(NodeFilter.SHOW_DOCUMENT);
         break;
  -      
  -    case OpCodes.MATCH_ATTRIBUTE:
  +    case OpCodes.MATCH_ATTRIBUTE :
         argLen = getArgLengthOfStep(opPos);
         opPos = getFirstChildPosOfStep(opPos);
  -      pattern = new StepPattern(NodeFilter.SHOW_ATTRIBUTE, 
  -                                getStepNS(startOpPos), 
  +      pattern = new StepPattern(NodeFilter.SHOW_ATTRIBUTE,
  +                                getStepNS(startOpPos),
                                   getStepLocalName(startOpPos));
         break;
  -
  -    case OpCodes.MATCH_ANY_ANCESTOR:
  +    case OpCodes.MATCH_ANY_ANCESTOR :
         argLen = getArgLengthOfStep(opPos);
         opPos = getFirstChildPosOfStep(opPos);
  -      pattern = new AncestorStepPattern(getWhatToShow(startOpPos), 
  -                                getStepNS(startOpPos), 
  -                                getStepLocalName(startOpPos));
  +      pattern = new AncestorStepPattern(getWhatToShow(startOpPos),
  +                                        getStepNS(startOpPos),
  +                                        getStepLocalName(startOpPos));
         break;
  -      
  -    case OpCodes.MATCH_IMMEDIATE_ANCESTOR:
  +    case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
         argLen = getArgLengthOfStep(opPos);
         opPos = getFirstChildPosOfStep(opPos);
  -      pattern = new StepPattern(getWhatToShow(startOpPos), 
  -                                getStepNS(startOpPos), 
  +      pattern = new StepPattern(getWhatToShow(startOpPos),
  +                                getStepNS(startOpPos),
                                   getStepLocalName(startOpPos));
         break;
  -      
  -    default:
  -      error(XPATHErrorResources.ER_UNKNOWN_MATCH_OPERATION, null); //"unknown match operation!");
  +    default :
  +      error(XPATHErrorResources.ER_UNKNOWN_MATCH_OPERATION, null);  //"unknown match operation!");
  +
         return null;
       }
  -    
  +
       pattern.setPredicates(getCompiledPredicates(opPos + argLen));
       pattern.setRelativePathPattern(ancestorPattern);
  -    
  -    StepPattern relativePathPattern = stepPattern(endStep, stepCount+1, pattern);
  -        
  +
  +    StepPattern relativePathPattern = stepPattern(endStep, stepCount + 1,
  +                                        pattern);
  +
       return (null != relativePathPattern) ? relativePathPattern : pattern;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getCompiledPredicates 
  +   *
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC (getCompiledPredicates) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public Expression[] getCompiledPredicates(int opPos)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       int count = countPredicates(opPos);
  -    if(count > 0)
  +
  +    if (count > 0)
       {
         Expression[] predicates = new Expression[count];
  +
         compilePredicates(opPos, predicates);
  +
         return predicates;
       }
  +
       return null;
     }
  -  
  +
     /**
      * Count the number of predicates in the step.
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public int countPredicates(int opPos)
  -    throws org.xml.sax.SAXException
  +  public int countPredicates(int opPos) throws org.xml.sax.SAXException
     {
  +
       int count = 0;
  -    while(OpCodes.OP_PREDICATE == getOp(opPos))
  +
  +    while (OpCodes.OP_PREDICATE == getOp(opPos))
       {
         count++;
  +
         opPos = getNextOpPos(opPos);
       }
  +
       return count;
     }
  -  
  +
     /**
      * Allocate predicates in the step.
  +   *
  +   * NEEDSDOC @param opPos
  +   * NEEDSDOC @param predicates
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     private void compilePredicates(int opPos, Expression[] predicates)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    for(int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++)
  +
  +    for (int i = 0; OpCodes.OP_PREDICATE == getOp(opPos); i++)
       {
         predicates[i] = predicate(opPos);
         opPos = getNextOpPos(opPos);
  @@ -679,124 +938,178 @@
   
     /**
      * Execute a function from an op code.
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  Expression compileFunction(int opPos)
  -    throws org.xml.sax.SAXException
  +  Expression compileFunction(int opPos) throws org.xml.sax.SAXException
     {
  -    int endFunc = opPos+m_opMap[opPos+1]-1;
  +
  +    int endFunc = opPos + m_opMap[opPos + 1] - 1;
  +
       opPos = getFirstChildPos(opPos);
  +
       int funcID = m_opMap[opPos];
  +
       opPos++;
  -    if(-1 != funcID)
  +
  +    if (-1 != funcID)
       {
         Function func = FunctionTable.getFunction(funcID);
   
         try
         {
           int i = 0;
  -        for(int p = opPos; p < endFunc; p = getNextOpPos(p), i++)
  +
  +        for (int p = opPos; p < endFunc; p = getNextOpPos(p), i++)
           {
  +
             // System.out.println("argPos: "+ p);
             // System.out.println("argCode: "+ m_opMap[p]);
             func.setArg(compile(p), i);
           }
  +
           func.checkNumberArgs(i);
         }
  -      catch(WrongNumberArgsException wnae)
  +      catch (WrongNumberArgsException wnae)
         {
           java.lang.String name = FunctionTable.m_functions[funcID].getName();
  -        throw new SAXException(name+" only allows "+wnae.m_argsExpected+" arguments");
  +
  +        throw new SAXException(name + " only allows " + wnae.m_argsExpected
  +                               + " arguments");
         }
  -      
  +
         return func;
       }
       else
       {
  -      warn(XPATHErrorResources.WG_FUNCTION_TOKEN_NOT_FOUND, null); //"function token not found.");
  +      warn(XPATHErrorResources.WG_FUNCTION_TOKEN_NOT_FOUND, null);  //"function token not found.");
  +
         return null;
       }
     }
  -  
  +
     /**
      * Execute an extension function from an op code.
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     private Expression compileExtension(int opPos)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    int endExtFunc = opPos+m_opMap[opPos+1]-1;
  +
  +    int endExtFunc = opPos + m_opMap[opPos + 1] - 1;
  +
       opPos = getFirstChildPos(opPos);
  -    java.lang.String ns = (java.lang.String)m_tokenQueue[m_opMap[opPos]];
  +
  +    java.lang.String ns = (java.lang.String) m_tokenQueue[m_opMap[opPos]];
  +
       opPos++;
  -    java.lang.String funcName = (java.lang.String)m_tokenQueue[m_opMap[opPos]];
  +
  +    java.lang.String funcName =
  +      (java.lang.String) m_tokenQueue[m_opMap[opPos]];
  +
       opPos++;
  -    Function extension = new FuncExtFunction(ns, funcName, 
  -                            // Create a method key, for faster lookup.
  -                            String.valueOf(opPos)+String.valueOf(hashCode()));
  -    
  +
  +    Function extension = new FuncExtFunction(ns, funcName,
  +
  +    // Create a method key, for faster lookup.
  +    String.valueOf(opPos) + String.valueOf(hashCode()));
  +
       try
       {
         int i = 0;
  -      while(opPos < endExtFunc)
  +
  +      while (opPos < endExtFunc)
         {
           int nextOpPos = getNextOpPos(opPos);
  +
           extension.setArg(this.compile(opPos), i);
  +
           opPos = nextOpPos;
  +
           i++;
         }
       }
  -    catch(WrongNumberArgsException wnae)
  +    catch (WrongNumberArgsException wnae)
       {
  -      ; // should never happen
  +      ;  // should never happen
       }
  +
       return extension;
     }
   
  -  
     /**
      * Warn the user of an problem.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void warn(int msg, Object[] args)
  -    throws org.xml.sax.SAXException
  +  public void warn(int msg, Object[] args) throws org.xml.sax.SAXException
     {
  -    java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args); 
  -    
  -    if(null != m_errorHandler)
  +
  +    java.lang.String fmsg = XSLMessages.createXPATHWarning(msg, args);
  +
  +    if (null != m_errorHandler)
       {
  +
         // TO DO: Need to get stylesheet Locator from here.
         m_errorHandler.warning(new ProcessorException(fmsg));
       }
     }
   
     /**
  -   * Tell the user of an assertion error, and probably throw an 
  +   * Tell the user of an assertion error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param b
  +   * NEEDSDOC @param msg
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public void assert(boolean b, java.lang.String msg)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    if(!b)
  +
  +    if (!b)
       {
  -      java.lang.String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] {msg}); 
  +      java.lang.String fMsg = XSLMessages.createXPATHMessage(
  +        XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
  +        new Object[]{ msg });
  +
         throw new RuntimeException(fMsg);
       }
     }
   
     /**
  -   * Tell the user of an error, and probably throw an 
  +   * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void error(int msg, Object[] args)
  -    throws org.xml.sax.SAXException
  +  public void error(int msg, Object[] args) throws org.xml.sax.SAXException
     {
  -    java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args); 
  -    
  -    ProcessorException te = new ProcessorException(fmsg, 
  -                                                   m_locator);
  -    
  -    if(null != m_errorHandler)
  +
  +    java.lang.String fmsg = XSLMessages.createXPATHMessage(msg, args);
  +    ProcessorException te = new ProcessorException(fmsg, m_locator);
  +
  +    if (null != m_errorHandler)
         m_errorHandler.fatalError(te);
       else
       {
  +
         // System.out.println(te.getMessage()
         //                    +"; file "+te.getSystemId()
         //                    +"; line "+te.getLineNumber()
  @@ -804,15 +1117,16 @@
         throw te;
       }
     }
  -  
  +
     /**
      * The current prefixResolver for the execution context.
      */
     private PrefixResolver m_currentPrefixResolver = null;
   
  -  
     /**
      * Get the current namespace context for the xpath.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public PrefixResolver getNamespaceContext()
     {
  @@ -821,14 +1135,17 @@
   
     /**
      * Set the current namespace context for the xpath.
  +   *
  +   * NEEDSDOC @param pr
      */
     public void setNamespaceContext(PrefixResolver pr)
     {
       m_currentPrefixResolver = pr;
  -  } 
  +  }
   
  +  /** NEEDSDOC Field m_errorHandler          */
     ErrorHandler m_errorHandler;
  +
  +  /** NEEDSDOC Field m_locator          */
     Locator m_locator;
  -  
  -  
   }
  
  
  
  1.2       +51 -16    xml-xalan/java/src/org/apache/xpath/compiler/FuncLoader.java
  
  Index: FuncLoader.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/FuncLoader.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncLoader.java	2000/07/05 14:45:35	1.1
  +++ FuncLoader.java	2000/10/30 18:59:20	1.2
  @@ -54,12 +54,16 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.compiler; 
  +package org.apache.xpath.compiler;
   
   import java.lang.Class;
  +
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,53 +75,84 @@
    */
   public class FuncLoader
   {
  +
  +  /** NEEDSDOC Field m_funcID          */
     private int m_funcID;
  +
  +  /** NEEDSDOC Field m_funcName, test          */
     private String m_funcName, test;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getName 
  +   *
  +   *
  +   * NEEDSDOC (getName) @return
  +   */
     public String getName()
     {
       return m_funcName;
     }
  -  
  +
  +  /**
  +   * Constructor FuncLoader
  +   *
  +   *
  +   * NEEDSDOC @param funcName
  +   * NEEDSDOC @param funcID
  +   */
     public FuncLoader(String funcName, int funcID)
     {
  +
       super();
  +
       m_funcID = funcID;
       m_funcName = funcName;
     }
  -  
  -  public Function getFunction() 
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method getFunction 
  +   *
  +   *
  +   * NEEDSDOC (getFunction) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public Function getFunction() throws org.xml.sax.SAXException
     {
  +
       try
       {
         Class function;
  +
         // first get package name if necessary
  -      if ( m_funcName.indexOf(".") < 0 )
  -      {  
  +      if (m_funcName.indexOf(".") < 0)
  +      {
  +
           // String thisName = this.getClass().getName();
           // int lastdot = thisName.lastIndexOf(".");
           // String classname = thisName.substring(0,lastdot+1) + m_funcName; 
  -        String classname = "org.apache.xpath.functions." + m_funcName; 
  +        String classname = "org.apache.xpath.functions." + m_funcName;
  +
           function = Class.forName(classname);
         }
         else
           function = Class.forName(m_funcName);
  -      
  -      Function func = (Function)function.newInstance();
  +
  +      Function func = (Function) function.newInstance();
  +
         return func;
       }
  -    catch(ClassNotFoundException e)
  +    catch (ClassNotFoundException e)
       {
         throw new org.xml.sax.SAXException(e);
       }
  -    catch(IllegalAccessException e)
  +    catch (IllegalAccessException e)
       {
         throw new org.xml.sax.SAXException(e);
  -    } 
  -    catch(InstantiationException e)
  +    }
  +    catch (InstantiationException e)
       {
         throw new org.xml.sax.SAXException(e);
  -    } 
  +    }
     }
   }
  
  
  
  1.2       +199 -36   xml-xalan/java/src/org/apache/xpath/compiler/FunctionTable.java
  
  Index: FunctionTable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/FunctionTable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FunctionTable.java	2000/07/05 14:45:35	1.1
  +++ FunctionTable.java	2000/10/30 18:59:21	1.2
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.compiler;
   
   import org.apache.xpath.Expression;
  @@ -8,54 +64,125 @@
    */
   public class FunctionTable
   {
  +
  +  /** NEEDSDOC Field FUNC_CURRENT          */
     public static final int FUNC_CURRENT = 0;
  +
  +  /** NEEDSDOC Field FUNC_LAST          */
     public static final int FUNC_LAST = 1;
  +
  +  /** NEEDSDOC Field FUNC_POSITION          */
     public static final int FUNC_POSITION = 2;
  +
  +  /** NEEDSDOC Field FUNC_COUNT          */
     public static final int FUNC_COUNT = 3;
  +
  +  /** NEEDSDOC Field FUNC_ID          */
     public static final int FUNC_ID = 4;
  +
  +  /** NEEDSDOC Field FUNC_KEY          */
     public static final int FUNC_KEY = 5;
  +
     // public static final int FUNC_DOC = 6;
  +
  +  /** NEEDSDOC Field FUNC_LOCAL_PART          */
     public static final int FUNC_LOCAL_PART = 7;
  +
  +  /** NEEDSDOC Field FUNC_NAMESPACE          */
     public static final int FUNC_NAMESPACE = 8;
  +
  +  /** NEEDSDOC Field FUNC_QNAME          */
     public static final int FUNC_QNAME = 9;
  +
  +  /** NEEDSDOC Field FUNC_GENERATE_ID          */
     public static final int FUNC_GENERATE_ID = 10;
  +
  +  /** NEEDSDOC Field FUNC_NOT          */
     public static final int FUNC_NOT = 11;
  +
  +  /** NEEDSDOC Field FUNC_TRUE          */
     public static final int FUNC_TRUE = 12;
  +
  +  /** NEEDSDOC Field FUNC_FALSE          */
     public static final int FUNC_FALSE = 13;
  +
  +  /** NEEDSDOC Field FUNC_BOOLEAN          */
     public static final int FUNC_BOOLEAN = 14;
  +
  +  /** NEEDSDOC Field FUNC_NUMBER          */
     public static final int FUNC_NUMBER = 15;
  +
  +  /** NEEDSDOC Field FUNC_FLOOR          */
     public static final int FUNC_FLOOR = 16;
  +
  +  /** NEEDSDOC Field FUNC_CEILING          */
     public static final int FUNC_CEILING = 17;
  +
  +  /** NEEDSDOC Field FUNC_ROUND          */
     public static final int FUNC_ROUND = 18;
  +
  +  /** NEEDSDOC Field FUNC_SUM          */
     public static final int FUNC_SUM = 19;
  +
  +  /** NEEDSDOC Field FUNC_STRING          */
     public static final int FUNC_STRING = 20;
  +
  +  /** NEEDSDOC Field FUNC_STARTS_WITH          */
     public static final int FUNC_STARTS_WITH = 21;
  +
  +  /** NEEDSDOC Field FUNC_CONTAINS          */
     public static final int FUNC_CONTAINS = 22;
  +
  +  /** NEEDSDOC Field FUNC_SUBSTRING_BEFORE          */
     public static final int FUNC_SUBSTRING_BEFORE = 23;
  +
  +  /** NEEDSDOC Field FUNC_SUBSTRING_AFTER          */
     public static final int FUNC_SUBSTRING_AFTER = 24;
  +
  +  /** NEEDSDOC Field FUNC_NORMALIZE_SPACE          */
     public static final int FUNC_NORMALIZE_SPACE = 25;
  +
  +  /** NEEDSDOC Field FUNC_TRANSLATE          */
     public static final int FUNC_TRANSLATE = 26;
  +
  +  /** NEEDSDOC Field FUNC_CONCAT          */
     public static final int FUNC_CONCAT = 27;
  - // public static final int FUNC_FORMAT_NUMBER = 28;
  +
  +  // public static final int FUNC_FORMAT_NUMBER = 28;
  +
  +  /** NEEDSDOC Field FUNC_SUBSTRING          */
     public static final int FUNC_SUBSTRING = 29;
  +
  +  /** NEEDSDOC Field FUNC_STRING_LENGTH          */
     public static final int FUNC_STRING_LENGTH = 30;
  +
  +  /** NEEDSDOC Field FUNC_SYSTEM_PROPERTY          */
     public static final int FUNC_SYSTEM_PROPERTY = 31;
  +
  +  /** NEEDSDOC Field FUNC_LANG          */
     public static final int FUNC_LANG = 32;
  +
  +  /** NEEDSDOC Field FUNC_EXT_FUNCTION_AVAILABLE          */
     public static final int FUNC_EXT_FUNCTION_AVAILABLE = 33;
  +
  +  /** NEEDSDOC Field FUNC_EXT_ELEM_AVAILABLE          */
     public static final int FUNC_EXT_ELEM_AVAILABLE = 34;
  -    
  +
     // Proprietary
  +
  +  /** NEEDSDOC Field FUNC_DOCLOCATION          */
     public static final int FUNC_DOCLOCATION = 35;
   
  +  /** NEEDSDOC Field FUNC_UNPARSED_ENTITY_URI          */
     public static final int FUNC_UNPARSED_ENTITY_URI = 36;
   
     /**
      * The function table.
      */
     public static FuncLoader m_functions[];
  -    
  +
     /**
  -   * Number of built in functions.  Be sure to update this as 
  +   * Number of built in functions.  Be sure to update this as
      * built-in functions are added.
      */
     private static final int NUM_BUILT_IN_FUNCS = 37;
  @@ -64,26 +191,32 @@
      * Number of built-in functions that may be added.
      */
     private static final int NUM_ALLOWABLE_ADDINS = 30;
  -  
  +
     /**
      * The index to the next free function index.
      */
     static int m_funcNextFreeIndex = NUM_BUILT_IN_FUNCS;
  -  
  +
     static
     {
  -    m_functions = new FuncLoader[NUM_BUILT_IN_FUNCS+NUM_ALLOWABLE_ADDINS];
  +    m_functions = new FuncLoader[NUM_BUILT_IN_FUNCS + NUM_ALLOWABLE_ADDINS];
       m_functions[FUNC_CURRENT] = new FuncLoader("FuncCurrent", FUNC_CURRENT);
       m_functions[FUNC_LAST] = new FuncLoader("FuncLast", FUNC_LAST);
  -    m_functions[FUNC_POSITION] = new FuncLoader("FuncPosition", FUNC_POSITION);
  +    m_functions[FUNC_POSITION] = new FuncLoader("FuncPosition",
  +                                                FUNC_POSITION);
       m_functions[FUNC_COUNT] = new FuncLoader("FuncCount", FUNC_COUNT);
       m_functions[FUNC_ID] = new FuncLoader("FuncId", FUNC_ID);
  -    m_functions[FUNC_KEY] = new FuncLoader("org.apache.xalan.templates.FuncKey", FUNC_KEY);
  +    m_functions[FUNC_KEY] =
  +      new FuncLoader("org.apache.xalan.templates.FuncKey", FUNC_KEY);
  +
       // m_functions[FUNC_DOC] = new FuncDoc();
  -    m_functions[FUNC_LOCAL_PART] = new FuncLoader("FuncLocalPart", FUNC_LOCAL_PART);
  -    m_functions[FUNC_NAMESPACE] = new FuncLoader("FuncNamespace", FUNC_NAMESPACE);
  +    m_functions[FUNC_LOCAL_PART] = new FuncLoader("FuncLocalPart",
  +            FUNC_LOCAL_PART);
  +    m_functions[FUNC_NAMESPACE] = new FuncLoader("FuncNamespace",
  +            FUNC_NAMESPACE);
       m_functions[FUNC_QNAME] = new FuncLoader("FuncQname", FUNC_QNAME);
  -    m_functions[FUNC_GENERATE_ID] = new FuncLoader("FuncGenerateId", FUNC_GENERATE_ID);
  +    m_functions[FUNC_GENERATE_ID] = new FuncLoader("FuncGenerateId",
  +            FUNC_GENERATE_ID);
       m_functions[FUNC_NOT] = new FuncLoader("FuncNot", FUNC_NOT);
       m_functions[FUNC_TRUE] = new FuncLoader("FuncTrue", FUNC_TRUE);
       m_functions[FUNC_FALSE] = new FuncLoader("FuncFalse", FUNC_FALSE);
  @@ -95,25 +228,49 @@
       m_functions[FUNC_ROUND] = new FuncLoader("FuncRound", FUNC_ROUND);
       m_functions[FUNC_SUM] = new FuncLoader("FuncSum", FUNC_SUM);
       m_functions[FUNC_STRING] = new FuncLoader("FuncString", FUNC_STRING);
  -    m_functions[FUNC_STARTS_WITH] = new FuncLoader("FuncStartsWith", FUNC_STARTS_WITH);
  -    m_functions[FUNC_CONTAINS] = new FuncLoader("FuncContains", FUNC_CONTAINS);
  -    m_functions[FUNC_SUBSTRING_BEFORE] = new FuncLoader("FuncSubstringBefore", FUNC_SUBSTRING_BEFORE);
  -    m_functions[FUNC_SUBSTRING_AFTER] = new FuncLoader("FuncSubstringAfter", FUNC_SUBSTRING_AFTER);
  -    m_functions[FUNC_NORMALIZE_SPACE] = new FuncLoader("FuncNormalizeSpace", FUNC_NORMALIZE_SPACE);
  -    m_functions[FUNC_TRANSLATE] = new FuncLoader("FuncTranslate", FUNC_TRANSLATE);
  +    m_functions[FUNC_STARTS_WITH] = new FuncLoader("FuncStartsWith",
  +            FUNC_STARTS_WITH);
  +    m_functions[FUNC_CONTAINS] = new FuncLoader("FuncContains",
  +                                                FUNC_CONTAINS);
  +    m_functions[FUNC_SUBSTRING_BEFORE] = new FuncLoader("FuncSubstringBefore",
  +            FUNC_SUBSTRING_BEFORE);
  +    m_functions[FUNC_SUBSTRING_AFTER] = new FuncLoader("FuncSubstringAfter",
  +            FUNC_SUBSTRING_AFTER);
  +    m_functions[FUNC_NORMALIZE_SPACE] = new FuncLoader("FuncNormalizeSpace",
  +            FUNC_NORMALIZE_SPACE);
  +    m_functions[FUNC_TRANSLATE] = new FuncLoader("FuncTranslate",
  +            FUNC_TRANSLATE);
       m_functions[FUNC_CONCAT] = new FuncLoader("FuncConcat", FUNC_CONCAT);
  +
       //m_functions[FUNC_FORMAT_NUMBER] = new FuncFormatNumber();
  -    m_functions[FUNC_SYSTEM_PROPERTY] = new FuncLoader("FuncSystemProperty", FUNC_SYSTEM_PROPERTY);
  -    m_functions[FUNC_EXT_FUNCTION_AVAILABLE] = new FuncLoader("FuncExtFunctionAvailable", FUNC_EXT_FUNCTION_AVAILABLE);
  -    m_functions[FUNC_EXT_ELEM_AVAILABLE] = new FuncLoader("FuncExtElementAvailable", FUNC_EXT_ELEM_AVAILABLE);
  -    m_functions[FUNC_SUBSTRING] = new FuncLoader("FuncSubstring", FUNC_SUBSTRING);
  -    m_functions[FUNC_STRING_LENGTH] = new FuncLoader("FuncStringLength", FUNC_STRING_LENGTH);
  -    m_functions[FUNC_DOCLOCATION] = new FuncLoader("FuncDoclocation", FUNC_DOCLOCATION);
  -    m_functions[FUNC_UNPARSED_ENTITY_URI] = new FuncLoader("FuncUnparsedEntityURI", FUNC_UNPARSED_ENTITY_URI);
  +    m_functions[FUNC_SYSTEM_PROPERTY] = new FuncLoader("FuncSystemProperty",
  +            FUNC_SYSTEM_PROPERTY);
  +    m_functions[FUNC_EXT_FUNCTION_AVAILABLE] =
  +      new FuncLoader("FuncExtFunctionAvailable", FUNC_EXT_FUNCTION_AVAILABLE);
  +    m_functions[FUNC_EXT_ELEM_AVAILABLE] =
  +      new FuncLoader("FuncExtElementAvailable", FUNC_EXT_ELEM_AVAILABLE);
  +    m_functions[FUNC_SUBSTRING] = new FuncLoader("FuncSubstring",
  +            FUNC_SUBSTRING);
  +    m_functions[FUNC_STRING_LENGTH] = new FuncLoader("FuncStringLength",
  +            FUNC_STRING_LENGTH);
  +    m_functions[FUNC_DOCLOCATION] = new FuncLoader("FuncDoclocation",
  +            FUNC_DOCLOCATION);
  +    m_functions[FUNC_UNPARSED_ENTITY_URI] =
  +      new FuncLoader("FuncUnparsedEntityURI", FUNC_UNPARSED_ENTITY_URI);
     }
  -  
  -  public static Function getFunction(int which) 
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method getFunction 
  +   *
  +   *
  +   * NEEDSDOC @param which
  +   *
  +   * NEEDSDOC (getFunction) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public static Function getFunction(int which)
  +          throws org.xml.sax.SAXException
     {
       return m_functions[which].getFunction();
     }
  @@ -125,36 +282,42 @@
      * @return the position of the function in the internal index.
      */
     public static int installFunction(String name, Expression func)
  -  {   
  +  {
  +
       int funcIndex;
       Object funcIndexObj = Keywords.m_functions.get(name);
  -    if(null != funcIndexObj)
  +
  +    if (null != funcIndexObj)
       {
  -      funcIndex = ((Integer)funcIndexObj).intValue();
  +      funcIndex = ((Integer) funcIndexObj).intValue();
       }
       else
       {
         funcIndex = m_funcNextFreeIndex;
  +
         m_funcNextFreeIndex++;
  +
         Keywords.m_functions.put(name, new Integer(funcIndex));
       }
  -    FuncLoader loader 
  -      = new FuncLoader(func.getClass().getName(), funcIndex);
  +
  +    FuncLoader loader = new FuncLoader(func.getClass().getName(), funcIndex);
   
       m_functions[funcIndex] = loader;
  +
       return funcIndex;
     }
  -  
  +
     /**
      * Install a built-in function at a specific index.
      * @param name The unqualified name of the function.
      * @param func A Implementation of an XPath Function object.
  +   * NEEDSDOC @param funcIndex
      * @return the position of the function in the internal index.
      */
     public static void installFunction(Expression func, int funcIndex)
     {
  -    FuncLoader loader 
  -      = new FuncLoader(func.getClass().getName(), funcIndex);
  +
  +    FuncLoader loader = new FuncLoader(func.getClass().getName(), funcIndex);
   
       m_functions[funcIndex] = loader;
     }
  
  
  
  1.2       +333 -71   xml-xalan/java/src/org/apache/xpath/compiler/Keywords.java
  
  Index: Keywords.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/Keywords.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Keywords.java	2000/07/05 14:45:35	1.1
  +++ Keywords.java	2000/10/30 18:59:22	1.2
  @@ -1,161 +1,423 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.compiler;
   
   import java.util.Hashtable;
  +
   import org.apache.xalan.utils.StringKey;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Keywords <needs-comment/>
  + */
   public class Keywords
   {
  +
  +  /** NEEDSDOC Field m_keywords          */
     static Hashtable m_keywords = new Hashtable();
  +
  +  /** NEEDSDOC Field m_axisnames          */
     static Hashtable m_axisnames = new Hashtable();
  +
  +  /** NEEDSDOC Field m_functions          */
     static Hashtable m_functions = new Hashtable();
  +
  +  /** NEEDSDOC Field m_nodetypes          */
     static Hashtable m_nodetypes = new Hashtable();
   
  +  /** NEEDSDOC Field FROM_ANCESTORS_STRING          */
     private static final String FROM_ANCESTORS_STRING = "ancestor";
  -  private static final String FROM_ANCESTORS_OR_SELF_STRING = "ancestor-or-self";
  +
  +  /** NEEDSDOC Field FROM_ANCESTORS_OR_SELF_STRING          */
  +  private static final String FROM_ANCESTORS_OR_SELF_STRING =
  +    "ancestor-or-self";
  +
  +  /** NEEDSDOC Field FROM_ATTRIBUTES_STRING          */
     private static final String FROM_ATTRIBUTES_STRING = "attribute";
  +
  +  /** NEEDSDOC Field FROM_CHILDREN_STRING          */
     private static final String FROM_CHILDREN_STRING = "child";
  +
  +  /** NEEDSDOC Field FROM_DESCENDANTS_STRING          */
     private static final String FROM_DESCENDANTS_STRING = "descendant";
  -  private static final String FROM_DESCENDANTS_OR_SELF_STRING = "descendant-or-self";
  +
  +  /** NEEDSDOC Field FROM_DESCENDANTS_OR_SELF_STRING          */
  +  private static final String FROM_DESCENDANTS_OR_SELF_STRING =
  +    "descendant-or-self";
  +
  +  /** NEEDSDOC Field FROM_FOLLOWING_STRING          */
     private static final String FROM_FOLLOWING_STRING = "following";
  -  private static final String FROM_FOLLOWING_SIBLINGS_STRING = "following-sibling";
  +
  +  /** NEEDSDOC Field FROM_FOLLOWING_SIBLINGS_STRING          */
  +  private static final String FROM_FOLLOWING_SIBLINGS_STRING =
  +    "following-sibling";
  +
  +  /** NEEDSDOC Field FROM_PARENT_STRING          */
     private static final String FROM_PARENT_STRING = "parent";
  +
  +  /** NEEDSDOC Field FROM_PRECEDING_STRING          */
     private static final String FROM_PRECEDING_STRING = "preceding";
  -  private static final String FROM_PRECEDING_SIBLINGS_STRING = "preceding-sibling";
  +
  +  /** NEEDSDOC Field FROM_PRECEDING_SIBLINGS_STRING          */
  +  private static final String FROM_PRECEDING_SIBLINGS_STRING =
  +    "preceding-sibling";
  +
  +  /** NEEDSDOC Field FROM_SELF_STRING          */
     private static final String FROM_SELF_STRING = "self";
  +
  +  /** NEEDSDOC Field FROM_NAMESPACE_STRING          */
     private static final String FROM_NAMESPACE_STRING = "namespace";
   
  +  /** NEEDSDOC Field FROM_SELF_ABBREVIATED_STRING          */
     private static final String FROM_SELF_ABBREVIATED_STRING = ".";
  +
  +  /** NEEDSDOC Field NODETYPE_COMMENT_STRING          */
     private static final String NODETYPE_COMMENT_STRING = "comment";
  +
  +  /** NEEDSDOC Field NODETYPE_TEXT_STRING          */
     private static final String NODETYPE_TEXT_STRING = "text";
  +
  +  /** NEEDSDOC Field NODETYPE_PI_STRING          */
     private static final String NODETYPE_PI_STRING = "processing-instruction";
  +
  +  /** NEEDSDOC Field NODETYPE_NODE_STRING          */
     private static final String NODETYPE_NODE_STRING = "node";
  +
  +  /** NEEDSDOC Field FROM_ATTRIBUTE_STRING          */
     private static final String FROM_ATTRIBUTE_STRING = "@";
  +
  +  /** NEEDSDOC Field FROM_DOC_STRING          */
     private static final String FROM_DOC_STRING = "document";
  +
  +  /** NEEDSDOC Field FROM_DOCREF_STRING          */
     private static final String FROM_DOCREF_STRING = "document";
  +
  +  /** NEEDSDOC Field FROM_ID_STRING          */
     private static final String FROM_ID_STRING = "id";
  +
  +  /** NEEDSDOC Field FROM_IDREF_STRING          */
     private static final String FROM_IDREF_STRING = "idref";
  +
  +  /** NEEDSDOC Field NODETYPE_ANYELEMENT_STRING          */
     private static final String NODETYPE_ANYELEMENT_STRING = "*";
  +
  +  /** NEEDSDOC Field FUNC_CURRENT_STRING          */
     private static final String FUNC_CURRENT_STRING = "current";
  +
  +  /** NEEDSDOC Field FUNC_LAST_STRING          */
     private static final String FUNC_LAST_STRING = "last";
  +
  +  /** NEEDSDOC Field FUNC_POSITION_STRING          */
     private static final String FUNC_POSITION_STRING = "position";
  +
  +  /** NEEDSDOC Field FUNC_COUNT_STRING          */
     private static final String FUNC_COUNT_STRING = "count";
  +
  +  /** NEEDSDOC Field FUNC_ID_STRING          */
     static final String FUNC_ID_STRING = "id";
  +
  +  /** NEEDSDOC Field FUNC_IDREF_STRING          */
     private static final String FUNC_IDREF_STRING = "idref";
  +
  +  /** NEEDSDOC Field FUNC_KEY_STRING          */
     static final String FUNC_KEY_STRING = "key";
  +
  +  /** NEEDSDOC Field FUNC_KEYREF_STRING          */
     private static final String FUNC_KEYREF_STRING = "keyref";
  +
  +  /** NEEDSDOC Field FUNC_DOC_STRING          */
     private static final String FUNC_DOC_STRING = "doc";
  +
  +  /** NEEDSDOC Field FUNC_DOCUMENT_STRING          */
     private static final String FUNC_DOCUMENT_STRING = "document";
  +
  +  /** NEEDSDOC Field FUNC_DOCREF_STRING          */
     private static final String FUNC_DOCREF_STRING = "docref";
  +
  +  /** NEEDSDOC Field FUNC_LOCAL_PART_STRING          */
     private static final String FUNC_LOCAL_PART_STRING = "local-name";
  +
  +  /** NEEDSDOC Field FUNC_NAMESPACE_STRING          */
     private static final String FUNC_NAMESPACE_STRING = "namespace-uri";
  +
  +  /** NEEDSDOC Field FUNC_NAME_STRING          */
     private static final String FUNC_NAME_STRING = "name";
  +
  +  /** NEEDSDOC Field FUNC_GENERATE_ID_STRING          */
     private static final String FUNC_GENERATE_ID_STRING = "generate-id";
  +
  +  /** NEEDSDOC Field FUNC_NOT_STRING          */
     private static final String FUNC_NOT_STRING = "not";
  +
  +  /** NEEDSDOC Field FUNC_TRUE_STRING          */
     private static final String FUNC_TRUE_STRING = "true";
  +
  +  /** NEEDSDOC Field FUNC_FALSE_STRING          */
     private static final String FUNC_FALSE_STRING = "false";
  +
  +  /** NEEDSDOC Field FUNC_BOOLEAN_STRING          */
     private static final String FUNC_BOOLEAN_STRING = "boolean";
  +
  +  /** NEEDSDOC Field FUNC_LANG_STRING          */
     private static final String FUNC_LANG_STRING = "lang";
  +
  +  /** NEEDSDOC Field FUNC_NUMBER_STRING          */
     private static final String FUNC_NUMBER_STRING = "number";
  +
  +  /** NEEDSDOC Field FUNC_FLOOR_STRING          */
     private static final String FUNC_FLOOR_STRING = "floor";
  +
  +  /** NEEDSDOC Field FUNC_CEILING_STRING          */
     private static final String FUNC_CEILING_STRING = "ceiling";
  +
  +  /** NEEDSDOC Field FUNC_ROUND_STRING          */
     private static final String FUNC_ROUND_STRING = "round";
  +
  +  /** NEEDSDOC Field FUNC_SUM_STRING          */
     private static final String FUNC_SUM_STRING = "sum";
  +
  +  /** NEEDSDOC Field FUNC_STRING_STRING          */
     private static final String FUNC_STRING_STRING = "string";
  +
  +  /** NEEDSDOC Field FUNC_STARTS_WITH_STRING          */
     private static final String FUNC_STARTS_WITH_STRING = "starts-with";
  +
  +  /** NEEDSDOC Field FUNC_CONTAINS_STRING          */
     private static final String FUNC_CONTAINS_STRING = "contains";
  -  private static final String FUNC_SUBSTRING_BEFORE_STRING = "substring-before";
  +
  +  /** NEEDSDOC Field FUNC_SUBSTRING_BEFORE_STRING          */
  +  private static final String FUNC_SUBSTRING_BEFORE_STRING =
  +    "substring-before";
  +
  +  /** NEEDSDOC Field FUNC_SUBSTRING_AFTER_STRING          */
     private static final String FUNC_SUBSTRING_AFTER_STRING = "substring-after";
  +
  +  /** NEEDSDOC Field FUNC_NORMALIZE_SPACE_STRING          */
     private static final String FUNC_NORMALIZE_SPACE_STRING = "normalize-space";
  +
  +  /** NEEDSDOC Field FUNC_TRANSLATE_STRING          */
     private static final String FUNC_TRANSLATE_STRING = "translate";
  +
  +  /** NEEDSDOC Field FUNC_CONCAT_STRING          */
     private static final String FUNC_CONCAT_STRING = "concat";
  +
     //private static final String FUNC_FORMAT_NUMBER_STRING = "format-number";
  +
  +  /** NEEDSDOC Field FUNC_SYSTEM_PROPERTY_STRING          */
     private static final String FUNC_SYSTEM_PROPERTY_STRING = "system-property";
  -  private static final String FUNC_EXT_FUNCTION_AVAILABLE_STRING = "function-available";
  -  private static final String FUNC_EXT_ELEM_AVAILABLE_STRING = "element-available";
  +
  +  /** NEEDSDOC Field FUNC_EXT_FUNCTION_AVAILABLE_STRING          */
  +  private static final String FUNC_EXT_FUNCTION_AVAILABLE_STRING =
  +    "function-available";
  +
  +  /** NEEDSDOC Field FUNC_EXT_ELEM_AVAILABLE_STRING          */
  +  private static final String FUNC_EXT_ELEM_AVAILABLE_STRING =
  +    "element-available";
  +
  +  /** NEEDSDOC Field FUNC_SUBSTRING_STRING          */
     private static final String FUNC_SUBSTRING_STRING = "substring";
  +
  +  /** NEEDSDOC Field FUNC_STRING_LENGTH_STRING          */
     private static final String FUNC_STRING_LENGTH_STRING = "string-length";
  -  private static final String FUNC_UNPARSED_ENTITY_URI_STRING = "unparsed-entity-uri";
  +
  +  /** NEEDSDOC Field FUNC_UNPARSED_ENTITY_URI_STRING          */
  +  private static final String FUNC_UNPARSED_ENTITY_URI_STRING =
  +    "unparsed-entity-uri";
   
     // Proprietary, built in functions
  +
  +  /** NEEDSDOC Field FUNC_DOCLOCATION_STRING          */
     private static final String FUNC_DOCLOCATION_STRING = "document-location";
   
     static
     {
  -    m_axisnames.put(new StringKey(FROM_ANCESTORS_STRING), new Integer(OpCodes.FROM_ANCESTORS));
  -    m_axisnames.put(new StringKey(FROM_ANCESTORS_OR_SELF_STRING), new Integer(OpCodes.FROM_ANCESTORS_OR_SELF));
  -    m_axisnames.put(new StringKey(FROM_ATTRIBUTES_STRING), new Integer(OpCodes.FROM_ATTRIBUTES));
  -    m_axisnames.put(new StringKey(FROM_CHILDREN_STRING), new Integer(OpCodes.FROM_CHILDREN));
  -    m_axisnames.put(new StringKey(FROM_DESCENDANTS_STRING), new Integer(OpCodes.FROM_DESCENDANTS));
  -    m_axisnames.put(new StringKey(FROM_DESCENDANTS_OR_SELF_STRING), new Integer(OpCodes.FROM_DESCENDANTS_OR_SELF));
  -    m_axisnames.put(new StringKey(FROM_FOLLOWING_STRING), new Integer(OpCodes.FROM_FOLLOWING));
  -    m_axisnames.put(new StringKey(FROM_FOLLOWING_SIBLINGS_STRING), new Integer(OpCodes.FROM_FOLLOWING_SIBLINGS));
  -    m_axisnames.put(new StringKey(FROM_PARENT_STRING), new Integer(OpCodes.FROM_PARENT));
  -    m_axisnames.put(new StringKey(FROM_PRECEDING_STRING), new Integer(OpCodes.FROM_PRECEDING));
  -    m_axisnames.put(new StringKey(FROM_PRECEDING_SIBLINGS_STRING), new Integer(OpCodes.FROM_PRECEDING_SIBLINGS));
  -    m_axisnames.put(new StringKey(FROM_SELF_STRING), new Integer(OpCodes.FROM_SELF));
  -    m_axisnames.put(new StringKey(FROM_NAMESPACE_STRING), new Integer(OpCodes.FROM_NAMESPACE));
  -
  -    m_nodetypes.put(new StringKey(NODETYPE_COMMENT_STRING), new Integer(OpCodes.NODETYPE_COMMENT));
  -    m_nodetypes.put(new StringKey(NODETYPE_TEXT_STRING), new Integer(OpCodes.NODETYPE_TEXT));
  -    m_nodetypes.put(new StringKey(NODETYPE_PI_STRING), new Integer(OpCodes.NODETYPE_PI));
  -    m_nodetypes.put(new StringKey(NODETYPE_NODE_STRING), new Integer(OpCodes.NODETYPE_NODE));
  -    m_nodetypes.put(new StringKey(NODETYPE_ANYELEMENT_STRING), new Integer(OpCodes.NODETYPE_ANYELEMENT));
  +    m_axisnames.put(new StringKey(FROM_ANCESTORS_STRING),
  +                    new Integer(OpCodes.FROM_ANCESTORS));
  +    m_axisnames.put(new StringKey(FROM_ANCESTORS_OR_SELF_STRING),
  +                    new Integer(OpCodes.FROM_ANCESTORS_OR_SELF));
  +    m_axisnames.put(new StringKey(FROM_ATTRIBUTES_STRING),
  +                    new Integer(OpCodes.FROM_ATTRIBUTES));
  +    m_axisnames.put(new StringKey(FROM_CHILDREN_STRING),
  +                    new Integer(OpCodes.FROM_CHILDREN));
  +    m_axisnames.put(new StringKey(FROM_DESCENDANTS_STRING),
  +                    new Integer(OpCodes.FROM_DESCENDANTS));
  +    m_axisnames.put(new StringKey(FROM_DESCENDANTS_OR_SELF_STRING),
  +                    new Integer(OpCodes.FROM_DESCENDANTS_OR_SELF));
  +    m_axisnames.put(new StringKey(FROM_FOLLOWING_STRING),
  +                    new Integer(OpCodes.FROM_FOLLOWING));
  +    m_axisnames.put(new StringKey(FROM_FOLLOWING_SIBLINGS_STRING),
  +                    new Integer(OpCodes.FROM_FOLLOWING_SIBLINGS));
  +    m_axisnames.put(new StringKey(FROM_PARENT_STRING),
  +                    new Integer(OpCodes.FROM_PARENT));
  +    m_axisnames.put(new StringKey(FROM_PRECEDING_STRING),
  +                    new Integer(OpCodes.FROM_PRECEDING));
  +    m_axisnames.put(new StringKey(FROM_PRECEDING_SIBLINGS_STRING),
  +                    new Integer(OpCodes.FROM_PRECEDING_SIBLINGS));
  +    m_axisnames.put(new StringKey(FROM_SELF_STRING),
  +                    new Integer(OpCodes.FROM_SELF));
  +    m_axisnames.put(new StringKey(FROM_NAMESPACE_STRING),
  +                    new Integer(OpCodes.FROM_NAMESPACE));
  +    m_nodetypes.put(new StringKey(NODETYPE_COMMENT_STRING),
  +                    new Integer(OpCodes.NODETYPE_COMMENT));
  +    m_nodetypes.put(new StringKey(NODETYPE_TEXT_STRING),
  +                    new Integer(OpCodes.NODETYPE_TEXT));
  +    m_nodetypes.put(new StringKey(NODETYPE_PI_STRING),
  +                    new Integer(OpCodes.NODETYPE_PI));
  +    m_nodetypes.put(new StringKey(NODETYPE_NODE_STRING),
  +                    new Integer(OpCodes.NODETYPE_NODE));
  +    m_nodetypes.put(new StringKey(NODETYPE_ANYELEMENT_STRING),
  +                    new Integer(OpCodes.NODETYPE_ANYELEMENT));
  +    m_keywords.put(new StringKey(FROM_SELF_ABBREVIATED_STRING),
  +                   new Integer(OpCodes.FROM_SELF));
   
  -    m_keywords.put(new StringKey(FROM_SELF_ABBREVIATED_STRING), new Integer(OpCodes.FROM_SELF));
       // m_keywords.put(new StringKey(FROM_ATTRIBUTE_STRING), new Integer(OpCodes.FROM_ATTRIBUTE));
       // m_keywords.put(new StringKey(FROM_DOC_STRING), new Integer(OpCodes.FROM_DOC));
       // m_keywords.put(new StringKey(FROM_DOCREF_STRING), new Integer(OpCodes.FROM_DOCREF));
       // m_keywords.put(new StringKey(FROM_ID_STRING), new Integer(OpCodes.FROM_ID));
       // m_keywords.put(new StringKey(FROM_IDREF_STRING), new Integer(OpCodes.FROM_IDREF));
  +    m_keywords.put(new StringKey(FUNC_ID_STRING),
  +                   new Integer(FunctionTable.FUNC_ID));
  +    m_keywords.put(new StringKey(FUNC_KEY_STRING),
  +                   new Integer(FunctionTable.FUNC_KEY));
   
  -    m_keywords.put(new StringKey(FUNC_ID_STRING), new Integer(FunctionTable.FUNC_ID));
  -    m_keywords.put(new StringKey(FUNC_KEY_STRING), new Integer(FunctionTable.FUNC_KEY));
       // m_keywords.put(new StringKey(FUNC_DOCUMENT_STRING), new Integer(FunctionTable.FUNC_DOC));
  +    m_functions.put(new StringKey(FUNC_CURRENT_STRING),
  +                    new Integer(FunctionTable.FUNC_CURRENT));
  +    m_functions.put(new StringKey(FUNC_LAST_STRING),
  +                    new Integer(FunctionTable.FUNC_LAST));
  +    m_functions.put(new StringKey(FUNC_POSITION_STRING),
  +                    new Integer(FunctionTable.FUNC_POSITION));
  +    m_functions.put(new StringKey(FUNC_COUNT_STRING),
  +                    new Integer(FunctionTable.FUNC_COUNT));
  +    m_functions.put(new StringKey(FUNC_ID_STRING),
  +                    new Integer(FunctionTable.FUNC_ID));
  +    m_functions.put(new StringKey(FUNC_KEY_STRING),
  +                    new Integer(FunctionTable.FUNC_KEY));
   
  -    m_functions.put(new StringKey(FUNC_CURRENT_STRING), new Integer(FunctionTable.FUNC_CURRENT));
  -    m_functions.put(new StringKey(FUNC_LAST_STRING), new Integer(FunctionTable.FUNC_LAST));
  -    m_functions.put(new StringKey(FUNC_POSITION_STRING), new Integer(FunctionTable.FUNC_POSITION));
  -    m_functions.put(new StringKey(FUNC_COUNT_STRING), new Integer(FunctionTable.FUNC_COUNT));
  -    m_functions.put(new StringKey(FUNC_ID_STRING), new Integer(FunctionTable.FUNC_ID));
  -    m_functions.put(new StringKey(FUNC_KEY_STRING), new Integer(FunctionTable.FUNC_KEY));
       // m_functions.put(new StringKey(FUNC_DOCUMENT_STRING), new Integer(FunctionTable.FUNC_DOC));
  -    m_functions.put(new StringKey(FUNC_LOCAL_PART_STRING), new Integer(FunctionTable.FUNC_LOCAL_PART));
  -    m_functions.put(new StringKey(FUNC_NAMESPACE_STRING), new Integer(FunctionTable.FUNC_NAMESPACE));
  -    m_functions.put(new StringKey(FUNC_NAME_STRING), new Integer(FunctionTable.FUNC_QNAME));
  -    m_functions.put(new StringKey(FUNC_GENERATE_ID_STRING), new Integer(FunctionTable.FUNC_GENERATE_ID));
  -    m_functions.put(new StringKey(FUNC_NOT_STRING), new Integer(FunctionTable.FUNC_NOT));
  -    m_functions.put(new StringKey(FUNC_TRUE_STRING), new Integer(FunctionTable.FUNC_TRUE));
  -    m_functions.put(new StringKey(FUNC_FALSE_STRING), new Integer(FunctionTable.FUNC_FALSE));
  -    m_functions.put(new StringKey(FUNC_BOOLEAN_STRING), new Integer(FunctionTable.FUNC_BOOLEAN));
  -    m_functions.put(new StringKey(FUNC_LANG_STRING), new Integer(FunctionTable.FUNC_LANG));
  -    m_functions.put(new StringKey(FUNC_NUMBER_STRING), new Integer(FunctionTable.FUNC_NUMBER));
  -    m_functions.put(new StringKey(FUNC_FLOOR_STRING), new Integer(FunctionTable.FUNC_FLOOR));
  -    m_functions.put(new StringKey(FUNC_CEILING_STRING), new Integer(FunctionTable.FUNC_CEILING));
  -    m_functions.put(new StringKey(FUNC_ROUND_STRING), new Integer(FunctionTable.FUNC_ROUND));
  -    m_functions.put(new StringKey(FUNC_SUM_STRING), new Integer(FunctionTable.FUNC_SUM));
  -    m_functions.put(new StringKey(FUNC_STRING_STRING), new Integer(FunctionTable.FUNC_STRING));
  -    m_functions.put(new StringKey(FUNC_STARTS_WITH_STRING), new Integer(FunctionTable.FUNC_STARTS_WITH));
  -    m_functions.put(new StringKey(FUNC_CONTAINS_STRING), new Integer(FunctionTable.FUNC_CONTAINS));
  -    m_functions.put(new StringKey(FUNC_SUBSTRING_BEFORE_STRING), new Integer(FunctionTable.FUNC_SUBSTRING_BEFORE));
  -    m_functions.put(new StringKey(FUNC_SUBSTRING_AFTER_STRING), new Integer(FunctionTable.FUNC_SUBSTRING_AFTER));
  -    m_functions.put(new StringKey(FUNC_NORMALIZE_SPACE_STRING), new Integer(FunctionTable.FUNC_NORMALIZE_SPACE));
  -    m_functions.put(new StringKey(FUNC_TRANSLATE_STRING), new Integer(FunctionTable.FUNC_TRANSLATE));
  -    m_functions.put(new StringKey(FUNC_CONCAT_STRING), new Integer(FunctionTable.FUNC_CONCAT));
  +    m_functions.put(new StringKey(FUNC_LOCAL_PART_STRING),
  +                    new Integer(FunctionTable.FUNC_LOCAL_PART));
  +    m_functions.put(new StringKey(FUNC_NAMESPACE_STRING),
  +                    new Integer(FunctionTable.FUNC_NAMESPACE));
  +    m_functions.put(new StringKey(FUNC_NAME_STRING),
  +                    new Integer(FunctionTable.FUNC_QNAME));
  +    m_functions.put(new StringKey(FUNC_GENERATE_ID_STRING),
  +                    new Integer(FunctionTable.FUNC_GENERATE_ID));
  +    m_functions.put(new StringKey(FUNC_NOT_STRING),
  +                    new Integer(FunctionTable.FUNC_NOT));
  +    m_functions.put(new StringKey(FUNC_TRUE_STRING),
  +                    new Integer(FunctionTable.FUNC_TRUE));
  +    m_functions.put(new StringKey(FUNC_FALSE_STRING),
  +                    new Integer(FunctionTable.FUNC_FALSE));
  +    m_functions.put(new StringKey(FUNC_BOOLEAN_STRING),
  +                    new Integer(FunctionTable.FUNC_BOOLEAN));
  +    m_functions.put(new StringKey(FUNC_LANG_STRING),
  +                    new Integer(FunctionTable.FUNC_LANG));
  +    m_functions.put(new StringKey(FUNC_NUMBER_STRING),
  +                    new Integer(FunctionTable.FUNC_NUMBER));
  +    m_functions.put(new StringKey(FUNC_FLOOR_STRING),
  +                    new Integer(FunctionTable.FUNC_FLOOR));
  +    m_functions.put(new StringKey(FUNC_CEILING_STRING),
  +                    new Integer(FunctionTable.FUNC_CEILING));
  +    m_functions.put(new StringKey(FUNC_ROUND_STRING),
  +                    new Integer(FunctionTable.FUNC_ROUND));
  +    m_functions.put(new StringKey(FUNC_SUM_STRING),
  +                    new Integer(FunctionTable.FUNC_SUM));
  +    m_functions.put(new StringKey(FUNC_STRING_STRING),
  +                    new Integer(FunctionTable.FUNC_STRING));
  +    m_functions.put(new StringKey(FUNC_STARTS_WITH_STRING),
  +                    new Integer(FunctionTable.FUNC_STARTS_WITH));
  +    m_functions.put(new StringKey(FUNC_CONTAINS_STRING),
  +                    new Integer(FunctionTable.FUNC_CONTAINS));
  +    m_functions.put(new StringKey(FUNC_SUBSTRING_BEFORE_STRING),
  +                    new Integer(FunctionTable.FUNC_SUBSTRING_BEFORE));
  +    m_functions.put(new StringKey(FUNC_SUBSTRING_AFTER_STRING),
  +                    new Integer(FunctionTable.FUNC_SUBSTRING_AFTER));
  +    m_functions.put(new StringKey(FUNC_NORMALIZE_SPACE_STRING),
  +                    new Integer(FunctionTable.FUNC_NORMALIZE_SPACE));
  +    m_functions.put(new StringKey(FUNC_TRANSLATE_STRING),
  +                    new Integer(FunctionTable.FUNC_TRANSLATE));
  +    m_functions.put(new StringKey(FUNC_CONCAT_STRING),
  +                    new Integer(FunctionTable.FUNC_CONCAT));
  +
       //m_functions.put(new StringKey(FUNC_FORMAT_NUMBER_STRING), new Integer(FunctionTable.FUNC_FORMAT_NUMBER));
  -    m_functions.put(new StringKey(FUNC_SYSTEM_PROPERTY_STRING), new Integer(FunctionTable.FUNC_SYSTEM_PROPERTY));
  -    m_functions.put(new StringKey(FUNC_EXT_FUNCTION_AVAILABLE_STRING), new Integer(FunctionTable.FUNC_EXT_FUNCTION_AVAILABLE));
  -    m_functions.put(new StringKey(FUNC_EXT_ELEM_AVAILABLE_STRING), new Integer(FunctionTable.FUNC_EXT_ELEM_AVAILABLE));
  -    m_functions.put(new StringKey(FUNC_SUBSTRING_STRING), new Integer(FunctionTable.FUNC_SUBSTRING));
  -    m_functions.put(new StringKey(FUNC_STRING_LENGTH_STRING), new Integer(FunctionTable.FUNC_STRING_LENGTH));
  -    m_functions.put(new StringKey(FUNC_UNPARSED_ENTITY_URI_STRING), new Integer(FunctionTable.FUNC_UNPARSED_ENTITY_URI));
  +    m_functions.put(new StringKey(FUNC_SYSTEM_PROPERTY_STRING),
  +                    new Integer(FunctionTable.FUNC_SYSTEM_PROPERTY));
  +    m_functions.put(new StringKey(FUNC_EXT_FUNCTION_AVAILABLE_STRING),
  +                    new Integer(FunctionTable.FUNC_EXT_FUNCTION_AVAILABLE));
  +    m_functions.put(new StringKey(FUNC_EXT_ELEM_AVAILABLE_STRING),
  +                    new Integer(FunctionTable.FUNC_EXT_ELEM_AVAILABLE));
  +    m_functions.put(new StringKey(FUNC_SUBSTRING_STRING),
  +                    new Integer(FunctionTable.FUNC_SUBSTRING));
  +    m_functions.put(new StringKey(FUNC_STRING_LENGTH_STRING),
  +                    new Integer(FunctionTable.FUNC_STRING_LENGTH));
  +    m_functions.put(new StringKey(FUNC_UNPARSED_ENTITY_URI_STRING),
  +                    new Integer(FunctionTable.FUNC_UNPARSED_ENTITY_URI));
   
       // These aren't really functions.
  -    m_functions.put(new StringKey(NODETYPE_COMMENT_STRING), new Integer(OpCodes.NODETYPE_COMMENT));
  -    m_functions.put(new StringKey(NODETYPE_TEXT_STRING), new Integer(OpCodes.NODETYPE_TEXT));
  -    m_functions.put(new StringKey(NODETYPE_PI_STRING), new Integer(OpCodes.NODETYPE_PI));
  -    m_functions.put(new StringKey(NODETYPE_NODE_STRING), new Integer(OpCodes.NODETYPE_NODE));
  -
  -    m_functions.put(new StringKey(FUNC_DOCLOCATION_STRING), new Integer(FunctionTable.FUNC_DOCLOCATION));
  +    m_functions.put(new StringKey(NODETYPE_COMMENT_STRING),
  +                    new Integer(OpCodes.NODETYPE_COMMENT));
  +    m_functions.put(new StringKey(NODETYPE_TEXT_STRING),
  +                    new Integer(OpCodes.NODETYPE_TEXT));
  +    m_functions.put(new StringKey(NODETYPE_PI_STRING),
  +                    new Integer(OpCodes.NODETYPE_PI));
  +    m_functions.put(new StringKey(NODETYPE_NODE_STRING),
  +                    new Integer(OpCodes.NODETYPE_NODE));
  +    m_functions.put(new StringKey(FUNC_DOCLOCATION_STRING),
  +                    new Integer(FunctionTable.FUNC_DOCLOCATION));
     }
  -
   }
  
  
  
  1.2       +265 -163  xml-xalan/java/src/org/apache/xpath/compiler/Lexer.java
  
  Index: Lexer.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/Lexer.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Lexer.java	2000/07/05 14:45:36	1.1
  +++ Lexer.java	2000/10/30 18:59:22	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,7 +57,9 @@
   package org.apache.xpath.compiler;
   
   import org.apache.xalan.utils.PrefixResolver;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xpath.XPath;
   import org.apache.xpath.compiler.Compiler;
  @@ -65,54 +67,60 @@
   import org.apache.xpath.compiler.XPathParser;
   
   /**
  - * This class is in charge of lexical processing of the XPath 
  + * This class is in charge of lexical processing of the XPath
    * expression into tokens.
    */
   class Lexer
   {
  +
     /**
      * The target XPath.
      */
     private Compiler m_compiler;
  -  
  +
     /**
      * The prefix resolver to map prefixes to namespaces in the XPath.
      */
     PrefixResolver m_namespaceContext;
  -  
  +
     /**
      * The XPath processor object.
      */
     XPathParser m_processor;
  -  
  +
     /**
      * This value is added to each element name in the TARGETEXTRA
      * that is a 'target' (right-most top-level element name).
      */
     static final int TARGETEXTRA = 10000;
  -  
  +
     /**
      * Ignore this, it is going away.
      * This holds a map to the m_tokenQueue that tells where the top-level elements are.
      * It is used for pattern matching so the m_tokenQueue can be walked backwards.
  -   * Each element that is a 'target', (right-most top level element name) has 
  +   * Each element that is a 'target', (right-most top level element name) has
      * TARGETEXTRA added to it.
  -   * 
  +   *
      */
     private int m_patternMap[] = new int[100];
  -  
  +
     /**
      * Ignore this, it is going away.
      * The number of elements that m_patternMap maps;
      */
     private int m_patternMapSize;
   
  -
     /**
      * Create a Lexer object.
  +   *
  +   * NEEDSDOC @param compiler
  +   * NEEDSDOC @param resolver
  +   * NEEDSDOC @param xpathProcessor
      */
  -  Lexer(Compiler compiler, PrefixResolver resolver, XPathParser xpathProcessor)
  +  Lexer(Compiler compiler, PrefixResolver resolver,
  +        XPathParser xpathProcessor)
     {
  +
       m_compiler = compiler;
       m_namespaceContext = resolver;
       m_processor = xpathProcessor;
  @@ -122,9 +130,10 @@
      * Walk through the expression and build a token queue, and a map of the top-level
      * elements.
      * @param pat XSLT Expression.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  void tokenize(String pat)
  -    throws org.xml.sax.SAXException
  +  void tokenize(String pat) throws org.xml.sax.SAXException
     {
       tokenize(pat, null);
     }
  @@ -134,14 +143,18 @@
      * elements.
      * @param pat XSLT Expression.
      * @param targetStrings Vector to hold Strings, may be null.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     void tokenize(String pat, Vector targetStrings)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       m_compiler.m_tokenQueueSize = 0;
       m_compiler.m_currentPattern = pat;
       m_patternMapSize = 0;
  -    m_compiler.m_opMap = new int[OpMap.MAXTOKENQUEUESIZE*5];
  +    m_compiler.m_opMap = new int[OpMap.MAXTOKENQUEUESIZE * 5];
  +
       int nChars = pat.length();
       int startSubstring = -1;
       int posOfNSSep = -1;
  @@ -154,48 +167,55 @@
       int nesting = 0;
   
       // char[] chars = pat.toCharArray();
  -    for(int i = 0; i < nChars; i++)
  +    for (int i = 0; i < nChars; i++)
       {
         char c = pat.charAt(i);
  -      switch(c)
  +
  +      switch (c)
         {
  -      case '\"':
  +      case '\"' :
  +      {
  +        if (startSubstring != -1)
           {
  -          if(startSubstring != -1)
  -          {
  -            isNum = false;
  -            isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
  -            isAttrName = false;
  -            if(-1 != posOfNSSep)
  -            {
  -              posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
  -            }
  -            else
  -            {
  -              addToTokenQueue(pat.substring(startSubstring, i));
  -            }
  -          }
  -          startSubstring = i;
  -          for(i++; (i < nChars) && ((c = pat.charAt(i)) != '\"'); i++);
  -          if(c == '\"')
  +          isNum = false;
  +          isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
  +          isAttrName = false;
  +
  +          if (-1 != posOfNSSep)
             {
  -            addToTokenQueue(pat.substring(startSubstring, i+1));
  -            startSubstring = -1;
  +            posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
             }
             else
             {
  -            m_processor.error(XPATHErrorResources.ER_EXPECTED_DOUBLE_QUOTE, null); //"misquoted literal... expected double quote!");
  +            addToTokenQueue(pat.substring(startSubstring, i));
             }
           }
  -        break;
  +
  +        startSubstring = i;
  +
  +        for (i++; (i < nChars) && ((c = pat.charAt(i)) != '\"'); i++);
   
  -      case '\'':
  -        if(startSubstring != -1)
  +        if (c == '\"')
  +        {
  +          addToTokenQueue(pat.substring(startSubstring, i + 1));
  +
  +          startSubstring = -1;
  +        }
  +        else
           {
  +          m_processor.error(XPATHErrorResources.ER_EXPECTED_DOUBLE_QUOTE,
  +                            null);  //"misquoted literal... expected double quote!");
  +        }
  +      }
  +      break;
  +      case '\'' :
  +        if (startSubstring != -1)
  +        {
             isNum = false;
             isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
             isAttrName = false;
  -          if(-1 != posOfNSSep)
  +
  +          if (-1 != posOfNSSep)
             {
               posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
             }
  @@ -204,29 +224,34 @@
               addToTokenQueue(pat.substring(startSubstring, i));
             }
           }
  +
           startSubstring = i;
  -        for(i++; (i < nChars) && ((c = pat.charAt(i)) != '\''); i++);
  -        if(c == '\'')
  +
  +        for (i++; (i < nChars) && ((c = pat.charAt(i)) != '\''); i++);
  +
  +        if (c == '\'')
           {
  -          addToTokenQueue(pat.substring(startSubstring, i+1));
  +          addToTokenQueue(pat.substring(startSubstring, i + 1));
  +
             startSubstring = -1;
           }
           else
           {
  -          m_processor.error(XPATHErrorResources.ER_EXPECTED_SINGLE_QUOTE, null); //"misquoted literal... expected single quote!");
  +          m_processor.error(XPATHErrorResources.ER_EXPECTED_SINGLE_QUOTE,
  +                            null);  //"misquoted literal... expected single quote!");
           }
           break;
  -
  -      case 0x0A:
  -      case 0x0D:
  -      case ' ':
  -      case '\t':
  -        if(startSubstring != -1)
  +      case 0x0A :
  +      case 0x0D :
  +      case ' ' :
  +      case '\t' :
  +        if (startSubstring != -1)
           {
             isNum = false;
             isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
             isAttrName = false;
  -          if(-1 != posOfNSSep)
  +
  +          if (-1 != posOfNSSep)
             {
               posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
             }
  @@ -234,47 +259,49 @@
             {
               addToTokenQueue(pat.substring(startSubstring, i));
             }
  +
             startSubstring = -1;
           }
           break;
  -
  -      case '@':
  +      case '@' :
           isAttrName = true;
  -        // fall-through on purpose
   
  -      case '-':
  -        if('-' == c)
  +      // fall-through on purpose
  +      case '-' :
  +        if ('-' == c)
           {
  -          if(!(isNum || (startSubstring == -1)))
  +          if (!(isNum || (startSubstring == -1)))
             {
               break;
             }
  +
             isNum = false;
           }
  -        // fall-through on purpose
   
  -      case '(':
  -      case '[':
  -      case ')':
  -      case ']':
  -      case '|':
  -      case '/':
  -      case '*':
  -      case '+':
  -      case '=':
  -      case ',':
  -      case '\\': // Unused at the moment
  -      case '^': // Unused at the moment
  -      case '!': // Unused at the moment
  -      case '$':
  -      case '<':
  -      case '>':
  -        if(startSubstring != -1)
  +      // fall-through on purpose
  +      case '(' :
  +      case '[' :
  +      case ')' :
  +      case ']' :
  +      case '|' :
  +      case '/' :
  +      case '*' :
  +      case '+' :
  +      case '=' :
  +      case ',' :
  +      case '\\' :  // Unused at the moment
  +      case '^' :  // Unused at the moment
  +      case '!' :  // Unused at the moment
  +      case '$' :
  +      case '<' :
  +      case '>' :
  +        if (startSubstring != -1)
           {
             isNum = false;
             isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
             isAttrName = false;
  -          if(-1 != posOfNSSep)
  +
  +          if (-1 != posOfNSSep)
             {
               posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, i);
             }
  @@ -282,80 +309,86 @@
             {
               addToTokenQueue(pat.substring(startSubstring, i));
             }
  +
             startSubstring = -1;
           }
  -        else if(('/' == c) && isStartOfPat)
  +        else if (('/' == c) && isStartOfPat)
           {
             isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
           }
  -        else if('*' == c)
  +        else if ('*' == c)
           {
             isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
             isAttrName = false;
           }
   
  -        if(0 == nesting)
  +        if (0 == nesting)
           {
  -          if('|' == c)
  +          if ('|' == c)
             {
  -            if(null != targetStrings)
  +            if (null != targetStrings)
               {
                 recordTokenString(targetStrings);
               }
  +
               isStartOfPat = true;
             }
           }
  -        if((')' == c) || (']' == c))
  +
  +        if ((')' == c) || (']' == c))
           {
             nesting--;
           }
  -        else if(('(' == c) || ('[' == c))
  +        else if (('(' == c) || ('[' == c))
           {
             nesting++;
           }
  -        addToTokenQueue(pat.substring(i, i+1));
   
  -       break;
  +        addToTokenQueue(pat.substring(i, i + 1));
  +        break;
  +      case ':' :
  +        if (posOfNSSep == (i - 1))
  +        {
  +          if (startSubstring != -1)
  +          {
  +            if (startSubstring < (i - 1))
  +              addToTokenQueue(pat.substring(startSubstring, i - 1));
  +          }
  +
  +          isNum = false;
  +          isAttrName = false;
  +          startSubstring = -1;
  +          posOfNSSep = -1;
  +
  +          addToTokenQueue(pat.substring(i - 1, i + 1));
   
  -      case ':':
  -       if(posOfNSSep == (i-1))
  -       {
  -         if(startSubstring != -1)
  -         {
  -           if(startSubstring < (i-1))
  -             addToTokenQueue(pat.substring(startSubstring, i-1));
  -         }
  -         isNum = false;
  -         isAttrName = false;
  -         startSubstring = -1;
  -         posOfNSSep = -1;
  -
  -         addToTokenQueue(pat.substring(i-1, i+1));
  -         break;
  -       }
  -       else
  -       {
  -         posOfNSSep = i;
  -       }
  -        // fall through on purpose
  +          break;
  +        }
  +        else
  +        {
  +          posOfNSSep = i;
  +        }
   
  -      default:
  -        if(-1 == startSubstring)
  +      // fall through on purpose
  +      default :
  +        if (-1 == startSubstring)
           {
             startSubstring = i;
             isNum = Character.isDigit(c);
           }
  -        else if(isNum)
  +        else if (isNum)
           {
             isNum = Character.isDigit(c);
           }
         }
       }
  -    if(startSubstring != -1)
  +
  +    if (startSubstring != -1)
       {
         isNum = false;
         isStartOfPat = mapPatternElemPos(nesting, isStartOfPat, isAttrName);
  -      if(-1 != posOfNSSep)
  +
  +      if (-1 != posOfNSSep)
         {
           posOfNSSep = mapNSTokens(pat, startSubstring, posOfNSSep, nChars);
         }
  @@ -365,14 +398,15 @@
         }
       }
   
  -    if(0 == m_compiler.m_tokenQueueSize)
  +    if (0 == m_compiler.m_tokenQueueSize)
       {
  -      m_processor.error(XPATHErrorResources.ER_EMPTY_EXPRESSION, null); //"Empty expression!");
  +      m_processor.error(XPATHErrorResources.ER_EMPTY_EXPRESSION, null);  //"Empty expression!");
       }
  -    else if(null != targetStrings)
  +    else if (null != targetStrings)
       {
         recordTokenString(targetStrings);
       }
  +
       m_processor.m_queueMark = 0;
     }
   
  @@ -380,32 +414,50 @@
      * Record the current position on the token queue as long as
      * this is a top-level element.  Must be called before the
      * next token is added to the m_tokenQueue.
  +   *
  +   * NEEDSDOC @param nesting
  +   * NEEDSDOC @param isStart
  +   * NEEDSDOC @param isAttrName
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private boolean mapPatternElemPos(int nesting, boolean isStart, boolean isAttrName)
  +  private boolean mapPatternElemPos(int nesting, boolean isStart,
  +                                    boolean isAttrName)
     {
  -    if(0 == nesting)
  +
  +    if (0 == nesting)
       {
  -      if(!isStart)
  +      if (!isStart)
         {
  -        m_patternMap[m_patternMapSize-1] -= TARGETEXTRA;
  +        m_patternMap[m_patternMapSize - 1] -= TARGETEXTRA;
         }
  -      m_patternMap[m_patternMapSize]
  -        = (m_compiler.m_tokenQueueSize - (isAttrName ? 1 : 0)) + TARGETEXTRA;
  +
  +      m_patternMap[m_patternMapSize] =
  +        (m_compiler.m_tokenQueueSize - (isAttrName ? 1 : 0)) + TARGETEXTRA;
  +
         m_patternMapSize++;
  +
         isStart = false;
       }
  +
       return isStart;
     }
  -  
  +
     /**
      * Given a map pos, return the corresponding token queue pos.
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     private int getTokenQueuePosFromMap(int i)
     {
  +
       int pos = m_patternMap[i];
  +
       return (pos >= TARGETEXTRA) ? (pos - TARGETEXTRA) : pos;
     }
  -  
  +
     /**
      * Reset token queue mark and m_token to a
      * given position.
  @@ -413,11 +465,16 @@
      */
     private final void resetTokenMark(int mark)
     {
  +
       int qsz = m_compiler.m_tokenQueueSize;
  -    m_processor.m_queueMark = (mark > 0) ? ((mark <= qsz) ? mark -1 : mark) : 0;
  -    if( m_processor.m_queueMark < qsz )
  +
  +    m_processor.m_queueMark = (mark > 0)
  +                              ? ((mark <= qsz) ? mark - 1 : mark) : 0;
  +
  +    if (m_processor.m_queueMark < qsz)
       {
  -      m_processor.m_token = (String)m_compiler.m_tokenQueue[m_processor.m_queueMark++];
  +      m_processor.m_token =
  +        (String) m_compiler.m_tokenQueue[m_processor.m_queueMark++];
         m_processor.m_tokenChar = m_processor.m_token.charAt(0);
       }
       else
  @@ -426,118 +483,158 @@
         m_processor.m_tokenChar = 0;
       }
     }
  -  
  +
     /**
      * Given a string, return the corresponding keyword token.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     final int getKeywordToken(String key)
     {
  +
       int tok;
  +
       try
       {
  -      Integer itok = (Integer)Keywords.m_keywords.get(key);
  +      Integer itok = (Integer) Keywords.m_keywords.get(key);
  +
         tok = (null != itok) ? itok.intValue() : 0;
       }
  -    catch(NullPointerException npe)
  +    catch (NullPointerException npe)
       {
         tok = 0;
       }
  -    catch(ClassCastException cce)
  +    catch (ClassCastException cce)
       {
         tok = 0;
       }
  +
       return tok;
     }
   
     /**
      * Record the correct token string in the passed vector.
  +   *
  +   * NEEDSDOC @param targetStrings
      */
     private void recordTokenString(Vector targetStrings)
     {
  -    int tokPos = getTokenQueuePosFromMap(m_patternMapSize-1);
  -    resetTokenMark(tokPos+1);
  +
  +    int tokPos = getTokenQueuePosFromMap(m_patternMapSize - 1);
   
  -    if(m_processor.lookahead('(', 1))
  +    resetTokenMark(tokPos + 1);
  +
  +    if (m_processor.lookahead('(', 1))
       {
         int tok = getKeywordToken(m_processor.m_token);
  -      switch(tok)
  +
  +      switch (tok)
         {
  -      case OpCodes.NODETYPE_COMMENT:
  +      case OpCodes.NODETYPE_COMMENT :
           targetStrings.addElement(PsuedoNames.PSEUDONAME_COMMENT);
           break;
  -      case OpCodes.NODETYPE_TEXT:
  +      case OpCodes.NODETYPE_TEXT :
           targetStrings.addElement(PsuedoNames.PSEUDONAME_TEXT);
           break;
  -      case OpCodes.NODETYPE_NODE:
  +      case OpCodes.NODETYPE_NODE :
           targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
           break;
  -      case OpCodes.NODETYPE_ROOT:
  +      case OpCodes.NODETYPE_ROOT :
           targetStrings.addElement(PsuedoNames.PSEUDONAME_ROOT);
           break;
  -      case OpCodes.NODETYPE_ANYELEMENT:
  +      case OpCodes.NODETYPE_ANYELEMENT :
           targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
           break;
  -      case OpCodes.NODETYPE_PI:
  +      case OpCodes.NODETYPE_PI :
           targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
           break;
  -      default:
  +      default :
           targetStrings.addElement(PsuedoNames.PSEUDONAME_ANY);
         }
       }
       else
       {
  -      if(m_processor.tokenIs('@'))
  +      if (m_processor.tokenIs('@'))
         {
           tokPos++;
  -        resetTokenMark(tokPos+1);
  +
  +        resetTokenMark(tokPos + 1);
         }
  -      if(m_processor.lookahead(':', 1))
  +
  +      if (m_processor.lookahead(':', 1))
         {
           tokPos += 2;
         }
  +
         targetStrings.addElement(m_compiler.m_tokenQueue[tokPos]);
       }
     }
   
  +  /**
  +   * NEEDSDOC Method addToTokenQueue 
  +   *
  +   *
  +   * NEEDSDOC @param s
  +   */
     private final void addToTokenQueue(String s)
     {
       m_compiler.m_tokenQueue[m_compiler.m_tokenQueueSize++] = s;
     }
  -  
  +
     /**
      * When a seperator token is found, see if there's a element name or
      * the like to map.
  +   *
  +   * NEEDSDOC @param pat
  +   * NEEDSDOC @param startSubstring
  +   * NEEDSDOC @param posOfNSSep
  +   * NEEDSDOC @param posOfScan
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private int mapNSTokens(String pat, int startSubstring, int posOfNSSep, int posOfScan)
  +  private int mapNSTokens(String pat, int startSubstring, int posOfNSSep,
  +                          int posOfScan)
     {
  +
       String prefix = pat.substring(startSubstring, posOfNSSep);
       String uName;
  -    if((null != m_namespaceContext) && !prefix.equals("*") && !prefix.equals("xmlns"))
  +
  +    if ((null != m_namespaceContext) &&!prefix.equals("*")
  +            &&!prefix.equals("xmlns"))
       {
         try
         {
  -        if(prefix.length() > 0)
  -          uName = ((PrefixResolver)m_namespaceContext).getNamespaceForPrefix(prefix);
  +        if (prefix.length() > 0)
  +          uName = ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(
  +            prefix);
           else
           {
  +
             // Assume last was wildcard. This is not legal according
             // to the draft. Set the below to true to make namespace
             // wildcards work.
  -          if(false)
  +          if (false)
             {
               addToTokenQueue(":");
  -            String s = pat.substring(posOfNSSep+1, posOfScan);
  -            if(s.length() > 0)
  +
  +            String s = pat.substring(posOfNSSep + 1, posOfScan);
  +
  +            if (s.length() > 0)
                 addToTokenQueue(s);
  +
               return -1;
             }
             else
             {
  -            uName = ((PrefixResolver)m_namespaceContext).getNamespaceForPrefix(prefix);
  +            uName =
  +              ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(
  +                prefix);
             }
           }
         }
  -      catch(ClassCastException cce)
  +      catch (ClassCastException cce)
         {
           uName = m_namespaceContext.getNamespaceForPrefix(prefix);
         }
  @@ -546,25 +643,30 @@
       {
         uName = prefix;
       }
  -    if((null != uName) && (uName.length() > 0))
  +
  +    if ((null != uName) && (uName.length() > 0))
       {
         addToTokenQueue(uName);
         addToTokenQueue(":");
  -      String s = pat.substring(posOfNSSep+1, posOfScan);
  -      if(s.length() > 0)
  +
  +      String s = pat.substring(posOfNSSep + 1, posOfScan);
  +
  +      if (s.length() > 0)
           addToTokenQueue(s);
       }
       else
       {
  +
         // error("Could not locate namespace for prefix: "+prefix);
         addToTokenQueue(prefix);
         addToTokenQueue(":");
  -      String s = pat.substring(posOfNSSep+1, posOfScan);
  -      if(s.length() > 0)
  +
  +      String s = pat.substring(posOfNSSep + 1, posOfScan);
  +
  +      if (s.length() > 0)
           addToTokenQueue(s);
       }
  +
       return -1;
     }
  -
  -
   }
  
  
  
  1.4       +158 -131  xml-xalan/java/src/org/apache/xpath/compiler/OpCodes.java
  
  Index: OpCodes.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/OpCodes.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- OpCodes.java	2000/09/12 19:17:32	1.3
  +++ OpCodes.java	2000/10/30 18:59:23	1.4
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -66,7 +66,7 @@
    *       including the operations code and the length integer.)
    * {UPPER CASE} indicates the given production,
    * {description} is the description of a new production,
  - *      (For instance, {boolean expression} means some expression 
  + *      (For instance, {boolean expression} means some expression
    *       that should be resolved to a boolean.)
    *  * means that it occurs zero or more times,
    *  + means that it occurs one or more times,
  @@ -83,7 +83,7 @@
      * Some operators may like to have a terminator.
      */
     public static final int ENDOP = -1;
  -  
  +
     /**
      * [EMPTY]
      * Empty slot to indicate NULL.
  @@ -93,7 +93,7 @@
     /**
      * <meta name="usage" content="advanced"/>
      * [ELEMWILDCARD]
  -   * Means ELEMWILDCARD ("*"), used instead 
  +   * Means ELEMWILDCARD ("*"), used instead
      * of string index in some places.
      */
     public static final int ELEMWILDCARD = -3;
  @@ -103,8 +103,8 @@
      * [OP_XPATH]
      * [length]
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNodeSet
      *  XNumber
      *  XString
  @@ -113,39 +113,39 @@
      *  XObject
      */
     public static final int OP_XPATH = 1;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_OR]
      * [length]
      *  {boolean expression}
      *  {boolean expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_OR = 2;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_AND]
      * [length]
      *  {boolean expression}
      *  {boolean expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_AND = 3;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_NOTEQUALS]
      * [length]
      *  {expression}
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_NOTEQUALS = 4;
  @@ -156,8 +156,8 @@
      * [length]
      *  {expression}
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_EQUALS = 5;
  @@ -168,8 +168,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_LTE = 6;
  @@ -180,8 +180,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_LT = 7;
  @@ -192,8 +192,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_GTE = 8;
  @@ -204,8 +204,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_GT = 9;
  @@ -216,8 +216,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNumber
      */
     public static final int OP_PLUS = 10;
  @@ -228,8 +228,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNumber
      */
     public static final int OP_MINUS = 11;
  @@ -240,8 +240,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNumber
      */
     public static final int OP_MULT = 12;
  @@ -252,8 +252,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNumber
      */
     public static final int OP_DIV = 13;
  @@ -264,8 +264,8 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNumber
      */
     public static final int OP_MOD = 14;
  @@ -276,54 +276,52 @@
      * [length]
      *  {number expression}
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNumber
      */
     public static final int OP_QUO = 15;
   
  -
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_NEG]
      * [length]
      *  {number expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNumber
      */
     public static final int OP_NEG = 16;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_STRING] (cast operation)
      * [length]
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XString
      */
     public static final int OP_STRING = 17;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_BOOL] (cast operation)
      * [length]
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_BOOL = 18;
   
  -
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_NUMBER] (cast operation)
      * [length]
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int OP_NUMBER = 19;
  @@ -333,43 +331,44 @@
      * [OP_UNION]
      * [length]
      *  {PathExpr}+
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNodeSet
      */
     public static final int OP_UNION = 20;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_LITERAL]
      * [3]
      * [index to token]
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XString
      */
     public static final int OP_LITERAL = 21;
  -  
  +
  +  /** NEEDSDOC Field FIRST_NODESET_OP          */
     static final int FIRST_NODESET_OP = 22;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_VARIABLE]
      * [3]
      * [index to token]
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XString
      */
     public static final int OP_VARIABLE = 22;
  -    
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_GROUP]
      * [length]
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNodeSet
      *  XNumber
      *  XString
  @@ -385,9 +384,9 @@
      * [length]
      * [index to namespace token]
      * [index to function name token]
  -   *  {OP_ARGUMENT}*
  -   * 
  -   * returns: 
  +   *  {OP_ARGUMENT}
  +   *
  +   * returns:
      *  XNodeSet
      *  XNumber
      *  XString
  @@ -396,16 +395,16 @@
      *  XObject
      */
     public static final int OP_EXTFUNCTION = 24;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_FUNCTION]
      * [length]
      * [FUNC_name]
  -   *  {OP_ARGUMENT}*
  +   *  {OP_ARGUMENT}
      * [ENDOP]
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNodeSet
      *  XNumber
      *  XString
  @@ -414,7 +413,8 @@
      *  XObject
      */
     public static final int OP_FUNCTION = 25;
  -  
  +
  +  /** NEEDSDOC Field LAST_NODESET_OP          */
     static final int LAST_NODESET_OP = 25;
   
     /**
  @@ -422,8 +422,8 @@
      * [OP_ARGUMENT] (Function argument.)
      * [length]
      *  {expression}
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNodeSet
      *  XNumber
      *  XString
  @@ -438,32 +438,32 @@
      * [OP_NUMBERLIT] (Number literal.)
      * [3]
      * [index to token]
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XString
      */
  -  public static final int OP_NUMBERLIT = 27;  
  -    
  +  public static final int OP_NUMBERLIT = 27;
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_LOCATIONPATH]
      * [length]
      *   {FROM_stepType}
      * | {function}
  -   * {predicate}*
  +   * {predicate}
      * [ENDOP]
  -   * 
  -   * (Note that element and attribute namespaces and 
  +   *
  +   * (Note that element and attribute namespaces and
      * names can be wildcarded '*'.)
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNodeSet
      */
     public static final int OP_LOCATIONPATH = 28;
  +
     // public static final int LOCATIONPATHEX_MASK = 0x0000FFFF;
     // public static final int LOCATIONPATHEX_ISSIMPLE = 0x00010000;
     // public static final int OP_LOCATIONPATH_EX = (28 | 0x00010000);
  -    
   
     /**
      * <meta name="usage" content="advanced"/>
  @@ -471,122 +471,120 @@
      * [length]
      *  {expression}
      * [ENDOP] (For safety)
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean or XNumber
      */
     public static final int OP_PREDICATE = 29;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_MATCHPATTERN]
      * [length]
      *  {PathExpr}+
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XNodeSet
      */
     public static final int OP_MATCHPATTERN = 30;
  -  
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [OP_LOCATIONPATHPATTERN]
      * [length]
      *   {FROM_stepType}
  -   * | {function}{predicate}*
  +   * | {function}{predicate}
      * [ENDOP]
  -   * returns: 
  +   * returns:
      *  XNodeSet
      */
     public static final int OP_LOCATIONPATHPATTERN = 31;
   
  -  
     /**
      * <meta name="usage" content="advanced"/>
      * [NODETYPE_COMMENT]
      * No size or arguments.
      * Note: must not overlap function OP number!
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODETYPE_COMMENT = 1030;
  -    
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [NODETYPE_TEXT]
      * No size or arguments.
      * Note: must not overlap function OP number!
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODETYPE_TEXT = 1031;
  -    
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [NODETYPE_PI]
      * [index to token]
      * Note: must not overlap function OP number!
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODETYPE_PI = 1032;
  -    
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [NODETYPE_NODE]
      * No size or arguments.
      * Note: must not overlap function OP number!
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODETYPE_NODE = 1033;
  -    
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [NODENAME]
      * [index to ns token or EMPTY]
      * [index to name token]
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODENAME = 34;
  -    
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [NODETYPE_ROOT]
      * No size or arguments.
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODETYPE_ROOT = 35;
  -    
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [NODETYPE_ANY]
      * No size or arguments.
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODETYPE_ANYELEMENT = 36;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [NODETYPE_ANY]
      * No size or arguments.
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int NODETYPE_FUNCTEST = 1034;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * [FROM_stepType]
  @@ -594,46 +592,75 @@
      * [length of just the step, without the predicates]
      * {node test}
      * {predicates}?
  -   * 
  -   * returns: 
  +   *
  +   * returns:
      *  XBoolean
      */
     public static final int AXES_START_TYPES = 37;
  +
  +  /** NEEDSDOC Field FROM_ANCESTORS          */
     public static final int FROM_ANCESTORS = 37;
  +
  +  /** NEEDSDOC Field FROM_ANCESTORS_OR_SELF          */
     public static final int FROM_ANCESTORS_OR_SELF = 38;
  +
  +  /** NEEDSDOC Field FROM_ATTRIBUTES          */
     public static final int FROM_ATTRIBUTES = 39;
  +
  +  /** NEEDSDOC Field FROM_CHILDREN          */
     public static final int FROM_CHILDREN = 40;
  +
  +  /** NEEDSDOC Field FROM_DESCENDANTS          */
     public static final int FROM_DESCENDANTS = 41;
  +
  +  /** NEEDSDOC Field FROM_DESCENDANTS_OR_SELF          */
     public static final int FROM_DESCENDANTS_OR_SELF = 42;
  +
  +  /** NEEDSDOC Field FROM_FOLLOWING          */
     public static final int FROM_FOLLOWING = 43;
  -  public static final int FROM_FOLLOWING_SIBLINGS = 44; 
  +
  +  /** NEEDSDOC Field FROM_FOLLOWING_SIBLINGS          */
  +  public static final int FROM_FOLLOWING_SIBLINGS = 44;
  +
  +  /** NEEDSDOC Field FROM_PARENT          */
     public static final int FROM_PARENT = 45;
  +
  +  /** NEEDSDOC Field FROM_PRECEDING          */
     public static final int FROM_PRECEDING = 46;
  +
  +  /** NEEDSDOC Field FROM_PRECEDING_SIBLINGS          */
     public static final int FROM_PRECEDING_SIBLINGS = 47;
  +
  +  /** NEEDSDOC Field FROM_SELF          */
     public static final int FROM_SELF = 48;
  -  public static final int FROM_NAMESPACE = 49;  
  -  public static final int FROM_ROOT = 50;  
  -  
  +
  +  /** NEEDSDOC Field FROM_NAMESPACE          */
  +  public static final int FROM_NAMESPACE = 49;
  +
  +  /** NEEDSDOC Field FROM_ROOT          */
  +  public static final int FROM_ROOT = 50;
  +
     /**
      * <meta name="usage" content="advanced"/>
      * For match patterns.
      */
  -  public static final int MATCH_ATTRIBUTE = 51;  
  -  
  +  public static final int MATCH_ATTRIBUTE = 51;
  +
     /**
      * <meta name="usage" content="advanced"/>
      * For match patterns.
      */
  -  public static final int MATCH_ANY_ANCESTOR = 52;  
  -  
  +  public static final int MATCH_ANY_ANCESTOR = 52;
  +
     /**
      * <meta name="usage" content="advanced"/>
      * For match patterns.
      */
  -  public static final int MATCH_IMMEDIATE_ANCESTOR = 53; 
  -  
  +  public static final int MATCH_IMMEDIATE_ANCESTOR = 53;
  +
  +  /** NEEDSDOC Field AXES_END_TYPES          */
     public static final int AXES_END_TYPES = 53;
  - 
  -  private static final int NEXT_FREE_ID = 99;  
  -  
  +
  +  /** NEEDSDOC Field NEXT_FREE_ID          */
  +  private static final int NEXT_FREE_ID = 99;
   }
  
  
  
  1.5       +218 -108  xml-xalan/java/src/org/apache/xpath/compiler/OpMap.java
  
  Index: OpMap.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/OpMap.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- OpMap.java	2000/10/17 19:43:10	1.4
  +++ OpMap.java	2000/10/30 18:59:23	1.5
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -57,48 +57,60 @@
   package org.apache.xpath.compiler;
   
   import java.util.Vector;
  +
   import org.apache.xalan.utils.QName;
   import org.apache.xpath.patterns.NodeTest;
   
   /**
  - * This class represents the data structure basics of the XPath 
  + * This class represents the data structure basics of the XPath
    * object.
    */
   public class OpMap
   {
  +
     /**
      * The current pattern string, for diagnostics purposes
      */
     protected String m_currentPattern;
  -  
  +
  +  /**
  +   * NEEDSDOC Method toString 
  +   *
  +   *
  +   * NEEDSDOC (toString) @return
  +   */
     public String toString()
     {
       return m_currentPattern;
     }
  -  
  +
     /**
      * Get the pattern string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getPatternString()
     {
       return m_currentPattern;
     }
  -  
  +
     /**
      * The max size that the token queue can grow to.
      */
     static final int MAXTOKENQUEUESIZE = 500;
   
     /**
  -   *  TokenStack is the queue of used tokens. The current token is the token at the 
  +   *  TokenStack is the queue of used tokens. The current token is the token at the
      * end of the m_tokenQueue. The idea is that the queue can be marked and a sequence
      * of tokens can be reused.
      */
     public Object[] m_tokenQueue = new Object[MAXTOKENQUEUESIZE];
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * Get the XPath as a list of tokens.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Object[] getTokenQueue()
     {
  @@ -108,6 +120,10 @@
     /**
      * <meta name="usage" content="advanced"/>
      * Get the XPath as a list of tokens.
  +   *
  +   * NEEDSDOC @param pos
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Object getToken(int pos)
     {
  @@ -122,6 +138,8 @@
     /**
      * <meta name="usage" content="advanced"/>
      * Get size of the token queue.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getTokenQueueSize()
     {
  @@ -129,68 +147,81 @@
     }
   
     /**
  -   * An operations map is used instead of a proper parse tree.  It contains 
  +   * An operations map is used instead of a proper parse tree.  It contains
      * operations codes and indexes into the m_tokenQueue.
  -   * I use an array instead of a full parse tree in order to cut down 
  +   * I use an array instead of a full parse tree in order to cut down
      * on the number of objects created.
      */
     public int m_opMap[] = null;
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
  -   * Get the opcode list that describes the XPath operations.  It contains 
  +   * Get the opcode list that describes the XPath operations.  It contains
      * operations codes and indexes into the m_tokenQueue.
  -   * I use an array instead of a full parse tree in order to cut down 
  +   * I use an array instead of a full parse tree in order to cut down
      * on the number of objects created.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int[] getOpMap()
     {
       return m_opMap;
     }
  -  
  +
     // Position indexes
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * The length is always the opcode position + 1.
  -   * Length is always expressed as the opcode+length bytes, 
  +   * Length is always expressed as the opcode+length bytes,
      * so it is always 2 or greater.
      */
     public static final int MAPINDEX_LENGTH = 1;
  -  
  +
     /**
  -   * Replace the large arrays 
  +   * Replace the large arrays
      * with a small array.
      */
     void shrink()
     {
  +
       int map[] = m_opMap;
  -    int n = m_opMap[MAPINDEX_LENGTH];;
  -    m_opMap = new int[n+4];
  +    int n = m_opMap[MAPINDEX_LENGTH];
  +    ;
  +
  +    m_opMap = new int[n + 4];
  +
       int i;
  -    for(i = 0; i < n; i++)
  +
  +    for (i = 0; i < n; i++)
       {
         m_opMap[i] = map[i];
       }
  +
       m_opMap[i] = 0;
  -    m_opMap[i+1] = 0;
  -    m_opMap[i+2] = 0;
  -        
  +    m_opMap[i + 1] = 0;
  +    m_opMap[i + 2] = 0;
  +
       Object[] tokens = m_tokenQueue;
  +
       n = m_tokenQueueSize;
  -    m_tokenQueue = new Object[n+4];
  -    for(i = 0; i < n; i++)
  +    m_tokenQueue = new Object[n + 4];
  +
  +    for (i = 0; i < n; i++)
       {
         m_tokenQueue[i] = tokens[i];
       }
  +
       m_tokenQueue[i] = null;
  -    m_tokenQueue[i+1] = null;
  -    m_tokenQueue[i+2] = null;
  +    m_tokenQueue[i + 1] = null;
  +    m_tokenQueue[i + 2] = null;
     }
   
     /**
      * <meta name="usage" content="advanced"/>
      * Given an operation position, return the current op.
  +   *
  +   * NEEDSDOC @param opPos
      * @return position of next operation in m_opMap.
      */
     public int getOp(int opPos)
  @@ -200,150 +231,197 @@
   
     /**
      * <meta name="usage" content="advanced"/>
  -   * Given an operation position, return the end position, i.e. the 
  +   * Given an operation position, return the end position, i.e. the
      * beginning of the next operation.
  +   *
  +   * NEEDSDOC @param opPos
      * @return position of next operation in m_opMap.
      */
     public int getNextOpPos(int opPos)
     {
  -    return opPos+m_opMap[opPos+1];
  +    return opPos + m_opMap[opPos + 1];
     }
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
  -   * Given an operation position, return the end position, i.e. the 
  +   * Given an operation position, return the end position, i.e. the
      * beginning of the next operation.
  +   *
  +   * NEEDSDOC @param opPos
      * @return position of next operation in m_opMap.
      */
     public int getNextStepPos(int opPos)
     {
  +
       int stepType = getOp(opPos);
  -    if((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES))
  +
  +    if ((stepType >= OpCodes.AXES_START_TYPES)
  +            && (stepType <= OpCodes.AXES_END_TYPES))
       {
         return getNextOpPos(opPos);
       }
  -    else if((stepType >= OpCodes.FIRST_NODESET_OP) && (stepType <= OpCodes.LAST_NODESET_OP))
  +    else if ((stepType >= OpCodes.FIRST_NODESET_OP)
  +             && (stepType <= OpCodes.LAST_NODESET_OP))
       {
         int newOpPos = getNextOpPos(opPos);
  -      
  -      while(OpCodes.OP_PREDICATE == getOp(newOpPos))
  +
  +      while (OpCodes.OP_PREDICATE == getOp(newOpPos))
  +      {
           newOpPos = getNextOpPos(newOpPos);
  +      }
   
         stepType = getOp(newOpPos);
  -      if(!((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES)))
  +
  +      if (!((stepType >= OpCodes.AXES_START_TYPES)
  +            && (stepType <= OpCodes.AXES_END_TYPES)))
         {
           return OpCodes.ENDOP;
         }
  +
         return newOpPos;
       }
       else
       {
  -      throw new RuntimeException("Programmer's assertion in getNextStepPos: unknown stepType: "+stepType);
  +      throw new RuntimeException(
  +        "Programmer's assertion in getNextStepPos: unknown stepType: "
  +        + stepType);
       }
     }
   
  -  
     /**
      * <meta name="usage" content="advanced"/>
  -   * Given an operation position, return the end position, i.e. the 
  +   * Given an operation position, return the end position, i.e. the
      * beginning of the next operation.
  +   *
  +   * NEEDSDOC @param opMap
  +   * NEEDSDOC @param opPos
      * @return position of next operation in m_opMap.
      */
     public static int getNextOpPos(int[] opMap, int opPos)
     {
  -    return opPos+opMap[opPos+1];
  +    return opPos + opMap[opPos + 1];
     }
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
  -   * Given an FROM_stepType position, return the position of the 
  -   * first predicate, if there is one, or else this will point 
  +   * Given an FROM_stepType position, return the position of the
  +   * first predicate, if there is one, or else this will point
      * to the end of the FROM_stepType.
      * Example:
      *  int posOfPredicate = xpath.getNextOpPos(stepPos);
  -   *  boolean hasPredicates = 
  +   *  boolean hasPredicates =
      *            OpCodes.OP_PREDICATE == xpath.getOp(posOfPredicate);
  +   *
  +   * NEEDSDOC @param opPos
      * @return position of predicate in FROM_stepType structure.
      */
     public int getFirstPredicateOpPos(int opPos)
     {
  +
       int stepType = m_opMap[opPos];
  -    if((stepType >= OpCodes.AXES_START_TYPES) && (stepType <= OpCodes.AXES_END_TYPES))
  +
  +    if ((stepType >= OpCodes.AXES_START_TYPES)
  +            && (stepType <= OpCodes.AXES_END_TYPES))
       {
  -      return opPos+m_opMap[opPos+2];
  +      return opPos + m_opMap[opPos + 2];
       }
  -    else if((stepType >= OpCodes.FIRST_NODESET_OP) && (stepType <= OpCodes.LAST_NODESET_OP))
  +    else if ((stepType >= OpCodes.FIRST_NODESET_OP)
  +             && (stepType <= OpCodes.LAST_NODESET_OP))
       {
  -      return opPos+m_opMap[opPos+1];
  +      return opPos + m_opMap[opPos + 1];
       }
       else
       {
  -      throw new RuntimeException("Programmer's assertion in getNextStepPos: unknown stepType: "+stepType);
  +      throw new RuntimeException(
  +        "Programmer's assertion in getNextStepPos: unknown stepType: "
  +        + stepType);
       }
     }
   
  -  
     /**
      * <meta name="usage" content="advanced"/>
      * Go to the first child of a given operation.
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static int getFirstChildPos(int opPos)
     {
  -    return opPos+2;
  +    return opPos + 2;
     }
   
     /**
      * <meta name="usage" content="advanced"/>
      * Go to the first child of a given operation.
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getArgLength(int opPos)
     {
  -    return m_opMap[opPos+MAPINDEX_LENGTH];
  +    return m_opMap[opPos + MAPINDEX_LENGTH];
     }
   
     /**
      * <meta name="usage" content="advanced"/>
      * Go to the first child of a given operation.
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getArgLengthOfStep(int opPos)
     {
  -    return m_opMap[opPos+MAPINDEX_LENGTH+1]-3;
  +    return m_opMap[opPos + MAPINDEX_LENGTH + 1] - 3;
     }
   
     /**
      * <meta name="usage" content="advanced"/>
      * Go to the first child of a given operation.
  +   *
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static int getFirstChildPosOfStep(int opPos)
     {
  -    return opPos+3;
  +    return opPos + 3;
     }
   
     /**
      * <meta name="usage" content="advanced"/>
      * Get the test type of the step, i.e. NODETYPE_XXX value.
  -   * @param opPosOfStep The position of the FROM_XXX step. 
  +   * @param opPosOfStep The position of the FROM_XXX step.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getStepTestType(int opPosOfStep)
     {
  -    return m_opMap[opPosOfStep+3]; // skip past op, len, len without predicates
  +    return m_opMap[opPosOfStep + 3];  // skip past op, len, len without predicates
     }
   
     /**
      * <meta name="usage" content="advanced"/>
      * Get the namespace of the step.
  -   * @param opPosOfStep The position of the FROM_XXX step. 
  +   * @param opPosOfStep The position of the FROM_XXX step.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getStepNS(int opPosOfStep)
     {
  +
       int argLenOfStep = getArgLengthOfStep(opPosOfStep);
  +
       // System.out.println("getStepNS.argLenOfStep: "+argLenOfStep);
  -    if(argLenOfStep == 3)
  +    if (argLenOfStep == 3)
       {
  -      int index = m_opMap[opPosOfStep+4];
  -      if(index >= 0)
  -        return (String)m_tokenQueue[index];
  -      else if(OpCodes.ELEMWILDCARD == index)
  +      int index = m_opMap[opPosOfStep + 4];
  +
  +      if (index >= 0)
  +        return (String) m_tokenQueue[index];
  +      else if (OpCodes.ELEMWILDCARD == index)
           return NodeTest.WILD;
         else
           return null;
  @@ -351,30 +429,46 @@
       else
         return null;
     }
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * Get the local name of the step.
  -   * @param opPosOfStep The position of the FROM_XXX step. 
  +   * @param opPosOfStep The position of the FROM_XXX step.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getStepLocalName(int opPosOfStep)
     {
  +
       int argLenOfStep = getArgLengthOfStep(opPosOfStep);
  +
       // System.out.println("getStepLocalName.argLenOfStep: "+argLenOfStep);
       int index;
  -    switch(argLenOfStep)
  +
  +    switch (argLenOfStep)
       {
  -    case 0: index = OpCodes.EMPTY; break;
  -    case 1: index = OpCodes.ELEMWILDCARD; break;
  -    case 2: index = m_opMap[opPosOfStep+4]; break;
  -    case 3: index = m_opMap[opPosOfStep+5]; break;
  -    default: index = OpCodes.EMPTY; break; // Should assert error
  +    case 0 :
  +      index = OpCodes.EMPTY;
  +      break;
  +    case 1 :
  +      index = OpCodes.ELEMWILDCARD;
  +      break;
  +    case 2 :
  +      index = m_opMap[opPosOfStep + 4];
  +      break;
  +    case 3 :
  +      index = m_opMap[opPosOfStep + 5];
  +      break;
  +    default :
  +      index = OpCodes.EMPTY;
  +      break;  // Should assert error
       }
  +
       // int index = (argLenOfStep == 3) ? m_opMap[opPosOfStep+5] 
       //                                  : ((argLenOfStep == 1) ? -3 : -2);
  -    if(index >= 0)
  -      return (String)m_tokenQueue[index].toString();
  -    else if(OpCodes.ELEMWILDCARD == index)
  +    if (index >= 0)
  +      return (String) m_tokenQueue[index].toString();
  +    else if (OpCodes.ELEMWILDCARD == index)
         return NodeTest.WILD;
       else
         return null;
  @@ -383,73 +477,86 @@
     /**
      * <meta name="usage" content="advanced"/>
      * This method is for building indexes of match patterns for fast lookup.
  -   * This allows a caller to get the QName, and quickly 
  -   * find the likely candidates that may match.  Note that this will 
  +   * This allows a caller to get the QName, and quickly
  +   * find the likely candidates that may match.  Note that this will
      * produce QName objects that aren't strictly legal, like "*".
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Vector getTargetElementQNames()
     {
  -    Vector targetQNames = new Vector();
   
  +    Vector targetQNames = new Vector();
       int opPos = 2;
   
  -    while(m_opMap[opPos] == OpCodes.OP_LOCATIONPATHPATTERN)
  +    while (m_opMap[opPos] == OpCodes.OP_LOCATIONPATHPATTERN)
       {
         int nextOpPos = getNextOpPos(opPos);
  +
         opPos = getFirstChildPos(opPos);
  -      
  -      while( m_opMap[opPos] != OpCodes.ENDOP )
  +
  +      while (m_opMap[opPos] != OpCodes.ENDOP)
         {
           int nextStepPos = getNextOpPos(opPos);
           int nextOp = m_opMap[nextStepPos];
  -        if((nextOp == OpCodes.OP_PREDICATE) || (nextOp == OpCodes.ENDOP))
  +
  +        if ((nextOp == OpCodes.OP_PREDICATE) || (nextOp == OpCodes.ENDOP))
           {
             int stepType = m_opMap[opPos];
  +
             opPos += 3;
  -          switch(stepType)
  +
  +          switch (stepType)
             {
  -          case OpCodes.OP_FUNCTION:
  +          case OpCodes.OP_FUNCTION :
               targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_ANY));
               break;
  -          case OpCodes.FROM_ROOT:
  +          case OpCodes.FROM_ROOT :
               targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_ROOT));
               break;
  -          case OpCodes.MATCH_ATTRIBUTE:
  -          case OpCodes.MATCH_ANY_ANCESTOR:
  -          case OpCodes.MATCH_IMMEDIATE_ANCESTOR:
  +          case OpCodes.MATCH_ATTRIBUTE :
  +          case OpCodes.MATCH_ANY_ANCESTOR :
  +          case OpCodes.MATCH_IMMEDIATE_ANCESTOR :
               int tok = m_opMap[opPos];
  +
               opPos++;
  -            switch(tok)
  +
  +            switch (tok)
               {
  -            case OpCodes.NODETYPE_COMMENT:
  -              targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_COMMENT));
  +            case OpCodes.NODETYPE_COMMENT :
  +              targetQNames.addElement(
  +                new QName(PsuedoNames.PSEUDONAME_COMMENT));
                 break;
  -            case OpCodes.NODETYPE_TEXT:
  +            case OpCodes.NODETYPE_TEXT :
                 targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_TEXT));
                 break;
  -            case OpCodes.NODETYPE_NODE:
  +            case OpCodes.NODETYPE_NODE :
                 targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_ANY));
                 break;
  -            case OpCodes.NODETYPE_ROOT:
  +            case OpCodes.NODETYPE_ROOT :
                 targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_ROOT));
                 break;
  -            case OpCodes.NODETYPE_ANYELEMENT:
  +            case OpCodes.NODETYPE_ANYELEMENT :
                 targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_ANY));
                 break;
  -            case OpCodes.NODETYPE_PI:
  +            case OpCodes.NODETYPE_PI :
                 targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_ANY));
                 break;
  -            case OpCodes.NODENAME:
  -              int tokenIndex = m_opMap[opPos+1];
  -              String namespace = (tokenIndex >= 0) ? 
  -                                 (String)m_tokenQueue[tokenIndex] : null;
  -              tokenIndex = m_opMap[opPos+1];
  -              if(tokenIndex >= 0)
  +            case OpCodes.NODENAME :
  +              int tokenIndex = m_opMap[opPos + 1];
  +              String namespace = (tokenIndex >= 0)
  +                                 ? (String) m_tokenQueue[tokenIndex] : null;
  +
  +              tokenIndex = m_opMap[opPos + 1];
  +
  +              if (tokenIndex >= 0)
                 {
  -                String targetName = (String)m_tokenQueue[tokenIndex];
  -                if(targetName.equals("*"))
  +                String targetName = (String) m_tokenQueue[tokenIndex];
  +
  +                if (targetName.equals("*"))
                   {
  -                  targetQNames.addElement(new QName(namespace, PsuedoNames.PSEUDONAME_ANY));
  +                  targetQNames.addElement(
  +                    new QName(namespace, PsuedoNames.PSEUDONAME_ANY));
                   }
                   else
                   {
  @@ -458,23 +565,26 @@
                 }
                 else
                 {
  +
                   // ?? -sboag
  -                targetQNames.addElement(new QName(namespace, PsuedoNames.PSEUDONAME_ANY));
  +                targetQNames.addElement(
  +                  new QName(namespace, PsuedoNames.PSEUDONAME_ANY));
                 }
                 break;
  -            default:
  +            default :
                 targetQNames.addElement(new QName(PsuedoNames.PSEUDONAME_ANY));
                 break;
               }
               break;
             }
           }
  +
           opPos = nextStepPos;
         }
  -      
  +
         opPos = nextOpPos;
       }
  +
       return targetQNames;
     }
  -
   }
  
  
  
  1.2       +12 -7     xml-xalan/java/src/org/apache/xpath/compiler/PsuedoNames.java
  
  Index: PsuedoNames.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/PsuedoNames.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- PsuedoNames.java	2000/07/05 14:45:38	1.1
  +++ PsuedoNames.java	2000/10/30 18:59:25	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -56,43 +56,48 @@
    */
   package org.apache.xpath.compiler;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class PsuedoNames <needs-comment/>
  + */
   public class PsuedoNames
   {
  +
     /**
      * <meta name="usage" content="advanced"/>
      * used mainly for keys in the pattern lookup table,
      * for those nodes that don't have unique lookup values.
      */
     public static final String PSEUDONAME_ANY = "*";
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * used mainly for keys in the pattern lookup table,
      * for those nodes that don't have unique lookup values.
      */
     public static final String PSEUDONAME_ROOT = "/";
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * used mainly for keys in the pattern lookup table,
      * for those nodes that don't have unique lookup values.
      */
     public static final String PSEUDONAME_TEXT = "#text";
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * used mainly for keys in the pattern lookup table,
      * for those nodes that don't have unique lookup values.
      */
     public static final String PSEUDONAME_COMMENT = "#comment";
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * used mainly for keys in the pattern lookup table,
      * for those nodes that don't have unique lookup values.
      */
     public static final String PSEUDONAME_PI = "#pi";
  -  
  +
     /**
      * <meta name="usage" content="advanced"/>
      * used mainly for keys in the pattern lookup table,
  
  
  
  1.2       +3 -3      xml-xalan/java/src/org/apache/xpath/compiler/XPathDumper.java
  
  Index: XPathDumper.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/XPathDumper.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPathDumper.java	2000/07/05 14:45:38	1.1
  +++ XPathDumper.java	2000/10/30 18:59:25	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -58,7 +58,6 @@
   
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xpath.res.XPATHErrorResources;
  -
   import org.apache.xpath.XPath;
   import org.apache.xpath.compiler.XPathParser;
   
  @@ -67,5 +66,6 @@
    */
   public class XPathDumper
   {
  +
     // deleted for the time being.
   }
  
  
  
  1.4       +820 -411  xml-xalan/java/src/org/apache/xpath/compiler/XPathParser.java
  
  Index: XPathParser.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/compiler/XPathParser.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XPathParser.java	2000/10/13 02:33:19	1.3
  +++ XPathParser.java	2000/10/30 18:59:26	1.4
  @@ -2,7 +2,7 @@
    * The Apache Software License, Version 1.1
    *
    *
  - * Copyright (c) 1999 The Apache Software Foundation.  All rights
  + * Copyright (c) 1999 The Apache Software Foundation.  All rights 
    * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
  @@ -10,7 +10,7 @@
    * are met:
    *
    * 1. Redistributions of source code must retain the above copyright
  - *    notice, this list of conditions and the following disclaimer.
  + *    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
  @@ -18,7 +18,7 @@
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  - *    if any, must include the following acknowledgment:
  + *    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,
  @@ -26,7 +26,7 @@
    *
    * 4. The names "Xalan" and "Apache Software Foundation" must
    *    not be used to endorse or promote products derived from this
  - *    software without prior written permission. For written
  + *    software without prior written permission. For written 
    *    permission, please contact apache@apache.org.
    *
    * 5. Products derived from this software may not be called "Apache",
  @@ -58,6 +58,7 @@
   
   import java.util.Vector;
   import java.util.Hashtable;
  +
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xpath.compiler.Compiler;
  @@ -65,18 +66,21 @@
   import org.apache.xpath.objects.XNumber;
   import org.apache.xalan.res.XSLMessages;
   import org.apache.xalan.utils.StringKey;
  +
   import org.xml.sax.ErrorHandler;
   import org.xml.sax.SAXException;
   import org.xml.sax.Locator;
  +
   import org.apache.trax.ProcessorException;
   
   /**
    * <meta name="usage" content="general"/>
  - * Tokenizes and parses XPath expressions. This should really be named 
  + * Tokenizes and parses XPath expressions. This should really be named
    * XPathParserImpl, and may be renamed in the future.
    */
   public class XPathParser implements java.io.Serializable
   {
  +
     /**
      * The XPath to be processed.
      */
  @@ -102,110 +106,146 @@
     /**
      * The parser constructor.
      */
  -  public XPathParser()
  -  {
  -  }
  +  public XPathParser(){}
   
     /**
      * The prefix resolver to map prefixes to namespaces in the OpMap.
      */
     PrefixResolver m_namespaceContext;
  -  
  +
     /**
  -   * Given an string, init an XPath object for selections, 
  -   * in order that a parse doesn't 
  +   * Given an string, init an XPath object for selections,
  +   * in order that a parse doesn't
      * have to be done each time the expression is evaluated.
      * @param compiler The compiler object.
      * @param expresson A String representing the OpMap.
  -   * @param namespaceContext An object that is able to resolve prefixes in 
  +   * NEEDSDOC @param expression
  +   * @param namespaceContext An object that is able to resolve prefixes in
      * the XPath to namespaces.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void initXPath(Compiler compiler, String expression, PrefixResolver namespaceContext)
  -    throws org.xml.sax.SAXException
  +  public void initXPath(
  +          Compiler compiler, String expression, PrefixResolver namespaceContext)
  +            throws org.xml.sax.SAXException
     {
  +
       m_ops = compiler;
       m_namespaceContext = namespaceContext;
  +
       Lexer lexer = new Lexer(compiler, namespaceContext, this);
  -    lexer.tokenize( expression );
  +
  +    lexer.tokenize(expression);
  +
       m_ops.m_opMap[0] = OpCodes.OP_XPATH;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] = 2;
  +
       nextToken();
       Expr();
  -    if(null != m_token)
  +
  +    if (null != m_token)
       {
         String extraTokens = "";
  -      while(null != m_token)
  +
  +      while (null != m_token)
         {
  -        extraTokens += "'"+m_token+"'";
  +        extraTokens += "'" + m_token + "'";
  +
           nextToken();
  -        if(null != m_token)
  +
  +        if (null != m_token)
             extraTokens += ", ";
         }
  -      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[] {extraTokens}); //"Extra illegal tokens: "+extraTokens);
  +
  +      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
  +            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
       }
  +
       compiler.shrink();
       doStaticAnalysis(compiler);
     }
   
     /**
      * Analyze the XPath object to give optimization information.
  +   *
  +   * NEEDSDOC @param compiler
      */
  -  void doStaticAnalysis(Compiler compiler)
  -  {
  -  }
  +  void doStaticAnalysis(Compiler compiler){}
   
     /**
  -   * Given an string, init an XPath object for pattern matches, 
  -   * in order that a parse doesn't 
  +   * Given an string, init an XPath object for pattern matches,
  +   * in order that a parse doesn't
      * have to be done each time the expression is evaluated.
      * @param compiler The XPath object to be initialized.
      * @param expresson A String representing the XPath.
  -   * @param namespaceContext An object that is able to resolve prefixes in 
  +   * NEEDSDOC @param expression
  +   * @param namespaceContext An object that is able to resolve prefixes in
      * the XPath to namespaces.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public void initMatchPattern(Compiler compiler, String expression, PrefixResolver namespaceContext)
  -    throws org.xml.sax.SAXException
  +  public void initMatchPattern(
  +          Compiler compiler, String expression, PrefixResolver namespaceContext)
  +            throws org.xml.sax.SAXException
     {
  +
       m_ops = compiler;
       m_namespaceContext = namespaceContext;
  +
       Lexer lexer = new Lexer(compiler, namespaceContext, this);
  -    lexer.tokenize( expression );
  +
  +    lexer.tokenize(expression);
  +
       m_ops.m_opMap[0] = OpCodes.OP_MATCHPATTERN;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] = 2;
  +
       nextToken();
       Pattern();
  -    if(null != m_token)
  +
  +    if (null != m_token)
       {
         String extraTokens = "";
  -      while(null != m_token)
  +
  +      while (null != m_token)
         {
  -        extraTokens += "'"+m_token+"'";
  +        extraTokens += "'" + m_token + "'";
  +
           nextToken();
  -        if(null != m_token)
  +
  +        if (null != m_token)
             extraTokens += ", ";
         }
  -      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS, new Object[] {extraTokens}); //"Extra illegal tokens: "+extraTokens);
  +
  +      error(XPATHErrorResources.ER_EXTRA_ILLEGAL_TOKENS,
  +            new Object[]{ extraTokens });  //"Extra illegal tokens: "+extraTokens);
       }
  +
       // Terminate for safety.
       m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ENDOP;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
       m_ops.shrink();
     }
  -  
  +
  +  /** NEEDSDOC Field m_errorHandler          */
     private ErrorHandler m_errorHandler;
   
     /**
      * Allow an application to register an error event handler.
  +   *
  +   * NEEDSDOC @param handler
      */
  -  public void setErrorHandler (ErrorHandler handler)
  +  public void setErrorHandler(ErrorHandler handler)
     {
       m_errorHandler = handler;
     }
   
     /**
      * Return the current error handler.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  public ErrorHandler getErrorHandler ()
  +  public ErrorHandler getErrorHandler()
     {
       return m_errorHandler;
     }
  @@ -213,41 +253,58 @@
     /**
      * Check whether m_token==s. If m_token is null, returns false (or true if s is also null);
      * do not throw an exception.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  final boolean tokenIs( String s )
  +  final boolean tokenIs(String s)
     {
  -    return ( m_token!=null ) ? (m_token.equals(s)) : ( s==null );
  +    return (m_token != null) ? (m_token.equals(s)) : (s == null);
     }
   
     /**
      * Check whether m_token==c. If m_token is null, returns false (or true if c is also null);
      * do not throw an exception.
  +   *
  +   * NEEDSDOC @param c
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  final boolean tokenIs( char c )
  +  final boolean tokenIs(char c)
     {
  -    return ( m_token!=null ) ? (m_tokenChar == c) : false;
  +    return (m_token != null) ? (m_tokenChar == c) : false;
     }
   
     /**
      * Look ahead of the current token in order to
      * make a branching decision.
      * @param s the string to compare it to.
  +   *
  +   * NEEDSDOC @param c
      * @param n number of tokens to look ahead.  Must be
      * greater than 1.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  final boolean lookahead( char c, int n )
  +  final boolean lookahead(char c, int n)
     {
  -    int pos = (m_queueMark+n);
  +
  +    int pos = (m_queueMark + n);
       boolean b;
  -    if((pos <= m_ops.m_tokenQueueSize) && (pos > 0) && (m_ops.m_tokenQueueSize != 0))
  +
  +    if ((pos <= m_ops.m_tokenQueueSize) && (pos > 0)
  +            && (m_ops.m_tokenQueueSize != 0))
       {
  -      String tok = ((String)m_ops.m_tokenQueue[pos-1]);
  +      String tok = ((String) m_ops.m_tokenQueue[pos - 1]);
  +
         b = (tok.length() == 1) ? (tok.charAt(0) == c) : false;
       }
       else
       {
         b = false;
       }
  +
       return b;
     }
   
  @@ -260,18 +317,24 @@
      * at either the beginning of the string or on a '|'
      * character.  Because of this, this method should only
      * be used for pattern matching.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private final boolean lookbehind( char c, int n )
  +  private final boolean lookbehind(char c, int n)
     {
  +
       boolean isToken;
  -    int lookBehindPos = m_queueMark-(n+1);
  -    if( lookBehindPos >= 0 )
  +    int lookBehindPos = m_queueMark - (n + 1);
  +
  +    if (lookBehindPos >= 0)
       {
  -      String lookbehind = (String)m_ops.m_tokenQueue[lookBehindPos];
  -      if(lookbehind.length() == 1)
  +      String lookbehind = (String) m_ops.m_tokenQueue[lookBehindPos];
  +
  +      if (lookbehind.length() == 1)
         {
  -        char c0 = ( lookbehind == null ) ? '|' : lookbehind.charAt(0);
  -        isToken = ( c0 == '|' ) ? false : (c0 == c);
  +        char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0);
  +
  +        isToken = (c0 == '|') ? false : (c0 == c);
         }
         else
         {
  @@ -282,6 +345,7 @@
       {
         isToken = false;
       }
  +
       return isToken;
     }
   
  @@ -295,19 +359,23 @@
      * be used for pattern matching.
      * @return true if look behind has a token, false otherwise.
      */
  -  private final boolean lookbehindHasToken( int n )
  +  private final boolean lookbehindHasToken(int n)
     {
  +
       boolean hasToken;
  -    if( (m_queueMark-n) > 0 )
  +
  +    if ((m_queueMark - n) > 0)
       {
  -      String lookbehind = (String)m_ops.m_tokenQueue[m_queueMark - (n-1)];
  -      char c0 = ( lookbehind == null ) ? '|' : lookbehind.charAt(0);
  -      hasToken = ( c0 == '|' ) ? false : true;
  +      String lookbehind = (String) m_ops.m_tokenQueue[m_queueMark - (n - 1)];
  +      char c0 = (lookbehind == null) ? '|' : lookbehind.charAt(0);
  +
  +      hasToken = (c0 == '|') ? false : true;
       }
       else
       {
         hasToken = false;
       }
  +
       return hasToken;
     }
   
  @@ -317,19 +385,25 @@
      * @param s the string to compare it to.
      * @param n number of tokens to lookahead.  Must be
      * greater than 1.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
  -  private final boolean lookahead( String s, int n )
  +  private final boolean lookahead(String s, int n)
     {
  +
       boolean isToken;
  -    if( (m_queueMark+n) <= m_ops.m_tokenQueueSize )
  +
  +    if ((m_queueMark + n) <= m_ops.m_tokenQueueSize)
       {
  -      String lookahead = (String)m_ops.m_tokenQueue[m_queueMark + (n-1)];
  -      isToken = ( lookahead!=null ) ? lookahead.equals(s) : ( s==null );
  +      String lookahead = (String) m_ops.m_tokenQueue[m_queueMark + (n - 1)];
  +
  +      isToken = (lookahead != null) ? lookahead.equals(s) : (s == null);
       }
       else
       {
         isToken = (null == s);
       }
  +
       return isToken;
     }
   
  @@ -339,9 +413,10 @@
      */
     private final void nextToken()
     {
  -    if( m_queueMark < m_ops.m_tokenQueueSize )
  +
  +    if (m_queueMark < m_ops.m_tokenQueueSize)
       {
  -      m_token = (String)m_ops.m_tokenQueue[m_queueMark++];
  +      m_token = (String) m_ops.m_tokenQueue[m_queueMark++];
         m_tokenChar = m_token.charAt(0);
       }
       else
  @@ -354,19 +429,24 @@
     /**
      * Retrieve a token relative to the current token.
      * @param i Position relative to current token.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     private final String getTokenRelative(int i)
     {
  +
       String tok;
  -    int relative = m_queueMark+i;
  -    if( (relative > 0) && (relative < m_ops.m_tokenQueueSize) )
  +    int relative = m_queueMark + i;
  +
  +    if ((relative > 0) && (relative < m_ops.m_tokenQueueSize))
       {
  -      tok = (String)m_ops.m_tokenQueue[relative];
  +      tok = (String) m_ops.m_tokenQueue[relative];
       }
       else
       {
         tok = null;
       }
  +
       return tok;
     }
   
  @@ -376,10 +456,12 @@
      */
     private final void prevToken()
     {
  -    if( m_queueMark > 0 )
  +
  +    if (m_queueMark > 0)
       {
         m_queueMark--;
  -      m_token = (String)m_ops.m_tokenQueue[m_queueMark];
  +
  +      m_token = (String) m_ops.m_tokenQueue[m_queueMark];
         m_tokenChar = m_token.charAt(0);
       }
       else
  @@ -392,52 +474,70 @@
     /**
      * Consume an expected token, throwing an exception if it
      * isn't there.
  +   *
  +   * NEEDSDOC @param expected
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     private final void consumeExpected(String expected)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    if(tokenIs(expected))
  +
  +    if (tokenIs(expected))
       {
         nextToken();
       }
       else
       {
  -		error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[] {expected, m_token}); //"Expected "+expected+", but found: "+m_token);
  +      error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[]{ expected,
  +                                                                     m_token });  //"Expected "+expected+", but found: "+m_token);
       }
     }
   
     /**
      * Consume an expected token, throwing an exception if it
      * isn't there.
  +   *
  +   * NEEDSDOC @param expected
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     private final void consumeExpected(char expected)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    if(tokenIs(expected))
  +
  +    if (tokenIs(expected))
       {
         nextToken();
       }
       else
       {
  -      error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND, new Object[] {String.valueOf(expected), m_token}); //"Expected "+expected+", but found: "+m_token);
  +      error(XPATHErrorResources.ER_EXPECTED_BUT_FOUND,
  +            new Object[]{ String.valueOf(expected),
  +                          m_token });  //"Expected "+expected+", but found: "+m_token);
       }
     }
   
     /**
      * Warn the user of a problem.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws SAXException
      */
  -  void warn(int msg, Object[] args)
  -    throws SAXException
  +  void warn(int msg, Object[] args) throws SAXException
     {
  -    String fmsg = XSLMessages.createXPATHWarning(msg, args); 
  -    
  +
  +    String fmsg = XSLMessages.createXPATHWarning(msg, args);
       ErrorHandler ehandler = this.getErrorHandler();
   
  -    if(null != ehandler)
  +    if (null != ehandler)
       {
  +
         // TO DO: Need to get stylesheet Locator from here.
  -      ehandler.warning(new ProcessorException(fmsg, (Locator)null));
  -    }  
  +      ehandler.warning(new ProcessorException(fmsg, (Locator) null));
  +    }
       else
       {
         System.out.println(fmsg);
  @@ -447,12 +547,19 @@
     /**
      * Notify the user of an assertion error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param b
  +   * NEEDSDOC @param msg
      */
     private void assert(boolean b, String msg)
     {
  -    if(!b)
  +
  +    if (!b)
       {
  -      String fMsg = XSLMessages.createXPATHMessage(XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION, new Object[] {msg}); 
  +      String fMsg = XSLMessages.createXPATHMessage(
  +        XPATHErrorResources.ER_INCORRECT_PROGRAMMER_ASSERTION,
  +        new Object[]{ msg });
  +
         throw new RuntimeException(fMsg);
       }
     }
  @@ -460,18 +567,23 @@
     /**
      * Notify the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws SAXException
      */
  -  void error(int msg, Object[] args)
  -    throws SAXException
  +  void error(int msg, Object[] args) throws SAXException
     {
  -    String fmsg = XSLMessages.createXPATHMessage(msg, args); 
  -    
  +
  +    String fmsg = XSLMessages.createXPATHMessage(msg, args);
       ErrorHandler ehandler = this.getErrorHandler();
   
  -    if(null != ehandler)
  +    if (null != ehandler)
       {
  +
         // TO DO: Need to get stylesheet Locator from here.
  -      ehandler.fatalError(new ProcessorException(fmsg, (Locator)null));
  +      ehandler.fatalError(new ProcessorException(fmsg, (Locator) null));
       }
       else
       {
  @@ -482,46 +594,61 @@
     /**
      * Dump the remaining token queue.
      * Thanks to Craig for this.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected String dumpRemainingTokenQueue()
     {
  +
       int q = m_queueMark;
       String returnMsg;
  -    if(q < m_ops.m_tokenQueueSize)
  +
  +    if (q < m_ops.m_tokenQueueSize)
       {
         String msg = "\n Remaining tokens: (";
  -      while (q < m_ops.m_tokenQueueSize )
  +
  +      while (q < m_ops.m_tokenQueueSize)
         {
  -        String t = (String)m_ops.m_tokenQueue[q++];
  +        String t = (String) m_ops.m_tokenQueue[q++];
  +
           msg += (" '" + t + "'");
         }
  +
         returnMsg = msg + ")";
       }
       else
       {
         returnMsg = "";
       }
  +
       return returnMsg;
     }
   
     /**
      * Given a string, return the corresponding function token.
  +   *
  +   * NEEDSDOC @param key
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     final int getFunctionToken(String key)
     {
  +
       int tok;
  +
       try
       {
  -      tok = ((Integer)(Keywords.m_functions.get(key))).intValue();
  +      tok = ((Integer) (Keywords.m_functions.get(key))).intValue();
       }
  -    catch(NullPointerException npe)
  +    catch (NullPointerException npe)
       {
         tok = -1;
       }
  -    catch(ClassCastException cce)
  +    catch (ClassCastException cce)
       {
         tok = -1;
       }
  +
       return tok;
     }
   
  @@ -529,14 +656,21 @@
      * Insert room for operation.  This will NOT set
      * the length value of the operation, but will update
      * the length value for the total expression.
  +   *
  +   * NEEDSDOC @param pos
  +   * NEEDSDOC @param length
  +   * NEEDSDOC @param op
      */
     void insertOp(int pos, int length, int op)
     {
  +
       int totalLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    for(int i = totalLen - 1; i >= pos; i--)
  +
  +    for (int i = totalLen - 1; i >= pos; i--)
       {
  -      m_ops.m_opMap[i+length] = m_ops.m_opMap[i];
  +      m_ops.m_opMap[i + length] = m_ops.m_opMap[i];
       }
  +
       m_ops.m_opMap[pos] = op;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] = totalLen + length;
     }
  @@ -545,25 +679,31 @@
      * Insert room for operation.  This WILL set
      * the length value of the operation, and will update
      * the length value for the total expression.
  +   *
  +   * NEEDSDOC @param length
  +   * NEEDSDOC @param op
      */
     void appendOp(int length, int op)
     {
  +
       int totalLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       m_ops.m_opMap[totalLen] = op;
  -    m_ops.m_opMap[totalLen+OpMap.MAPINDEX_LENGTH] = length;
  +    m_ops.m_opMap[totalLen + OpMap.MAPINDEX_LENGTH] = length;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] = totalLen + length;
     }
   
     // ============= EXPRESSIONS FUNCTIONS =================
  -  
  +
     /**
      *
      *
      * Expr  ::=  OrExpr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Expr()
  -    throws org.xml.sax.SAXException
  +  protected void Expr() throws org.xml.sax.SAXException
     {
       OrExpr();
     }
  @@ -574,19 +714,24 @@
      * OrExpr  ::=  AndExpr
      * | OrExpr 'or' AndExpr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void OrExpr()
  -    throws org.xml.sax.SAXException
  +  protected void OrExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       AndExpr();
  -    if((null != m_token) && tokenIs("or"))
  +
  +    if ((null != m_token) && tokenIs("or"))
       {
         nextToken();
         insertOp(opPos, 2, OpCodes.OP_OR);
         OrExpr();
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH]
  -        = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
     }
   
  @@ -596,18 +741,24 @@
      * AndExpr  ::=  EqualityExpr
      * | AndExpr 'and' EqualityExpr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void AndExpr()
  -    throws org.xml.sax.SAXException
  +  protected void AndExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       EqualityExpr(-1);
  -    if((null != m_token) && tokenIs("and"))
  +
  +    if ((null != m_token) && tokenIs("and"))
       {
         nextToken();
         insertOp(opPos, 2, OpCodes.OP_AND);
         AndExpr();
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
     }
   
  @@ -619,38 +770,52 @@
      * EqualityExpr  ::=  RelationalExpr
      * | EqualityExpr '=' RelationalExpr
      *
  +   *
  +   * NEEDSDOC @param addPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected int EqualityExpr(int addPos)
  -    throws org.xml.sax.SAXException
  +  protected int EqualityExpr(int addPos) throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    if(-1 == addPos)
  +
  +    if (-1 == addPos)
         addPos = opPos;
  +
       RelationalExpr(-1);
  -    if(null != m_token)
  +
  +    if (null != m_token)
       {
  -      if(tokenIs('!') && lookahead('=', 1))
  +      if (tokenIs('!') && lookahead('=', 1))
         {
           nextToken();
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_NOTEQUALS);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = EqualityExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
  -      else if(tokenIs('='))
  +      else if (tokenIs('='))
         {
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_EQUALS);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = EqualityExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
       }
  +
       return addPos;
     }
   
  @@ -665,20 +830,30 @@
      * | RelationalExpr '<=' AdditiveExpr
      * | RelationalExpr '>=' AdditiveExpr
      *
  +   *
  +   * NEEDSDOC @param addPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected int RelationalExpr(int addPos)
  -    throws org.xml.sax.SAXException
  +  protected int RelationalExpr(int addPos) throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    if(-1 == addPos)
  +
  +    if (-1 == addPos)
         addPos = opPos;
  +
       AdditiveExpr(-1);
  -    if(null != m_token)
  +
  +    if (null != m_token)
       {
  -      if(tokenIs('<'))
  +      if (tokenIs('<'))
         {
           nextToken();
  -        if(tokenIs('='))
  +
  +        if (tokenIs('='))
           {
             nextToken();
             insertOp(addPos, 2, OpCodes.OP_LTE);
  @@ -687,16 +862,19 @@
           {
             insertOp(addPos, 2, OpCodes.OP_LT);
           }
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = RelationalExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
  -      else if(tokenIs('>'))
  +      else if (tokenIs('>'))
         {
           nextToken();
  -        if(tokenIs('='))
  +
  +        if (tokenIs('='))
           {
             nextToken();
             insertOp(addPos, 2, OpCodes.OP_GTE);
  @@ -705,13 +883,16 @@
           {
             insertOp(addPos, 2, OpCodes.OP_GT);
           }
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = RelationalExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
       }
  +
       return addPos;
     }
   
  @@ -728,37 +909,49 @@
      * | AdditiveExpr '+' MultiplicativeExpr
      * | AdditiveExpr '-' MultiplicativeExpr
      *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected int AdditiveExpr(int addPos)
  -    throws org.xml.sax.SAXException
  +  protected int AdditiveExpr(int addPos) throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    if(-1 == addPos)
  +
  +    if (-1 == addPos)
         addPos = opPos;
  +
       MultiplicativeExpr(-1);
  -    if(null != m_token)
  +
  +    if (null != m_token)
       {
  -      if(tokenIs('+'))
  +      if (tokenIs('+'))
         {
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_PLUS);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = AdditiveExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
  -      else if(tokenIs('-'))
  +      else if (tokenIs('-'))
         {
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_MINUS);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = AdditiveExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
       }
  +
       return addPos;
     }
   
  @@ -777,57 +970,73 @@
      * | MultiplicativeExpr 'mod' UnaryExpr
      * | MultiplicativeExpr 'quo' UnaryExpr
      *
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected int MultiplicativeExpr(int addPos)
  -    throws org.xml.sax.SAXException
  +  protected int MultiplicativeExpr(int addPos) throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    if(-1 == addPos)
  +
  +    if (-1 == addPos)
         addPos = opPos;
  +
       UnaryExpr();
  -    if(null != m_token)
  +
  +    if (null != m_token)
       {
  -      if(tokenIs('*'))
  +      if (tokenIs('*'))
         {
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_MULT);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = MultiplicativeExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;        
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
  -      else if(tokenIs("div"))
  +      else if (tokenIs("div"))
         {
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_DIV);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = MultiplicativeExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
  -      else if(tokenIs("mod"))
  +      else if (tokenIs("mod"))
         {
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_MOD);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = MultiplicativeExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
  -      else if(tokenIs("quo"))
  +      else if (tokenIs("quo"))
         {
           nextToken();
           insertOp(addPos, 2, OpCodes.OP_QUO);
  +
           int opPlusLeftHandLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - addPos;
  +
           addPos = MultiplicativeExpr(addPos);
  -        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH]
  -          = m_ops.m_opMap[addPos+opPlusLeftHandLen+1] + opPlusLeftHandLen;
  -        addPos+=2;
  +        m_ops.m_opMap[addPos + OpMap.MAPINDEX_LENGTH] =
  +          m_ops.m_opMap[addPos + opPlusLeftHandLen + 1] + opPlusLeftHandLen;
  +        addPos += 2;
         }
       }
  +
       return addPos;
     }
   
  @@ -839,35 +1048,47 @@
      * UnaryExpr  ::=  UnionExpr
      * | '-' UnaryExpr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void UnaryExpr()
  -    throws org.xml.sax.SAXException
  +  protected void UnaryExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
       boolean isNeg = false;
  -    if(m_tokenChar == '-')
  +
  +    if (m_tokenChar == '-')
       {
         nextToken();
         appendOp(2, OpCodes.OP_NEG);
  +
         isNeg = true;
       }
  +
       UnionExpr();
  -    if(isNeg)
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +    if (isNeg)
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
      *
      * StringExpr  ::=  Expr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void StringExpr()
  -    throws org.xml.sax.SAXException
  +  protected void StringExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       appendOp(2, OpCodes.OP_STRING);
       Expr();
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
  @@ -875,18 +1096,24 @@
      *
      * StringExpr  ::=  Expr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void BooleanExpr()
  -    throws org.xml.sax.SAXException
  +  protected void BooleanExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       appendOp(2, OpCodes.OP_BOOL);
       Expr();
  +
       int opLen = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  -    if(opLen == 2)
  +
  +    if (opLen == 2)
       {
  -      error(XPATHErrorResources.ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, null); //"boolean(...) argument is no longer optional with 19990709 XPath draft.");
  +      error(XPATHErrorResources.ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL, null);  //"boolean(...) argument is no longer optional with 19990709 XPath draft.");
       }
  +
       m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = opLen;
     }
   
  @@ -895,14 +1122,19 @@
      *
      * NumberExpr  ::=  Expr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void NumberExpr()
  -    throws org.xml.sax.SAXException
  +  protected void NumberExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       appendOp(2, OpCodes.OP_NUMBER);
       Expr();
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
  @@ -915,24 +1147,29 @@
      * UnionExpr    ::=    PathExpr
      * | UnionExpr '|' PathExpr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void UnionExpr()
  -    throws org.xml.sax.SAXException
  +  protected void UnionExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
       boolean continueOrLoop = true;
       boolean foundUnion = false;
  +
       do
       {
         PathExpr();
   
  -      if(tokenIs('|'))
  +      if (tokenIs('|'))
         {
  -        if(false == foundUnion)
  +        if (false == foundUnion)
           {
             foundUnion = true;
  +
             insertOp(opPos, 2, OpCodes.OP_UNION);
           }
  +
           nextToken();
         }
         else
  @@ -942,61 +1179,79 @@
   
         // this.m_testForDocOrder = true;
       }
  -      while(continueOrLoop);
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    while (continueOrLoop);
  +
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
      * Analyze a union pattern and tell if the axes are
      * all descendants.
      * (Move to XPath?)
  +   *
  +   * NEEDSDOC @param opmap
  +   * NEEDSDOC @param opPos
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     private static boolean isLocationPathSimpleFollowing(OpMap opmap, int opPos)
     {
  -    if(true)
  +
  +    if (true)
       {
  -      // int posOfLastOp = OpMap.getNextOpPos(opPos)-1;
   
  +      // int posOfLastOp = OpMap.getNextOpPos(opPos)-1;
         opPos = OpMap.getFirstChildPos(opPos);
  +
         // step
         int stepType = opmap.m_opMap[opPos];
   
         // make sure all step types are going forwards
  -      switch(stepType)
  +      switch (stepType)
         {
  -      case OpCodes.FROM_SELF:
  -      case OpCodes.FROM_ATTRIBUTES:
  -      case OpCodes.FROM_CHILDREN:
  -      case OpCodes.FROM_DESCENDANTS:
  -      case OpCodes.FROM_DESCENDANTS_OR_SELF:
  -      case OpCodes.FROM_FOLLOWING:
  -      case OpCodes.FROM_FOLLOWING_SIBLINGS:
  -        if(opmap.m_opMap[opmap.getNextOpPos(opPos)] == OpCodes.ENDOP)
  +      case OpCodes.FROM_SELF :
  +      case OpCodes.FROM_ATTRIBUTES :
  +      case OpCodes.FROM_CHILDREN :
  +      case OpCodes.FROM_DESCENDANTS :
  +      case OpCodes.FROM_DESCENDANTS_OR_SELF :
  +      case OpCodes.FROM_FOLLOWING :
  +      case OpCodes.FROM_FOLLOWING_SIBLINGS :
  +        if (opmap.m_opMap[opmap.getNextOpPos(opPos)] == OpCodes.ENDOP)
           {
  +
             // Add the length of the step itself, plus the length of the op,
             // and two length arguments, to the op position.
  -          opPos = (opmap.getArgLengthOfStep(opPos)+opmap.getFirstChildPosOfStep(opPos));
  +          opPos = (opmap.getArgLengthOfStep(opPos)
  +                   + opmap.getFirstChildPosOfStep(opPos));
  +
             int nextStepType = opmap.m_opMap[opPos];
   
  -          if(OpCodes.OP_PREDICATE == nextStepType)
  +          if (OpCodes.OP_PREDICATE == nextStepType)
             {
  -            int firstPredPos = opPos+2;
  +            int firstPredPos = opPos + 2;
               int predicateType = opmap.m_opMap[firstPredPos];
  -            if((OpCodes.OP_NUMBERLIT == predicateType) || (OpCodes.OP_NUMBER == predicateType)
  -               || (FunctionTable.FUNC_NUMBER == predicateType))
  +
  +            if ((OpCodes.OP_NUMBERLIT == predicateType)
  +                    || (OpCodes.OP_NUMBER == predicateType)
  +                    || (FunctionTable.FUNC_NUMBER == predicateType))
               {
                 return false;
               }
  +
               opPos = opmap.getNextOpPos(opPos);
               nextStepType = opmap.m_opMap[opPos];
  +
               // Multiple predicates?
  -            if(OpCodes.OP_PREDICATE == nextStepType)
  +            if (OpCodes.OP_PREDICATE == nextStepType)
                 return false;
             }
  +
             return true;
           }
           break;
         }
  +
         return false;
       }
       else
  @@ -1005,7 +1260,6 @@
       }
     }
   
  -
     /**
      * PathExpr  ::=  LocationPath
      * | FilterExpr
  @@ -1014,27 +1268,30 @@
      *
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void PathExpr()
  -    throws org.xml.sax.SAXException
  +  protected void PathExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
       boolean foundLocationPath;
   
       FilterExpr();
   
  -    if(tokenIs('/'))
  -    { 
  +    if (tokenIs('/'))
  +    {
         nextToken();
  -      int locationPathOpPos = opPos;
  +
  +      // int locationPathOpPos = opPos;
         insertOp(opPos, 2, OpCodes.OP_LOCATIONPATH);
         RelativeLocationPath();
   
         // Terminate for safety.
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ENDOP;
         m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
     }
   
  @@ -1046,25 +1303,29 @@
      *
      * @exception XSLProcessorException thrown if the active ProblemListener and XPathContext decide
      * the error condition is severe enough to halt processing.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void FilterExpr()
  -    throws org.xml.sax.SAXException
  +  protected void FilterExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       // boolean isFunc = lookahead('(', 1);
       PrimaryExpr();
   
  -    if(tokenIs('['))
  +    if (tokenIs('['))
       {
  -      int locationPathOpPos = opPos;
  +
  +      // int locationPathOpPos = opPos;
         insertOp(opPos, 2, OpCodes.OP_LOCATIONPATH);
   
  -      while(tokenIs('['))
  +      while (tokenIs('['))
         {
           Predicate();
         }
   
  -      if(tokenIs('/'))
  +      if (tokenIs('/'))
         {
           nextToken();
           RelativeLocationPath();
  @@ -1073,8 +1334,8 @@
         // Terminate for safety.
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ENDOP;
         m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
   
       /*
  @@ -1094,43 +1355,51 @@
      * | Number
      * | FunctionCall
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void PrimaryExpr()
  -    throws org.xml.sax.SAXException
  +  protected void PrimaryExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    if((m_tokenChar == '\'') || (m_tokenChar == '"'))
  +
  +    if ((m_tokenChar == '\'') || (m_tokenChar == '"'))
       {
         appendOp(2, OpCodes.OP_LITERAL);
         Literal();
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
  -    else if(m_tokenChar == '$')
  +    else if (m_tokenChar == '$')
       {
  -      nextToken(); // consume '$'
  +      nextToken();  // consume '$'
         appendOp(2, OpCodes.OP_VARIABLE);
  -
         NCName();
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
  -    else if(m_tokenChar == '(')
  +    else if (m_tokenChar == '(')
       {
         nextToken();
         appendOp(2, OpCodes.OP_GROUP);
         Expr();
         consumeExpected(')');
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
  -    else if((null != m_token) &&
  -            ((('.' == m_tokenChar) && (m_token.length() > 1) &&
  -              Character.isDigit( m_token.charAt(1) ))
  -             || Character.isDigit( m_tokenChar )))
  +    else if ((null != m_token) && ((('.' == m_tokenChar) && (m_token.length() > 1) && Character.isDigit(
  +            m_token.charAt(1))) || Character.isDigit(m_tokenChar)))
       {
         appendOp(2, OpCodes.OP_NUMBERLIT);
         Number();
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
  -    else if(lookahead('(', 1) || (lookahead(':', 1) && lookahead('(', 3)))
  +    else if (lookahead('(', 1) || (lookahead(':', 1) && lookahead('(', 3)))
       {
         FunctionCall();
       }
  @@ -1144,79 +1413,104 @@
      *
      * Argument    ::=    Expr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Argument()
  -    throws org.xml.sax.SAXException
  +  protected void Argument() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       appendOp(2, OpCodes.OP_ARGUMENT);
       Expr();
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
      *
      * FunctionCall    ::=    FunctionName '(' ( Argument ( ',' Argument)*)? ')'
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void FunctionCall()
  -    throws org.xml.sax.SAXException
  +  protected void FunctionCall() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    if(lookahead(':',1))
  +
  +    if (lookahead(':', 1))
       {
         appendOp(4, OpCodes.OP_EXTFUNCTION);
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] = m_queueMark-1;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] = m_queueMark - 1;
  +
         nextToken();
         consumeExpected(':');
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 2] = m_queueMark-1;
  +
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 2] = m_queueMark - 1;
  +
         nextToken();
       }
       else
       {
         int funcTok = getFunctionToken(m_token);
  -      if(-1 == funcTok)
  +
  +      if (-1 == funcTok)
         {
  -		  error(XPATHErrorResources.ER_COULDNOT_FIND_FUNCTION, new Object[] {m_token}); //"Could not find function: "+m_token+"()");
  +        error(XPATHErrorResources.ER_COULDNOT_FIND_FUNCTION,
  +              new Object[]{ m_token });  //"Could not find function: "+m_token+"()");
         }
  -      switch(funcTok)
  +
  +      switch (funcTok)
         {
  -      case OpCodes.NODETYPE_PI:
  -      case OpCodes.NODETYPE_COMMENT:
  -      case OpCodes.NODETYPE_TEXT:
  -      case OpCodes.NODETYPE_NODE:
  +      case OpCodes.NODETYPE_PI :
  +      case OpCodes.NODETYPE_COMMENT :
  +      case OpCodes.NODETYPE_TEXT :
  +      case OpCodes.NODETYPE_NODE :
           LocationPath();
  +
           return;
  -      default:
  +      default :
           appendOp(3, OpCodes.OP_FUNCTION);
  +
           m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] = funcTok;
         }
  +
         nextToken();
       }
  +
       consumeExpected('(');
  -    while(!tokenIs(')') && m_token != null)
  +
  +    while (!tokenIs(')') && m_token != null)
       {
  -      if(tokenIs(','))
  +      if (tokenIs(','))
         {
  -        error(XPATHErrorResources.ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, null); //"Found ',' but no preceding argument!");
  +        error(XPATHErrorResources.ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG, null);  //"Found ',' but no preceding argument!");
         }
  +
         Argument();
  -      if(!tokenIs(')'))
  +
  +      if (!tokenIs(')'))
         {
           consumeExpected(',');
  -        if(tokenIs(')'))
  +
  +        if (tokenIs(')'))
           {
  -          error(XPATHErrorResources.ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG, null); //"Found ',' but no following argument!");
  +          error(XPATHErrorResources.ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG,
  +                null);  //"Found ',' but no following argument!");
           }
         }
       }
  +
       consumeExpected(')');
   
       // Terminate for safety.
       m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ENDOP;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     // ============= GRAMMAR FUNCTIONS =================
  @@ -1226,23 +1520,30 @@
      * LocationPath ::= RelativeLocationPath
      * | AbsoluteLocationPath
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void LocationPath()
  -    throws org.xml.sax.SAXException
  +  protected void LocationPath() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  -    int locationPathOpPos = opPos;
  +
  +    // int locationPathOpPos = opPos;
       appendOp(2, OpCodes.OP_LOCATIONPATH);
   
  -    if(tokenIs('/'))
  +    if (tokenIs('/'))
       {
         appendOp(4, OpCodes.FROM_ROOT);
  +
         // Tell how long the step is without the predicate
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 2] = 4;
  -      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] = OpCodes.NODETYPE_ROOT;
  +      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] =
  +        OpCodes.NODETYPE_ROOT;
  +
         nextToken();
       }
  -    if(m_token != null)
  +
  +    if (m_token != null)
       {
         RelativeLocationPath();
       }
  @@ -1250,8 +1551,8 @@
       // Terminate for safety.
       m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ENDOP;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
  @@ -1260,66 +1561,76 @@
      * | RelativeLocationPath '/' Step
      * | AbbreviatedRelativeLocationPath
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void RelativeLocationPath()
  -    throws org.xml.sax.SAXException
  +  protected void RelativeLocationPath() throws org.xml.sax.SAXException
     {
  +
       Step();
  -    while(tokenIs('/'))
  +
  +    while (tokenIs('/'))
       {
         nextToken();
         Step();
       }
     }
   
  -
     /**
      *
  -   * Step    ::=    Basis Predicate*
  +   * Step    ::=    Basis Predicate
      * | AbbreviatedStep
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Step()
  -    throws org.xml.sax.SAXException
  +  protected void Step() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
   
  -    if(tokenIs("."))
  +    if (tokenIs("."))
       {
         nextToken();
  -      if(tokenIs('['))
  +
  +      if (tokenIs('['))
         {
  -        error(XPATHErrorResources.ER_PREDICATE_ILLEGAL_SYNTAX, null); //"'..[predicate]' or '.[predicate]' is illegal syntax.  Use 'self::node()[predicate]' instead.");
  +        error(XPATHErrorResources.ER_PREDICATE_ILLEGAL_SYNTAX, null);  //"'..[predicate]' or '.[predicate]' is illegal syntax.  Use 'self::node()[predicate]' instead.");
         }
  +
         appendOp(4, OpCodes.FROM_SELF);
  +
         // Tell how long the step is without the predicate
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 2] = 4;
  -      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] = OpCodes.NODETYPE_NODE;
  +      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] =
  +        OpCodes.NODETYPE_NODE;
       }
  -    else if(tokenIs(".."))
  +    else if (tokenIs(".."))
       {
         nextToken();
         appendOp(4, OpCodes.FROM_PARENT);
  +
         // Tell how long the step is without the predicate
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 2] = 4;
  -      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] = OpCodes.NODETYPE_NODE;
  +      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] =
  +        OpCodes.NODETYPE_NODE;
       }
  +
       // There is probably a better way to test for this 
       // transition... but it gets real hairy if you try 
       // to do it in basis().
  -    else if(tokenIs('*') ||
  -            tokenIs('@') ||
  -            tokenIs('/') ||
  -            Character.isLetter(m_token.charAt(0)))
  +    else if (tokenIs('*') || tokenIs('@') || tokenIs('/')
  +             || Character.isLetter(m_token.charAt(0)))
       {
         Basis();
   
  -      while(tokenIs('['))
  +      while (tokenIs('['))
         {
           Predicate();
         }
   
         // Tell how long the entire step is.
  -      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +      m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
       }
     }
   
  @@ -1327,29 +1638,34 @@
      *
      * Basis    ::=    AxisName '::' NodeTest
      * | AbbreviatedBasis
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Basis()
  -    throws org.xml.sax.SAXException
  +  protected void Basis() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
       int axesType;
   
       // The next blocks guarantee that a FROM_XXX will be added.
  -    if(lookahead("::", 1))
  +    if (lookahead("::", 1))
       {
         axesType = AxisName();
  +
         nextToken();
         nextToken();
       }
  -    else if(tokenIs('@'))
  +    else if (tokenIs('@'))
       {
         axesType = OpCodes.FROM_ATTRIBUTES;
  +
         appendOp(2, axesType);
         nextToken();
       }
  -    else if(tokenIs('/'))
  +    else if (tokenIs('/'))
       {
         axesType = OpCodes.FROM_DESCENDANTS_OR_SELF;
  +
         appendOp(2, axesType);
   
         // Have to fix up for patterns such as '//@foo' or '//attribute::foo',
  @@ -1358,17 +1674,20 @@
         // by a regular step pattern.
         // if(lookahead('@', 1) || lookahead("::", 2))
         {
  +
           // Make room for telling how long the step is without the predicate
           m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -
  -        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.NODETYPE_NODE;
  +        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] =
  +          OpCodes.NODETYPE_NODE;
           m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
   
           // Tell how long the step is without the predicate
  -        m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +        m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] =
  +          m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
   
  -        return; // make a quick exit...
  +        return;  // make a quick exit...
         }
  +
         // else
         // {
         //  nextToken();
  @@ -1377,6 +1696,7 @@
       else
       {
         axesType = OpCodes.FROM_CHILDREN;
  +
         appendOp(2, axesType);
       }
   
  @@ -1386,104 +1706,134 @@
       NodeTest(axesType);
   
       // Tell how long the step is without the predicate
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
      *
      * Basis    ::=    AxisName '::' NodeTest
      * | AbbreviatedBasis
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected int AxisName()
  -    throws org.xml.sax.SAXException
  +  protected int AxisName() throws org.xml.sax.SAXException
     {
  +
       Object val = Keywords.m_axisnames.get(m_token);
  -    if(null == val)
  +
  +    if (null == val)
       {
  -      error(XPATHErrorResources.ER_ILLEGAL_AXIS_NAME, new Object[] {m_token}); //"illegal axis name: "+m_token);
  +      error(XPATHErrorResources.ER_ILLEGAL_AXIS_NAME,
  +            new Object[]{ m_token });  //"illegal axis name: "+m_token);
       }
  -    int axesType = ((Integer)val).intValue();
  +
  +    int axesType = ((Integer) val).intValue();
  +
       appendOp(2, axesType);
  +
       return axesType;
     }
   
  -
     /**
      *
      * NodeTest    ::=    WildcardName
      * | NodeType '(' ')'
      * | 'processing-instruction' '(' Literal ')'
  +   *
  +   * NEEDSDOC @param axesType
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void NodeTest(int axesType)
  -    throws org.xml.sax.SAXException
  +  protected void NodeTest(int axesType) throws org.xml.sax.SAXException
     {
  -    if(lookahead('(', 1))
  +
  +    if (lookahead('(', 1))
       {
         Object nodeTestOp = Keywords.m_nodetypes.get(m_token);
  -      if(null == nodeTestOp)
  +
  +      if (null == nodeTestOp)
         {
  -        error(XPATHErrorResources.ER_UNKNOWN_NODETYPE, new Object[] {m_token}); //"Unknown nodetype: "+m_token);
  +        error(XPATHErrorResources.ER_UNKNOWN_NODETYPE,
  +              new Object[]{ m_token });  //"Unknown nodetype: "+m_token);
         }
         else
         {
           nextToken();
  -        int nt = ((Integer)nodeTestOp).intValue();
  +
  +        int nt = ((Integer) nodeTestOp).intValue();
  +
           m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = nt;
           m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
   
           consumeExpected('(');
  -        if(OpCodes.NODETYPE_PI == nt)
  +
  +        if (OpCodes.NODETYPE_PI == nt)
           {
  -          if(!tokenIs(')'))
  +          if (!tokenIs(')'))
             {
               Literal();
             }
           }
  +
           consumeExpected(')');
         }
       }
       else
       {
  +
         // Assume name of attribute or element.
  -        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.NODENAME;
  -        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -        if(lookahead(':', 1))
  +      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.NODENAME;
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
  +      if (lookahead(':', 1))
  +      {
  +        if (tokenIs('*'))
           {
  -          if(tokenIs('*'))
  -          {
  -            m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]]
  -              = OpCodes.ELEMWILDCARD;
  -          }
  -          else
  -          {
  -            m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark-1;
  -          }
  -          nextToken();
  -          consumeExpected(':');
  +          m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] =
  +            OpCodes.ELEMWILDCARD;
           }
           else
           {
  -          m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.EMPTY;
  +          m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark
  +                  - 1;
           }
  -        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
   
  -        if(tokenIs('*'))
  -        {
  -          m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ELEMWILDCARD;
  -        }
  -        else
  +        nextToken();
  +        consumeExpected(':');
  +      }
  +      else
  +      {
  +        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.EMPTY;
  +      }
  +
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
  +      if (tokenIs('*'))
  +      {
  +        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] =
  +          OpCodes.ELEMWILDCARD;
  +      }
  +      else
  +      {
  +        if (OpCodes.FROM_NAMESPACE == axesType)
           {
  -          if(OpCodes.FROM_NAMESPACE == axesType)
  -          {
  -            String prefix = (String)this.m_ops.m_tokenQueue[m_queueMark-1];
  -            String namespace = ((PrefixResolver)m_namespaceContext).getNamespaceForPrefix(prefix);
  -            this.m_ops.m_tokenQueue[m_queueMark-1] = namespace;
  -          }
  -          m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark-1;
  +          String prefix = (String) this.m_ops.m_tokenQueue[m_queueMark - 1];
  +          String namespace =
  +            ((PrefixResolver) m_namespaceContext).getNamespaceForPrefix(
  +              prefix);
  +
  +          this.m_ops.m_tokenQueue[m_queueMark - 1] = namespace;
           }
   
  -        m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -        nextToken();
  +        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark - 1;
  +      }
  +
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
  +      nextToken();
       }
     }
   
  @@ -1491,11 +1841,13 @@
      *
      * Predicate ::= '[' PredicateExpr ']'
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Predicate()
  -    throws org.xml.sax.SAXException
  +  protected void Predicate() throws org.xml.sax.SAXException
     {
  -    if(tokenIs('['))
  +
  +    if (tokenIs('['))
       {
         nextToken();
         PredicateExpr();
  @@ -1507,46 +1859,56 @@
      *
      * PredicateExpr ::= Expr
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void PredicateExpr()
  -    throws org.xml.sax.SAXException
  +  protected void PredicateExpr() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       appendOp(2, OpCodes.OP_PREDICATE);
       Expr();
   
       // Terminate for safety.
       m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ENDOP;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
      * QName ::=  (Prefix ':')? LocalPart
      * Prefix ::=  NCName
      * LocalPart ::=  NCName
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void QName()
  -    throws org.xml.sax.SAXException
  +  protected void QName() throws org.xml.sax.SAXException
     {
  -    m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark-1;
  +
  +    m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark - 1;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
       nextToken();
       consumeExpected(':');
  -    m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark-1;
  +
  +    m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark - 1;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
       nextToken();
     }
   
     /**
  -   * NCName ::=  (Letter | '_') (NCNameChar)*
  +   * NCName ::=  (Letter | '_') (NCNameChar)
      * NCNameChar ::=  Letter | Digit | '.' | '-' | '_' | CombiningChar | Extender
      */
     protected void NCName()
     {
  -    m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark-1;
  +
  +    m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark - 1;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
       nextToken();
     }
   
  @@ -1557,30 +1919,39 @@
      * Literal  ::=  '"' [^"]* '"'
      * | "'" [^']* "'"
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Literal()
  -    throws org.xml.sax.SAXException
  +  protected void Literal() throws org.xml.sax.SAXException
     {
  -    int last = m_token.length()-1;
  +
  +    int last = m_token.length() - 1;
       char c0 = m_tokenChar;
       char cX = m_token.charAt(last);
  -    if(((c0 == '\"') && (cX == '\"')) ||
  -       ((c0 == '\'') && (cX == '\'')))
  +
  +    if (((c0 == '\"') && (cX == '\"')) || ((c0 == '\'') && (cX == '\'')))
       {
  +
         // Mutate the token to remove the quotes and have the XString object
         // already made.
  -      int tokenQueuePos = m_queueMark-1;
  +      int tokenQueuePos = m_queueMark - 1;
  +
         m_ops.m_tokenQueue[tokenQueuePos] = null;
  +
         Object obj = new XString(m_token.substring(1, last));
  +
         m_ops.m_tokenQueue[tokenQueuePos] = obj;
  +
         // lit = m_token.substring(1, last);
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = tokenQueuePos;
         m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
         nextToken();
       }
       else
       {
  -      error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED, new Object[] {m_token}); //"Pattern literal ("+m_token+") needs to be quoted!");
  +      error(XPATHErrorResources.ER_PATTERN_LITERAL_NEEDS_BE_QUOTED,
  +            new Object[]{ m_token });  //"Pattern literal ("+m_token+") needs to be quoted!");
       }
     }
   
  @@ -1588,29 +1959,35 @@
      *
      * Number ::= [0-9]+('.'[0-9]+)? | '.'[0-9]+
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Number()
  -    throws org.xml.sax.SAXException
  +  protected void Number() throws org.xml.sax.SAXException
     {
  -    if(null != m_token)
  +
  +    if (null != m_token)
       {
  +
         // Mutate the token to remove the quotes and have the XNumber object
         // already made.
         double num;
  +
         try
         {
           num = Double.valueOf(m_token).doubleValue();
         }
  -      catch(NumberFormatException nfe)
  +      catch (NumberFormatException nfe)
         {
  -        num = 0.0; // to shut up compiler.
  -        error(XPATHErrorResources.ER_COULDNOT_BE_FORMATTED_TO_NUMBER, new Object[] {m_token}); //m_token+" could not be formatted to a number!");
  +        num = 0.0;  // to shut up compiler.
  +
  +        error(XPATHErrorResources.ER_COULDNOT_BE_FORMATTED_TO_NUMBER,
  +              new Object[]{ m_token });  //m_token+" could not be formatted to a number!");
         }
  -      m_ops.m_tokenQueue[m_queueMark-1]
  -        = new XNumber(num);
   
  +      m_ops.m_tokenQueue[m_queueMark - 1] = new XNumber(num);
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = m_queueMark - 1;
         m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  +
         nextToken();
       }
     }
  @@ -1622,15 +1999,17 @@
      * Pattern  ::=  LocationPathPattern
      * | Pattern '|' LocationPathPattern
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void Pattern()
  -    throws org.xml.sax.SAXException
  +  protected void Pattern() throws org.xml.sax.SAXException
     {
  -    while(true)
  +
  +    while (true)
       {
         LocationPathPattern();
   
  -      if(tokenIs('|'))
  +      if (tokenIs('|'))
         {
           nextToken();
         }
  @@ -1648,31 +2027,38 @@
      * | IdKeyPattern (('/' | '//') RelativePathPattern)?
      * | '//'? RelativePathPattern
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void LocationPathPattern()
  -    throws org.xml.sax.SAXException
  +  protected void LocationPathPattern() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
  +
       appendOp(2, OpCodes.OP_LOCATIONPATHPATTERN);
   
  -    if(lookahead('(', 1) 
  -       && (tokenIs(Keywords.FUNC_ID_STRING) || tokenIs(Keywords.FUNC_KEY_STRING)))
  +    if (lookahead('(', 1)
  +            && (tokenIs(Keywords.FUNC_ID_STRING)
  +                || tokenIs(Keywords.FUNC_KEY_STRING)))
       {
         IdKeyPattern();
  -      if(tokenIs('/') && lookahead('/', 1))
  +
  +      if (tokenIs('/') && lookahead('/', 1))
         {
           appendOp(4, OpCodes.MATCH_ANY_ANCESTOR);
  -        
  +
           // Tell how long the step is without the predicate
           m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 2] = 4;
  -        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] = OpCodes.NODETYPE_FUNCTEST;
  +        m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] =
  +          OpCodes.NODETYPE_FUNCTEST;
  +
           nextToken();
           nextToken();
         }
       }
  -    else if(tokenIs('/'))
  +    else if (tokenIs('/'))
       {
  -      if(lookahead('/', 1))
  +      if (lookahead('/', 1))
         {
           appendOp(4, OpCodes.MATCH_ANY_ANCESTOR);
         }
  @@ -1680,13 +2066,16 @@
         {
           appendOp(4, OpCodes.FROM_ROOT);
         }
  +
         // Tell how long the step is without the predicate
         m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 2] = 4;
  -      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] = OpCodes.NODETYPE_ROOT;
  +      m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - 1] =
  +        OpCodes.NODETYPE_ROOT;
  +
         nextToken();
       }
   
  -    if(!tokenIs('|') && (null != m_token))
  +    if (!tokenIs('|') && (null != m_token))
       {
         RelativePathPattern();
       }
  @@ -1694,8 +2083,8 @@
       // Terminate for safety.
       m_ops.m_opMap[m_ops.m_opMap[OpMap.MAPINDEX_LENGTH]] = OpCodes.ENDOP;
       m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] += 1;
  -
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
   
     /**
  @@ -1704,9 +2093,10 @@
      * | 'key' '(' Literal ',' Literal ')'
      * (Also handle doc())
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void IdKeyPattern()
  -    throws org.xml.sax.SAXException
  +  protected void IdKeyPattern() throws org.xml.sax.SAXException
     {
       FunctionCall();
     }
  @@ -1717,12 +2107,15 @@
      * | RelativePathPattern '/' StepPattern
      * | RelativePathPattern '//' StepPattern
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void RelativePathPattern()
  -    throws org.xml.sax.SAXException
  +  protected void RelativePathPattern() throws org.xml.sax.SAXException
     {
  +
       StepPattern();
  -    while(tokenIs('/'))
  +
  +    while (tokenIs('/'))
       {
         nextToken();
         StepPattern();
  @@ -1733,66 +2126,79 @@
      *
      * StepPattern  ::=  AbbreviatedNodeTestStep
      *
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void StepPattern()
  -    throws org.xml.sax.SAXException
  +  protected void StepPattern() throws org.xml.sax.SAXException
     {
  -    AbbreviatedNodeTestStep(  );
  +    AbbreviatedNodeTestStep();
     }
   
     /**
  +   *
  +   * AbbreviatedNodeTestStep    ::=    '@'? NodeTest Predicate
      *
  -   * AbbreviatedNodeTestStep    ::=    '@'? NodeTest Predicate*
      *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void AbbreviatedNodeTestStep()
  -    throws org.xml.sax.SAXException
  +  protected void AbbreviatedNodeTestStep() throws org.xml.sax.SAXException
     {
  +
       int opPos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
       int axesType;
   
       // The next blocks guarantee that a MATCH_XXX will be added.
       int matchTypePos = -1;
  -    if(tokenIs('@'))
  +
  +    if (tokenIs('@'))
       {
         axesType = OpCodes.MATCH_ATTRIBUTE;
  +
         appendOp(2, axesType);
         nextToken();
       }
  -    else if(this.lookahead("::", 1))
  +    else if (this.lookahead("::", 1))
       {
  -      if(tokenIs("attribute"))
  +      if (tokenIs("attribute"))
         {
           axesType = OpCodes.MATCH_ATTRIBUTE;
  +
           appendOp(2, axesType);
         }
  -      else if(tokenIs("child"))
  +      else if (tokenIs("child"))
         {
           axesType = OpCodes.MATCH_IMMEDIATE_ANCESTOR;
  +
           appendOp(2, axesType);
         }
         else
         {
           axesType = -1;
  -        this.error(XPATHErrorResources.ER_AXES_NOT_ALLOWED, new Object[] {this.m_token});
  +
  +        this.error(XPATHErrorResources.ER_AXES_NOT_ALLOWED,
  +                   new Object[]{ this.m_token });
         }
  +
         nextToken();
         nextToken();
       }
  -    else if(tokenIs('/'))
  +    else if (tokenIs('/'))
       {
         axesType = OpCodes.MATCH_ANY_ANCESTOR;
  +
         appendOp(2, axesType);
         nextToken();
       }
       else
       {
  -      if(tokenIs('/'))
  +      if (tokenIs('/'))
         {
           nextToken();
         }
  +
         matchTypePos = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH];
         axesType = OpCodes.MATCH_IMMEDIATE_ANCESTOR;
  +
         appendOp(2, axesType);
       }
   
  @@ -1802,20 +2208,23 @@
       NodeTest(axesType);
   
       // Tell how long the step is without the predicate
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH + 1] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
   
  -    while(tokenIs('['))
  +    while (tokenIs('['))
       {
         Predicate();
       }
  -    if((matchTypePos > -1) && tokenIs('/') && lookahead('/', 1))
  +
  +    if ((matchTypePos > -1) && tokenIs('/') && lookahead('/', 1))
       {
         m_ops.m_opMap[matchTypePos] = OpCodes.MATCH_ANY_ANCESTOR;
  +
         nextToken();
       }
   
       // Tell how long the entire step is.
  -    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] = m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
  +    m_ops.m_opMap[opPos + OpMap.MAPINDEX_LENGTH] =
  +      m_ops.m_opMap[OpMap.MAPINDEX_LENGTH] - opPos;
     }
  -
   }
  
  
  
  1.2       +10 -7     xml-xalan/java/src/org/apache/xpath/functions/FuncBoolean.java
  
  Index: FuncBoolean.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncBoolean.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncBoolean.java	2000/07/05 14:46:34	1.1
  +++ FuncBoolean.java	2000/10/30 18:59:32	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,16 +71,17 @@
    */
   public class FuncBoolean extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    return m_arg0.execute(xctxt).bool() 
  -           ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +    return m_arg0.execute(xctxt).bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
   }
  
  
  
  1.2       +10 -6     xml-xalan/java/src/org/apache/xpath/functions/FuncCeiling.java
  
  Index: FuncCeiling.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncCeiling.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncCeiling.java	2000/07/05 14:46:35	1.1
  +++ FuncCeiling.java	2000/10/30 18:59:32	1.2
  @@ -3,7 +3,7 @@
    *
    *
    * Copyright (c) 1999 The Apache Software Foundation.  All rights 
  - * Xalan.
  + * reserved.
    *
    * Redistribution and use in source and binary forms, with or without
    * modification, are permitted provided that the following conditions
  @@ -54,12 +54,14 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import java.lang.Math;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,15 +73,17 @@
    */
   public class FuncCeiling extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return new XNumber(Math.ceil(m_arg0.execute(xctxt).num()));
     }
   }
  
  
  
  1.2       +35 -13    xml-xalan/java/src/org/apache/xpath/functions/FuncConcat.java
  
  Index: FuncConcat.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncConcat.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncConcat.java	2000/07/05 14:46:35	1.1
  +++ FuncConcat.java	2000/10/30 18:59:33	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,29 +71,49 @@
    */
   public class FuncConcat extends FunctionMultiArgs
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       StringBuffer sb = new StringBuffer();
  +
       // Compiler says we must have at least two arguments.
       sb.append(m_arg0.execute(xctxt).str());
  -    sb.append(m_arg1.execute(xctxt).str());
    if(null != m_arg2)
      sb.append(m_arg2.execute(xctxt).str());
    if(null != m_args)
  +    sb.append(m_arg1.execute(xctxt).str());
  +
  +    if (null != m_arg2)
  +      sb.append(m_arg2.execute(xctxt).str());
  +
  +    if (null != m_args)
       {
  -      for(int i = 0; i < m_args.length; i++)
        sb.append(m_args[i].execute(xctxt).str());
  -    }
    
    return new XString(sb.toString());
  +      for (int i = 0; i < m_args.length; i++)
  +      {
  +        sb.append(m_args[i].execute(xctxt).str());
  +      }
  +    }
  +
  +    return new XString(sb.toString());
     }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum < 2)
  +    if (argNum < 2)
         throw new WrongNumberArgsException(">1");
     }
  -
   }
  
  
  
  1.2       +17 -8     xml-xalan/java/src/org/apache/xpath/functions/FuncContains.java
  
  Index: FuncContains.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncContains.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncContains.java	2000/07/05 14:46:35	1.1
  +++ FuncContains.java	2000/10/30 18:59:33	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,20 +71,27 @@
    */
   public class FuncContains extends Function2Args
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    String s1 = m_arg0.execute(xctxt).str();
    String s2 = m_arg1.execute(xctxt).str();
  -    
    // Add this check for JDK consistency for empty strings.
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    String s1 = m_arg0.execute(xctxt).str();
  +    String s2 = m_arg1.execute(xctxt).str();
  +
  +    // Add this check for JDK consistency for empty strings.
       if (s1.length() == 0 && s2.length() == 0)
         return XBoolean.S_TRUE;
  -    
    int index = s1.indexOf(s2);
  +
  +    int index = s1.indexOf(s2);
  +
       return (index > -1) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
   }
  
  
  
  1.2       +17 -7     xml-xalan/java/src/org/apache/xpath/functions/FuncCount.java
  
  Index: FuncCount.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncCount.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncCount.java	2000/07/05 14:46:35	1.1
  +++ FuncCount.java	2000/10/30 18:59:33	1.2
  @@ -54,12 +54,15 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -72,22 +75,29 @@
    */
   public class FuncCount extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       NodeIterator nl = m_arg0.execute(xctxt).nodeset();
   
       // We should probably make a function on the iterator for this, 
       // as a given implementation could optimize.
       int i = 0;
  -    while(null != nl.nextNode())
  +
  +    while (null != nl.nextNode())
  +    {
         i++;
  -    return new XNumber((double)i);
  +    }
  +
  +    return new XNumber((double) i);
     }
   }
  
  
  
  1.2       +25 -12    xml-xalan/java/src/org/apache/xpath/functions/FuncCurrent.java
  
  Index: FuncCurrent.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncCurrent.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncCurrent.java	2000/07/05 14:46:35	1.1
  +++ FuncCurrent.java	2000/10/30 18:59:34	1.2
  @@ -57,9 +57,12 @@
   package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -74,45 +77,55 @@
    */
   public class FuncCurrent extends Function
   {
  +
     /**
      * Diagnostics.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     protected String nodeToString(Node n)
     {
  -    return (null != n) 
  -           ? n.getNodeName()+"{"+ ((org.apache.xalan.stree.Child)n).getUid() + "}"
  -             : "null";
  +
  +    return (null != n)
  +           ? n.getNodeName() + "{" + ((org.apache.xalan.stree.Child) n).getUid() + "}"
  +           : "null";
     }
   
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       // If we're in a predicate, then this will return non-null.
  -    AxesWalker iter = (AxesWalker)xctxt.getSubContextList();
  -    
  +    AxesWalker iter = (AxesWalker) xctxt.getSubContextList();
       Node currentNode;
  -    if(null != iter)
  +
  +    if (null != iter)
       {
         LocPathIterator lpi = iter.getLocPathIterator();
  +
         currentNode = lpi.getCurrentContextNode();
       }
       else
       {
         ContextNodeList cnl = xctxt.getContextNodeList();
  -      if(null != cnl)
  +
  +      if (null != cnl)
         {
           currentNode = cnl.getCurrentNode();
         }
         else
           currentNode = null;
       }
  -    
  +
       return new XNodeSet(currentNode);
     }
   }
  
  
  
  1.2       +29 -15    xml-xalan/java/src/org/apache/xpath/functions/FuncDoclocation.java
  
  Index: FuncDoclocation.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncDoclocation.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncDoclocation.java	2000/07/05 14:46:35	1.1
  +++ FuncDoclocation.java	2000/10/30 18:59:34	1.2
  @@ -54,12 +54,14 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.Document;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -67,29 +69,41 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * Execute the proprietary document-location() function, which returns 
  + * Execute the proprietary document-location() function, which returns
    * a node set of documents.
    */
   public class FuncDoclocation extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    Node whereNode = getArg0AsNode(xctxt);
    
  -    String fileLocation = null;
    if(null != whereNode)
    {
      if(Node.DOCUMENT_FRAGMENT_NODE == whereNode.getNodeType())
  -      {
        whereNode = whereNode.getFirstChild();
  -      }
      if(null != whereNode)
  -      {
        Document owner = whereNode.getOwnerDocument();
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    Node whereNode = getArg0AsNode(xctxt);
  +    String fileLocation = null;
  +
  +    if (null != whereNode)
  +    {
  +      if (Node.DOCUMENT_FRAGMENT_NODE == whereNode.getNodeType())
  +      {
  +        whereNode = whereNode.getFirstChild();
  +      }
  +
  +      if (null != whereNode)
  +      {
  +        Document owner = whereNode.getOwnerDocument();
  +
           fileLocation = xctxt.getSourceTreeManager().findURIFromDoc(owner);
  -      }
    }
  -    
    return new XString((null != fileLocation) ? fileLocation : "");
  -  }
  -  
  +      }
  +    }
   
  +    return new XString((null != fileLocation) ? fileLocation : "");
  +  }
   }
  
  
  
  1.2       +21 -12    xml-xalan/java/src/org/apache/xpath/functions/FuncExtElementAvailable.java
  
  Index: FuncExtElementAvailable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncExtElementAvailable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncExtElementAvailable.java	2000/07/05 14:46:35	1.1
  +++ FuncExtElementAvailable.java	2000/10/30 18:59:34	1.2
  @@ -54,12 +54,15 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.extensions.ExtensionsTable;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,23 +74,29 @@
    */
   public class FuncExtElementAvailable extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {      
  -		String fullName = m_arg0.execute(xctxt).str();
  -		int indexOfNSSep = fullName.indexOf(':');
  -		String prefix = (indexOfNSSep >= 0) ? fullName.substring(0, indexOfNSSep) : "";
  -		String namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
  -		String methName = (indexOfNSSep < 0) ? fullName : fullName.substring(indexOfNSSep+1);
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
   
  +    String fullName = m_arg0.execute(xctxt).str();
  +    int indexOfNSSep = fullName.indexOf(':');
  +    String prefix = (indexOfNSSep >= 0)
  +                    ? fullName.substring(0, indexOfNSSep) : "";
  +    String namespace =
  +      xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
  +    String methName = (indexOfNSSep < 0)
  +                      ? fullName : fullName.substring(indexOfNSSep + 1);
       ExtensionsTable etable = xctxt.getExtensionsTable();
  -		return etable.elementAvailable(namespace, methName) 
  +
  +    return etable.elementAvailable(namespace, methName)
              ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  -	}
  +  }
   }
  
  
  
  1.4       +141 -43   xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunction.java
  
  Index: FuncExtFunction.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunction.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- FuncExtFunction.java	2000/08/07 02:51:24	1.3
  +++ FuncExtFunction.java	2000/10/30 18:59:34	1.4
  @@ -1,6 +1,63 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.functions;
   
   import java.util.Vector;
  +
   import org.apache.xpath.Expression;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.objects.*;
  @@ -10,78 +67,106 @@
   import org.w3c.dom.DocumentFragment;
   import org.w3c.dom.traversal.NodeIterator;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class FuncExtFunction <needs-comment/>
  + */
   public class FuncExtFunction extends Function
   {
  +
  +  /** NEEDSDOC Field m_namespace          */
     String m_namespace;
  -  String m_extensionName; 
  +
  +  /** NEEDSDOC Field m_extensionName          */
  +  String m_extensionName;
  +
  +  /** NEEDSDOC Field m_methodKey          */
     Object m_methodKey;
  +
  +  /** NEEDSDOC Field m_argVec          */
     Vector m_argVec = new Vector();
  -  
  -  public FuncExtFunction(java.lang.String namespace, 
  -                         java.lang.String extensionName, 
  -                         Object methodKey) 
  +
  +  /**
  +   * Constructor FuncExtFunction
  +   *
  +   *
  +   * NEEDSDOC @param namespace
  +   * NEEDSDOC @param extensionName
  +   * NEEDSDOC @param methodKey
  +   */
  +  public FuncExtFunction(java.lang.String namespace,
  +                         java.lang.String extensionName, Object methodKey)
     {
  +
       m_namespace = namespace;
  -    m_extensionName = extensionName; 
  +    m_extensionName = extensionName;
       m_methodKey = methodKey;
     }
  -  
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {   
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       XObject result;
       Vector argVec = new Vector();
       int nArgs = m_argVec.size();
  -    for(int i = 0; i < nArgs; i++)
  +
  +    for (int i = 0; i < nArgs; i++)
       {
  -      Expression arg = (Expression)m_argVec.elementAt(i);
  +      Expression arg = (Expression) m_argVec.elementAt(i);
  +
         argVec.addElement(arg.execute(xctxt));
       }
  +
       ExtensionsTable etable = xctxt.getExtensionsTable();
  -    Object val = etable.extFunction(m_namespace, m_extensionName, 
  -                                    argVec, m_methodKey, xctxt);
  -    if(null != val)
  +    Object val = etable.extFunction(m_namespace, m_extensionName, argVec,
  +                                    m_methodKey, xctxt);
  +
  +    if (null != val)
       {
  -      if(val instanceof XObject)
  +      if (val instanceof XObject)
         {
  -        result = (XObject)val;
  +        result = (XObject) val;
         }
  +
         // else if(val instanceof XLocator)
         // {
  -        // XLocator locator = (XLocator)val;
  -        // opPos = getNextOpPos(opPos+1);
  -        // result = locator.connectToNodes(this, opPos, argVec);  
  -        // System.out.println("nodeset len: "+result.nodeset().getLength());
  +      // XLocator locator = (XLocator)val;
  +      // opPos = getNextOpPos(opPos+1);
  +      // result = locator.connectToNodes(this, opPos, argVec);  
  +      // System.out.println("nodeset len: "+result.nodeset().getLength());
         // }
  -      else if(val instanceof String)
  +      else if (val instanceof String)
         {
  -        result = new XString((String)val);
  +        result = new XString((String) val);
         }
  -      else if(val instanceof Boolean)
  +      else if (val instanceof Boolean)
         {
  -        result = ((Boolean)val).booleanValue() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  +        result = ((Boolean) val).booleanValue()
  +                 ? XBoolean.S_TRUE : XBoolean.S_FALSE;
         }
  -      else if(val instanceof Double)
  +      else if (val instanceof Double)
         {
  -        result = new XNumber(((Double)val).doubleValue());
  +        result = new XNumber(((Double) val).doubleValue());
         }
  -      else if(val instanceof DocumentFragment)
  +      else if (val instanceof DocumentFragment)
         {
  -        result = new XRTreeFrag((DocumentFragment)val);
  +        result = new XRTreeFrag((DocumentFragment) val);
         }
  -      else if(val instanceof NodeIterator)
  +      else if (val instanceof NodeIterator)
         {
  -        result = new XNodeSet((NodeIterator)val);
  +        result = new XNodeSet((NodeIterator) val);
         }
  -      else if(val instanceof Node)
  +      else if (val instanceof Node)
         {
  -        result = new XNodeSet((Node)val);
  +        result = new XNodeSet((Node) val);
         }
         else
         {
  @@ -92,19 +177,32 @@
       {
         result = new XNull();
       }
  -    return result;
   
  +    return result;
     }
  -  
  -  
  +
  +  /**
  +   * NEEDSDOC Method setArg 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
     public void setArg(Expression arg, int argNum)
  -    throws WrongNumberArgsException
  +          throws WrongNumberArgsException
     {
       m_argVec.addElement(arg);
  -  }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  -  {
     }
  +
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException{}
   }
  
  
  
  1.2       +21 -12    xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunctionAvailable.java
  
  Index: FuncExtFunctionAvailable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncExtFunctionAvailable.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncExtFunctionAvailable.java	2000/07/05 14:46:35	1.1
  +++ FuncExtFunctionAvailable.java	2000/10/30 18:59:35	1.2
  @@ -54,12 +54,15 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xalan.extensions.ExtensionsTable;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,23 +74,29 @@
    */
   public class FuncExtFunctionAvailable extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {      
  -		String fullName = m_arg0.execute(xctxt).str();
  -		int indexOfNSSep = fullName.indexOf(':');
  -		String prefix = (indexOfNSSep >= 0) ? fullName.substring(0, indexOfNSSep) : "";
  -		String namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
  -		String methName = (indexOfNSSep < 0) ? fullName : fullName.substring(indexOfNSSep+1);
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
   
  +    String fullName = m_arg0.execute(xctxt).str();
  +    int indexOfNSSep = fullName.indexOf(':');
  +    String prefix = (indexOfNSSep >= 0)
  +                    ? fullName.substring(0, indexOfNSSep) : "";
  +    String namespace =
  +      xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
  +    String methName = (indexOfNSSep < 0)
  +                      ? fullName : fullName.substring(indexOfNSSep + 1);
       ExtensionsTable etable = xctxt.getExtensionsTable();
  -		return etable.functionAvailable(namespace, methName) 
  +
  +    return etable.functionAvailable(namespace, methName)
              ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  -	}
  +  }
   }
  
  
  
  1.2       +9 -5      xml-xalan/java/src/org/apache/xpath/functions/FuncFalse.java
  
  Index: FuncFalse.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncFalse.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncFalse.java	2000/07/05 14:46:35	1.1
  +++ FuncFalse.java	2000/10/30 18:59:35	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,15 +71,17 @@
    */
   public class FuncFalse extends Function
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {      
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return XBoolean.S_FALSE;
     }
   }
  
  
  
  1.2       +9 -5      xml-xalan/java/src/org/apache/xpath/functions/FuncFloor.java
  
  Index: FuncFloor.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncFloor.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncFloor.java	2000/07/05 14:46:38	1.1
  +++ FuncFloor.java	2000/10/30 18:59:35	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,15 +71,17 @@
    */
   public class FuncFloor extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {   
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return new XNumber(java.lang.Math.floor(m_arg0.execute(xctxt).num()));
     }
   }
  
  
  
  1.2       +29 -13    xml-xalan/java/src/org/apache/xpath/functions/FuncFormatNumber.java
  
  Index: FuncFormatNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncFormatNumber.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncFormatNumber.java	2000/07/05 14:46:40	1.1
  +++ FuncFormatNumber.java	2000/10/30 18:59:36	1.2
  @@ -54,11 +54,14 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -70,32 +73,45 @@
    */
   public class FuncFormatNumber extends Function3Args
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       double num = m_arg0.execute(xctxt).num();
       String formatStr = m_arg1.execute(xctxt).str();
  -    if(null != m_arg2)
  +
  +    if (null != m_arg2)
       {
  +
         // TODO: Myriam, implement this!
  -      warn(xctxt, XPATHErrorResources.WG_LOCALE_NAME_NOT_HANDLED, null); //"locale name in the format-number function not yet handled!");
  +      warn(xctxt, XPATHErrorResources.WG_LOCALE_NAME_NOT_HANDLED, null);  //"locale name in the format-number function not yet handled!");
       }
  +
  +    java.text.DecimalFormat formatter =
  +      new java.text.DecimalFormat(formatStr);
   
  -    java.text.DecimalFormat formatter = new java.text.DecimalFormat(formatStr);
       return new XString(formatter.format(num));
     }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum > 3)
  +    if (argNum > 3)
         throw new WrongNumberArgsException("2 or 3");
     }
  -
   }
  
  
  
  1.3       +13 -8     xml-xalan/java/src/org/apache/xpath/functions/FuncGenerateId.java
  
  Index: FuncGenerateId.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncGenerateId.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FuncGenerateId.java	2000/08/01 18:22:54	1.2
  +++ FuncGenerateId.java	2000/10/30 18:59:36	1.3
  @@ -54,11 +54,13 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -70,20 +72,23 @@
    */
   public class FuncGenerateId extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       Node which = getArg0AsNode(xctxt);
  -    
  -    if(null != which)
  +
  +    if (null != which)
         return new XString(xctxt.getDOMHelper().getUniqueID(which));
       else
  -     return XString.EMPTYSTRING; 
  +      return XString.EMPTYSTRING;
     }
   }
  
  
  
  1.2       +57 -32    xml-xalan/java/src/org/apache/xpath/functions/FuncId.java
  
  Index: FuncId.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncId.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncId.java	2000/07/05 14:46:40	1.1
  +++ FuncId.java	2000/10/30 18:59:37	1.2
  @@ -54,15 +54,19 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import java.util.Hashtable;
   import java.util.StringTokenizer;
  +
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.Document;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
   import org.apache.xpath.XPath;
  @@ -77,90 +81,111 @@
    */
   public class FuncId extends FunctionOneArg
   {
  -  private StringVector getNodesByID(XPathContext xctxt,
  -                                    Document docContext,
  -                                    String refval, StringVector usedrefs, 
  +
  +  /**
  +   * NEEDSDOC Method getNodesByID 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   * NEEDSDOC @param docContext
  +   * NEEDSDOC @param refval
  +   * NEEDSDOC @param usedrefs
  +   * NEEDSDOC @param nodeSet
  +   * NEEDSDOC @param mayBeMore
  +   *
  +   * NEEDSDOC (getNodesByID) @return
  +   */
  +  private StringVector getNodesByID(XPathContext xctxt, Document docContext,
  +                                    String refval, StringVector usedrefs,
                                       NodeSet nodeSet, boolean mayBeMore)
     {
  -    if(null != refval)
  +
  +    if (null != refval)
       {
         String ref = null;
         DOMHelper dh = xctxt.getDOMHelper();
         StringTokenizer tokenizer = new StringTokenizer(refval);
         boolean hasMore = tokenizer.hasMoreTokens();
  -      while(hasMore)
  +
  +      while (hasMore)
         {
           ref = tokenizer.nextToken();
           hasMore = tokenizer.hasMoreTokens();
  -        
  -        if((null != usedrefs) && usedrefs.contains(ref))
  +
  +        if ((null != usedrefs) && usedrefs.contains(ref))
           {
             ref = null;
  +
             continue;
           }
   
           Node node = dh.getElementByID(ref, docContext);
   
  -        if(null != node)
  +        if (null != node)
             nodeSet.addNodeInDocOrder(node, xctxt);
  -        
  -        if((null != ref) && (hasMore || mayBeMore))
  +
  +        if ((null != ref) && (hasMore || mayBeMore))
           {
  -          if(null == usedrefs)
  +          if (null == usedrefs)
               usedrefs = new StringVector();
  +
             usedrefs.addElement(ref);
           }
         }
       }
  -    
  +
       return usedrefs;
     }
  -  
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       Node context = xctxt.getCurrentNode();
  -    Document docContext = (Node.DOCUMENT_NODE == context.getNodeType()) 
  -                          ? (Document)context : context.getOwnerDocument();
  -    
  -    if(null == docContext)
  +    Document docContext = (Node.DOCUMENT_NODE == context.getNodeType())
  +                          ? (Document) context : context.getOwnerDocument();
  +
  +    if (null == docContext)
         error(xctxt, XPATHErrorResources.ER_CONTEXT_HAS_NO_OWNERDOC, null);
  -    
  +
       XObject arg = m_arg0.execute(xctxt);
  -    
       int argType = arg.getType();
  -         
       XNodeSet nodes = new XNodeSet();
       NodeSet nodeSet = nodes.mutableNodeset();
  -        
  -    if(XObject.CLASS_NODESET == argType)
  -    {      
  +
  +    if (XObject.CLASS_NODESET == argType)
  +    {
         NodeIterator ni = arg.nodeset();
         StringVector usedrefs = null;
         Node pos = ni.nextNode();
  -      while(null != pos)
  +
  +      while (null != pos)
         {
           String refval = DOMHelper.getNodeData(pos);
  +
           pos = ni.nextNode();
  -        usedrefs = getNodesByID(xctxt, docContext, refval, 
  -                                usedrefs, nodeSet, null != pos);
  +        usedrefs = getNodesByID(xctxt, docContext, refval, usedrefs, nodeSet,
  +                                null != pos);
         }
       }
  -    else if(XObject.CLASS_NULL == argType)
  +    else if (XObject.CLASS_NULL == argType)
       {
         return nodes;
       }
       else
       {
         String refval = arg.str();
  +
         getNodesByID(xctxt, docContext, refval, null, nodeSet, false);
       }
  +
       return nodes;
     }
   }
  
  
  
  1.2       +25 -12    xml-xalan/java/src/org/apache/xpath/functions/FuncLang.java
  
  Index: FuncLang.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncLang.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncLang.java	2000/07/05 14:46:40	1.1
  +++ FuncLang.java	2000/10/30 18:59:37	1.2
  @@ -54,11 +54,13 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.Element;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -70,37 +72,48 @@
    */
   public class FuncLang extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    String lang = m_arg0.execute(xctxt).str();
    Node parent = xctxt.getCurrentNode();
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    String lang = m_arg0.execute(xctxt).str();
  +    Node parent = xctxt.getCurrentNode();
       boolean isLang = false;
  -    while(null != parent)
  +
  +    while (null != parent)
       {
  -      if(Node.ELEMENT_NODE == parent.getNodeType())
  +      if (Node.ELEMENT_NODE == parent.getNodeType())
         {
  -        String langVal = ((Element)parent).getAttribute("xml:lang");
  -        if((null != langVal) && (langVal.length() > 0))
  +        String langVal = ((Element) parent).getAttribute("xml:lang");
  +
  +        if ((null != langVal) && (langVal.length() > 0))
           {
  -          if(langVal.toLowerCase().startsWith(lang.toLowerCase()))
  +          if (langVal.toLowerCase().startsWith(lang.toLowerCase()))
             {
               int valLen = lang.length();
  -            if((langVal.length() == valLen) || (langVal.charAt(valLen) == '-'))
  +
  +            if ((langVal.length() == valLen)
  +                    || (langVal.charAt(valLen) == '-'))
               {
                 isLang = true;
               }
             }
  +
             break;
           }
         }
  +
         parent = xctxt.getDOMHelper().getParentOfNode(parent);
       }
  +
       return isLang ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
   }
  
  
  
  1.2       +28 -14    xml-xalan/java/src/org/apache/xpath/functions/FuncLast.java
  
  Index: FuncLast.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncLast.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncLast.java	2000/07/05 14:46:40	1.1
  +++ FuncLast.java	2000/10/30 18:59:37	1.2
  @@ -54,11 +54,13 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -75,44 +77,56 @@
    */
   public class FuncLast extends Function
   {
  +
     /**
      * Get the position in the current context node list.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public int getCountOfContextNodeList(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       //    assert(null != m_contextNodeList, "m_contextNodeList must be non-null");
  -    
       // If we're in a predicate, then this will return non-null.
       SubContextList iter = xctxt.getSubContextList();
  -    
  -    if(null != iter)
  +
  +    if (null != iter)
         return iter.getLastPos(xctxt);
  -    
  +
       ContextNodeList cnl = xctxt.getContextNodeList();
  -    if(cnl.size() == 0)
  +
  +    if (cnl.size() == 0)
       {
         int currentPos = cnl.getCurrentPos();
  +
         // System.out.println("getCountOfContextNodeList - currentPos: "+currentPos);
  -      if(!cnl.isFresh())
  +      if (!cnl.isFresh())
           cnl.reset();
  +
         cnl.setShouldCacheNodes(true);
         cnl.runTo(-1);
         cnl.setCurrentPos(currentPos);
       }
  +
       // System.out.println("cnl.size(): "+cnl.size());
       return cnl.size();
     }
  -  
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    return new XNumber((double)getCountOfContextNodeList(xctxt));
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +    return new XNumber((double) getCountOfContextNodeList(xctxt));
     }
   }
  
  
  
  1.2       +14 -6     xml-xalan/java/src/org/apache/xpath/functions/FuncLocalPart.java
  
  Index: FuncLocalPart.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncLocalPart.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncLocalPart.java	2000/07/05 14:46:40	1.1
  +++ FuncLocalPart.java	2000/10/30 18:59:38	1.2
  @@ -54,12 +54,15 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,17 +74,22 @@
    */
   public class FuncLocalPart extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       Node context = getArg0AsNode(xctxt);
  +
       return new XString((context != null)
  -                       ? xctxt.getDOMHelper().getLocalNameOfNode(context) : "");
  +                       ? xctxt.getDOMHelper().getLocalNameOfNode(context)
  +                       : "");
     }
   }
  
  
  
  1.2       +14 -6     xml-xalan/java/src/org/apache/xpath/functions/FuncNamespace.java
  
  Index: FuncNamespace.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNamespace.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncNamespace.java	2000/07/05 14:46:40	1.1
  +++ FuncNamespace.java	2000/10/30 18:59:38	1.2
  @@ -54,12 +54,15 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,17 +74,22 @@
    */
   public class FuncNamespace extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       Node context = getArg0AsNode(xctxt);
  +
       return new XString((context != null)
  -                       ? xctxt.getDOMHelper().getNamespaceOfNode(context) : "");
  +                       ? xctxt.getDOMHelper().getNamespaceOfNode(context)
  +                       : "");
     }
   }
  
  
  
  1.3       +58 -34    xml-xalan/java/src/org/apache/xpath/functions/FuncNormalizeSpace.java
  
  Index: FuncNormalizeSpace.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNormalizeSpace.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FuncNormalizeSpace.java	2000/10/13 00:34:49	1.2
  +++ FuncNormalizeSpace.java	2000/10/30 18:59:38	1.3
  @@ -54,11 +54,14 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -66,21 +69,29 @@
   import org.apache.xpath.objects.XNodeSet;
   import org.apache.xalan.utils.XMLCharacterRecognizer;
   
  -public class FuncNormalizeSpace extends FunctionDef1Arg 
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class FuncNormalizeSpace <needs-comment/>
  + */
  +public class FuncNormalizeSpace extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       String s1 = getArg0AsString(xctxt);
  +
       return new XString(fixWhiteSpace(s1, true, true, false));
     }
  -    
  +
     /**
      * Returns whether the specified <var>ch</var> conforms to the XML 1.0 definition
      * of whitespace.  Refer to <A href="http://www.w3.org/TR/1998/REC-xml-19980210#NT-S">
  @@ -88,19 +99,19 @@
      * @param   ch      Character to check as XML whitespace.
      * @return          =true if <var>ch</var> is XML whitespace; otherwise =false.
      */
  -  private static boolean isSpace(char ch) 
  +  private static boolean isSpace(char ch)
     {
  -    return XMLCharacterRecognizer.isWhiteSpace(ch); // Take the easy way out for now.
  +    return XMLCharacterRecognizer.isWhiteSpace(ch);  // Take the easy way out for now.
     }
  -  
  +
     /**
      * (Code stolen and modified from XML4J)
  -   * Conditionally trim all leading and trailing whitespace in the specified String.  
  -   * All strings of white space are 
  -   * replaced by a single space character (#x20), except spaces after punctuation which 
  +   * Conditionally trim all leading and trailing whitespace in the specified String.
  +   * All strings of white space are
  +   * replaced by a single space character (#x20), except spaces after punctuation which
      * receive double spaces if doublePunctuationSpaces is true.
      * This function may be useful to a formatter, but to get first class
  -   * results, the formatter should probably do it's own white space handling 
  +   * results, the formatter should probably do it's own white space handling
      * based on the semantics of the formatting object.
      * @param   string      String to be trimmed.
      * @param   trimHead    Trim leading whitespace?
  @@ -108,41 +119,49 @@
      * @param   doublePunctuationSpaces    Use double spaces for punctuation?
      * @return              The trimmed string.
      */
  -  protected String fixWhiteSpace(String string, 
  -                              boolean trimHead, 
  -                              boolean trimTail, 
  -                              boolean doublePunctuationSpaces) 
  +  protected String fixWhiteSpace(String string, boolean trimHead,
  +                                 boolean trimTail,
  +                                 boolean doublePunctuationSpaces)
     {
  +
       char[] buf = string.toCharArray();
       int len = buf.length;
       boolean edit = false;
       int s;
  -    for (s = 0;  s < len;  s++) 
  +
  +    for (s = 0; s < len; s++)
       {
  -      if (isSpace(buf[s]))  
  +      if (isSpace(buf[s]))
         {
           break;
         }
       }
  +
       /* replace S to ' '. and ' '+ -> single ' '. */
       int d = s;
       boolean pres = false;
  -    for ( ;  s < len;  s ++) 
  +
  +    for (; s < len; s++)
       {
         char c = buf[s];
  -      if (isSpace(c)) 
  +
  +      if (isSpace(c))
         {
  -        if (!pres) 
  +        if (!pres)
           {
  -          if (' ' != c)  
  +          if (' ' != c)
             {
               edit = true;
             }
  +
             buf[d++] = ' ';
  -          if(doublePunctuationSpaces && (s != 0))
  +
  +          if (doublePunctuationSpaces && (s != 0))
             {
  -            char prevChar = buf[s-1];
  -            if(!((prevChar == '.') || (prevChar == '!') || (prevChar == '?')))
  +            char prevChar = buf[s - 1];
  +
  +            if (!((prevChar == '.') || (prevChar == '!')
  +                  || (prevChar == '?')))
               {
                 pres = true;
               }
  @@ -158,24 +177,29 @@
             pres = true;
           }
         }
  -      else 
  +      else
         {
           buf[d++] = c;
           pres = false;
         }
       }
  -    if (trimTail && 1 <= d && ' ' == buf[d-1]) 
  +
  +    if (trimTail && 1 <= d && ' ' == buf[d - 1])
       {
         edit = true;
  -      d --;
  +
  +      d--;
       }
  +
       int start = 0;
  -    if (trimHead && 0 < d && ' ' == buf[0]) 
  +
  +    if (trimHead && 0 < d && ' ' == buf[0])
       {
         edit = true;
  -      start ++;
  +
  +      start++;
       }
  -    return edit ? new String(buf, start, d-start) : string;
  -  }
   
  +    return edit ? new String(buf, start, d - start) : string;
  +  }
   }
  
  
  
  1.2       +9 -5      xml-xalan/java/src/org/apache/xpath/functions/FuncNot.java
  
  Index: FuncNot.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNot.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncNot.java	2000/07/05 14:46:40	1.1
  +++ FuncNot.java	2000/10/30 18:59:39	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,15 +71,17 @@
    */
   public class FuncNot extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return m_arg0.execute(xctxt).bool() ? XBoolean.S_FALSE : XBoolean.S_TRUE;
     }
   }
  
  
  
  1.2       +10 -5     xml-xalan/java/src/org/apache/xpath/functions/FuncNumber.java
  
  Index: FuncNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncNumber.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncNumber.java	2000/07/05 14:46:40	1.1
  +++ FuncNumber.java	2000/10/30 18:59:39	1.2
  @@ -54,11 +54,14 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,15 +74,17 @@
    */
   public class FuncNumber extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return new XNumber(getArg0AsNumber(xctxt));
     }
   }
  
  
  
  1.2       +24 -13    xml-xalan/java/src/org/apache/xpath/functions/FuncPosition.java
  
  Index: FuncPosition.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncPosition.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncPosition.java	2000/07/05 14:46:40	1.1
  +++ FuncPosition.java	2000/10/30 18:59:39	1.2
  @@ -54,11 +54,13 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -73,43 +75,52 @@
    */
   public class FuncPosition extends Function
   {
  +
     /**
      * Get the position in the current context node list.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getPositionInContextNodeList(XPathContext xctxt)
     {
  +
       // System.out.println("FuncPosition- entry");
  -    
       // If we're in a predicate, then this will return non-null.
       SubContextList iter = xctxt.getSubContextList();
  -    
  -    if(null != iter)
  +
  +    if (null != iter)
       {
         int prox = iter.getProximityPosition(xctxt);
  +
         // System.out.println("FuncPosition- prox: "+prox);
         return prox;
       }
  -    
  -    ContextNodeList cnl = (ContextNodeList)xctxt.getContextNodeList();
  -    if(null != cnl)
  +
  +    ContextNodeList cnl = (ContextNodeList) xctxt.getContextNodeList();
  +
  +    if (null != cnl)
       {
  +
         // System.out.println("FuncPosition- cnl.getCurrentPos(): "+cnl.getCurrentPos());
         return cnl.getCurrentPos();
       }
  -    
  +
       // System.out.println("FuncPosition - out of guesses: -1");
       return -1;
     }
   
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    return new XNumber((double)getPositionInContextNodeList(xctxt));
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +    return new XNumber((double) getPositionInContextNodeList(xctxt));
     }
   }
  
  
  
  1.2       +25 -15    xml-xalan/java/src/org/apache/xpath/functions/FuncQname.java
  
  Index: FuncQname.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncQname.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncQname.java	2000/07/05 14:46:40	1.1
  +++ FuncQname.java	2000/10/30 18:59:40	1.2
  @@ -54,13 +54,16 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.Attr;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -73,41 +76,47 @@
    */
   public class FuncQname extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       Node context = getArg0AsNode(xctxt);
       XObject val;
  -    if(null != context)
  +
  +    if (null != context)
       {
  -      int ntype = context.getNodeType();
  -      if(ntype == Node.ATTRIBUTE_NODE)
  +      short ntype = context.getNodeType();
  +
  +      if (ntype == Node.ATTRIBUTE_NODE)
         {
  -        String qname = ((Attr)context).getName();
  -        if(xctxt.getDOMHelper().isNamespaceNode(context))
  +        String qname = ((Attr) context).getName();
  +
  +        if (xctxt.getDOMHelper().isNamespaceNode(context))
           {
  -          if(qname.equals("xmlns"))
  +          if (qname.equals("xmlns"))
               val = XString.EMPTYSTRING;
             else
             {
               qname = QName.getLocalPart(qname);
  -            val = (null == qname) ? XString.EMPTYSTRING :
  -                                    new XString(qname);
  +            val = (null == qname) ? XString.EMPTYSTRING : new XString(qname);
             }
           }
           else
             val = new XString(qname);
         }
  -      else if((ntype == Node.ELEMENT_NODE) 
  -         || (ntype == Node.PROCESSING_INSTRUCTION_NODE))
  +      else if ((ntype == Node.ELEMENT_NODE)
  +               || (ntype == Node.PROCESSING_INSTRUCTION_NODE))
         {
           String qname = context.getNodeName();
  +
           val = new XString(qname);
         }
         else
  @@ -119,6 +128,7 @@
       {
         val = XString.EMPTYSTRING;
       }
  +
       return val;
     }
   }
  
  
  
  1.2       +11 -6     xml-xalan/java/src/org/apache/xpath/functions/FuncRound.java
  
  Index: FuncRound.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncRound.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncRound.java	2000/07/05 14:46:40	1.1
  +++ FuncRound.java	2000/10/30 18:59:40	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,15 +71,18 @@
    */
   public class FuncRound extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    return new XNumber(java.lang.Math.floor(m_arg0.execute(xctxt).num() + 0.5));
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +    return new XNumber(java.lang.Math.floor(m_arg0.execute(xctxt).num()
  +                                            + 0.5));
     }
   }
  
  
  
  1.2       +10 -6     xml-xalan/java/src/org/apache/xpath/functions/FuncStartsWith.java
  
  Index: FuncStartsWith.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncStartsWith.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncStartsWith.java	2000/07/05 14:46:40	1.1
  +++ FuncStartsWith.java	2000/10/30 18:59:40	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,16 +71,18 @@
    */
   public class FuncStartsWith extends Function2Args
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    return m_arg0.execute(xctxt).str().startsWith(m_arg1.execute(xctxt).str()) 
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +    return m_arg0.execute(xctxt).str().startsWith(m_arg1.execute(xctxt).str())
              ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
   }
  
  
  
  1.2       +10 -5     xml-xalan/java/src/org/apache/xpath/functions/FuncString.java
  
  Index: FuncString.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncString.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncString.java	2000/07/05 14:46:40	1.1
  +++ FuncString.java	2000/10/30 18:59:41	1.2
  @@ -54,11 +54,14 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,15 +74,17 @@
    */
   public class FuncString extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return new XString(getArg0AsString(xctxt));
     }
   }
  
  
  
  1.2       +10 -5     xml-xalan/java/src/org/apache/xpath/functions/FuncStringLength.java
  
  Index: FuncStringLength.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncStringLength.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncStringLength.java	2000/07/05 14:46:45	1.1
  +++ FuncStringLength.java	2000/10/30 18:59:41	1.2
  @@ -54,11 +54,14 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -71,15 +74,17 @@
    */
   public class FuncStringLength extends FunctionDef1Arg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return new XNumber(getArg0AsString(xctxt).length());
     }
   }
  
  
  
  1.2       +38 -23    xml-xalan/java/src/org/apache/xpath/functions/FuncSubstring.java
  
  Index: FuncSubstring.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSubstring.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncSubstring.java	2000/07/05 14:46:45	1.1
  +++ FuncSubstring.java	2000/10/30 18:59:42	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,48 +71,54 @@
    */
   public class FuncSubstring extends Function3Args
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    String s1 = m_arg0.execute(xctxt).str();
    double start = m_arg1.execute(xctxt).num();
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    String s1 = m_arg0.execute(xctxt).str();
  +    double start = m_arg1.execute(xctxt).num();
       int lenOfS1 = s1.length();
       String substr;
  -    if(lenOfS1 <= 0)
  +
  +    if (lenOfS1 <= 0)
         return XString.EMPTYSTRING;
       else
       {
  -      
         int startIndex;
  -      if(Double.isNaN(start))
  +
  +      if (Double.isNaN(start))
         {
  +
           // Double.MIN_VALUE doesn't work with math below 
           // so just use a big number and hope I never get caught.
  -        start = -1000000;  
  +        start = -1000000;
           startIndex = 0;
         }
         else
         {
           start = Math.round(start);
  -        startIndex = (start > 0) ? (int)start-1 : 0;
  +        startIndex = (start > 0) ? (int) start - 1 : 0;
         }
  -      
  -      if(null != m_arg2)
  +
  +      if (null != m_arg2)
         {
           double len = m_arg2.execute(xctxt).num();
  -        int end = (int)(Math.round(len)+start)-1;
  -        
  +        int end = (int) (Math.round(len) + start) - 1;
  +
           // Normalize end index.
  -        if(end < 0)
  +        if (end < 0)
             end = 0;
  -        else if(end > lenOfS1)
  +        else if (end > lenOfS1)
             end = lenOfS1;
  -        
  +
           substr = s1.substring(startIndex, end);
         }
         else
  @@ -118,14 +126,21 @@
           substr = s1.substring(startIndex);
         }
       }
  +
       return new XString(substr);
     }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum < 2)
  +    if (argNum < 2)
         throw new WrongNumberArgsException("2 or 3");
     }
  -
   }
  
  
  
  1.2       +17 -7     xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringAfter.java
  
  Index: FuncSubstringAfter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringAfter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncSubstringAfter.java	2000/07/05 14:46:45	1.1
  +++ FuncSubstringAfter.java	2000/10/30 18:59:42	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,16 +71,24 @@
    */
   public class FuncSubstringAfter extends Function2Args
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    String s1 = m_arg0.execute(xctxt).str();
    String s2 = m_arg1.execute(xctxt).str();
    int index = s1.indexOf(s2);
  -    return (-1 == index) ? XString.EMPTYSTRING : new XString(s1.substring(index+s2.length()));
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    String s1 = m_arg0.execute(xctxt).str();
  +    String s2 = m_arg1.execute(xctxt).str();
  +    int index = s1.indexOf(s2);
  +
  +    return (-1 == index)
  +           ? XString.EMPTYSTRING
  +           : new XString(s1.substring(index + s2.length()));
     }
   }
  
  
  
  1.2       +16 -7     xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringBefore.java
  
  Index: FuncSubstringBefore.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSubstringBefore.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncSubstringBefore.java	2000/07/05 14:46:45	1.1
  +++ FuncSubstringBefore.java	2000/10/30 18:59:42	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,16 +71,23 @@
    */
   public class FuncSubstringBefore extends Function2Args
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    String s1 = m_arg0.execute(xctxt).str();
    String s2 = m_arg1.execute(xctxt).str();
    int index = s1.indexOf(s2);
  -    return (-1 == index) ? XString.EMPTYSTRING : new XString(s1.substring(0,  index));
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    String s1 = m_arg0.execute(xctxt).str();
  +    String s2 = m_arg1.execute(xctxt).str();
  +    int index = s1.indexOf(s2);
  +
  +    return (-1 == index)
  +           ? XString.EMPTYSTRING : new XString(s1.substring(0, index));
     }
   }
  
  
  
  1.2       +17 -8     xml-xalan/java/src/org/apache/xpath/functions/FuncSum.java
  
  Index: FuncSum.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSum.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncSum.java	2000/07/05 14:46:45	1.1
  +++ FuncSum.java	2000/10/30 18:59:45	1.2
  @@ -54,11 +54,13 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.DOMHelper;
   import org.apache.xpath.XPath;
  @@ -72,23 +74,30 @@
    */
   public class FuncSum extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -    NodeIterator nodes = m_arg0.execute(xctxt).nodeset();
    double sum = 0.0;
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    NodeIterator nodes = m_arg0.execute(xctxt).nodeset();
  +    double sum = 0.0;
       Node pos;
  -    while(null != (pos = nodes.nextNode()))
  +
  +    while (null != (pos = nodes.nextNode()))
       {
         String s = DOMHelper.getNodeData(pos);
  -      if(null != s) 
  +
  +      if (null != s)
           sum += XString.castToNum(s);
       }
  +
       return new XNumber(sum);
     }
   }
  
  
  
  1.2       +85 -42    xml-xalan/java/src/org/apache/xpath/functions/FuncSystemProperty.java
  
  Index: FuncSystemProperty.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncSystemProperty.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncSystemProperty.java	2000/07/05 14:46:46	1.1
  +++ FuncSystemProperty.java	2000/10/30 18:59:45	1.2
  @@ -54,16 +54,22 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import java.util.Properties;
  +
   import java.io.BufferedInputStream;
   import java.io.InputStream;
  +
   import java.lang.ClassLoader;
  +
   import org.apache.xalan.utils.PrefixResolver;
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -76,56 +82,76 @@
    */
   public class FuncSystemProperty extends FunctionOneArg
   {
  -  Properties xsltInfo = new Properties ();
  +
  +  /** NEEDSDOC Field xsltInfo          */
  +  Properties xsltInfo = new Properties();
  +
  +  /** NEEDSDOC Field XSLT_PROPERTIES          */
     static String XSLT_PROPERTIES = "/org/apache/xalan/res/XSLTInfo.properties";
  -  
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       String fullName = m_arg0.execute(xctxt).str();
       int indexOfNSSep = fullName.indexOf(':');
       String result;
  -    String propName= "";
  +    String propName = "";
  +
       loadPropertyFile(XSLT_PROPERTIES, xsltInfo);
  -    if(indexOfNSSep > 0)
  +
  +    if (indexOfNSSep > 0)
       {
  -      String prefix = (indexOfNSSep >= 0) ? fullName.substring(0, indexOfNSSep) : "";
  +      String prefix = (indexOfNSSep >= 0)
  +                      ? fullName.substring(0, indexOfNSSep) : "";
         String namespace;
  +
         namespace = xctxt.getNamespaceContext().getNamespaceForPrefix(prefix);
  -      propName = (indexOfNSSep < 0) ? fullName 
  -                                             : fullName.substring(indexOfNSSep+1);
  -      
  -      if(namespace.startsWith("http://www.w3.org/XSL/Transform") ||
  -         namespace.equals("http://www.w3.org/1999/XSL/Transform"))
  +      propName = (indexOfNSSep < 0)
  +                 ? fullName : fullName.substring(indexOfNSSep + 1);
  +
  +      if (namespace.startsWith("http://www.w3.org/XSL/Transform")
  +              || namespace.equals("http://www.w3.org/1999/XSL/Transform"))
         {
           result = xsltInfo.getProperty(propName);
  +
           if (null == result)
           {
  -			    warn(xctxt, XPATHErrorResources.WG_PROPERTY_NOT_SUPPORTED, new Object[] {fullName}); //"XSL Property not supported: "+fullName);
  +          warn(xctxt, XPATHErrorResources.WG_PROPERTY_NOT_SUPPORTED,
  +               new Object[]{ fullName });  //"XSL Property not supported: "+fullName);
  +
             return XString.EMPTYSTRING;
           }
         }
         else
         {
  -        warn(xctxt, XPATHErrorResources.WG_DONT_DO_ANYTHING_WITH_NS, new Object[] {namespace, fullName}); //"Don't currently do anything with namespace "+namespace+" in property: "+fullName);
  +        warn(xctxt, XPATHErrorResources.WG_DONT_DO_ANYTHING_WITH_NS,
  +             new Object[]{ namespace,
  +                           fullName });  //"Don't currently do anything with namespace "+namespace+" in property: "+fullName);
  +
           try
           {
             result = System.getProperty(propName);
  -          if(null == result)
  +
  +          if (null == result)
             {
  +
               // result = System.getenv(propName);
               return XString.EMPTYSTRING;
             }
           }
  -        catch(SecurityException se)
  +        catch (SecurityException se)
           {
  -          warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION, new Object[] {fullName}); //"SecurityException when trying to access XSL system property: "+fullName);
  +          warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION,
  +               new Object[]{ fullName });  //"SecurityException when trying to access XSL system property: "+fullName);
  +
             return XString.EMPTYSTRING;
           }
         }
  @@ -135,20 +161,25 @@
         try
         {
           result = System.getProperty(fullName);
  -        if(null == result)
  +
  +        if (null == result)
           {
  +
             // result = System.getenv(fullName);
             return XString.EMPTYSTRING;
           }
         }
  -      catch(SecurityException se)
  +      catch (SecurityException se)
         {
  -        warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION, new Object[] {fullName}); //"SecurityException when trying to access XSL system property: "+fullName);
  +        warn(xctxt, XPATHErrorResources.WG_SECURITY_EXCEPTION,
  +             new Object[]{ fullName });  //"SecurityException when trying to access XSL system property: "+fullName);
  +
           return XString.EMPTYSTRING;
         }
       }
  -    if (propName.equals("version") && result.length()>0)
  -    {  
  +
  +    if (propName.equals("version") && result.length() > 0)
  +    {
         try
         {
           return new XNumber(new Double(result).doubleValue());
  @@ -156,31 +187,43 @@
         catch (Exception ex)
         {
           return new XString(result);
  -      }    
  -    }      
  -    else  
  +      }
  +    }
  +    else
         return new XString(result);
     }
  -  
  -/*
  - * Retrieve a propery bundle from a specified file
  - * @param file The string name of the property file.  The file is loaded from the workplace base directory
  - * @param target The target property bag the file will be placed into.
  - */
  -  public void loadPropertyFile (String file, Properties target) 
  +
  +  /*
  +   * Retrieve a propery bundle from a specified file
  +   * @param file The string name of the property file.  The file is loaded from the workplace base directory
  +   * @param target The target property bag the file will be placed into.
  +   */
  +
  +  /**
  +   * NEEDSDOC Method loadPropertyFile 
  +   *
  +   *
  +   * NEEDSDOC @param file
  +   * NEEDSDOC @param target
  +   */
  +  public void loadPropertyFile(String file, Properties target)
     {
  +
       InputStream is;
  +
       try
  -    {   		   
  -      is= getClass().getResourceAsStream(file);      
  -                                                           // get a buffered version
  -      BufferedInputStream bis = new BufferedInputStream (is);
  -      target.load (bis);                                     // and load up the property bag from this
  -      bis.close ();                                          // close out after reading
  +    {
  +      is = getClass().getResourceAsStream(file);
  +
  +      // get a buffered version
  +      BufferedInputStream bis = new BufferedInputStream(is);
  +
  +      target.load(bis);  // and load up the property bag from this
  +      bis.close();  // close out after reading
       }
       catch (Exception ex)
       {
         ex.printStackTrace();
  -    }  
  +    }
     }
   }
  
  
  
  1.2       +48 -41    xml-xalan/java/src/org/apache/xpath/functions/FuncTranslate.java
  
  Index: FuncTranslate.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncTranslate.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncTranslate.java	2000/07/05 14:46:46	1.1
  +++ FuncTranslate.java	2000/10/30 18:59:46	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -70,53 +72,58 @@
    */
   public class FuncTranslate extends Function3Args
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  -		String		theFirstString = m_arg0.execute(xctxt).str();
  -		String		theSecondString = m_arg1.execute(xctxt).str();
  -		String		theThirdString = m_arg2.execute(xctxt).str();
  -
  -		int			theFirstStringLength = theFirstString.length();
  -		int			theThirdStringLength = theThirdString.length();
  -
  -		// A vector to contain the new characters.  We'll use it to construct
  -		// the result string.
  -		StringBuffer sbuffer = new StringBuffer();
  -
  -		for (int i = 0; i < theFirstStringLength; i++)
  -		{
  -			char theCurrentChar = theFirstString.charAt(i);
  -
  -			int		theIndex = theSecondString.indexOf(theCurrentChar);
  -
  -			if (theIndex < 0)
  -			{
  -				// Didn't find the character in the second string, so it
  -				// is not translated.
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
  +    String theFirstString = m_arg0.execute(xctxt).str();
  +    String theSecondString = m_arg1.execute(xctxt).str();
  +    String theThirdString = m_arg2.execute(xctxt).str();
  +    int theFirstStringLength = theFirstString.length();
  +    int theThirdStringLength = theThirdString.length();
  +
  +    // A vector to contain the new characters.  We'll use it to construct
  +    // the result string.
  +    StringBuffer sbuffer = new StringBuffer();
  +
  +    for (int i = 0; i < theFirstStringLength; i++)
  +    {
  +      char theCurrentChar = theFirstString.charAt(i);
  +      int theIndex = theSecondString.indexOf(theCurrentChar);
  +
  +      if (theIndex < 0)
  +      {
  +
  +        // Didn't find the character in the second string, so it
  +        // is not translated.
           sbuffer.append(theCurrentChar);
  -			}
  -			else if (theIndex < theThirdStringLength)
  -			{
  -				// OK, there's a corresponding character in the
  -				// third string, so do the translation...
  +      }
  +      else if (theIndex < theThirdStringLength)
  +      {
  +
  +        // OK, there's a corresponding character in the
  +        // third string, so do the translation...
           sbuffer.append(theThirdString.charAt(theIndex));
  -			}
  -			else
  -			{
  -				// There's no corresponding character in the
  -				// third string, since it's shorter than the
  -				// second string.  In this case, the character
  -				// is removed from the output string, so don't
  -				// do anything.
  -			}
  -		}
  +      }
  +      else
  +      {
  +
  +        // There's no corresponding character in the
  +        // third string, since it's shorter than the
  +        // second string.  In this case, the character
  +        // is removed from the output string, so don't
  +        // do anything.
  +      }
  +    }
  +
       return new XString(sbuffer.toString());
     }
   }
  
  
  
  1.2       +9 -5      xml-xalan/java/src/org/apache/xpath/functions/FuncTrue.java
  
  Index: FuncTrue.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncTrue.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncTrue.java	2000/07/05 14:46:46	1.1
  +++ FuncTrue.java	2000/10/30 18:59:46	1.2
  @@ -54,10 +54,12 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -69,15 +71,17 @@
    */
   public class FuncTrue extends Function
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
       return XBoolean.S_TRUE;
     }
   }
  
  
  
  1.2       +14 -8     xml-xalan/java/src/org/apache/xpath/functions/FuncUnparsedEntityURI.java
  
  Index: FuncUnparsedEntityURI.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FuncUnparsedEntityURI.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FuncUnparsedEntityURI.java	2000/07/05 14:46:46	1.1
  +++ FuncUnparsedEntityURI.java	2000/10/30 18:59:47	1.2
  @@ -54,12 +54,15 @@
    * information on the Apache Software Foundation, please see
    * <http://www.apache.org/>.
    */
  -package org.apache.xpath.functions; 
  +package org.apache.xpath.functions;
   
   import org.apache.xpath.res.XPATHErrorResources;
  +
   import org.w3c.dom.Node;
   import org.w3c.dom.Document;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -70,21 +73,24 @@
    */
   public class FuncUnparsedEntityURI extends FunctionOneArg
   {
  +
     /**
  -   * Execute the function.  The function must return 
  +   * Execute the function.  The function must return
      * a valid object.
      * @param xctxt The current execution context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  -  {    
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
  +  {
  +
       String name = m_arg0.execute(xctxt).str();
       Node context = xctxt.getCurrentNode();
  -    Document doc = (Node.DOCUMENT_NODE == context.getNodeType()) 
  -                   ? ((Document)context) :
  -                     context.getOwnerDocument();
  +    Document doc = (Node.DOCUMENT_NODE == context.getNodeType())
  +                   ? ((Document) context) : context.getOwnerDocument();
       String uri = xctxt.getDOMHelper().getUnparsedEntityURI(name, doc);
  +
       return new XString(uri);
     }
   }
  
  
  
  1.2       +39 -18    xml-xalan/java/src/org/apache/xpath/functions/Function.java
  
  Index: Function.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/Function.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Function.java	2000/07/05 14:46:46	1.1
  +++ Function.java	2000/10/30 18:59:47	1.2
  @@ -57,7 +57,9 @@
   package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import java.util.Vector;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.XPath;
   import org.apache.xpath.objects.XObject;
  @@ -65,41 +67,60 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * This is a superclass of all XPath functions.  This allows two 
  - * ways for the class to be called. One method is that the 
  - * super class processes the arguments and hands the results to 
  - * the derived class, the other method is that the derived 
  - * class may process it's own arguments, which is faster since 
  - * the arguments don't have to be added to an array, but causes 
  + * This is a superclass of all XPath functions.  This allows two
  + * ways for the class to be called. One method is that the
  + * super class processes the arguments and hands the results to
  + * the derived class, the other method is that the derived
  + * class may process it's own arguments, which is faster since
  + * the arguments don't have to be added to an array, but causes
    * a larger code footprint.
    */
   public class Function extends Expression
  -{  
  +{
  +
  +  /**
  +   * NEEDSDOC Method setArg 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
     public void setArg(Expression arg, int argNum)
  -    throws WrongNumberArgsException
  +          throws WrongNumberArgsException
     {
  -      throw new WrongNumberArgsException("0");
  +    throw new WrongNumberArgsException("0");
     }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum != 0)
  +    if (argNum != 0)
         throw new WrongNumberArgsException("0");
     }
  -  
  +
     /**
  -   * Execute an XPath function object.  The function must return 
  +   * Execute an XPath function object.  The function must return
      * a valid object.
      * @param xctxt The execution current context.
      * @return A valid XObject.
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       // Programmer's assert.  (And, no, I don't want the method to be abstract).
       System.out.println("Error! Function.execute should not be called!");
  +
       return null;
     }
  -      
   }
  
  
  
  1.2       +93 -9     xml-xalan/java/src/org/apache/xpath/functions/Function2Args.java
  
  Index: Function2Args.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/Function2Args.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Function2Args.java	2000/07/05 14:46:46	1.1
  +++ Function2Args.java	2000/10/30 18:59:48	1.2
  @@ -1,33 +1,117 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.functions;
   
   import org.apache.xpath.Expression;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Function2Args <needs-comment/>
  + */
   public class Function2Args extends FunctionOneArg
   {
  +
  +  /** NEEDSDOC Field m_arg1          */
     Expression m_arg1;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getArg1 
  +   *
  +   *
  +   * NEEDSDOC (getArg1) @return
  +   */
     public Expression getArg1()
     {
       return m_arg1;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setArg 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
     public void setArg(Expression arg, int argNum)
  -    throws WrongNumberArgsException
  +          throws WrongNumberArgsException
     {
  +
       // System.out.println("argNum: "+argNum);
  -    if(argNum == 0)
  +    if (argNum == 0)
         super.setArg(arg, argNum);
  -    else if(1 == argNum)
  +    else if (1 == argNum)
         m_arg1 = arg;
       else
         throw new WrongNumberArgsException("2");
  -
     }
   
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum != 2)
  +    if (argNum != 2)
         throw new WrongNumberArgsException("2");
     }
   }
  
  
  
  1.3       +94 -10    xml-xalan/java/src/org/apache/xpath/functions/Function3Args.java
  
  Index: Function3Args.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/Function3Args.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Function3Args.java	2000/07/30 22:37:34	1.2
  +++ Function3Args.java	2000/10/30 18:59:48	1.3
  @@ -1,32 +1,116 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.functions;
   
   import org.apache.xpath.Expression;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Function3Args <needs-comment/>
  + */
   public class Function3Args extends Function2Args
   {
  +
  +  /** NEEDSDOC Field m_arg2          */
     Expression m_arg2;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getArg2 
  +   *
  +   *
  +   * NEEDSDOC (getArg2) @return
  +   */
     public Expression getArg2()
     {
       return m_arg2;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setArg 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
     public void setArg(Expression arg, int argNum)
  -    throws WrongNumberArgsException
  +          throws WrongNumberArgsException
     {
  -    if(argNum < 2)
  +
  +    if (argNum < 2)
         super.setArg(arg, argNum);
  -    else if(2 == argNum)
  +    else if (2 == argNum)
         m_arg2 = arg;
       else
         throw new WrongNumberArgsException("3");
     }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum != 3)
  +    if (argNum != 3)
         throw new WrongNumberArgsException("3");
     }
  -
   }
  
  
  
  1.2       +117 -13   xml-xalan/java/src/org/apache/xpath/functions/FunctionDef1Arg.java
  
  Index: FunctionDef1Arg.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FunctionDef1Arg.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FunctionDef1Arg.java	2000/07/05 14:46:48	1.1
  +++ FunctionDef1Arg.java	2000/10/30 18:59:49	1.2
  @@ -1,38 +1,142 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.functions;
   
   import org.w3c.dom.Node;
  +
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.objects.XNodeSet;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class FunctionDef1Arg <needs-comment/>
  + */
   public class FunctionDef1Arg extends FunctionOneArg
   {
  +
  +  /**
  +   * NEEDSDOC Method getArg0AsNode 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getArg0AsNode) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     protected Node getArg0AsNode(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return (null == m_arg0) ? xctxt.getCurrentNode() 
  -                              : m_arg0.execute(xctxt).nodeset().nextNode();
  +
  +    return (null == m_arg0)
  +           ? xctxt.getCurrentNode()
  +           : m_arg0.execute(xctxt).nodeset().nextNode();
     }
   
  +  /**
  +   * NEEDSDOC Method getArg0AsString 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getArg0AsString) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     protected String getArg0AsString(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return (null == m_arg0) ? XNodeSet.getStringFromNode(xctxt.getCurrentNode() )
  -                              : m_arg0.execute(xctxt).str();
  +
  +    return (null == m_arg0)
  +           ? XNodeSet.getStringFromNode(xctxt.getCurrentNode())
  +           : m_arg0.execute(xctxt).str();
     }
   
  +  /**
  +   * NEEDSDOC Method getArg0AsNumber 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getArg0AsNumber) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     protected double getArg0AsNumber(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return (null == m_arg0) ? XNodeSet.getNumberFromNode(xctxt.getCurrentNode())
  -                              : m_arg0.execute(xctxt).num();
  +
  +    return (null == m_arg0)
  +           ? XNodeSet.getNumberFromNode(xctxt.getCurrentNode())
  +           : m_arg0.execute(xctxt).num();
     }
   
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum > 1)
  +    if (argNum > 1)
         throw new WrongNumberArgsException("0 or 1");
     }
  -
   }
  
  
  
  1.3       +95 -17    xml-xalan/java/src/org/apache/xpath/functions/FunctionMultiArgs.java
  
  Index: FunctionMultiArgs.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FunctionMultiArgs.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FunctionMultiArgs.java	2000/08/09 17:51:54	1.2
  +++ FunctionMultiArgs.java	2000/10/30 18:59:49	1.3
  @@ -1,38 +1,116 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.functions;
   
   import org.apache.xpath.Expression;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class FunctionMultiArgs <needs-comment/>
  + */
   public class FunctionMultiArgs extends Function3Args
   {
  +
  +  /** NEEDSDOC Field m_args          */
     Expression[] m_args;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setArg 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
     public void setArg(Expression arg, int argNum)
  -    throws WrongNumberArgsException
  +          throws WrongNumberArgsException
     {
  -    if(argNum < 3)
  +
  +    if (argNum < 3)
         super.setArg(arg, argNum);
  -    else 
  -    {                  
  -      if(null == m_args)
  -      {    
  +    else
  +    {
  +      if (null == m_args)
  +      {
           m_args = new Expression[1];
           m_args[0] = arg;
  -      }  
  +      }
         else
  -      { 
  +      {
  +
           // Slow but space conservative.
  -        Expression[] args = new Expression[m_args.length+1];      
  +        Expression[] args = new Expression[m_args.length + 1];
  +
           System.arraycopy(m_args, 0, args, 0, m_args.length);
  +
           args[m_args.length] = arg;
           m_args = args;
         }
  -    }  
  +    }
     }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  -  {
  -  }
   
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException{}
   }
  -
  
  
  
  1.2       +91 -7     xml-xalan/java/src/org/apache/xpath/functions/FunctionOneArg.java
  
  Index: FunctionOneArg.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/FunctionOneArg.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- FunctionOneArg.java	2000/07/05 14:46:48	1.1
  +++ FunctionOneArg.java	2000/10/30 18:59:50	1.2
  @@ -1,30 +1,114 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.functions;
   
   import org.apache.xpath.Expression;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class FunctionOneArg <needs-comment/>
  + */
   public class FunctionOneArg extends Function
   {
  +
  +  /** NEEDSDOC Field m_arg0          */
     Expression m_arg0;
   
  +  /**
  +   * NEEDSDOC Method getArg0 
  +   *
  +   *
  +   * NEEDSDOC (getArg0) @return
  +   */
     public Expression getArg0()
     {
       return m_arg0;
     }
   
  +  /**
  +   * NEEDSDOC Method setArg 
  +   *
  +   *
  +   * NEEDSDOC @param arg
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
     public void setArg(Expression arg, int argNum)
  -    throws WrongNumberArgsException
  +          throws WrongNumberArgsException
     {
  -    if(0 == argNum)
  +
  +    if (0 == argNum)
         m_arg0 = arg;
       else
         throw new WrongNumberArgsException("1");
     }
  -  
  -  public void checkNumberArgs(int argNum)
  -    throws WrongNumberArgsException
  +
  +  /**
  +   * NEEDSDOC Method checkNumberArgs 
  +   *
  +   *
  +   * NEEDSDOC @param argNum
  +   *
  +   * @throws WrongNumberArgsException
  +   */
  +  public void checkNumberArgs(int argNum) throws WrongNumberArgsException
     {
  -    if(argNum != 1)
  +    if (argNum != 1)
         throw new WrongNumberArgsException("1");
     }
  -
   }
  
  
  
  1.2       +71 -1     xml-xalan/java/src/org/apache/xpath/functions/WrongNumberArgsException.java
  
  Index: WrongNumberArgsException.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/functions/WrongNumberArgsException.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- WrongNumberArgsException.java	2000/07/05 14:46:48	1.1
  +++ WrongNumberArgsException.java	2000/10/30 18:59:50	1.2
  @@ -1,12 +1,82 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.functions;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class WrongNumberArgsException <needs-comment/>
  + */
   public class WrongNumberArgsException extends Exception
   {
  +
  +  /** NEEDSDOC Field m_argsExpected          */
     public String m_argsExpected;
  -  
  +
  +  /**
  +   * Constructor WrongNumberArgsException
  +   *
  +   *
  +   * NEEDSDOC @param argsExpected
  +   */
     public WrongNumberArgsException(String argsExpected)
     {
  +
       super();
  +
       m_argsExpected = argsExpected;
     }
   }
  
  
  
  1.4       +36 -12    xml-xalan/java/src/org/apache/xpath/objects/XBoolean.java
  
  Index: XBoolean.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XBoolean.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XBoolean.java	2000/10/29 22:29:58	1.3
  +++ XBoolean.java	2000/10/30 19:00:23	1.4
  @@ -60,52 +60,65 @@
   
   /**
    * <meta name="usage" content="advanced"/>
  - * This class represents an XPath boolean object, and is capable of 
  + * This class represents an XPath boolean object, and is capable of
    * converting the boolean to other types, such as a string.
    */
   public class XBoolean extends XObject
   {
  +
     /**
      * <meta name="usage" content="internal"/>
      * A true boolean object so we don't have to keep creating them.
      */
     public static XBoolean S_TRUE = new XBooleanStatic(true);
  -  
  +
     /**
      * <meta name="usage" content="internal"/>
      * A true boolean object so we don't have to keep creating them.
      */
     public static XBoolean S_FALSE = new XBooleanStatic(false);
   
  +  /** NEEDSDOC Field m_val          */
     boolean m_val;
  +
     /**
      * Construct a XNodeSet object.
  +   *
  +   * NEEDSDOC @param b
      */
     public XBoolean(boolean b)
     {
  +
       super();
  +
       m_val = b;
     }
  -  
  +
     /**
      * Tell that this is a CLASS_BOOLEAN.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getType()
     {
       return CLASS_BOOLEAN;
     }
  -  
  +
     /**
  -   * Given a request type, return the equivalent string. 
  +   * Given a request type, return the equivalent string.
      * For diagnostic purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTypeString()
     {
       return "#BOOLEAN";
     }
  -  
  +
     /**
      * Cast result object to a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public double num()
     {
  @@ -114,6 +127,8 @@
   
     /**
      * Cast result object to a boolean.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean bool()
     {
  @@ -122,15 +137,19 @@
   
     /**
      * Cast result object to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String str()
     {
       return m_val ? "true" : "false";
     }
  -  
  +
     /**
  -   * Return a java object that's closes to the represenation 
  +   * Return a java object that's closes to the represenation
      * that should be handed to an extension.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Object object()
     {
  @@ -139,18 +158,23 @@
   
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean equals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean equals(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.equals(this);
   
       return m_val == obj2.bool();
     }
   
   }
  -
  
  
  
  1.2       +17 -7     xml-xalan/java/src/org/apache/xpath/objects/XBooleanStatic.java
  
  Index: XBooleanStatic.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XBooleanStatic.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XBooleanStatic.java	2000/07/05 14:48:06	1.1
  +++ XBooleanStatic.java	2000/10/30 19:00:23	1.2
  @@ -57,35 +57,45 @@
   package org.apache.xpath.objects;
   
   import org.w3c.dom.*;
  +
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xalan.res.XSLMessages;
   
   /**
    * <meta name="usage" content="internal"/>
  - * This class doesn't have any XPathContext, so override 
  + * This class doesn't have any XPathContext, so override
    * whatever to ensure it works OK.
    */
   public class XBooleanStatic extends XBoolean
   {
  +
  +  /** NEEDSDOC Field m_val          */
     boolean m_val;
  -  
  +
     /**
      * Construct a XNodeSet object.
  +   *
  +   * NEEDSDOC @param b
      */
     public XBooleanStatic(boolean b)
     {
  +
       super(b);
  +
       m_val = b;
     }
  -  
  +
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean equals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean equals(XObject obj2) throws org.xml.sax.SAXException
     {
       return m_val == obj2.bool();
     }
  -
   }
  -
  
  
  
  1.6       +350 -93   xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java
  
  Index: XNodeSet.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNodeSet.java,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -r1.5 -r1.6
  --- XNodeSet.java	2000/10/29 22:29:58	1.5
  +++ XNodeSet.java	2000/10/30 19:00:24	1.6
  @@ -60,6 +60,7 @@
   import org.w3c.dom.Text;
   import org.w3c.dom.DocumentFragment;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import org.apache.xpath.DOMHelper;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.NodeSet;
  @@ -68,19 +69,22 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * This class represents an XPath nodeset object, and is capable of 
  + * This class represents an XPath nodeset object, and is capable of
    * converting the nodeset to other types, such as a string.
    */
   public class XNodeSet extends XObject
  -{  
  +{
  +
     /**
      * Construct a XNodeSet object.
  +   *
  +   * NEEDSDOC @param val
      */
     public XNodeSet(NodeIterator val)
     {
       super(val);
     }
  -  
  +
     /**
      * Construct an empty XNodeSet object.
      */
  @@ -91,36 +95,47 @@
   
     /**
      * Construct a XNodeSet object for one node.
  +   *
  +   * NEEDSDOC @param n
      */
     public XNodeSet(Node n)
     {
  +
       super(new NodeSet());
  -    if(null != n)
  +
  +    if (null != n)
       {
  -      ((NodeSet)m_obj).addNode(n);
  +      ((NodeSet) m_obj).addNode(n);
       }
     }
  - 
  - 
  +
     /**
      * Tell that this is a CLASS_NODESET.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getType()
     {
       return CLASS_NODESET;
     }
  -  
  +
     /**
  -   * Given a request type, return the equivalent string. 
  +   * Given a request type, return the equivalent string.
      * For diagnostic purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTypeString()
     {
       return "#NODESET";
     }
  -  
  +
     /**
      * Get the string conversion from a single node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static double getNumberFromNode(Node n)
     {
  @@ -129,82 +144,109 @@
   
     /**
      * Cast result object to a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public double num()
     {
  +
       NodeIterator nl = nodeset();
       Node node = nl.nextNode();
  +
       return (node != null) ? getNumberFromNode(node) : Double.NaN;
     }
   
     /**
      * Cast result object to a boolean.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean bool()
     {
       return (nodeset().nextNode() != null);
     }
  -  
   
     /**
      * Get the string conversion from a single node.
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static String getStringFromNode(Node n)
     {
  -    switch(n.getNodeType())
  +
  +    switch (n.getNodeType())
       {
  -    case Node.ELEMENT_NODE:
  -    case Node.DOCUMENT_NODE:
  +    case Node.ELEMENT_NODE :
  +    case Node.DOCUMENT_NODE :
         return DOMHelper.getNodeData(n);
  -    case Node.CDATA_SECTION_NODE:
  -    case Node.TEXT_NODE:
  -      return ((Text)n).getData();
  -    case Node.COMMENT_NODE:
  -    case Node.PROCESSING_INSTRUCTION_NODE:
  -    case Node.ATTRIBUTE_NODE:
  +    case Node.CDATA_SECTION_NODE :
  +    case Node.TEXT_NODE :
  +      return ((Text) n).getData();
  +    case Node.COMMENT_NODE :
  +    case Node.PROCESSING_INSTRUCTION_NODE :
  +    case Node.ATTRIBUTE_NODE :
         return n.getNodeValue();
  -    default:
  +    default :
         return DOMHelper.getNodeData(n);
       }
     }
   
     /**
      * Cast result object to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String str()
     {
  +
       NodeIterator nl = nodeset();
       Node node = nl.nextNode();
  +
       return (node != null) ? getStringFromNode(node) : "";
     }
  -  
  +
     /**
      * Cast result object to a result tree fragment.
  +   *
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public DocumentFragment rtree(XPathContext support)
     {
  -    DocumentFragment frag = support.getDOMHelper().getDOMFactory().createDocumentFragment();
  +
  +    DocumentFragment frag =
  +      support.getDOMHelper().getDOMFactory().createDocumentFragment();
       NodeIterator nl = nodeset();
       Node node;
  -    while(null != (node = nl.nextNode()))
  +
  +    while (null != (node = nl.nextNode()))
       {
         frag.appendChild(node.cloneNode(true));
       }
  +
       return frag;
     }
   
     /**
      * Cast result object to a nodelist.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeIterator nodeset()
     {
  +
       // System.out.println("In XNodeSet.nodeset()");
  -    NodeIterator ns = (NodeIterator)m_obj;
  +    NodeIterator ns = (NodeIterator) m_obj;
  +
       // System.out.println("Got NodeIterator");
  -    if(ns instanceof ContextNodeList)
  +    if (ns instanceof ContextNodeList)
       {
  -     // System.out.println("Is a ContextNodeList: "+ns);
  -     if(((ContextNodeList)ns).isFresh()) // bit of a hack...
  +
  +      // System.out.println("Is a ContextNodeList: "+ns);
  +      if (((ContextNodeList) ns).isFresh())  // bit of a hack...
         {
           return ns;
         }
  @@ -212,9 +254,9 @@
         {
           try
           {
  -          return ((ContextNodeList)ns).cloneWithReset();
  +          return ((ContextNodeList) ns).cloneWithReset();
           }
  -        catch(CloneNotSupportedException cnse)
  +        catch (CloneNotSupportedException cnse)
           {
             throw new RuntimeException(cnse.getMessage());
           }
  @@ -222,99 +264,134 @@
       }
       else
       {
  +
         // System.out.println("Returning node iterator");
         return ns;
       }
  -  }  
  +  }
   
     /**
      * Cast result object to a nodelist.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeSet mutableNodeset()
     {
  +
       NodeSet mnl;
  +
       if (m_obj instanceof NodeSet)
       {
  -      mnl = (NodeSet)m_obj;
  +      mnl = (NodeSet) m_obj;
       }
       else
       {
         mnl = new NodeSet(nodeset());
         m_obj = mnl;
       }
  -    
  +
       return mnl;
  -  }  
  -  
  +  }
  +
  +  /** NEEDSDOC Field S_LT          */
     static LessThanComparator S_LT = new LessThanComparator();
  +
  +  /** NEEDSDOC Field S_LTE          */
     static LessThanOrEqualComparator S_LTE = new LessThanOrEqualComparator();
  +
  +  /** NEEDSDOC Field S_GT          */
     static GreaterThanComparator S_GT = new GreaterThanComparator();
  -  static GreaterThanOrEqualComparator S_GTE = new GreaterThanOrEqualComparator();
  +
  +  /** NEEDSDOC Field S_GTE          */
  +  static GreaterThanOrEqualComparator S_GTE =
  +    new GreaterThanOrEqualComparator();
  +
  +  /** NEEDSDOC Field S_EQ          */
     static EqualComparator S_EQ = new EqualComparator();
  +
  +  /** NEEDSDOC Field S_NEQ          */
     static NotEqualComparator S_NEQ = new NotEqualComparator();
  -  
  +
     /**
      * Tell if one object is less than the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   * NEEDSDOC @param comparator
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public boolean compare(XObject obj2, Comparator comparator)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       boolean result = false;
       int type = obj2.getType();
  -    if(XObject.CLASS_NODESET == type)
  +
  +    if (XObject.CLASS_NODESET == type)
       {
  +
         // From http://www.w3.org/TR/xpath: 
         // If both objects to be compared are node-sets, then the comparison 
         // will be true if and only if there is a node in the first node-set 
         // and a node in the second node-set such that the result of performing 
         // the comparison on the string-values of the two nodes is true.
  -
         // Note this little gem from the draft:
         // NOTE: If $x is bound to a node-set, then $x="foo" 
         // does not mean the same as not($x!="foo"): the former 
         // is true if and only if some node in $x has the string-value 
         // foo; the latter is true if and only if all nodes in $x have 
         // the string-value foo.
  -
         NodeIterator list1 = nodeset();
  -      NodeIterator list2 = ((XNodeSet)obj2).nodeset();
  +      NodeIterator list2 = ((XNodeSet) obj2).nodeset();
         Node node1;
         StringVector node2Strings = null;
  -      while(null != (node1 = list1.nextNode()))
  +
  +      while (null != (node1 = list1.nextNode()))
         {
           String s1 = getStringFromNode(node1);
  -        if(null == node2Strings)
  +
  +        if (null == node2Strings)
           {
             Node node2;
  -          while(null != (node2 = list2.nextNode()))
  +
  +          while (null != (node2 = list2.nextNode()))
             {
               String s2 = getStringFromNode(node2);
  -            if(comparator.compareStrings(s1, s2))
  +
  +            if (comparator.compareStrings(s1, s2))
               {
                 result = true;
  +
                 break;
               }
  -            if(null == node2Strings)
  +
  +            if (null == node2Strings)
                 node2Strings = new StringVector();
  +
               node2Strings.addElement(s2);
             }
           }
           else
           {
             int n = node2Strings.size();
  -          for(int i = 0; i < n; i++)
  +
  +          for (int i = 0; i < n; i++)
             {
  -            if(comparator.compareStrings(s1, node2Strings.elementAt(i)))
  +            if (comparator.compareStrings(s1, node2Strings.elementAt(i)))
               {
                 result = true;
  +
                 break;
               }
             }
           }
         }
       }
  -    else if(XObject.CLASS_BOOLEAN == type)
  +    else if (XObject.CLASS_BOOLEAN == type)
       {
  +
         // From http://www.w3.org/TR/xpath: 
         // If one object to be compared is a node-set and the other is a boolean, 
         // then the comparison will be true if and only if the result of 
  @@ -323,10 +400,12 @@
         // is true.
         double num1 = bool() ? 1.0 : 0.0;
         double num2 = obj2.num();
  +
         result = comparator.compareNumbers(num1, num2);
       }
  -    else if(XObject.CLASS_NUMBER == type)
  +    else if (XObject.CLASS_NUMBER == type)
       {
  +
         // From http://www.w3.org/TR/xpath: 
         // If one object to be compared is a node-set and the other is a number, 
         // then the comparison will be true if and only if there is a 
  @@ -334,36 +413,43 @@
         // comparison on the number to be compared and on the result of 
         // converting the string-value of that node to a number using 
         // the number function is true. 
  -            
         NodeIterator list1 = nodeset();
         double num2 = obj2.num();
         Node node;
  -      while(null != (node = list1.nextNode()))
  +
  +      while (null != (node = list1.nextNode()))
         {
           double num1 = getNumberFromNode(node);
  -        if(comparator.compareNumbers(num1, num2))
  +
  +        if (comparator.compareNumbers(num1, num2))
           {
             result = true;
  +
             break;
           }
         }
       }
  -    else if(XObject.CLASS_RTREEFRAG == type)
  +    else if (XObject.CLASS_RTREEFRAG == type)
       {
  +
         // hmmm... 
         // Try first to treat it as a number, so that numeric 
         // comparisons can be done with it.  I suspect this is bogus...
         double num2 = obj2.num();
  -      if(!Double.isNaN(num2))
  +
  +      if (!Double.isNaN(num2))
         {
           NodeIterator list1 = nodeset();
           Node node;
  -        while(null != (node = list1.nextNode()))
  +
  +        while (null != (node = list1.nextNode()))
           {
             double num1 = getNumberFromNode(node);
  -          if(comparator.compareNumbers(num1, num2))
  +
  +          if (comparator.compareNumbers(num1, num2))
             {
               result = true;
  +
               break;
             }
           }
  @@ -373,19 +459,23 @@
           String s2 = obj2.str();
           NodeIterator list1 = nodeset();
           Node node;
  -        while(null != (node = list1.nextNode()))
  +
  +        while (null != (node = list1.nextNode()))
           {
             String s1 = getStringFromNode(node);
  -          if(comparator.compareStrings(s1, s2))
  +
  +          if (comparator.compareStrings(s1, s2))
             {
               result = true;
  +
               break;
             }
           }
         }
       }
  -    else if(XObject.CLASS_STRING == type)
  +    else if (XObject.CLASS_STRING == type)
       {
  +
         // From http://www.w3.org/TR/xpath: 
         // If one object to be compared is a node-set and the other is a 
         // string, then the comparison will be true if and only if there 
  @@ -395,12 +485,15 @@
         String s2 = obj2.str();
         NodeIterator list1 = nodeset();
         Node node;
  -      while(null != (node = list1.nextNode()))
  +
  +      while (null != (node = list1.nextNode()))
         {
           String s1 = getStringFromNode(node);
  -        if(comparator.compareStrings(s1, s2))
  +
  +        if (comparator.compareStrings(s1, s2))
           {
             result = true;
  +
             break;
           }
         }
  @@ -409,64 +502,94 @@
       {
         result = comparator.compareNumbers(this.num(), obj2.num());
       }
  +
       return result;
     }
   
  -
     /**
      * Tell if one object is less than the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean lessThan(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean lessThan(XObject obj2) throws org.xml.sax.SAXException
     {
       return compare(obj2, S_LT);
     }
   
     /**
      * Tell if one object is less than or equal to the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean lessThanOrEqual(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean lessThanOrEqual(XObject obj2) throws org.xml.sax.SAXException
     {
       return compare(obj2, S_LTE);
     }
   
     /**
      * Tell if one object is less than the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean greaterThan(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean greaterThan(XObject obj2) throws org.xml.sax.SAXException
     {
       return compare(obj2, S_GT);
     }
   
     /**
      * Tell if one object is less than the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public boolean greaterThanOrEqual(XObject obj2)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       return compare(obj2, S_GTE);
     }
   
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean equals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean equals(XObject obj2) throws org.xml.sax.SAXException
     {
       return compare(obj2, S_EQ);
     }
  -  
  +
     /**
      * Tell if two objects are functionally not equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean notEquals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean notEquals(XObject obj2) throws org.xml.sax.SAXException
     {
       return compare(obj2, S_NEQ);
     }
  -
   }
   
   /**
  @@ -474,20 +597,59 @@
    */
   abstract class Comparator
   {
  +
  +  /**
  +   * NEEDSDOC Method compareStrings 
  +   *
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   *
  +   * NEEDSDOC (compareStrings) @return
  +   */
     abstract boolean compareStrings(String s1, String s2);
  +
  +  /**
  +   * NEEDSDOC Method compareNumbers 
  +   *
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   *
  +   * NEEDSDOC (compareNumbers) @return
  +   */
     abstract boolean compareNumbers(double n1, double n2);
   }
  -  
  +
   /**
    * Compare strings or numbers for less than.
    */
   class LessThanComparator extends Comparator
   {
  -  boolean compareStrings(String s1, String s2) 
  +
  +  /**
  +   * NEEDSDOC Method compareStrings 
  +   *
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   *
  +   * NEEDSDOC (compareStrings) @return
  +   */
  +  boolean compareStrings(String s1, String s2)
     {
       return s1.compareTo(s2) < 0;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method compareNumbers 
  +   *
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   *
  +   * NEEDSDOC (compareNumbers) @return
  +   */
     boolean compareNumbers(double n1, double n2)
     {
       return n1 < n2;
  @@ -499,59 +661,135 @@
    */
   class LessThanOrEqualComparator extends Comparator
   {
  -  boolean compareStrings(String s1, String s2) 
  +
  +  /**
  +   * NEEDSDOC Method compareStrings 
  +   *
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   *
  +   * NEEDSDOC (compareStrings) @return
  +   */
  +  boolean compareStrings(String s1, String s2)
     {
       return s1.compareTo(s2) <= 0;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method compareNumbers 
  +   *
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   *
  +   * NEEDSDOC (compareNumbers) @return
  +   */
     boolean compareNumbers(double n1, double n2)
     {
       return n1 <= n2;
     }
   }
  -  
  +
   /**
    * Compare strings or numbers for greater than.
    */
   class GreaterThanComparator extends Comparator
   {
  -  boolean compareStrings(String s1, String s2) 
  +
  +  /**
  +   * NEEDSDOC Method compareStrings 
  +   *
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   *
  +   * NEEDSDOC (compareStrings) @return
  +   */
  +  boolean compareStrings(String s1, String s2)
     {
       return s1.compareTo(s2) > 0;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method compareNumbers 
  +   *
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   *
  +   * NEEDSDOC (compareNumbers) @return
  +   */
     boolean compareNumbers(double n1, double n2)
     {
       return n1 > n2;
     }
   }
  -  
  +
   /**
    * Compare strings or numbers for greater than or equal.
    */
   class GreaterThanOrEqualComparator extends Comparator
   {
  -  boolean compareStrings(String s1, String s2) 
  +
  +  /**
  +   * NEEDSDOC Method compareStrings 
  +   *
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   *
  +   * NEEDSDOC (compareStrings) @return
  +   */
  +  boolean compareStrings(String s1, String s2)
     {
       return s1.compareTo(s2) >= 0;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method compareNumbers 
  +   *
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   *
  +   * NEEDSDOC (compareNumbers) @return
  +   */
     boolean compareNumbers(double n1, double n2)
     {
       return n1 >= n2;
     }
   }
  -  
  +
   /**
    * Compare strings or numbers for equality.
    */
   class EqualComparator extends Comparator
   {
  -  boolean compareStrings(String s1, String s2) 
  +
  +  /**
  +   * NEEDSDOC Method compareStrings 
  +   *
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   *
  +   * NEEDSDOC (compareStrings) @return
  +   */
  +  boolean compareStrings(String s1, String s2)
     {
       return s1.equals(s2);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method compareNumbers 
  +   *
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   *
  +   * NEEDSDOC (compareNumbers) @return
  +   */
     boolean compareNumbers(double n1, double n2)
     {
       return n1 == n2;
  @@ -563,11 +801,30 @@
    */
   class NotEqualComparator extends Comparator
   {
  -  boolean compareStrings(String s1, String s2) 
  +
  +  /**
  +   * NEEDSDOC Method compareStrings 
  +   *
  +   *
  +   * NEEDSDOC @param s1
  +   * NEEDSDOC @param s2
  +   *
  +   * NEEDSDOC (compareStrings) @return
  +   */
  +  boolean compareStrings(String s1, String s2)
     {
       return !s1.equals(s2);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method compareNumbers 
  +   *
  +   *
  +   * NEEDSDOC @param n1
  +   * NEEDSDOC @param n2
  +   *
  +   * NEEDSDOC (compareNumbers) @return
  +   */
     boolean compareNumbers(double n1, double n2)
     {
       return n1 != n2;
  
  
  
  1.4       +30 -7     xml-xalan/java/src/org/apache/xpath/objects/XNull.java
  
  Index: XNull.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNull.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XNull.java	2000/10/29 22:29:58	1.3
  +++ XNull.java	2000/10/30 19:00:24	1.4
  @@ -64,11 +64,12 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * This class represents an XPath null object, and is capable of 
  + * This class represents an XPath null object, and is capable of
    * converting the null to other types, such as a string.
    */
   public class XNull extends XObject
   {
  +
     /**
      * Create an XObject.
      */
  @@ -79,6 +80,8 @@
   
     /**
      * Tell what kind of class this is.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getType()
     {
  @@ -86,17 +89,20 @@
     }
   
     /**
  -   * Given a request type, return the equivalent string. 
  +   * Given a request type, return the equivalent string.
      * For diagnostic purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTypeString()
     {
       return "#CLASS_NULL";
     }
  -  
  +
     /**
      * Cast result object to a number.
      */
  +
     public double num()
     {
       return 0.0;
  @@ -104,6 +110,8 @@
   
     /**
      * Cast result object to a boolean.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean bool()
     {
  @@ -112,31 +120,46 @@
   
     /**
      * Cast result object to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String str()
     {
       return "";
     }
  -  
  +
     /**
      * Cast result object to a result tree fragment.
  +   *
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public DocumentFragment rtree(XPathContext support)
     {
  -    DocumentFragment result = support.getDOMHelper().getDOMFactory().createDocumentFragment();
  +
  +    DocumentFragment result =
  +      support.getDOMHelper().getDOMFactory().createDocumentFragment();
  +
       return result;
     }
   
     /**
      * Cast result object to a nodelist.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeIterator nodeset()
     {
       return null;
  -  }  
  -   
  +  }
  +
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean equals(XObject obj2)
     {
  
  
  
  1.5       +78 -26    xml-xalan/java/src/org/apache/xpath/objects/XNumber.java
  
  Index: XNumber.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XNumber.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- XNumber.java	2000/10/29 22:29:58	1.4
  +++ XNumber.java	2000/10/30 19:00:24	1.5
  @@ -60,41 +60,53 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * This class represents an XPath number, and is capable of 
  + * This class represents an XPath number, and is capable of
    * converting the number to other types, such as a string.
    */
   public class XNumber extends XObject
   {
  +
  +  /** NEEDSDOC Field m_val          */
     double m_val;
  -  
  +
     /**
      * Construct a XNodeSet object.
  +   *
  +   * NEEDSDOC @param d
      */
     public XNumber(double d)
     {
  +
       super();
  +
       m_val = d;
     }
  -  
  +
     /**
      * Tell that this is a CLASS_NUMBER.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getType()
     {
       return CLASS_NUMBER;
     }
  -  
  +
     /**
  -   * Given a request type, return the equivalent string. 
  +   * Given a request type, return the equivalent string.
      * For diagnostic purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTypeString()
     {
       return "#NUMBER";
     }
  -  
  +
     /**
      * Cast result object to a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public double num()
     {
  @@ -103,70 +115,106 @@
   
     /**
      * Cast result object to a boolean.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean bool()
     {
       return (Double.isNaN(m_val) || (m_val == 0.0)) ? false : true;
     }
  -  
  +
     /**
      * Cast result object to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String str()
     {
  -    if(Double.isNaN(m_val))
  +
  +    if (Double.isNaN(m_val))
       {
         return "NaN";
       }
  -    else if(Double.isInfinite(m_val))
  +    else if (Double.isInfinite(m_val))
       {
  -      if(m_val > 0)
  +      if (m_val > 0)
           return "Infinity";
         else
           return "-Infinity";
  -    }    
  -    
  +    }
  +
       double num = m_val;
       String s = Double.toString(num);
       int len = s.length();
  -    if (s.charAt(len - 2) == '.' && s.charAt(len - 1) == '0') 
  +
  +    if (s.charAt(len - 2) == '.' && s.charAt(len - 1) == '0')
       {
         s = s.substring(0, len - 2);
  +
         if (s.equals("-0"))
           return "0";
  +
         return s;
       }
  +
       int e = s.indexOf('E');
  +
       if (e < 0)
         return s;
  +
       int exp = Integer.parseInt(s.substring(e + 1));
       String sign;
  -    if (s.charAt(0) == '-') 
  +
  +    if (s.charAt(0) == '-')
       {
         sign = "-";
         s = s.substring(1);
  +
         --e;
       }
       else
         sign = "";
  +
       int nDigits = e - 2;
  +
       if (exp >= nDigits)
  -      return sign + s.substring(0, 1) + s.substring(2, e) + zeros(exp - nDigits);
  +      return sign + s.substring(0, 1) + s.substring(2, e)
  +             + zeros(exp - nDigits);
  +
       if (exp > 0)
  -      return sign + s.substring(0, 1) + s.substring(2, 2 + exp) + "." + s.substring(2 + exp, e);
  -    return sign + "0." + zeros(-1 - exp) + s.substring(0, 1) + s.substring(2, e);
  +      return sign + s.substring(0, 1) + s.substring(2, 2 + exp) + "."
  +             + s.substring(2 + exp, e);
  +
  +    return sign + "0." + zeros(-1 - exp) + s.substring(0, 1)
  +           + s.substring(2, e);
     }
  -  
  -  static private String zeros(int n) {
  +
  +  /**
  +   * NEEDSDOC Method zeros 
  +   *
  +   *
  +   * NEEDSDOC @param n
  +   *
  +   * NEEDSDOC (zeros) @return
  +   */
  +  static private String zeros(int n)
  +  {
  +
       char[] buf = new char[n];
  +
       for (int i = 0; i < n; i++)
  +    {
         buf[i] = '0';
  +    }
  +
       return new String(buf);
     }
  -  
  +
     /**
  -   * Return a java object that's closes to the represenation 
  +   * Return a java object that's closes to the represenation
      * that should be handed to an extension.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Object object()
     {
  @@ -175,18 +223,22 @@
   
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean equals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean equals(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.equals(this);
   
       return m_val == obj2.num();
     }
  -
   }
  -
  
  
  
  1.4       +231 -94   xml-xalan/java/src/org/apache/xpath/objects/XObject.java
  
  Index: XObject.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XObject.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XObject.java	2000/10/29 22:29:58	1.3
  +++ XObject.java	2000/10/30 19:00:25	1.4
  @@ -60,7 +60,9 @@
   import org.w3c.dom.Text;
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
  +
   import java.io.Serializable;
  +
   import org.apache.xpath.res.XPATHErrorResources;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.NodeSet;
  @@ -70,91 +72,121 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * This class represents an XPath object, and is capable of 
  + * This class represents an XPath object, and is capable of
    * converting the object to various types, such as a string.
  - * This class acts as the base class to other XPath type objects, 
  + * This class acts as the base class to other XPath type objects,
    * such as XString, and provides polymorphic casting capabilities.
    */
   public class XObject extends Expression implements Serializable
   {
  -  protected Object m_obj; // This may be NULL!!!
  -  
  +
  +  /** NEEDSDOC Field m_obj          */
  +  protected Object m_obj;  // This may be NULL!!!
  +
     /**
      * Create an XObject.
      */
  -  public XObject()
  -  {
  -  }
  +  public XObject(){}
   
     /**
      * Create an XObject.
  +   *
  +   * NEEDSDOC @param obj
      */
     public XObject(Object obj)
     {
       m_obj = obj;
     }
  -  
  +
     /**
      * For support of literal objects in xpaths.
      * @returns This object.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
       return this;
     }
  -  
  +
     /**
      * Create the right XObject based on the type of the object passed.
  +   *
  +   * NEEDSDOC @param val
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     static public XObject create(Object val)
     {
  +
       XObject result;
  -    if(val instanceof XObject)
  +
  +    if (val instanceof XObject)
       {
  -      result = (XObject)val;
  +      result = (XObject) val;
       }
  -    else if(val instanceof String)
  +    else if (val instanceof String)
       {
  -      result = new XString((String)val);
  +      result = new XString((String) val);
       }
  -    else if(val instanceof Boolean)
  +    else if (val instanceof Boolean)
       {
  -      result = ((Boolean)val).booleanValue() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  +      result = ((Boolean) val).booleanValue()
  +               ? XBoolean.S_TRUE : XBoolean.S_FALSE;
       }
  -    else if(val instanceof Double)
  +    else if (val instanceof Double)
       {
  -      result = new XNumber(((Double)val).doubleValue());
  +      result = new XNumber(((Double) val).doubleValue());
       }
  -    else if(val instanceof DocumentFragment)
  +    else if (val instanceof DocumentFragment)
       {
  -      result = new XRTreeFrag((DocumentFragment)val);
  +      result = new XRTreeFrag((DocumentFragment) val);
       }
  -    else if(val instanceof Node)
  +    else if (val instanceof Node)
       {
  -      result = new XNodeSet((Node)val);
  +      result = new XNodeSet((Node) val);
       }
  -    else if(val instanceof NodeIterator)
  +    else if (val instanceof NodeIterator)
       {
  -      result = new XNodeSet((NodeIterator)val);
  +      result = new XNodeSet((NodeIterator) val);
       }
       else
       {
         result = new XObject(val);
       }
  +
       return result;
     }
  -  
  +
  +  /** NEEDSDOC Field CLASS_NULL          */
     public static final int CLASS_NULL = -1;
  +
  +  /** NEEDSDOC Field CLASS_UNKNOWN          */
     public static final int CLASS_UNKNOWN = 0;
  +
  +  /** NEEDSDOC Field CLASS_BOOLEAN          */
     public static final int CLASS_BOOLEAN = 1;
  +
  +  /** NEEDSDOC Field CLASS_NUMBER          */
     public static final int CLASS_NUMBER = 2;
  +
  +  /** NEEDSDOC Field CLASS_STRING          */
     public static final int CLASS_STRING = 3;
  +
  +  /** NEEDSDOC Field CLASS_NODESET          */
     public static final int CLASS_NODESET = 4;
  +
  +  /** NEEDSDOC Field CLASS_RTREEFRAG          */
     public static final int CLASS_RTREEFRAG = 5;
  -  
  +
     /**
      * Tell what kind of class this is.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getType()
     {
  @@ -162,75 +194,110 @@
     }
   
     /**
  -   * Given a request type, return the equivalent string. 
  +   * Given a request type, return the equivalent string.
      * For diagnostic purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTypeString()
     {
       return "#UNKNOWN (" + object().getClass().getName() + ")";
     }
  -  
  +
     /**
      * Cast result object to a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public double num()
  -    throws org.xml.sax.SAXException
  +  public double num() throws org.xml.sax.SAXException
     {
  -	  error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER, new Object[] {getTypeString()}); //"Can not convert "+getTypeString()+" to a number");
  +
  +    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
  +          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a number");
   
       return 0.0;
     }
   
     /**
      * Cast result object to a boolean.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean bool()
  -    throws org.xml.sax.SAXException
  +  public boolean bool() throws org.xml.sax.SAXException
     {
  -    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER, new Object[] {getTypeString()}); //"Can not convert "+getTypeString()+" to a number");
  +
  +    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NUMBER,
  +          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a number");
   
       return false;
     }
   
     /**
      * Cast result object to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String str()
     {
       return m_obj.toString();
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method toString 
  +   *
  +   *
  +   * NEEDSDOC (toString) @return
  +   */
     public String toString()
     {
       return str();
     }
  -  
  +
     /**
      * Cast result object to a result tree fragment.
  +   *
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public DocumentFragment rtree(XPathContext support)
     {
  +
       DocumentFragment result = rtree();
  -    if(null == result)
  +
  +    if (null == result)
       {
  -      result = support.getDOMHelper().getDOMFactory().createDocumentFragment();
  -      Text textNode = support.getDOMHelper().getDOMFactory().createTextNode(str());
  +      result =
  +        support.getDOMHelper().getDOMFactory().createDocumentFragment();
  +
  +      Text textNode =
  +        support.getDOMHelper().getDOMFactory().createTextNode(str());
  +
         result.appendChild(textNode);
       }
  +
       return result;
     }
  -  
  +
     /**
      * For functions to override.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public DocumentFragment rtree()
     {
       return null;
     }
  -  
  +
     /**
  -   * Return a java object that's closes to the represenation 
  +   * Return a java object that's closes to the represenation
      * that should be handed to an extension.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public Object object()
     {
  @@ -239,70 +306,101 @@
   
     /**
      * Cast result object to a nodelist.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public NodeIterator nodeset()
  -    throws org.xml.sax.SAXException
  +  public NodeIterator nodeset() throws org.xml.sax.SAXException
     {
  -    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST, new Object[] {getTypeString()}); //"Can not convert "+getTypeString()+" to a NodeList!");
  +
  +    error(XPATHErrorResources.ER_CANT_CONVERT_TO_NODELIST,
  +          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a NodeList!");
  +
       return null;
  -  }  
  -  
  +  }
  +
     /**
      * Cast result object to a nodelist.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public NodeSet mutableNodeset()
  -    throws org.xml.sax.SAXException
  +  public NodeSet mutableNodeset() throws org.xml.sax.SAXException
     {
  -    error(XPATHErrorResources.ER_CANT_CONVERT_TO_MUTABLENODELIST, new Object[] {getTypeString()}); //"Can not convert "+getTypeString()+" to a NodeSet!");
  -    return (NodeSet)m_obj;
  -  }  
  - 
  +
  +    error(XPATHErrorResources.ER_CANT_CONVERT_TO_MUTABLENODELIST,
  +          new Object[]{ getTypeString() });  //"Can not convert "+getTypeString()+" to a NodeSet!");
  +
  +    return (NodeSet) m_obj;
  +  }
  +
     /**
      * Cast object to type t.
  +   *
  +   * NEEDSDOC @param t
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public Object castToType(int t, XPathContext support)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       Object result;
  -    switch(t)
  +
  +    switch (t)
       {
  -    case CLASS_STRING:
  +    case CLASS_STRING :
         result = str();
         break;
  -    case CLASS_NUMBER:
  +    case CLASS_NUMBER :
         result = new Double(num());
         break;
  -    case CLASS_NODESET:
  +    case CLASS_NODESET :
         result = nodeset();
         break;
  -    case CLASS_BOOLEAN:
  -      result = new Boolean( bool() );
  +    case CLASS_BOOLEAN :
  +      result = new Boolean(bool());
         break;
  -    case CLASS_UNKNOWN:
  +    case CLASS_UNKNOWN :
         result = m_obj;
         break;
  -    case CLASS_RTREEFRAG:
  +    case CLASS_RTREEFRAG :
         result = rtree(support);
         break;
  -    default:
  -      error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE, new Object[] {getTypeString(), Integer.toString(t)}); //"Can not convert "+getTypeString()+" to a type#"+t);
  +    default :
  +      error(XPATHErrorResources.ER_CANT_CONVERT_TO_TYPE,
  +            new Object[]{ getTypeString(),
  +                          Integer.toString(t) });  //"Can not convert "+getTypeString()+" to a type#"+t);
  +
         result = null;
       }
  +
       return result;
     }
   
     /**
      * Tell if one object is less than the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean lessThan(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean lessThan(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.  Because the arguments 
       // are backwards, we call the opposite comparison
       // function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.greaterThan(this);
   
       return this.num() < obj2.num();
  @@ -310,33 +408,45 @@
   
     /**
      * Tell if one object is less than or equal to the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean lessThanOrEqual(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean lessThanOrEqual(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.  Because the arguments 
       // are backwards, we call the opposite comparison
       // function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.greaterThanOrEqual(this);
  -    
  +
       return this.num() <= obj2.num();
     }
   
     /**
      * Tell if one object is less than the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean greaterThan(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean greaterThan(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.  Because the arguments 
       // are backwards, we call the opposite comparison
       // function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.lessThan(this);
   
       return this.num() > obj2.num();
  @@ -344,16 +454,23 @@
   
     /**
      * Tell if one object is less than the other.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
     public boolean greaterThanOrEqual(XObject obj2)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.  Because the arguments 
       // are backwards, we call the opposite comparison
       // function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.lessThanOrEqual(this);
   
       return this.num() >= obj2.num();
  @@ -361,52 +478,73 @@
   
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean equals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean equals(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.equals(this);
   
       return m_obj.equals(obj2.m_obj);
     }
  -  
  +
     /**
      * Tell if two objects are functionally not equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean notEquals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean notEquals(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.notEquals(this);
   
       return !equals(obj2);
     }
   
     /**
  -   * Tell the user of an error, and probably throw an 
  +   * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void error(int msg)
  -    throws org.xml.sax.SAXException
  +  protected void error(int msg) throws org.xml.sax.SAXException
     {
  -	  error (msg, null);
  -  }	   
  +    error(msg, null);
  +  }
   
     /**
  -   * Tell the user of an error, and probably throw an 
  +   * Tell the user of an error, and probably throw an
      * exception.
  +   *
  +   * NEEDSDOC @param msg
  +   * NEEDSDOC @param args
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  protected void error(int msg, Object[] args)
  -    throws org.xml.sax.SAXException
  +  protected void error(int msg, Object[] args) throws org.xml.sax.SAXException
     {
  -    String fmsg = XSLMessages.createXPATHMessage(msg, args);  
  +
  +    String fmsg = XSLMessages.createXPATHMessage(msg, args);
  +
       // boolean shouldThrow = support.problem(m_support.XPATHPROCESSOR, 
       //                                      m_support.ERROR,
       //                                      null, 
  @@ -416,5 +554,4 @@
         throw new XPathException(fmsg);
       }
     }
  -
   }
  
  
  
  1.8       +120 -61   xml-xalan/java/src/org/apache/xpath/objects/XRTreeFrag.java
  
  Index: XRTreeFrag.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XRTreeFrag.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- XRTreeFrag.java	2000/10/29 22:29:58	1.7
  +++ XRTreeFrag.java	2000/10/30 19:00:25	1.8
  @@ -59,25 +59,31 @@
   import org.w3c.dom.*;
   import org.w3c.dom.traversal.NodeIterator;
   import org.w3c.dom.traversal.NodeFilter;
  +
   import org.apache.xpath.DOMHelper;
   
   /**
    * <meta name="usage" content="general"/>
  - * This class represents an XPath result tree fragment object, and is capable of 
  + * This class represents an XPath result tree fragment object, and is capable of
    * converting the RTF to other types, such as a string.
    */
   public class XRTreeFrag extends XObject
  -{  
  +{
  +
     /**
      * Create an XObject.
  +   *
  +   * NEEDSDOC @param frag
      */
     public XRTreeFrag(DocumentFragment frag)
     {
       super(frag);
     }
  -  
  +
     /**
      * Tell what kind of class this is.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getType()
     {
  @@ -85,32 +91,42 @@
     }
   
     /**
  -   * Given a request type, return the equivalent string. 
  +   * Given a request type, return the equivalent string.
      * For diagnostic purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTypeString()
     {
       return "#RTREEFRAG";
     }
  -  
  +
     /**
      * Cast result object to a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public double num()
     {
  -    java.text.NumberFormat m_formatter = java.text.NumberFormat.getNumberInstance();
  +
  +    java.text.NumberFormat m_formatter =
  +      java.text.NumberFormat.getNumberInstance();
       double result;
  -    String s = DOMHelper.getNodeData((DocumentFragment)m_obj);
  -    if(null != s)
  +    String s = DOMHelper.getNodeData((DocumentFragment) m_obj);
  +
  +    if (null != s)
       {
         try
         {
  +
           // result = Double.valueOf(s).doubleValue();
           Number n = m_formatter.parse(s.trim());
  +
           result = n.doubleValue();
         }
  +
         // catch(NumberFormatException nfe)
  -      catch(java.text.ParseException nfe)
  +      catch (java.text.ParseException nfe)
         {
           result = Double.NaN;
         }
  @@ -126,6 +142,8 @@
     /**
      * Cast result object to a boolean.  This always returns true for a RTreeFrag
      * because it is treated like a node-set with a single root node.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean bool()
     {
  @@ -134,76 +152,96 @@
   
     /**
      * Cast result object to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String str()
     {
  -    String str = DOMHelper.getNodeData((DocumentFragment)m_obj);
  +
  +    String str = DOMHelper.getNodeData((DocumentFragment) m_obj);
  +
       return (null == str) ? "" : str;
     }
  -  
  +
     /**
      * Cast result object to a result tree fragment.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public DocumentFragment rtree()
     {
  -    return (DocumentFragment)m_obj;
  +    return (DocumentFragment) m_obj;
     }
  -  
  +
     /**
      * Cast result object to a nodelist.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeIterator asNodeIterator()
     {
  -    if(m_obj instanceof NodeIterator)
  -      return (NodeIterator)m_obj;
  -    else 
  +
  +    if (m_obj instanceof NodeIterator)
  +      return (NodeIterator) m_obj;
  +    else
         return new NodeIteratorWrapper(rtree());
     }
  -  
  +
     /**
      * Cast result object to a nodelist. (special function).
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public NodeList convertToNodeset()
     {
  -    if(m_obj instanceof DocumentFragment)
  -      return ((DocumentFragment)m_obj).getChildNodes();
  -    else if(m_obj instanceof NodeList)
  -      return (NodeList)m_obj;
  +
  +    if (m_obj instanceof DocumentFragment)
  +      return ((DocumentFragment) m_obj).getChildNodes();
  +    else if (m_obj instanceof NodeList)
  +      return (NodeList) m_obj;
       else
         return null;
  -  }  
  -  
  +  }
  +
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean equals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean equals(XObject obj2) throws org.xml.sax.SAXException
     {
  -    if(XObject.CLASS_NODESET == obj2.getType())
  +
  +    if (XObject.CLASS_NODESET == obj2.getType())
       {
  +
         // In order to handle the 'all' semantics of 
         // nodeset comparisons, we always call the 
         // nodeset function.
         return obj2.equals(this);
       }
  -    else if(XObject.CLASS_BOOLEAN == obj2.getType())
  +    else if (XObject.CLASS_BOOLEAN == obj2.getType())
       {
         return bool() == obj2.bool();
       }
  -    else if(XObject.CLASS_NUMBER == obj2.getType())
  +    else if (XObject.CLASS_NUMBER == obj2.getType())
       {
         return num() == obj2.num();
       }
  -    else if(XObject.CLASS_NODESET == obj2.getType())
  +    else if (XObject.CLASS_NODESET == obj2.getType())
       {
         return str().equals(obj2.str());
       }
  -    else if(XObject.CLASS_STRING == obj2.getType())
  +    else if (XObject.CLASS_STRING == obj2.getType())
       {
         return str().equals(obj2.str());
       }
  -    else if(XObject.CLASS_RTREEFRAG == obj2.getType())
  +    else if (XObject.CLASS_RTREEFRAG == obj2.getType())
       {
  +
         // Probably not so good.  Think about this.
         return str().equals(obj2.str());
       }
  @@ -212,19 +250,35 @@
         return super.equals(obj2);
       }
     }
  -  
  +
  +  /**
  +   * <meta name="usage" content="internal"/>
  +   * NEEDSDOC Class NodeIteratorWrapper <needs-comment/>
  +   */
     class NodeIteratorWrapper implements NodeIterator
     {
  +
  +    /** NEEDSDOC Field m_pos          */
       private int m_pos = -1;
  +
  +    /** NEEDSDOC Field m_docFrag          */
       private DocumentFragment m_docFrag;
  -    
  +
  +    /**
  +     * Constructor NodeIteratorWrapper
  +     *
  +     *
  +     * NEEDSDOC @param df
  +     */
       NodeIteratorWrapper(DocumentFragment df)
       {
         m_docFrag = df;
       }
  -    
  +
       /**
        *  The root node of the Iterator, as specified when it was created.
  +     *
  +     * NEEDSDOC ($objectName$) @return
        */
       public Node getRoot()
       {
  @@ -232,9 +286,11 @@
       }
   
       /**
  -     *  This attribute determines which node types are presented via the 
  -     * iterator. The available set of constants is defined in the 
  +     *  This attribute determines which node types are presented via the
  +     * iterator. The available set of constants is defined in the
        * <code>NodeFilter</code> interface.
  +     *
  +     * NEEDSDOC ($objectName$) @return
        */
       public int getWhatToShow()
       {
  @@ -243,6 +299,8 @@
   
       /**
        *  The filter used to screen nodes.
  +     *
  +     * NEEDSDOC ($objectName$) @return
        */
       public NodeFilter getFilter()
       {
  @@ -250,16 +308,18 @@
       }
   
       /**
  -     *  The value of this flag determines whether the children of entity 
  -     * reference nodes are visible to the iterator. If false, they will be 
  +     *  The value of this flag determines whether the children of entity
  +     * reference nodes are visible to the iterator. If false, they will be
        * skipped over.
  -     * <br> To produce a view of the document that has entity references 
  -     * expanded and does not expose the entity reference node itself, use the 
  -     * whatToShow flags to hide the entity reference node and set 
  -     * expandEntityReferences to true when creating the iterator. To produce 
  -     * a view of the document that has entity reference nodes but no entity 
  -     * expansion, use the whatToShow flags to show the entity reference node 
  +     * <br> To produce a view of the document that has entity references
  +     * expanded and does not expose the entity reference node itself, use the
  +     * whatToShow flags to hide the entity reference node and set
  +     * expandEntityReferences to true when creating the iterator. To produce
  +     * a view of the document that has entity reference nodes but no entity
  +     * expansion, use the whatToShow flags to show the entity reference node
        * and set expandEntityReferences to false.
  +     *
  +     * NEEDSDOC ($objectName$) @return
        */
       public boolean getExpandEntityReferences()
       {
  @@ -267,8 +327,8 @@
       }
   
       /**
  -     *  Returns the next node in the set and advances the position of the 
  -     * iterator in the set. After a NodeIterator is created, the first call 
  +     *  Returns the next node in the set and advances the position of the
  +     * iterator in the set. After a NodeIterator is created, the first call
        * to nextNode() returns the first node in the set.
        * @return  The next <code>Node</code> in the set being iterated over, or
        *   <code>null</code> if there are no more members in that set.
  @@ -276,12 +336,13 @@
        *    INVALID_STATE_ERR: Raised if this method is called after the
        *   <code>detach</code> method was invoked.
        */
  -    public Node nextNode()
  -                         throws DOMException
  +    public Node nextNode() throws DOMException
       {
  +
         if (-1 == m_pos)
         {
           m_pos = 0;
  +
           return m_docFrag;
         }
         else
  @@ -289,20 +350,21 @@
       }
   
       /**
  -     *  Returns the previous node in the set and moves the position of the 
  +     *  Returns the previous node in the set and moves the position of the
        * iterator backwards in the set.
  -     * @return  The previous <code>Node</code> in the set being iterated over, 
  -     *   or<code>null</code> if there are no more members in that set. 
  +     * @return  The previous <code>Node</code> in the set being iterated over,
  +     *   or<code>null</code> if there are no more members in that set.
        * @exception DOMException
        *    INVALID_STATE_ERR: Raised if this method is called after the
        *   <code>detach</code> method was invoked.
        */
  -    public Node previousNode()
  -                             throws DOMException
  +    public Node previousNode() throws DOMException
       {
  +
         if (0 == m_pos)
         {
           m_pos = -1;
  +
           return m_docFrag;
         }
         else
  @@ -310,15 +372,12 @@
       }
   
       /**
  -     *  Detaches the iterator from the set which it iterated over, releasing 
  -     * any computational resources and placing the iterator in the INVALID 
  -     * state. After<code>detach</code> has been invoked, calls to 
  -     * <code>nextNode</code> or<code>previousNode</code> will raise the 
  +     *  Detaches the iterator from the set which it iterated over, releasing
  +     * any computational resources and placing the iterator in the INVALID
  +     * state. After<code>detach</code> has been invoked, calls to
  +     * <code>nextNode</code> or<code>previousNode</code> will raise the
        * exception INVALID_STATE_ERR.
        */
  -    public void detach()
  -    {
  -    }
  +    public void detach(){}
     }
  -
   }
  
  
  
  1.4       +59 -22    xml-xalan/java/src/org/apache/xpath/objects/XString.java
  
  Index: XString.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/objects/XString.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- XString.java	2000/10/29 22:29:58	1.3
  +++ XString.java	2000/10/30 19:00:26	1.4
  @@ -62,15 +62,19 @@
   
   /**
    * <meta name="usage" content="general"/>
  - * This class represents an XPath string object, and is capable of 
  + * This class represents an XPath string object, and is capable of
    * converting the string to other types, such as a number.
    */
   public class XString extends XObject
   {
  +
  +  /** NEEDSDOC Field EMPTYSTRING          */
     public static XString EMPTYSTRING = new XString("");
  -  
  +
     /**
      * Construct a XNodeSet object.
  +   *
  +   * NEEDSDOC @param val
      */
     public XString(String val)
     {
  @@ -79,37 +83,49 @@
   
     /**
      * Tell that this is a CLASS_STRING.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getType()
     {
       return CLASS_STRING;
     }
  -  
  +
     /**
  -   * Given a request type, return the equivalent string. 
  +   * Given a request type, return the equivalent string.
      * For diagnostic purposes.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getTypeString()
     {
       return "#STRING";
     }
  -  
  +
     /**
      * Cast a string to a number.
  +   *
  +   * NEEDSDOC @param s
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public static double castToNum(String s)
     {
  +
       double result;
  -    if(null == s) 
  +
  +    if (null == s)
         result = 0.0;
       else
       {
  -      try 
  +      try
         {
  +
           /**
  -        * TODO: Adjust this for locale. Need to take into 
  -        * account the lang parameter on the xsl:sort 
  -        */
  +         * TODO: Adjust this for locale. Need to take into
  +         * account the lang parameter on the xsl:sort
  +         */
  +
           // It seems we can not use this as it just parses the 
           // start of the string until it finds a non-number char, 
           // which is not what we want according to the XSLT spec.  
  @@ -118,7 +134,6 @@
           // XSLT spec (see below).
           // NumberFormat formatter = NumberFormat.getNumberInstance();
           // result = formatter.parse(s.trim()).doubleValue();
  -        
           // The dumb XSLT spec says: "The number function should 
           // not be used for conversion of numeric data occurring 
           // in an element in an XML document unless the element 
  @@ -134,25 +149,31 @@
           // parse?  Or does it use the ieee parse?
           result = Double.valueOf(s.trim()).doubleValue();
         }
  +
         // catch (ParseException e) 
         catch (NumberFormatException nfe)
         {
           result = Double.NaN;
         }
       }
  +
       return result;
     }
  -  
  +
     /**
      * Cast result object to a number.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public double num()
     {
  -    return castToNum((String)m_obj);
  +    return castToNum((String) m_obj);
     }
   
     /**
      * Cast result object to a boolean.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public boolean bool()
     {
  @@ -161,36 +182,52 @@
   
     /**
      * Cast result object to a string.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String str()
     {
  -    return (null != m_obj) ? ((String)m_obj) : "";
  +    return (null != m_obj) ? ((String) m_obj) : "";
     }
  -  
  +
     /**
      * Cast result object to a result tree fragment.
  +   *
  +   * NEEDSDOC @param support
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public DocumentFragment rtree(XPathContext support)
     {
  -    DocumentFragment df = support.getDOMHelper().getDOMFactory().createDocumentFragment();
  -    Text textNode = support.getDOMHelper().getDOMFactory().createTextNode(str());
  +
  +    DocumentFragment df =
  +      support.getDOMHelper().getDOMFactory().createDocumentFragment();
  +    Text textNode =
  +      support.getDOMHelper().getDOMFactory().createTextNode(str());
  +
       df.appendChild(textNode);
  +
       return df;
     }
  -  
  +
     /**
      * Tell if two objects are functionally equal.
  +   *
  +   * NEEDSDOC @param obj2
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public boolean equals(XObject obj2)
  -    throws org.xml.sax.SAXException
  +  public boolean equals(XObject obj2) throws org.xml.sax.SAXException
     {
  +
       // In order to handle the 'all' semantics of 
       // nodeset comparisons, we always call the 
       // nodeset function.
  -    if(obj2.getType() == XObject.CLASS_NODESET)
  +    if (obj2.getType() == XObject.CLASS_NODESET)
         return obj2.equals(this);
   
       return str().equals(obj2.str());
     }
  -
   }
  
  
  
  1.2       +73 -4     xml-xalan/java/src/org/apache/xpath/operations/And.java
  
  Index: And.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/And.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- And.java	2000/07/05 14:48:15	1.1
  +++ And.java	2000/10/30 19:00:30	1.2
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.Expression;
  @@ -8,19 +64,32 @@
   
   import org.w3c.dom.Node;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class And <needs-comment/>
  + */
   public class And extends Operation
   {
  +
     /**
  -   * AND two expressions and return the boolean result. Override 
  +   * AND two expressions and return the boolean result. Override
      * superclass method for optimization purposes.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       XObject expr1 = m_left.execute(xctxt);
  -    if(expr1.bool())
  +
  +    if (expr1.bool())
       {
         XObject expr2 = m_right.execute(xctxt);
  +
         return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
       }
       else
  
  
  
  1.2       +74 -3     xml-xalan/java/src/org/apache/xpath/operations/Bool.java
  
  Index: Bool.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Bool.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Bool.java	2000/07/05 14:48:16	1.1
  +++ Bool.java	2000/10/30 19:00:30	1.2
  @@ -1,14 +1,85 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XBoolean;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Bool <needs-comment/>
  + */
   public class Bool extends UnaryOperation
   {
  -  public XObject operate(XObject right)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject operate(XObject right) throws org.xml.sax.SAXException
     {
  -    if(XObject.CLASS_BOOLEAN == right.getType())
  +
  +    if (XObject.CLASS_BOOLEAN == right.getType())
         return right;
       else
         return right.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  
  
  
  1.2       +73 -1     xml-xalan/java/src/org/apache/xpath/operations/Div.java
  
  Index: Div.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Div.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Div.java	2000/07/05 14:48:16	1.1
  +++ Div.java	2000/10/30 19:00:31	1.2
  @@ -1,12 +1,84 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Div <needs-comment/>
  + */
   public class Div extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       return new XNumber(left.num() / right.num());
     }
  
  
  
  1.2       +73 -1     xml-xalan/java/src/org/apache/xpath/operations/Equals.java
  
  Index: Equals.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Equals.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Equals.java	2000/07/05 14:48:16	1.1
  +++ Equals.java	2000/10/30 19:00:31	1.2
  @@ -1,12 +1,84 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XBoolean;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Equals <needs-comment/>
  + */
   public class Equals extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       return left.equals(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
  
  
  
  1.2       +73 -1     xml-xalan/java/src/org/apache/xpath/operations/Gt.java
  
  Index: Gt.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Gt.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Gt.java	2000/07/05 14:48:17	1.1
  +++ Gt.java	2000/10/30 19:00:32	1.2
  @@ -1,12 +1,84 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XBoolean;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Gt <needs-comment/>
  + */
   public class Gt extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       return left.greaterThan(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
  
  
  
  1.2       +75 -2     xml-xalan/java/src/org/apache/xpath/operations/Gte.java
  
  Index: Gte.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Gte.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Gte.java	2000/07/05 14:48:17	1.1
  +++ Gte.java	2000/10/30 19:00:32	1.2
  @@ -1,13 +1,86 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XBoolean;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Gte <needs-comment/>
  + */
   public class Gte extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return left.greaterThanOrEqual(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
  +    return left.greaterThanOrEqual(right)
  +           ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
   }
  
  
  
  1.2       +73 -1     xml-xalan/java/src/org/apache/xpath/operations/Lt.java
  
  Index: Lt.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Lt.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Lt.java	2000/07/05 14:48:17	1.1
  +++ Lt.java	2000/10/30 19:00:33	1.2
  @@ -1,12 +1,84 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XBoolean;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Lt <needs-comment/>
  + */
   public class Lt extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       return left.lessThan(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
  
  
  
  1.2       +73 -1     xml-xalan/java/src/org/apache/xpath/operations/Lte.java
  
  Index: Lte.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Lte.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Lte.java	2000/07/05 14:48:17	1.1
  +++ Lte.java	2000/10/30 19:00:33	1.2
  @@ -1,12 +1,84 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XBoolean;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Lte <needs-comment/>
  + */
   public class Lte extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       return left.lessThanOrEqual(right) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
  
  
  
  1.2       +74 -2     xml-xalan/java/src/org/apache/xpath/operations/Minus.java
  
  Index: Minus.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Minus.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Minus.java	2000/07/05 14:48:17	1.1
  +++ Minus.java	2000/10/30 19:00:34	1.2
  @@ -1,13 +1,85 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Minus <needs-comment/>
  + */
   public class Minus extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return new XNumber(left.num() -  right.num());
  +    return new XNumber(left.num() - right.num());
     }
   }
  
  
  
  1.2       +74 -2     xml-xalan/java/src/org/apache/xpath/operations/Mod.java
  
  Index: Mod.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Mod.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Mod.java	2000/07/05 14:48:17	1.1
  +++ Mod.java	2000/10/30 19:00:35	1.2
  @@ -1,13 +1,85 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Mod <needs-comment/>
  + */
   public class Mod extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return new XNumber(left.num() %  right.num());
  +    return new XNumber(left.num() % right.num());
     }
   }
  
  
  
  1.2       +74 -2     xml-xalan/java/src/org/apache/xpath/operations/Mult.java
  
  Index: Mult.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Mult.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Mult.java	2000/07/05 14:48:17	1.1
  +++ Mult.java	2000/10/30 19:00:35	1.2
  @@ -1,13 +1,85 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Mult <needs-comment/>
  + */
   public class Mult extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return new XNumber(left.num() *  right.num());
  +    return new XNumber(left.num() * right.num());
     }
   }
  
  
  
  1.2       +72 -2     xml-xalan/java/src/org/apache/xpath/operations/Neg.java
  
  Index: Neg.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Neg.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Neg.java	2000/07/05 14:48:17	1.1
  +++ Neg.java	2000/10/30 19:00:36	1.2
  @@ -1,12 +1,82 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Neg <needs-comment/>
  + */
   public class Neg extends UnaryOperation
   {
  -  public XObject operate(XObject right)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject operate(XObject right) throws org.xml.sax.SAXException
     {
       return new XNumber(-right.num());
     }
  
  
  
  1.2       +73 -1     xml-xalan/java/src/org/apache/xpath/operations/NotEquals.java
  
  Index: NotEquals.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/NotEquals.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NotEquals.java	2000/07/05 14:48:18	1.1
  +++ NotEquals.java	2000/10/30 19:00:36	1.2
  @@ -1,12 +1,84 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XBoolean;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class NotEquals <needs-comment/>
  + */
   public class NotEquals extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
       return (left.notEquals(right)) ? XBoolean.S_TRUE : XBoolean.S_FALSE;
     }
  
  
  
  1.2       +74 -3     xml-xalan/java/src/org/apache/xpath/operations/Number.java
  
  Index: Number.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Number.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Number.java	2000/07/05 14:48:18	1.1
  +++ Number.java	2000/10/30 19:00:37	1.2
  @@ -1,14 +1,85 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Number <needs-comment/>
  + */
   public class Number extends UnaryOperation
   {
  -  public XObject operate(XObject right)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject operate(XObject right) throws org.xml.sax.SAXException
     {
  -    if(XObject.CLASS_NUMBER == right.getType())
  +
  +    if (XObject.CLASS_NUMBER == right.getType())
         return right;
       else
         return new XNumber(right.num());
  
  
  
  1.2       +100 -8    xml-xalan/java/src/org/apache/xpath/operations/Operation.java
  
  Index: Operation.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Operation.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Operation.java	2000/07/05 14:48:19	1.1
  +++ Operation.java	2000/10/30 19:00:37	1.2
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.Expression;
  @@ -7,29 +63,65 @@
   
   import org.w3c.dom.Node;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Operation <needs-comment/>
  + */
   public class Operation extends Expression
   {
  +
  +  /** NEEDSDOC Field m_left          */
     protected Expression m_left;
  +
  +  /** NEEDSDOC Field m_right          */
     protected Expression m_right;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setLeftRight 
  +   *
  +   *
  +   * NEEDSDOC @param l
  +   * NEEDSDOC @param r
  +   */
     public void setLeftRight(Expression l, Expression r)
     {
       m_left = l;
       m_right = r;
     }
  -  
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method execute 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (execute) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       XObject left = m_left.execute(xctxt);
       XObject right = m_right.execute(xctxt);
  -    
  +
       return operate(left, right);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return null; // no-op
  +    return null;  // no-op
     }
   }
  
  
  
  1.2       +74 -5     xml-xalan/java/src/org/apache/xpath/operations/Or.java
  
  Index: Or.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Or.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Or.java	2000/07/05 14:48:19	1.1
  +++ Or.java	2000/10/30 19:00:37	1.2
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.Expression;
  @@ -8,19 +64,32 @@
   
   import org.w3c.dom.Node;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Or <needs-comment/>
  + */
   public class Or extends Operation
  -{  
  +{
  +
     /**
  -   * OR two expressions and return the boolean result. Override 
  +   * OR two expressions and return the boolean result. Override
      * superclass method for optimization purposes.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt) 
  -    throws org.xml.sax.SAXException
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       XObject expr1 = m_left.execute(xctxt);
  -    if(!expr1.bool())
  +
  +    if (!expr1.bool())
       {
         XObject expr2 = m_right.execute(xctxt);
  +
         return expr2.bool() ? XBoolean.S_TRUE : XBoolean.S_FALSE;
       }
       else
  
  
  
  1.2       +74 -2     xml-xalan/java/src/org/apache/xpath/operations/Plus.java
  
  Index: Plus.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Plus.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Plus.java	2000/07/05 14:48:19	1.1
  +++ Plus.java	2000/10/30 19:00:38	1.2
  @@ -1,13 +1,85 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Plus <needs-comment/>
  + */
   public class Plus extends Operation
   {
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return new XNumber(left.num() +  right.num());
  +    return new XNumber(left.num() + right.num());
     }
   }
  
  
  
  1.2       +75 -2     xml-xalan/java/src/org/apache/xpath/operations/Quo.java
  
  Index: Quo.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Quo.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Quo.java	2000/07/05 14:48:19	1.1
  +++ Quo.java	2000/10/30 19:00:38	1.2
  @@ -1,14 +1,87 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XNumber;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Quo <needs-comment/>
  + */
   public class Quo extends Operation
   {
  +
     // Actually, this is no longer supported by xpath...
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param left
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject operate(XObject left, XObject right)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    return new XNumber((int)(left.num() /  right.num()));
  +    return new XNumber((int) (left.num() / right.num()));
     }
   }
  
  
  
  1.2       +74 -3     xml-xalan/java/src/org/apache/xpath/operations/String.java
  
  Index: String.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/String.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- String.java	2000/07/05 14:48:19	1.1
  +++ String.java	2000/10/30 19:00:39	1.2
  @@ -1,14 +1,85 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.objects.XObject;
   import org.apache.xpath.objects.XString;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class String <needs-comment/>
  + */
   public class String extends UnaryOperation
   {
  -  public XObject operate(XObject right)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject operate(XObject right) throws org.xml.sax.SAXException
     {
  -    if(XObject.CLASS_STRING == right.getType())
  +
  +    if (XObject.CLASS_STRING == right.getType())
         return right;
       else
         return new XString(right.str());
  
  
  
  1.2       +94 -6     xml-xalan/java/src/org/apache/xpath/operations/UnaryOperation.java
  
  Index: UnaryOperation.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/UnaryOperation.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- UnaryOperation.java	2000/07/05 14:48:19	1.1
  +++ UnaryOperation.java	2000/10/30 19:00:39	1.2
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xpath.Expression;
  @@ -7,23 +63,55 @@
   
   import org.w3c.dom.Node;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class UnaryOperation <needs-comment/>
  + */
   public abstract class UnaryOperation extends Expression
   {
  +
  +  /** NEEDSDOC Field m_right          */
     protected Expression m_right;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setRight 
  +   *
  +   *
  +   * NEEDSDOC @param r
  +   */
     public void setRight(Expression r)
     {
       m_right = r;
     }
  -  
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method execute 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (execute) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       XObject right = m_right.execute(xctxt);
  -    
  +
       return operate(right);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method operate 
  +   *
  +   *
  +   * NEEDSDOC @param right
  +   *
  +   * NEEDSDOC (operate) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public abstract XObject operate(XObject right)
       throws org.xml.sax.SAXException;
   }
  
  
  
  1.3       +90 -8     xml-xalan/java/src/org/apache/xpath/operations/Variable.java
  
  Index: Variable.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/operations/Variable.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Variable.java	2000/08/09 17:51:56	1.2
  +++ Variable.java	2000/10/30 19:00:40	1.3
  @@ -1,7 +1,62 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.operations;
   
   import org.apache.xalan.utils.QName;
  -
   import org.apache.xpath.Expression;
   import org.apache.xpath.XPath;
   import org.apache.xpath.XPathContext;
  @@ -12,33 +67,60 @@
   
   import org.apache.xpath.res.XPATHErrorResources;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class Variable <needs-comment/>
  + */
   public class Variable extends Expression
   {
  +
  +  /** NEEDSDOC Field m_qname          */
     protected QName m_qname;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setQName 
  +   *
  +   *
  +   * NEEDSDOC @param qname
  +   */
     public void setQName(QName qname)
     {
       m_qname = qname;
     }
   
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +  /**
  +   * NEEDSDOC Method execute 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (execute) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       // Is the variable fetched always the same?
       XObject result;
  +
       try
       {
         result = xctxt.getVariable(m_qname);
       }
  -    catch(Exception e)
  +    catch (Exception e)
       {
  -      error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED, new Object[] {m_qname.getLocalPart()}); //"Could not get variable named "+varName);
  +      error(xctxt, XPATHErrorResources.ER_COULDNOT_GET_VAR_NAMED,
  +            new Object[]{ m_qname.getLocalPart() });  //"Could not get variable named "+varName);
  +
         result = null;
       }
   
  -    if(null == result)
  +    if (null == result)
       {
  -      warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE, new Object[] {m_qname.getLocalPart()}); //"VariableReference given for variable out "+
  +      warn(xctxt, XPATHErrorResources.WG_ILLEGAL_VARIABLE_REFERENCE,
  +           new Object[]{ m_qname.getLocalPart() });  //"VariableReference given for variable out "+
  +
         result = new XNodeSet();
       }
   
  
  
  
  1.5       +116 -18   xml-xalan/java/src/org/apache/xpath/patterns/AncestorStepPattern.java
  
  Index: AncestorStepPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/AncestorStepPattern.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AncestorStepPattern.java	2000/10/17 19:44:43	1.4
  +++ AncestorStepPattern.java	2000/10/30 19:00:49	1.5
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.patterns;
   
   import org.apache.xpath.Expression;
  @@ -9,65 +65,108 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class AncestorStepPattern <needs-comment/>
  + */
   public class AncestorStepPattern extends StepPattern
   {
  +
  +  /**
  +   * Constructor AncestorStepPattern
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   * NEEDSDOC @param namespace
  +   * NEEDSDOC @param name
  +   */
     public AncestorStepPattern(int whatToShow, String namespace, String name)
     {
       super(whatToShow, namespace, name);
     }
  -  
  +
  +  /**
  +   * Constructor AncestorStepPattern
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   */
     public AncestorStepPattern(int whatToShow)
     {
       super(whatToShow);
     }
  -  
  +
     /**
      * Static calc of match score.
      */
     protected final void calcScore()
     {
  +
       m_score = SCORE_OTHER;
  -    if(null == m_targetString)
  +
  +    if (null == m_targetString)
         calcTargetString();
     }
  -  
  +
     /**
      * Overide the super method so that we can handle
  -   * match patterns starting with a function such as id()// 
  -   */  
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +   * match patterns starting with a function such as id()/
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       int whatToShow = getWhatToShow();
  -    if(whatToShow == NodeTest.SHOW_BYFUNCTION)
  +
  +    if (whatToShow == NodeTest.SHOW_BYFUNCTION)
       {
         XObject score = NodeTest.SCORE_NONE;
  -      if(null != m_relativePathPattern)
  +
  +      if (null != m_relativePathPattern)
         {
           score = m_relativePathPattern.execute(xctxt);
         }
  +
         return score;
       }
  -    else 
  +    else
         return super.execute(xctxt);
     }
   
  -  
  +  /**
  +   * NEEDSDOC Method executeRelativePathPattern 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (executeRelativePathPattern) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject executeRelativePathPattern(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       XObject score = NodeTest.SCORE_NONE;
       Node parent = xctxt.getCurrentNode();
  -    
  -    while(null != (parent = xctxt.getDOMHelper().getParentOfNode(parent)))
  +
  +    while (null != (parent = xctxt.getDOMHelper().getParentOfNode(parent)))
       {
         try
         {
           xctxt.pushCurrentNode(parent);
  +
           score = execute(xctxt);
  -        if(score != NodeTest.SCORE_NONE)
  +
  +        if (score != NodeTest.SCORE_NONE)
           {
             score = SCORE_OTHER;
  +
             break;
           }
         }
  @@ -76,8 +175,7 @@
           xctxt.popCurrentNode();
         }
       }
  +
       return score;
     }
  -
  -
   }
  
  
  
  1.3       +93 -10    xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java
  
  Index: FunctionPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/FunctionPattern.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FunctionPattern.java	2000/10/17 19:45:46	1.2
  +++ FunctionPattern.java	2000/10/30 19:00:50	1.3
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.patterns;
   
   import org.apache.xpath.XPath;
  @@ -10,26 +66,42 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class FunctionPattern <needs-comment/>
  + */
   public class FunctionPattern extends StepPattern
   {
  +
  +  /**
  +   * Constructor FunctionPattern
  +   *
  +   *
  +   * NEEDSDOC @param expr
  +   */
     public FunctionPattern(Expression expr)
     {
  +
       super(0, null, null);
  +
       m_functionExpr = expr;
     }
  -  
  +
     /**
      * Static calc of match score.
      */
     protected final void calcScore()
     {
  +
       m_score = SCORE_OTHER;
  -    if(null == m_targetString)
  +
  +    if (null == m_targetString)
         calcTargetString();
     }
  -  
  +
  +  /** NEEDSDOC Field m_functionExpr          */
     Expression m_functionExpr;
  -  
  +
     /**
      * Test a node to see if it matches the given node test.
      * @param xpath The xpath that is executing.
  @@ -37,29 +109,40 @@
      * @param opPos The current position in the xpath.m_opMap array.
      * @param len The length of the argument.
      * @param len The type of the step.
  -   * @returns score in an XNumber, one of MATCH_SCORE_NODETEST, 
  +   * @returns score in an XNumber, one of MATCH_SCORE_NODETEST,
      * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       Node context = xctxt.getCurrentNode();
       XObject obj = m_functionExpr.execute(xctxt);
       NodeIterator nl = obj.nodeset();
       XNumber score = SCORE_NONE;
  -    if(null != nl)
  +
  +    if (null != nl)
       {
         Node n;
  -      while(null != (n = nl.nextNode()))
  +
  +      while (null != (n = nl.nextNode()))
         {
           score = (n.equals(context)) ? SCORE_OTHER : SCORE_NONE;
  -        if(score == SCORE_OTHER)
  +
  +        if (score == SCORE_OTHER)
           {
             context = n;
  +
             break;
           }
         }
       }
  +
       return score;
     }
   }
  
  
  
  1.10      +272 -126  xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java
  
  Index: NodeTest.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/NodeTest.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- NodeTest.java	2000/10/17 21:35:04	1.9
  +++ NodeTest.java	2000/10/30 19:00:51	1.10
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.patterns;
   
   import org.w3c.dom.traversal.NodeFilter;
  @@ -13,169 +69,264 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeFilter;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class NodeTest <needs-comment/>
  + */
   public class NodeTest extends Expression
   {
  +
  +  /** NEEDSDOC Field WILD          */
     public static final String WILD = "*";
   
     /**
      * This attribute determines which node types are accepted.
      */
     protected int m_whatToShow;
  -  
  +
  +  /** NEEDSDOC Field SHOW_NAMESPACE          */
     public static final int SHOW_NAMESPACE = 0x00001000;
  -  
  +
     /**
  -   * Special bitmap for match patterns starting with a function. 
  +   * Special bitmap for match patterns starting with a function.
      * Make sure this does not conflict with dom.traversal.NodeFilter
  -   */  
  +   */
     public static final int SHOW_BYFUNCTION = 0x00010000;
  -  
  +
     /**
      * This attribute determines which node types are accepted.
  -   * These constants are defined in the <code>NodeFilter</code> 
  +   * These constants are defined in the <code>NodeFilter</code>
      * interface.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public int getWhatToShow()
     {
       return m_whatToShow;
     }
  -  
  +
  +  /** NEEDSDOC Field m_namespace          */
     String m_namespace;
  -  
  +
     /**
      * Return the namespace to be tested.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getNamespace()
     {
       return m_namespace;
     }
  -  
  +
  +  /** NEEDSDOC Field m_name          */
     String m_name;
  -  
  +
     /**
      * Return the local namespace to be tested.
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     public String getLocalName()
     {
       return m_name;
     }
  -  
  +
  +  /** NEEDSDOC Field m_score          */
     XNumber m_score;
  -  
  -  static final XNumber SCORE_NODETEST 
  -    = new XNumber( XPath.MATCH_SCORE_NODETEST );
  -  static final XNumber SCORE_NSWILD 
  -    = new XNumber( XPath.MATCH_SCORE_NSWILD );
  -  static final XNumber SCORE_QNAME 
  -    = new XNumber( XPath.MATCH_SCORE_QNAME );
  -  static final XNumber SCORE_OTHER 
  -    = new XNumber( XPath.MATCH_SCORE_OTHER );
  -  public static final XNumber SCORE_NONE 
  -    = new XNumber( XPath.MATCH_SCORE_NONE );
  -  
  +
  +  /** NEEDSDOC Field SCORE_NODETEST          */
  +  static final XNumber SCORE_NODETEST =
  +    new XNumber(XPath.MATCH_SCORE_NODETEST);
  +
  +  /** NEEDSDOC Field SCORE_NSWILD          */
  +  static final XNumber SCORE_NSWILD = new XNumber(XPath.MATCH_SCORE_NSWILD);
  +
  +  /** NEEDSDOC Field SCORE_QNAME          */
  +  static final XNumber SCORE_QNAME = new XNumber(XPath.MATCH_SCORE_QNAME);
  +
  +  /** NEEDSDOC Field SCORE_OTHER          */
  +  static final XNumber SCORE_OTHER = new XNumber(XPath.MATCH_SCORE_OTHER);
  +
  +  /** NEEDSDOC Field SCORE_NONE          */
  +  public static final XNumber SCORE_NONE =
  +    new XNumber(XPath.MATCH_SCORE_NONE);
  +
  +  /**
  +   * Constructor NodeTest
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   * NEEDSDOC @param namespace
  +   * NEEDSDOC @param name
  +   */
     public NodeTest(int whatToShow, String namespace, String name)
     {
       initNodeTest(whatToShow, namespace, name);
     }
  -  
  +
  +  /**
  +   * Constructor NodeTest
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   */
     public NodeTest(int whatToShow)
     {
       initNodeTest(whatToShow);
  -  }
  -  
  -  public NodeTest()
  -  {
     }
  -  
  +
  +  /**
  +   * Constructor NodeTest
  +   *
  +   */
  +  public NodeTest(){}
  +
  +  /**
  +   * NEEDSDOC Method initNodeTest 
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   */
     public void initNodeTest(int whatToShow)
     {
  +
       m_whatToShow = whatToShow;
  +
       calcScore();
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method initNodeTest 
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   * NEEDSDOC @param namespace
  +   * NEEDSDOC @param name
  +   */
     public void initNodeTest(int whatToShow, String namespace, String name)
     {
  +
       m_whatToShow = whatToShow;
       m_namespace = namespace;
       m_name = name;
  +
       calcScore();
     }
  -  
  +
  +  /** NEEDSDOC Field m_isTotallyWild          */
     private boolean m_isTotallyWild;
  -  
  +
     /**
      * Static calc of match score.
      */
     protected void calcScore()
     {
  -    if((m_namespace == null) && (m_name == null))
  +
  +    if ((m_namespace == null) && (m_name == null))
         m_score = SCORE_NODETEST;
  -    else if(((m_namespace == WILD) || (m_namespace == null)) && (m_name == WILD))
  +    else if (((m_namespace == WILD) || (m_namespace == null))
  +             && (m_name == WILD))
         m_score = SCORE_NODETEST;
  -    else if((m_namespace != WILD) && (m_name == WILD))
  +    else if ((m_namespace != WILD) && (m_name == WILD))
         m_score = SCORE_NSWILD;
       else
         m_score = SCORE_QNAME;
  -    
  -    m_isTotallyWild = ( m_namespace == null && m_name == WILD);
  +
  +    m_isTotallyWild = (m_namespace == null && m_name == WILD);
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getDefaultScore 
  +   *
  +   *
  +   * NEEDSDOC (getDefaultScore) @return
  +   */
     public double getDefaultScore()
     {
       return m_score.num();
  -  }  
  -  
  +  }
  +
  +  /**
  +   * NEEDSDOC Method debugWhatToShow 
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   */
     public static void debugWhatToShow(int whatToShow)
     {
  +
       java.util.Vector v = new java.util.Vector();
  -    if(0 != (whatToShow & NodeFilter.SHOW_ATTRIBUTE))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_ATTRIBUTE))
         v.addElement("SHOW_ATTRIBUTE");
  -    if(0 != (whatToShow & NodeFilter.SHOW_CDATA_SECTION))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_CDATA_SECTION))
         v.addElement("SHOW_CDATA_SECTION");
  -    if(0 != (whatToShow & NodeFilter.SHOW_COMMENT))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_COMMENT))
         v.addElement("SHOW_COMMENT");
  -    if(0 != (whatToShow & NodeFilter.SHOW_DOCUMENT))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_DOCUMENT))
         v.addElement("SHOW_DOCUMENT");
  -    if(0 != (whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_DOCUMENT_FRAGMENT))
         v.addElement("SHOW_DOCUMENT_FRAGMENT");
  -    if(0 != (whatToShow & NodeFilter.SHOW_DOCUMENT_TYPE))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_DOCUMENT_TYPE))
         v.addElement("SHOW_DOCUMENT_TYPE");
  -    if(0 != (whatToShow & NodeFilter.SHOW_ELEMENT))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_ELEMENT))
         v.addElement("SHOW_ELEMENT");
  -    if(0 != (whatToShow & NodeFilter.SHOW_ENTITY))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_ENTITY))
         v.addElement("SHOW_ENTITY");
  -    if(0 != (whatToShow & NodeFilter.SHOW_ENTITY_REFERENCE))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_ENTITY_REFERENCE))
         v.addElement("SHOW_ENTITY_REFERENCE");
  -    if(0 != (whatToShow & NodeFilter.SHOW_NOTATION))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_NOTATION))
         v.addElement("SHOW_NOTATION");
  -    if(0 != (whatToShow & NodeFilter.SHOW_PROCESSING_INSTRUCTION))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_PROCESSING_INSTRUCTION))
         v.addElement("SHOW_PROCESSING_INSTRUCTION");
  -    if(0 != (whatToShow & NodeFilter.SHOW_TEXT))
  +
  +    if (0 != (whatToShow & NodeFilter.SHOW_TEXT))
         v.addElement("SHOW_TEXT");
  +
       int n = v.size();
  -    for(int i = 0; i < n; i++)
  +
  +    for (int i = 0; i < n; i++)
       {
  -      if(i > 0)
  +      if (i > 0)
           System.out.print(" | ");
  +
         System.out.print(v.elementAt(i));
       }
  -    if(0 == n)
  -      System.out.print("empty whatToShow: "+whatToShow);
  +
  +    if (0 == n)
  +      System.out.print("empty whatToShow: " + whatToShow);
  +
       System.out.println();
     }
   
     /**
  -   * Two names are equal if they and either both are null or 
  -   * the name t is wild and the name p is non-null, or the two 
  +   * Two names are equal if they and either both are null or
  +   * the name t is wild and the name p is non-null, or the two
      * strings are equal.
  +   *
  +   * NEEDSDOC @param p
  +   * NEEDSDOC @param t
  +   *
  +   * NEEDSDOC ($objectName$) @return
      */
     private static final boolean subPartMatch(String p, String t)
     {
  +
       // boolean b = (p == t) || ((null != p) && ((t == WILD) || p.equals(t)));
       // System.out.println("subPartMatch - p: "+p+", t: "+t+", result: "+b);
       return (p == t) || ((null != p) && ((t == WILD) || p.equals(t)));
     }
  -  
  +
     /**
      * Test a node to see if it matches the given node test.
      * @param xpath The xpath that is executing.
  @@ -183,91 +334,86 @@
      * @param opPos The current position in the xpath.m_opMap array.
      * @param len The length of the argument.
      * @param len The type of the step.
  -   * @returns score in an XNumber, one of MATCH_SCORE_NODETEST, 
  +   * @returns score in an XNumber, one of MATCH_SCORE_NODETEST,
      * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  -    int whatToShow = getWhatToShow();
  -    // debugWhatToShow(whatToShow);
  -    if(whatToShow == NodeFilter.SHOW_ALL)
  +
  +    if (m_whatToShow == NodeFilter.SHOW_ALL)
         return m_score;
  -    
  -    Node context = xctxt.getCurrentNode();
  -    int nodeType = context.getNodeType();
   
  -    int nodeBit = (whatToShow & (0x00000001 << (nodeType-1)));
  +    Node context = xctxt.getCurrentNode();
  +    short nodeType = context.getNodeType();
  +    int nodeBit = (m_whatToShow & (0x00000001 << (nodeType - 1)));
   
  -    switch(nodeBit)
  +    switch (nodeBit)
       {
  -    case NodeFilter.SHOW_DOCUMENT:
  +    case NodeFilter.SHOW_DOCUMENT :
         return SCORE_OTHER;
  -    case NodeFilter.SHOW_COMMENT:
  +    case NodeFilter.SHOW_COMMENT :
         return m_score;
  -      
  -    case NodeFilter.SHOW_CDATA_SECTION:
  -    case NodeFilter.SHOW_TEXT:
  +    case NodeFilter.SHOW_CDATA_SECTION :
  +    case NodeFilter.SHOW_TEXT :
         return (!xctxt.getDOMHelper().shouldStripSourceNode(context))
                ? m_score : SCORE_NONE;
  -
  -    case NodeFilter.SHOW_PROCESSING_INSTRUCTION:
  -      return subPartMatch(context.getNodeName(), m_name) 
  +    case NodeFilter.SHOW_PROCESSING_INSTRUCTION :
  +      return subPartMatch(context.getNodeName(), m_name)
                ? m_score : SCORE_NONE;
  -            
  -      // From the draft: "Two expanded names are equal if they 
  -      // have the same local part, and either both have no URI or 
  -      // both have the same URI."
  -      // "A node test * is true for any node of the principal node type. 
  -      // For example, child::* will select all element children of the 
  -      // context node, and attribute::* will select all attributes of 
  -      // the context node."
  -      // "A node test can have the form NCName:*. In this case, the prefix 
  -      // is expanded in the same way as with a QName using the context 
  -      // namespace declarations. The node test will be true for any node 
  -      // of the principal type whose expanded name has the URI to which 
  -      // the prefix expands, regardless of the local part of the name."
  +
  +    // From the draft: "Two expanded names are equal if they 
  +    // have the same local part, and either both have no URI or 
  +    // both have the same URI."
  +    // "A node test * is true for any node of the principal node type. 
  +    // For example, child::* will select all element children of the 
  +    // context node, and attribute::* will select all attributes of 
  +    // the context node."
  +    // "A node test can have the form NCName:*. In this case, the prefix 
  +    // is expanded in the same way as with a QName using the context 
  +    // namespace declarations. The node test will be true for any node 
  +    // of the principal type whose expanded name has the URI to which 
  +    // the prefix expands, regardless of the local part of the name."
  +    case NodeFilter.SHOW_ATTRIBUTE :
  +    {
  +      int isNamespace = (m_whatToShow & SHOW_NAMESPACE);
   
  -    case NodeFilter.SHOW_ATTRIBUTE:
  +      if (0 == isNamespace)
         {
  -        int isNamespace = (whatToShow & SHOW_NAMESPACE);
  -        if(0 == isNamespace)
  -        {
  -          DOMHelper dh = xctxt.getDOMHelper();
  -          if(!dh.isNamespaceNode(context))
  -            return (m_isTotallyWild ||
  -                    (subPartMatch(dh.getNamespaceOfNode(context), m_namespace) 
  -                     && subPartMatch(dh.getLocalNameOfNode(context), m_name))) ?
  -                   m_score : SCORE_NONE;
  -          else
  -            return SCORE_NONE;
  -        }
  +        DOMHelper dh = xctxt.getDOMHelper();
  +
  +        if (!dh.isNamespaceNode(context))
  +          return (m_isTotallyWild || (subPartMatch(dh.getNamespaceOfNode(context), m_namespace) && subPartMatch(dh.getLocalNameOfNode(context), m_name)))
  +                 ? m_score : SCORE_NONE;
           else
  -        {
  -          if(xctxt.getDOMHelper().isNamespaceNode(context))
  -          {
  -            String ns = context.getNodeValue();
  -            return (subPartMatch(ns, m_name)) ?
  -                   m_score : SCORE_NONE;
  -          }
  -          else
  -            return SCORE_NONE;
  -        }
  +          return SCORE_NONE;
         }
  -      
  -    case NodeFilter.SHOW_ELEMENT:
  +      else
         {
  -        DOMHelper dh = xctxt.getDOMHelper();
  -        return (m_isTotallyWild ||
  -                (subPartMatch(dh.getNamespaceOfNode(context), m_namespace) 
  -                && subPartMatch(dh.getLocalNameOfNode(context), m_name))) ?
  -               m_score : SCORE_NONE;
  +        if (xctxt.getDOMHelper().isNamespaceNode(context))
  +        {
  +          String ns = context.getNodeValue();
  +
  +          return (subPartMatch(ns, m_name)) ? m_score : SCORE_NONE;
  +        }
  +        else
  +          return SCORE_NONE;
         }
  -      
  -    default:
  +    }
  +    case NodeFilter.SHOW_ELEMENT :
  +    {
  +      DOMHelper dh = xctxt.getDOMHelper();
  +
  +      return (m_isTotallyWild || (subPartMatch(dh.getNamespaceOfNode(context), m_namespace) && subPartMatch(dh.getLocalNameOfNode(context), m_name)))
  +             ? m_score : SCORE_NONE;
  +    }
  +    default :
         return SCORE_NONE;
  -    } // end switch(testType)
  -    
  +    }  // end switch(testType)
     }
  -  
   }
  
  
  
  1.2       +66 -3     xml-xalan/java/src/org/apache/xpath/patterns/NodeTestFilter.java
  
  Index: NodeTestFilter.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/NodeTestFilter.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- NodeTestFilter.java	2000/08/07 02:54:33	1.1
  +++ NodeTestFilter.java	2000/10/30 19:00:51	1.2
  @@ -1,11 +1,74 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.patterns;
   
   /**
  - * This interface should be implemented by Nodes and/or iterators, 
  - * when they need to know what the node test is before get they do 
  + * This interface should be implemented by Nodes and/or iterators,
  + * when they need to know what the node test is before get they do
    * getNextChild, etc.
    */
   public interface NodeTestFilter
  -{ 
  +{
  +
  +  /**
  +   * NEEDSDOC Method setNodeTest 
  +   *
  +   *
  +   * NEEDSDOC @param nodeTest
  +   */
     void setNodeTest(NodeTest nodeTest);
   }
  
  
  
  1.10      +282 -80   xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java
  
  Index: StepPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/StepPattern.java,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -r1.9 -r1.10
  --- StepPattern.java	2000/10/17 19:50:37	1.9
  +++ StepPattern.java	2000/10/30 19:00:52	1.10
  @@ -1,3 +1,59 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.patterns;
   
   import org.apache.xpath.Expression;
  @@ -11,150 +67,232 @@
   import org.w3c.dom.Node;
   import org.w3c.dom.traversal.NodeIterator;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class StepPattern <needs-comment/>
  + */
   public class StepPattern extends NodeTest implements SubContextList
  -{  
  +{
  +
  +  /**
  +   * Constructor StepPattern
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   * NEEDSDOC @param namespace
  +   * NEEDSDOC @param name
  +   */
     public StepPattern(int whatToShow, String namespace, String name)
     {
       super(whatToShow, namespace, name);
     }
  -  
  +
  +  /**
  +   * Constructor StepPattern
  +   *
  +   *
  +   * NEEDSDOC @param whatToShow
  +   */
     public StepPattern(int whatToShow)
     {
       super(whatToShow);
     }
  -  
  -  String m_targetString; // only calculate on head
  -  
  +
  +  /** NEEDSDOC Field m_targetString          */
  +  String m_targetString;  // only calculate on head
  +
  +  /**
  +   * NEEDSDOC Method calcTargetString 
  +   *
  +   */
     public void calcTargetString()
     {
  +
       int whatToShow = getWhatToShow();
  -    switch(whatToShow)
  +
  +    switch (whatToShow)
       {
  -    case NodeFilter.SHOW_COMMENT:
  +    case NodeFilter.SHOW_COMMENT :
         m_targetString = PsuedoNames.PSEUDONAME_COMMENT;
         break;
  -    case NodeFilter.SHOW_TEXT:
  +    case NodeFilter.SHOW_TEXT :
         m_targetString = PsuedoNames.PSEUDONAME_TEXT;
         break;
  -    case NodeFilter.SHOW_ALL:
  +    case NodeFilter.SHOW_ALL :
         m_targetString = PsuedoNames.PSEUDONAME_ANY;
         break;
  -    case NodeFilter.SHOW_DOCUMENT:
  +    case NodeFilter.SHOW_DOCUMENT :
         m_targetString = PsuedoNames.PSEUDONAME_ROOT;
         break;
  -    case NodeFilter.SHOW_ELEMENT:
  -      if(this.WILD == m_name)
  +    case NodeFilter.SHOW_ELEMENT :
  +      if (this.WILD == m_name)
           m_targetString = PsuedoNames.PSEUDONAME_ANY;
         else
           m_targetString = m_name;
         break;
  -    default:
  +    default :
         m_targetString = PsuedoNames.PSEUDONAME_ANY;
         break;
       }
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getTargetString 
  +   *
  +   *
  +   * NEEDSDOC (getTargetString) @return
  +   */
     public String getTargetString()
     {
       return m_targetString;
     }
  -  
  +
     /**
  -   * Reference to nodetest and predicate for 
  +   * Reference to nodetest and predicate for
      * parent or ancestor.
      */
     StepPattern m_relativePathPattern;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setRelativePathPattern 
  +   *
  +   *
  +   * NEEDSDOC @param expr
  +   */
     public void setRelativePathPattern(StepPattern expr)
     {
  +
       m_relativePathPattern = expr;
  +
       calcScore();
     }
  -  
  +
  +  /** NEEDSDOC Field m_predicates          */
     Expression[] m_predicates;
  -  
  +
  +  /**
  +   * NEEDSDOC Method getPredicate 
  +   *
  +   *
  +   * NEEDSDOC @param i
  +   *
  +   * NEEDSDOC (getPredicate) @return
  +   */
     public Expression getPredicate(int i)
     {
       return m_predicates[i];
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getPredicateCount 
  +   *
  +   *
  +   * NEEDSDOC (getPredicateCount) @return
  +   */
     public final int getPredicateCount()
     {
       return (null == m_predicates) ? 0 : m_predicates.length;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method setPredicates 
  +   *
  +   *
  +   * NEEDSDOC @param predicates
  +   */
     public void setPredicates(Expression[] predicates)
     {
  +
       m_predicates = predicates;
  +
       calcScore();
     }
  -  
  +
     /**
      * Static calc of match score.
      */
     protected void calcScore()
     {
  -    if((getPredicateCount() > 0)  || (null != m_relativePathPattern))
  +
  +    if ((getPredicateCount() > 0) || (null != m_relativePathPattern))
         m_score = SCORE_OTHER;
       else
         super.calcScore();
  -    if(null == m_targetString)
  +
  +    if (null == m_targetString)
         calcTargetString();
     }
   
  -  
  +  /**
  +   * NEEDSDOC Method executeStep 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (executeStep) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject executeStep(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  +
       XObject score;
  -    int nodeType = xctxt.getCurrentNode().getNodeType();
  -    if(nodeType == Node.ATTRIBUTE_NODE &&
  -         m_whatToShow != NodeFilter.SHOW_ATTRIBUTE)
  +    short nodeType = xctxt.getCurrentNode().getNodeType();
  +
  +    if (nodeType == Node.ATTRIBUTE_NODE
  +            && m_whatToShow != NodeFilter.SHOW_ATTRIBUTE)
       {
         score = NodeTest.SCORE_NONE;
       }
  -    else if(nodeType == Node.DOCUMENT_NODE &&
  -         m_whatToShow != NodeFilter.SHOW_DOCUMENT)
  +    else if (nodeType == Node.DOCUMENT_NODE
  +             && m_whatToShow != NodeFilter.SHOW_DOCUMENT)
       {
         score = NodeTest.SCORE_NONE;
       }
       else
         score = super.execute(xctxt);
  -    
  -    if(score == NodeTest.SCORE_NONE)
  +
  +    if (score == NodeTest.SCORE_NONE)
       {
  +
         // System.out.println("executeStep: "+this.m_name+" = "+score);
         return score;
       }
  -    
  +
       int n = getPredicateCount();
  -    if(n == 0)
  +
  +    if (n == 0)
         return score;
   
  -    // xctxt.getVarStack().setCurrentStackFrameIndex(m_lpi.getStackFrameIndex());
       // xctxt.setNamespaceContext(m_lpi.getPrefixResolver());
       // xctxt.pushCurrentNode(context);
       try
       {
         xctxt.pushSubContextList(this);
  -      for(int i = 0; i < n; i++)
  +
  +      for (int i = 0; i < n; i++)
         {
           XObject pred;
  +
           pred = m_predicates[i].execute(xctxt);
  -        if(XObject.CLASS_NUMBER == pred.getType())
  +
  +        if (XObject.CLASS_NUMBER == pred.getType())
           {
  -          if(this.getProximityPosition(xctxt) != (int)pred.num())
  +          if (this.getProximityPosition(xctxt) != (int) pred.num())
             {
               score = NodeTest.SCORE_NONE;
  +
               break;
             }
           }
  -        else if(!pred.bool())
  +        else if (!pred.bool())
           {
             score = NodeTest.SCORE_NONE;
  +
             break;
           }
  -        
  +
           // countProximityPosition(++m_predicateIndex);
         }
       }
  @@ -162,32 +300,46 @@
       {
         xctxt.popSubContextList();
       }
  +
       // System.out.println("executeStep: "+this.m_name+" = "+score);
       return score;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getProximityPosition 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getProximityPosition) @return
  +   */
     public int getProximityPosition(XPathContext xctxt)
     {
  +
       Node context = xctxt.getCurrentNode();
  +
       // System.out.println("context: "+context.getNodeName());
       Node parentContext = xctxt.getDOMHelper().getParentOfNode(context);
  +
       // System.out.println("parentContext: "+parentContext.getNodeName());
       try
       {
         xctxt.pushCurrentNode(parentContext);
  -      
  +
         int pos = 0;
  -      for(Node child = parentContext.getFirstChild(); 
  -          child != null; 
  -          child = child.getNextSibling())
  +
  +      for (Node child = parentContext.getFirstChild(); child != null;
  +              child = child.getNextSibling())
         {
           try
           {
             xctxt.pushCurrentNode(child);
  -          if(NodeTest.SCORE_NONE != super.execute(xctxt))
  +
  +          if (NodeTest.SCORE_NONE != super.execute(xctxt))
             {
               pos++;
  -            if(child.equals( context ))
  +
  +            if (child.equals(context))
               {
                 return pos;
               }
  @@ -199,110 +351,162 @@
           }
         }
       }
  -    catch(org.xml.sax.SAXException se)
  +    catch (org.xml.sax.SAXException se)
       {
  +
         // TODO: should keep throw sax exception...
         throw new java.lang.RuntimeException(se.getMessage());
       }
       finally
       {
         xctxt.popCurrentNode();
  +
         // xctxt.popContextNodeList();
       }
  +
       return 0;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getLastPos 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (getLastPos) @return
  +   */
     public int getLastPos(XPathContext xctxt)
     {
  +
       Node context = xctxt.getCurrentNode();
       Node parentContext = xctxt.getDOMHelper().getParentOfNode(context);
  +
       try
       {
         xctxt.pushCurrentNode(parentContext);
  -      
  +
         int count = 0;
  -      for(Node child = parentContext.getFirstChild(); 
  -          child != null; 
  -          child = child.getNextSibling())
  +
  +      for (Node child = parentContext.getFirstChild(); child != null;
  +              child = child.getNextSibling())
         {
           try
           {
             xctxt.pushCurrentNode(child);
  -          if(NodeTest.SCORE_NONE != super.execute(xctxt))
  +
  +          if (NodeTest.SCORE_NONE != super.execute(xctxt))
               count++;
           }
           finally
           {
             xctxt.popCurrentNode();
  -        }        
  +        }
         }
  +
         return count;
       }
  -    catch(org.xml.sax.SAXException se)
  +    catch (org.xml.sax.SAXException se)
       {
  +
         // TODO: should keep throw sax exception...
         throw new java.lang.RuntimeException(se.getMessage());
       }
       finally
       {
         xctxt.popCurrentNode();
  +
         // xctxt.popContextNodeList();
  -    }   
  +    }
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method executeRelativePathPattern 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (executeRelativePathPattern) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
     public XObject executeRelativePathPattern(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +          throws org.xml.sax.SAXException
     {
  -    XObject score;    
  -    Node parent = xctxt.getDOMHelper().getParentOfNode(xctxt.getCurrentNode());
  +
  +    XObject score;
  +    Node parent =
  +      xctxt.getDOMHelper().getParentOfNode(xctxt.getCurrentNode());
  +
       if (null != parent)
       {
         try
         {
           xctxt.pushCurrentNode(parent);
  +
           score = execute(xctxt);
  -        if(score != NodeTest.SCORE_NONE)
  +
  +        if (score != NodeTest.SCORE_NONE)
             score = SCORE_OTHER;
         }
         finally
         {
           xctxt.popCurrentNode();
         }
  -    }  
  +    }
       else
  -      score = NodeTest.SCORE_NONE;    
  -    
  +      score = NodeTest.SCORE_NONE;
  +
       return score;
     }
  -  
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +
  +  /**
  +   * NEEDSDOC Method execute 
  +   *
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC (execute) @return
  +   *
  +   * @throws org.xml.sax.SAXException
  +   */
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       XObject score;
  +
       // int n = getPredicateCount();
  -    
       score = executeStep(xctxt);
  -    
  -    if((score != NodeTest.SCORE_NONE) && (null != m_relativePathPattern))
  +
  +    if ((score != NodeTest.SCORE_NONE) && (null != m_relativePathPattern))
       {
         score = m_relativePathPattern.executeRelativePathPattern(xctxt);
       }
  +
       return score;
     }
  -  
  +
  +  /** NEEDSDOC Field DEBUG_MATCHES          */
     private static final boolean DEBUG_MATCHES = false;
  -  
  +
     /**
      * Get the match score of the given node.
  +   *
  +   * NEEDSDOC @param xctxt
      * @param context The current source tree context node.
  -   * @returns score, one of MATCH_SCORE_NODETEST, 
  +   * @returns score, one of MATCH_SCORE_NODETEST,
      * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public double getMatchScore(XPathContext xctxt, Node context) 
  -    throws org.xml.sax.SAXException
  +  public double getMatchScore(XPathContext xctxt, Node context)
  +          throws org.xml.sax.SAXException
     {
  +
       xctxt.pushCurrentNode(context);
       xctxt.pushCurrentExpressionNode(context);
  +
       try
       {
         XObject score = execute(xctxt);
  @@ -314,9 +518,7 @@
         xctxt.popCurrentNode();
         xctxt.popCurrentExpressionNode();
       }
  +
       // return XPath.MATCH_SCORE_NONE;
     }
  -
  -  
  -
   }
  
  
  
  1.3       +95 -13    xml-xalan/java/src/org/apache/xpath/patterns/UnionPattern.java
  
  Index: UnionPattern.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/patterns/UnionPattern.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- UnionPattern.java	2000/10/16 22:56:04	1.2
  +++ UnionPattern.java	2000/10/30 19:00:52	1.3
  @@ -1,23 +1,97 @@
  +/*
  + * The Apache Software License, Version 1.1
  + *
  + *
  + * Copyright (c) 1999 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 "Xalan" 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, Lotus
  + * Development Corporation., http://www.lotus.com.  For more
  + * information on the Apache Software Foundation, please see
  + * <http://www.apache.org/>.
  + */
   package org.apache.xpath.patterns;
   
   import org.apache.xpath.Expression;
   import org.apache.xpath.XPathContext;
   import org.apache.xpath.objects.XObject;
   
  +/**
  + * <meta name="usage" content="internal"/>
  + * NEEDSDOC Class UnionPattern <needs-comment/>
  + */
   public class UnionPattern extends Expression
   {
  +
  +  /** NEEDSDOC Field m_patterns          */
     private StepPattern[] m_patterns;
  -  
  +
  +  /**
  +   * NEEDSDOC Method setPatterns 
  +   *
  +   *
  +   * NEEDSDOC @param patterns
  +   */
     public void setPatterns(StepPattern[] patterns)
     {
       m_patterns = patterns;
     }
  -  
  +
  +  /**
  +   * NEEDSDOC Method getPatterns 
  +   *
  +   *
  +   * NEEDSDOC (getPatterns) @return
  +   */
     public StepPattern[] getPatterns()
     {
       return m_patterns;
     }
  -  
  +
     /**
      * Test a node to see if it matches the given node test.
      * @param xpath The xpath that is executing.
  @@ -25,31 +99,39 @@
      * @param opPos The current position in the xpath.m_opMap array.
      * @param len The length of the argument.
      * @param len The type of the step.
  -   * @returns score in an XNumber, one of MATCH_SCORE_NODETEST, 
  +   * @returns score in an XNumber, one of MATCH_SCORE_NODETEST,
      * MATCH_SCORE_NONE, MATCH_SCORE_OTHER, MATCH_SCORE_QNAME.
  +   *
  +   * NEEDSDOC @param xctxt
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   *
  +   * @throws org.xml.sax.SAXException
      */
  -  public XObject execute(XPathContext xctxt)
  -    throws org.xml.sax.SAXException
  +  public XObject execute(XPathContext xctxt) throws org.xml.sax.SAXException
     {
  +
       XObject bestScore = null;
  -    
       int n = m_patterns.length;
  -    for(int i = 0; i < n; i++)
  +
  +    for (int i = 0; i < n; i++)
       {
         XObject score = m_patterns[i].execute(xctxt);
  -      if(score != NodeTest.SCORE_NONE)
  +
  +      if (score != NodeTest.SCORE_NONE)
         {
  -        if(null == bestScore)
  +        if (null == bestScore)
             bestScore = score;
  -        else if(score.num() > bestScore.num())
  +        else if (score.num() > bestScore.num())
             bestScore = score;
         }
       }
  -    if(null == bestScore)
  +
  +    if (null == bestScore)
       {
         bestScore = NodeTest.SCORE_NONE;
       }
  -    
  +
       return bestScore;
     }
   }
  
  
  
  1.2       +43 -85    xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResourceBundle.java
  
  Index: XPATHErrorResourceBundle.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResourceBundle.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPATHErrorResourceBundle.java	2000/07/05 14:49:03	1.1
  +++ XPATHErrorResourceBundle.java	2000/10/30 19:00:56	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,98 +55,56 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xpath.res;
  +
   import java.util.*;
   
   /**
    * <meta name="usage" content="internal"/>
    * LangResources_en.properties
    */
  -public class XPATHErrorResourceBundle extends ListResourceBundle 
  +public class XPATHErrorResourceBundle extends ListResourceBundle
   {
  +
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
     public Object[][] getContents()
     {
       return contents;
  -  }	
  +  }
   
  -  static final Object[][] contents = 
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
     {
  -
  -    {"ui_language","en"},
  -    {"help_language", "en"},
  -    {"language", "en"},
  -
  -    {"ERROR0001","0001"},
  -    {"ERROR0002", "0002"},
  -    {"ERROR0003", "0003"},
  -    {"ERROR0004", "0004"},
  -    {"ERROR0005", "0005"},
  -    {"ERROR0006", "0006"},
  -    {"ERROR0007", "0007"},
  -    {"ERROR0008", "0008"},
  -    {"ERROR0009", "0009"},
  -    {"ERROR0010", "0010"},
  -    {"ERROR0011", "0011"},
  -    {"ERROR0012", "0012"},
  -    {"ERROR0013", "0013"},
  -    {"ERROR0014", "0014"},
  -    {"ERROR0015", "0015"},
  -    {"ERROR0016", "0016"},
  -    {"ERROR0017", "0017"},
  -    {"ERROR0018", "0018"},
  -    {"ERROR0019", "0019"},
  -    {"ERROR0020", "0020"},
  -    {"ERROR0021", "0021"},
  -    {"ERROR0022", "0022"},
  -    {"ERROR0023", "0023"},
  -    {"ERROR0024", "0024"},
  -    {"ERROR0025", "0025"},
  -    {"ERROR0026", "0026"},
  -    {"ERROR0027", "0027"},
  -    {"ERROR0028", "0028"},
  -    {"ERROR0029", "0029"},
  -    {"ERROR0030", "0030"},
  -    {"ERROR0031", "0031"},
  -    {"ERROR0032", "0032"},
  -    {"ERROR0033", "0033"},
  -    {"ERROR0034", "0034"},
  -    {"ERROR0035", "0035"},
  -    {"ERROR0036", "0036"},
  -    {"ERROR0037", "0037"},
  -    {"ERROR0038", "0038"},
  -    {"ERROR0039", "0039"},
  -    {"ERROR0040", "0040"},
  -    {"ERROR0041", "0041"},
  -    {"ERROR0042", "0042"},
  -    {"ERROR0043", "0043"},
  -    {"ERROR0044", "0044"},
  -    {"ERROR0045", "0045"},
  -    {"ERROR0046", "0046"},
  -    {"ERROR0047", "0047"},
  -    {"ERROR0048", "0048"},
  -    {"ERROR0049", "0049"},
  -    {"ERROR0050", "0050"},
  -    {"ERROR0051", "0051"},
  -    {"ERROR0052", "0052"},
  -    {"ERROR0053", "0053"},
  -    {"ERROR0054", "0054"},
  -    {"ERROR0055", "0055"},
  -    {"ERROR0056", "0056"},
  -    {"ERROR0057", "0057"},
  -    {"ERROR0058", "0058"},
  -    {"ERROR0059", "0059"},
  -    {"ERROR0060", "0060"},
  -
  -
  -    {"WARNING0001", "0001"},
  -    {"WARNING0002", "0002"},
  -    {"WARNING0003", "0003"},
  -    {"WARNING0004", "0004"},
  -    {"WARNING0005", "0005"},
  -    {"WARNING0006", "0006"},
  -    {"WARNING0007", "0007"},
  -    {"WARNING0008", "0008"},
  -    {"WARNING0009", "0009"},
  -    {"WARNING0010", "0010"},
  -    {"WARNING0011", "0011"}
  -  };    
  -}  
  +    { "ui_language", "en" }, { "help_language", "en" }, { "language", "en" },
  +    { "ERROR0001", "0001" }, { "ERROR0002", "0002" }, { "ERROR0003", "0003" },
  +    { "ERROR0004", "0004" }, { "ERROR0005", "0005" }, { "ERROR0006", "0006" },
  +    { "ERROR0007", "0007" }, { "ERROR0008", "0008" }, { "ERROR0009", "0009" },
  +    { "ERROR0010", "0010" }, { "ERROR0011", "0011" }, { "ERROR0012", "0012" },
  +    { "ERROR0013", "0013" }, { "ERROR0014", "0014" }, { "ERROR0015", "0015" },
  +    { "ERROR0016", "0016" }, { "ERROR0017", "0017" }, { "ERROR0018", "0018" },
  +    { "ERROR0019", "0019" }, { "ERROR0020", "0020" }, { "ERROR0021", "0021" },
  +    { "ERROR0022", "0022" }, { "ERROR0023", "0023" }, { "ERROR0024", "0024" },
  +    { "ERROR0025", "0025" }, { "ERROR0026", "0026" }, { "ERROR0027", "0027" },
  +    { "ERROR0028", "0028" }, { "ERROR0029", "0029" }, { "ERROR0030", "0030" },
  +    { "ERROR0031", "0031" }, { "ERROR0032", "0032" }, { "ERROR0033", "0033" },
  +    { "ERROR0034", "0034" }, { "ERROR0035", "0035" }, { "ERROR0036", "0036" },
  +    { "ERROR0037", "0037" }, { "ERROR0038", "0038" }, { "ERROR0039", "0039" },
  +    { "ERROR0040", "0040" }, { "ERROR0041", "0041" }, { "ERROR0042", "0042" },
  +    { "ERROR0043", "0043" }, { "ERROR0044", "0044" }, { "ERROR0045", "0045" },
  +    { "ERROR0046", "0046" }, { "ERROR0047", "0047" }, { "ERROR0048", "0048" },
  +    { "ERROR0049", "0049" }, { "ERROR0050", "0050" }, { "ERROR0051", "0051" },
  +    { "ERROR0052", "0052" }, { "ERROR0053", "0053" }, { "ERROR0054", "0054" },
  +    { "ERROR0055", "0055" }, { "ERROR0056", "0056" }, { "ERROR0057", "0057" },
  +    { "ERROR0058", "0058" }, { "ERROR0059", "0059" }, { "ERROR0060", "0060" },
  +    { "WARNING0001", "0001" }, { "WARNING0002", "0002" },
  +    { "WARNING0003", "0003" }, { "WARNING0004", "0004" },
  +    { "WARNING0005", "0005" }, { "WARNING0006", "0006" },
  +    { "WARNING0007", "0007" }, { "WARNING0008", "0008" },
  +    { "WARNING0009", "0009" }, { "WARNING0010", "0010" },
  +    { "WARNING0011", "0011" }
  +  };
  +}
  
  
  
  1.3       +628 -423  xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java
  
  Index: XPATHErrorResources.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XPATHErrorResources.java	2000/08/09 17:51:58	1.2
  +++ XPATHErrorResources.java	2000/10/30 19:00:57	1.3
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,710 +55,881 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xpath.res;
  +
   import org.apache.xalan.res.XSLResourceBundle;
  +
   import java.util.*;
  +
   import java.text.DecimalFormat;
   
   /**
    * <meta name="usage" content="advanced"/>
    * Set up error messages.
  - * We build a two dimensional array of message keys and 
  + * We build a two dimensional array of message keys and
    * message strings. In order to add a new message here,
  - * you need to first update the count of messages(MAX_CODE)or 
  - * the count of warnings(MAX_WARNING). The array will be 
  - * automatically filled in with the keys, but you need to 
  + * you need to first update the count of messages(MAX_CODE)or
  + * the count of warnings(MAX_WARNING). The array will be
  + * automatically filled in with the keys, but you need to
    * fill in the actual message string. Follow the instructions
  - * below.   
  + * below.
    */
  -public class XPATHErrorResources extends XSLResourceBundle 
  +public class XPATHErrorResources extends XSLResourceBundle
   {
  +
  +  /** NEEDSDOC Field ERROR_SUFFIX          */
  +  public static final String ERROR_SUFFIX = "ER";
   
  -  public static final String ERROR_SUFFIX = "ER";  
  +  /** NEEDSDOC Field WARNING_SUFFIX          */
     public static final String WARNING_SUFFIX = "WR";
  +
  +  /** NEEDSDOC Field MAX_CODE          */
  +  public static final int MAX_CODE = 68;  // this is needed to keep track of the number of messages          
   
  -  public static final int MAX_CODE = 68;                // this is needed to keep track of the number of messages          
  -  public static final int MAX_WARNING = 11;             // this is needed to keep track of the number of warnings
  +  /** NEEDSDOC Field MAX_WARNING          */
  +  public static final int MAX_WARNING = 11;  // this is needed to keep track of the number of warnings
  +
  +  /** NEEDSDOC Field MAX_OTHERS          */
     public static final int MAX_OTHERS = 20;
  -  public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING +1;
  +
  +  /** NEEDSDOC Field MAX_MESSAGES          */
  +  public static final int MAX_MESSAGES = MAX_CODE + MAX_WARNING + 1;
   
  -  static final Object[][] contents = new Object[MAX_MESSAGES + MAX_OTHERS +1][2];
  +  /** NEEDSDOC Field contents          */
  +  static final Object[][] contents =
  +    new Object[MAX_MESSAGES + MAX_OTHERS + 1][2];
   
  -  /* 
  +  /*
     * Now fill in the message keys.
     * This does not need to be updated. If MAX_CODE and MAX_WARNING
     * are correct, the keys will get filled in automatically with
  -  * the value ERxxxx (WRxxxx for warnings) where xxxx is a 
  +  * the value ERxxxx (WRxxxx for warnings) where xxxx is a
     * formatted number corresponding to the error code (i.e. ER0001).
  -  */ 
  -  static 
  +  */
  +  static
     {
  -    for(int i = 0; i < MAX_CODE+1; i++)
  +    for (int i = 0; i < MAX_CODE + 1; i++)
       {
         contents[i][0] = getMKey(i);
       }
  -    for(int i = 1; i < MAX_WARNING+1; i++)
  +
  +    for (int i = 1; i < MAX_WARNING + 1; i++)
       {
  -      contents[i+ MAX_CODE][0] = getWKey(i);
  +      contents[i + MAX_CODE][0] = getWKey(i);
       }
     }
   
     /*
     * Now fill in the message text.
  -  * First create an int for the message code. Make sure you 
  +  * First create an int for the message code. Make sure you
     * update MAX_CODE for error messages and MAX_WARNING for warnings
     * Then fill in the message text for that message code in the
     * array. Use the new error code as the index into the array.
  -  */ 
  +  */
   
     // Error messages...
   
  +  /** NEEDSDOC Field ERROR0000          */
     public static final int ERROR0000 = 0;
  -  static 
  +
  +  static
     {
  -    contents[ERROR0000][1] 
  -    = "{0}";
  +    contents[ERROR0000][1] = "{0}";
     }
   
  +  /** NEEDSDOC Field ER_CURRENT_NOT_ALLOWED_IN_MATCH          */
     public static final int ER_CURRENT_NOT_ALLOWED_IN_MATCH = 1;
  -  static 
  +
  +  static
     {
  -    contents[ER_CURRENT_NOT_ALLOWED_IN_MATCH][1] 
  -    = "The current() function is not allowed in a match pattern!";
  +    contents[ER_CURRENT_NOT_ALLOWED_IN_MATCH][1] =
  +      "The current() function is not allowed in a match pattern!";
     }
   
  +  /** NEEDSDOC Field ER_CURRENT_TAKES_NO_ARGS          */
     public static final int ER_CURRENT_TAKES_NO_ARGS = 2;
  -  static 
  +
  +  static
     {
  -    contents[ER_CURRENT_TAKES_NO_ARGS][1] 
  -    = "The current() function does not accept arguments!";
  +    contents[ER_CURRENT_TAKES_NO_ARGS][1] =
  +      "The current() function does not accept arguments!";
     }
   
  +  /** NEEDSDOC Field ER_DOCUMENT_REPLACED          */
     public static final int ER_DOCUMENT_REPLACED = 3;
  -  static 
  +
  +  static
     {
  -    contents[ER_DOCUMENT_REPLACED][1] 
  -    = "document() function implementation has been replaced by org.apache.xalan.xslt.FuncDocument!";
  +    contents[ER_DOCUMENT_REPLACED][1] =
  +      "document() function implementation has been replaced by org.apache.xalan.xslt.FuncDocument!";
     }
   
  +  /** NEEDSDOC Field ER_CONTEXT_HAS_NO_OWNERDOC          */
     public static final int ER_CONTEXT_HAS_NO_OWNERDOC = 4;
  -  static 
  +
  +  static
     {
  -    contents[ER_CONTEXT_HAS_NO_OWNERDOC][1] 
  -    = "context does not have an owner document!";
  +    contents[ER_CONTEXT_HAS_NO_OWNERDOC][1] =
  +      "context does not have an owner document!";
     }
  +
  +  /** NEEDSDOC Field ER_LOCALNAME_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_LOCALNAME_HAS_TOO_MANY_ARGS = 5;
   
  -  public static final int ER_LOCALNAME_HAS_TOO_MANY_ARGS  = 5;
  -  static 
  +  static
     {
  -    contents[ER_LOCALNAME_HAS_TOO_MANY_ARGS ][1] 
  -    = "local-name() has too many arguments.";
  +    contents[ER_LOCALNAME_HAS_TOO_MANY_ARGS][1] =
  +      "local-name() has too many arguments.";
     }
   
  -  public static final int ER_NAMESPACEURI_HAS_TOO_MANY_ARGS  = 6;
  -  static 
  +  /** NEEDSDOC Field ER_NAMESPACEURI_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_NAMESPACEURI_HAS_TOO_MANY_ARGS = 6;
  +
  +  static
     {
  -    contents[ER_NAMESPACEURI_HAS_TOO_MANY_ARGS ][1] 
  -    = "namespace-uri() has too many arguments.";
  +    contents[ER_NAMESPACEURI_HAS_TOO_MANY_ARGS][1] =
  +      "namespace-uri() has too many arguments.";
     }
  +
  +  /** NEEDSDOC Field ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS = 7;
   
  -  public static final int ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS  = 7;
  -  static 
  +  static
     {
  -    contents[ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS ][1] 
  -    = "normalize-space() has too many arguments.";
  +    contents[ER_NORMALIZESPACE_HAS_TOO_MANY_ARGS][1] =
  +      "normalize-space() has too many arguments.";
     }
  +
  +  /** NEEDSDOC Field ER_NUMBER_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_NUMBER_HAS_TOO_MANY_ARGS = 8;
   
  -  public static final int ER_NUMBER_HAS_TOO_MANY_ARGS  = 8;
  -  static 
  +  static
     {
  -    contents[ER_NUMBER_HAS_TOO_MANY_ARGS ][1] 
  -    = "number() has too many arguments.";
  +    contents[ER_NUMBER_HAS_TOO_MANY_ARGS][1] =
  +      "number() has too many arguments.";
     }
   
  -  public static final int ER_NAME_HAS_TOO_MANY_ARGS  = 9;
  -  static 
  +  /** NEEDSDOC Field ER_NAME_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_NAME_HAS_TOO_MANY_ARGS = 9;
  +
  +  static
     {
  -    contents[ER_NAME_HAS_TOO_MANY_ARGS ][1] 
  -    = "name() has too many arguments.";
  +    contents[ER_NAME_HAS_TOO_MANY_ARGS][1] = "name() has too many arguments.";
     }
  +
  +  /** NEEDSDOC Field ER_STRING_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_STRING_HAS_TOO_MANY_ARGS = 10;
   
  -  public static final int ER_STRING_HAS_TOO_MANY_ARGS  = 10;
  -  static 
  +  static
     {
  -    contents[ER_STRING_HAS_TOO_MANY_ARGS ][1] 
  -    = "string() has too many arguments.";
  +    contents[ER_STRING_HAS_TOO_MANY_ARGS][1] =
  +      "string() has too many arguments.";
     }
   
  -  public static final int ER_STRINGLENGTH_HAS_TOO_MANY_ARGS  = 11;
  -  static 
  +  /** NEEDSDOC Field ER_STRINGLENGTH_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_STRINGLENGTH_HAS_TOO_MANY_ARGS = 11;
  +
  +  static
     {
  -    contents[ER_STRINGLENGTH_HAS_TOO_MANY_ARGS ][1] 
  -    = "string-length() has too many arguments.";
  +    contents[ER_STRINGLENGTH_HAS_TOO_MANY_ARGS][1] =
  +      "string-length() has too many arguments.";
     }
  +
  +  /** NEEDSDOC Field ER_TRANSLATE_TAKES_3_ARGS          */
  +  public static final int ER_TRANSLATE_TAKES_3_ARGS = 12;
   
  -  public static final int ER_TRANSLATE_TAKES_3_ARGS  = 12;
  -  static 
  +  static
     {
  -    contents[ER_TRANSLATE_TAKES_3_ARGS ][1] 
  -    = "The translate() function takes three arguments!";
  +    contents[ER_TRANSLATE_TAKES_3_ARGS][1] =
  +      "The translate() function takes three arguments!";
     }
  +
  +  /** NEEDSDOC Field ER_UNPARSEDENTITYURI_TAKES_1_ARG          */
  +  public static final int ER_UNPARSEDENTITYURI_TAKES_1_ARG = 13;
   
  -  public static final int ER_UNPARSEDENTITYURI_TAKES_1_ARG  = 13;
  -  static 
  +  static
     {
  -    contents[ER_UNPARSEDENTITYURI_TAKES_1_ARG ][1] 
  -    = "The unparsed-entity-uri function should take one argument!";
  +    contents[ER_UNPARSEDENTITYURI_TAKES_1_ARG][1] =
  +      "The unparsed-entity-uri function should take one argument!";
     }
   
  -  public static final int ER_NAMESPACEAXIS_NOT_IMPLEMENTED  = 14;
  -  static 
  +  /** NEEDSDOC Field ER_NAMESPACEAXIS_NOT_IMPLEMENTED          */
  +  public static final int ER_NAMESPACEAXIS_NOT_IMPLEMENTED = 14;
  +
  +  static
     {
  -    contents[ER_NAMESPACEAXIS_NOT_IMPLEMENTED ][1] 
  -    = "namespace axis not implemented yet!";
  +    contents[ER_NAMESPACEAXIS_NOT_IMPLEMENTED][1] =
  +      "namespace axis not implemented yet!";
     }
  +
  +  /** NEEDSDOC Field ER_UNKNOWN_AXIS          */
  +  public static final int ER_UNKNOWN_AXIS = 15;
   
  -  public static final int ER_UNKNOWN_AXIS  = 15;
  -  static 
  +  static
     {
  -    contents[ER_UNKNOWN_AXIS ][1] 
  -    = "unknown axis: {0}";
  +    contents[ER_UNKNOWN_AXIS][1] = "unknown axis: {0}";
     }
  +
  +  /** NEEDSDOC Field ER_UNKNOWN_MATCH_OPERATION          */
  +  public static final int ER_UNKNOWN_MATCH_OPERATION = 16;
   
  -  public static final int ER_UNKNOWN_MATCH_OPERATION  = 16;
  -  static 
  +  static
     {
  -    contents[ER_UNKNOWN_MATCH_OPERATION ][1] 
  -    = "unknown match operation!";
  +    contents[ER_UNKNOWN_MATCH_OPERATION][1] = "unknown match operation!";
     }
   
  -  public static final int ER_INCORRECT_ARG_LENGTH  = 17;
  -  static 
  +  /** NEEDSDOC Field ER_INCORRECT_ARG_LENGTH          */
  +  public static final int ER_INCORRECT_ARG_LENGTH = 17;
  +
  +  static
     {
  -    contents[ER_INCORRECT_ARG_LENGTH ][1] 
  -    = "Arg length of processing-instruction() node test is incorrect!";
  +    contents[ER_INCORRECT_ARG_LENGTH][1] =
  +      "Arg length of processing-instruction() node test is incorrect!";
     }
  +
  +  /** NEEDSDOC Field ER_CANT_CONVERT_TO_NUMBER          */
  +  public static final int ER_CANT_CONVERT_TO_NUMBER = 18;
   
  -  public static final int ER_CANT_CONVERT_TO_NUMBER  = 18;
  -  static 
  +  static
     {
  -    contents[ER_CANT_CONVERT_TO_NUMBER ][1] 
  -    = "Can not convert {0} to a number";
  +    contents[ER_CANT_CONVERT_TO_NUMBER][1] =
  +      "Can not convert {0} to a number";
     }
  +
  +  /** NEEDSDOC Field ER_CANT_CONVERT_TO_NODELIST          */
  +  public static final int ER_CANT_CONVERT_TO_NODELIST = 19;
   
  -  public static final int ER_CANT_CONVERT_TO_NODELIST  = 19;
  -  static 
  +  static
     {
  -    contents[ER_CANT_CONVERT_TO_NODELIST ][1] 
  -    = "Can not convert {0} to a NodeList!";
  +    contents[ER_CANT_CONVERT_TO_NODELIST][1] =
  +      "Can not convert {0} to a NodeList!";
     }
   
  -  public static final int ER_CANT_CONVERT_TO_MUTABLENODELIST  = 20;
  -  static 
  +  /** NEEDSDOC Field ER_CANT_CONVERT_TO_MUTABLENODELIST          */
  +  public static final int ER_CANT_CONVERT_TO_MUTABLENODELIST = 20;
  +
  +  static
     {
  -    contents[ER_CANT_CONVERT_TO_MUTABLENODELIST ][1] 
  -    = "Can not convert {0} to a NodeSet!";
  +    contents[ER_CANT_CONVERT_TO_MUTABLENODELIST][1] =
  +      "Can not convert {0} to a NodeSet!";
     }
  +
  +  /** NEEDSDOC Field ER_CANT_CONVERT_TO_TYPE          */
  +  public static final int ER_CANT_CONVERT_TO_TYPE = 21;
   
  -  public static final int ER_CANT_CONVERT_TO_TYPE  = 21;
  -  static 
  +  static
     {
  -    contents[ER_CANT_CONVERT_TO_TYPE ][1] 
  -    = "Can not convert {0} to a type#{1}";
  +    contents[ER_CANT_CONVERT_TO_TYPE][1] =
  +      "Can not convert {0} to a type#{1}";
     }
   
  -  public static final int ER_EXPECTED_MATCH_PATTERN  = 22;
  -  static 
  +  /** NEEDSDOC Field ER_EXPECTED_MATCH_PATTERN          */
  +  public static final int ER_EXPECTED_MATCH_PATTERN = 22;
  +
  +  static
     {
  -    contents[ER_EXPECTED_MATCH_PATTERN ][1] 
  -    = "Expected match pattern in getMatchScore!";
  +    contents[ER_EXPECTED_MATCH_PATTERN][1] =
  +      "Expected match pattern in getMatchScore!";
     }
  +
  +  /** NEEDSDOC Field ER_COULDNOT_GET_VAR_NAMED          */
  +  public static final int ER_COULDNOT_GET_VAR_NAMED = 23;
   
  -  public static final int ER_COULDNOT_GET_VAR_NAMED  = 23;
  -  static 
  +  static
     {
  -    contents[ER_COULDNOT_GET_VAR_NAMED ][1] 
  -    = "Could not get variable named {0}";
  +    contents[ER_COULDNOT_GET_VAR_NAMED][1] =
  +      "Could not get variable named {0}";
     }
  +
  +  /** NEEDSDOC Field ER_UNKNOWN_OPCODE          */
  +  public static final int ER_UNKNOWN_OPCODE = 24;
   
  -  public static final int ER_UNKNOWN_OPCODE  = 24;
  -  static 
  +  static
     {
  -    contents[ER_UNKNOWN_OPCODE ][1] 
  -    = "ERROR! Unknown op code: {0}";
  +    contents[ER_UNKNOWN_OPCODE][1] = "ERROR! Unknown op code: {0}";
     }
   
  -  public static final int ER_EXTRA_ILLEGAL_TOKENS  = 25;
  -  static 
  +  /** NEEDSDOC Field ER_EXTRA_ILLEGAL_TOKENS          */
  +  public static final int ER_EXTRA_ILLEGAL_TOKENS = 25;
  +
  +  static
     {
  -    contents[ER_EXTRA_ILLEGAL_TOKENS ][1] 
  -    = "Extra illegal tokens: {0}";
  +    contents[ER_EXTRA_ILLEGAL_TOKENS][1] = "Extra illegal tokens: {0}";
     }
  +
  +  /** NEEDSDOC Field ER_EXPECTED_DOUBLE_QUOTE          */
  +  public static final int ER_EXPECTED_DOUBLE_QUOTE = 26;
   
  -  public static final int ER_EXPECTED_DOUBLE_QUOTE  = 26;
  -  static 
  +  static
     {
  -    contents[ER_EXPECTED_DOUBLE_QUOTE ][1] 
  -    = "misquoted literal... expected double quote!";
  +    contents[ER_EXPECTED_DOUBLE_QUOTE][1] =
  +      "misquoted literal... expected double quote!";
     }
   
  -  public static final int ER_EXPECTED_SINGLE_QUOTE  = 27;
  -  static 
  +  /** NEEDSDOC Field ER_EXPECTED_SINGLE_QUOTE          */
  +  public static final int ER_EXPECTED_SINGLE_QUOTE = 27;
  +
  +  static
     {
  -    contents[ER_EXPECTED_SINGLE_QUOTE ][1] 
  -    = "misquoted literal... expected single quote!";
  +    contents[ER_EXPECTED_SINGLE_QUOTE][1] =
  +      "misquoted literal... expected single quote!";
     }
  +
  +  /** NEEDSDOC Field ER_EMPTY_EXPRESSION          */
  +  public static final int ER_EMPTY_EXPRESSION = 28;
   
  -  public static final int ER_EMPTY_EXPRESSION  = 28;
  -  static 
  +  static
     {
  -    contents[ER_EMPTY_EXPRESSION ][1] 
  -    = "Empty expression!";
  +    contents[ER_EMPTY_EXPRESSION][1] = "Empty expression!";
     }
  +
  +  /** NEEDSDOC Field ER_EXPECTED_BUT_FOUND          */
  +  public static final int ER_EXPECTED_BUT_FOUND = 29;
   
  -  public static final int ER_EXPECTED_BUT_FOUND  = 29;
  -  static 
  +  static
     {
  -    contents[ER_EXPECTED_BUT_FOUND ][1] 
  -    = "Expected {0}, but found: {1}";
  +    contents[ER_EXPECTED_BUT_FOUND][1] = "Expected {0}, but found: {1}";
     }
   
  -  public static final int ER_INCORRECT_PROGRAMMER_ASSERTION  = 30;
  -  static 
  +  /** NEEDSDOC Field ER_INCORRECT_PROGRAMMER_ASSERTION          */
  +  public static final int ER_INCORRECT_PROGRAMMER_ASSERTION = 30;
  +
  +  static
     {
  -    contents[ER_INCORRECT_PROGRAMMER_ASSERTION ][1] 
  -    = "Programmer assertion is incorrect! - {0}";
  +    contents[ER_INCORRECT_PROGRAMMER_ASSERTION][1] =
  +      "Programmer assertion is incorrect! - {0}";
     }
  +
  +  /** NEEDSDOC Field ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL          */
  +  public static final int ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL = 31;
   
  -  public static final int ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL  = 31;
  -  static 
  +  static
     {
  -    contents[ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL ][1] 
  -    = "boolean(...) argument is no longer optional with 19990709 XPath draft.";
  +    contents[ER_BOOLEAN_ARG_NO_LONGER_OPTIONAL][1] =
  +      "boolean(...) argument is no longer optional with 19990709 XPath draft.";
     }
   
  -  public static final int ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG  = 32;
  -  static 
  +  /** NEEDSDOC Field ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG          */
  +  public static final int ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG = 32;
  +
  +  static
     {
  -    contents[ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG ][1] 
  -    = "Found ',' but no preceding argument!";
  +    contents[ER_FOUND_COMMA_BUT_NO_PRECEDING_ARG][1] =
  +      "Found ',' but no preceding argument!";
     }
  +
  +  /** NEEDSDOC Field ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG          */
  +  public static final int ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG = 33;
   
  -  public static final int ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG  = 33;
  -  static 
  +  static
     {
  -    contents[ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG ][1] 
  -    = "Found ',' but no following argument!";
  +    contents[ER_FOUND_COMMA_BUT_NO_FOLLOWING_ARG][1] =
  +      "Found ',' but no following argument!";
     }
  +
  +  /** NEEDSDOC Field ER_PREDICATE_ILLEGAL_SYNTAX          */
  +  public static final int ER_PREDICATE_ILLEGAL_SYNTAX = 34;
   
  -  public static final int ER_PREDICATE_ILLEGAL_SYNTAX  = 34;
  -  static 
  +  static
     {
  -    contents[ER_PREDICATE_ILLEGAL_SYNTAX ][1] 
  -    = "'..[predicate]' or '.[predicate]' is illegal syntax.  Use 'self::node()[predicate]' instead.";
  +    contents[ER_PREDICATE_ILLEGAL_SYNTAX][1] =
  +      "'..[predicate]' or '.[predicate]' is illegal syntax.  Use 'self::node()[predicate]' instead.";
     }
   
  -  public static final int ER_ILLEGAL_AXIS_NAME  = 35;
  -  static 
  +  /** NEEDSDOC Field ER_ILLEGAL_AXIS_NAME          */
  +  public static final int ER_ILLEGAL_AXIS_NAME = 35;
  +
  +  static
     {
  -    contents[ER_ILLEGAL_AXIS_NAME ][1] 
  -    = "illegal axis name: {0}";
  +    contents[ER_ILLEGAL_AXIS_NAME][1] = "illegal axis name: {0}";
     }
  +
  +  /** NEEDSDOC Field ER_UNKNOWN_NODETYPE          */
  +  public static final int ER_UNKNOWN_NODETYPE = 36;
   
  -  public static final int ER_UNKNOWN_NODETYPE  = 36;
  -  static 
  +  static
     {
  -    contents[ER_UNKNOWN_NODETYPE ][1] 
  -    = "Unknown nodetype: {0}";
  +    contents[ER_UNKNOWN_NODETYPE][1] = "Unknown nodetype: {0}";
     }
  +
  +  /** NEEDSDOC Field ER_PATTERN_LITERAL_NEEDS_BE_QUOTED          */
  +  public static final int ER_PATTERN_LITERAL_NEEDS_BE_QUOTED = 37;
   
  -  public static final int ER_PATTERN_LITERAL_NEEDS_BE_QUOTED  = 37;
  -  static 
  +  static
     {
  -    contents[ER_PATTERN_LITERAL_NEEDS_BE_QUOTED ][1] 
  -    = "Pattern literal ({0}) needs to be quoted!";
  +    contents[ER_PATTERN_LITERAL_NEEDS_BE_QUOTED][1] =
  +      "Pattern literal ({0}) needs to be quoted!";
     }
   
  -  public static final int ER_COULDNOT_BE_FORMATTED_TO_NUMBER  = 38;
  -  static 
  +  /** NEEDSDOC Field ER_COULDNOT_BE_FORMATTED_TO_NUMBER          */
  +  public static final int ER_COULDNOT_BE_FORMATTED_TO_NUMBER = 38;
  +
  +  static
     {
  -    contents[ER_COULDNOT_BE_FORMATTED_TO_NUMBER ][1] 
  -    = "{0} could not be formatted to a number!";
  +    contents[ER_COULDNOT_BE_FORMATTED_TO_NUMBER][1] =
  +      "{0} could not be formatted to a number!";
     }
  +
  +  /** NEEDSDOC Field ER_COULDNOT_CREATE_XMLPROCESSORLIAISON          */
  +  public static final int ER_COULDNOT_CREATE_XMLPROCESSORLIAISON = 39;
   
  -  public static final int ER_COULDNOT_CREATE_XMLPROCESSORLIAISON  = 39;
  -  static 
  +  static
     {
  -    contents[ER_COULDNOT_CREATE_XMLPROCESSORLIAISON ][1] 
  -    = "Could not create XML Processor Liaison: {0}";
  +    contents[ER_COULDNOT_CREATE_XMLPROCESSORLIAISON][1] =
  +      "Could not create XML Processor Liaison: {0}";
     }
  +
  +  /** NEEDSDOC Field ER_DIDNOT_FIND_XPATH_SELECT_EXP          */
  +  public static final int ER_DIDNOT_FIND_XPATH_SELECT_EXP = 40;
   
  -  public static final int ER_DIDNOT_FIND_XPATH_SELECT_EXP  = 40;
  -  static 
  +  static
     {
  -    contents[ER_DIDNOT_FIND_XPATH_SELECT_EXP ][1] 
  -    = "Error! Did not find xpath select expression (-select).";
  +    contents[ER_DIDNOT_FIND_XPATH_SELECT_EXP][1] =
  +      "Error! Did not find xpath select expression (-select).";
     }
   
  -  public static final int ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH  = 41;
  -  static 
  +  /** NEEDSDOC Field ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH          */
  +  public static final int ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH = 41;
  +
  +  static
     {
  -    contents[ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH ][1] 
  -    = "ERROR! Could not find ENDOP after OP_LOCATIONPATH";
  +    contents[ER_COULDNOT_FIND_ENDOP_AFTER_OPLOCATIONPATH][1] =
  +      "ERROR! Could not find ENDOP after OP_LOCATIONPATH";
     }
  +
  +  /** NEEDSDOC Field ER_ERROR_OCCURED          */
  +  public static final int ER_ERROR_OCCURED = 42;
   
  -  public static final int ER_ERROR_OCCURED  = 42;
  -  static 
  +  static
     {
  -    contents[ER_ERROR_OCCURED ][1] 
  -    = "Error occured!";
  +    contents[ER_ERROR_OCCURED][1] = "Error occured!";
     }
   
  -  public static final int ER_ILLEGAL_VARIABLE_REFERENCE  = 43;
  -  static 
  +  /** NEEDSDOC Field ER_ILLEGAL_VARIABLE_REFERENCE          */
  +  public static final int ER_ILLEGAL_VARIABLE_REFERENCE = 43;
  +
  +  static
     {
  -    contents[ER_ILLEGAL_VARIABLE_REFERENCE][1] 
  -    = "VariableReference given for variable out of context or without definition!  Name = {0}";
  +    contents[ER_ILLEGAL_VARIABLE_REFERENCE][1] =
  +      "VariableReference given for variable out of context or without definition!  Name = {0}";
     }
  +
  +  /** NEEDSDOC Field ER_AXES_NOT_ALLOWED          */
  +  public static final int ER_AXES_NOT_ALLOWED = 44;
   
  -  public static final int ER_AXES_NOT_ALLOWED  = 44;
  -  static 
  +  static
     {
  -    contents[ER_AXES_NOT_ALLOWED][1] 
  -    = "Only child:: and attribute:: axes are allowed in match patterns!  Offending axes = {0}";
  +    contents[ER_AXES_NOT_ALLOWED][1] =
  +      "Only child:: and attribute:: axes are allowed in match patterns!  Offending axes = {0}";
     }
  +
  +  /** NEEDSDOC Field ER_KEY_HAS_TOO_MANY_ARGS          */
  +  public static final int ER_KEY_HAS_TOO_MANY_ARGS = 45;
   
  -  public static final int ER_KEY_HAS_TOO_MANY_ARGS  = 45;
  -  static 
  +  static
     {
  -    contents[ER_KEY_HAS_TOO_MANY_ARGS ][1] 
  -    = "key() has an incorrect number of arguments.";
  +    contents[ER_KEY_HAS_TOO_MANY_ARGS][1] =
  +      "key() has an incorrect number of arguments.";
     }
   
  -  public static final int ER_COUNT_TAKES_1_ARG  = 46;
  -  static 
  +  /** NEEDSDOC Field ER_COUNT_TAKES_1_ARG          */
  +  public static final int ER_COUNT_TAKES_1_ARG = 46;
  +
  +  static
     {
  -    contents[ER_COUNT_TAKES_1_ARG ][1] 
  -    = "The count function should take one argument!";
  +    contents[ER_COUNT_TAKES_1_ARG][1] =
  +      "The count function should take one argument!";
     }
  +
  +  /** NEEDSDOC Field ER_COULDNOT_FIND_FUNCTION          */
  +  public static final int ER_COULDNOT_FIND_FUNCTION = 47;
   
  -  public static final int ER_COULDNOT_FIND_FUNCTION  = 47;
  -  static 
  +  static
     {
  -    contents[ER_COULDNOT_FIND_FUNCTION ][1] 
  -    = "Could not find function: {0}";
  +    contents[ER_COULDNOT_FIND_FUNCTION][1] = "Could not find function: {0}";
     }
  -  
  -  public static final int ER_UNSUPPORTED_ENCODING  = 48;
  -  static 
  +
  +  /** NEEDSDOC Field ER_UNSUPPORTED_ENCODING          */
  +  public static final int ER_UNSUPPORTED_ENCODING = 48;
  +
  +  static
     {
  -    contents[ER_UNSUPPORTED_ENCODING ][1] 
  -    = "Unsupported encoding: {0}";
  +    contents[ER_UNSUPPORTED_ENCODING][1] = "Unsupported encoding: {0}";
     }
  -  
  -  public static final int ER_PROBLEM_IN_DTM_NEXTSIBLING  = 49;
  -  static 
  +
  +  /** NEEDSDOC Field ER_PROBLEM_IN_DTM_NEXTSIBLING          */
  +  public static final int ER_PROBLEM_IN_DTM_NEXTSIBLING = 49;
  +
  +  static
     {
  -    contents[ER_PROBLEM_IN_DTM_NEXTSIBLING ][1] 
  -    = "Problem occured in DTM in getNextSibling... trying to recover";
  +    contents[ER_PROBLEM_IN_DTM_NEXTSIBLING][1] =
  +      "Problem occured in DTM in getNextSibling... trying to recover";
     }
  -  
  -  public static final int ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL  = 50;
  -  static 
  +
  +  /** NEEDSDOC Field ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL          */
  +  public static final int ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL = 50;
  +
  +  static
     {
  -    contents[ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL ][1] 
  -    = "Programmer error: EmptyNodeList can not be written to.";
  +    contents[ER_CANNOT_WRITE_TO_EMPTYNODELISTIMPL][1] =
  +      "Programmer error: EmptyNodeList can not be written to.";
     }
  -  
  -  public static final int ER_SETDOMFACTORY_NOT_SUPPORTED  = 51;
  -  static 
  +
  +  /** NEEDSDOC Field ER_SETDOMFACTORY_NOT_SUPPORTED          */
  +  public static final int ER_SETDOMFACTORY_NOT_SUPPORTED = 51;
  +
  +  static
     {
  -    contents[ER_SETDOMFACTORY_NOT_SUPPORTED ][1] 
  -    = "setDOMFactory is not supported by XPathContext!";
  +    contents[ER_SETDOMFACTORY_NOT_SUPPORTED][1] =
  +      "setDOMFactory is not supported by XPathContext!";
     }
  -  
  -  public static final int ER_PREFIX_MUST_RESOLVE  = 52;
  -  static 
  +
  +  /** NEEDSDOC Field ER_PREFIX_MUST_RESOLVE          */
  +  public static final int ER_PREFIX_MUST_RESOLVE = 52;
  +
  +  static
     {
  -    contents[ER_PREFIX_MUST_RESOLVE ][1] 
  -      = "Prefix must resolve to a namespace: {0}";
  +    contents[ER_PREFIX_MUST_RESOLVE][1] =
  +      "Prefix must resolve to a namespace: {0}";
     }
  -  
  -  public static final int ER_PARSE_NOT_SUPPORTED  = 53;
  -  static 
  +
  +  /** NEEDSDOC Field ER_PARSE_NOT_SUPPORTED          */
  +  public static final int ER_PARSE_NOT_SUPPORTED = 53;
  +
  +  static
     {
  -    contents[ER_PARSE_NOT_SUPPORTED ][1] 
  -      = "parse (InputSource source) not supported in XPathContext! Can not open {0}";
  +    contents[ER_PARSE_NOT_SUPPORTED][1] =
  +      "parse (InputSource source) not supported in XPathContext! Can not open {0}";
     }
  -  
  -  public static final int ER_CREATEDOCUMENT_NOT_SUPPORTED  = 54;
  -  static 
  +
  +  /** NEEDSDOC Field ER_CREATEDOCUMENT_NOT_SUPPORTED          */
  +  public static final int ER_CREATEDOCUMENT_NOT_SUPPORTED = 54;
  +
  +  static
     {
  -    contents[ER_CREATEDOCUMENT_NOT_SUPPORTED ][1] 
  -      = "createDocument() not supported in XPathContext!";
  +    contents[ER_CREATEDOCUMENT_NOT_SUPPORTED][1] =
  +      "createDocument() not supported in XPathContext!";
     }
  -  
  -  public static final int ER_CHILD_HAS_NO_OWNER_DOCUMENT  = 55;
  -  static 
  +
  +  /** NEEDSDOC Field ER_CHILD_HAS_NO_OWNER_DOCUMENT          */
  +  public static final int ER_CHILD_HAS_NO_OWNER_DOCUMENT = 55;
  +
  +  static
     {
  -    contents[ER_CHILD_HAS_NO_OWNER_DOCUMENT ][1] 
  -      = "Attribute child does not have an owner document!";
  +    contents[ER_CHILD_HAS_NO_OWNER_DOCUMENT][1] =
  +      "Attribute child does not have an owner document!";
     }
   
  -  public static final int ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT  = 56;
  -  static 
  +  /** NEEDSDOC Field ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT          */
  +  public static final int ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT = 56;
  +
  +  static
     {
  -    contents[ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT ][1] 
  -      = "Attribute child does not have an owner document element!";
  +    contents[ER_CHILD_HAS_NO_OWNER_DOCUMENT_ELEMENT][1] =
  +      "Attribute child does not have an owner document element!";
     }
  -  
  -  public static final int ER_SAX_API_NOT_HANDLED  = 57;
  -  static 
  +
  +  /** NEEDSDOC Field ER_SAX_API_NOT_HANDLED          */
  +  public static final int ER_SAX_API_NOT_HANDLED = 57;
  +
  +  static
     {
  -    contents[ER_SAX_API_NOT_HANDLED ][1] 
  -      = "SAX API characters(char ch[]... not handled by the DTM!";
  +    contents[ER_SAX_API_NOT_HANDLED][1] =
  +      "SAX API characters(char ch[]... not handled by the DTM!";
     }
  -  
  -  public static final int ER_IGNORABLE_WHITESPACE_NOT_HANDLED  = 58;
  -  static 
  +
  +  /** NEEDSDOC Field ER_IGNORABLE_WHITESPACE_NOT_HANDLED          */
  +  public static final int ER_IGNORABLE_WHITESPACE_NOT_HANDLED = 58;
  +
  +  static
     {
  -    contents[ER_IGNORABLE_WHITESPACE_NOT_HANDLED ][1] 
  -      = "ignorableWhitespace(char ch[]... not handled by the DTM!";
  +    contents[ER_IGNORABLE_WHITESPACE_NOT_HANDLED][1] =
  +      "ignorableWhitespace(char ch[]... not handled by the DTM!";
     }
  -  
  -  public static final int ER_DTM_CANNOT_HANDLE_NODES  = 59;
  -  static 
  +
  +  /** NEEDSDOC Field ER_DTM_CANNOT_HANDLE_NODES          */
  +  public static final int ER_DTM_CANNOT_HANDLE_NODES = 59;
  +
  +  static
     {
  -    contents[ER_DTM_CANNOT_HANDLE_NODES ][1] 
  -      = "DTMLiaison can not handle nodes of type {0}";
  +    contents[ER_DTM_CANNOT_HANDLE_NODES][1] =
  +      "DTMLiaison can not handle nodes of type {0}";
     }
  -  
  -  public static final int ER_XERCES_CANNOT_HANDLE_NODES  = 60;
  -  static 
  +
  +  /** NEEDSDOC Field ER_XERCES_CANNOT_HANDLE_NODES          */
  +  public static final int ER_XERCES_CANNOT_HANDLE_NODES = 60;
  +
  +  static
     {
  -    contents[ER_XERCES_CANNOT_HANDLE_NODES ][1] 
  -      = "DOM2Helper can not handle nodes of type {0}";
  +    contents[ER_XERCES_CANNOT_HANDLE_NODES][1] =
  +      "DOM2Helper can not handle nodes of type {0}";
     }
  -  
  -  public static final int ER_XERCES_PARSE_ERROR_DETAILS  = 61;
  -  static 
  +
  +  /** NEEDSDOC Field ER_XERCES_PARSE_ERROR_DETAILS          */
  +  public static final int ER_XERCES_PARSE_ERROR_DETAILS = 61;
  +
  +  static
     {
  -    contents[ER_XERCES_PARSE_ERROR_DETAILS ][1] 
  -      = "DOM2Helper.parse error: SystemID - {0} line - {1}";
  +    contents[ER_XERCES_PARSE_ERROR_DETAILS][1] =
  +      "DOM2Helper.parse error: SystemID - {0} line - {1}";
     }
  -  
  -  public static final int ER_XERCES_PARSE_ERROR  = 62;
  -  static 
  +
  +  /** NEEDSDOC Field ER_XERCES_PARSE_ERROR          */
  +  public static final int ER_XERCES_PARSE_ERROR = 62;
  +
  +  static
     {
  -    contents[ER_XERCES_PARSE_ERROR ][1] 
  -      = "DOM2Helper.parse error";
  +    contents[ER_XERCES_PARSE_ERROR][1] = "DOM2Helper.parse error";
     }
  -  
  -  public static final int ER_CANT_OUTPUT_TEXT_BEFORE_DOC  = 63;
  -  static 
  +
  +  /** NEEDSDOC Field ER_CANT_OUTPUT_TEXT_BEFORE_DOC          */
  +  public static final int ER_CANT_OUTPUT_TEXT_BEFORE_DOC = 63;
  +
  +  static
     {
  -    contents[ER_CANT_OUTPUT_TEXT_BEFORE_DOC ][1] 
  -      = "Warning: can't output text before document element!  Ignoring...";
  +    contents[ER_CANT_OUTPUT_TEXT_BEFORE_DOC][1] =
  +      "Warning: can't output text before document element!  Ignoring...";
     }
  -  
  -  public static final int ER_CANT_HAVE_MORE_THAN_ONE_ROOT  = 64;
  -  static 
  +
  +  /** NEEDSDOC Field ER_CANT_HAVE_MORE_THAN_ONE_ROOT          */
  +  public static final int ER_CANT_HAVE_MORE_THAN_ONE_ROOT = 64;
  +
  +  static
     {
  -    contents[ER_CANT_HAVE_MORE_THAN_ONE_ROOT ][1] 
  -      = "Can't have more than one root on a DOM!";
  +    contents[ER_CANT_HAVE_MORE_THAN_ONE_ROOT][1] =
  +      "Can't have more than one root on a DOM!";
     }
  -  
  -  public static final int ER_INVALID_UTF16_SURROGATE  = 65;
  -  static 
  +
  +  /** NEEDSDOC Field ER_INVALID_UTF16_SURROGATE          */
  +  public static final int ER_INVALID_UTF16_SURROGATE = 65;
  +
  +  static
     {
  -    contents[ER_INVALID_UTF16_SURROGATE ][1] 
  -      = "Invalid UTF-16 surrogate detected: {0} ?";
  +    contents[ER_INVALID_UTF16_SURROGATE][1] =
  +      "Invalid UTF-16 surrogate detected: {0} ?";
     }
  -  
  -  public static final int ER_OIERROR  = 66;
  -  static 
  +
  +  /** NEEDSDOC Field ER_OIERROR          */
  +  public static final int ER_OIERROR = 66;
  +
  +  static
     {
  -    contents[ER_OIERROR ][1] 
  -      = "IO error";
  +    contents[ER_OIERROR][1] = "IO error";
     }
  -  
  -  public static final int ER_CANNOT_CREATE_URL  = 67;
  -  static 
  +
  +  /** NEEDSDOC Field ER_CANNOT_CREATE_URL          */
  +  public static final int ER_CANNOT_CREATE_URL = 67;
  +
  +  static
     {
  -    contents[ER_CANNOT_CREATE_URL ][1] 
  -      = "Cannot create url for: {0}";
  +    contents[ER_CANNOT_CREATE_URL][1] = "Cannot create url for: {0}";
     }
  -  
  -  public static final int ER_XPATH_READOBJECT  = 68;
  -  static 
  +
  +  /** NEEDSDOC Field ER_XPATH_READOBJECT          */
  +  public static final int ER_XPATH_READOBJECT = 68;
  +
  +  static
     {
  -    contents[ER_XPATH_READOBJECT ][1] 
  -      = "In XPath.readObject: {0}";
  +    contents[ER_XPATH_READOBJECT][1] = "In XPath.readObject: {0}";
     }
   
     // Warnings...
  +
  +  /** NEEDSDOC Field WG_LOCALE_NAME_NOT_HANDLED          */
  +  public static final int WG_LOCALE_NAME_NOT_HANDLED = 1;
   
  -  public static final int WG_LOCALE_NAME_NOT_HANDLED  = 1;
  -  static 
  +  static
     {
  -    contents[WG_LOCALE_NAME_NOT_HANDLED  + MAX_CODE][1] 
  -    = "locale name in the format-number function not yet handled!";
  +    contents[WG_LOCALE_NAME_NOT_HANDLED + MAX_CODE][1] =
  +      "locale name in the format-number function not yet handled!";
     }
  +
  +  /** NEEDSDOC Field WG_PROPERTY_NOT_SUPPORTED          */
  +  public static final int WG_PROPERTY_NOT_SUPPORTED = 2;
  +
  +  static
  +  {
  +    contents[WG_PROPERTY_NOT_SUPPORTED + MAX_CODE][1] =
  +      "XSL Property not supported: {0}";
  +  }
  +
  +  /** NEEDSDOC Field WG_DONT_DO_ANYTHING_WITH_NS          */
  +  public static final int WG_DONT_DO_ANYTHING_WITH_NS = 3;
   
  -  public static final int WG_PROPERTY_NOT_SUPPORTED  = 2;
  -  static 
  +  static
     {
  -    contents[WG_PROPERTY_NOT_SUPPORTED  + MAX_CODE][1] 
  -    = "XSL Property not supported: {0}";
  +    contents[WG_DONT_DO_ANYTHING_WITH_NS + MAX_CODE][1] =
  +      "Do not currently do anything with namespace {0} in property: {1}";
     }
   
  -  public static final int WG_DONT_DO_ANYTHING_WITH_NS  = 3;
  -  static 
  +  /** NEEDSDOC Field WG_SECURITY_EXCEPTION          */
  +  public static final int WG_SECURITY_EXCEPTION = 4;
  +
  +  static
     {
  -    contents[WG_DONT_DO_ANYTHING_WITH_NS  + MAX_CODE][1] 
  -    = "Do not currently do anything with namespace {0} in property: {1}";
  +    contents[WG_SECURITY_EXCEPTION + MAX_CODE][1] =
  +      "SecurityException when trying to access XSL system property: {0}";
     }
  +
  +  /** NEEDSDOC Field WG_QUO_NO_LONGER_DEFINED          */
  +  public static final int WG_QUO_NO_LONGER_DEFINED = 5;
   
  -  public static final int WG_SECURITY_EXCEPTION  = 4;
  -  static 
  +  static
     {
  -    contents[WG_SECURITY_EXCEPTION  + MAX_CODE][1] 
  -    = "SecurityException when trying to access XSL system property: {0}";
  +    contents[WG_QUO_NO_LONGER_DEFINED + MAX_CODE][1] =
  +      "Old syntax: quo(...) is no longer defined in XPath.";
     }
  +
  +  /** NEEDSDOC Field WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST          */
  +  public static final int WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST = 6;
   
  -  public static final int WG_QUO_NO_LONGER_DEFINED  = 5;
  -  static 
  +  static
     {
  -    contents[WG_QUO_NO_LONGER_DEFINED  + MAX_CODE][1] 
  -    = "Old syntax: quo(...) is no longer defined in XPath.";
  +    contents[WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST + MAX_CODE][1] =
  +      "XPath needs a derived object to implement nodeTest!";
     }
   
  +  /** NEEDSDOC Field WG_FUNCTION_TOKEN_NOT_FOUND          */
  +  public static final int WG_FUNCTION_TOKEN_NOT_FOUND = 7;
   
  -  public static final int WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST  = 6;
  -  static 
  +  static
     {
  -    contents[WG_NEED_DERIVED_OBJECT_TO_IMPLEMENT_NODETEST  + MAX_CODE][1] 
  -    = "XPath needs a derived object to implement nodeTest!";
  +    contents[WG_FUNCTION_TOKEN_NOT_FOUND + MAX_CODE][1] =
  +      "function token not found.";
     }
   
  -  public static final int WG_FUNCTION_TOKEN_NOT_FOUND  = 7;
  -  static 
  +  /** NEEDSDOC Field WG_COULDNOT_FIND_FUNCTION          */
  +  public static final int WG_COULDNOT_FIND_FUNCTION = 8;
  +
  +  static
     {
  -    contents[WG_FUNCTION_TOKEN_NOT_FOUND  + MAX_CODE][1] 
  -    = "function token not found.";
  +    contents[WG_COULDNOT_FIND_FUNCTION + MAX_CODE][1] =
  +      "Could not find function: {0}";
     }
  +
  +  /** NEEDSDOC Field WG_CANNOT_MAKE_URL_FROM          */
  +  public static final int WG_CANNOT_MAKE_URL_FROM = 9;
   
  -  public static final int WG_COULDNOT_FIND_FUNCTION  = 8;
  -  static 
  +  static
     {
  -    contents[WG_COULDNOT_FIND_FUNCTION  + MAX_CODE][1] 
  -    = "Could not find function: {0}";
  +    contents[WG_CANNOT_MAKE_URL_FROM + MAX_CODE][1] =
  +      "Can not make URL from: {0}";
     }
  +
  +  /** NEEDSDOC Field WG_EXPAND_ENTITIES_NOT_SUPPORTED          */
  +  public static final int WG_EXPAND_ENTITIES_NOT_SUPPORTED = 10;
   
  -  public static final int WG_CANNOT_MAKE_URL_FROM  = 9;
  -  static 
  +  static
     {
  -    contents[WG_CANNOT_MAKE_URL_FROM  + MAX_CODE][1] 
  -    = "Can not make URL from: {0}";
  +    contents[WG_EXPAND_ENTITIES_NOT_SUPPORTED + MAX_CODE][1] =
  +      "-E option not supported for DTM parser";
     }
   
  -  public static final int WG_EXPAND_ENTITIES_NOT_SUPPORTED  = 10;
  -  static 
  +  /** NEEDSDOC Field WG_ILLEGAL_VARIABLE_REFERENCE          */
  +  public static final int WG_ILLEGAL_VARIABLE_REFERENCE = 11;
  +
  +  static
     {
  -    contents[WG_EXPAND_ENTITIES_NOT_SUPPORTED  + MAX_CODE][1] 
  -    = "-E option not supported for DTM parser";
  +    contents[WG_ILLEGAL_VARIABLE_REFERENCE + MAX_CODE][1] =
  +      "VariableReference given for variable out of context or without definition!  Name = {0}";
     }
  -  
  -  public static final int WG_ILLEGAL_VARIABLE_REFERENCE  = 11;
  -  static 
  +
  +  /** NEEDSDOC Field WG_UNSUPPORTED_ENCODING          */
  +  public static final int WG_UNSUPPORTED_ENCODING = 12;
  +
  +  static
     {
  -    contents[WG_ILLEGAL_VARIABLE_REFERENCE + MAX_CODE][1] 
  -    = "VariableReference given for variable out of context or without definition!  Name = {0}";
  +    contents[ER_UNSUPPORTED_ENCODING][1] = "Unsupported encoding: {0}";
     }
   
     // Other miscellaneous text used inside the code...
  -
  -  static  
  +  static
     {
  -    
       contents[MAX_MESSAGES][0] = "ui_language";
       contents[MAX_MESSAGES][1] = "en";
  -    
       contents[MAX_MESSAGES + 1][0] = "help_language";
       contents[MAX_MESSAGES + 1][1] = "en";
  -    
       contents[MAX_MESSAGES + 2][0] = "language";
       contents[MAX_MESSAGES + 2][1] = "en";
  -    
       contents[MAX_MESSAGES + 3][0] = "BAD_CODE";
  -    contents[MAX_MESSAGES + 3][1] = "Parameter to createMessage was out of bounds";
  -    
  +    contents[MAX_MESSAGES + 3][1] =
  +      "Parameter to createMessage was out of bounds";
       contents[MAX_MESSAGES + 4][0] = "FORMAT_FAILED";
  -    contents[MAX_MESSAGES + 4][1] = "Exception thrown during messageFormat call";
  -    
  +    contents[MAX_MESSAGES + 4][1] =
  +      "Exception thrown during messageFormat call";
       contents[MAX_MESSAGES + 5][0] = "version";
       contents[MAX_MESSAGES + 5][1] = ">>>>>>> Xalan Version ";
  -    
       contents[MAX_MESSAGES + 6][0] = "version2";
       contents[MAX_MESSAGES + 6][1] = "<<<<<<<";
  -    
       contents[MAX_MESSAGES + 7][0] = "yes";
       contents[MAX_MESSAGES + 7][1] = "yes";
  -    
       contents[MAX_MESSAGES + 8][0] = "line";
       contents[MAX_MESSAGES + 8][1] = "Line #";
  -    
       contents[MAX_MESSAGES + 9][0] = "column";
       contents[MAX_MESSAGES + 9][1] = "Column #";
  -    
       contents[MAX_MESSAGES + 10][0] = "xsldone";
       contents[MAX_MESSAGES + 10][1] = "XSLProcessor: done";
  -    
       contents[MAX_MESSAGES + 11][0] = "xpath_option";
       contents[MAX_MESSAGES + 11][1] = "xpath options: ";
  -    
       contents[MAX_MESSAGES + 12][0] = "optionIN";
       contents[MAX_MESSAGES + 12][1] = "   [-in inputXMLURL]";
  -    
       contents[MAX_MESSAGES + 13][0] = "optionSelect";
       contents[MAX_MESSAGES + 13][1] = "   [-select xpath expression]";
  -    
       contents[MAX_MESSAGES + 14][0] = "optionMatch";
  -    contents[MAX_MESSAGES + 14][1] = "   [-match match pattern (for match diagnostics)]";
  -    
  +    contents[MAX_MESSAGES + 14][1] =
  +      "   [-match match pattern (for match diagnostics)]";
       contents[MAX_MESSAGES + 15][0] = "optionAnyExpr";
  -    contents[MAX_MESSAGES + 15][1] = "Or just an xpath expression will do a diagnostic dump";
  -    
  -
  +    contents[MAX_MESSAGES + 15][1] =
  +      "Or just an xpath expression will do a diagnostic dump";
       contents[MAX_MESSAGES + 16][0] = "noParsermsg1";
       contents[MAX_MESSAGES + 16][1] = "XSL Process was not successful.";
  -    
       contents[MAX_MESSAGES + 17][0] = "noParsermsg2";
       contents[MAX_MESSAGES + 17][1] = "** Could not find parser **";
  -
       contents[MAX_MESSAGES + 18][0] = "noParsermsg3";
       contents[MAX_MESSAGES + 18][1] = "Please check your classpath.";
  -
  -    contents[MAX_MESSAGES + 19][0] = "noParsermsg4"; 
  -    contents[MAX_MESSAGES + 19][1] = "If you don't have IBM's XML Parser for Java, you can download it from";
  -    
  +    contents[MAX_MESSAGES + 19][0] = "noParsermsg4";
  +    contents[MAX_MESSAGES + 19][1] =
  +      "If you don't have IBM's XML Parser for Java, you can download it from";
       contents[MAX_MESSAGES + 20][0] = "noParsermsg5";
  -    contents[MAX_MESSAGES + 20][1] = "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml";
  +    contents[MAX_MESSAGES + 20][1] =
  +      "IBM's AlphaWorks: http://www.alphaworks.ibm.com/formula/xml";
     }
   
     // ================= INFRASTRUCTURE ======================
   
  +  /** NEEDSDOC Field BAD_CODE          */
     public static final String BAD_CODE = "BAD_CODE";
  +
  +  /** NEEDSDOC Field FORMAT_FAILED          */
     public static final String FORMAT_FAILED = "FORMAT_FAILED";
   
  -  public static final String ERROR_RESOURCES = "org.apache.xpath.res.XPATHErrorResources";
  -  
  +  /** NEEDSDOC Field ERROR_RESOURCES          */
  +  public static final String ERROR_RESOURCES =
  +    "org.apache.xpath.res.XPATHErrorResources";
  +
  +  /** NEEDSDOC Field ERROR_STRING          */
     public static final String ERROR_STRING = "#error";
  +
  +  /** NEEDSDOC Field ERROR_HEADER          */
     public static final String ERROR_HEADER = "Error: ";
  +
  +  /** NEEDSDOC Field WARNING_HEADER          */
     public static final String WARNING_HEADER = "Warning: ";
  +
  +  /** NEEDSDOC Field XSL_HEADER          */
     public static final String XSL_HEADER = "XSL ";
  +
  +  /** NEEDSDOC Field XML_HEADER          */
     public static final String XML_HEADER = "XML ";
  +
  +  /** NEEDSDOC Field QUERY_HEADER          */
     public static final String QUERY_HEADER = "PATTERN ";
   
  +  /**
  +   * NEEDSDOC Method getContents 
  +   *
  +   *
  +   * NEEDSDOC (getContents) @return
  +   */
     public Object[][] getContents()
     {
       return contents;
  @@ -766,40 +937,50 @@
   
     /**
      * Return a named ResourceBundle for a particular locale.  This method mimics the behavior
  -   * of ResourceBundle.getBundle(). 
  +   * of ResourceBundle.getBundle().
      *
  -   * @param res the name of the resource to load. 
  +   * @param res the name of the resource to load.
      * @param locale the locale to prefer when searching for the bundle
  +   *
  +   * NEEDSDOC @param className
      * @return the ResourceBundle
  -   * @throws MissingResourceException  
  +   * @throws MissingResourceException
      */
  -  public static final XPATHErrorResources loadResourceBundle (String className) 
  -    throws MissingResourceException
  +  public static final XPATHErrorResources loadResourceBundle(String className)
  +          throws MissingResourceException
     {
  +
       Locale locale = Locale.getDefault();
  -    String suffix = getResourceSuffix(locale);  
  +    String suffix = getResourceSuffix(locale);
  +
       try
  -    {		
  +    {
  +
         // first try with the given locale
  -      return (XPATHErrorResources)ResourceBundle.getBundle (className + suffix, locale);
  +      return (XPATHErrorResources) ResourceBundle.getBundle(className
  +              + suffix, locale);
       }
       catch (MissingResourceException e)
       {
  -      try                                                  // try to fall back to en_US if we can't load
  +      try  // try to fall back to en_US if we can't load
         {
  +
           // Since we can't find the localized property file,
           // fall back to en_US.
  -        return (XPATHErrorResources)ResourceBundle.getBundle (className, new Locale ("en", "US"));
  +        return (XPATHErrorResources) ResourceBundle.getBundle(className,
  +                new Locale("en", "US"));
         }
         catch (MissingResourceException e2)
         {
  +
           // Now we are really in trouble.
           // very bad, definitely very bad...not going to get very far
  -        throw new MissingResourceException ("Could not load any resource bundles.", className, "");
  +        throw new MissingResourceException(
  +          "Could not load any resource bundles.", className, "");
         }
       }
     }
  -  
  +
     /**
      * Return the resource file suffic for the indicated locale
      * For most locales, this will be based the language code.  However
  @@ -807,72 +988,96 @@
      *
      * @param locale the locale
      * @return an String suffix which canbe appended to a resource name
  -   */        
  +   */
     private static final String getResourceSuffix(Locale locale)
     {
  +
       String suffix = "_" + locale.getLanguage();
  -    
  -    String country = locale.getCountry();        
  -    
  +    String country = locale.getCountry();
  +
       if (country.equals("TW"))
         suffix += "_" + country;
   
       return suffix;
     }
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getMessageKey(int errorCode)
     {
  +
       if (errorCode > MAX_CODE)
         return null;
       else
       {
         DecimalFormat df = new DecimalFormat("0000");
  -      return ERROR_SUFFIX + df.format(errorCode);	
  -    }  
  +
  +      return ERROR_SUFFIX + df.format(errorCode);
  +    }
     }
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public String getWarningKey(int errorCode)
     {
  +
       if (errorCode > MAX_WARNING)
         return null;
  -    else 
  +    else
       {
         DecimalFormat df = new DecimalFormat("0000");
  -      return WARNING_SUFFIX + df.format(errorCode);	
  +
  +      return WARNING_SUFFIX + df.format(errorCode);
       }
     }
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public static String getMKey(int errorCode)
     {
  +
       if (errorCode > MAX_CODE)
         return null;
       else
       {
         DecimalFormat df = new DecimalFormat("0000");
  -      return ERROR_SUFFIX + df.format(errorCode);	
  -    }  
  +
  +      return ERROR_SUFFIX + df.format(errorCode);
  +    }
     }
  -  
  +
     /**
      * Get the error string associated with the error code
  -   */ 
  +   *
  +   * NEEDSDOC @param errorCode
  +   *
  +   * NEEDSDOC ($objectName$) @return
  +   */
     public static String getWKey(int errorCode)
     {
  +
       if (errorCode > MAX_WARNING)
         return null;
  -    else 
  +    else
       {
         DecimalFormat df = new DecimalFormat("0000");
  -      return WARNING_SUFFIX + df.format(errorCode);	
  +
  +      return WARNING_SUFFIX + df.format(errorCode);
       }
     }
   }
  
  
  
  1.2       +6 -5      xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources_en.java
  
  Index: XPATHErrorResources_en.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/src/org/apache/xpath/res/XPATHErrorResources_en.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- XPATHErrorResources_en.java	2000/07/05 14:49:05	1.1
  +++ XPATHErrorResources_en.java	2000/10/30 19:00:58	1.2
  @@ -8,13 +8,13 @@
    * 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
  + *    the documentation and/or other materials provided with the
    *    distribution.
    *
    * 3. The end-user documentation included with the redistribution,
  @@ -55,13 +55,14 @@
    * <http://www.apache.org/>.
    */
   package org.apache.xpath.res;
  +
   import java.util.*;
   
   /**
    * <meta name="usage" content="advanced"/>
  - * Default implementation of XPATHErrorResources.  This is just 
  + * Default implementation of XPATHErrorResources.  This is just
    * an empty class.
    */
  -public class XPATHErrorResources_en extends XPATHErrorResources 
  -{    
  +public class XPATHErrorResources_en extends XPATHErrorResources
  +{
   }