diff --git a/mozilla/content/xslt/src/base/txDouble.cpp b/mozilla/content/xslt/src/base/txDouble.cpp index f4730bef4ae..2014283e673 100644 --- a/mozilla/content/xslt/src/base/txDouble.cpp +++ b/mozilla/content/xslt/src/base/txDouble.cpp @@ -1,26 +1,32 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * Larry Fitzpatrick, lef@opentext.com * + * $Id: txDouble.cpp,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ - - #include "primitives.h" //----------------------------/ @@ -29,8 +35,8 @@ /** * A wrapper for the primitive double type, and provides some simple * floating point related routines + * @author Keith Visco * @author Larry Fitzpatrick - * @author Keith Visco **/ double d0 = 0.0; @@ -98,8 +104,8 @@ MBool Double::isInfinite() { * Determins whether the given double is NaN **/ MBool Double::isNaN(double dbl) { -#ifdef MOZILLA - return (MBool) _isnan(dbl); +#ifdef WIN32 + return _isnan(dbl); #else return (MBool) isnan(dbl); #endif @@ -109,8 +115,8 @@ MBool Double::isNaN(double dbl) { * Determins whether this Double's value is NaN **/ MBool Double::isNaN() { -#ifdef MOZILLA - return (MBool) _isnan(value); +#ifdef WIN32 + return _isnan(value); #else return (MBool) isnan(value); #endif @@ -235,4 +241,3 @@ String& Double::toString(double value, String& dest) { return dest; } //-- toString - diff --git a/mozilla/content/xslt/src/base/txErrorObserver.h b/mozilla/content/xslt/src/base/txErrorObserver.h index c5150fd261f..c7f0ad5beaf 100644 --- a/mozilla/content/xslt/src/base/txErrorObserver.h +++ b/mozilla/content/xslt/src/base/txErrorObserver.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: txErrorObserver.h,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ #ifndef MITRE_ERROROBSERVER_H @@ -28,7 +33,8 @@ /** * A simple interface for observing errors - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:39 $ **/ class ErrorObserver { @@ -94,3 +100,4 @@ private: MBool hideWarnings; }; //-- SimpleErrorObserver #endif + diff --git a/mozilla/content/xslt/src/base/txList.cpp b/mozilla/content/xslt/src/base/txList.cpp index c9136a6f269..d7e17046ea8 100644 --- a/mozilla/content/xslt/src/base/txList.cpp +++ b/mozilla/content/xslt/src/base/txList.cpp @@ -1,33 +1,42 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: txList.cpp,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ #include "List.h" #include + //--------------------------/ //- Implementation of List -/ //--------------------------/ /** * Default constructor for a List; + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:39 $ **/ + List::List() { firstItem = 0; lastItem = 0; diff --git a/mozilla/content/xslt/src/base/txList.h b/mozilla/content/xslt/src/base/txList.h index a147c115149..f9ca3deb0a9 100644 --- a/mozilla/content/xslt/src/base/txList.h +++ b/mozilla/content/xslt/src/base/txList.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: txList.h,v 1.2 1999-11-15 07:12:40 nisheeth%netscape.com Exp $ */ #include "baseutils.h" @@ -26,7 +31,8 @@ /** * Represents an ordered list of Object pointers. Modeled after a Java 2 List. - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:40 $ **/ class List { diff --git a/mozilla/content/xslt/src/base/txSimpleErrorObserver.cpp b/mozilla/content/xslt/src/base/txSimpleErrorObserver.cpp index bf598199a64..a9db8517406 100644 --- a/mozilla/content/xslt/src/base/txSimpleErrorObserver.cpp +++ b/mozilla/content/xslt/src/base/txSimpleErrorObserver.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: txSimpleErrorObserver.cpp,v 1.2 1999-11-15 07:12:41 nisheeth%netscape.com Exp $ */ #include "ErrorObserver.h" @@ -74,3 +79,4 @@ void SimpleErrorObserver::recieveError(String& errorMessage, ErrorLevel level) { void SimpleErrorObserver::supressWarnings(MBool supress) { this->hideWarnings = supress; } //-- supressWarnings + diff --git a/mozilla/content/xslt/src/main/transformiix.cpp b/mozilla/content/xslt/src/main/transformiix.cpp index ddbc420b8b4..8b69094acfc 100644 --- a/mozilla/content/xslt/src/main/transformiix.cpp +++ b/mozilla/content/xslt/src/main/transformiix.cpp @@ -1,24 +1,30 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: transformiix.cpp,v 1.2 1999-11-15 07:12:46 nisheeth%netscape.com Exp $ */ + #include "XSLProcessor.h" //--------------/ @@ -37,20 +43,20 @@ void printUsage(); /** * The TransforMiiX command line interface - * @author Keith Visco + * @author Keith Visco **/ int main(int argc, char** argv) { XSLProcessor xslProcessor; - String copyright("(C) 1999 The MITRE Corporation"); + String copyright("(C) 1999 The MITRE Corporation, Keith Visco, and contributors"); cout << xslProcessor.getAppName() << " "; - cout << xslProcessor.getAppVersion() << copyright <length()+1]; ifstream xslInput(xslFilename->toChar(chars), ios::in); delete chars; - xslProcessor.process(xmlInput, xslInput, *resultOutput); + xslProcessor.process(xmlInput, xslInput, *resultOutput, documentBase); } resultFileStream.close(); return 0; diff --git a/mozilla/content/xslt/src/xml/txXMLUtils.cpp b/mozilla/content/xslt/src/xml/txXMLUtils.cpp index e31bba90d9e..0e0dcadd66f 100644 --- a/mozilla/content/xslt/src/xml/txXMLUtils.cpp +++ b/mozilla/content/xslt/src/xml/txXMLUtils.cpp @@ -1,24 +1,28 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco + * -- original author. * + * $Id: txXMLUtils.cpp,v 1.2 1999-11-15 07:12:49 nisheeth%netscape.com Exp $ */ - /** * An XML utility class * @author Keith Visco @@ -108,6 +112,25 @@ MBool XMLUtils::isValidQName(String& name) { return MB_TRUE; } //-- isValidQName +/** + * Returns true if the given string has only whitespace characters +**/ +MBool XMLUtils::isWhitespace(const String& text) { + for ( int i = 0; i < text.length(); i++ ) { + Int32 ch = text.charAt(i); + switch ( ch ) { + case ' ' : + case '\n' : + case '\r' : + case '\t' : + break; + default: + return MB_FALSE; + } + } + return MB_TRUE; +} //-- isWhitespace + /** * Normalizes the value of an XML attribute **/ diff --git a/mozilla/content/xslt/src/xml/txXMLUtils.h b/mozilla/content/xslt/src/xml/txXMLUtils.h index fa935158ef4..ccef9a533bd 100644 --- a/mozilla/content/xslt/src/xml/txXMLUtils.h +++ b/mozilla/content/xslt/src/xml/txXMLUtils.h @@ -1,27 +1,32 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: txXMLUtils.h,v 1.2 1999-11-15 07:12:49 nisheeth%netscape.com Exp $ */ /** * An XML Utility class - * @author Keith Visco + * @author Keith Visco **/ #include "String.h" @@ -39,11 +44,17 @@ public: static void getNameSpace(const String& src, String& dest); static void getLocalPart(const String& src, String& dest); + /** * Returns true if the given String is a valid XML QName **/ static MBool isValidQName(String& name); + /** + * Returns true if the given string has only whitespace characters + **/ + static MBool isWhitespace(const String& text); + /** * Normalizes the value of an XML attribute **/ @@ -107,3 +118,4 @@ private: }; //-- XMLUtils #endif + diff --git a/mozilla/extensions/transformiix/docs/contributors.html b/mozilla/extensions/transformiix/docs/contributors.html index 277eff9ffa1..52ff1e9f018 100644 --- a/mozilla/extensions/transformiix/docs/contributors.html +++ b/mozilla/extensions/transformiix/docs/contributors.html @@ -3,7 +3,7 @@ MITRE TransforMiiX(tm) Contributors - + @@ -36,13 +36,15 @@ effort to the development. - @@ -80,12 +82,24 @@ The following people have contributed to the development. + + + + + + diff --git a/mozilla/extensions/transformiix/release.txt b/mozilla/extensions/transformiix/release.txt index a88a4b0e085..e6d9f9fda17 100644 --- a/mozilla/extensions/transformiix/release.txt +++ b/mozilla/extensions/transformiix/release.txt @@ -1,24 +1,26 @@ -TransforMiiX (TM) (C) Copyright The MITRE Corporation 1999 All rights reserved. - -All source and compiled binaries are considered the "program". - -The contents of all source files in distributed with this -program are subject to the Mozilla Public License -Version 1.0 (the "License"); you may not use those files except in -compliance with the License. You may obtain a copy of the License at -http://www.mozilla.org/MPL/ - -The program provided "as is" without any warranty express or -implied, including the warranty of non-infringement and the implied -warranties of merchantibility and fitness for a particular purpose. -The Copyright owner will not be liable for any damages suffered by -you as a result of using the Program. In no event will the Copyright -owner be liable for any special, indirect or consequential damages or -lost profits even if the Copyright owner has been advised of the -possibility of their occurrence. - -Much of the source code was ported from XSL:P [http://xslp.kvisco.com], -an open source Java XSL processor written by Keith Visco. -There were a number of contributors to XSL:P and therefor many of -those contributors have indirectly contributed to this project. - +TransforMiiX (TM) +(C) Copyright The MITRE Corporation 1999, Keith Visco, and Contributors +All rights reserved. + +All source and compiled binaries are considered the "program". + +The contents of all source files in distributed with this +program are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use those files except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ + +The program provided "as is" without any warranty express or +implied, including the warranty of non-infringement and the implied +warranties of merchantibility and fitness for a particular purpose. +The Copyright owner will not be liable for any damages suffered by +you as a result of using the Program. In no event will the Copyright +owner be liable for any special, indirect or consequential damages or +lost profits even if the Copyright owner has been advised of the +possibility of their occurrence. + +Much of the source code was ported from XSL:P [http://xslp.kvisco.com], +an open source Java XSL processor written by Keith Visco. +There were a number of contributors to XSL:P and therefor many of +those contributors have indirectly contributed to this project. + diff --git a/mozilla/extensions/transformiix/source/Makefile b/mozilla/extensions/transformiix/source/Makefile index b4edb22d278..43f740d517a 100644 --- a/mozilla/extensions/transformiix/source/Makefile +++ b/mozilla/extensions/transformiix/source/Makefile @@ -1,6 +1,6 @@ target: TransforMiiX -CC = g++ +CC := g++ ROOT_PATH = . XML_PATH = $(ROOT_PATH)/xml @@ -16,16 +16,16 @@ EXPAT_PARSER_PATH = $(XMLPARSER_PATH)/xmlparse EXPAT_TOKEN_PATH = $(XMLPARSER_PATH)/xmltok -INCLUDE_PATHS = -I $(BASE_PATH) \ - -I $(NET_PATH) \ - -I $(DOM_PATH) \ - -I $(XML_PATH) \ - -I $(EXPR_PATH) \ - -I $(XSL_PATH) \ - -I $(XSLUTIL_PATH) \ - -I $(XMLPARSER_PATH) \ - -I $(XMLPRINTER_PATH) \ - -I $(EXPAT_PARSER_PATH) -I- +INCLUDE_PATHS = -I$(BASE_PATH) \ + -I$(NET_PATH) \ + -I$(DOM_PATH) \ + -I$(XML_PATH) \ + -I$(EXPR_PATH) \ + -I$(XSL_PATH) \ + -I$(XSLUTIL_PATH) \ + -I$(XMLPARSER_PATH) \ + -I$(XMLPRINTER_PATH) \ + -I$(EXPAT_PARSER_PATH) -I- BASE_OBJS = $(BASE_PATH)/*.o @@ -61,7 +61,7 @@ ALL_OBJS = $(BASE_OBJS) \ MAIN_CPP = main/transformiix.cpp TransforMiiX: $(ALL_OBJS) - $(CC) $(INCLUDE_PATHS) $(ALL_OBJS) $(MAIN_CPP) -o transfrmx.exe + $(CC) $(INCLUDE_PATHS) -I- $(ALL_OBJS) $(MAIN_CPP) -o transfrmx $(BASE_OBJS): $(BASE_PATH)/*.cpp $(BASE_PATH)/*.h diff --git a/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp b/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp index d9f201c2228..853f76557a4 100644 --- a/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp +++ b/mozilla/extensions/transformiix/source/base/CommandLineUtils.cpp @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: CommandLineUtils.cpp,v 1.2 1999-11-15 07:12:38 nisheeth%netscape.com Exp $ */ #include "CommandLineUtils.h" /** - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:38 $ **/ void CommandLineUtils::getOptions (NamedMap& options, int argc, char** argv, StringList& flags) diff --git a/mozilla/extensions/transformiix/source/base/CommandLineUtils.h b/mozilla/extensions/transformiix/source/base/CommandLineUtils.h index 6a74ab9ac3f..f4c0e38525a 100644 --- a/mozilla/extensions/transformiix/source/base/CommandLineUtils.h +++ b/mozilla/extensions/transformiix/source/base/CommandLineUtils.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: CommandLineUtils.h,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ #include "baseutils.h" @@ -27,7 +32,8 @@ #define MITRE_COMMANDLINEUTILS_H /** - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:39 $ **/ class CommandLineUtils { diff --git a/mozilla/extensions/transformiix/source/base/Double.cpp b/mozilla/extensions/transformiix/source/base/Double.cpp index f4730bef4ae..6bcbe064624 100644 --- a/mozilla/extensions/transformiix/source/base/Double.cpp +++ b/mozilla/extensions/transformiix/source/base/Double.cpp @@ -1,26 +1,32 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * Larry Fitzpatrick, lef@opentext.com * + * $Id: Double.cpp,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ - - #include "primitives.h" //----------------------------/ @@ -29,8 +35,8 @@ /** * A wrapper for the primitive double type, and provides some simple * floating point related routines + * @author Keith Visco * @author Larry Fitzpatrick - * @author Keith Visco **/ double d0 = 0.0; @@ -98,8 +104,8 @@ MBool Double::isInfinite() { * Determins whether the given double is NaN **/ MBool Double::isNaN(double dbl) { -#ifdef MOZILLA - return (MBool) _isnan(dbl); +#ifdef WIN32 + return _isnan(dbl); #else return (MBool) isnan(dbl); #endif @@ -109,8 +115,8 @@ MBool Double::isNaN(double dbl) { * Determins whether this Double's value is NaN **/ MBool Double::isNaN() { -#ifdef MOZILLA - return (MBool) _isnan(value); +#ifdef WIN32 + return _isnan(value); #else return (MBool) isnan(value); #endif @@ -235,4 +241,3 @@ String& Double::toString(double value, String& dest) { return dest; } //-- toString - diff --git a/mozilla/extensions/transformiix/source/base/ErrorObserver.h b/mozilla/extensions/transformiix/source/base/ErrorObserver.h index c5150fd261f..d66058eb680 100644 --- a/mozilla/extensions/transformiix/source/base/ErrorObserver.h +++ b/mozilla/extensions/transformiix/source/base/ErrorObserver.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: ErrorObserver.h,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ #ifndef MITRE_ERROROBSERVER_H @@ -28,7 +33,8 @@ /** * A simple interface for observing errors - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:39 $ **/ class ErrorObserver { @@ -94,3 +100,4 @@ private: MBool hideWarnings; }; //-- SimpleErrorObserver #endif + diff --git a/mozilla/extensions/transformiix/source/base/Integer.cpp b/mozilla/extensions/transformiix/source/base/Integer.cpp index 05860c00c55..19f92bd111d 100644 --- a/mozilla/extensions/transformiix/source/base/Integer.cpp +++ b/mozilla/extensions/transformiix/source/base/Integer.cpp @@ -1,26 +1,29 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: Integer.cpp,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ - - #include "primitives.h" #include "baseutils.h" @@ -31,7 +34,8 @@ /** * A wrapper for the primitive int type, and provides some simple * integer related routines - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:39 $ **/ /** diff --git a/mozilla/extensions/transformiix/source/base/List.cpp b/mozilla/extensions/transformiix/source/base/List.cpp index c9136a6f269..2e308d3ed10 100644 --- a/mozilla/extensions/transformiix/source/base/List.cpp +++ b/mozilla/extensions/transformiix/source/base/List.cpp @@ -1,33 +1,42 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: List.cpp,v 1.2 1999-11-15 07:12:39 nisheeth%netscape.com Exp $ */ #include "List.h" #include + //--------------------------/ //- Implementation of List -/ //--------------------------/ /** * Default constructor for a List; + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:39 $ **/ + List::List() { firstItem = 0; lastItem = 0; diff --git a/mozilla/extensions/transformiix/source/base/List.h b/mozilla/extensions/transformiix/source/base/List.h index a147c115149..a8f8b74ab63 100644 --- a/mozilla/extensions/transformiix/source/base/List.h +++ b/mozilla/extensions/transformiix/source/base/List.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: List.h,v 1.2 1999-11-15 07:12:40 nisheeth%netscape.com Exp $ */ #include "baseutils.h" @@ -26,7 +31,8 @@ /** * Represents an ordered list of Object pointers. Modeled after a Java 2 List. - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:40 $ **/ class List { diff --git a/mozilla/extensions/transformiix/source/base/MITREObject.h b/mozilla/extensions/transformiix/source/base/MITREObject.h index 4e07671f43a..2158b72ff54 100644 --- a/mozilla/extensions/transformiix/source/base/MITREObject.h +++ b/mozilla/extensions/transformiix/source/base/MITREObject.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: MITREObject.h,v 1.2 1999-11-15 07:12:40 nisheeth%netscape.com Exp $ */ #ifndef MITRE_MITREOBJECT_H @@ -25,7 +30,8 @@ /** * A standard base class for many of the Class definitions in this * application - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:40 $ **/ class MITREObject { public: @@ -44,3 +50,4 @@ public: }; #endif + diff --git a/mozilla/extensions/transformiix/source/base/MITREObjectWrapper.cpp b/mozilla/extensions/transformiix/source/base/MITREObjectWrapper.cpp index cfef351ec7f..ee425661509 100644 --- a/mozilla/extensions/transformiix/source/base/MITREObjectWrapper.cpp +++ b/mozilla/extensions/transformiix/source/base/MITREObjectWrapper.cpp @@ -18,6 +18,31 @@ * Please see release.txt distributed with this file for more information. * */ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. + * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: MITREObjectWrapper.cpp,v 1.2 1999-11-15 07:12:40 nisheeth%netscape.com Exp $ + */ #include "MITREObject.h" @@ -38,3 +63,4 @@ MITREObjectWrapper::MITREObjectWrapper() { MITREObjectWrapper::~MITREObjectWrapper() { this->object = 0; } //-- ~MITREObjectWrapper + diff --git a/mozilla/extensions/transformiix/source/base/Makefile b/mozilla/extensions/transformiix/source/base/Makefile index 271ec36cf3d..308e83f199c 100644 --- a/mozilla/extensions/transformiix/source/base/Makefile +++ b/mozilla/extensions/transformiix/source/base/Makefile @@ -1,6 +1,6 @@ target: make_base -CC = g++ +CC := $(CC) -g BASE_OBJS = CommandLineUtils.o \ Double.o \ diff --git a/mozilla/extensions/transformiix/source/base/NamedMap.cpp b/mozilla/extensions/transformiix/source/base/NamedMap.cpp index 443b64e451d..f8dbf4cfaae 100644 --- a/mozilla/extensions/transformiix/source/base/NamedMap.cpp +++ b/mozilla/extensions/transformiix/source/base/NamedMap.cpp @@ -1,33 +1,43 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Bob Miller, Oblix Inc., kbob@oblix.com + * -- fixed memory leak in NamedMap::hashKey method by deleting + * up char[] chars; * + * $Id: NamedMap.cpp,v 1.2 1999-11-15 07:12:40 nisheeth%netscape.com Exp $ */ /** * A Named Map for MITREObjects - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:40 $ **/ #include "NamedMap.h" - //-------------/ - //- Constants -/ + //-------------/ + //- Constants -/ //-------------/ const int NamedMap::DEFAULT_SIZE = 17; @@ -73,10 +83,8 @@ void NamedMap::initialize(Int32 size) { * Destructor for NamedMap **/ NamedMap::~NamedMap() { - //cout << "~NamedMap() - start"<add(new String(item->key)); + item = item->next; + } + } + return list; +} //-- keys + /** * Adds the specified Node to the top of this Stack. * @param node the Node to add to the top of the Stack @@ -235,12 +260,26 @@ void NamedMap::put(const String& key, MITREObject* obj) { **/ MITREObject* NamedMap::remove(String& key) { - BucketItem* bktItem = getBucketItem(key); + // compute hash for key + long hashCode = hashKey(key); + + int idx = hashCode % numberOfBuckets; + + BucketItem* bktItem = elements[idx]; + + while ( bktItem ) { + if ( bktItem->key.isEqual(key) ) break; + bktItem = bktItem->next; + } if ( bktItem ) { - bktItem->prev->next = bktItem->next; + if (bktItem == elements[idx]) elements[idx] = bktItem->next; + else bktItem->prev->next = bktItem->next; numberOfElements--; - return bktItem->item; + MITREObject* mObject = bktItem->item; + bktItem->item = 0; + delete bktItem; + return mObject; } return 0; @@ -306,7 +345,7 @@ unsigned long NamedMap::hashKey(const String& key) { for (Int32 i = 0; i < len; i++) { hashCode += ((Int32)chars[i]) << 3; } - + delete [] chars; return hashCode; } //-- hashKey diff --git a/mozilla/extensions/transformiix/source/base/NamedMap.h b/mozilla/extensions/transformiix/source/base/NamedMap.h index 1d553e4ed7b..b565e598009 100644 --- a/mozilla/extensions/transformiix/source/base/NamedMap.h +++ b/mozilla/extensions/transformiix/source/base/NamedMap.h @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: NamedMap.h,v 1.2 1999-11-15 07:12:41 nisheeth%netscape.com Exp $ */ /** * A Named Map for MITREObjects - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:41 $ **/ #ifndef MITREXSL_NAMEDMAP_H @@ -30,6 +36,7 @@ #include "String.h" #include "baseutils.h" #include "MITREObject.h" +#include "StringList.h" class NamedMap : public MITREObject { @@ -56,6 +63,14 @@ public: **/ virtual ~NamedMap(); + + /** + * Returns a list of all the keys of this NamedMap. + *
+ * You will need to delete this List when you are done with it. + **/ + StringList* keys(); + /** * Returns the object reference in this Map associated with the given name * @return the object reference in this Map associated with the given name @@ -175,3 +190,4 @@ private: }; //-- NamedMap #endif + diff --git a/mozilla/extensions/transformiix/source/base/SimpleErrorObserver.cpp b/mozilla/extensions/transformiix/source/base/SimpleErrorObserver.cpp index bf598199a64..3a84dbe423e 100644 --- a/mozilla/extensions/transformiix/source/base/SimpleErrorObserver.cpp +++ b/mozilla/extensions/transformiix/source/base/SimpleErrorObserver.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: SimpleErrorObserver.cpp,v 1.2 1999-11-15 07:12:41 nisheeth%netscape.com Exp $ */ #include "ErrorObserver.h" @@ -74,3 +79,4 @@ void SimpleErrorObserver::recieveError(String& errorMessage, ErrorLevel level) { void SimpleErrorObserver::supressWarnings(MBool supress) { this->hideWarnings = supress; } //-- supressWarnings + diff --git a/mozilla/extensions/transformiix/source/base/Stack.cpp b/mozilla/extensions/transformiix/source/base/Stack.cpp index a4a73e11d36..91130dc8e3d 100644 --- a/mozilla/extensions/transformiix/source/base/Stack.cpp +++ b/mozilla/extensions/transformiix/source/base/Stack.cpp @@ -1,34 +1,36 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * Larry Fitzpatrick, lef@opentext.com + * -- 19990806 + * - In method ::peek() changed ListItem::ListItem to List::ListItem * + * $Id: Stack.cpp,v 1.2 1999-11-15 07:12:41 nisheeth%netscape.com Exp $ */ /** * Stack - * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *  - in method #peek():
- *    - Changed ListItem::ListItem to List::ListItem
- * 
+ * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:41 $ **/ #include "Stack.h" diff --git a/mozilla/extensions/transformiix/source/base/Stack.h b/mozilla/extensions/transformiix/source/base/Stack.h index b3693c7d679..8e30a2af6c3 100644 --- a/mozilla/extensions/transformiix/source/base/Stack.h +++ b/mozilla/extensions/transformiix/source/base/Stack.h @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: Stack.h,v 1.2 1999-11-15 07:12:41 nisheeth%netscape.com Exp $ */ /** * Stack - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:41 $ **/ #include "List.h" diff --git a/mozilla/extensions/transformiix/source/base/String.cpp b/mozilla/extensions/transformiix/source/base/String.cpp index f298d20c9cd..daf9cdff6f6 100644 --- a/mozilla/extensions/transformiix/source/base/String.cpp +++ b/mozilla/extensions/transformiix/source/base/String.cpp @@ -1,1154 +1,1154 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ - -// Tom Kneeland (3/17/99) -// -// Implementation of a simple String class -// -// Modification History: -// Who When What -// TK 03/17/99 Created -// TK 03/23/99 Released without "lastIndexOf" functions -// TK 04/02/99 Added support for 'const' strings, and added -// 'operator=' for constant char*. -// TK 04/09/99 Overloaded the output operator (<<). Currently it only -// supports outputing the String to a C sytle character based -// stream. -// TK 04/09/99 Provided support for the extraction of the DOM_CHAR -// representation of the string. The new method, "toDomChar()" -// returns a constant pointer to the internal DOM_CHAR string -// buffer. -// TK 04/10/99 Added the implementation for appending an array of DOM_CHARs -// to a string. It should be noted that a length needs to be -// provided in order to determine the length of the source -// array. -// TK 04/22/99 Fixed a bug where setting a string equal to NULL would cause -// a core dump. Also added support for constructing a string -// using the NULL identifier. -// Modified the output operator (<<) to accept a const String -// reference. This eliminates a wasteful copy constructor call. -// TK 04/28/99 Modified the clear() method to leave the DOM_CHAR array -// in place. -// TK 04/28/99 Added 3 new member functions: insert, deleteChars, and -// replace. -// TK 05/05/99 Added support for implicit integer conversion. This allows -// integers to be appended, inserted, and used as replacements -// for DOM_CHARs. To support this feature, ConvertInt has been -// added which converts the given integer to a string and stores -// it in the target. -// TK 05/05/99 Converted DOM_CHAR to UNICODE_CHAR -// -// KV 07/29/1999 Added lastIndexOf methods -// KV 07/29/1999 Changed indexOf methods with no offset, to call the -// indexOf methods with offset of 0. This allows re-use of -// code, makes it easier to debug, and minimizes the size of -// the implementation -// LF 08/06/1999 In method #operator=, -// added line: return *this -// KV 08/11/1999 changed charAt to return -1, if index is out of bounds, instead of 0, -// since 0, is a valid character, and this makes my code more compatible -// with Java -// KV 08/11/1999 removed PRBool, uses baseutils.h (MBool) - - -#include -#include -#include "String.h" -#include - -// -//Default Constructor, create an empty String -// -String::String() -{ - strBuffer = NULL; - bufferLength = 0; - strLength = 0; -} - -// -//Create an empty String of a specific size -// -String::String(Int32 initSize) -{ - strBuffer = new UNICODE_CHAR[initSize]; - bufferLength = initSize; - strLength = 0; -} - -// -//Create a copy of the source String -// -String::String(const String& source) -{ - - Int32 copyLoop; - - //Allocate space for the source string - strLength = source.length(); - - //-- modified by kvisco to only use necessay amount of space - //-- was: bufferLength = source.bufferLength; - bufferLength = strLength; - - strBuffer = new UNICODE_CHAR[bufferLength]; - - //Copy the new string data after the old data - for (copyLoop=0;copyLoop strLength) - { - ensureCapacity(totalOffset - strLength); - strLength += totalOffset - strLength; - } - - for (replaceLoop=0;replaceLoop strLength) - { - ensureCapacity(totalOffset - strLength); - strLength += totalOffset - strLength; - } - - for (replaceLoop=0;replaceLoop strLength) - { - ensureCapacity(totalOffset - strLength); - strLength += totalOffset - strLength; - } - - for (replaceLoop=0;replaceLoop current length, the string will be extended - * and padded with '\0' null characters. Otherwise the String - * will be truncated -**/ -void String::setLength(Int32 length) { - setLength(length, '\0'); -} //-- setLength - -/** - * Sets the Length of this String, if length is less than 0, it will - * be set to 0; if length > current length, the string will be extended - * and padded with given pad character. Otherwise the String - * will be truncated -**/ -void String::setLength(Int32 length, UNICODE_CHAR padChar) { - if ( length < 0 ) strLength = 0; - else if ( length > strLength ) { - Int32 diff = length-strLength; - ensureCapacity(diff); - for ( Int32 i = strLength; i < length; i++ ) - strBuffer[i] = padChar; - strLength = length; - } - else strLength = length; -} //-- setLength - -// -//Delete the "substring" starting at "offset" and proceeding for "count" number -//of characters (or until the end of the string, whichever comes first). -// -void String::deleteChars(Int32 offset, Int32 count) -{ - Int32 deleteLoop; - Int32 offsetCount; - - offset = offset < 0 ? 0 : offset; - offsetCount = offset + count; - - if (offsetCount < strLength) - { - for (deleteLoop=0;deleteLoop= 0)) - return strBuffer[index]; - else - return -1; -} - -// -//Clear out the string by simply setting the length to zero. The buffer is -//left intact. -// -void String::clear() -{ - strLength = 0; -} - -// -//Make sure the buffer has room for 'capacity' UNICODE_CHARS. -// -void String::ensureCapacity(Int32 capacity) -{ - UNICODE_CHAR* tempStrBuffer = NULL; - - //Check for the desired capacity - Int32 freeSpace = bufferLength - strLength; //(added by kvisco) - - if (freeSpace < capacity) { - - //-- modified by kvisco to only add needed capacity, - //-- not extra bytes as before - //-- old : bufferLength += capacity; - bufferLength += capacity - freeSpace; - - tempStrBuffer = new UNICODE_CHAR[bufferLength]; - copyString(tempStrBuffer); - - //If the old string contained any data, delete it, and save the new. - if (strBuffer) - delete strBuffer; - - strBuffer = tempStrBuffer; - } -} - -/** - * Performs a CASE SENSITIVE search of the string for the first occurence - * of 'data'. If found return the index, else return NOT_FOUND. - * -- changed by kvisco to call indexOf(UNICODE_CHAR, Int32) -**/ -Int32 String::indexOf(UNICODE_CHAR data) const -{ - return indexOf(data, 0); -} //-- indexOf - -// -//Starting at 'offset' perform a CASE SENSITIVE search of the string looking -//for the first occurence of 'data'. If found return the index, else return -//NOT_FOUND. If the offset is less than zero, then start at zero. -// -Int32 String::indexOf(UNICODE_CHAR data, Int32 offset) const -{ - Int32 searchIndex = offset < 0 ? searchIndex = 0 : searchIndex = offset; - - while (1) - { - if (searchIndex >= strLength) - return NOT_FOUND; - else if (strBuffer[searchIndex] == data) - return searchIndex; - else - ++searchIndex; - } -} //-- indexOf - -// -//Returns the index of the first occurence of data -// -Int32 String::indexOf(const String& data) const -{ - Int32 searchIndex = 0; - - while (1) - { - if (searchIndex <= (strLength - data.length())) - { - if (isEqual(&strBuffer[searchIndex], - &data.strBuffer[0], - data.length())) - return searchIndex; - } - else - return NOT_FOUND; - - searchIndex++; - } -} - -// -//Returns the index of the first occurrence of data starting at offset -// -Int32 String::indexOf(const String& data, Int32 offset) const -{ - Int32 searchIndex = offset < 0 ? 0 : offset; - - while (1) - { - if (searchIndex <= (strLength - data.length())) - { - if (isEqual(&strBuffer[searchIndex], - &data.strBuffer[0], - data.length())) - return searchIndex; - } - else - return NOT_FOUND; - - searchIndex++; - } -} - -// -//Check for equality between this string, and data -// -MBool String::isEqual(const String& data) const -{ - if (this == &data) - return MB_TRUE; - else if (strLength != data.length()) - return MB_FALSE; - else - return isEqual(strBuffer, data.strBuffer, data.length()); -} - -/** - * Returns index of last occurrence of data - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 String::lastIndexOf(UNICODE_CHAR data) const -{ - return lastIndexOf(data, strLength-1); -} //-- lastIndexOf - -/** - * Returns the index of the last occurrence of data starting at offset - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 String::lastIndexOf(UNICODE_CHAR data, Int32 offset) const -{ - if ((offset < 0) || (offset >= strLength)) return NOT_FOUND; - - Int32 searchIndex = offset; - while (searchIndex >= 0) { - if (strBuffer[searchIndex] == data) return searchIndex; - --searchIndex; - } - return NOT_FOUND; - -} //-- lastIndexOf - -/** - * Returns the index of the last occurrence of data - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 String::lastIndexOf(const String& data) const -{ - return lastIndexOf(data, strLength-1); -} //-- lastIndexOf - -/** - * Returns the index of the last occurrence of data starting at offset - *
- * Added implementation 19990729 (kvisco) -**/ -Int32 String::lastIndexOf(const String& data, Int32 offset) const -{ - if ((offset < 0) || (offset >= strLength)) return NOT_FOUND; - return NOT_FOUND; -} - -// -//Returns the length of the String -// -Int32 String::length() const -{ - return strLength; -} - -// -//Returns a subString starting at start -// -String& String::subString(Int32 start, String& dest) const -{ - Int32 srcLoop; - Int32 destLoop = 0; - - start = start < 0? 0 : start; - - dest.clear(); - if (start < strLength) - { - dest.ensureCapacity(strLength - start); - for (srcLoop=start;srcLoop strLength? strLength : end; - - dest.clear(); - if ((start < end)) - { - dest.ensureCapacity(end - start); - for (srcLoop=start;srcLoop= 'A') && - (strBuffer[conversionLoop] <= 'Z')) - strBuffer[conversionLoop] += 32; - } -} - -// -//Convert String to uppercase -// -void String::toUpperCase() -{ - Int32 conversionLoop; - - for (conversionLoop=0;conversionLoop= 'a') && - (strBuffer[conversionLoop] <= 'z')) - strBuffer[conversionLoop] -= 32; - } -} - -// -//Trim whitespace from both ends of String -// -void String::trim() -{ - Int32 trimLoop = strLength - 1; - Int32 cutLoop; - MBool done = MB_FALSE; - - //As long as we are not working on an emtpy string, trim from the right - //first, so we don't have to move useless spaces when we trim from the left. - if (strLength > 0) - { - while (!done) - { - if (strBuffer[trimLoop] == 32) - { - --strLength; //Trim the whitespace by shorting the string. - --trimLoop; - } - else - done = MB_TRUE; - } - } - - //Now, if there are any characters left to the string, Trim to the left. - //First count the number of "left" spaces. Then move all characters to the - //left by that ammount. - if (strLength > 0) - { - done = MB_FALSE; - trimLoop = 0; - while (!done) - { - if (strBuffer[trimLoop] == 32) - ++trimLoop; - else - done = MB_TRUE; - } - - if (trimLoop < strLength) - { - for (cutLoop=trimLoop;cutLoop strLength) + { + ensureCapacity(totalOffset - strLength); + strLength += totalOffset - strLength; + } + + for (replaceLoop=0;replaceLoop strLength) + { + ensureCapacity(totalOffset - strLength); + strLength += totalOffset - strLength; + } + + for (replaceLoop=0;replaceLoop strLength) + { + ensureCapacity(totalOffset - strLength); + strLength += totalOffset - strLength; + } + + for (replaceLoop=0;replaceLoop current length, the string will be extended + * and padded with '\0' null characters. Otherwise the String + * will be truncated +**/ +void String::setLength(Int32 length) { + setLength(length, '\0'); +} //-- setLength + +/** + * Sets the Length of this String, if length is less than 0, it will + * be set to 0; if length > current length, the string will be extended + * and padded with given pad character. Otherwise the String + * will be truncated +**/ +void String::setLength(Int32 length, UNICODE_CHAR padChar) { + if ( length < 0 ) strLength = 0; + else if ( length > strLength ) { + Int32 diff = length-strLength; + ensureCapacity(diff); + for ( Int32 i = strLength; i < length; i++ ) + strBuffer[i] = padChar; + strLength = length; + } + else strLength = length; +} //-- setLength + +// +//Delete the "substring" starting at "offset" and proceeding for "count" number +//of characters (or until the end of the string, whichever comes first). +// +void String::deleteChars(Int32 offset, Int32 count) +{ + Int32 deleteLoop; + Int32 offsetCount; + + offset = offset < 0 ? 0 : offset; + offsetCount = offset + count; + + if (offsetCount < strLength) + { + for (deleteLoop=0;deleteLoop= 0)) + return strBuffer[index]; + else + return -1; +} + +// +//Clear out the string by simply setting the length to zero. The buffer is +//left intact. +// +void String::clear() +{ + strLength = 0; +} + +// +//Make sure the buffer has room for 'capacity' UNICODE_CHARS. +// +void String::ensureCapacity(Int32 capacity) +{ + UNICODE_CHAR* tempStrBuffer = NULL; + + //Check for the desired capacity + Int32 freeSpace = bufferLength - strLength; //(added by kvisco) + + if (freeSpace < capacity) { + + //-- modified by kvisco to only add needed capacity, + //-- not extra bytes as before + //-- old : bufferLength += capacity; + bufferLength += capacity - freeSpace; + + tempStrBuffer = new UNICODE_CHAR[bufferLength]; + copyString(tempStrBuffer); + + //If the old string contained any data, delete it, and save the new. + if (strBuffer) + delete strBuffer; + + strBuffer = tempStrBuffer; + } +} + +/** + * Performs a CASE SENSITIVE search of the string for the first occurence + * of 'data'. If found return the index, else return NOT_FOUND. + * -- changed by kvisco to call indexOf(UNICODE_CHAR, Int32) +**/ +Int32 String::indexOf(UNICODE_CHAR data) const +{ + return indexOf(data, 0); +} //-- indexOf + +// +//Starting at 'offset' perform a CASE SENSITIVE search of the string looking +//for the first occurence of 'data'. If found return the index, else return +//NOT_FOUND. If the offset is less than zero, then start at zero. +// +Int32 String::indexOf(UNICODE_CHAR data, Int32 offset) const +{ + Int32 searchIndex = offset < 0 ? searchIndex = 0 : searchIndex = offset; + + while (1) + { + if (searchIndex >= strLength) + return NOT_FOUND; + else if (strBuffer[searchIndex] == data) + return searchIndex; + else + ++searchIndex; + } +} //-- indexOf + +// +//Returns the index of the first occurence of data +// +Int32 String::indexOf(const String& data) const +{ + Int32 searchIndex = 0; + + while (1) + { + if (searchIndex <= (strLength - data.length())) + { + if (isEqual(&strBuffer[searchIndex], + &data.strBuffer[0], + data.length())) + return searchIndex; + } + else + return NOT_FOUND; + + searchIndex++; + } +} + +// +//Returns the index of the first occurrence of data starting at offset +// +Int32 String::indexOf(const String& data, Int32 offset) const +{ + Int32 searchIndex = offset < 0 ? 0 : offset; + + while (1) + { + if (searchIndex <= (strLength - data.length())) + { + if (isEqual(&strBuffer[searchIndex], + &data.strBuffer[0], + data.length())) + return searchIndex; + } + else + return NOT_FOUND; + + searchIndex++; + } +} + +// +//Check for equality between this string, and data +// +MBool String::isEqual(const String& data) const +{ + if (this == &data) + return MB_TRUE; + else if (strLength != data.length()) + return MB_FALSE; + else + return isEqual(strBuffer, data.strBuffer, data.length()); +} + +/** + * Returns index of last occurrence of data + *
+ * Added implementation 19990729 (kvisco) +**/ +Int32 String::lastIndexOf(UNICODE_CHAR data) const +{ + return lastIndexOf(data, strLength-1); +} //-- lastIndexOf + +/** + * Returns the index of the last occurrence of data starting at offset + *
+ * Added implementation 19990729 (kvisco) +**/ +Int32 String::lastIndexOf(UNICODE_CHAR data, Int32 offset) const +{ + if ((offset < 0) || (offset >= strLength)) return NOT_FOUND; + + Int32 searchIndex = offset; + while (searchIndex >= 0) { + if (strBuffer[searchIndex] == data) return searchIndex; + --searchIndex; + } + return NOT_FOUND; + +} //-- lastIndexOf + +/** + * Returns the index of the last occurrence of data + *
+ * Added implementation 19990729 (kvisco) +**/ +Int32 String::lastIndexOf(const String& data) const +{ + return lastIndexOf(data, strLength-1); +} //-- lastIndexOf + +/** + * Returns the index of the last occurrence of data starting at offset + *
+ * Added implementation 19990729 (kvisco) +**/ +Int32 String::lastIndexOf(const String& data, Int32 offset) const +{ + if ((offset < 0) || (offset >= strLength)) return NOT_FOUND; + return NOT_FOUND; +} + +// +//Returns the length of the String +// +Int32 String::length() const +{ + return strLength; +} + +// +//Returns a subString starting at start +// +String& String::subString(Int32 start, String& dest) const +{ + Int32 srcLoop; + Int32 destLoop = 0; + + start = start < 0? 0 : start; + + dest.clear(); + if (start < strLength) + { + dest.ensureCapacity(strLength - start); + for (srcLoop=start;srcLoop strLength? strLength : end; + + dest.clear(); + if ((start < end)) + { + dest.ensureCapacity(end - start); + for (srcLoop=start;srcLoop= 'A') && + (strBuffer[conversionLoop] <= 'Z')) + strBuffer[conversionLoop] += 32; + } +} + +// +//Convert String to uppercase +// +void String::toUpperCase() +{ + Int32 conversionLoop; + + for (conversionLoop=0;conversionLoop= 'a') && + (strBuffer[conversionLoop] <= 'z')) + strBuffer[conversionLoop] -= 32; + } +} + +// +//Trim whitespace from both ends of String +// +void String::trim() +{ + Int32 trimLoop = strLength - 1; + Int32 cutLoop; + MBool done = MB_FALSE; + + //As long as we are not working on an emtpy string, trim from the right + //first, so we don't have to move useless spaces when we trim from the left. + if (strLength > 0) + { + while (!done) + { + if (strBuffer[trimLoop] == 32) + { + --strLength; //Trim the whitespace by shorting the string. + --trimLoop; + } + else + done = MB_TRUE; + } + } + + //Now, if there are any characters left to the string, Trim to the left. + //First count the number of "left" spaces. Then move all characters to the + //left by that ammount. + if (strLength > 0) + { + done = MB_FALSE; + trimLoop = 0; + while (!done) + { + if (strBuffer[trimLoop] == 32) + ++trimLoop; + else + done = MB_TRUE; + } + + if (trimLoop < strLength) + { + for (cutLoop=trimLoop;cutLoop - typedef unsigned short UNICODE_CHAR; #ifndef NULL -typedef 0 NULL; + #define NULL 0 #endif #define NOT_FOUND -1 @@ -105,8 +105,8 @@ class String : public MITREObject String& operator=(Int32 source); //Grow buffer if necessary and append the source - void append(const UNICODE_CHAR source); - void append(const char source); + void append(UNICODE_CHAR source); + void append(char source); void append(const String& source); void append(const char* source); void append(const UNICODE_CHAR* source); @@ -218,3 +218,4 @@ class String : public MITREObject ostream& operator<<(ostream& output, const String& source); #endif + diff --git a/mozilla/extensions/transformiix/source/base/StringList.cpp b/mozilla/extensions/transformiix/source/base/StringList.cpp index 072329c67b0..bff5bcc5629 100644 --- a/mozilla/extensions/transformiix/source/base/StringList.cpp +++ b/mozilla/extensions/transformiix/source/base/StringList.cpp @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: StringList.cpp,v 1.2 1999-11-15 07:12:42 nisheeth%netscape.com Exp $ */ /** * StringList - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:42 $ **/ #include diff --git a/mozilla/extensions/transformiix/source/base/StringList.h b/mozilla/extensions/transformiix/source/base/StringList.h index 0db6dbaf894..3342bbcf19d 100644 --- a/mozilla/extensions/transformiix/source/base/StringList.h +++ b/mozilla/extensions/transformiix/source/base/StringList.h @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: StringList.h,v 1.2 1999-11-15 07:12:42 nisheeth%netscape.com Exp $ */ /** * A class for keeping an ordered list of Strings - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:42 $ **/ #include "String.h" @@ -129,3 +135,4 @@ private: }; #endif + diff --git a/mozilla/extensions/transformiix/source/base/Tokenizer.cpp b/mozilla/extensions/transformiix/source/base/Tokenizer.cpp index 2e3d2fa692e..d963929c9f1 100644 --- a/mozilla/extensions/transformiix/source/base/Tokenizer.cpp +++ b/mozilla/extensions/transformiix/source/base/Tokenizer.cpp @@ -18,20 +18,41 @@ * Please see release.txt distributed with this file for more information. * */ +/* + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. + * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * Larry Fitzpartick, OpenText, lef@opentext.com + * -- 19990806 + * -- added void return type declaration for ::nextToken() + * -- added proper cast from Int32 to char in ::nextToken() + * $Id: Tokenizer.cpp,v 1.2 1999-11-15 07:12:42 nisheeth%netscape.com Exp $ + */ /** * Tokenizer * A simple String tokenizer - * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *  - in method #nextToken():
- *    - added void return type declaration
- *    - added proper casts from Int32 to char
- * 
- * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:42 $ **/ #include "Tokenizer.h" @@ -98,4 +119,3 @@ void Tokenizer::nextToken(String& buffer) { } } //-- nextToken - diff --git a/mozilla/extensions/transformiix/source/base/Tokenizer.h b/mozilla/extensions/transformiix/source/base/Tokenizer.h index e8450987604..c2ee0b329ac 100644 --- a/mozilla/extensions/transformiix/source/base/Tokenizer.h +++ b/mozilla/extensions/transformiix/source/base/Tokenizer.h @@ -1,36 +1,38 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. + * Keith Visco, kvisco@ziplink.net + * -- original author. * - * Please see release.txt distributed with this file for more information. + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- 19990806, added void return type declaration for ::nextToken() * + * $Id: Tokenizer.h,v 1.2 1999-11-15 07:12:42 nisheeth%netscape.com Exp $ */ /** * Tokenizer * A simple String tokenizer - * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *  - for method #nextToken():
- *    - added void return type declaration
- * 
- * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:42 $ **/ @@ -85,3 +87,4 @@ private: }; //-- Tokenizer #endif + diff --git a/mozilla/extensions/transformiix/source/base/baseutils.h b/mozilla/extensions/transformiix/source/base/baseutils.h index 35011fa92ed..0c4775b6dbf 100644 --- a/mozilla/extensions/transformiix/source/base/baseutils.h +++ b/mozilla/extensions/transformiix/source/base/baseutils.h @@ -1,22 +1,47 @@ +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: baseutils.h,v 1.2 1999-11-15 07:12:43 nisheeth%netscape.com Exp $ */ // Basic Definitions used throughout many of these classes @@ -32,3 +57,4 @@ typedef Int32 MBool; #define MB_FALSE (MBool)0 #endif + diff --git a/mozilla/extensions/transformiix/source/base/primitives.h b/mozilla/extensions/transformiix/source/base/primitives.h index 883074efe1a..3b6d8fbc71d 100644 --- a/mozilla/extensions/transformiix/source/base/primitives.h +++ b/mozilla/extensions/transformiix/source/base/primitives.h @@ -1,26 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- + * $Id: primitives.h,v 1.2 1999-11-15 07:12:43 nisheeth%netscape.com Exp $ */ - #ifndef MITRE_PRIMITIVES_H #define MITRE_PRIMITIVES_H @@ -29,7 +36,7 @@ #include "String.h" #include -#ifdef MOZILLA +#ifdef WIN32 #include #endif @@ -37,7 +44,7 @@ * A wrapper for the primitive double type, and provides some simple * floating point related routines * @author Larry Fitzpatrick - * @author Keith Visco + * @author Keith Visco **/ class Double : public MITREObject { @@ -124,7 +131,7 @@ private: /** * A wrapper for the primitive int type, and provides some simple * integer related routines - * @author Keith Visco + * @author Keith Visco **/ class Integer : public MITREObject { public: @@ -171,3 +178,4 @@ private: }; //-- Integer #endif + diff --git a/mozilla/extensions/transformiix/source/clean.mk b/mozilla/extensions/transformiix/source/clean.mk index f23235a4910..bd2ee3fa585 100644 --- a/mozilla/extensions/transformiix/source/clean.mk +++ b/mozilla/extensions/transformiix/source/clean.mk @@ -1,7 +1,5 @@ target: clean -CC = g++ - PROJ_PATH = ${PWD} ROOT_PATH = $(PROJ_PATH) XML_PATH = $(ROOT_PATH)/xml @@ -16,15 +14,16 @@ XMLPARSER_PATH = $(XML_PATH)/parser EXPAT_PARSER_PATH = $(XMLPARSER_PATH)/xmlparse EXPAT_TOKEN_PATH = $(XMLPARSER_PATH)/xmltok +CMDS = rm -f *.o *~; clean: - cd $(BASE_PATH); rm *.o; \ - cd $(NET_PATH); rm *.o; \ - cd $(XML_PATH); rm *.o; \ - cd $(DOM_PATH); rm *.o; \ - cd $(XMLPARSER_PATH); rm *.o; \ - cd $(EXPAT_PARSER_PATH); rm *.o; \ - cd $(EXPAT_TOKEN_PATH); rm *.o; \ - cd $(XMLPRINTER_PATH); rm *.o; \ - cd $(XSL_PATH); rm *.o; \ - cd $(XSLUTIL_PATH); rm *.o; \ - cd $(EXPR_PATH); rm *.o + cd $(BASE_PATH); $(CMDS) \ + cd $(NET_PATH); $(CMDS) \ + cd $(XML_PATH); $(CMDS) \ + cd $(DOM_PATH); $(CMDS) \ + cd $(XMLPARSER_PATH); $(CMDS) \ + cd $(EXPAT_PARSER_PATH); $(CMDS) \ + cd $(EXPAT_TOKEN_PATH); $(CMDS) \ + cd $(XMLPRINTER_PATH); $(CMDS) \ + cd $(XSL_PATH); $(CMDS) \ + cd $(XSLUTIL_PATH); $(CMDS) \ + cd $(EXPR_PATH); $(CMDS) diff --git a/mozilla/extensions/transformiix/source/examples/functions.html b/mozilla/extensions/transformiix/source/examples/functions.html index 5bdd17edc6b..ba49ef087bd 100644 --- a/mozilla/extensions/transformiix/source/examples/functions.html +++ b/mozilla/extensions/transformiix/source/examples/functions.html @@ -1,986 +1,986 @@ - - - - MII TransforMiiX Test Cases - - -
- - MITRE - -
- MII TransforMiiX Test Cases -
-

This document serves to test XPath and XSL functions.

-
- Visco, Keith + Visco, Keith + Software design and most of the implementation - The MITRE Corporation + Exoffice Technologies +
+ originally with The MITRE Corporation.
+ Heesch, Stefan + + C++ porting issues with Borland C + +
+
Lee, Michele - C++ porting issues + C++ porting issues, bug reports Oblix @@ -111,8 +125,8 @@ beneficial to the development.
-The MITRE Corporation, (C) Copyright 1999, All rights reserved
-Email:kvisco@mitre.org +The MITRE Corporation, Keith Visco (C) Copyright 1999, All rights reserved
+Email:kvisco@ziplink.net
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Boolean Functions -
- Function: - - boolean - boolean( - object - ) -
- Test: - <xsl:value-of select="boolean(descendant::z)"/>
-
- Desired Result: - - true -
-
- Result: - - true -
- Test: - <xsl:value-of select="boolean(*)"/>
-
- Desired Result: - - true -
-
- Result: - - true -
- Function: - - boolean - false() -
- Test: - <xsl:value-of select="false()"/>
-
- Desired Result: - - false -
-
- Result: - - false -
- Function: - - boolean - true() -
- Test: - <xsl:value-of select="true()"/>
-
- Desired Result: - - true -
-
- Result: - - true -
- Function: - - boolean - not( - boolean - ) -
- Test: - <xsl:value-of select="not(true())"/>
-
- Desired Result: - - false -
-
- Result: - - false -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- NodeSet Functions -
- Function: - - number - count( - node-set - ) -
- Test: - <xsl:value-of select="count(*)"/>
-
- Desired Result: - - 4 -
-
- Result: - - 4 -
- Function: - - number - position() -
- Test: - <xsl:value-of select="*[position()=3]"/>
-
- Desired Result: - - z -
-
- Result: - - z -
- Function: - - number - last() -
- Test: - <xsl:value-of select="*[last()-1]"/>
-
- Desired Result: - - z -
-
- Result: - - z -
- Function: - String local-part( - node-set? - ) -
- Test: - <xsl:value-of select="local-part(names/abc:test-name)"/>
-
- Desired Result: - - test-name -
-
- Result: - - test-name -
- Function: - String local-part( - node-set? - ) -
- Test: - <xsl:value-of select="local-part()"/>
-
- Desired Result: - - document -
-
- Result: - - document -
- Function: - Stringname( - node-set? - ) -
- Test: - <xsl:value-of select="name(names/abc:test-name)"/>
-
- Desired Result: - - abc:test-name -
-
- Result: - - abc:test-name -
- Function: - Stringnamespace( - node-set? - ) -
- Test: - <xsl:value-of select="namespace(names/abc:test-name)"/>
-
- Desired Result: - - abc -
-
- Result: - - abc -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- String Functions -
- Function: - - string - string( - object? - ) -
- Test: - <xsl:value-of select="string()"/>
-
- Desired Result: - - x y z -
-
- Result: - - x y z -
- Test: - <xsl:value-of select="string('xyz')"/>
-
- Desired Result: - - xyz -
-
- Result: - - xyz -
- Function: - - string - concat( - string, string, string* - ) -
- Test: - <xsl:value-of select="concat('abc', 'def')"/>
-
- Desired Result: - - abcdef -
-
- Result: - - abcdef -
- Function: - - boolean - contains( - string, string - ) -
- Test: - <xsl:value-of select="contains('abcdef', 'efg')"/>
-
- Desired Result: - - false -
-
- Result: - - false -
- Test: - <xsl:value-of select="contains('abcdef', 'bcd')"/>
-
- Desired Result: - - true -
-
- Result: - - true -
- Function: - - boolean - starts-with( - string, string - ) -
- Test: - <xsl:value-of select="starts-with('abcdef', 'abc')"/>
-
- Desired Result: - - true -
-
- Result: - - true -
- Test: - <xsl:value-of select="starts-with('abcdef', 'xyz')"/>
-
- Desired Result: - - false -
-
- Result: - - false -
- Function: - - number - string-length( - string? - ) -
- Test: - <xsl:value-of select="string-length(name())"/>
-
- Desired Result: - - 8 -
-
- Result: - - 8 -
- Test: - <xsl:value-of select="string-length('abcdef')"/>
-
- Desired Result: - - 6 -
-
- Result: - - 6 -
- Function: - - string - substring( - string, number, number? - ) -
- Test: - <xsl:value-of select="substring('12345', 1.5, 2.6)"/>
-
- Desired Result: - - 234 -
-
- Result: - - 234 -
- Test: - <xsl:value-of select="substring('12345', 0, 3)"/>
-
- Desired Result: - - 12 -
-
- Result: - - 12 -
- Test: - <xsl:value-of select="substring('12345', 0 div 0, 3)"/>
-
- Desired Result: - - -
-
- Result: - - -
- Test: - <xsl:value-of select="substring('12345', 1, 0 div 0)"/>
-
- Desired Result: - - -
-
- Result: - - -
- Test: - <xsl:value-of select="substring('12345', -42, 1 div 0)"/>
-
- Desired Result: - - 12345 -
-
- Result: - - 12345 -
- Test: - <xsl:value-of select="substring('12345', -1 div 0, 1 div 0)"/>
-
- Desired Result: - - -
-
- Result: - - -
- Function: - - string - substring-after( - string, string - ) -
- Test: - <xsl:value-of select="substring-after('1999/04/01', '/')"/>
-
- Desired Result: - - 04/01 -
-
- Result: - - 04/01 -
- Function: - - string - substring-before( - string, string - ) -
- Test: - <xsl:value-of select="substring-before('1999/04/01', '/')"/>
-
- Desired Result: - - 1999 -
-
- Result: - - 1999 -
- Function: - - string - translate( - string, string, string - ) -
- Test: - <xsl:value-of select="translate('bar', 'abc', 'ABC')"/>
-
- Desired Result: - - BAr -
-
- Result: - - BAr -
- Test: - <xsl:value-of select="translate('---aaa---', 'abc-', 'ABC')"/>
-
- Desired Result: - - AAA -
-
- Result: - - AAA -
- - + + + + MII TransforMiiX Test Cases + + +
+ + MITRE + +
+ MII TransforMiiX Test Cases +
+

This document serves to test XPath and XSL functions.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Boolean Functions +
+ Function: + + boolean + boolean( + object + ) +
+ Test: + <xsl:value-of select="boolean(descendant::z)"/>
+
+ Desired Result: + + true +
+
+ Result: + + true +
+ Test: + <xsl:value-of select="boolean(*)"/>
+
+ Desired Result: + + true +
+
+ Result: + + true +
+ Function: + + boolean + false() +
+ Test: + <xsl:value-of select="false()"/>
+
+ Desired Result: + + false +
+
+ Result: + + false +
+ Function: + + boolean + true() +
+ Test: + <xsl:value-of select="true()"/>
+
+ Desired Result: + + true +
+
+ Result: + + true +
+ Function: + + boolean + not( + boolean + ) +
+ Test: + <xsl:value-of select="not(true())"/>
+
+ Desired Result: + + false +
+
+ Result: + + false +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ NodeSet Functions +
+ Function: + + number + count( + node-set + ) +
+ Test: + <xsl:value-of select="count(*)"/>
+
+ Desired Result: + + 4 +
+
+ Result: + + 4 +
+ Function: + + number + position() +
+ Test: + <xsl:value-of select="*[position()=3]"/>
+
+ Desired Result: + + z +
+
+ Result: + + z +
+ Function: + + number + last() +
+ Test: + <xsl:value-of select="*[last()-1]"/>
+
+ Desired Result: + + z +
+
+ Result: + + z +
+ Function: + String local-name( + node-set? + ) +
+ Test: + <xsl:value-of select="local-name(names/abc:test-name)"/>
+
+ Desired Result: + + test-name +
+
+ Result: + + test-name +
+ Function: + String local-name( + node-set? + ) +
+ Test: + <xsl:value-of select="local-name()"/>
+
+ Desired Result: + + document +
+
+ Result: + + document +
+ Function: + String name( + node-set? + ) +
+ Test: + <xsl:value-of select="name(names/abc:test-name)"/>
+
+ Desired Result: + + abc:test-name +
+
+ Result: + + abc:test-name +
+ Function: + String namespace-uri( + node-set? + ) +
+ Test: + <xsl:value-of select="namespace-uri(names/abc:test-name)"/>
+
+ Desired Result: + + abc +
+
+ Result: + + abc +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ String Functions +
+ Function: + + string + string( + object? + ) +
+ Test: + <xsl:value-of select="string()"/>
+
+ Desired Result: + + x y z +
+
+ Result: + + x y z +
+ Test: + <xsl:value-of select="string('xyz')"/>
+
+ Desired Result: + + xyz +
+
+ Result: + + xyz +
+ Function: + + string + concat( + string, string, string* + ) +
+ Test: + <xsl:value-of select="concat('abc', 'def')"/>
+
+ Desired Result: + + abcdef +
+
+ Result: + + abcdef +
+ Function: + + boolean + contains( + string, string + ) +
+ Test: + <xsl:value-of select="contains('abcdef', 'efg')"/>
+
+ Desired Result: + + false +
+
+ Result: + + false +
+ Test: + <xsl:value-of select="contains('abcdef', 'bcd')"/>
+
+ Desired Result: + + true +
+
+ Result: + + true +
+ Function: + + boolean + starts-with( + string, string + ) +
+ Test: + <xsl:value-of select="starts-with('abcdef', 'abc')"/>
+
+ Desired Result: + + true +
+
+ Result: + + true +
+ Test: + <xsl:value-of select="starts-with('abcdef', 'xyz')"/>
+
+ Desired Result: + + false +
+
+ Result: + + false +
+ Function: + + number + string-length( + string? + ) +
+ Test: + <xsl:value-of select="string-length(name())"/>
+
+ Desired Result: + + 8 +
+
+ Result: + + 8 +
+ Test: + <xsl:value-of select="string-length('abcdef')"/>
+
+ Desired Result: + + 6 +
+
+ Result: + + 6 +
+ Function: + + string + substring( + string, number, number? + ) +
+ Test: + <xsl:value-of select="substring('12345', 1.5, 2.6)"/>
+
+ Desired Result: + + 234 +
+
+ Result: + + 234 +
+ Test: + <xsl:value-of select="substring('12345', 0, 3)"/>
+
+ Desired Result: + + 12 +
+
+ Result: + + 12 +
+ Test: + <xsl:value-of select="substring('12345', 0 div 0, 3)"/>
+
+ Desired Result: + + +
+
+ Result: + + +
+ Test: + <xsl:value-of select="substring('12345', 1, 0 div 0)"/>
+
+ Desired Result: + + +
+
+ Result: + + +
+ Test: + <xsl:value-of select="substring('12345', -42, 1 div 0)"/>
+
+ Desired Result: + + 12345 +
+
+ Result: + + 12345 +
+ Test: + <xsl:value-of select="substring('12345', -1 div 0, 1 div 0)"/>
+
+ Desired Result: + + +
+
+ Result: + + +
+ Function: + + string + substring-after( + string, string + ) +
+ Test: + <xsl:value-of select="substring-after('1999/04/01', '/')"/>
+
+ Desired Result: + + 04/01 +
+
+ Result: + + 04/01 +
+ Function: + + string + substring-before( + string, string + ) +
+ Test: + <xsl:value-of select="substring-before('1999/04/01', '/')"/>
+
+ Desired Result: + + 1999 +
+
+ Result: + + 1999 +
+ Function: + + string + translate( + string, string, string + ) +
+ Test: + <xsl:value-of select="translate('bar', 'abc', 'ABC')"/>
+
+ Desired Result: + + BAr +
+
+ Result: + + BAr +
+ Test: + <xsl:value-of select="translate('---aaa---', 'abc-', 'ABC')"/>
+
+ Desired Result: + + AAA +
+
+ Result: + + AAA +
+ + diff --git a/mozilla/extensions/transformiix/source/examples/functions.xml b/mozilla/extensions/transformiix/source/examples/functions.xml index 4d401a5e38d..529b6303e69 100644 --- a/mozilla/extensions/transformiix/source/examples/functions.xml +++ b/mozilla/extensions/transformiix/source/examples/functions.xml @@ -1,12 +1,12 @@ - - - - - - x - y - z - - - - + + + + + + x + y + z + + + + diff --git a/mozilla/extensions/transformiix/source/examples/functions.xsl b/mozilla/extensions/transformiix/source/examples/functions.xsl index 9c772173d4f..6feeac541d1 100644 --- a/mozilla/extensions/transformiix/source/examples/functions.xsl +++ b/mozilla/extensions/transformiix/source/examples/functions.xsl @@ -1,869 +1,869 @@ - - - - - - - - - - - - - - - TransforMiiX - - - - - - - MII TransforMiiX Test Cases - - -
- MITRE
- MII TransforMiiX Test Cases -
-

- This document serves to test XPath and XSL functions. -

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- Boolean Functions -
Function: - boolean boolean(object) -
Test: - <xsl:value-of select="boolean(descendant::z)"/>
-
Desired Result: - true
-
Result: - - - -
Test: - <xsl:value-of select="boolean(*)"/>
-
Desired Result: - true
-
Result: - - - -
Function: - boolean false() -
Test: - <xsl:value-of select="false()"/>
-
Desired Result: - false
-
Result: - - - -
Function: - boolean true() -
Test: - <xsl:value-of select="true()"/>
-
Desired Result: - true
-
Result: - - - -
Function: - boolean not(boolean) -
Test: - <xsl:value-of select="not(true())"/>
-
Desired Result: - false
-
Result: - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- NodeSet Functions -
Function: - number count(node-set) -
Test: - <xsl:value-of select="count(*)"/>
-
Desired Result: - 4
-
Result: - - - -
Function: - number position() -
Test: - <xsl:value-of select="*[position()=3]"/>
-
Desired Result: - z
-
Result: - - - -
Function: - number last() -
Test: - <xsl:value-of select="*[last()-1]"/>
-
Desired Result: - z
-
Result: - - - -
Function: - String local-part(node-set?) -
Test: - <xsl:value-of select="local-part(names/abc:test-name)"/>
-
Desired Result: - test-name
-
Result: - - - -
Function: - String local-part(node-set?) -
Test: - <xsl:value-of select="local-part()"/>
-
Desired Result: - document
-
Result: - - - -
Function: - String name(node-set?) -
Test: - <xsl:value-of select="name(names/abc:test-name)"/>
-
Desired Result: - abc:test-name
-
Result: - - - -
Function: - String namespace(node-set?) -
Test: - <xsl:value-of select="namespace(names/abc:test-name)"/>
-
Desired Result: - abc
-
Result: - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
- String Functions -
Function: - string string(object?) -
Test: - <xsl:value-of select="string()"/>
-
Desired Result: - x y z
-
Result: - - - -
Test: - <xsl:value-of select="string('xyz')"/>
-
Desired Result: - xyz
-
Result: - - - -
Function: - string concat(string, string, string*) -
Test: - <xsl:value-of select="concat('abc', 'def')"/>
-
Desired Result: - abcdef
-
Result: - - - -
Function: - boolean contains(string, string) -
Test: - <xsl:value-of select="contains('abcdef', 'efg')"/>
-
Desired Result: - false
-
Result: - - - -
Test: - <xsl:value-of select="contains('abcdef', 'bcd')"/>
-
Desired Result: - true
-
Result: - - - -
Function: - boolean starts-with(string, string) -
Test: - <xsl:value-of select="starts-with('abcdef', 'abc')"/>
-
Desired Result: - true
-
Result: - - - -
Test: - <xsl:value-of select="starts-with('abcdef', 'xyz')"/>
-
Desired Result: - false
-
Result: - - - -
Function: - number string-length(string?) -
Test: - <xsl:value-of select="string-length(name())"/>
-
Desired Result: - 8
-
Result: - - - -
Test: - <xsl:value-of select="string-length('abcdef')"/>
-
Desired Result: - 6
-
Result: - - - -
Function: - string substring(string, number, number?) -
Test: - <xsl:value-of select="substring('12345', 1.5, 2.6)"/>
-
Desired Result: - 234
-
Result: - - - -
Test: - <xsl:value-of select="substring('12345', 0, 3)"/>
-
Desired Result: - 12
-
Result: - - - -
Test: - <xsl:value-of select="substring('12345', 0 div 0, 3)"/>
-
Desired Result: -
-
Result: - - - -
Test: - <xsl:value-of select="substring('12345', 1, 0 div 0)"/>
-
Desired Result: -
-
Result: - - - -
Test: - <xsl:value-of select="substring('12345', -42, 1 div 0)"/>
-
Desired Result: - 12345
-
Result: - - - -
Test: - <xsl:value-of select="substring('12345', -1 div 0, 1 div 0)"/>
-
Desired Result: -
-
Result: - - - -
Function: - string substring-after(string, string) -
Test: - <xsl:value-of select="substring-after('1999/04/01', '/')"/>
-
Desired Result: - 04/01
-
Result: - - - -
Function: - string substring-before(string, string) -
Test: - <xsl:value-of select="substring-before('1999/04/01', '/')"/>
-
Desired Result: - 1999
-
Result: - - - -
Function: - string translate(string, string, string) -
Test: - <xsl:value-of select="translate('bar', 'abc', 'ABC')"/>
-
Desired Result: - BAr
-
Result: - - - -
Test: - <xsl:value-of select="translate('---aaa---', 'abc-', 'ABC')"/>
-
Desired Result: - AAA
-
Result: - - - -
- - -
- -
- + + + + + + + + + + + + + + + TransforMiiX + + + + + + + MII TransforMiiX Test Cases + + +
+ MITRE
+ MII TransforMiiX Test Cases +
+

+ This document serves to test XPath and XSL functions. +

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Boolean Functions +
Function: + boolean boolean(object) +
Test: + <xsl:value-of select="boolean(descendant::z)"/>
+
Desired Result: + true
+
Result: + + + +
Test: + <xsl:value-of select="boolean(*)"/>
+
Desired Result: + true
+
Result: + + + +
Function: + boolean false() +
Test: + <xsl:value-of select="false()"/>
+
Desired Result: + false
+
Result: + + + +
Function: + boolean true() +
Test: + <xsl:value-of select="true()"/>
+
Desired Result: + true
+
Result: + + + +
Function: + boolean not(boolean) +
Test: + <xsl:value-of select="not(true())"/>
+
Desired Result: + false
+
Result: + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ NodeSet Functions +
Function: + number count(node-set) +
Test: + <xsl:value-of select="count(*)"/>
+
Desired Result: + 4
+
Result: + + + +
Function: + number position() +
Test: + <xsl:value-of select="*[position()=3]"/>
+
Desired Result: + z
+
Result: + + + +
Function: + number last() +
Test: + <xsl:value-of select="*[last()-1]"/>
+
Desired Result: + z
+
Result: + + + +
Function: + String local-name(node-set?) +
Test: + <xsl:value-of select="local-name(names/abc:test-name)"/>
+
Desired Result: + test-name
+
Result: + + + +
Function: + String local-name(node-set?) +
Test: + <xsl:value-of select="local-name()"/>
+
Desired Result: + document
+
Result: + + + +
Function: + String name(node-set?) +
Test: + <xsl:value-of select="name(names/abc:test-name)"/>
+
Desired Result: + abc:test-name
+
Result: + + + +
Function: + String namespace-uri(node-set?) +
Test: + <xsl:value-of select="namespace-uri(names/abc:test-name)"/>
+
Desired Result: + abc
+
Result: + + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ String Functions +
Function: + string string(object?) +
Test: + <xsl:value-of select="string()"/>
+
Desired Result: + x y z
+
Result: + + + +
Test: + <xsl:value-of select="string('xyz')"/>
+
Desired Result: + xyz
+
Result: + + + +
Function: + string concat(string, string, string*) +
Test: + <xsl:value-of select="concat('abc', 'def')"/>
+
Desired Result: + abcdef
+
Result: + + + +
Function: + boolean contains(string, string) +
Test: + <xsl:value-of select="contains('abcdef', 'efg')"/>
+
Desired Result: + false
+
Result: + + + +
Test: + <xsl:value-of select="contains('abcdef', 'bcd')"/>
+
Desired Result: + true
+
Result: + + + +
Function: + boolean starts-with(string, string) +
Test: + <xsl:value-of select="starts-with('abcdef', 'abc')"/>
+
Desired Result: + true
+
Result: + + + +
Test: + <xsl:value-of select="starts-with('abcdef', 'xyz')"/>
+
Desired Result: + false
+
Result: + + + +
Function: + number string-length(string?) +
Test: + <xsl:value-of select="string-length(name())"/>
+
Desired Result: + 8
+
Result: + + + +
Test: + <xsl:value-of select="string-length('abcdef')"/>
+
Desired Result: + 6
+
Result: + + + +
Function: + string substring(string, number, number?) +
Test: + <xsl:value-of select="substring('12345', 1.5, 2.6)"/>
+
Desired Result: + 234
+
Result: + + + +
Test: + <xsl:value-of select="substring('12345', 0, 3)"/>
+
Desired Result: + 12
+
Result: + + + +
Test: + <xsl:value-of select="substring('12345', 0 div 0, 3)"/>
+
Desired Result: +
+
Result: + + + +
Test: + <xsl:value-of select="substring('12345', 1, 0 div 0)"/>
+
Desired Result: +
+
Result: + + + +
Test: + <xsl:value-of select="substring('12345', -42, 1 div 0)"/>
+
Desired Result: + 12345
+
Result: + + + +
Test: + <xsl:value-of select="substring('12345', -1 div 0, 1 div 0)"/>
+
Desired Result: +
+
Result: + + + +
Function: + string substring-after(string, string) +
Test: + <xsl:value-of select="substring-after('1999/04/01', '/')"/>
+
Desired Result: + 04/01
+
Result: + + + +
Function: + string substring-before(string, string) +
Test: + <xsl:value-of select="substring-before('1999/04/01', '/')"/>
+
Desired Result: + 1999
+
Result: + + + +
Function: + string translate(string, string, string) +
Test: + <xsl:value-of select="translate('bar', 'abc', 'ABC')"/>
+
Desired Result: + BAr
+
Result: + + + +
Test: + <xsl:value-of select="translate('---aaa---', 'abc-', 'ABC')"/>
+
Desired Result: + AAA
+
Result: + + + +
+ + +
+ +
+ diff --git a/mozilla/extensions/transformiix/source/examples/identity-result.xml b/mozilla/extensions/transformiix/source/examples/identity-result.xml index de5c0758cf3..ef4227be779 100644 --- a/mozilla/extensions/transformiix/source/examples/identity-result.xml +++ b/mozilla/extensions/transformiix/source/examples/identity-result.xml @@ -1,8 +1,8 @@ - - - - - x - y - z - + + + + + x + y + z + diff --git a/mozilla/extensions/transformiix/source/examples/test.html b/mozilla/extensions/transformiix/source/examples/test.html index 325f2978ba3..d2fa25f6024 100644 --- a/mozilla/extensions/transformiix/source/examples/test.html +++ b/mozilla/extensions/transformiix/source/examples/test.html @@ -16,17 +16,37 @@

This document serves to test basic XSL expressions.

- Testing xsl:variable + Testing xsl:variable and xsl:copy-of
- Test:<xsl:value-of select="$product-name"/>
- Desired Result:TransforMiiX
- Result:TransforMiiX

+ Test:<xsl:copy-of select="$product-name"/>
+ Desired Result:TransforMiiX
+ Result:TransforMiiX

Testing xsl:if
Test:<xsl:if test="x | y | z">true</xsl:if>
Desired Result:true
Result:true

+

+ Testing xsl:if +
+ Test:<xsl:if test="true()">true</xsl:if>
+ Desired Result:true
+ Result:true

+

+ Testing xsl:if +
+ Test:<xsl:if test="'a'='b'">a equals b</xsl:if>
+ <xsl:if test="'a'!='b'">a does not equal b</xsl:if>
+ Desired Result:a does not equal to b
+ Result:a does not equal b

+

+ Testing xsl:if +
+ Test:<xsl:if test="2+1-3">2+1-3 is true</xsl:if>
+  <xsl:if test="not(2+1-3)">not(2+1-3) is true</xsl:if>
+ Desired Result:not(2+1-3) is true
+ Result:not(2+1-3) is true

Testing xsl:choose
@@ -46,7 +66,13 @@ Test:<xsl:apply-templates/>
Desired Result:element x, element y, element z
Result:element x,element y,element z -

+ + + + + + +

Testing basic xsl:apply-templates with mode
@@ -73,10 +99,17 @@

Named Template/Call Template -
- Test:<xsl:call-template name="named-template-test"/>
- Desired Result:named template processed!
- Result:named template processed!

+

+ Test:<xsl:call-template name="named-template-test"/>
+ Desired Result:named template processed with default value!
+ Result: + named template processed with default value!

+

+ Test:- passing arguments to named templates (see xsl source)
+ Desired Result:named template processed with passed value!
+ Result: + named template processed with passed value!

+

Attribute Value Templates and variables
@@ -227,6 +260,63 @@


+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Numbering (only simple numbering currently implemented) +
+ Test: + <xsl:number value="4"/>
+
+ Desired Result: + + 4 +
+
+ Result: + + 4 +
+ Test: + see source
+
+ Desired Result: + + 1. x
1. y
1. z
+
+
+ Result: + + 1. x
1. y
1. z
+
+
+
- @@ -478,7 +568,135 @@ Result: + +
@@ -461,7 +551,7 @@ Test: <xsl:variable name="x" expr="7*3"/>
<xsl:variable name="y" expr="3"/>
<xsl:value-of select="$x div $y"/>
+
<xsl:variable name="x" select="7*3"/>
<xsl:variable name="y" select="3"/>
<xsl:value-of select="$x div $y"/>
- 7 + 7
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Precedence tests +
+ Test: + <xsl:value-of select="2 mod 2 = 0"/>
+
+ Desired Result: + + true +
+
+ Result: + + true +
+ Test: + <xsl:value-of select="5 mod 2<5 and 2*6>= 12"/>
+
+ Desired Result: + + true +
+
+ Result: + + true +
+ Test: + <xsl:value-of select="5 mod 2<5 and 2*6>12"/>
+
+ Desired Result: + + false +
+
+ Result: + + false +
+ Test: + <xsl:value-of select="4+5*3"/>
+
+ Desired Result: + + 19 +
+
+ Result: + + 19 +
+ Test: + <xsl:value-of select="4+5*3+(6-4)*7"/>
+
+ Desired Result: + + 33 +
+
+ Result: + + 33
diff --git a/mozilla/extensions/transformiix/source/examples/test.xsl b/mozilla/extensions/transformiix/source/examples/test.xsl index 0de98a6da1c..0c1e354379d 100644 --- a/mozilla/extensions/transformiix/source/examples/test.xsl +++ b/mozilla/extensions/transformiix/source/examples/test.xsl @@ -43,7 +43,7 @@ - this is a test processing ?> instruction + this is a test processing instruction MITRE TransforMiiX Test cases, written by Keith Visco. @@ -51,7 +51,15 @@ - named template processed! + + named template processed with + ! + +
+ + Error, undeclared parameters should be ignored! + +
@@ -77,10 +85,10 @@

- Testing xsl:variable
- Test: <xsl:value-of select="$product-name"/>
- Desired Result:TransforMiiX
- Result: + Testing xsl:variable and xsl:copy-of
+ Test: <xsl:copy-of select="$product-name"/>
+ Desired Result:TransforMiiX
+ Result:

@@ -90,6 +98,37 @@ Result: true

+ +

+ Testing xsl:if
+ Test: <xsl:if test="true()">true</xsl:if>
+ Desired Result: true
+ Result: true +

+ + +

+ Testing xsl:if
+ Test: <xsl:if test="'a'='b'">a equals b</xsl:if>
+ <xsl:if test="'a'!='b'">a does not equal b</xsl:if> +
+ Desired Result: a does not equal to b
+ Result: + a equals b
+ a does not equal b +

+ + +

+ Testing xsl:if
+ Test: <xsl:if test="2+1-3"> 2+1-3 is true</xsl:if>
+  <xsl:if test="not(2+1-3)"> not(2+1-3) is true</xsl:if>
+ Desired Result:not(2+1-3) is true
+ Result: + 2+1-3 is true + not(2+1-3) is true +

+

Testing xsl:choose
@@ -149,10 +188,21 @@

- Named Template/Call Template
- Test:<xsl:call-template name="named-template-test"/>
- Desired Result:named template processed!
- Result: + Named Template/Call Template +

+ Test:<xsl:call-template name="named-template-test"/>
+ Desired Result:named template processed with default value!
+ Result: +

+

+ Test: - passing arguments to named templates (see xsl source)
+ Desired Result:named template processed with passed value!
+ Result: + + + + +

@@ -169,6 +219,7 @@ Red Text


+
@@ -301,6 +352,61 @@
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Numbering (only simple numbering currently implemented) +
Test: + <xsl:number value="4"/>
+
Desired Result: + 4
+
Result: + +
Test: + see source
+
Desired Result: + + 1. x
1. y
1. z +

+
Result: + + + + .
+
+
+

@@ -512,8 +618,8 @@ Test: - <xsl:variable name="x" expr="7*3"/>
- <xsl:variable name="y" expr="3"/>
+ <xsl:variable name="x" select="7*3"/>
+ <xsl:variable name="y" select="3"/>
<xsl:value-of select="$x div $y"/>
@@ -527,13 +633,130 @@ Result: - - + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ Precedence tests +
Test: + <xsl:value-of select="2 mod 2 = 0"/>
+
Desired Result: + true
+
Result: + + + +
Test: + <xsl:value-of select="5 mod 2 < 5 and 2*6 >= 12"/>
+
Desired Result: + true
+
Result: + + + +
Test: + <xsl:value-of select="5 mod 2 < 5 and 2*6>12"/>
+
Desired Result: + false
+
Result: + + + +
Test: + <xsl:value-of select="4+5*3"/>
+
Desired Result: + 19
+
Result: + + + +
Test: + <xsl:value-of select="4+5*3+(6-4)*7"/>
+
Desired Result: + 33
+
Result: + + + +
+
diff --git a/mozilla/extensions/transformiix/source/main/transformiix.cpp b/mozilla/extensions/transformiix/source/main/transformiix.cpp index ddbc420b8b4..8b69094acfc 100644 --- a/mozilla/extensions/transformiix/source/main/transformiix.cpp +++ b/mozilla/extensions/transformiix/source/main/transformiix.cpp @@ -1,24 +1,30 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: transformiix.cpp,v 1.2 1999-11-15 07:12:46 nisheeth%netscape.com Exp $ */ + #include "XSLProcessor.h" //--------------/ @@ -37,20 +43,20 @@ void printUsage(); /** * The TransforMiiX command line interface - * @author Keith Visco + * @author Keith Visco **/ int main(int argc, char** argv) { XSLProcessor xslProcessor; - String copyright("(C) 1999 The MITRE Corporation"); + String copyright("(C) 1999 The MITRE Corporation, Keith Visco, and contributors"); cout << xslProcessor.getAppName() << " "; - cout << xslProcessor.getAppVersion() << copyright <length()+1]; ifstream xslInput(xslFilename->toChar(chars), ios::in); delete chars; - xslProcessor.process(xmlInput, xslInput, *resultOutput); + xslProcessor.process(xmlInput, xslInput, *resultOutput, documentBase); } resultFileStream.close(); return 0; diff --git a/mozilla/extensions/transformiix/source/net/Makefile b/mozilla/extensions/transformiix/source/net/Makefile index 51f295c79f3..6da707bc05a 100644 --- a/mozilla/extensions/transformiix/source/net/Makefile +++ b/mozilla/extensions/transformiix/source/net/Makefile @@ -1,12 +1,12 @@ target: make_netlib -CC = g++ +CC := $(CC) -g #ifndef PROJ_PATH BASE_PATH = ../base #endif -INCLUDE_PATHS = -I . -I$(BASE_PATH) -I- +INCLUDE_PATHS = -I. -I$(BASE_PATH) -I- BASE_OBJS = $(BASE_PATH)/String.o diff --git a/mozilla/extensions/transformiix/source/net/URIUtils.cpp b/mozilla/extensions/transformiix/source/net/URIUtils.cpp index 30e28e77e54..0955896c5c9 100644 --- a/mozilla/extensions/transformiix/source/net/URIUtils.cpp +++ b/mozilla/extensions/transformiix/source/net/URIUtils.cpp @@ -1,39 +1,40 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- 19990806 + * -- moved initialization of constant shorts and chars from + * URIUtils.cpp to here * + * $Id: URIUtils.cpp,v 1.2 1999-11-15 07:12:47 nisheeth%netscape.com Exp $ */ -//package com.kvisco.net; #include "URIUtils.h" /** * URIUtils * A set of utilities for handling URIs - * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *  - moved initialization of contanst shorts and chars from
- *    URIUtils.h to here
- * 
- * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:47 $ **/ //- Constants -/ diff --git a/mozilla/extensions/transformiix/source/net/URIUtils.h b/mozilla/extensions/transformiix/source/net/URIUtils.h index 5f8e191dab8..9c49a6e618c 100644 --- a/mozilla/extensions/transformiix/source/net/URIUtils.h +++ b/mozilla/extensions/transformiix/source/net/URIUtils.h @@ -1,24 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- 19990806 + * -- moved initialization of constant shorts and chars to + * URIUtils.cpp + * $Id: URIUtils.h,v 1.2 1999-11-15 07:12:48 nisheeth%netscape.com Exp $ */ -//package com.kvisco.net; #include "String.h" #include "baseutils.h" @@ -29,12 +38,7 @@ * A utility class for URI handling * Not yet finished, only handles file URI at this point * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *  - moved initialization of contanst shorts and chars to URIUtils.cpp
- * 
+ * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:48 $ * **/ @@ -106,3 +110,4 @@ private: }; //-- URIUtils + diff --git a/mozilla/extensions/transformiix/source/xml/Makefile b/mozilla/extensions/transformiix/source/xml/Makefile index 36eaa348384..bc076cccd43 100644 --- a/mozilla/extensions/transformiix/source/xml/Makefile +++ b/mozilla/extensions/transformiix/source/xml/Makefile @@ -1,20 +1,15 @@ -BASE_PATH = ../base -DOM_PATH = dom - -INCLUDE_PATH = -I . -I $(BASE_PATH) -I $(DOM_PATH) -I- +INCLUDE_PATH = -I../base -Idom ALL_OBJS = XMLDOMUtils.o \ XMLUtils.o -CC = g++ $(INCLUDE_PATH) - target: $(ALL_OBJS) XMLDOMUtils.o: XMLDOMUtils.h XMLDOMUtils.cpp - $(CC) -c XMLDOMUtils.cpp + $(CC) $(INCLUDE_PATH) -c XMLDOMUtils.cpp XMLUtils.o: XMLUtils.h XMLUtils.cpp - $(CC) -c XMLUtils.cpp + $(CC) $(INCLUDE_PATH) -c XMLUtils.cpp diff --git a/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp b/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp index 90c59f6c205..bddd1aa8c11 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp +++ b/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.cpp @@ -1,36 +1,128 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco + * -- original author. * + * $Id: XMLDOMUtils.cpp,v 1.2 1999-11-15 07:12:49 nisheeth%netscape.com Exp $ */ /** * XMLDOMUtils - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:49 $ **/ #include "XMLDOMUtils.h" +/** + * Copies the given Node, using the owner Document to create all + * necessary new Node(s) +**/ +Node* XMLDOMUtils::copyNode(Node* node, Document* owner) { + + if ( !node ) return 0; + + short nodeType = node->getNodeType(); + + //-- make sure owner exists if we are copying nodes other than + //-- document nodes + if ((nodeType != Node::DOCUMENT_NODE) && (!owner)) return 0; + Node* newNode = 0; + int i = 0; + switch ( nodeType ) { + + case Node::ATTRIBUTE_NODE : + { + Attr* attr = (Attr*)node; + Attr* newAttr = owner->createAttribute(attr->getName()); + newAttr->setValue(attr->getValue()); + newNode = newAttr; + break; + } + case Node::DOCUMENT_NODE : + { + Document* doc = (Document*)node; + Document* newDoc = new Document(); + NodeList* nl = doc->getChildNodes(); + for (i = 0; i < nl->getLength(); i++) { + newDoc->appendChild(copyNode(nl->item(i), newDoc)); + } + newNode = newDoc; + break; + } + case Node::DOCUMENT_FRAGMENT_NODE : + { + newNode = owner->createDocumentFragment(); + NodeList* nl = node->getChildNodes(); + for (i = 0; i < nl->getLength(); i++) { + newNode->appendChild(copyNode(nl->item(i), owner)); + } + break; + } + case Node::ELEMENT_NODE : + { + Element* element = (Element*)node; + Element* newElement = owner->createElement(element->getNodeName()); + + //-- copy atts + NamedNodeMap* attList = element->getAttributes(); + if ( attList ) { + for ( i = 0; i < attList->getLength(); i++ ) { + Attr* attr = (Attr*) attList->item(i); + newElement->setAttribute(attr->getName(), attr->getValue()); + } + } + //-- copy children + NodeList* nl = element->getChildNodes(); + for (i = 0; i < nl->getLength(); i++) { + newElement->appendChild(copyNode(nl->item(i), owner)); + } + newNode = newElement; + break; + } + case Node::TEXT_NODE : + newNode = owner->createTextNode(((Text*)node)->getData()); + break; + case Node::CDATA_SECTION_NODE : + newNode = owner->createCDATASection(((CDATASection*)node)->getData()); + break; + case Node::PROCESSING_INSTRUCTION_NODE: + { + ProcessingInstruction* pi = (ProcessingInstruction*)node; + newNode = owner->createProcessingInstruction(pi->getTarget(), pi->getData()); + break; + } + case Node::COMMENT_NODE: + newNode = owner->createComment(((Comment*)node)->getData()); + break; + default: + break; + } //-- switch + + return newNode; +} //-- copyNode + void XMLDOMUtils::getNodeValue(Node* node, DOMString* target) { - if (!node) { - return; - } + if (!node) return; int nodeType = node->getNodeType(); Element* element = 0; diff --git a/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.h b/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.h index 1d0e394d5e7..8a932e52d9e 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.h +++ b/mozilla/extensions/transformiix/source/xml/XMLDOMUtils.h @@ -1,27 +1,32 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco + * -- original author. * + * $Id: XMLDOMUtils.h,v 1.2 1999-11-15 07:12:49 nisheeth%netscape.com Exp $ */ /** * A utility class for use with XML DOM implementations - * @author Keith Visco + * @author Keith Visco **/ #include "dom.h" @@ -30,12 +35,20 @@ class XMLDOMUtils { - public: +public: + + /** + * Copies the given Node, using the owner Document to create all + * necessary new Node(s) + **/ + static Node* XMLDOMUtils::copyNode(Node* node, Document* owner); /** * Appends the value of the given Node to the target DOMString **/ static void XMLDOMUtils::getNodeValue(Node* node, DOMString* target); + + }; //-- XMLDOMUtils #endif diff --git a/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp b/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp index e31bba90d9e..ddc76c76f90 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp +++ b/mozilla/extensions/transformiix/source/xml/XMLUtils.cpp @@ -1,24 +1,28 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco + * -- original author. * + * $Id: XMLUtils.cpp,v 1.2 1999-11-15 07:12:49 nisheeth%netscape.com Exp $ */ - /** * An XML utility class * @author Keith Visco @@ -108,6 +112,25 @@ MBool XMLUtils::isValidQName(String& name) { return MB_TRUE; } //-- isValidQName +/** + * Returns true if the given string has only whitespace characters +**/ +MBool XMLUtils::isWhitespace(const String& text) { + for ( int i = 0; i < text.length(); i++ ) { + Int32 ch = text.charAt(i); + switch ( ch ) { + case ' ' : + case '\n' : + case '\r' : + case '\t' : + break; + default: + return MB_FALSE; + } + } + return MB_TRUE; +} //-- isWhitespace + /** * Normalizes the value of an XML attribute **/ diff --git a/mozilla/extensions/transformiix/source/xml/XMLUtils.h b/mozilla/extensions/transformiix/source/xml/XMLUtils.h index fa935158ef4..9647a5cf369 100644 --- a/mozilla/extensions/transformiix/source/xml/XMLUtils.h +++ b/mozilla/extensions/transformiix/source/xml/XMLUtils.h @@ -1,27 +1,32 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: XMLUtils.h,v 1.2 1999-11-15 07:12:49 nisheeth%netscape.com Exp $ */ /** * An XML Utility class - * @author Keith Visco + * @author Keith Visco **/ #include "String.h" @@ -39,11 +44,17 @@ public: static void getNameSpace(const String& src, String& dest); static void getLocalPart(const String& src, String& dest); + /** * Returns true if the given String is a valid XML QName **/ static MBool isValidQName(String& name); + /** + * Returns true if the given string has only whitespace characters + **/ + static MBool isWhitespace(const String& text); + /** * Normalizes the value of an XML attribute **/ @@ -107,3 +118,4 @@ private: }; //-- XMLUtils #endif + diff --git a/mozilla/extensions/transformiix/source/xml/dom/Attr.cpp b/mozilla/extensions/transformiix/source/xml/dom/Attr.cpp index 04a4004b76e..bb0dfef8ab2 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Attr.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/Attr.cpp @@ -1,143 +1,143 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the Attr class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// LF 08/06/1999 fixed typo: defalut to default - -// - -#include "dom.h" - -// -//Construct an Attribute object using the specified name and document owner -// -Attr::Attr(const DOMString& name, Document* owner): - NodeDefinition(Node::ATTRIBUTE_NODE, name, NULL_STRING, owner) -{ - specified = MB_FALSE; -} - -// -//Retrieve the name of the attribute from the nodeName data member -// -const DOMString& Attr::getName() const -{ - return nodeName; -} - -// -//Retrieve the specified flag -// -MBool Attr::getSpecified() const -{ - return specified; -} - -// -//Retrieve the value of the attribute. This is a comma-deliminated string -//representation of the Attribute's children. -// -const DOMString& Attr::getValue() -{ - Int32 valueLoop; - nodeValue = NULL_STRING; - NodeList* childList = getChildNodes(); - Int32 numChildren = childList->getLength(); - - for (valueLoop=0;valueLoopitem(valueLoop)->getNodeType() != Node::ENTITY_REFERENCE_NODE) - { - nodeValue.append(childList->item(valueLoop)->getNodeValue()); - if (valueLoop < (numChildren-1)) - nodeValue.append(","); - } - } - - return nodeValue; -} - -// -//Create a new Text node and add it to the Attribute's list of children. Also -//set the Specified flag to true. -// -void Attr::setValue(const DOMString& newValue) -{ - NodeDefinition::DeleteChildren(); - - appendChild(getOwnerDocument()->createTextNode(newValue)); - - specified = MB_TRUE; -} - - -// -//Override the set node value member function to create a new TEXT node with -//the DOMString and to add it as the Attribute's child. -// NOTE: Not currently impemented, just execute the default setNodeValue -// -void Attr::setNodeValue(const DOMString& nodeValue) -{ - setValue(nodeValue); -} - -// -//Return a DOMString represening the value of this node. If the value is an -//Entity Reference then return the value of the reference. Otherwise, it is a -//simple conversion of the text value. -// NOTE: Not currently implemented, just execute the default getNodeValue -// -const DOMString& Attr::getNodeValue() -{ - return getValue(); -} - - -// -//First check to see if the new node is an allowable child for an Attr. If it -//is, call NodeDefinition's implementation of Insert Before. If not, return -//null as an error. -// -Node* Attr::insertBefore(Node* newChild, Node* refChild) -{ - Node* returnVal = NULL; - - switch (newChild->getNodeType()) - { - case Node::TEXT_NODE : - case Node::ENTITY_REFERENCE_NODE: - returnVal = NodeDefinition::insertBefore(newChild, refChild); - - if (returnVal) - specified = MB_TRUE; - break; - default: - returnVal = NULL; - } - - return returnVal; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the Attr class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// LF 08/06/1999 fixed typo: defalut to default + +// + +#include "dom.h" + +// +//Construct an Attribute object using the specified name and document owner +// +Attr::Attr(const DOMString& name, Document* owner): + NodeDefinition(Node::ATTRIBUTE_NODE, name, NULL_STRING, owner) +{ + specified = MB_FALSE; +} + +// +//Retrieve the name of the attribute from the nodeName data member +// +const DOMString& Attr::getName() const +{ + return nodeName; +} + +// +//Retrieve the specified flag +// +MBool Attr::getSpecified() const +{ + return specified; +} + +// +//Retrieve the value of the attribute. This is a comma-deliminated string +//representation of the Attribute's children. +// +const DOMString& Attr::getValue() +{ + Int32 valueLoop; + nodeValue = NULL_STRING; + NodeList* childList = getChildNodes(); + Int32 numChildren = childList->getLength(); + + for (valueLoop=0;valueLoopitem(valueLoop)->getNodeType() != Node::ENTITY_REFERENCE_NODE) + { + nodeValue.append(childList->item(valueLoop)->getNodeValue()); + if (valueLoop < (numChildren-1)) + nodeValue.append(","); + } + } + + return nodeValue; +} + +// +//Create a new Text node and add it to the Attribute's list of children. Also +//set the Specified flag to true. +// +void Attr::setValue(const DOMString& newValue) +{ + NodeDefinition::DeleteChildren(); + + appendChild(getOwnerDocument()->createTextNode(newValue)); + + specified = MB_TRUE; +} + + +// +//Override the set node value member function to create a new TEXT node with +//the DOMString and to add it as the Attribute's child. +// NOTE: Not currently impemented, just execute the default setNodeValue +// +void Attr::setNodeValue(const DOMString& nodeValue) +{ + setValue(nodeValue); +} + +// +//Return a DOMString represening the value of this node. If the value is an +//Entity Reference then return the value of the reference. Otherwise, it is a +//simple conversion of the text value. +// NOTE: Not currently implemented, just execute the default getNodeValue +// +const DOMString& Attr::getNodeValue() +{ + return getValue(); +} + + +// +//First check to see if the new node is an allowable child for an Attr. If it +//is, call NodeDefinition's implementation of Insert Before. If not, return +//null as an error. +// +Node* Attr::insertBefore(Node* newChild, Node* refChild) +{ + Node* returnVal = NULL; + + switch (newChild->getNodeType()) + { + case Node::TEXT_NODE : + case Node::ENTITY_REFERENCE_NODE: + returnVal = NodeDefinition::insertBefore(newChild, refChild); + + if (returnVal) + specified = MB_TRUE; + break; + default: + returnVal = NULL; + } + + return returnVal; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/CDATASection.cpp b/mozilla/extensions/transformiix/source/xml/dom/CDATASection.cpp index 328bba1ca63..44586af9d4c 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/CDATASection.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/CDATASection.cpp @@ -1,64 +1,64 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the CDATASection class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -CDATASection::CDATASection(const DOMString& theData, Document* owner) : - Text(Node::CDATA_SECTION_NODE, "#cdata-section", theData, owner) -{ -} - -// -//CDATASection nodes can not have any children, so just return null from all child -//manipulation functions. -// - -Node* CDATASection::insertBefore(Node* newChild, Node* refChild) -{ - return NULL; -} - -Node* CDATASection::replaceChild(Node* newChild, Node* oldChild) -{ - return NULL; -} - -Node* CDATASection::removeChild(Node* oldChild) -{ - return NULL; -} - -Node* CDATASection::appendChild(Node* newChild) -{ - return NULL; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the CDATASection class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +CDATASection::CDATASection(const DOMString& theData, Document* owner) : + Text(Node::CDATA_SECTION_NODE, "#cdata-section", theData, owner) +{ +} + +// +//CDATASection nodes can not have any children, so just return null from all child +//manipulation functions. +// + +Node* CDATASection::insertBefore(Node* newChild, Node* refChild) +{ + return NULL; +} + +Node* CDATASection::replaceChild(Node* newChild, Node* oldChild) +{ + return NULL; +} + +Node* CDATASection::removeChild(Node* oldChild) +{ + return NULL; +} + +Node* CDATASection::appendChild(Node* newChild) +{ + return NULL; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/CharacterData.cpp b/mozilla/extensions/transformiix/source/xml/dom/CharacterData.cpp index dbdc75c4371..167f9eaebf4 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/CharacterData.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/CharacterData.cpp @@ -1,113 +1,113 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the CharacterData class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Protected constructor. Just pass parameters onto NodeDefinition. -// -CharacterData::CharacterData(NodeType type, const DOMString& name, - const DOMString& value, Document* owner) : - NodeDefinition(type, name, value, owner) -{ -} - -// -//Return a constant reference to the data stored by this object. -// -const DOMString& CharacterData::getData() const -{ - return nodeValue; -} - -// -//Set the data stored by this object to the string represented by "source". -// -void CharacterData::setData(const DOMString& source) -{ - nodeValue = source; -} - -// -//Returns the length of the data object. -// -Int32 CharacterData::getLength() const -{ - return nodeValue.length(); -} - -// -//Retreive the substring starting at offset anc ending count number of -//characters away. -// NOTE: An empty string will be returned in the event of an error. -// -DOMString& CharacterData::substringData(Int32 offset, Int32 count, DOMString& dest) -{ - if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0)) - return nodeValue.subString(offset, offset+count, dest); - else - { - dest.clear(); - return dest; - } -} - -void CharacterData::appendData(const DOMString& arg) -{ - nodeValue.append(arg); -} - -void CharacterData::insertData(Int32 offset, const DOMString& arg) -{ - if ((offset >= 0) && (offset < nodeValue.length())) - nodeValue.insert(offset, arg); -} - -void CharacterData::deleteData(Int32 offset, Int32 count) -{ - if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0)) - nodeValue.deleteChars(offset, count); -} - -void CharacterData::replaceData(Int32 offset, Int32 count, const DOMString& arg) -{ - DOMString tempString; - - if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0)) - { - if (count < arg.length()) - { - tempString = arg.subString(0, count, tempString); - nodeValue.replace(offset, tempString); - } - else - nodeValue.replace(offset, arg); - } -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the CharacterData class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Protected constructor. Just pass parameters onto NodeDefinition. +// +CharacterData::CharacterData(NodeType type, const DOMString& name, + const DOMString& value, Document* owner) : + NodeDefinition(type, name, value, owner) +{ +} + +// +//Return a constant reference to the data stored by this object. +// +const DOMString& CharacterData::getData() const +{ + return nodeValue; +} + +// +//Set the data stored by this object to the string represented by "source". +// +void CharacterData::setData(const DOMString& source) +{ + nodeValue = source; +} + +// +//Returns the length of the data object. +// +Int32 CharacterData::getLength() const +{ + return nodeValue.length(); +} + +// +//Retreive the substring starting at offset anc ending count number of +//characters away. +// NOTE: An empty string will be returned in the event of an error. +// +DOMString& CharacterData::substringData(Int32 offset, Int32 count, DOMString& dest) +{ + if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0)) + return nodeValue.subString(offset, offset+count, dest); + else + { + dest.clear(); + return dest; + } +} + +void CharacterData::appendData(const DOMString& arg) +{ + nodeValue.append(arg); +} + +void CharacterData::insertData(Int32 offset, const DOMString& arg) +{ + if ((offset >= 0) && (offset < nodeValue.length())) + nodeValue.insert(offset, arg); +} + +void CharacterData::deleteData(Int32 offset, Int32 count) +{ + if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0)) + nodeValue.deleteChars(offset, count); +} + +void CharacterData::replaceData(Int32 offset, Int32 count, const DOMString& arg) +{ + DOMString tempString; + + if ((offset >= 0) && (offset < nodeValue.length()) && (count > 0)) + { + if (count < arg.length()) + { + tempString = arg.subString(0, count, tempString); + nodeValue.replace(offset, tempString); + } + else + nodeValue.replace(offset, arg); + } +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/Comment.cpp b/mozilla/extensions/transformiix/source/xml/dom/Comment.cpp index 97db4507946..cc26feecf2b 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Comment.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/Comment.cpp @@ -1,64 +1,64 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the Comment class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -Comment::Comment(const DOMString& theData, Document* owner) : - CharacterData(Node::COMMENT_NODE, "#comment", theData, owner) -{ -} - -// -//Comment nodes can not have any children, so just return null from all child -//manipulation functions. -// - -Node* Comment::insertBefore(Node* newChild, Node* refChild) -{ - return NULL; -} - -Node* Comment::replaceChild(Node* newChild, Node* oldChild) -{ - return NULL; -} - -Node* Comment::removeChild(Node* oldChild) -{ - return NULL; -} - -Node* Comment::appendChild(Node* newChild) -{ - return NULL; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the Comment class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +Comment::Comment(const DOMString& theData, Document* owner) : + CharacterData(Node::COMMENT_NODE, "#comment", theData, owner) +{ +} + +// +//Comment nodes can not have any children, so just return null from all child +//manipulation functions. +// + +Node* Comment::insertBefore(Node* newChild, Node* refChild) +{ + return NULL; +} + +Node* Comment::replaceChild(Node* newChild, Node* oldChild) +{ + return NULL; +} + +Node* Comment::removeChild(Node* oldChild) +{ + return NULL; +} + +Node* Comment::appendChild(Node* newChild) +{ + return NULL; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/DOMImplementation.cpp b/mozilla/extensions/transformiix/source/xml/dom/DOMImplementation.cpp index 91d4974c9dd..dc30f22ac5a 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/DOMImplementation.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/DOMImplementation.cpp @@ -1,56 +1,56 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the DOMImplementation class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -DOMImplementation::DOMImplementation() -{ - implFeature = "XML"; - implVersion = "1.0"; -} - -DOMImplementation::~DOMImplementation() -{ -} - -// -//Perform a case insensitive comparison between "feature" and the -//functionality of this DOM implementation/version. -// -MBool DOMImplementation::hasFeature(DOMString feature, - const DOMString& version) const -{ - feature.toUpperCase(); - - if (feature.isEqual(implFeature) && version.isEqual(implVersion)) - return MB_TRUE; - else - return MB_FALSE; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the DOMImplementation class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +DOMImplementation::DOMImplementation() +{ + implFeature = "XML"; + implVersion = "1.0"; +} + +DOMImplementation::~DOMImplementation() +{ +} + +// +//Perform a case insensitive comparison between "feature" and the +//functionality of this DOM implementation/version. +// +MBool DOMImplementation::hasFeature(DOMString feature, + const DOMString& version) const +{ + feature.toUpperCase(); + + if (feature.isEqual(implFeature) && version.isEqual(implVersion)) + return MB_TRUE; + else + return MB_FALSE; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/Document.cpp b/mozilla/extensions/transformiix/source/xml/dom/Document.cpp index be9b55500de..76e77ecbbe3 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Document.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/Document.cpp @@ -1,258 +1,258 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the Document class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// LF 08/06/1999 Removed Default argument initializer from -// Document() constructor -// LF 08/06/1999 fixed typo: defalut to default -// - -#include "dom.h" - -// -//Construct a Document. Currently no parameters are required, but the the -//node constructor is called to identify the node type. -// -Document::Document(DocumentType* theDoctype) : - NodeDefinition(Node::DOCUMENT_NODE, "#document", NULL_STRING, NULL) -{ - documentElement = NULL; - doctype = theDoctype; -} - -// -//Return the one and only element for this document -// -Element* Document::getDocumentElement() -{ - return documentElement; -} - -// -//Return the document type of this document object -// -DocumentType* Document::getDoctype() -{ - return doctype; -} - -// -//Return a constant reference to the DOM's Implementation -// -const DOMImplementation& Document::getImplementation() -{ - return implementation; -} - -// -//Ensure that no Element node is inserted if the document already has an -//associated Element child. -// -Node* Document::insertBefore(Node* newChild, Node* refChild) -{ - Node* returnVal = NULL; - - NodeDefinition* pCurrentNode = NULL; - NodeDefinition* pNextNode = NULL; - - //Convert to a NodeDefinition Pointer - NodeDefinition* pNewChild = (NodeDefinition*)newChild; - NodeDefinition* pRefChild = (NodeDefinition*)refChild; - - //Check to see if the reference node is a child of this node - if ((refChild != NULL) && (pRefChild->getParentNode() != this)) - return NULL; - - switch (pNewChild->getNodeType()) - { - case Node::DOCUMENT_FRAGMENT_NODE : - pCurrentNode = (NodeDefinition*)pNewChild->getFirstChild(); - while (pCurrentNode) - { - pNextNode = (NodeDefinition*)pCurrentNode->getNextSibling(); - - //Make sure that if the current node is an Element, the document - //doesn't already have one. - if ((pCurrentNode->getNodeType() != Node::ELEMENT_NODE) || - ((pCurrentNode->getNodeType() == Node::ELEMENT_NODE) && - (documentElement == NULL))) - { - pCurrentNode = (NodeDefinition*)pNewChild->removeChild(pCurrentNode); - implInsertBefore(pCurrentNode, pRefChild); - - if (pCurrentNode->getNodeType() == Node::ELEMENT_NODE) - documentElement = (Element*)pCurrentNode; - } - pCurrentNode = pNextNode; - } - returnVal = newChild; - break; - - case Node::PROCESSING_INSTRUCTION_NODE : - case Node::COMMENT_NODE : - case Node::DOCUMENT_TYPE_NODE : - returnVal = implInsertBefore(pNewChild, pRefChild); - break; - - case Node::ELEMENT_NODE : - if (!documentElement) - { - documentElement = (Element*)pNewChild; - returnVal = implInsertBefore(pNewChild, pRefChild); - } - else - returnVal = NULL; - break; - default: - returnVal = NULL; - } - - return returnVal; -} - -// -//Ensure that if the newChild is an Element and the Document already has an -//element, then oldChild should be specifying the existing element. If not -//then the replacement can not take place. -// -Node* Document::replaceChild(Node* newChild, Node* oldChild) -{ - Node* replacedChild = NULL; - - if (newChild->getNodeType() != Node::ELEMENT_NODE) - { - //The new child is not an Element, so perform replacement - replacedChild = NodeDefinition::replaceChild(newChild, oldChild); - - //If old node was an Element, then the document's element has been - //replaced with a non-element node. Therefore clear the documentElement - //pointer - if (replacedChild && (oldChild->getNodeType() == Node::ELEMENT_NODE)) - documentElement = NULL; - - return replacedChild; - } - else - { - //A node is being replaced with an Element. If the document does not - //have an elemet yet, then just allow the replacemetn to take place. - if (!documentElement) - replacedChild = NodeDefinition::replaceChild(newChild, oldChild); - else if (oldChild->getNodeType() == Node::ELEMENT_NODE) - replacedChild = NodeDefinition::replaceChild(newChild, oldChild); - - if (replacedChild) - documentElement = (Element*)newChild; - - return replacedChild; - } -} - -// -//Update the documentElement pointer if the associated Element node is being -//removed. -// -Node* Document::removeChild(Node* oldChild) -{ - Node* removedChild = NULL; - - removedChild = NodeDefinition::removeChild(oldChild); - - if (removedChild && (removedChild->getNodeType() == Node::ELEMENT_NODE)) - documentElement = NULL; - - return removedChild; -} - -// -//Construct an empty document fragment. -// NOTE: The caller is responsible for cleaning up this fragment's memory -// when it is no longer needed. -// -DocumentFragment* Document::createDocumentFragment() -{ - return new DocumentFragment("#document-fragment", NULL_STRING, this); -} - -// -//Construct an element with the specified tag name. -// NOTE: The caller is responsible for cleaning up the element's menory -// -Element* Document::createElement(const DOMString& tagName) -{ - return new Element(tagName, this); -} - -// -//Construct an attribute with the specified name -// -Attr* Document::createAttribute(const DOMString& name) -{ - return new Attr(name, this); -} - -// -//Construct a text node with the given data -// -Text* Document::createTextNode(const DOMString& theData) -{ - return new Text(theData, this); -} - -// -//Construct a comment node with the given data -// -Comment* Document::createComment(const DOMString& theData) -{ - return new Comment(theData, this); -} - -// -//Construct a CDATASection node with the given data -// -CDATASection* Document::createCDATASection(const DOMString& theData) -{ - return new CDATASection(theData, this); -} - -// -//Construct a ProcessingInstruction node with the given targe and data. -// -ProcessingInstruction* - Document::createProcessingInstruction(const DOMString& target, - const DOMString& data) -{ - return new ProcessingInstruction(target, data, this); -} - -// -//Construct an EntityReference with the given name -// -EntityReference* Document::createEntityReference(const DOMString& name) -{ - return new EntityReference(name, this); -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the Document class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// LF 08/06/1999 Removed Default argument initializer from +// Document() constructor +// LF 08/06/1999 fixed typo: defalut to default +// + +#include "dom.h" + +// +//Construct a Document. Currently no parameters are required, but the the +//node constructor is called to identify the node type. +// +Document::Document(DocumentType* theDoctype) : + NodeDefinition(Node::DOCUMENT_NODE, "#document", NULL_STRING, NULL) +{ + documentElement = NULL; + doctype = theDoctype; +} + +// +//Return the one and only element for this document +// +Element* Document::getDocumentElement() +{ + return documentElement; +} + +// +//Return the document type of this document object +// +DocumentType* Document::getDoctype() +{ + return doctype; +} + +// +//Return a constant reference to the DOM's Implementation +// +const DOMImplementation& Document::getImplementation() +{ + return implementation; +} + +// +//Ensure that no Element node is inserted if the document already has an +//associated Element child. +// +Node* Document::insertBefore(Node* newChild, Node* refChild) +{ + Node* returnVal = NULL; + + NodeDefinition* pCurrentNode = NULL; + NodeDefinition* pNextNode = NULL; + + //Convert to a NodeDefinition Pointer + NodeDefinition* pNewChild = (NodeDefinition*)newChild; + NodeDefinition* pRefChild = (NodeDefinition*)refChild; + + //Check to see if the reference node is a child of this node + if ((refChild != NULL) && (pRefChild->getParentNode() != this)) + return NULL; + + switch (pNewChild->getNodeType()) + { + case Node::DOCUMENT_FRAGMENT_NODE : + pCurrentNode = (NodeDefinition*)pNewChild->getFirstChild(); + while (pCurrentNode) + { + pNextNode = (NodeDefinition*)pCurrentNode->getNextSibling(); + + //Make sure that if the current node is an Element, the document + //doesn't already have one. + if ((pCurrentNode->getNodeType() != Node::ELEMENT_NODE) || + ((pCurrentNode->getNodeType() == Node::ELEMENT_NODE) && + (documentElement == NULL))) + { + pCurrentNode = (NodeDefinition*)pNewChild->removeChild(pCurrentNode); + implInsertBefore(pCurrentNode, pRefChild); + + if (pCurrentNode->getNodeType() == Node::ELEMENT_NODE) + documentElement = (Element*)pCurrentNode; + } + pCurrentNode = pNextNode; + } + returnVal = newChild; + break; + + case Node::PROCESSING_INSTRUCTION_NODE : + case Node::COMMENT_NODE : + case Node::DOCUMENT_TYPE_NODE : + returnVal = implInsertBefore(pNewChild, pRefChild); + break; + + case Node::ELEMENT_NODE : + if (!documentElement) + { + documentElement = (Element*)pNewChild; + returnVal = implInsertBefore(pNewChild, pRefChild); + } + else + returnVal = NULL; + break; + default: + returnVal = NULL; + } + + return returnVal; +} + +// +//Ensure that if the newChild is an Element and the Document already has an +//element, then oldChild should be specifying the existing element. If not +//then the replacement can not take place. +// +Node* Document::replaceChild(Node* newChild, Node* oldChild) +{ + Node* replacedChild = NULL; + + if (newChild->getNodeType() != Node::ELEMENT_NODE) + { + //The new child is not an Element, so perform replacement + replacedChild = NodeDefinition::replaceChild(newChild, oldChild); + + //If old node was an Element, then the document's element has been + //replaced with a non-element node. Therefore clear the documentElement + //pointer + if (replacedChild && (oldChild->getNodeType() == Node::ELEMENT_NODE)) + documentElement = NULL; + + return replacedChild; + } + else + { + //A node is being replaced with an Element. If the document does not + //have an elemet yet, then just allow the replacemetn to take place. + if (!documentElement) + replacedChild = NodeDefinition::replaceChild(newChild, oldChild); + else if (oldChild->getNodeType() == Node::ELEMENT_NODE) + replacedChild = NodeDefinition::replaceChild(newChild, oldChild); + + if (replacedChild) + documentElement = (Element*)newChild; + + return replacedChild; + } +} + +// +//Update the documentElement pointer if the associated Element node is being +//removed. +// +Node* Document::removeChild(Node* oldChild) +{ + Node* removedChild = NULL; + + removedChild = NodeDefinition::removeChild(oldChild); + + if (removedChild && (removedChild->getNodeType() == Node::ELEMENT_NODE)) + documentElement = NULL; + + return removedChild; +} + +// +//Construct an empty document fragment. +// NOTE: The caller is responsible for cleaning up this fragment's memory +// when it is no longer needed. +// +DocumentFragment* Document::createDocumentFragment() +{ + return new DocumentFragment("#document-fragment", NULL_STRING, this); +} + +// +//Construct an element with the specified tag name. +// NOTE: The caller is responsible for cleaning up the element's menory +// +Element* Document::createElement(const DOMString& tagName) +{ + return new Element(tagName, this); +} + +// +//Construct an attribute with the specified name +// +Attr* Document::createAttribute(const DOMString& name) +{ + return new Attr(name, this); +} + +// +//Construct a text node with the given data +// +Text* Document::createTextNode(const DOMString& theData) +{ + return new Text(theData, this); +} + +// +//Construct a comment node with the given data +// +Comment* Document::createComment(const DOMString& theData) +{ + return new Comment(theData, this); +} + +// +//Construct a CDATASection node with the given data +// +CDATASection* Document::createCDATASection(const DOMString& theData) +{ + return new CDATASection(theData, this); +} + +// +//Construct a ProcessingInstruction node with the given targe and data. +// +ProcessingInstruction* + Document::createProcessingInstruction(const DOMString& target, + const DOMString& data) +{ + return new ProcessingInstruction(target, data, this); +} + +// +//Construct an EntityReference with the given name +// +EntityReference* Document::createEntityReference(const DOMString& name) +{ + return new EntityReference(name, this); +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/DocumentFragment.cpp b/mozilla/extensions/transformiix/source/xml/dom/DocumentFragment.cpp index 084fe26b543..912d6e5993c 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/DocumentFragment.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/DocumentFragment.cpp @@ -1,68 +1,68 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the DocumentFragment class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// LF 08/06/1999 fixed typo: defalut to default -// - -#include "dom.h" - -// -//Construct a DocumentFragment with the specified name and value. Call the -//constructor for NodeDefinition and specify the DocumentFragment Type. -// -DocumentFragment::DocumentFragment(const DOMString& name, - const DOMString& value, Document* owner) : - NodeDefinition(Node::DOCUMENT_FRAGMENT_NODE, name, value, owner) -{ -} - -// -//First check to see if the new node is an allowable child for a -//DocumentFragment. If it is, call NodeDefinition's implementation of Insert -//Before. If not, return null as an error. -// -Node* DocumentFragment::insertBefore(Node* newChild, Node* refChild) -{ - Node* returnVal = NULL; - - switch (newChild->getNodeType()) - { - case Node::ELEMENT_NODE : - case Node::PROCESSING_INSTRUCTION_NODE : - case Node::COMMENT_NODE : - case Node::TEXT_NODE : - case Node::CDATA_SECTION_NODE : - case Node::ENTITY_REFERENCE_NODE: - returnVal = NodeDefinition::insertBefore(newChild, refChild); - break; - default: - returnVal = NULL; - } - - return returnVal; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the DocumentFragment class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// LF 08/06/1999 fixed typo: defalut to default +// + +#include "dom.h" + +// +//Construct a DocumentFragment with the specified name and value. Call the +//constructor for NodeDefinition and specify the DocumentFragment Type. +// +DocumentFragment::DocumentFragment(const DOMString& name, + const DOMString& value, Document* owner) : + NodeDefinition(Node::DOCUMENT_FRAGMENT_NODE, name, value, owner) +{ +} + +// +//First check to see if the new node is an allowable child for a +//DocumentFragment. If it is, call NodeDefinition's implementation of Insert +//Before. If not, return null as an error. +// +Node* DocumentFragment::insertBefore(Node* newChild, Node* refChild) +{ + Node* returnVal = NULL; + + switch (newChild->getNodeType()) + { + case Node::ELEMENT_NODE : + case Node::PROCESSING_INSTRUCTION_NODE : + case Node::COMMENT_NODE : + case Node::TEXT_NODE : + case Node::CDATA_SECTION_NODE : + case Node::ENTITY_REFERENCE_NODE: + returnVal = NodeDefinition::insertBefore(newChild, refChild); + break; + default: + returnVal = NULL; + } + + return returnVal; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/DocumentType.cpp b/mozilla/extensions/transformiix/source/xml/dom/DocumentType.cpp index 3c86aa204c2..69809ef2536 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/DocumentType.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/DocumentType.cpp @@ -1,96 +1,96 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the DocumentType class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -DocumentType::DocumentType(const DOMString& name, NamedNodeMap* theEntities, - NamedNodeMap* theNotations) : - NodeDefinition(Node::DOCUMENT_TYPE_NODE, name, NULL_STRING, NULL) -{ - entities = theEntities; - notations = theNotations; -} - -// -//When destroying the DocumentType, the entities and notations must be -//destroyed too. -// -DocumentType::~DocumentType() -{ - if (entities) - delete entities; - - if (notations) - delete notations; -} - -// -//Return a pointer to the entities contained in this Document Type -// -NamedNodeMap* DocumentType::getEntities() -{ - return entities; -} - -// -//Return a pointer to the notations contained in this Document Type -// -NamedNodeMap* DocumentType::getNotations() -{ - return notations; -} - -// -//Comment nodes can not have any children, so just return null from all child -//manipulation functions. -// - -Node* DocumentType::insertBefore(Node* newChild, Node* refChild) -{ - return NULL; -} - -Node* DocumentType::replaceChild(Node* newChild, Node* oldChild) -{ - return NULL; -} - -Node* DocumentType::removeChild(Node* oldChild) -{ - return NULL; -} - -Node* DocumentType::appendChild(Node* newChild) -{ - return NULL; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the DocumentType class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +DocumentType::DocumentType(const DOMString& name, NamedNodeMap* theEntities, + NamedNodeMap* theNotations) : + NodeDefinition(Node::DOCUMENT_TYPE_NODE, name, NULL_STRING, NULL) +{ + entities = theEntities; + notations = theNotations; +} + +// +//When destroying the DocumentType, the entities and notations must be +//destroyed too. +// +DocumentType::~DocumentType() +{ + if (entities) + delete entities; + + if (notations) + delete notations; +} + +// +//Return a pointer to the entities contained in this Document Type +// +NamedNodeMap* DocumentType::getEntities() +{ + return entities; +} + +// +//Return a pointer to the notations contained in this Document Type +// +NamedNodeMap* DocumentType::getNotations() +{ + return notations; +} + +// +//Comment nodes can not have any children, so just return null from all child +//manipulation functions. +// + +Node* DocumentType::insertBefore(Node* newChild, Node* refChild) +{ + return NULL; +} + +Node* DocumentType::replaceChild(Node* newChild, Node* oldChild) +{ + return NULL; +} + +Node* DocumentType::removeChild(Node* oldChild) +{ + return NULL; +} + +Node* DocumentType::appendChild(Node* newChild) +{ + return NULL; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/Element.cpp b/mozilla/extensions/transformiix/source/xml/dom/Element.cpp index 29f0da2c4af..f0402fdf710 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Element.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/Element.cpp @@ -1,161 +1,162 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the Element class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// LF 08/06/1999 fixed typo: defalut to default -// - -#include "dom.h" - -// -//Construct a new element with the specified tagName and Document owner. -//Simply call the constructor for NodeDefinition, and specify the proper node -//type. -// -Element::Element(const DOMString& tagName, Document* owner) : - NodeDefinition(Node::ELEMENT_NODE, tagName, NULL_STRING, owner) -{ -} - -// -//First check to see if the new node is an allowable child for an Element. If -//it is, call NodeDefinition's implementation of Insert Before. If not, return -//null as an error -// -Node* Element::insertBefore(Node* newChild, Node* refChild) -{ - Node* returnVal = NULL; - - switch (newChild->getNodeType()) - { - case Node::ELEMENT_NODE : - case Node::TEXT_NODE : - case Node::COMMENT_NODE : - case Node::PROCESSING_INSTRUCTION_NODE : - case Node::CDATA_SECTION_NODE : - case Node::ENTITY_REFERENCE_NODE: - returnVal = NodeDefinition::insertBefore(newChild, refChild); - break; - default: - returnVal = NULL; - } - - return returnVal; -} - -// -//Return the tagName for this element. This is simply the nodeName. -// -const DOMString& Element::getTagName() -{ - return nodeName; -} - -// -//Retreive an attribute's value by name. If the attribute does not exist, -//return a reference to the pre-created, constatnt "NULL STRING". -// -const DOMString& Element::getAttribute(const DOMString& name) -{ - Node* tempNode = attributes.getNamedItem(name); - - if (tempNode) - return attributes.getNamedItem(name)->getNodeValue(); - else - return NULL_STRING; -} - - -// -//Add an attribute to this Element. Create a new Attr object using the -//name and value specified. Then add the Attr to the the Element's -//attributes NamedNodeMap. -// -void Element::setAttribute(const DOMString& name, const DOMString& value) -{ - Attr* tempAttribute; - - //Check to see if an attribute with this name already exists. If it does - //over write its value, if not, add it. - tempAttribute = getAttributeNode(name); - if (tempAttribute) - tempAttribute->setNodeValue(value); - else - { - tempAttribute = getOwnerDocument()->createAttribute(name); - tempAttribute->setNodeValue(value); - attributes.setNamedItem(tempAttribute); - } -} - -// -//Remove an attribute from the attributes NamedNodeMap, and free its memory. -// NOTE: How do default values enter into this picture -// -void Element::removeAttribute(const DOMString& name) -{ - delete attributes.removeNamedItem(name); -} - -// -//Return the attribute specified by name -// -Attr* Element::getAttributeNode(const DOMString& name) -{ - return (Attr*)attributes.getNamedItem(name); -} - -// -//Set a new attribute specifed by the newAttr node. If an attribute with that -//name already exists, the existing Attr is removed from the list and return to -//the caller, else NULL is returned. -// -Attr* Element::setAttributeNode(Attr* newAttr) -{ - Attr* pOldAttr = (Attr*)attributes.removeNamedItem(newAttr->getNodeName()); - - attributes.setNamedItem(newAttr); - return pOldAttr; -} - -// -//Remove the Attribute from the attributes list and return to the caller. If -//the node is not found, return NULL. -// -Attr* Element::removeAttributeNode(Attr* oldAttr) -{ - return (Attr*)attributes.removeNamedItem(oldAttr->getNodeName()); -} - -NodeList* Element::getElementsByTagName(const DOMString& name) -{ - return 0; -} - -void Element::normalize() -{ -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the Element class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// LF 08/06/1999 fixed typo: defalut to default +// + +#include "dom.h" + +// +//Construct a new element with the specified tagName and Document owner. +//Simply call the constructor for NodeDefinition, and specify the proper node +//type. +// +Element::Element(const DOMString& tagName, Document* owner) : + NodeDefinition(Node::ELEMENT_NODE, tagName, NULL_STRING, owner) +{ +} + +// +//First check to see if the new node is an allowable child for an Element. If +//it is, call NodeDefinition's implementation of Insert Before. If not, return +//null as an error +// +Node* Element::insertBefore(Node* newChild, Node* refChild) +{ + Node* returnVal = NULL; + + switch (newChild->getNodeType()) + { + case Node::ELEMENT_NODE : + case Node::TEXT_NODE : + case Node::COMMENT_NODE : + case Node::PROCESSING_INSTRUCTION_NODE : + case Node::CDATA_SECTION_NODE : + case Node::DOCUMENT_FRAGMENT_NODE : //-- added 19990813 (kvisco) + case Node::ENTITY_REFERENCE_NODE: + returnVal = NodeDefinition::insertBefore(newChild, refChild); + break; + default: + returnVal = NULL; + } + + return returnVal; +} + +// +//Return the tagName for this element. This is simply the nodeName. +// +const DOMString& Element::getTagName() +{ + return nodeName; +} + +// +//Retreive an attribute's value by name. If the attribute does not exist, +//return a reference to the pre-created, constatnt "NULL STRING". +// +const DOMString& Element::getAttribute(const DOMString& name) +{ + Node* tempNode = attributes.getNamedItem(name); + + if (tempNode) + return attributes.getNamedItem(name)->getNodeValue(); + else + return NULL_STRING; +} + + +// +//Add an attribute to this Element. Create a new Attr object using the +//name and value specified. Then add the Attr to the the Element's +//attributes NamedNodeMap. +// +void Element::setAttribute(const DOMString& name, const DOMString& value) +{ + Attr* tempAttribute; + + //Check to see if an attribute with this name already exists. If it does + //over write its value, if not, add it. + tempAttribute = getAttributeNode(name); + if (tempAttribute) + tempAttribute->setNodeValue(value); + else + { + tempAttribute = getOwnerDocument()->createAttribute(name); + tempAttribute->setNodeValue(value); + attributes.setNamedItem(tempAttribute); + } +} + +// +//Remove an attribute from the attributes NamedNodeMap, and free its memory. +// NOTE: How do default values enter into this picture +// +void Element::removeAttribute(const DOMString& name) +{ + delete attributes.removeNamedItem(name); +} + +// +//Return the attribute specified by name +// +Attr* Element::getAttributeNode(const DOMString& name) +{ + return (Attr*)attributes.getNamedItem(name); +} + +// +//Set a new attribute specifed by the newAttr node. If an attribute with that +//name already exists, the existing Attr is removed from the list and return to +//the caller, else NULL is returned. +// +Attr* Element::setAttributeNode(Attr* newAttr) +{ + Attr* pOldAttr = (Attr*)attributes.removeNamedItem(newAttr->getNodeName()); + + attributes.setNamedItem(newAttr); + return pOldAttr; +} + +// +//Remove the Attribute from the attributes list and return to the caller. If +//the node is not found, return NULL. +// +Attr* Element::removeAttributeNode(Attr* oldAttr) +{ + return (Attr*)attributes.removeNamedItem(oldAttr->getNodeName()); +} + +NodeList* Element::getElementsByTagName(const DOMString& name) +{ + return 0; +} + +void Element::normalize() +{ +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/Entity.cpp b/mozilla/extensions/transformiix/source/xml/dom/Entity.cpp index 5f690d71e8c..33f17f806b9 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Entity.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/Entity.cpp @@ -1,95 +1,95 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the Entity class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// LF 08/06/1999 fixed typo: defalut to default - -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -Entity::Entity(const DOMString& name, const DOMString& pubID, - const DOMString& sysID, const DOMString& notName) : - NodeDefinition(Node::ENTITY_NODE, name, NULL_STRING, NULL) -{ - publicId = pubID; - systemId = sysID; - notationName = notName; -} - -// -//Return the Public ID of the Entity -// -const DOMString& Entity::getPublicId() const -{ - return publicId; -} - -// -//Return the System ID of the Entity -// -const DOMString& Entity::getSystemId() const -{ - return systemId; -} - -// -//Return the Notation Name of the Entity -// -const DOMString& Entity::getNotationName() const -{ - return notationName; -} - -// -//First check to see if the new node is an allowable child for an Entity. If -//it is, call NodeDefinition's implementation of Insert Before. If not, return -//null as an error. -// -Node* Entity::insertBefore(Node* newChild, Node* refChild) -{ - Node* returnVal = NULL; - - switch (newChild->getNodeType()) - { - case Node::ELEMENT_NODE: - case Node::PROCESSING_INSTRUCTION_NODE: - case Node::COMMENT_NODE: - case Node::TEXT_NODE : - case Node::CDATA_SECTION_NODE: - case Node::ENTITY_REFERENCE_NODE: - returnVal = NodeDefinition::insertBefore(newChild, refChild); - break; - default: - returnVal = NULL; - } - - return returnVal; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the Entity class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// LF 08/06/1999 fixed typo: defalut to default + +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +Entity::Entity(const DOMString& name, const DOMString& pubID, + const DOMString& sysID, const DOMString& notName) : + NodeDefinition(Node::ENTITY_NODE, name, NULL_STRING, NULL) +{ + publicId = pubID; + systemId = sysID; + notationName = notName; +} + +// +//Return the Public ID of the Entity +// +const DOMString& Entity::getPublicId() const +{ + return publicId; +} + +// +//Return the System ID of the Entity +// +const DOMString& Entity::getSystemId() const +{ + return systemId; +} + +// +//Return the Notation Name of the Entity +// +const DOMString& Entity::getNotationName() const +{ + return notationName; +} + +// +//First check to see if the new node is an allowable child for an Entity. If +//it is, call NodeDefinition's implementation of Insert Before. If not, return +//null as an error. +// +Node* Entity::insertBefore(Node* newChild, Node* refChild) +{ + Node* returnVal = NULL; + + switch (newChild->getNodeType()) + { + case Node::ELEMENT_NODE: + case Node::PROCESSING_INSTRUCTION_NODE: + case Node::COMMENT_NODE: + case Node::TEXT_NODE : + case Node::CDATA_SECTION_NODE: + case Node::ENTITY_REFERENCE_NODE: + returnVal = NodeDefinition::insertBefore(newChild, refChild); + break; + default: + returnVal = NULL; + } + + return returnVal; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/EntityReference.cpp b/mozilla/extensions/transformiix/source/xml/dom/EntityReference.cpp index 2fbe9ee86b1..e70112d4ab6 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/EntityReference.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/EntityReference.cpp @@ -1,66 +1,66 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the EntityReference class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// LF 08/06/1999 fixed typo: defalut to default -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -EntityReference::EntityReference(const DOMString& name, Document* owner) : - NodeDefinition(Node::ENTITY_REFERENCE_NODE, name, NULL_STRING, owner) -{ -} - -// -//First check to see if the new node is an allowable child for an -//EntityReference. If it is, call NodeDefinition's implementation of Insert -//Before. If not, return null as an error. -// -Node* EntityReference::insertBefore(Node* newChild, Node* refChild) -{ - Node* returnVal = NULL; - - switch (newChild->getNodeType()) - { - case Node::ELEMENT_NODE: - case Node::PROCESSING_INSTRUCTION_NODE: - case Node::COMMENT_NODE: - case Node::TEXT_NODE : - case Node::CDATA_SECTION_NODE: - case Node::ENTITY_REFERENCE_NODE: - returnVal = NodeDefinition::insertBefore(newChild, refChild); - break; - default: - returnVal = NULL; - } - - return returnVal; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the EntityReference class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// LF 08/06/1999 fixed typo: defalut to default +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +EntityReference::EntityReference(const DOMString& name, Document* owner) : + NodeDefinition(Node::ENTITY_REFERENCE_NODE, name, NULL_STRING, owner) +{ +} + +// +//First check to see if the new node is an allowable child for an +//EntityReference. If it is, call NodeDefinition's implementation of Insert +//Before. If not, return null as an error. +// +Node* EntityReference::insertBefore(Node* newChild, Node* refChild) +{ + Node* returnVal = NULL; + + switch (newChild->getNodeType()) + { + case Node::ELEMENT_NODE: + case Node::PROCESSING_INSTRUCTION_NODE: + case Node::COMMENT_NODE: + case Node::TEXT_NODE : + case Node::CDATA_SECTION_NODE: + case Node::ENTITY_REFERENCE_NODE: + returnVal = NodeDefinition::insertBefore(newChild, refChild); + break; + default: + returnVal = NULL; + } + + return returnVal; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/Makefile b/mozilla/extensions/transformiix/source/xml/dom/Makefile index 58293717c99..2ab496a5b9d 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Makefile +++ b/mozilla/extensions/transformiix/source/xml/dom/Makefile @@ -4,10 +4,10 @@ BASE_PATH = ../../base DOM_PATH = . #endif -INCLUDE_PATHS = -I$(BASE_PATH) -I . -I- +INCLUDE_PATHS = -I$(BASE_PATH) -I. -I- -CC = g++ $(INCLUDE_PATHS) +CC := $(CC) -g $(INCLUDE_PATHS) DOM_OBJS = NodeDefinition.o \ Document.o \ diff --git a/mozilla/extensions/transformiix/source/xml/dom/NamedNodeMap.cpp b/mozilla/extensions/transformiix/source/xml/dom/NamedNodeMap.cpp index 414c05a1e47..0f3d6cb5983 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/NamedNodeMap.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/NamedNodeMap.cpp @@ -1,111 +1,111 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the NamedNodeMap class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -NamedNodeMap::NamedNodeMap() -{ -} - -NamedNodeMap::~NamedNodeMap() -{ -} - -Node* NamedNodeMap::getNamedItem(const DOMString& name) -{ - ListItem* pSearchItem = findListItemByName(name); - - if (pSearchItem) - return pSearchItem->node; - else - return NULL; -} - -Node* NamedNodeMap::setNamedItem(Node* arg) -{ - //Since the DOM does not specify any ording for the NamedNodeMap, just - //try and remove the new node (arg). If successful, return a pointer to - //the removed item. Reguardless of wheter the node already existed or not, - //insert the new node at the end of the list. - Node* pReplacedNode = removeNamedItem(arg->getNodeName()); - - NodeListDefinition::append(arg); - - return pReplacedNode; -} - -Node* NamedNodeMap::removeNamedItem(const DOMString& name) -{ - NodeListDefinition::ListItem* pSearchItem; - Node* returnNode; - - pSearchItem = findListItemByName(name); - - if (pSearchItem) - { - if (pSearchItem != firstItem) - pSearchItem->prev->next = pSearchItem->next; - else - firstItem = pSearchItem->next; - - if (pSearchItem != lastItem) - pSearchItem->next->prev = pSearchItem->prev; - else - lastItem = pSearchItem->prev; - - pSearchItem->next = NULL; - pSearchItem->prev = NULL; - - length--; - returnNode = pSearchItem->node; - delete pSearchItem; - - return returnNode; - } - - - return NULL; -} - -NodeListDefinition::ListItem* - NamedNodeMap::findListItemByName(const DOMString& name) -{ - NodeListDefinition::ListItem* pSearchItem = firstItem; - - while (pSearchItem) - { - if (name.isEqual(pSearchItem->node->getNodeName())) - return pSearchItem; - - pSearchItem = pSearchItem->next; - } - - return NULL; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the NamedNodeMap class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +NamedNodeMap::NamedNodeMap() +{ +} + +NamedNodeMap::~NamedNodeMap() +{ +} + +Node* NamedNodeMap::getNamedItem(const DOMString& name) +{ + ListItem* pSearchItem = findListItemByName(name); + + if (pSearchItem) + return pSearchItem->node; + else + return NULL; +} + +Node* NamedNodeMap::setNamedItem(Node* arg) +{ + //Since the DOM does not specify any ording for the NamedNodeMap, just + //try and remove the new node (arg). If successful, return a pointer to + //the removed item. Reguardless of wheter the node already existed or not, + //insert the new node at the end of the list. + Node* pReplacedNode = removeNamedItem(arg->getNodeName()); + + NodeListDefinition::append(arg); + + return pReplacedNode; +} + +Node* NamedNodeMap::removeNamedItem(const DOMString& name) +{ + NodeListDefinition::ListItem* pSearchItem; + Node* returnNode; + + pSearchItem = findListItemByName(name); + + if (pSearchItem) + { + if (pSearchItem != firstItem) + pSearchItem->prev->next = pSearchItem->next; + else + firstItem = pSearchItem->next; + + if (pSearchItem != lastItem) + pSearchItem->next->prev = pSearchItem->prev; + else + lastItem = pSearchItem->prev; + + pSearchItem->next = NULL; + pSearchItem->prev = NULL; + + length--; + returnNode = pSearchItem->node; + delete pSearchItem; + + return returnNode; + } + + + return NULL; +} + +NodeListDefinition::ListItem* + NamedNodeMap::findListItemByName(const DOMString& name) +{ + NodeListDefinition::ListItem* pSearchItem = firstItem; + + while (pSearchItem) + { + if (name.isEqual(pSearchItem->node->getNodeName())) + return pSearchItem; + + pSearchItem = pSearchItem->next; + } + + return NULL; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/NodeDefinition.cpp b/mozilla/extensions/transformiix/source/xml/dom/NodeDefinition.cpp index ab5ea836256..6b52826d95b 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/NodeDefinition.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/NodeDefinition.cpp @@ -1,356 +1,356 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the NodeDefinition Class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -NodeDefinition::NodeDefinition(NodeType type, const DOMString& name, - const DOMString& value, Document* owner) -{ - - nodeName = name; - nodeValue = value; - nodeType = type; - - parentNode = NULL; - previousSibling = NULL; - nextSibling = NULL;; - firstChild = NULL; - lastChild = NULL; - - ownerDocument = owner; - length = 0; - -} - -// -// This node is being destroyed, so loop through and destroy all the children. -// Also, destroy all attributes stored in the attributes NamedNodeMap. -// -NodeDefinition::~NodeDefinition() -{ - Int32 numAttributes = attributes.getLength(); - Int32 killAttrLoop; - - DeleteChildren(); - - for (killAttrLoop=0;killAttrLoopgetNodeName()); -} - -// -//Remove and delete all children of this node -// -void NodeDefinition::DeleteChildren() -{ - NodeDefinition* pCurrent = firstChild; - NodeDefinition* pDestroyer; - - while (pCurrent) - { - pDestroyer = pCurrent; - pCurrent = pCurrent->nextSibling; - delete pDestroyer; - } - - length = 0; - firstChild = NULL; - lastChild = NULL; -} - -const DOMString& NodeDefinition::getNodeName() const -{ - return nodeName; -} - -const DOMString& NodeDefinition::getNodeValue() const -{ - return nodeValue; -} - -const DOMString& NodeDefinition::getNodeValue() -{ - return nodeValue; -} - -unsigned short NodeDefinition::getNodeType() const -{ - return nodeType; -} - -Node* NodeDefinition::getParentNode() const -{ - return parentNode; -} - -NodeList* NodeDefinition::getChildNodes() -{ - return this; -} - -Node* NodeDefinition::getFirstChild() const -{ - return firstChild; -} - -Node* NodeDefinition::getLastChild() const -{ - return lastChild; -} - -Node* NodeDefinition::getPreviousSibling() const -{ - return previousSibling; -} - -Node* NodeDefinition::getNextSibling() const -{ - return nextSibling; -} - -NamedNodeMap* NodeDefinition::getAttributes() -{ - return &attributes; -} - -Document* NodeDefinition::getOwnerDocument() const -{ - return ownerDocument; -} - -Node* NodeDefinition::item(Int32 index) -{ - Int32 selectLoop; - NodeDefinition* pSelectNode = firstChild; - - if (index < length) - { - for (selectLoop=0;selectLoopnextSibling; - - return pSelectNode; - } - - return NULL; -} - -Int32 NodeDefinition::getLength() -{ - return length; -} - -void NodeDefinition::setNodeValue(const DOMString& newNodeValue) -{ - nodeValue = newNodeValue; -} - -// -//Insert the "newChild" node before the "refChild" node. Return a pointer to -//the inserted child. If the node to insert is a document fragment, then -//insert each child of the document fragment, and return the document fragment -//which should be empty if all the inserts suceeded. -//This function's responsibility is to check for and handle document fragments -//vs. plain nodes. -// *** NOTE: Need to check the document types before inserting. -// -// The decision to return the possibly empty document fragment -// was an implementation choice. The spec did not dictate what -// whould occur. -// -Node* NodeDefinition::insertBefore(Node* newChild, - Node* refChild) -{ - NodeDefinition* pCurrentNode = NULL; - NodeDefinition* pNextNode = NULL; - - //Convert to a NodeDefinition Pointer - NodeDefinition* pNewChild = (NodeDefinition*)newChild; - NodeDefinition* pRefChild = (NodeDefinition*)refChild; - - //Check to see if the reference node is a child of this node - if ((refChild != NULL) && (pRefChild->parentNode != this)) - return NULL; - - if (pNewChild->getNodeType() == Node::DOCUMENT_FRAGMENT_NODE) - { - pCurrentNode = pNewChild->firstChild; - while (pCurrentNode) - { - pNextNode = pCurrentNode->nextSibling; - pCurrentNode = (NodeDefinition*)pNewChild->removeChild(pCurrentNode); - implInsertBefore(pCurrentNode, pRefChild); - pCurrentNode = pNextNode; - } - return newChild; - } - else - return implInsertBefore(pNewChild, pRefChild); -} - -// -//The code that actually insert one node before another. -// -Node* NodeDefinition::implInsertBefore(NodeDefinition* pNewChild, - NodeDefinition* pRefChild) -{ - //Remove the "newChild" if it is already a child of this node - if (pNewChild->parentNode == this) - pNewChild = (NodeDefinition*)removeChild(pNewChild); - - //The new child should not be a child of any other node - if ((pNewChild->previousSibling == NULL) && - (pNewChild->nextSibling == NULL) && - (pNewChild->parentNode == NULL)) - { - if (pRefChild == NULL) - { - //Append - pNewChild->previousSibling = lastChild; - - if (lastChild) - lastChild->nextSibling = pNewChild; - - lastChild = pNewChild; - } - else - { - //Insert before the reference node - if (pRefChild->previousSibling) - pRefChild->previousSibling->nextSibling = pNewChild; - pNewChild->nextSibling = pRefChild; - pNewChild->previousSibling = pRefChild->previousSibling; - pRefChild->previousSibling = pNewChild; - } - - pNewChild->parentNode = this; - - if (pNewChild->previousSibling == NULL) - firstChild = pNewChild; - - length++; - - return pNewChild; - } - - return NULL; -} - - -// -//Replace "oldChild" with "newChild". Return the replaced node, or NULL -//otherwise. -// *** NOTE: Need to check that the documents match *** -// -Node* NodeDefinition::replaceChild(Node* newChild, - Node* oldChild) -{ - NodeDefinition* pOldChild = (NodeDefinition*)oldChild; - NodeDefinition* pNextSibling = NULL; - - //If the newChild is replacing itself then we don't need to do anything - if (pOldChild == newChild) - return pOldChild; - - //If "oldChild" is a child of this node, remove it from the list. - pOldChild = (NodeDefinition*)removeChild(oldChild); - - //If the removal was successful... Else, return null - if (pOldChild) - { - //Try to insert the new node before the old node's next sibling. If - //successful, just returned the replaced child. If not succesful, - //reinsert the old node, and return NULL. - pNextSibling = pOldChild->nextSibling; - if (!insertBefore(newChild, pNextSibling)) - { - insertBefore(pOldChild, pNextSibling); - pOldChild = NULL; - } - } - - return pOldChild; -} - -// -//Remove the specified "oldChild" from this node's children. First make sure -//the specified node is a child of this node. Return the removed node, NULL -//otherwise. -// -Node* NodeDefinition::removeChild(Node* oldChild) -{ - NodeDefinition* pOldChild = (NodeDefinition*)oldChild; - - //If "oldChild" is a child of this node, adjust pointers to remove it, and - //clear "oldChild"'s sibling and parent pointers. - if (pOldChild->parentNode == this) - { - if (pOldChild != firstChild) - pOldChild->previousSibling->nextSibling = pOldChild->nextSibling; - else - firstChild = pOldChild->nextSibling; - - if (pOldChild != lastChild) - pOldChild->nextSibling->previousSibling = pOldChild->previousSibling; - else - lastChild = pOldChild->previousSibling; - - pOldChild->nextSibling = NULL; - pOldChild->previousSibling = NULL; - pOldChild->parentNode = NULL; - - length--; - - return pOldChild; - } - - return NULL; -} - -// -//Append a new child node. First make sure the new child is not already a -//child of another node. Return the appended node. -// *** NOTE *** Need to eventually check to make sure the documents match *** -// -Node* NodeDefinition::appendChild(Node* newChild) -{ - return insertBefore(newChild, NULL); -} - -Node* NodeDefinition::cloneNode(MBool deep, Node* dest) -{ - return 0; -} - -MBool NodeDefinition::hasChildNodes() const -{ - if (firstChild != NULL) - return MB_TRUE; - else - return MB_FALSE; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the NodeDefinition Class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +NodeDefinition::NodeDefinition(NodeType type, const DOMString& name, + const DOMString& value, Document* owner) +{ + + nodeName = name; + nodeValue = value; + nodeType = type; + + parentNode = NULL; + previousSibling = NULL; + nextSibling = NULL;; + firstChild = NULL; + lastChild = NULL; + + ownerDocument = owner; + length = 0; + +} + +// +// This node is being destroyed, so loop through and destroy all the children. +// Also, destroy all attributes stored in the attributes NamedNodeMap. +// +NodeDefinition::~NodeDefinition() +{ + Int32 numAttributes = attributes.getLength(); + Int32 killAttrLoop; + + DeleteChildren(); + + for (killAttrLoop=0;killAttrLoopgetNodeName()); +} + +// +//Remove and delete all children of this node +// +void NodeDefinition::DeleteChildren() +{ + NodeDefinition* pCurrent = firstChild; + NodeDefinition* pDestroyer; + + while (pCurrent) + { + pDestroyer = pCurrent; + pCurrent = pCurrent->nextSibling; + delete pDestroyer; + } + + length = 0; + firstChild = NULL; + lastChild = NULL; +} + +const DOMString& NodeDefinition::getNodeName() const +{ + return nodeName; +} + +const DOMString& NodeDefinition::getNodeValue() const +{ + return nodeValue; +} + +const DOMString& NodeDefinition::getNodeValue() +{ + return nodeValue; +} + +unsigned short NodeDefinition::getNodeType() const +{ + return nodeType; +} + +Node* NodeDefinition::getParentNode() const +{ + return parentNode; +} + +NodeList* NodeDefinition::getChildNodes() +{ + return this; +} + +Node* NodeDefinition::getFirstChild() const +{ + return firstChild; +} + +Node* NodeDefinition::getLastChild() const +{ + return lastChild; +} + +Node* NodeDefinition::getPreviousSibling() const +{ + return previousSibling; +} + +Node* NodeDefinition::getNextSibling() const +{ + return nextSibling; +} + +NamedNodeMap* NodeDefinition::getAttributes() +{ + return &attributes; +} + +Document* NodeDefinition::getOwnerDocument() const +{ + return ownerDocument; +} + +Node* NodeDefinition::item(Int32 index) +{ + Int32 selectLoop; + NodeDefinition* pSelectNode = firstChild; + + if (index < length) + { + for (selectLoop=0;selectLoopnextSibling; + + return pSelectNode; + } + + return NULL; +} + +Int32 NodeDefinition::getLength() +{ + return length; +} + +void NodeDefinition::setNodeValue(const DOMString& newNodeValue) +{ + nodeValue = newNodeValue; +} + +// +//Insert the "newChild" node before the "refChild" node. Return a pointer to +//the inserted child. If the node to insert is a document fragment, then +//insert each child of the document fragment, and return the document fragment +//which should be empty if all the inserts suceeded. +//This function's responsibility is to check for and handle document fragments +//vs. plain nodes. +// *** NOTE: Need to check the document types before inserting. +// +// The decision to return the possibly empty document fragment +// was an implementation choice. The spec did not dictate what +// whould occur. +// +Node* NodeDefinition::insertBefore(Node* newChild, + Node* refChild) +{ + NodeDefinition* pCurrentNode = NULL; + NodeDefinition* pNextNode = NULL; + + //Convert to a NodeDefinition Pointer + NodeDefinition* pNewChild = (NodeDefinition*)newChild; + NodeDefinition* pRefChild = (NodeDefinition*)refChild; + + //Check to see if the reference node is a child of this node + if ((refChild != NULL) && (pRefChild->parentNode != this)) + return NULL; + + if (newChild->getNodeType() == Node::DOCUMENT_FRAGMENT_NODE) + { + pCurrentNode = pNewChild->firstChild; + while (pCurrentNode) + { + pNextNode = pCurrentNode->nextSibling; + pCurrentNode = (NodeDefinition*)pNewChild->removeChild(pCurrentNode); + implInsertBefore(pCurrentNode, pRefChild); + pCurrentNode = pNextNode; + } + return newChild; + } + else + return implInsertBefore(pNewChild, pRefChild); +} + +// +//The code that actually insert one node before another. +// +Node* NodeDefinition::implInsertBefore(NodeDefinition* pNewChild, + NodeDefinition* pRefChild) +{ + //Remove the "newChild" if it is already a child of this node + if (pNewChild->parentNode == this) + pNewChild = (NodeDefinition*)removeChild(pNewChild); + + //The new child should not be a child of any other node + if ((pNewChild->previousSibling == NULL) && + (pNewChild->nextSibling == NULL) && + (pNewChild->parentNode == NULL)) + { + if (pRefChild == NULL) + { + //Append + pNewChild->previousSibling = lastChild; + + if (lastChild) + lastChild->nextSibling = pNewChild; + + lastChild = pNewChild; + } + else + { + //Insert before the reference node + if (pRefChild->previousSibling) + pRefChild->previousSibling->nextSibling = pNewChild; + pNewChild->nextSibling = pRefChild; + pNewChild->previousSibling = pRefChild->previousSibling; + pRefChild->previousSibling = pNewChild; + } + + pNewChild->parentNode = this; + + if (pNewChild->previousSibling == NULL) + firstChild = pNewChild; + + length++; + + return pNewChild; + } + + return NULL; +} + + +// +//Replace "oldChild" with "newChild". Return the replaced node, or NULL +//otherwise. +// *** NOTE: Need to check that the documents match *** +// +Node* NodeDefinition::replaceChild(Node* newChild, + Node* oldChild) +{ + NodeDefinition* pOldChild = (NodeDefinition*)oldChild; + NodeDefinition* pNextSibling = NULL; + + //If the newChild is replacing itself then we don't need to do anything + if (pOldChild == newChild) + return pOldChild; + + //If "oldChild" is a child of this node, remove it from the list. + pOldChild = (NodeDefinition*)removeChild(oldChild); + + //If the removal was successful... Else, return null + if (pOldChild) + { + //Try to insert the new node before the old node's next sibling. If + //successful, just returned the replaced child. If not succesful, + //reinsert the old node, and return NULL. + pNextSibling = pOldChild->nextSibling; + if (!insertBefore(newChild, pNextSibling)) + { + insertBefore(pOldChild, pNextSibling); + pOldChild = NULL; + } + } + + return pOldChild; +} + +// +//Remove the specified "oldChild" from this node's children. First make sure +//the specified node is a child of this node. Return the removed node, NULL +//otherwise. +// +Node* NodeDefinition::removeChild(Node* oldChild) +{ + NodeDefinition* pOldChild = (NodeDefinition*)oldChild; + + //If "oldChild" is a child of this node, adjust pointers to remove it, and + //clear "oldChild"'s sibling and parent pointers. + if (pOldChild->parentNode == this) + { + if (pOldChild != firstChild) + pOldChild->previousSibling->nextSibling = pOldChild->nextSibling; + else + firstChild = pOldChild->nextSibling; + + if (pOldChild != lastChild) + pOldChild->nextSibling->previousSibling = pOldChild->previousSibling; + else + lastChild = pOldChild->previousSibling; + + pOldChild->nextSibling = NULL; + pOldChild->previousSibling = NULL; + pOldChild->parentNode = NULL; + + length--; + + return pOldChild; + } + + return NULL; +} + +// +//Append a new child node. First make sure the new child is not already a +//child of another node. Return the appended node. +// *** NOTE *** Need to eventually check to make sure the documents match *** +// +Node* NodeDefinition::appendChild(Node* newChild) +{ + return insertBefore(newChild, NULL); +} + +Node* NodeDefinition::cloneNode(MBool deep, Node* dest) +{ + return 0; +} + +MBool NodeDefinition::hasChildNodes() const +{ + if (firstChild != NULL) + return MB_TRUE; + else + return MB_FALSE; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/NodeListDefinition.cpp b/mozilla/extensions/transformiix/source/xml/dom/NodeListDefinition.cpp index 4bb1983ffd1..4031610884c 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/NodeListDefinition.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/NodeListDefinition.cpp @@ -1,117 +1,117 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the NodeListDefinition class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Create an empty node list. -// -NodeListDefinition::NodeListDefinition() -{ - firstItem = NULL; - lastItem = NULL; - length = 0; -} - -// -//Free up the memory used by the List of Items. Don't delete the actual nodes -//though. -// -NodeListDefinition::~NodeListDefinition() -{ - ListItem* pDeleteItem; - ListItem* pListTraversal = firstItem; - - while (pListTraversal) - { - pDeleteItem = pListTraversal; - pListTraversal = pListTraversal->next; - delete pDeleteItem; - } -} - -// -//Create a new ListItem, point it to the newNode, and append it to the current -//list of nodes. -// -void NodeListDefinition::append(Node* newNode) -{ - append(*newNode); -} - -void NodeListDefinition::append(Node& newNode) -{ - ListItem* newListItem = new ListItem; - - // Setup the new list item - newListItem->node = &newNode; - newListItem->prev = lastItem; - newListItem->next = NULL; - - //Append the list item - if (lastItem) - lastItem->next = newListItem; - - lastItem = newListItem; - - //Adjust firstItem if this new item is being added to an empty list - if (!firstItem) - firstItem = lastItem; - - //Need to increment the length of the list. Inherited from NodeList - length++; -} - -// -// Return the Node contained in the item specified -// -Node* NodeListDefinition::item(Int32 index) -{ - Int32 selectLoop; - ListItem* pListItem = firstItem; - - if (index < length) - { - for (selectLoop=0;selectLoopnext; - - return pListItem->node; - } - - return NULL; -} - -// -// Return the number of items in the list -// -Int32 NodeListDefinition::getLength() -{ - return length; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the NodeListDefinition class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Create an empty node list. +// +NodeListDefinition::NodeListDefinition() +{ + firstItem = NULL; + lastItem = NULL; + length = 0; +} + +// +//Free up the memory used by the List of Items. Don't delete the actual nodes +//though. +// +NodeListDefinition::~NodeListDefinition() +{ + ListItem* pDeleteItem; + ListItem* pListTraversal = firstItem; + + while (pListTraversal) + { + pDeleteItem = pListTraversal; + pListTraversal = pListTraversal->next; + delete pDeleteItem; + } +} + +// +//Create a new ListItem, point it to the newNode, and append it to the current +//list of nodes. +// +void NodeListDefinition::append(Node* newNode) +{ + append(*newNode); +} + +void NodeListDefinition::append(Node& newNode) +{ + ListItem* newListItem = new ListItem; + + // Setup the new list item + newListItem->node = &newNode; + newListItem->prev = lastItem; + newListItem->next = NULL; + + //Append the list item + if (lastItem) + lastItem->next = newListItem; + + lastItem = newListItem; + + //Adjust firstItem if this new item is being added to an empty list + if (!firstItem) + firstItem = lastItem; + + //Need to increment the length of the list. Inherited from NodeList + length++; +} + +// +// Return the Node contained in the item specified +// +Node* NodeListDefinition::item(Int32 index) +{ + Int32 selectLoop; + ListItem* pListItem = firstItem; + + if (index < length) + { + for (selectLoop=0;selectLoopnext; + + return pListItem->node; + } + + return NULL; +} + +// +// Return the number of items in the list +// +Int32 NodeListDefinition::getLength() +{ + return length; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/Notation.cpp b/mozilla/extensions/transformiix/source/xml/dom/Notation.cpp index 8aad385b6c5..d0d5928b796 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Notation.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/Notation.cpp @@ -1,81 +1,81 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the Notation class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -Notation::Notation(const DOMString& name, const DOMString& pubID, - const DOMString& sysID) : - NodeDefinition(Node::NOTATION_NODE, name, NULL_STRING, NULL) -{ - publicId = pubID; - systemId = sysID; -} - -// -//Return the Public ID of the Notation -// -const DOMString& Notation::getPublicId() const -{ - return publicId; -} - -//Return the System ID of the Notation -const DOMString& Notation::getSystemId() const -{ - return systemId; -} - -// -//Notation nodes can not have any children, so just return null from all child -//manipulation functions. -// - -Node* Notation::insertBefore(Node* newChild, Node* refChild) -{ - return NULL; -} - -Node* Notation::replaceChild(Node* newChild, Node* oldChild) -{ - return NULL; -} - -Node* Notation::removeChild(Node* oldChild) -{ - return NULL; -} - -Node* Notation::appendChild(Node* newChild) -{ - return NULL; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the Notation class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +Notation::Notation(const DOMString& name, const DOMString& pubID, + const DOMString& sysID) : + NodeDefinition(Node::NOTATION_NODE, name, NULL_STRING, NULL) +{ + publicId = pubID; + systemId = sysID; +} + +// +//Return the Public ID of the Notation +// +const DOMString& Notation::getPublicId() const +{ + return publicId; +} + +//Return the System ID of the Notation +const DOMString& Notation::getSystemId() const +{ + return systemId; +} + +// +//Notation nodes can not have any children, so just return null from all child +//manipulation functions. +// + +Node* Notation::insertBefore(Node* newChild, Node* refChild) +{ + return NULL; +} + +Node* Notation::replaceChild(Node* newChild, Node* oldChild) +{ + return NULL; +} + +Node* Notation::removeChild(Node* oldChild) +{ + return NULL; +} + +Node* Notation::appendChild(Node* newChild) +{ + return NULL; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/ProcessingInstruction.cpp b/mozilla/extensions/transformiix/source/xml/dom/ProcessingInstruction.cpp index ffc8e56f001..281856da9aa 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/ProcessingInstruction.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/ProcessingInstruction.cpp @@ -1,93 +1,93 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the ProcessingInstruction class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -ProcessingInstruction::ProcessingInstruction(const DOMString& theTarget, - const DOMString& theData, - Document* owner) : - NodeDefinition(Node::PROCESSING_INSTRUCTION_NODE, - theTarget, theData, owner) -{ -} - -// -//Return the Target of the processing instruction. This is simply the -//nodeName. -// -const DOMString& ProcessingInstruction::getTarget() const -{ - return nodeName; -} - -// -//Return the Data of the processing instruction. This is simply the value -//of the node, "nodeValue" -// -const DOMString& ProcessingInstruction::getData() const -{ - return nodeValue; -} - -// -//Set the Data element of the processing instruction. -void ProcessingInstruction::setData(const DOMString& theData) -{ - nodeValue = theData; -} - - -// -//ProcessingInstruction nodes can not have any children, so just return null -//from all child manipulation functions. -// - -Node* ProcessingInstruction::insertBefore(Node* newChild, Node* refChild) -{ - return NULL; -} - -Node* ProcessingInstruction::replaceChild(Node* newChild, Node* oldChild) -{ - return NULL; -} - -Node* ProcessingInstruction::removeChild(Node* oldChild) -{ - return NULL; -} - -Node* ProcessingInstruction::appendChild(Node* newChild) -{ - return NULL; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the ProcessingInstruction class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +ProcessingInstruction::ProcessingInstruction(const DOMString& theTarget, + const DOMString& theData, + Document* owner) : + NodeDefinition(Node::PROCESSING_INSTRUCTION_NODE, + theTarget, theData, owner) +{ +} + +// +//Return the Target of the processing instruction. This is simply the +//nodeName. +// +const DOMString& ProcessingInstruction::getTarget() const +{ + return nodeName; +} + +// +//Return the Data of the processing instruction. This is simply the value +//of the node, "nodeValue" +// +const DOMString& ProcessingInstruction::getData() const +{ + return nodeValue; +} + +// +//Set the Data element of the processing instruction. +void ProcessingInstruction::setData(const DOMString& theData) +{ + nodeValue = theData; +} + + +// +//ProcessingInstruction nodes can not have any children, so just return null +//from all child manipulation functions. +// + +Node* ProcessingInstruction::insertBefore(Node* newChild, Node* refChild) +{ + return NULL; +} + +Node* ProcessingInstruction::replaceChild(Node* newChild, Node* oldChild) +{ + return NULL; +} + +Node* ProcessingInstruction::removeChild(Node* oldChild) +{ + return NULL; +} + +Node* ProcessingInstruction::appendChild(Node* newChild) +{ + return NULL; +} diff --git a/mozilla/extensions/transformiix/source/xml/dom/Text.cpp b/mozilla/extensions/transformiix/source/xml/dom/Text.cpp index 71492901491..3980f0760be 100644 --- a/mozilla/extensions/transformiix/source/xml/dom/Text.cpp +++ b/mozilla/extensions/transformiix/source/xml/dom/Text.cpp @@ -1,93 +1,93 @@ -/* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. - * - */ -// Tom Kneeland (3/29/99) -// -// Implementation of the Document Object Model Level 1 Core -// Implementation of the Text class -// -// Modification History: -// Who When What -// TK 03/29/99 Created -// - -#include "dom.h" - -// -//Construct a text object with the specified document owner and data -// -Text::Text(const DOMString& theData, Document* owner) : - CharacterData(Node::TEXT_NODE, "#text", theData, owner) -{ -} - -// -//Protected constructor for children of the Text Class. Currently only -//CDATASection needs to use this function. -Text::Text(NodeType type, const DOMString& name, const DOMString& value, - Document* owner) : - CharacterData(type, name, value, owner) -{ -} - - -// -//Split the text node at Offset into two siblings. Return a pointer to the new -//sibling. -// -Text* Text::splitText(Int32 offset) -{ - Text* newTextSibling = NULL; - DOMString newData; - - if ((offset >= 0) && (offset < nodeValue.length())) - { - newTextSibling = getOwnerDocument()->createTextNode(nodeValue.subString(offset, newData)); - getParentNode()->insertBefore(newTextSibling, getNextSibling()); - nodeValue.deleteChars(offset, nodeValue.length() - offset); - } - - return newTextSibling; -} - -// -//Text nodes can not have any children, so just return null from all child -//manipulation functions. -// - -Node* Text::insertBefore(Node* newChild, Node* refChild) -{ - return NULL; -} - -Node* Text::replaceChild(Node* newChild, Node* oldChild) -{ - return NULL; -} - -Node* Text::removeChild(Node* oldChild) -{ - return NULL; -} - -Node* Text::appendChild(Node* newChild) -{ - return NULL; -} +/* + * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * + * The contents of this file are subject to the Mozilla Public License + * Version 1.0 (the "License"); you may not use this file except in + * compliance with the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * The program provided "as is" without any warranty express or + * implied, including the warranty of non-infringement and the implied + * warranties of merchantibility and fitness for a particular purpose. + * The Copyright owner will not be liable for any damages suffered by + * you as a result of using the Program. In no event will the Copyright + * owner be liable for any special, indirect or consequential damages or + * lost profits even if the Copyright owner has been advised of the + * possibility of their occurrence. + * + * Please see release.txt distributed with this file for more information. + * + */ +// Tom Kneeland (3/29/99) +// +// Implementation of the Document Object Model Level 1 Core +// Implementation of the Text class +// +// Modification History: +// Who When What +// TK 03/29/99 Created +// + +#include "dom.h" + +// +//Construct a text object with the specified document owner and data +// +Text::Text(const DOMString& theData, Document* owner) : + CharacterData(Node::TEXT_NODE, "#text", theData, owner) +{ +} + +// +//Protected constructor for children of the Text Class. Currently only +//CDATASection needs to use this function. +Text::Text(NodeType type, const DOMString& name, const DOMString& value, + Document* owner) : + CharacterData(type, name, value, owner) +{ +} + + +// +//Split the text node at Offset into two siblings. Return a pointer to the new +//sibling. +// +Text* Text::splitText(Int32 offset) +{ + Text* newTextSibling = NULL; + DOMString newData; + + if ((offset >= 0) && (offset < nodeValue.length())) + { + newTextSibling = getOwnerDocument()->createTextNode(nodeValue.subString(offset, newData)); + getParentNode()->insertBefore(newTextSibling, getNextSibling()); + nodeValue.deleteChars(offset, nodeValue.length() - offset); + } + + return newTextSibling; +} + +// +//Text nodes can not have any children, so just return null from all child +//manipulation functions. +// + +Node* Text::insertBefore(Node* newChild, Node* refChild) +{ + return NULL; +} + +Node* Text::replaceChild(Node* newChild, Node* oldChild) +{ + return NULL; +} + +Node* Text::removeChild(Node* oldChild) +{ + return NULL; +} + +Node* Text::appendChild(Node* newChild) +{ + return NULL; +} diff --git a/mozilla/extensions/transformiix/source/xml/parser/Makefile b/mozilla/extensions/transformiix/source/xml/parser/Makefile index c7c11b54a3f..d3cd7cdf3d5 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/Makefile +++ b/mozilla/extensions/transformiix/source/xml/parser/Makefile @@ -8,8 +8,8 @@ PARSER_PATH = . EXPAT_PARSER_PATH = xmlparse EXPAT_TOKEN_PATH = xmltok -INCLUDE_PATH = -I $(PARSER_PATH) -I $(BASE_PATH) -I $(DOM_PATH) \ - -I $(EXPAT_TOKEN_PATH) -I $(EXPAT_PARSER_PATH) -I- +INCLUDE_PATH = -I$(PARSER_PATH) -I$(BASE_PATH) -I$(DOM_PATH) \ + -I$(EXPAT_TOKEN_PATH) -I$(EXPAT_PARSER_PATH) -I- BASE_OBJS = $(BASE_PATH)/String.o @@ -40,7 +40,7 @@ PARSER_OBJS = $(PARSER_PATH)/XMLParser.o ALL_OBJS = $(BASE_OBJS) $(DOM_OBJS) $(EXPAT_OBJS) $(PARSER_OBJS) -CC = g++ -D XML_UNICODE -D __cplusplus +CC := $(CC) -D XML_UNICODE -D __cplusplus xml_parser: $(ALL_OBJS) diff --git a/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp b/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp index 22b1e776199..e0f7650372a 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp +++ b/mozilla/extensions/transformiix/source/xml/parser/XMLParser.cpp @@ -1,25 +1,43 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The program is provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Tom Kneeland, tomk@mitre.org + * -- original author. + * Keith Visco, kvisco@ziplink.net + * -- finished implementation. Too many changes to list here. + * Bob Miller, Oblix Inc., kbob@oblix.com + * -- fixed assignment to "true" to be MB_TRUE, in ::parse() + * + * $Id: XMLParser.cpp,v 1.2 1999-11-15 07:12:54 nisheeth%netscape.com Exp $ */ -#include "xmlparser.h" +#include "XMLParser.h" /** * Implementation of an In-Memory DOM based XML parser. The actual XML * parsing is provided by EXPAT. * + * @author Keith Visco * @author Tom Kneeland - * @author Keith Visco - * + * @author Bob Miller + * * Modification History: * Who When What * TK 05/03/99 Created @@ -79,7 +97,7 @@ Document* XMLParser::parse(istream& inputStream) errorString.append(XML_ErrorString(XML_GetErrorCode(parser))); errorString.append(" at line "); errorString.append(XML_GetCurrentLineNumber(parser)); - done = true; + done = MB_TRUE; errorState = MB_TRUE; delete ps.document; ps.document = NULL; diff --git a/mozilla/extensions/transformiix/source/xml/parser/XMLParser.h b/mozilla/extensions/transformiix/source/xml/parser/XMLParser.h index 4acbe69d4ef..53a53693365 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/XMLParser.h +++ b/mozilla/extensions/transformiix/source/xml/parser/XMLParser.h @@ -1,20 +1,35 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The program is provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Tom Kneeland + * -- original author. + * Keith Visco + * -- finished implementation + * + * $Id: XMLParser.h,v 1.2 1999-11-15 07:12:54 nisheeth%netscape.com Exp $ */ #include #include "baseutils.h" #include "xmlparse.h" -#include "DOM.h" +#include "dom.h" typedef struct { Document* document; @@ -22,18 +37,11 @@ typedef struct { } ParserState; /** - * Implementation of an In-Memory DOM based XML parser. The actual XML - * parsing is provided by EXPAT. - * + * Implementation of an In-Memory DOM based XML parser. The actual XML + * parsing is provided by EXPAT. * @author Tom Kneeland - * @author Keith Visco - * - * Modification History: - * Who When What - * TK 05/03/99 Created - * KV 06/15/1999 Changed #parse method to return document - * KV 06/17/1999 Made many changes - * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:12:54 $ **/ class XMLParser { diff --git a/mozilla/extensions/transformiix/source/xml/parser/expat.mk b/mozilla/extensions/transformiix/source/xml/parser/expat.mk index b69d55cefae..310bbd5866e 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/expat.mk +++ b/mozilla/extensions/transformiix/source/xml/parser/expat.mk @@ -7,10 +7,11 @@ EXPAT_OBJS = $(EXPAT_TOKEN_PATH)/xmltok.o \ $(EXPAT_PARSER_PATH)/hashtable.o -INCLUDE_PATH = -I . -I $(EXPAT_PARSER_PATH) -I $(EXPAT_TOKEN_PATH) -I- +INCLUDE_PATH = -I. -I$(EXPAT_PARSER_PATH) -I$(EXPAT_TOKEN_PATH) -I- -FLAGS = -D XML_UNICODE -CC = gcc $(FLAGS) $(INCLUDE_PATH) +FLAGS = -DXML_UNICODE + +CC := cc -g $(FLAGS) $(INCLUDE_PATH) target: $(EXPAT_OBJS) diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.c b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.c index 2876975bd2b..2acebc331f7 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.c @@ -16,6 +16,7 @@ Portions created by James Clark are Copyright (C) 1998 James Clark. All Rights Reserved. Contributor(s): + Bob Miller, Oblix Inc. changed #define XML_UNICODE section */ #include @@ -24,11 +25,23 @@ Contributor(s): #include "xmldef.h" #include "hashtable.h" -#ifdef XML_UNICODE +#ifdef XML_UNICODE_WCHAR_T #define keycmp wcscmp #else +#ifdef XML_UNICODE + static int keycmp(KEY a, KEY b) + { + for ( ; *a || *b; a++, b++) { + if (*a == *b) + continue; + return *b - *a; + } + return 0; + } +#else #define keycmp strcmp #endif +#endif #define INIT_SIZE 64 diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.h b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.h index 0eb732bce64..bdb162b4fda 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/hashtable.h @@ -1,29 +1,28 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #include #ifdef XML_UNICODE -typedef const wchar_t *KEY; +typedef const unsigned short *KEY; #else typedef const char *KEY; #endif diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.c b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.c index 8ec95e611f6..f11f62c0e30 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #include diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.h b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.h index a711b9f3202..13d5885ca2a 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmlparse/xmlparse.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #ifndef XmlParse_INCLUDED diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/asciitab.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/asciitab.h index 82a37171899..f7d78da4f82 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/asciitab.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/asciitab.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ /* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML, diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/dllmain.c b/mozilla/extensions/transformiix/source/xml/parser/xmltok/dllmain.c index e8ad4694f3f..579d6567e08 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/dllmain.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/dllmain.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #include diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/iasciitab.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/iasciitab.h index fb1a60fd48d..d894074771a 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/iasciitab.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/iasciitab.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ /* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */ diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/latin1tab.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/latin1tab.h index 2d64e277194..378697512e6 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/latin1tab.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/latin1tab.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ /* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER, diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/utf8tab.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/utf8tab.h index 477cf35267b..57ff8074c16 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/utf8tab.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/utf8tab.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmldef.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmldef.h index 167006f7160..48ba359ca04 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmldef.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmldef.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ /* This file can be used for any definitions needed in diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.c b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.c index 87cf62d88e9..72be89bff8f 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #include "xmldef.h" diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.h index 77a8ecef56f..ecbcc26dff0 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmlrole.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #ifndef XmlRole_INCLUDED diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.c b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.c index 17a6ea0bd5c..281b318efbb 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #include "xmldef.h" diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.h index cb26ecc44da..6d0b91dff2c 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #ifndef XmlTok_INCLUDED diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.c b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.c index 4f4b87b11cf..fa4916252ff 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #ifndef IS_INVALID_CHAR diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.h b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.h index dbd8c762513..3b0444ad2a6 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.h +++ b/mozilla/extensions/transformiix/source/xml/parser/xmltok/xmltok_impl.h @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ enum { diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/readfilemap.c b/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/readfilemap.c index fac887a73a5..cfdfa2a7974 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/readfilemap.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/readfilemap.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #include diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/unixfilemap.c b/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/unixfilemap.c index fef34829a4f..1207d12b92f 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/unixfilemap.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/unixfilemap.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #include diff --git a/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/win32filemap.c b/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/win32filemap.c index b6df65b2870..488aa685f29 100644 --- a/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/win32filemap.c +++ b/mozilla/extensions/transformiix/source/xml/parser/xmlwf-ignore/win32filemap.c @@ -1,22 +1,21 @@ /* - The contents of this file are subject to the Mozilla Public - License Version 1.1 (the "License"); you may not use this file - except in compliance with the License. You may obtain a copy of - the License at http://www.mozilla.org/MPL/ +The contents of this file are subject to the Mozilla Public License +Version 1.0 (the "License"); you may not use this file except in +compliance with the License. You may obtain a copy of the License at +http://www.mozilla.org/MPL/ - Software distributed under the License is distributed on an "AS - IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or - implied. See the License for the specific language governing - rights and limitations under the License. +Software distributed under the License is distributed on an "AS IS" +basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the +License for the specific language governing rights and limitations +under the License. - The Original Code is expat. +The Original Code is expat. - The Initial Developer of the Original Code is James Clark. - Portions created by James Clark are - Copyright (C) 1998 James Clark. All - Rights Reserved. +The Initial Developer of the Original Code is James Clark. +Portions created by James Clark are Copyright (C) 1998 +James Clark. All Rights Reserved. - Contributor(s): +Contributor(s): */ #define STRICT 1 diff --git a/mozilla/extensions/transformiix/source/xml/printer/HTMLPrinter.cpp b/mozilla/extensions/transformiix/source/xml/printer/HTMLPrinter.cpp index 68ec03367cb..0a2b5e59c4e 100644 --- a/mozilla/extensions/transformiix/source/xml/printer/HTMLPrinter.cpp +++ b/mozilla/extensions/transformiix/source/xml/printer/HTMLPrinter.cpp @@ -1,25 +1,28 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is XSL:P XSLT processor. + * + * The Initial Developer of the Original Code is Keith Visco. + * Portions created by Keith Visco (C) 1999 Keith Visco. + * All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author * + * $Id: HTMLPrinter.cpp,v 1.2 1999-11-15 07:13:00 nisheeth%netscape.com Exp $ */ -#include "Printers.h" +#include "printers.h" //--------------------------------/ //- Implementation of HTMLPrinter -/ @@ -28,7 +31,8 @@ /** * A class for printing XML nodes. * This class was ported from XSL:P Java source - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:00 $ **/ //---------------/ //- Contructors -/ diff --git a/mozilla/extensions/transformiix/source/xml/printer/Makefile b/mozilla/extensions/transformiix/source/xml/printer/Makefile index ffb40f58915..c14692fc351 100644 --- a/mozilla/extensions/transformiix/source/xml/printer/Makefile +++ b/mozilla/extensions/transformiix/source/xml/printer/Makefile @@ -4,18 +4,18 @@ target: printers BASE_PATH = "../../base" DOM_PATH = "../dom" -INCLUDE_PATH = -I . -I $(BASE_PATH) -I $(DOM_PATH) -I- +INCLUDE_PATH = -I. -I$(BASE_PATH) -I$(DOM_PATH) -I- ALL_OBJS = XMLPrinter.o \ HTMLPrinter.o -CC = g++ +CC := $(CC) -g printers: $(ALL_OBJS) -XMLPrinter.o: Printers.h XMLPrinter.cpp +XMLPrinter.o: printers.h XMLPrinter.cpp $(CC) $(INCLUDE_PATH) -c XMLPrinter.cpp -HTMLPrinter.o: Printers.h XMLPrinter.cpp HTMLPrinter.cpp +HTMLPrinter.o: printers.h XMLPrinter.cpp HTMLPrinter.cpp $(CC) $(INCLUDE_PATH) -c HTMLPrinter.cpp diff --git a/mozilla/extensions/transformiix/source/xml/printer/XMLPrinter.cpp b/mozilla/extensions/transformiix/source/xml/printer/XMLPrinter.cpp index f9af9bee17a..8b5977741c6 100644 --- a/mozilla/extensions/transformiix/source/xml/printer/XMLPrinter.cpp +++ b/mozilla/extensions/transformiix/source/xml/printer/XMLPrinter.cpp @@ -1,25 +1,30 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is XSL:P XSLT processor. + * + * The Initial Developer of the Original Code is Keith Visco. + * Portions created by Keith Visco (C) 1999 Keith Visco. + * All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author + * Majkel Kretschmar + * -- UTF-8 changes * + * $Id: XMLPrinter.cpp,v 1.2 1999-11-15 07:13:01 nisheeth%netscape.com Exp $ */ -#include "Printers.h" +#include "printers.h" //--------------------------------/ //- Implementation of XMLPrinter -/ @@ -28,7 +33,8 @@ /** * A class for printing XML nodes. * This class was ported from XSL:P Java source - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:01 $ **/ /** @@ -79,7 +85,7 @@ const char XMLPrinter::LF = '\n'; **/ XMLPrinter::XMLPrinter() { initialize(cout, DEFAULT_INDENT); -} //-- HTMLPrinter +} //-- XMLPrinter /** * Creates a new XML Printer using the given ostream for output @@ -361,7 +367,8 @@ void XMLPrinter::printUTF8Char(DOM_CHAR ch) const { ostream& out = *this->ostreamPtr; if (ch >= 128) { out << HEX_ENTITY; - out << ch; + if ( ch >= 256 ) out << (ch % 256); + else out << ch; out << SEMICOLON; } else out << (char)ch; @@ -430,4 +437,3 @@ void XMLPrinter::printComment(const DOMString& data) { } } //-- formatComment - diff --git a/mozilla/extensions/transformiix/source/xsl/Makefile b/mozilla/extensions/transformiix/source/xsl/Makefile index 208c0b0b807..9a07541f34a 100644 --- a/mozilla/extensions/transformiix/source/xsl/Makefile +++ b/mozilla/extensions/transformiix/source/xsl/Makefile @@ -1,6 +1,6 @@ target: xslp -CC = g++ +CC := $(CC) -g #ifndef PROJ_PATH ROOT_PATH = .. @@ -17,19 +17,21 @@ EXPAT_PARSER_PATH = $(XMLPARSER_PATH)/xmlparse EXPAT_TOKEN_PATH = $(XMLPARSER_PATH)/xmltok #endif -INCLUDE_PATHS = -I $(BASE_PATH) \ - -I $(NET_PATH) \ - -I $(DOM_PATH) \ - -I $(EXPR_PATH) \ - -I $(XSL_PATH) \ - -I $(XSLUTIL_PATH) \ - -I $(XML_PATH) \ - -I $(XMLPARSER_PATH) \ - -I $(XMLPRINTER_PATH) \ - -I $(EXPAT_PARSER_PATH) -I- +INCLUDE_PATHS = -I$(BASE_PATH) \ + -I$(NET_PATH) \ + -I$(DOM_PATH) \ + -I$(EXPR_PATH) \ + -I$(XSL_PATH) \ + -I$(XSLUTIL_PATH) \ + -I$(XML_PATH) \ + -I$(XMLPARSER_PATH) \ + -I$(XMLPRINTER_PATH) \ + -I$(EXPAT_PARSER_PATH) -I- XSL_OBJS = Names.o \ + Numbering.o \ ProcessorState.o \ + VariableBinding.o \ XSLProcessor.o ###################### @@ -41,8 +43,14 @@ xslp: $(XSL_OBJS) Names.o: Names.cpp Names.h $(CC) -I . -I $(BASE_PATH) -c Names.cpp +Numbering.o: Numbering.cpp Numbering.h + $(CC) $(INCLUDE_PATHS) -c Numbering.cpp + ProcessorState.o: ProcessorState.cpp ProcessorState.h $(CC) $(INCLUDE_PATHS) -c ProcessorState.cpp - + +VariableBinding.o: VariableBinding.h VariableBinding.cpp + $(CC) $(INCLUDE_PATHS) -c VariableBinding.cpp + XSLProcessor.o: XSLProcessor.cpp XSLProcessor.h $(CC) -c XSLProcessor.cpp -D __cplusplus $(INCLUDE_PATHS) diff --git a/mozilla/extensions/transformiix/source/xsl/Names.cpp b/mozilla/extensions/transformiix/source/xsl/Names.cpp index bdfd7123e49..8d88705409d 100644 --- a/mozilla/extensions/transformiix/source/xsl/Names.cpp +++ b/mozilla/extensions/transformiix/source/xsl/Names.cpp @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: Names.cpp,v 1.2 1999-11-15 07:13:07 nisheeth%netscape.com Exp $ */ /** * XSL names used throughout the XSLProcessor. * Probably should be wrapped in a Namespace - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:07 $ **/ #include "Names.h" @@ -48,9 +54,12 @@ const String COPY_OF = "copy-of"; const String ELEMENT = "element"; const String FOR_EACH = "for-each"; const String IF = "if"; +const String IMPORT = "import"; +const String INCLUDE = "include"; const String MESSAGE = "message"; const String NUMBER = "number"; const String OTHERWISE = "otherwise"; +const String PARAM = "param"; const String PI = "processing-instruction"; const String PRESERVE_SPACE = "preserve-space"; const String STRIP_SPACE = "strip-space"; @@ -59,6 +68,7 @@ const String TEXT = "text"; const String VALUE_OF = "value-of"; const String VARIABLE = "variable"; const String WHEN = "when"; +const String WITH_PARAM = "with-param"; //-- Attributes @@ -67,6 +77,9 @@ const String DEFAULT_SPACE_ATTR = "default-space"; const String ELEMENTS_ATTR = "elements"; const String EXPR_ATTR = "expr"; const String FORMAT_ATTR = "format"; +const String FROM_ATTR = "from"; +const String HREF_ATTR = "href"; +const String LEVEL_ATTR = "level"; const String MATCH_ATTR = "match"; const String MODE_ATTR = "mode"; const String NAME_ATTR = "name"; @@ -75,12 +88,16 @@ const String PRIORITY_ATTR = "priority"; const String SELECT_ATTR = "select"; const String TEST_ATTR = "test"; const String USE_ATTRIBUTE_SETS_ATTR = "use-attribute-sets"; +const String VALUE_ATTR = "value"; //-- Attribute Values -const String STRIP_VALUE = "strip"; -const String PRESERVE_VALUE = "preserve"; -const String YES_VALUE = "yes"; +const String ANY_VALUE = "any"; +const String MULTIPLE_VALUE = "multiple"; const String NO_VALUE = "no"; +const String PRESERVE_VALUE = "preserve"; +const String SINGLE_VALUE = "single"; +const String STRIP_VALUE = "strip"; +const String YES_VALUE = "yes"; //-- Stylesheet attributes const String INDENT_RESULT_ATTR = "indent-result"; @@ -110,29 +127,7 @@ const String NODE_FNAME = "node"; const String IDENTITY_OP = "."; const String PARENT_OP = ".."; -//-- Function Names -const String BOOLEAN_FN = "boolean"; -const String CONCAT_FN = "concat"; -const String CONTAINS_FN = "contains"; -const String COUNT_FN = "count"; -const String FALSE_FN = "false"; -const String LAST_FN = "last"; -const String LOCAL_PART_FN = "local-part"; -const String NAME_FN = "name"; -const String NAMESPACE_FN = "namespace"; -const String NOT_FN = "not"; -const String POSITION_FN = "position"; -const String STARTS_WITH_FN = "starts-with"; -const String STRING_FN = "string"; -const String STRING_LENGTH_FN = "string-length"; -const String SUBSTRING_FN = "substring"; -const String SUBSTRING_AFTER_FN = "substring-after"; -const String SUBSTRING_BEFORE_FN = "substring-before"; -const String TRANSLATE_FN = "translate"; -const String TRUE_FN = "true"; - -//-- internal XSL processor functions -const String ERROR_FN = "error"; +//-- XSL extension functions const String WILD_CARD = "*"; diff --git a/mozilla/extensions/transformiix/source/xsl/Names.h b/mozilla/extensions/transformiix/source/xsl/Names.h index 7362e0e3a5d..c4fcb853bc5 100644 --- a/mozilla/extensions/transformiix/source/xsl/Names.h +++ b/mozilla/extensions/transformiix/source/xsl/Names.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: Names.h,v 1.2 1999-11-15 07:13:07 nisheeth%netscape.com Exp $ */ #include "String.h" @@ -46,9 +51,12 @@ extern const String COPY_OF; extern const String ELEMENT; extern const String FOR_EACH; extern const String IF; +extern const String IMPORT; +extern const String INCLUDE; extern const String MESSAGE; extern const String NUMBER; extern const String OTHERWISE; +extern const String PARAM; extern const String PI; extern const String PRESERVE_SPACE; extern const String STRIP_SPACE; @@ -57,6 +65,7 @@ extern const String TEXT; extern const String VALUE_OF; extern const String VARIABLE; extern const String WHEN; +extern const String WITH_PARAM; //-- Attributes @@ -65,6 +74,9 @@ extern const String DEFAULT_SPACE_ATTR; extern const String ELEMENTS_ATTR; extern const String EXPR_ATTR; extern const String FORMAT_ATTR; +extern const String FROM_ATTR; +extern const String HREF_ATTR; +extern const String LEVEL_ATTR; extern const String MATCH_ATTR; extern const String MODE_ATTR; extern const String NAME_ATTR; @@ -73,12 +85,16 @@ extern const String PRIORITY_ATTR; extern const String SELECT_ATTR; extern const String TEST_ATTR; extern const String USE_ATTRIBUTE_SETS_ATTR; +extern const String VALUE_ATTR; //-- Attribute Values -extern const String STRIP_VALUE; -extern const String PRESERVE_VALUE; -extern const String YES_VALUE; +extern const String ANY_VALUE; +extern const String MULTIPLE_VALUE; extern const String NO_VALUE; +extern const String PRESERVE_VALUE; +extern const String SINGLE_VALUE; +extern const String STRIP_VALUE; +extern const String YES_VALUE; //-- Stylesheet attributes extern const String INDENT_RESULT_ATTR; @@ -108,29 +124,7 @@ extern const String NODE_FNAME; extern const String IDENTITY_OP; extern const String PARENT_OP; -//-- Function Names -extern const String BOOLEAN_FN; -extern const String CONCAT_FN; -extern const String CONTAINS_FN; -extern const String COUNT_FN ; -extern const String FALSE_FN; -extern const String LAST_FN; -extern const String LOCAL_PART_FN; -extern const String NAME_FN; -extern const String NAMESPACE_FN; -extern const String NOT_FN; -extern const String POSITION_FN; -extern const String STARTS_WITH_FN; -extern const String STRING_FN; -extern const String STRING_LENGTH_FN; -extern const String SUBSTRING_FN; -extern const String SUBSTRING_AFTER_FN; -extern const String SUBSTRING_BEFORE_FN; -extern const String TRANSLATE_FN; -extern const String TRUE_FN; - -//-- internal XSL processor functions -extern const String ERROR_FN; +//-- XSL extension functions extern const String WILD_CARD; diff --git a/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp b/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp index f9fc67a3add..5a711bac253 100644 --- a/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp +++ b/mozilla/extensions/transformiix/source/xsl/ProcessorState.cpp @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: ProcessorState.cpp,v 1.2 1999-11-15 07:13:07 nisheeth%netscape.com Exp $ */ /** * Implementation of ProcessorState * This code was ported from XSL:P - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:07 $ **/ #include "ProcessorState.h" @@ -51,9 +57,23 @@ ProcessorState::~ProcessorState() { delete dfWildCardTemplate; delete dfTextTemplate; delete nodeStack; + while ( ! variableSets.empty() ) { delete (NamedMap*) variableSets.pop(); } + + //-- delete includes + StringList* keys = includes.keys(); + StringListIterator iter = keys->iterator(); + while (iter.hasNext()) { + String* key = iter.next(); + MITREObjectWrapper* objWrapper + = (MITREObjectWrapper*)includes.remove(*key); + delete (Document*)objWrapper->object; + delete objWrapper; + } + delete keys; + } //-- ~ProcessorState @@ -99,6 +119,18 @@ void ProcessorState::addErrorObserver(ErrorObserver& errorObserver) { errorObservers.add(&errorObserver); } //-- addErrorObserver +/** + * Adds the given XSL document to the list of includes + * The href is used as a key for the include, to prevent + * including the same document more than once +**/ +void ProcessorState::addInclude(const String& href, Document* xslDocument) { + MITREObjectWrapper* objWrapper = new MITREObjectWrapper(); + objWrapper->object = xslDocument; + includes.put(href, objWrapper); +} //-- addInclude + + /** * Adds the given template to the list of templates to process * @param xslTemplate, the Element to add as a template @@ -177,6 +209,13 @@ MBool ProcessorState::addToResultTree(Node* node) { case Node::COMMENT_NODE : current->appendChild(node); break; + case Node::DOCUMENT_FRAGMENT_NODE: + { + current->appendChild(node); + delete node; //-- DOM Implementation does not clean up DocumentFragments + break; + + } //-- only add if not adding to document Node default: if (current != resultDocument) current->appendChild(node); @@ -259,6 +298,54 @@ NodeSet* ProcessorState::getAttributeSet(const String& name) { return (NodeSet*)namedAttributeSets.get(name); } //-- getAttributeSet + +/** + * Returns the global document base for resolving relative URIs within + * the XSL stylesheets +**/ +const String& ProcessorState::getDocumentBase() { + return documentBase; +} //-- getDocumentBase + +/** + * Returns the href for the given XSL document by looking in the + * includes and imports lists + **/ +void ProcessorState::getDocumentHref + (Document* xslDocument, String& documentBase) +{ + + documentBase.clear(); + + //-- lookup includes + StringList* keys = includes.keys(); + StringListIterator& iter = keys->iterator(); + while (iter.hasNext()) { + String* key = iter.next(); + MITREObjectWrapper* objWrapper + = (MITREObjectWrapper*)includes.get(*key); + if (xslDocument == objWrapper->object) { + documentBase.append(*key); + break; + } + } + delete &iter; + delete keys; +} //-- getDocumentBase + +/** + * @return the included xsl document that was associated with the + * given href, or null if no document is found +**/ +Document* ProcessorState::getInclude(const String& href) { + MITREObjectWrapper* objWrapper = (MITREObjectWrapper*)includes.get(href); + Document* doc = 0; + if (objWrapper) { + doc = (Document*) objWrapper->object; + } + return doc; +} //-- getInclude(String) + Expr* ProcessorState::getExpr(const String& pattern) { Expr* expr = (Expr*)exprHash.get(pattern); if ( !expr ) { @@ -341,6 +428,12 @@ void ProcessorState::preserveSpace(String& names) { } } //-- preserveSpace +/** + * Sets the document base for use when resolving relative URIs +**/ +void ProcessorState::setDocumentBase(const String& documentBase) { + this->documentBase = documentBase; +} //-- setDocumentBase /** * Adds the set of names to the Whitespace stripping element set @@ -361,6 +454,29 @@ void ProcessorState::stripSpace(String& names) { //- Virtual Methods from derived from ContextState -/ //--------------------------------------------------/ +/** + * Returns the parent of the given Node. This method is needed + * beacuse with the DOM some nodes such as Attr do not have parents + * @param node the Node to find the parent of + * @return the parent of the given Node, or null if not found +**/ +Node* ProcessorState::findParent(Node* node) { + if (!node) return node; + + Node* parent = 0; + switch(node->getNodeType()) { + + //-- we need to index/hash nodes to save attr parents + case Node::ATTRIBUTE_NODE: + //-- add later + break; + default: + parent = node->getParentNode(); + break; + } + return parent; +} //-- findParent + /** * Returns the Stack of context NodeSets * @return the Stack of context NodeSets @@ -382,7 +498,7 @@ ExprResult* ProcessorState::getVariable(String& name) { while ( iter->hasNext() ) { NamedMap* map = (NamedMap*) iter->next(); if ( map->get(name)) { - exprResult = (ExprResult*)map->get(name); + exprResult = ((VariableBinding*)map->get(name))->getValue(); break; } } diff --git a/mozilla/extensions/transformiix/source/xsl/ProcessorState.h b/mozilla/extensions/transformiix/source/xsl/ProcessorState.h index f88b0463982..62915eeecb7 100644 --- a/mozilla/extensions/transformiix/source/xsl/ProcessorState.h +++ b/mozilla/extensions/transformiix/source/xsl/ProcessorState.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: ProcessorState.h,v 1.2 1999-11-15 07:13:08 nisheeth%netscape.com Exp $ */ @@ -37,10 +42,12 @@ #include "Expr.h" #include "StringList.h" #include "Tokenizer.h" +#include "VariableBinding.h" /** * Class used for keeping the current state of the XSL Processor - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:08 $ **/ class ProcessorState : public ContextState { @@ -73,6 +80,14 @@ public: **/ void addErrorObserver(ErrorObserver& errorObserver); + + /** + * Adds the given XSL document to the list of includes + * The href is used as a key for the include, to prevent + * including the same document more than once + **/ + void addInclude(const String& href, Document* xslDocument); + /** * Adds the given template to the list of templates to process * @param xslTemplate, the Element to add as a template @@ -97,6 +112,23 @@ public: NodeSet* getAttributeSet(const String& name); + /** + * Returns the document base for resolving relative URIs + **/ + const String& getDocumentBase(); + + /** + * Returns the href for the given xsl document by returning + * it's reference from the include or import list + **/ + void getDocumentHref(Document* xslDocument, String& documentBase); + + /** + * @return the included xsl document that was associated with the + * given href, or null if no document is found + **/ + Document* getInclude(const String& href); + /** * Returns the template associated with the given name, or * null if not template is found @@ -143,6 +175,11 @@ public: **/ void preserveSpace(String& names); + /** + * Sets the document base for including and importing stylesheets + **/ + void setDocumentBase(const String& documentBase); + /** * Adds the set of names to the Whitespace stripping element set **/ @@ -153,6 +190,14 @@ public: //- Virtual Methods from ContextState -/ //-------------------------------------/ + /** + * Returns the parent of the given Node. This method is needed + * beacuse with the DOM some nodes such as Attr do not have parents + * @param node the Node to find the parent of + * @return the parent of the given Node, or null if not found + **/ + virtual Node* findParent(Node* node); + /** * Returns the value of a given variable binding within the current scope * @param the name to which the desired variable value has been bound @@ -192,6 +237,12 @@ private: **/ List errorObservers; + /** + * A map for included stylesheets + * (used for deletion when processing is done) + **/ + NamedMap includes; + /** * A map for named attribute sets **/ @@ -242,6 +293,8 @@ private: Element* dfWildCardTemplate; Element* dfTextTemplate; + String documentBase; + /** * Returns the closest xml:space value for the given node **/ diff --git a/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp b/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp index 5318fc4a51b..73f16868258 100644 --- a/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp +++ b/mozilla/extensions/transformiix/source/xsl/XSLProcessor.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: XSLProcessor.cpp,v 1.2 1999-11-15 07:13:08 nisheeth%netscape.com Exp $ */ #include "XSLProcessor.h" @@ -28,7 +33,8 @@ /** * XSLProcessor is a class for Processing XSL styelsheets - * @author Keith Visco (kvisco@mitre.org) + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:08 $ **/ /** @@ -43,13 +49,10 @@ const String XSLProcessor::NON_TEXT_TEMPLATE_WARNING = **/ XSLProcessor::XSLProcessor() { -#ifdef MOZILLA - NS_INIT_ISUPPORTS(); -#endif - xslVersion.append("1.0"); appName.append("TransforMiiX"); - appVersion.append("1.0 [beta v19990813]"); + appVersion.append("1.0 [beta v19991114]"); + //-- create XSL element types xslTypes.setObjectDeletion(MB_TRUE); @@ -64,9 +67,11 @@ XSLProcessor::XSLProcessor() { xslTypes.put(ELEMENT, new XSLType(XSLType::ELEMENT)); xslTypes.put(FOR_EACH, new XSLType(XSLType::FOR_EACH)); xslTypes.put(IF, new XSLType(XSLType::IF)); + xslTypes.put(INCLUDE, new XSLType(XSLType::INCLUDE)); xslTypes.put(MESSAGE, new XSLType(XSLType::MESSAGE)); xslTypes.put(NUMBER, new XSLType(XSLType::NUMBER)); xslTypes.put(OTHERWISE, new XSLType(XSLType::OTHERWISE)); + xslTypes.put(PARAM, new XSLType(XSLType::PARAM)); xslTypes.put(PI, new XSLType(XSLType::PI)); xslTypes.put(PRESERVE_SPACE, new XSLType(XSLType::PRESERVE_SPACE)); xslTypes.put(STRIP_SPACE, new XSLType(XSLType::STRIP_SPACE)); @@ -75,6 +80,7 @@ XSLProcessor::XSLProcessor() { xslTypes.put(VALUE_OF, new XSLType(XSLType::VALUE_OF)); xslTypes.put(VARIABLE, new XSLType(XSLType::VARIABLE)); xslTypes.put(WHEN, new XSLType(XSLType::WHEN)); + xslTypes.put(WITH_PARAM, new XSLType(XSLType::WITH_PARAM)); //-- proprietary debug elements xslTypes.put("expr-debug", new XSLType(XSLType::EXPR_DEBUG)); @@ -87,35 +93,6 @@ XSLProcessor::~XSLProcessor() { //-- currently does nothing, but added for future use } //-- ~XSLProcessor -#ifdef MOZILLA -// Provide a Create method that can be called by a factory constructor: -NS_METHOD -XSLProcessor::Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult) -{ - if (aOuter) - return NS_ERROR_NO_AGGREGATION; - - XSLProcessor* xslp = new XSLProcessor(); - if (xslp == NULL) - return NS_ERROR_OUT_OF_MEMORY; - - // Note that Create doesn't initialize the instance -- that has to - // be done by the caller since the initialization args aren't passed - // in here. - - // AddRef before calling QI -- this makes it easier to handle the QI - // failure case because we'll always just Release and return - NS_ADDREF(xslp); - nsresult rv = xslp->QueryInterface(aIID, aResult); - - // This will free it if QI failed: - NS_RELEASE(xslp); - return rv; -} - -NS_IMPL_ISUPPORTS(XSLProcessor, nsIDocumentTransformer::GetIID()); -#endif - /** * Registers the given ErrorObserver with this ProcessorState **/ @@ -123,7 +100,6 @@ void XSLProcessor::addErrorObserver(ErrorObserver& errorObserver) { errorObservers.add(&errorObserver); } //-- addErrorObserver -#ifndef MOZILLA XMLPrinter* XSLProcessor::createPrinter(Document& xslDocument, ostream& out) { //-- check result-ns of stylesheet element @@ -154,7 +130,6 @@ XMLPrinter* XSLProcessor::createPrinter(Document& xslDocument, ostream& out) { else xmlPrinter = new XMLPrinter(*target); return xmlPrinter; } //-- createPrinter -#endif String& XSLProcessor::getAppName() { return appName; @@ -164,8 +139,6 @@ String& XSLProcessor::getAppVersion() { return appVersion; } //-- getAppVersion - -#ifndef MOZILLA /** * Parses all XML Stylesheet PIs associated with the * given XML document. If any stylesheet PIs are found with @@ -266,7 +239,7 @@ void XSLProcessor::parseStylesheetPI(String& data, String& type, String& href) { Document* XSLProcessor::process(Document& xmlDocument, String& documentBase) { //-- look for Stylesheet PI Document xslDocument; //-- empty for now - return process(xmlDocument, xslDocument); + return process(xmlDocument, xslDocument, documentBase); } //-- process /** @@ -275,7 +248,8 @@ Document* XSLProcessor::process(Document& xmlDocument, String& documentBase) { * the given XSL input stream. * @return the result tree. **/ -Document* XSLProcessor::process(istream& xmlInput, istream& xslInput) { +Document* XSLProcessor::process +(istream& xmlInput, istream& xslInput, String& documentBase) { //-- read in XML Document XMLParser xmlParser; Document* xmlDoc = xmlParser.parse(xmlInput); @@ -294,7 +268,7 @@ Document* XSLProcessor::process(istream& xmlInput, istream& xslInput) { delete xmlDoc; return 0; } - Document* result = process(*xmlDoc, *xslDoc); + Document* result = process(*xmlDoc, *xslDoc, documentBase); delete xmlDoc; delete xslDoc; return result; @@ -337,46 +311,100 @@ Document* XSLProcessor::process(istream& xmlInput, String& documentBase) { delete xmlDoc; return 0; } - Document* result = process(*xmlDoc, *xslDoc); + Document* result = process(*xmlDoc, *xslDoc, documentBase); delete xmlDoc; delete xslDoc; return result; } //-- process -#endif /** - * Processes the given XML Document using the given XSL document - * and returns the result tree + * Processes the Top level elements for an XSL stylesheet **/ -Document* XSLProcessor::process(Document& xmlDocument, Document& xslDocument) { +void XSLProcessor::processTopLevel + (Document* xslDocument, ProcessorState* ps) +{ - Document* result = new Document(); - - //-- create a new ProcessorState - ProcessorState ps(xslDocument, *result); - - //-- add error observers - ListIterator* iter = errorObservers.iterator(); - while ( iter->hasNext()) { - ps.addErrorObserver(*((ErrorObserver*)iter->next())); - } - delete iter; //-------------------------------------------------------/ - //- index templates and process root level xsl elements -/ + //- index templates and process top level xsl elements -/ //-------------------------------------------------------/ - Element* stylesheet = xslDocument.getDocumentElement(); + + Element* stylesheet = xslDocument->getDocumentElement(); NodeList* nl = stylesheet->getChildNodes(); for (int i = 0; i < nl->getLength(); i++) { Node* node = nl->item(i); if (node->getNodeType() == Node::ELEMENT_NODE) { Element* element = (Element*)node; DOMString name = element->getNodeName(); - switch (getElementType(name, &ps)) { + switch (getElementType(name, ps)) { case XSLType::ATTRIBUTE_SET: - ps.addAttributeSet(element); + ps->addAttributeSet(element); break; + case XSLType::PARAM : + { + String name = element->getAttribute(NAME_ATTR); + if ( name.length() == 0 ) { + notifyError("missing required name attribute for xsl:param"); + break; + } + + ExprResult* exprResult + = processVariable(node, element, ps); + + bindVariable(name, exprResult, MB_TRUE, ps); + break; + } + case XSLType::INCLUDE : + { + + String href = element->getAttribute(HREF_ATTR); + //-- Read in XSL document + + if (ps->getInclude(href)) { + String err("stylesheet already included: "); + err.append(href); + notifyError(err, ErrorObserver::WARNING); + break; + } + + //-- get document base + String documentBase; + String currentHref; + //ps->getDocumentHref(element->getOwnerDocument(), + // currentHref); + if (currentHref.length() == 0) { + documentBase.append(ps->getDocumentBase()); + } + else { + URIUtils::getDocumentBase(currentHref, documentBase); + } + + String errMsg; + + istream* xslInput + = URIUtils::getInputStream(href,documentBase,errMsg); + Document* xslDoc = 0; + XMLParser xmlParser; + if ( xslInput ) { + xslDoc = xmlParser.parse(*xslInput); + delete xslInput; + } + if (!xslDoc) { + String err("error including XSL stylesheet: "); + err.append(href); + err.append("; "); + err.append(xmlParser.getErrorString()); + notifyError(err); + } + else { + //-- add stylesheet to list of includes + ps->addInclude(href, xslDoc); + processTopLevel(xslDoc, ps); + } + break; + + } case XSLType::TEMPLATE : - ps.addTemplate(element); + ps->addTemplate(element); break; case XSLType::VARIABLE : { @@ -385,8 +413,8 @@ Document* XSLProcessor::process(Document& xmlDocument, Document& xslDocument) { notifyError("missing required name attribute for xsl:variable"); break; } - ExprResult* exprResult = processVariable(node, element, &ps); - bindVariable(name, exprResult, &ps); + ExprResult* exprResult = processVariable(node, element, ps); + bindVariable(name, exprResult, MB_FALSE, ps); break; } case XSLType::PRESERVE_SPACE : @@ -398,7 +426,7 @@ Document* XSLProcessor::process(Document& xmlDocument, Document& xslDocument) { err.append("xsl:preserve-space"); notifyError(err); } - else ps.preserveSpace(elements); + else ps->preserveSpace(elements); break; } case XSLType::STRIP_SPACE : @@ -410,7 +438,7 @@ Document* XSLProcessor::process(Document& xmlDocument, Document& xslDocument) { err.append("xsl:strip-space"); notifyError(err); } - else ps.stripSpace(elements); + else ps->stripSpace(elements); break; } default: @@ -419,6 +447,36 @@ Document* XSLProcessor::process(Document& xmlDocument, Document& xslDocument) { } } } + +} //-- process(Document, ProcessorState) + +/** + * Processes the given XML Document using the given XSL document + * and returns the result tree +**/ +Document* XSLProcessor::process + (Document& xmlDocument, Document& xslDocument, String& documentBase) +{ + + Document* result = new Document(); + + //-- create a new ProcessorState + ProcessorState ps(xslDocument, *result); + ps.setDocumentBase(documentBase); + + //-- add error observers + ListIterator* iter = errorObservers.iterator(); + while ( iter->hasNext()) { + ps.addErrorObserver(*((ErrorObserver*)iter->next())); + } + delete iter; + + //-------------------------------------------------------/ + //- index templates and process top level xsl elements -/ + //-------------------------------------------------------/ + + processTopLevel(&xslDocument, &ps); + //----------------------------------------/ //- Process root of XML source document -/ //--------------------------------------/ @@ -427,14 +485,17 @@ Document* XSLProcessor::process(Document& xmlDocument, Document& xslDocument) { //-- return result Document return result; } //-- process - -#ifndef MOZILLA /** * Processes the given XML Document using the given XSL document * and prints the results to the given ostream argument **/ -void XSLProcessor::process(Document& xmlDocument, Document& xslDocument, ostream& out) { - Document* resultDoc = process(xmlDocument, xslDocument); +void XSLProcessor::process + ( Document& xmlDocument, + Document& xslDocument, + ostream& out, + String& documentBase ) +{ + Document* resultDoc = process(xmlDocument, xslDocument, documentBase); XMLPrinter* xmlPrinter = createPrinter(xslDocument, out); xmlPrinter->print(resultDoc); delete xmlPrinter; @@ -450,7 +511,9 @@ void XSLProcessor::process(Document& xmlDocument, Document& xslDocument, ostream * The result tree is printed to the given ostream argument, * will not close the ostream argument **/ -void XSLProcessor::process(istream& xmlInput, String& documentBase, ostream& out) { +void XSLProcessor::process + (istream& xmlInput, ostream& out, String& documentBase) +{ XMLParser xmlParser; Document* xmlDoc = xmlParser.parse(xmlInput); @@ -477,7 +540,7 @@ void XSLProcessor::process(istream& xmlInput, String& documentBase, ostream& out delete xmlDoc; return; } - Document* result = process(*xmlDoc, *xslDoc); + Document* result = process(*xmlDoc, *xslDoc, documentBase); XMLPrinter* xmlPrinter = createPrinter(*xslDoc, out); xmlPrinter->print(result); delete xmlPrinter; @@ -493,7 +556,9 @@ void XSLProcessor::process(istream& xmlInput, String& documentBase, ostream& out * The result tree is printed to the given ostream argument, * will not close the ostream argument **/ -void XSLProcessor::process(istream& xmlInput, istream& xslInput, ostream& out) { +void XSLProcessor::process + (istream& xmlInput, istream& xslInput, ostream& out, String& documentBase) +{ //-- read in XML Document XMLParser xmlParser; Document* xmlDoc = xmlParser.parse(xmlInput); @@ -512,7 +577,7 @@ void XSLProcessor::process(istream& xmlInput, istream& xslInput, ostream& out) { delete xmlDoc; return; } - Document* result = process(*xmlDoc, *xslDoc); + Document* result = process(*xmlDoc, *xslDoc, documentBase); XMLPrinter* xmlPrinter = createPrinter(*xslDoc, out); xmlPrinter->print(result); delete xmlPrinter; @@ -520,11 +585,40 @@ void XSLProcessor::process(istream& xmlInput, istream& xslInput, ostream& out) { delete xslDoc; delete result; } //-- process -#endif + //-------------------/ //- Private Methods -/ //-------------------/ +void XSLProcessor::bindVariable + (String& name, ExprResult* value, MBool allowShadowing, ProcessorState* ps) +{ + NamedMap* varSet = (NamedMap*)ps->getVariableSetStack()->peek(); + //-- check for duplicate variable names + VariableBinding* current = (VariableBinding*) varSet->get(name); + VariableBinding* binding = 0; + if (current) { + binding = current; + if (current->isShadowingAllowed() ) { + current->setShadowValue(value); + } + else { + //-- error cannot rebind variables + String err("error cannot rebind variables: "); + err.append(name); + err.append(" already exists in this scope."); + notifyError(err); + } + } + else { + binding = new VariableBinding(name, value); + varSet->put((const String&)name, binding); + } + if ( allowShadowing ) binding->allowShadowing(); + else binding->disallowShadowing(); + +} //-- bindVariable + /** * Returns the type of Element represented by the given name * @return the XSLType represented by the given element name @@ -549,25 +643,6 @@ short XSLProcessor::getElementType(String& name, ProcessorState* ps) { } //-- getElementType -void XSLProcessor::bindVariable - (String& name, ExprResult* exprResult, ProcessorState* ps) -{ - NamedMap* varSet = (NamedMap*)ps->getVariableSetStack()->peek(); - //-- check for duplicate variable names - ExprResult* current = (ExprResult*) varSet->get(name); - if ( current ) { - //-- error cannot rebind variables - String err("error cannot rebind variables: "); - err.append(name); - err.append(" already exists in this scope."); - notifyError(err); - } - else { - varSet->put((const String&)name, exprResult); - } - -} //-- bindVariable - /** * Gets the Text value of the given DocumentFragment. The value is placed * into the given destination String. If a non text node element is @@ -699,7 +774,7 @@ void XSLProcessor::processAction Attr* modeAttr = actionElement->getAttributeNode(MODE_ATTR); if ( modeAttr ) mode = new String(modeAttr->getValue()); String selectAtt = actionElement->getAttribute(SELECT_ATTR); - if ( selectAtt.length() == 0 ) selectAtt = "*"; + if ( selectAtt.length() == 0 ) selectAtt = "* | text()"; pExpr = ps->getPatternExpr(selectAtt); ExprResult* exprResult = pExpr->evaluate(node, ps); NodeSet* nodeSet = 0; @@ -766,7 +841,14 @@ void XSLProcessor::processAction if ( templateName.length() > 0 ) { Element* xslTemplate = ps->getNamedTemplate(templateName); if ( xslTemplate ) { + NamedMap params; + params.setObjectDeletion(MB_TRUE); + Stack* bindings = ps->getVariableSetStack(); + bindings->push(¶ms); + processTemplateParams(xslTemplate, node, ps); + processParameters(actionElement, node, ps); processTemplate(node, xslTemplate, ps); + bindings->pop(); } } else { @@ -820,9 +902,21 @@ void XSLProcessor::processAction if ( ! ps->addToResultTree(comment) ) delete comment; break; } + //-- xsl:copy case XSLType::COPY: xslCopy(node, actionElement, ps); break; + //-- xsl:copy-of + case XSLType::COPY_OF: + { + DOMString selectAtt = actionElement->getAttribute(SELECT_ATTR); + Expr* expr = ps->getExpr(selectAtt); + ExprResult* exprResult = expr->evaluate(node, ps); + xslCopyOf(exprResult, ps); + delete exprResult; + break; + + } case XSLType::ELEMENT: { Attr* attr = actionElement->getAttributeNode(NAME_ATTR); @@ -903,6 +997,7 @@ void XSLProcessor::processAction break; } + //-- xsl:message case XSLType::MESSAGE : { String message; @@ -911,9 +1006,12 @@ void XSLProcessor::processAction cout << "xsl:message - "<< message << endl; break; } - //xsl:number + //-- xsl:number case XSLType::NUMBER : { + String result; + Numbering::doNumbering(actionElement, result, node, ps); + ps->addToResultTree(resultDoc->createTextNode(result)); break; } //-- xsl:processing-instruction @@ -1028,7 +1126,7 @@ void XSLProcessor::processAction break; } ExprResult* exprResult = processVariable(node, actionElement, ps); - bindVariable(name, exprResult, ps); + bindVariable(name, exprResult, MB_FALSE, ps); break; } //-- literal @@ -1041,9 +1139,9 @@ void XSLProcessor::processAction if ( atts ) { String xsltNameSpace = ps->getXSLNamespace(); NodeSet nonXSLAtts(atts->getLength()); - int i; //-- process special XSL attributes first - for ( i = 0; i < atts->getLength(); i++ ) { + int i; + for (i = 0; i < atts->getLength(); i++ ) { Attr* attr = (Attr*) atts->item(i); //-- filter attributes in the XSLT namespace String attrNameSpace; @@ -1072,7 +1170,8 @@ void XSLProcessor::processAction } //-- process children NodeList* nl = xslAction->getChildNodes(); - for (int i = 0; i < nl->getLength(); i++) { + int i; + for ( i = 0; i < nl->getLength(); i++) { processAction(node, nl->item(i),ps); } ps->getNodeStack()->pop(); @@ -1122,6 +1221,41 @@ void XSLProcessor::processAttrValueTemplate } //-- processAttributeValueTemplate +/** + * Processes the xsl:with-param elements of the given xsl action + * Only processes xsl:with-params that have a corresponding + * xsl:param already in the current VariableSet +**/ +void XSLProcessor::processParameters(Element* xslAction, Node* context, ProcessorState* ps) +{ + if ( !xslAction ) return; + + //-- handle xsl:with-param elements + NodeList* nl = xslAction->getChildNodes(); + Stack* bindings = ps->getVariableSetStack(); + NamedMap* current = (NamedMap*)bindings->peek(); + for (int i = 0; i < nl->getLength(); i++) { + Node* tmpNode = nl->item(i); + int nodeType = tmpNode->getNodeType(); + if ( nodeType == Node::ELEMENT_NODE ) { + Element* action = (Element*)tmpNode; + String actionName = action->getNodeName(); + short xslType = getElementType(actionName, ps); + if ( xslType == XSLType::WITH_PARAM ) { + String name = action->getAttribute(NAME_ATTR); + if ( name.length() == 0 ) { + notifyError("missing required name attribute for xsl:with-param"); + } + else { + if ( current->get(name) ) { + ExprResult* exprResult = processVariable(context, action, ps); + bindVariable(name, exprResult, MB_FALSE, ps); + } + } + } + } + } +} //-- processParameters /** * Processes the set of nodes using the given context, and ProcessorState @@ -1132,13 +1266,55 @@ void XSLProcessor::processTemplate(Node* node, Node* xslTemplate, ProcessorState //-- do default? } else { + Stack* bindings = ps->getVariableSetStack(); + NamedMap localBindings; + localBindings.setObjectDeletion(MB_TRUE); + bindings->push(&localBindings); NodeList* nl = xslTemplate->getChildNodes(); - for (int i = 0; i < nl->getLength(); i++) { + for (int i = 0; i < nl->getLength(); i++) processAction(node, nl->item(i), ps); - } + bindings->pop(); } } //-- processTemplate +/** + * Processes the set of nodes using the given context, and ProcessorState +**/ +void XSLProcessor::processTemplateParams + (Node* xslTemplate, Node* context, ProcessorState* ps) { + + if ( xslTemplate ) { + NodeList* nl = xslTemplate->getChildNodes(); + int i = 0; + //-- handle params + for (i = 0; i < nl->getLength(); i++) { + Node* tmpNode = nl->item(i); + int nodeType = tmpNode->getNodeType(); + if ( nodeType == Node::ELEMENT_NODE ) { + Element* action = (Element*)tmpNode; + String actionName = action->getNodeName(); + short xslType = getElementType(actionName, ps); + if ( xslType == XSLType::PARAM ) { + String name = action->getAttribute(NAME_ATTR); + if ( name.length() == 0 ) { + notifyError("missing required name attribute for xsl:param"); + } + else { + ExprResult* exprResult = processVariable(context, action, ps); + bindVariable(name, exprResult, MB_TRUE, ps); + } + } + else break; + } + else if (nodeType == Node::TEXT_NODE) { + if (!XMLUtils::isWhitespace(((Text*)tmpNode)->getData())) break; + } + else break; + } + } +} //-- processTemplateParams + + /** * processes the xslVariable parameter as an xsl:variable using the given context, * and ProcessorState. @@ -1155,8 +1331,8 @@ ExprResult* XSLProcessor::processVariable return new StringResult("unable to process variable"); } - //-- check for EXPR_ATTR - Attr* attr = xslVariable->getAttributeNode(EXPR_ATTR); + //-- check for select attribute + Attr* attr = xslVariable->getAttributeNode(SELECT_ATTR); if ( attr ) { Expr* expr = ps->getExpr(attr->getValue()); return expr->evaluate(node, ps); @@ -1175,7 +1351,7 @@ ExprResult* XSLProcessor::processVariable nodeSet->add(node); return nodeSet; } -} //-- processTemplate +} //-- processVariable /** * Performs the xsl:copy action as specified in the XSL Working Draft @@ -1190,14 +1366,6 @@ void XSLProcessor::xslCopy(Node* node, Element* action, ProcessorState* ps) { //-- just process children processTemplate(node, action, ps); break; - case Node::ATTRIBUTE_NODE: - { - Attr* attr = (Attr*) node; - Attr* copyAtt = resultDoc->createAttribute(attr->getName()); - copyAtt->setValue(attr->getValue()); - copy = copyAtt; - break; - } case Node::ELEMENT_NODE: { Element* element = (Element*)node; @@ -1211,47 +1379,43 @@ void XSLProcessor::xslCopy(Node* node, Element* action, ProcessorState* ps) { ps->getNodeStack()->pop(); return; } - case Node::CDATA_SECTION_NODE: - { - CDATASection* cdata = (CDATASection*)node; - copy = resultDoc->createCDATASection(cdata->getData()); - break; - } - case Node::TEXT_NODE: - { - Text* text = (Text*)node; - copy = resultDoc->createTextNode(text->getData()); - break; - } - case Node::PROCESSING_INSTRUCTION_NODE: - { - ProcessingInstruction* pi = (ProcessingInstruction*)node; - copy = resultDoc->createProcessingInstruction(pi->getTarget(), pi->getData()); - break; - } - case Node::COMMENT_NODE: - { - Comment* comment = (Comment*)node; - copy = resultDoc->createComment(comment->getData()); - break; - } + //-- just copy node, xsl:copy template does not get processed default: + copy = XMLDOMUtils::copyNode(node, resultDoc); break; } if ( copy ) ps->addToResultTree(copy); } //-- xslCopy +/** + * Performs the xsl:copy-of action as specified in the XSL Working Draft +**/ +void XSLProcessor::xslCopyOf(ExprResult* exprResult, ProcessorState* ps) { -#ifdef MOZILLA -NS_IMETHODIMP -XSLProcessor::TransformDocument(nsIDOMElement* aSourceDOM, - nsIDOMElement* aStyleDOM, - nsIDOMDocument* aOutputDoc, - nsIObserver* aObserver) -{ - return NS_OK; -} -#endif + if ( !exprResult ) return; + + Document* resultDoc = ps->getResultDocument(); + + switch ( exprResult->getResultType() ) { + case ExprResult::NODESET: + { + NodeSet* nodes = (NodeSet*)exprResult; + for (int i = 0; i < nodes->size();i++) { + Node* node = nodes->get(i); + ps->addToResultTree(XMLDOMUtils::copyNode(node, resultDoc)); + } + break; + } + default: + { + String value; + exprResult->stringValue(value); + ps->addToResultTree(resultDoc->createTextNode(value)); + break; + } + + } +} //-- xslCopyOf XSLType::XSLType() { this->type = LITERAL; diff --git a/mozilla/extensions/transformiix/source/xsl/XSLProcessor.h b/mozilla/extensions/transformiix/source/xsl/XSLProcessor.h index a314a4f0a80..fd4b6f8ac9e 100644 --- a/mozilla/extensions/transformiix/source/xsl/XSLProcessor.h +++ b/mozilla/extensions/transformiix/source/xsl/XSLProcessor.h @@ -1,89 +1,64 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * $Id: XSLProcessor.h,v 1.2 1999-11-15 07:13:08 nisheeth%netscape.com Exp $ */ + #ifndef MITREXSL_XSLPROCESSOR_H #define MITREXSL_XSLPROCESSOR_H -#ifdef MOZILLA -#include "nsIDocumentTransformer.h" -#else +#ifndef __BORLANDC__ #include #include -#include "CommandLineUtils.h" -#include "Printers.h" -#include "URIUtils.h" -#include "XMLParser.h" -#include "XMLDOMUtils.h" #endif +#include "CommandLineUtils.h" #include "dom.h" #include "ExprParser.h" #include "MITREObject.h" #include "NamedMap.h" #include "Names.h" #include "NodeSet.h" +#include "printers.h" #include "ProcessorState.h" #include "String.h" #include "Tokenizer.h" +#include "URIUtils.h" +#include "XMLDOMUtils.h" +#include "XMLParser.h" #include "ErrorObserver.h" #include "List.h" - -#ifdef MOZILLA - -/* bacd8ad0-552f-11d3-a9f7-000064657374 */ -#define MITRE_XSL_PROCESSOR_CID \ -{ 0xbacd8ad0, 0x552f, 0x11d3, {0xa9, 0xf7, 0x00, 0x00, 0x64, 0x65, 0x73, 0x74} } - -#endif +#include "VariableBinding.h" +#include "Numbering.h" /** * A class for Processing XSL Stylesheets - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:08 $ **/ -class XSLProcessor -#ifdef MOZILLA -: nsIDocumentTransformer -#endif -{ +class XSLProcessor { + public: -#ifdef MOZILLA - // Define a Create method to be used with a factory: - static NS_METHOD - Create(nsISupports* aOuter, const nsIID& aIID, void* *aResult); - - /** - * This macro expands into a declaration of the nsISupports interface. - * Every XPCOM component needs to implement nsISupports, as it acts - * as the gateway to other interfaces this component implements. You - * could manually declare QueryInterface, AddRef, and Release instead - * of using this macro, but why? - */ - // nsISupports interface - NS_DECL_ISUPPORTS - - // nsIDocumentTransformer methods - NS_IMETHOD TransformDocument(nsIDOMElement* aSourceDOM, - nsIDOMElement* aStyleDOM, - nsIDOMDocument* aOutputDoc, - nsIObserver* aObserver); -#endif /** * A warning message used by all templates that do not allow non character @@ -99,11 +74,7 @@ public: /** * Default destructor for XSLProcessor **/ -#ifdef MOZILLA - virtual ~XSLProcessor(); -#else ~XSLProcessor(); -#endif /** * Registers the given ErrorObserver with this XSLProcessor @@ -124,7 +95,6 @@ public: //-- Methods that return the Result Document -/ //--------------------------------------------/ -#ifndef MOZILLA /** * Parses all XML Stylesheet PIs associated with the * given XML document. If any stylesheet PIs are found with @@ -144,22 +114,24 @@ public: * @return the result tree. **/ Document* process(Document& xmlDocument, String& documentBase); -#endif /** * Processes the given XML Document using the given XSL document * @return the result tree. + * @param documentBase the document base for resolving relative URIs. **/ - Document* process(Document& xmlDocument, Document& xslDocument); + Document* process + (Document& xmlDocument, Document& xslDocument, String& documentBase); -#ifndef MOZILLA /** * Reads an XML Document from the given XML input stream, and * processes the document using the XSL document derived from * the given XSL input stream. + * @param documentBase the document base for resolving relative URIs. * @return the result tree. **/ - Document* process(istream& xmlInput, istream& xslInput); + Document* process(istream& xmlInput, istream& xslInput, + String& documentBase); /** * Reads an XML document from the given XML input stream. The @@ -185,14 +157,17 @@ public: * The result tree is printed to the given ostream argument, * will not close the ostream argument **/ - void process(istream& xmlInput, String& documentBase, ostream& out); + void process(istream& xmlInput, ostream& out, String& documentBase); /** * Processes the given XML Document using the given XSL document. * The result tree is printed to the given ostream argument, * will not close the ostream argument + * @param documentBase the document base for resolving relative URIs. **/ - void process(Document& xmlDocument, Document& xslDocument, ostream& out); + void process + (Document& xmlDocument, Document& xslDocument, + ostream& out, String& documentBase); /** * Reads an XML Document from the given XML input stream, and @@ -200,9 +175,11 @@ public: * the given XSL input stream. * The result tree is printed to the given ostream argument, * will not close the ostream argument + * @param documentBase the document base for resolving relative URIs. **/ - void process(istream& xmlInput, istream& xslInput, ostream& out); -#endif + void process(istream& xmlInput, istream& xslInput, + ostream& out, String& documentBase); + private: @@ -239,13 +216,20 @@ private: NamedMap xslTypes; /** - * Binds the given ExprResult to the given name + * Binds the given Variable **/ - void bindVariable(String& name, ExprResult* exprResult, ProcessorState* ps); + void bindVariable(String& name, + ExprResult* value, + MBool allowShadowing, + ProcessorState* ps); -#ifndef MOZILLA XMLPrinter* createPrinter(Document& xslDocument, ostream& out); -#endif + + + /** + * Processes the xsl:with-param elements of the given xsl action + **/ + void processParameters(Element* xslAction, Node* context, ProcessorState* ps); /** * Looks up the given XSLType with the given name @@ -282,12 +266,10 @@ private: **/ void notifyError(String& errorMessage, ErrorObserver::ErrorLevel level); -#ifndef MOZILLA /** * Parses the contents of data, and returns the type and href psuedo attributes **/ void parseStylesheetPI(String& data, String& type, String& href); -#endif void process(Node* node, Node* context, ProcessorState* ps); void process(Node* node, Node* context, String* mode, ProcessorState* ps); @@ -310,6 +292,9 @@ private: (const String& attValue, String& result, Node* context, ProcessorState* ps); void processTemplate(Node* node, Node* xslTemplate, ProcessorState* ps); + void processTemplateParams(Node* xslTemplate, Node* context, ProcessorState* ps); + + void processTopLevel(Document* xslDocument, ProcessorState* ps); ExprResult* processVariable(Node* node, Element* xslVariable, ProcessorState* ps); @@ -318,6 +303,11 @@ private: **/ void xslCopy(Node* node, Element* action, ProcessorState* ps); + /** + * Performs the xsl:copy-of action as specified in the XSL Working Draft + **/ + void xslCopyOf(ExprResult* exprResult, ProcessorState* ps); + }; //-- XSLProcessor class XSLType : public MITREObject { @@ -335,6 +325,7 @@ public: COPY_OF, ELEMENT, IF, + INCLUDE, FOR_EACH, LITERAL, NUMBER, @@ -348,6 +339,7 @@ public: VALUE_OF, VARIABLE, WHEN, + WITH_PARAM, MESSAGE, EXPR_DEBUG, // temporary, used for debugging }; diff --git a/mozilla/extensions/transformiix/source/xsl/expr/AdditiveExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/AdditiveExpr.cpp index 21c26518a97..fd3f93489f3 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/AdditiveExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/AdditiveExpr.cpp @@ -1,30 +1,36 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: AdditiveExpr.cpp,v 1.2 1999-11-15 07:13:09 nisheeth%netscape.com Exp $ */ /** * Represents a AdditiveExpr, an binary expression that * performs an additive operation between it's lvalue and rvalue:
* + : addition - * - : substraction - * @author Keith Visco + * - : subtraction + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:09 $ **/ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/AttributeExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/AttributeExpr.cpp index 2f6af415129..6a9af5f011d 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/AttributeExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/AttributeExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: AttributeExpr.cpp,v 1.2 1999-11-15 07:13:09 nisheeth%netscape.com Exp $ */ #include "Expr.h" @@ -24,10 +29,8 @@ /** * This class represents a ElementExpr as defined by the XSL * Working Draft - *
- * 
- * @author Keith Visco - * This file was ported from XSL:P + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:09 $ **/ //- Constructors -/ diff --git a/mozilla/extensions/transformiix/source/xsl/expr/AttributeValueTemplate.cpp b/mozilla/extensions/transformiix/source/xsl/expr/AttributeValueTemplate.cpp index b807a03b7a0..fa94d8b824e 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/AttributeValueTemplate.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/AttributeValueTemplate.cpp @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: AttributeValueTemplate.cpp,v 1.2 1999-11-15 07:13:09 nisheeth%netscape.com Exp $ */ /** * AttributeValueTemplate - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:09 $ **/ #include "Expr.h" @@ -91,5 +97,3 @@ void AttributeValueTemplate::toString(String& str) { delete iter; } //-- toString - - diff --git a/mozilla/extensions/transformiix/source/xsl/expr/BasicNodeExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/BasicNodeExpr.cpp index 74e52e13955..5bb8b813a2e 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/BasicNodeExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/BasicNodeExpr.cpp @@ -1,29 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: BasicNodeExpr.cpp,v 1.2 1999-11-15 07:13:09 nisheeth%netscape.com Exp $ */ #include "Expr.h" /** - * @author Keith Visco - * This file was ported from XSL:P + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:09 $ **/ //- Constructors -/ diff --git a/mozilla/extensions/transformiix/source/xsl/expr/BooleanFunctionCall.cpp b/mozilla/extensions/transformiix/source/xsl/expr/BooleanFunctionCall.cpp index c4cd126a80f..0726ba08069 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/BooleanFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/BooleanFunctionCall.cpp @@ -1,30 +1,37 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: BooleanFunctionCall.cpp,v 1.2 1999-11-15 07:13:10 nisheeth%netscape.com Exp $ */ #include "FunctionLib.h" /** * Creates a default BooleanFunctionCall, which always evaluates to False + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:10 $ **/ -BooleanFunctionCall::BooleanFunctionCall() : FunctionCall(FALSE_FN) { +BooleanFunctionCall::BooleanFunctionCall() : FunctionCall(XPathNames::FALSE_FN) { this->type = FALSE; } //-- BooleanFunctionCall @@ -35,16 +42,16 @@ BooleanFunctionCall::BooleanFunctionCall(short type) : FunctionCall() { switch ( type ) { case BOOLEAN : - FunctionCall::setName(BOOLEAN_FN); + FunctionCall::setName(XPathNames::BOOLEAN_FN); break; case NOT : - FunctionCall::setName(NOT_FN); + FunctionCall::setName(XPathNames::NOT_FN); break; case TRUE : - FunctionCall::setName(TRUE_FN); + FunctionCall::setName(XPathNames::TRUE_FN); break; default: - FunctionCall::setName(FALSE_FN); + FunctionCall::setName(XPathNames::FALSE_FN); break; } this->type = type; diff --git a/mozilla/extensions/transformiix/source/xsl/expr/BooleanResult.cpp b/mozilla/extensions/transformiix/source/xsl/expr/BooleanResult.cpp index 6e92a1dbf75..7c0711a7800 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/BooleanResult.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/BooleanResult.cpp @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: BooleanResult.cpp,v 1.2 1999-11-15 07:13:10 nisheeth%netscape.com Exp $ */ /** * Boolean Expression result - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:10 $ **/ #include "ExprResult.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ElementExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/ElementExpr.cpp index 3f596d634ba..de6d2ded310 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ElementExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/ElementExpr.cpp @@ -1,38 +1,36 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: ElementExpr.cpp,v 1.2 1999-11-15 07:13:10 nisheeth%netscape.com Exp $ */ -/** - * ElementExpr - * @author Keith Visco -**/ - #include "Expr.h" /** - * This class represents a ElementExpr as defined by the XSL - * Working Draft - *
- * 
- * @author Keith Visco - * This file was ported from XSL:P + * This class represents a ElementExpr as defined by XPath 1.0 + * proposed recommendation + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:10 $ **/ //- Constructors -/ @@ -144,5 +142,3 @@ void ElementExpr::toString(String& dest) { dest.append(this->name); } //-- toString - - diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ErrorFunctionCall.cpp b/mozilla/extensions/transformiix/source/xsl/expr/ErrorFunctionCall.cpp index 9ed4a7f1903..30a7e9995bd 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ErrorFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/ErrorFunctionCall.cpp @@ -1,35 +1,47 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: ErrorFunctionCall.cpp,v 1.2 1999-11-15 07:13:10 nisheeth%netscape.com Exp $ */ #include "FunctionLib.h" +/** + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:10 $ +**/ + /** * Creates an Error FunctionCall with no error message **/ -ErrorFunctionCall::ErrorFunctionCall() : FunctionCall(ERROR_FN) {}; +ErrorFunctionCall::ErrorFunctionCall() : FunctionCall(XPathNames::ERROR_FN) {}; /** * Creates an Error FunctionCall with the given error message **/ -ErrorFunctionCall::ErrorFunctionCall(const String& errorMsg) : FunctionCall(ERROR_FN) { +ErrorFunctionCall::ErrorFunctionCall + (const String& errorMsg) : FunctionCall(XPathNames::ERROR_FN) +{ //-- copy errorMsg this->errorMessage = errorMsg; } //-- ErrorFunctionCall @@ -49,3 +61,4 @@ void ErrorFunctionCall::setErrorMessage(String& errorMsg) { //-- copy errorMsg this->errorMessage = errorMsg; } //-- setError + diff --git a/mozilla/extensions/transformiix/source/xsl/expr/Expr.h b/mozilla/extensions/transformiix/source/xsl/expr/Expr.h index bbb74f18d51..667b6d4d8fd 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/Expr.h +++ b/mozilla/extensions/transformiix/source/xsl/expr/Expr.h @@ -1,36 +1,38 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * Larry Fitzpatick, OpenText, lef@opentext.com + * -- 19990806 + * - changed constant short declarations in many of the classes + * with enumerations, commented with //--LF * + * $Id: Expr.h,v 1.2 1999-11-15 07:13:10 nisheeth%netscape.com Exp $ */ /** * XSL expression class definitions. * Much of this code was ported from XSL:P.
- * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *   - changed constant short declarations in many of the classes
- *     with enumerations, commented with //--LF
- * 
- * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:10 $ **/ #ifndef MITREXSL_EXPR_H @@ -53,8 +55,8 @@ public: /** * Returns the value of a given variable binding within the current scope * @param the name to which the desired variable value has been bound - * @return the ExprResult which has been bound to the variable with the given - * name + * @return the ExprResult which has been bound to the variable with + * the given name **/ virtual ExprResult* getVariable(String& name) = 0; @@ -66,11 +68,18 @@ public: virtual MBool isStripSpaceAllowed(Node* node) = 0; + /** + * handles finding the parent of a node, since in DOM some + * nodes such as Attribute Nodes do not have parents + * @param node the Node to search for the parent of + * @return the parent of the given node, or null + **/ + virtual Node* findParent(Node* node) = 0; + }; //-- ContextState /** * A Base Class for all XSL Expressions - * @author Keith Visco **/ class Expr : public MITREObject { @@ -105,7 +114,6 @@ public: /** * A base Pattern class - * @author Keith Visco **/ class Pattern { @@ -146,7 +154,6 @@ public: /** * A Base class for all Expressions and Patterns - * @author Keith Visco **/ class PatternExpr : public Expr, @@ -238,10 +245,6 @@ private: /** * This class represents a NodeTestExpr as defined by the XSL * Working Draft - *
- * 
- * @author Keith Visco (kvisco@mitre.org) - * This file was ported from XSL:P **/ class NodeExpr : public PatternExpr { @@ -301,8 +304,6 @@ public: /** * This class represents a AttributeExpr as defined by the XSL * Working Draft - * @author Keith Visco - * This file was ported from XSL:P **/ class AttributeExpr : public NodeExpr { @@ -381,8 +382,7 @@ private: }; //-- AttributeExpr /** - * @author Keith Visco - * This file was ported from XSL:P + * **/ class BasicNodeExpr : public NodeExpr { @@ -458,10 +458,6 @@ private: /** * This class represents a ElementExpr as defined by the XSL * Working Draft - *
- * 
- * @author Keith Visco (kvisco@mitre.org) - * This file was ported from XSL:P **/ class ElementExpr : public NodeExpr { @@ -539,8 +535,6 @@ private: /** * This class represents a IdentityExpr, which only matches a node * if it is equal to the context node - * @author Keith Visco - *
This class was ported from XSL:P, an open source Java based XSL processor **/ class IdentityExpr : public Expr { @@ -574,8 +568,6 @@ public: /** * This class represents a ParentExpr, which only selects a node * if it is equal to the context node's parent - * @author Keith Visco - *
This class was ported from XSL:P, an open source Java based XSL processor **/ class ParentExpr : public Expr { @@ -609,8 +601,6 @@ public: /** * This class represents a TextExpr, which only matches any text node - * @author Keith Visco - *
This class was ported from XSL:P, an open source Java based XSL processor **/ class TextExpr : public NodeExpr { @@ -665,10 +655,6 @@ public: /** * This class represents a WildCardExpr as defined by the XSL * Working Draft - *
- * 
- * @author Keith Visco - *
This class was ported from XSL:P, an open source Java based XSL processor **/ class WildCardExpr : public NodeExpr { @@ -724,7 +710,6 @@ public: /** * Represents an ordered list of Predicates, * for use with Step and Filter Expressions - * @author Keith Visco **/ class PredicateList { @@ -1021,6 +1006,7 @@ private: String value; }; //-- StringExpr + /** * Represents an AdditiveExpr, a binary expression that * performs an additive operation between it's lvalue and rvalue:
@@ -1077,6 +1063,59 @@ private: Expr* rightExpr; }; //-- AdditiveExpr +/** + * Represents a BooleanExpr, a binary expression that + * performs a boolean operation between it's lvalue and rvalue:
+**/ +class BooleanExpr : public Expr { + +public: + + //-- BooleanExpr Types + enum _BooleanExprType { AND = 1, OR }; + + BooleanExpr(); + BooleanExpr(Expr* leftExpr, Expr* rightExpr, short op); + ~BooleanExpr(); + + /** + * Sets the left side of this AdditiveExpr + **/ + void setLeftExpr(Expr* leftExpr); + + /** + * Sets the right side of this AdditiveExpr + **/ + void setRightExpr(Expr* rightExpr); + + + /** + * Evaluates this Expr based on the given context node and processor state + * @param context the context node for evaluation of this Expr + * @param ps the ContextState containing the stack information needed + * for evaluation + * @return the result of the evaluation + **/ + virtual ExprResult* evaluate(Node* context, ContextState* cs); + + /** + * Returns the String representation of this Expr. + * @param dest the String to use when creating the String + * representation. The String representation will be appended to + * any data in the destination String, to allow cascading calls to + * other #toString() methods for Expressions. + * @return the String representation of this Expr. + **/ + virtual void toString(String& str); + + + +private: + short op; + Expr* leftExpr; + Expr* rightExpr; +}; //-- BooleanExpr + /** * Represents a MultiplicativeExpr, a binary expression that * performs a multiplicative operation between it's lvalue and rvalue:
@@ -1194,7 +1233,6 @@ private: /** * VariableRefExpr
* Represents a variable reference ($refname) - * @author Keith Visco **/ class VariableRefExpr : public Expr { @@ -1236,7 +1274,6 @@ private: /** * Represents a PathExpr - * @author Keith Visco **/ class PathExpr : public PatternExpr { @@ -1332,8 +1369,6 @@ private: /** * This class represents a RootExpr, which only matches the Document node - * @author Keith Visco - *
This class was ported from XSL:P, an open source Java based XSL processor **/ class RootExpr : public PathExpr { @@ -1383,7 +1418,6 @@ public: /** * Represents a UnionExpr - * @author Keith Visco **/ class UnionExpr : public PatternExpr { diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.cpp b/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.cpp index 2cf8da1ac06..c20a7c5f4ee 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.cpp @@ -1,27 +1,37 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * -- fixed bug with '<=' and '>=' reported by Bob Miller + * + * Bob Miller, Oblix Inc., kbob@oblix.com + * -- fixed bug with single quotes inside double quotes + * + * $Id: ExprLexer.cpp,v 1.2 1999-11-15 07:13:11 nisheeth%netscape.com Exp $ */ /** * Lexical analyzer for XPath expressions - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:11 $ **/ #include @@ -92,10 +102,15 @@ const String ExprLexer::NODE = "node"; const String ExprLexer::PI = "processing-instruction"; const String ExprLexer::TEXT = "text"; +//-- boolean +const String ExprLexer::AND = "and"; +const String ExprLexer::OR = "or"; + //-- multiplicative operators const String ExprLexer::MODULUS = "mod"; const String ExprLexer::DIVIDE = "div"; + /** * The set of a XSL Expression Tokens **/ @@ -106,12 +121,16 @@ const Token ExprLexer::TOKENS[] = { Token(ExprLexer::NODE, Token::NODE), Token(ExprLexer::PI, Token::PI), Token(ExprLexer::TEXT, Token::TEXT), + //-- boolean operators + Token(ExprLexer::AND, Token::AND_OP), + Token(ExprLexer::OR, Token::OR_OP), + //-- multiplicative operators Token(ExprLexer::MODULUS, Token::MODULUS_OP), Token(ExprLexer::DIVIDE, Token::DIVIDE_OP) }; -const short ExprLexer::NUMBER_OF_TOKENS = 6; +const short ExprLexer::NUMBER_OF_TOKENS = 8; //---------------/ //- Contructors -/ @@ -276,6 +295,9 @@ MBool ExprLexer::isValidQName(String& name) { MBool ExprLexer::isOperatorToken(Token* token) { if ( !token ) return MB_FALSE; switch ( token->type ) { + //-- boolean operators + case Token::AND_OP: + case Token::OR_OP: //-- relational operators case Token::EQUAL_OP: case Token::NOT_EQUAL_OP: @@ -318,6 +340,12 @@ MBool ExprLexer::matchDelimiter(UNICODE_CHAR ch) { case R_BRACKET : tokenType = Token::R_BRACKET; break; + case L_ANGLE : + tokenType = Token::LESS_THAN_OP; + break; + case R_ANGLE : + tokenType = Token::GREATER_THAN_OP; + break; case COMMA : tokenType = Token::COMMA; break; @@ -470,7 +498,7 @@ void ExprLexer::parse(const String& pattern) { String tokenBuffer; - MBool inLiteral = MB_FALSE; + UNICODE_CHAR inLiteral = '\0'; MBool inNumber = MB_FALSE; Int32 currentPos = 0; @@ -491,8 +519,8 @@ void ExprLexer::parse(const String& pattern) { if ( inLiteral ) { //-- look for end of literal - if ( ch == S_QUOTE ) { - inLiteral = MB_FALSE; + if ( ch == inLiteral ) { + inLiteral = '\0'; addToken(new Token(tokenBuffer, Token::LITERAL)); tokenBuffer.clear(); } @@ -532,8 +560,9 @@ void ExprLexer::parse(const String& pattern) { case LF: break; case S_QUOTE : + case D_QUOTE : matchToken(tokenBuffer, ch); - inLiteral = MB_TRUE; + inLiteral = ch; break; case PERIOD: if ( inNumber ) tokenBuffer.append(ch); @@ -562,11 +591,26 @@ void ExprLexer::parse(const String& pattern) { case BANG : //-- used as previous...see EQUAL break; case EQUAL: + switch ( prevCh ) { + case BANG: + prevToken->type = Token::NOT_EQUAL_OP; + break; + case L_ANGLE: + prevToken->type = Token::LESS_OR_EQUAL_OP; + break; + case R_ANGLE: + prevToken->type = Token::GREATER_OR_EQUAL_OP; + break; + default: + matchToken(tokenBuffer, ch); + matchDelimiter(ch); + break; + } + break; + case L_ANGLE : + case R_ANGLE : matchToken(tokenBuffer, ch); matchDelimiter(ch); - if ( prevCh == BANG ) { - prevToken->type = Token::NOT_EQUAL_OP; - } break; case HYPHEN : if ( isValidQName(tokenBuffer) ) tokenBuffer.append(ch); diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.h b/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.h index c75119467cb..261e9b1b40d 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.h +++ b/mozilla/extensions/transformiix/source/xsl/expr/ExprLexer.h @@ -1,22 +1,31 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * Larry Fitzpatrick + * -- changed constant short declarations in Token and ExprLexer to + * enumerations, commented with //--LF + * + * $Id: ExprLexer.h,v 1.2 1999-11-15 07:13:11 nisheeth%netscape.com Exp $ */ @@ -29,16 +38,11 @@ /** * A Token class for the ExprLexer. - *
This class was ported from XSL:P, an open source Java based XSL processor - * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *   - changed constant short declarations in Token and ExprLexer to
- *     enumerations, commented with //--LF
- * 
- * + *
+ * This class was ported from XSL:P, an open source Java based + * XSLT processor, written by yours truly. + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:11 $ **/ class Token { @@ -50,7 +54,7 @@ public: //-- LF - changed from static const short declarations to enum //-- token types - enum _TokenTypes { + enum TokenType { //-- Trivial Tokens ERROR = 0, NULL_TOKEN, @@ -72,6 +76,11 @@ public: //-------------/ //- operators -/ //-------------/ + + //-- boolean ops + AND_OP, + OR_OP, + //-- relational EQUAL_OP, NOT_EQUAL_OP, @@ -132,11 +141,14 @@ public: */ //-- LF, changed to enum enum _TrivialTokens { + D_QUOTE = '\"', S_QUOTE = '\'', L_PAREN = '(', R_PAREN = ')', L_BRACKET = '[', R_BRACKET = ']', + L_ANGLE = '<', + R_ANGLE = '>', COMMA = ',', PERIOD = '.', ASTERIX = '*', @@ -166,6 +178,10 @@ public: static const String PI; static const String TEXT; + //-- boolean + static const String AND; + static const String OR; + //-- Multiplicative static const String MODULUS; static const String DIVIDE; @@ -272,3 +288,4 @@ private: }; //-- ExprLexer #endif + diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.cpp b/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.cpp index 8d69f23f0a1..e1205f288af 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.cpp @@ -1,29 +1,35 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: ExprParser.cpp,v 1.2 1999-11-15 07:13:11 nisheeth%netscape.com Exp $ */ /** * ExprParser * This class is used to parse XSL Expressions - * @author Keith Visco + * @author Keith Visco * @see ExprLexer + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:11 $ **/ #include "ExprParser.h" @@ -159,18 +165,43 @@ LocationStep* ExprParser::createLocationStep(const String& path) { Expr* ExprParser::createBinaryExpr (Expr* left, Expr* right, Token* op) { if ( !op ) return 0; switch(op->type) { + + + //-- additive ops case Token::ADDITION_OP : return new AdditiveExpr(left, right, AdditiveExpr::ADDITION); - case Token::DIVIDE_OP : - return new MultiplicativeExpr(left, right, MultiplicativeExpr::DIVIDE); + case Token::SUBTRACTION_OP: + return new AdditiveExpr(left, right, AdditiveExpr::SUBTRACTION); + + //-- case boolean ops + case Token::AND_OP: + return new BooleanExpr(left, right, BooleanExpr::AND); + case Token::OR_OP: + return new BooleanExpr(left, right, BooleanExpr::OR); + + //-- equality ops case Token::EQUAL_OP : return new RelationalExpr(left, right, RelationalExpr::EQUAL); + case Token::NOT_EQUAL_OP : + return new RelationalExpr(left, right, RelationalExpr::NOT_EQUAL); + + //-- relational ops + case Token::LESS_THAN_OP: + return new RelationalExpr(left, right, RelationalExpr::LESS_THAN); + case Token::GREATER_THAN_OP: + return new RelationalExpr(left, right, RelationalExpr::GREATER_THAN); + case Token::LESS_OR_EQUAL_OP: + return new RelationalExpr(left, right, RelationalExpr::LESS_OR_EQUAL); + case Token::GREATER_OR_EQUAL_OP: + return new RelationalExpr(left, right, RelationalExpr::GREATER_OR_EQUAL); + + //-- multiplicative ops + case Token::DIVIDE_OP : + return new MultiplicativeExpr(left, right, MultiplicativeExpr::DIVIDE); case Token::MODULUS_OP : return new MultiplicativeExpr(left, right, MultiplicativeExpr::MODULUS); case Token::MULTIPLY_OP : return new MultiplicativeExpr(left, right, MultiplicativeExpr::MULTIPLY); - case Token::SUBTRACTION_OP: - return new AdditiveExpr(left, right, AdditiveExpr::SUBTRACTION); default: break; @@ -186,6 +217,9 @@ Expr* ExprParser::createExpr(ExprLexer& lexer) { Expr* expr = 0; + Stack exprs; + Stack ops; + while ( lexer.hasMoreTokens() && (!done)) { Token* tok = lexer.nextToken(); @@ -245,16 +279,34 @@ Expr* ExprParser::createExpr(ExprLexer& lexer) { case Token::VAR_REFERENCE: expr = new VariableRefExpr(tok->value); break; + //-- additive ops case Token::ADDITION_OP: case Token::DIVIDE_OP: + //-- boolean ops + case Token::AND_OP : + case Token::OR_OP : + //-- equality ops case Token::EQUAL_OP: + case Token::NOT_EQUAL_OP: + //-- relational ops + case Token::LESS_THAN_OP: + case Token::GREATER_THAN_OP: + case Token::LESS_OR_EQUAL_OP: + case Token::GREATER_OR_EQUAL_OP: + //-- multiplicative ops case Token::MODULUS_OP: case Token::MULTIPLY_OP: case Token::SUBTRACTION_OP: { - Expr* left = expr; - Expr* right = createExpr(lexer); - expr = createBinaryExpr(left, right, tok); + if ( !exprs.empty() ) { + short ttype = ((Token*)ops.peek())->type; + if (precedenceLevel(tok->type) < precedenceLevel(ttype)) { + expr = createBinaryExpr((Expr*)exprs.pop(), expr, + (Token*)ops.pop()); + } + } + exprs.push(expr); + ops.push(tok); break; } default: @@ -263,6 +315,10 @@ Expr* ExprParser::createExpr(ExprLexer& lexer) { break; } } + + while (!exprs.empty() ) { + expr = createBinaryExpr((Expr*)exprs.pop(), expr, (Token*)ops.pop()); + } return expr; } //-- createExpr @@ -334,61 +390,61 @@ FunctionCall* ExprParser::createFunctionCall(ExprLexer& lexer) { //-- compare function names //-- * we should hash these names for speed - if ( BOOLEAN_FN.isEqual(tok->value) ) { + if ( XPathNames::BOOLEAN_FN.isEqual(tok->value) ) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::BOOLEAN); } - else if ( CONCAT_FN.isEqual(tok->value) ) { + else if ( XPathNames::CONCAT_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::CONCAT); } - else if ( CONTAINS_FN.isEqual(tok->value) ) { + else if ( XPathNames::CONTAINS_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::CONTAINS); } - else if ( COUNT_FN.isEqual(tok->value) ) { + else if ( XPathNames::COUNT_FN.isEqual(tok->value) ) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::COUNT); } - else if ( FALSE_FN.isEqual(tok->value) ) { + else if ( XPathNames::FALSE_FN.isEqual(tok->value) ) { fnCall = new BooleanFunctionCall(); } - else if ( LAST_FN.isEqual(tok->value) ) { + else if ( XPathNames::LAST_FN.isEqual(tok->value) ) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::LAST); } - else if ( LOCAL_PART_FN.isEqual(tok->value) ) { - fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::LOCAL_PART); + else if ( XPathNames::LOCAL_NAME_FN.isEqual(tok->value) ) { + fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::LOCAL_NAME); } - else if ( NAME_FN.isEqual(tok->value) ) { + else if ( XPathNames::NAME_FN.isEqual(tok->value) ) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::NAME); } - else if ( NAMESPACE_FN.isEqual(tok->value) ) { - fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::NAMESPACE); + else if ( XPathNames::NAMESPACE_URI_FN.isEqual(tok->value) ) { + fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::NAMESPACE_URI); } - else if ( NOT_FN.isEqual(tok->value) ) { + else if ( XPathNames::NOT_FN.isEqual(tok->value) ) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::NOT); } - else if ( POSITION_FN.isEqual(tok->value) ) { + else if ( XPathNames::POSITION_FN.isEqual(tok->value) ) { fnCall = new NodeSetFunctionCall(NodeSetFunctionCall::POSITION); } - else if ( STARTS_WITH_FN.isEqual(tok->value) ) { + else if ( XPathNames::STARTS_WITH_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::STARTS_WITH); } - else if ( STRING_FN.isEqual(tok->value) ) { + else if ( XPathNames::STRING_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::STRING); } - else if ( STRING_LENGTH_FN.isEqual(tok->value) ) { + else if ( XPathNames::STRING_LENGTH_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::STRING_LENGTH); } - else if ( SUBSTRING_FN.isEqual(tok->value) ) { + else if ( XPathNames::SUBSTRING_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::SUBSTRING); } - else if ( SUBSTRING_AFTER_FN.isEqual(tok->value) ) { + else if ( XPathNames::SUBSTRING_AFTER_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::SUBSTRING_AFTER); } - else if ( SUBSTRING_BEFORE_FN.isEqual(tok->value) ) { + else if ( XPathNames::SUBSTRING_BEFORE_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::SUBSTRING_BEFORE); } - else if ( TRANSLATE_FN.isEqual(tok->value) ) { + else if ( XPathNames::TRANSLATE_FN.isEqual(tok->value) ) { fnCall = new StringFunctionCall(StringFunctionCall::TRANSLATE); } - else if ( TRUE_FN.isEqual(tok->value) ) { + else if ( XPathNames::TRUE_FN.isEqual(tok->value) ) { fnCall = new BooleanFunctionCall(BooleanFunctionCall::TRUE); } else { @@ -791,3 +847,34 @@ String* ExprParser::parseParameters(List* list, ExprLexer& lexer) { } //-- parseParameters +short ExprParser::precedenceLevel(short tokenType) { + switch(tokenType) { + case Token::OR_OP: + return 1; + case Token::AND_OP: + return 2; + //-- equality + case Token::EQUAL_OP: + case Token::NOT_EQUAL_OP: + return 3; + //-- relational + case Token::LESS_THAN_OP: + case Token::GREATER_THAN_OP: + case Token::LESS_OR_EQUAL_OP: + case Token::GREATER_OR_EQUAL_OP: + return 4; + //-- additive operators + case Token::ADDITION_OP: + case Token::SUBTRACTION_OP: + return 5; + //-- multiplicative + case Token::DIVIDE_OP: + case Token::MULTIPLY_OP: + case Token::MODULUS_OP: + return 6; + default: + break; + } + return 0; +} //-- precedenceLevel + diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.h b/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.h index d97d10a56a6..4cb04231467 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.h +++ b/mozilla/extensions/transformiix/source/xsl/expr/ExprParser.h @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: ExprParser.h,v 1.2 1999-11-15 07:13:11 nisheeth%netscape.com Exp $ */ /** * ExprParser * This class is used to parse XSL Expressions - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:11 $ * @see ExprLexer **/ @@ -34,7 +40,7 @@ #include "Expr.h" #include "FunctionLib.h" #include "List.h" -#include "Names.h" +#include "Stack.h" #include class ExprParser { @@ -81,6 +87,8 @@ private: MBool isLocationStepToken (Token* tok); MBool isNodeTypeToken (Token* tok); + static short precedenceLevel (short tokenType); + /** * Using the given lexer, parses the tokens if they represent a predicate list * If an error occurs a non-zero String pointer will be returned containing the diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ExprResult.h b/mozilla/extensions/transformiix/source/xsl/expr/ExprResult.h index 5c895927a1b..4f3f0532b62 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ExprResult.h +++ b/mozilla/extensions/transformiix/source/xsl/expr/ExprResult.h @@ -1,14 +1,29 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The program is provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- changed constant short result types to enum + * + * $Id: ExprResult.h,v 1.2 1999-11-15 07:13:11 nisheeth%netscape.com Exp $ */ #include "MITREObject.h" @@ -27,19 +42,10 @@ * BooleanResult, ExprResult, NumberResult, StringResult *
* Note: for NodeSet, see NodeSet.h
- * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *   - changed constant short result types to enum
- * 
+ * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:11 $ */ -/** - * Represents the result of an expression evaluation - * @author Keith Visco -**/ class ExprResult : public MITREObject { public: diff --git a/mozilla/extensions/transformiix/source/xsl/expr/FilterExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/FilterExpr.cpp index 8fa1d9a7fec..217c2506456 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/FilterExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/FilterExpr.cpp @@ -1,29 +1,35 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: FilterExpr.cpp,v 1.2 1999-11-15 07:13:11 nisheeth%netscape.com Exp $ */ #include "Expr.h" /** - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:11 $ **/ //-- Implementation of FilterExpr --/ diff --git a/mozilla/extensions/transformiix/source/xsl/expr/FunctionCall.cpp b/mozilla/extensions/transformiix/source/xsl/expr/FunctionCall.cpp index 7d3ab235d1e..88a75416dc3 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/FunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/FunctionCall.cpp @@ -1,30 +1,35 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: FunctionCall.cpp,v 1.2 1999-11-15 07:13:11 nisheeth%netscape.com Exp $ */ #include "FunctionLib.h" /** * This class represents a FunctionCall as defined by the XSL Working Draft - * @author Keith Visco - * This file was ported from XSL:P + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:11 $ **/ const String FunctionCall::INVALID_PARAM_COUNT = diff --git a/mozilla/extensions/transformiix/source/xsl/expr/FunctionLib.h b/mozilla/extensions/transformiix/source/xsl/expr/FunctionLib.h index 926173af230..8e4112c6903 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/FunctionLib.h +++ b/mozilla/extensions/transformiix/source/xsl/expr/FunctionLib.h @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: FunctionLib.h,v 1.2 1999-11-15 07:13:12 nisheeth%netscape.com Exp $ */ @@ -36,6 +41,36 @@ #include "XMLUtils.h" #include +class XPathNames { + +public: +//-- Function Names +static const String BOOLEAN_FN; +static const String CONCAT_FN; +static const String CONTAINS_FN; +static const String COUNT_FN ; +static const String FALSE_FN; +static const String LAST_FN; +static const String LOCAL_NAME_FN; +static const String NAME_FN; +static const String NAMESPACE_URI_FN; +static const String NOT_FN; +static const String POSITION_FN; +static const String STARTS_WITH_FN; +static const String STRING_FN; +static const String STRING_LENGTH_FN; +static const String SUBSTRING_FN; +static const String SUBSTRING_AFTER_FN; +static const String SUBSTRING_BEFORE_FN; +static const String TRANSLATE_FN; +static const String TRUE_FN; + +//-- internal XSL processor functions +static const String ERROR_FN; + + +}; //-- XPathNames + /** * This class represents a FunctionCall as defined by the XSL * Working Draft. @@ -205,8 +240,8 @@ public: enum _NodeSetFunctions { COUNT = 1, //-- count() LAST, //-- last() - LOCAL_PART, //-- local-part() - NAMESPACE, //-- namespace() + LOCAL_NAME, //-- local-name() + NAMESPACE_URI, //-- namespace-uri() NAME, //-- name() POSITION //-- position() }; diff --git a/mozilla/extensions/transformiix/source/xsl/expr/IdentityExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/IdentityExpr.cpp index 2616ef61c6c..c8fd3410c27 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/IdentityExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/IdentityExpr.cpp @@ -1,26 +1,32 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: IdentityExpr.cpp,v 1.2 1999-11-15 07:13:12 nisheeth%netscape.com Exp $ */ /** - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:12 $ **/ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/LocationStep.cpp b/mozilla/extensions/transformiix/source/xsl/expr/LocationStep.cpp index 606c3d6fc6b..f1135e751a3 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/LocationStep.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/LocationStep.cpp @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: LocationStep.cpp,v 1.2 1999-11-15 07:13:12 nisheeth%netscape.com Exp $ */ /** * LocationStep - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:12 $ **/ #include "Expr.h" @@ -250,10 +256,14 @@ void LocationStep::fromDescendants(Node* context, ContextState* cs, NodeSet* nod MBool LocationStep::matches(Node* node, Node* context, ContextState* cs) { if ( !nodeExpr ) return MB_FALSE; - NodeSet* nodes = (NodeSet*) evaluate(context, cs); - MBool result = nodes->contains(node); - delete nodes; - return result; + + if ( !nodeExpr->matches(node, context, cs) ) return MB_FALSE; + + NodeSet nodes; + nodes.add(node); + evaluatePredicates(&nodes, cs); + if (nodes.size() > 0) return MB_TRUE; + return MB_FALSE; } //-- matches diff --git a/mozilla/extensions/transformiix/source/xsl/expr/Makefile b/mozilla/extensions/transformiix/source/xsl/expr/Makefile index 42d1c45776e..79c10d1b43b 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/Makefile +++ b/mozilla/extensions/transformiix/source/xsl/expr/Makefile @@ -1,6 +1,6 @@ target: exprlib -CC = g++ +CC := $(CC) -g EXPR_PATH = . ROOT_PATH = ../.. @@ -10,12 +10,12 @@ BASE_PATH = $(ROOT_PATH)/base XSLUTIL_PATH = $(PROCESSOR_PATH)/util PROCESSOR_PATH = .. -INCLUDE_PATHS = -I $(EXPR_PATH) \ - -I $(DOM_PATH) \ - -I $(BASE_PATH) \ - -I $(XML_PATH) \ - -I $(XSLUTIL_PATH) \ - -I $(PROCESSOR_PATH) \ +INCLUDE_PATHS = -I$(EXPR_PATH) \ + -I$(DOM_PATH) \ + -I$(BASE_PATH) \ + -I$(XML_PATH) \ + -I$(XSLUTIL_PATH) \ + -I$(PROCESSOR_PATH) \ -I- @@ -23,6 +23,7 @@ EXPR_OBJS = AdditiveExpr.o \ AttributeExpr.o \ AttributeValueTemplate.o \ BasicNodeExpr.o \ + BooleanExpr.o \ BooleanResult.o \ ElementExpr.o \ ExprLexer.o \ @@ -43,7 +44,8 @@ EXPR_OBJS = AdditiveExpr.o \ TextExpr.o \ UnionExpr.o \ VariableRefExpr.o \ - WildCardExpr.o + WildCardExpr.o \ + XPathNames.o FUNCTION_CALL_OBJS = \ BooleanFunctionCall.o \ @@ -53,7 +55,7 @@ FUNCTION_CALL_OBJS = \ StringFunctionCall.o ALL_OBJS = $(EXPR_OBJS) \ - $(FUNCTION_CALL_OBJS) \ + $(FUNCTION_CALL_OBJS) exprlib: $(ALL_OBJS) @@ -70,6 +72,9 @@ AttributeValueTemplate.o: Expr.h AttributeValueTemplate.cpp BasicNodeExpr.o: Expr.h BasicNodeExpr.cpp $(CC) $(INCLUDE_PATHS) -c BasicNodeExpr.cpp +BooleanExpr.o: Expr.h BooleanExpr.cpp + $(CC) $(INCLUDE_PATHS) -c BooleanExpr.cpp + BooleanResult.o: ExprResult.h BooleanResult.cpp $(CC) $(INCLUDE_PATHS) -c BooleanResult.cpp @@ -133,6 +138,9 @@ VariableRefExpr.o: Expr.h VariableRefExpr.cpp WildCardExpr.o: Expr.h WildCardExpr.cpp $(CC) $(INCLUDE_PATHS) -c WildCardExpr.cpp +XPathNames.o: FunctionLib.h XPathNames.cpp + $(CC) $(INCLUDE_PATHS) -c XPathNames.cpp + ######################## ## FunctionCall package diff --git a/mozilla/extensions/transformiix/source/xsl/expr/MultiplicativeExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/MultiplicativeExpr.cpp index b10726a2fd2..f7b40ee5823 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/MultiplicativeExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/MultiplicativeExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: MultiplicativeExpr.cpp,v 1.2 1999-11-15 07:13:12 nisheeth%netscape.com Exp $ */ /** @@ -25,7 +30,8 @@ * * : multiply * mod : modulus * div : divide - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:12 $ **/ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/NodeSetFunctionCall.cpp b/mozilla/extensions/transformiix/source/xsl/expr/NodeSetFunctionCall.cpp index 04d49d3219f..d51db36e37b 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/NodeSetFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/NodeSetFunctionCall.cpp @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: NodeSetFunctionCall.cpp,v 1.2 1999-11-15 07:13:12 nisheeth%netscape.com Exp $ */ /** * NodeSetFunctionCall * A representation of the XPath NodeSet funtions - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:12 $ **/ #include "FunctionLib.h" @@ -31,7 +37,7 @@ * Creates a default NodeSetFunctionCall. The Position function * is the default **/ -NodeSetFunctionCall::NodeSetFunctionCall() : FunctionCall(POSITION_FN) { +NodeSetFunctionCall::NodeSetFunctionCall() : FunctionCall(XPathNames::POSITION_FN) { type = POSITION; } //-- NodeSetFunctionCall @@ -42,22 +48,22 @@ NodeSetFunctionCall::NodeSetFunctionCall(short type) : FunctionCall() { this->type = type; switch ( type ) { case COUNT : - FunctionCall::setName(COUNT_FN); + FunctionCall::setName(XPathNames::COUNT_FN); break; case LAST : - FunctionCall::setName(LAST_FN); + FunctionCall::setName(XPathNames::LAST_FN); break; - case LOCAL_PART: - FunctionCall::setName(LOCAL_PART_FN); + case LOCAL_NAME: + FunctionCall::setName(XPathNames::LOCAL_NAME_FN); break; case NAME: - FunctionCall::setName(NAME_FN); + FunctionCall::setName(XPathNames::NAME_FN); break; - case NAMESPACE: - FunctionCall::setName(NAMESPACE_FN); + case NAMESPACE_URI: + FunctionCall::setName(XPathNames::NAMESPACE_URI_FN); break; default: - FunctionCall::setName(POSITION_FN); + FunctionCall::setName(XPathNames::POSITION_FN); break; } } //-- NodeSetFunctionCall @@ -100,9 +106,9 @@ ExprResult* NodeSetFunctionCall::evaluate(Node* context, ContextState* cs) { if ( nodeSet ) result = new NumberResult((double)nodeSet->size()); else result = new NumberResult(0.0); break; - case LOCAL_PART: + case LOCAL_NAME: case NAME: - case NAMESPACE : + case NAMESPACE_URI : { String name; Node* node = 0; @@ -126,10 +132,10 @@ ExprResult* NodeSetFunctionCall::evaluate(Node* context, ContextState* cs) { if ( !node ) node = context; switch ( type ) { - case LOCAL_PART : + case LOCAL_NAME : XMLUtils::getLocalPart(node->getNodeName(),name); break; - case NAMESPACE : + case NAMESPACE_URI : XMLUtils::getNameSpace(node->getNodeName(),name); break; default: diff --git a/mozilla/extensions/transformiix/source/xsl/expr/NumberExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/NumberExpr.cpp index 432f83abdd3..ecd2d5712c9 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/NumberExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/NumberExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: NumberExpr.cpp,v 1.2 1999-11-15 07:13:12 nisheeth%netscape.com Exp $ */ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/NumberResult.cpp b/mozilla/extensions/transformiix/source/xsl/expr/NumberResult.cpp index aac93a05713..c72b7c9372c 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/NumberResult.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/NumberResult.cpp @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: NumberResult.cpp,v 1.2 1999-11-15 07:13:12 nisheeth%netscape.com Exp $ */ /** * NumberResult * Represents the a number as the result of evaluating an Expr - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:12 $ **/ #include "ExprResult.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/ParentExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/ParentExpr.cpp index 3f4cba82a14..f2c089114fc 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/ParentExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/ParentExpr.cpp @@ -1,26 +1,32 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: ParentExpr.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ /** - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:13 $ **/ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/Parser.cpp b/mozilla/extensions/transformiix/source/xsl/expr/Parser.cpp index 41c76a1605d..873f4f5378e 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/Parser.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/Parser.cpp @@ -1,27 +1,33 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: Parser.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ /** * Test App for Expressions - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:13 $ **/ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/PathExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/PathExpr.cpp index 3cbc34fa6d7..72657cd18c7 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/PathExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/PathExpr.cpp @@ -1,29 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: PathExpr.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ #include "Expr.h" - //-------------/ + //------------/ //- PathExpr -/ -//-----------/ +//------------/ /** @@ -137,6 +142,7 @@ ExprResult* PathExpr::evaluate(Node* context, ContextState* cs) { if ( nodes->size() == 0 ) break; } delete iter; + return nodes; } //-- evaluate @@ -190,9 +196,60 @@ double PathExpr::getDefaultPriority(Node* node, Node* context, ContextState* cs) * the given context **/ MBool PathExpr::matches(Node* node, Node* context, ContextState* cs) { - NodeSet* nodeSet = (NodeSet*) evaluate(context, cs); - MBool result = nodeSet->contains(node); - delete nodeSet; + + if ( (!node) || (expressions.getLength() == 0)) + return MB_FALSE; + + MBool result = MB_FALSE; + + NodeSet nodes; + nodes.add(node); + + + ListIterator* iter = expressions.iterator(); + iter->reverse(); + + NodeSet tmpNodes; + while ( iter->hasNext() ) { + + PathExprItem* pxi = (PathExprItem*)iter->next(); + for (int i = 0; i < nodes.size(); i++) { + Node* tnode = nodes.get(i); + if (pxi->pExpr->matches(tnode, context, cs)) { + + //-- if this is the last expression we are done + if (!iter->hasNext()) { + result = MB_TRUE; + break; + } + + //-- select node's parent or ancestors + switch (pxi->ancestryOp) { + case ANCESTOR_OP: + { + Node* parent = tnode; + while (parent = cs->findParent(parent)) + tmpNodes.add(parent); + break; + } + case PARENT_OP: + { + Node* parent = cs->findParent(tnode); + if (parent) tmpNodes.add(parent); + break; + } + + } + } + } //-- for + nodes.clear(); + tmpNodes.copyInto(nodes); + tmpNodes.clear(); + } + + if (!result) result = (MBool)(nodes.size() > 0); + + delete iter; return result; } //-- matches diff --git a/mozilla/extensions/transformiix/source/xsl/expr/PredicateList.cpp b/mozilla/extensions/transformiix/source/xsl/expr/PredicateList.cpp index 809c47cafa9..a53e1273a6d 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/PredicateList.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/PredicateList.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: PredicateList.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ #include "Expr.h" @@ -24,7 +29,8 @@ /** * Represents an ordered list of Predicates, * for use with Step and Filter Expressions - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:13 $ **/ //-- PredicateList Implementation --/ diff --git a/mozilla/extensions/transformiix/source/xsl/expr/RelationalExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/RelationalExpr.cpp index d72962ffb35..c1903e2d022 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/RelationalExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/RelationalExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: RelationalExpr.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/RootExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/RootExpr.cpp index 49bee44a059..ee5dd6f93aa 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/RootExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/RootExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: RootExpr.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/StringExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/StringExpr.cpp index 97148b4fb52..97451b869c3 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/StringExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/StringExpr.cpp @@ -1,29 +1,35 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: StringExpr.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ #include "Expr.h" /** * StringExpr - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:13 $ **/ /** diff --git a/mozilla/extensions/transformiix/source/xsl/expr/StringFunctionCall.cpp b/mozilla/extensions/transformiix/source/xsl/expr/StringFunctionCall.cpp index c36ca70d4cd..1efd96e2e9a 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/StringFunctionCall.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/StringFunctionCall.cpp @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: StringFunctionCall.cpp,v 1.2 1999-11-15 07:13:13 nisheeth%netscape.com Exp $ */ /** * StringFunctionCall * A representation of the XPath String funtions - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:13 $ **/ #include "FunctionLib.h" @@ -31,7 +37,7 @@ * Creates a default StringFunctionCall. The string() function * is the default **/ -StringFunctionCall::StringFunctionCall() : FunctionCall(STRING_FN) { +StringFunctionCall::StringFunctionCall() : FunctionCall(XPathNames::STRING_FN) { type = STRING; } //-- StringFunctionCall @@ -42,31 +48,31 @@ StringFunctionCall::StringFunctionCall(short type) : FunctionCall() { this->type = type; switch ( type ) { case CONCAT: - FunctionCall::setName(CONCAT_FN); + FunctionCall::setName(XPathNames::CONCAT_FN); break; case CONTAINS: - FunctionCall::setName(CONTAINS_FN); + FunctionCall::setName(XPathNames::CONTAINS_FN); break; case STARTS_WITH: - FunctionCall::setName(STARTS_WITH_FN); + FunctionCall::setName(XPathNames::STARTS_WITH_FN); break; case STRING_LENGTH: - FunctionCall::setName(STRING_LENGTH_FN); + FunctionCall::setName(XPathNames::STRING_LENGTH_FN); break; case SUBSTRING: - FunctionCall::setName(SUBSTRING_FN); + FunctionCall::setName(XPathNames::SUBSTRING_FN); break; case SUBSTRING_AFTER: - FunctionCall::setName(SUBSTRING_AFTER_FN); + FunctionCall::setName(XPathNames::SUBSTRING_AFTER_FN); break; case SUBSTRING_BEFORE: - FunctionCall::setName(SUBSTRING_BEFORE_FN); + FunctionCall::setName(XPathNames::SUBSTRING_BEFORE_FN); break; case TRANSLATE: - FunctionCall::setName(TRANSLATE_FN); + FunctionCall::setName(XPathNames::TRANSLATE_FN); break; default: - FunctionCall::setName(STRING_FN); + FunctionCall::setName(XPathNames::STRING_FN); break; } } //-- StringFunctionCall @@ -197,11 +203,12 @@ ExprResult* StringFunctionCall::evaluate(Node* context, ContextState* cs) { char* chars = new char[size+1]; src.toChar(chars); src.clear(); - Int32 newIdx = 0; - for (Int32 i = 0; i < size; i++) { + Int32 newIdx = 0; + Int32 i; + for (i = 0; i < size; i++) { Int32 idx = oldChars.indexOf(chars[i]); if (idx >= 0) { - UNICODE_CHAR nchar = newChars.charAt(idx); + char nchar = newChars.charAt(idx); if (nchar != -1) src.append(nchar); } else src.append(chars[i]); diff --git a/mozilla/extensions/transformiix/source/xsl/expr/StringResult.cpp b/mozilla/extensions/transformiix/source/xsl/expr/StringResult.cpp index e9e386cb199..da12d13a78a 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/StringResult.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/StringResult.cpp @@ -1,28 +1,34 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: StringResult.cpp,v 1.2 1999-11-15 07:13:14 nisheeth%netscape.com Exp $ */ /** * StringResult * Represents a String as a Result of evaluating an Expr - * @author Keith Visco + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:14 $ **/ #include "ExprResult.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/TextExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/TextExpr.cpp index 8ae6330d985..00b2e206d01 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/TextExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/TextExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: TextExpr.cpp,v 1.2 1999-11-15 07:13:14 nisheeth%netscape.com Exp $ */ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/UnionExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/UnionExpr.cpp index 31c01e3c82e..f305ba2304e 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/UnionExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/UnionExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: UnionExpr.cpp,v 1.2 1999-11-15 07:13:14 nisheeth%netscape.com Exp $ */ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/VariableRefExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/VariableRefExpr.cpp index c9cc9377331..277557f3b4e 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/VariableRefExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/VariableRefExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: VariableRefExpr.cpp,v 1.2 1999-11-15 07:13:14 nisheeth%netscape.com Exp $ */ #include "Expr.h" diff --git a/mozilla/extensions/transformiix/source/xsl/expr/WildCardExpr.cpp b/mozilla/extensions/transformiix/source/xsl/expr/WildCardExpr.cpp index 274585157d0..b3a94678d13 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/WildCardExpr.cpp +++ b/mozilla/extensions/transformiix/source/xsl/expr/WildCardExpr.cpp @@ -1,22 +1,27 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. - * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. + * + * $Id: WildCardExpr.cpp,v 1.2 1999-11-15 07:13:14 nisheeth%netscape.com Exp $ */ #include "Expr.h" @@ -24,10 +29,8 @@ /** * This class represents a WildCardExpr as defined by the XSL * Working Draft - *
- * 
- * @author Keith Visco - *
This class was ported from XSL:P, an open source Java based XSL processor + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:14 $ **/ /** diff --git a/mozilla/extensions/transformiix/source/xsl/expr/parser.mk b/mozilla/extensions/transformiix/source/xsl/expr/parser.mk index ce58ae796ae..8a55f50065e 100644 --- a/mozilla/extensions/transformiix/source/xsl/expr/parser.mk +++ b/mozilla/extensions/transformiix/source/xsl/expr/parser.mk @@ -1,5 +1,5 @@ -CC = g++ +CC := $(CC) -g ROOT_PATH = ../.. BASE_PATH = $(ROOT_PATH)/base @@ -8,12 +8,12 @@ DOM_PATH = $(XML_PATH)/dom XSL_PATH = $(ROOT_PATH)/xsl XSLUTIL_PATH = $(XSL_PATH)/util -INCLUDE_PATHS = -I . \ - -I $(BASE_PATH) \ - -I $(XML_PATH) \ - -I $(DOM_PATH) \ - -I $(XSL_PATH) \ - -I $(XSLUTIL_PATH) \ +INCLUDE_PATHS = -I. \ + -I$(BASE_PATH) \ + -I$(XML_PATH) \ + -I$(DOM_PATH) \ + -I$(XSL_PATH) \ + -I$(XSLUTIL_PATH) \ -I- OBJS = *.o \ diff --git a/mozilla/extensions/transformiix/source/xsl/util/Makefile b/mozilla/extensions/transformiix/source/xsl/util/Makefile index 9bd04d12a83..5bc9eebaab5 100644 --- a/mozilla/extensions/transformiix/source/xsl/util/Makefile +++ b/mozilla/extensions/transformiix/source/xsl/util/Makefile @@ -1,25 +1,13 @@ -BASE_PATH = ../../base -EXPR_PATH = ../expr -XML_PATH = ../../xml -DOM_PATH = $(XML_PATH)/dom - -INCLUDE_PATHS = -I . \ - -I $(BASE_PATH) \ - -I $(EXPR_PATH) \ - -I $(DOM_PATH) \ - -I $(XML_PATH) \ - -I- ALL_OBJS = NodeSet.o \ NodeStack.o - -CC = g++ $(INCLUDE_PATHS) +INCLUDE_PATH = -I../../base -I../expr -I../../xml -I../../xml/dom target: $(ALL_OBJS) NodeSet.o: NodeSet.h NodeSet.cpp - $(CC) -c NodeSet.cpp + $(CC) $(INCLUDE_PATH) -c NodeSet.cpp NodeStack.o: NodeStack.h NodeStack.cpp - $(CC) -c NodeStack.cpp \ No newline at end of file + $(CC) $(INCLUDE_PATH) -c NodeStack.cpp diff --git a/mozilla/extensions/transformiix/source/xsl/util/NodeSet.cpp b/mozilla/extensions/transformiix/source/xsl/util/NodeSet.cpp index 2c5241ce276..dc6b308101d 100644 --- a/mozilla/extensions/transformiix/source/xsl/util/NodeSet.cpp +++ b/mozilla/extensions/transformiix/source/xsl/util/NodeSet.cpp @@ -1,22 +1,30 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- moved initialization of DEFAULT_SIZE from NodeSet.h to here * + * $Id: NodeSet.cpp,v 1.2 1999-11-15 07:13:16 nisheeth%netscape.com Exp $ */ #include "NodeSet.h" @@ -24,14 +32,8 @@ /** * NodeSet
* This class was ported from XSL:P.
- * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *   - moved initialization of DEFAULT_SIZE from NodeSet.h to here
- * 
- * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:16 $ **/ diff --git a/mozilla/extensions/transformiix/source/xsl/util/NodeSet.h b/mozilla/extensions/transformiix/source/xsl/util/NodeSet.h index f4959beb71d..e4461202324 100644 --- a/mozilla/extensions/transformiix/source/xsl/util/NodeSet.h +++ b/mozilla/extensions/transformiix/source/xsl/util/NodeSet.h @@ -1,41 +1,43 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- moved initialization of DEFAULT_SIZE to NodeSet.cpp * + * $Id: NodeSet.h,v 1.2 1999-11-15 07:13:16 nisheeth%netscape.com Exp $ */ /** * NodeSet - * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *   - moved initialization of DEFAULT_SIZE to NodeSet.cpp
- * 
- * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:16 $ **/ #ifndef MITREXSL_NODESET_H #define MITREXSL_NODESET_H #include "MITREObject.h" -#include "DOM.h" +#include "dom.h" #include "ExprResult.h" #include "XMLDOMUtils.h" diff --git a/mozilla/extensions/transformiix/source/xsl/util/NodeStack.cpp b/mozilla/extensions/transformiix/source/xsl/util/NodeStack.cpp index 667524ea0d8..0b3742565ff 100644 --- a/mozilla/extensions/transformiix/source/xsl/util/NodeStack.cpp +++ b/mozilla/extensions/transformiix/source/xsl/util/NodeStack.cpp @@ -1,35 +1,38 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): + * Keith Visco, kvisco@ziplink.net + * -- original author. * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- moved initialization of DEFAULT_SIZE from NodeStack.h to here * + * $Id: NodeStack.cpp,v 1.2 1999-11-15 07:13:16 nisheeth%netscape.com Exp $ */ #include "NodeStack.h" #include + /** - * @author Keith Visco - *
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *   - moved initialization of DEFAULT_SIZE from NodeStack.h to here
- * 
- * + * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:16 $ **/ @@ -265,3 +268,4 @@ void NodeStack::shiftUp(int index) { elements[i] = elements[i-1]; } } //-- shiftUp + diff --git a/mozilla/extensions/transformiix/source/xsl/util/NodeStack.h b/mozilla/extensions/transformiix/source/xsl/util/NodeStack.h index 837b552cc37..c30581795e4 100644 --- a/mozilla/extensions/transformiix/source/xsl/util/NodeStack.h +++ b/mozilla/extensions/transformiix/source/xsl/util/NodeStack.h @@ -1,34 +1,37 @@ /* - * (C) Copyright The MITRE Corporation 1999 All rights reserved. + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * The Original Code is TransforMiiX XSLT processor. + * + * The Initial Developer of the Original Code is The MITRE Corporation. + * Portions created by MITRE are Copyright (C) 1999 The MITRE Corporation. * - * The contents of this file are subject to the Mozilla Public License - * Version 1.0 (the "License"); you may not use this file except in - * compliance with the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ + * Portions created by Keith Visco as a Non MITRE employee, + * (C) 1999 Keith Visco. All Rights Reserved. + * + * Contributor(s): * - * The program provided "as is" without any warranty express or - * implied, including the warranty of non-infringement and the implied - * warranties of merchantibility and fitness for a particular purpose. - * The Copyright owner will not be liable for any damages suffered by - * you as a result of using the Program. In no event will the Copyright - * owner be liable for any special, indirect or consequential damages or - * lost profits even if the Copyright owner has been advised of the - * possibility of their occurrence. - * - * Please see release.txt distributed with this file for more information. + * Keith Visco, kvisco@ziplink.net + * -- original author. * + * Larry Fitzpatrick, OpenText, lef@opentext.com + * -- moved initialization of DEFAULT_SIZE to NodeStack.cpp + * $Id: NodeStack.h,v 1.2 1999-11-15 07:13:17 nisheeth%netscape.com Exp $ */ /** * NodeStack - * @author Keith Visco -*
- *
- * Modifications:
- * 19990806: Larry Fitzpatrick
- *   - moved initialization of DEFAULT_SIZE to NodeStack.cpp
- * 
+ * @author Keith Visco + * @version $Revision: 1.2 $ $Date: 1999-11-15 07:13:17 $ **/ #include "dom.h" #include "baseutils.h" @@ -192,3 +195,4 @@ private: }; //-- NodeSet #endif +