1.1 --- a/PKG-INFO Sun Jun 10 22:52:12 2007 +0000 1.2 +++ b/PKG-INFO Sat Jul 07 16:17:29 2007 +0000 1.3 @@ -8,7 +8,7 @@ 1.4 Home-page: http://www.boddie.org.uk/python/XSLTools.html 1.5 Download-url: http://www.boddie.org.uk/python/downloads/XSLTools-0.4.6.tar.gz 1.6 Summary: Modules and packages for the development of XML/XSL-based applications 1.7 -License: LGPL 1.8 +License: LGPL (version 3 or later) 1.9 Description: XSLTools is a distribution providing modules and packages for the development 1.10 of XML/XSL-based applications in Python, including Web-based applications, 1.11 utilising the open source libxml2 and libxslt libraries through the libxml2dom
2.1 --- a/README.txt Sun Jun 10 22:52:12 2007 +0000 2.2 +++ b/README.txt Sat Jul 07 16:17:29 2007 +0000 2.3 @@ -49,6 +49,8 @@ 2.4 2.5 * Improved the Login module, enabling the VerySimpleWithLogin example for 2.6 various frameworks. 2.7 + * Relicensed under the LGPL version 3 or later. 2.8 + * Upgraded to Sarissa 0.9.7.8 (compatible with LGPL/GPL version 3). 2.9 2.10 New in XSLTools 0.4.5 (Changes since XSLTools 0.4.4) 2.11 ----------------------------------------------------
3.1 --- a/XSLForms/Constants.py Sun Jun 10 22:52:12 2007 +0000 3.2 +++ b/XSLForms/Constants.py Sat Jul 07 16:17:29 2007 +0000 3.3 @@ -5,19 +5,18 @@ 3.4 3.5 Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 3.6 3.7 -This library is free software; you can redistribute it and/or 3.8 -modify it under the terms of the GNU Lesser General Public 3.9 -License as published by the Free Software Foundation; either 3.10 -version 2.1 of the License, or (at your option) any later version. 3.11 +This program is free software; you can redistribute it and/or modify it under 3.12 +the terms of the GNU Lesser General Public License as published by the Free 3.13 +Software Foundation; either version 3 of the License, or (at your option) any 3.14 +later version. 3.15 3.16 -This library is distributed in the hope that it will be useful, 3.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 3.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 3.19 -Lesser General Public License for more details. 3.20 +This program is distributed in the hope that it will be useful, but WITHOUT 3.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 3.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 3.23 +details. 3.24 3.25 -You should have received a copy of the GNU Lesser General Public 3.26 -License along with this library; if not, write to the Free Software 3.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 3.28 +You should have received a copy of the GNU Lesser General Public License along 3.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 3.30 """ 3.31 3.32 path_separator = "/"
4.1 --- a/XSLForms/Fields.py Sun Jun 10 22:52:12 2007 +0000 4.2 +++ b/XSLForms/Fields.py Sat Jul 07 16:17:29 2007 +0000 4.3 @@ -5,21 +5,20 @@ 4.4 Interpretation of field collections from sources such as HTTP request parameter 4.5 dictionaries. 4.6 4.7 -Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 4.8 +Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk> 4.9 4.10 -This library is free software; you can redistribute it and/or 4.11 -modify it under the terms of the GNU Lesser General Public 4.12 -License as published by the Free Software Foundation; either 4.13 -version 2.1 of the License, or (at your option) any later version. 4.14 +This program is free software; you can redistribute it and/or modify it under 4.15 +the terms of the GNU Lesser General Public License as published by the Free 4.16 +Software Foundation; either version 3 of the License, or (at your option) any 4.17 +later version. 4.18 4.19 -This library is distributed in the hope that it will be useful, 4.20 -but WITHOUT ANY WARRANTY; without even the implied warranty of 4.21 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 4.22 -Lesser General Public License for more details. 4.23 +This program is distributed in the hope that it will be useful, but WITHOUT 4.24 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 4.25 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 4.26 +details. 4.27 4.28 -You should have received a copy of the GNU Lesser General Public 4.29 -License along with this library; if not, write to the Free Software 4.30 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 4.31 +You should have received a copy of the GNU Lesser General Public License along 4.32 +with this program. If not, see <http://www.gnu.org/licenses/>. 4.33 4.34 -------- 4.35
5.1 --- a/XSLForms/Output.py Sun Jun 10 22:52:12 2007 +0000 5.2 +++ b/XSLForms/Output.py Sat Jul 07 16:17:29 2007 +0000 5.3 @@ -5,19 +5,18 @@ 5.4 5.5 Copyright (C) 2005, 2007 Paul Boddie <paul@boddie.org.uk> 5.6 5.7 -This library is free software; you can redistribute it and/or 5.8 -modify it under the terms of the GNU Lesser General Public 5.9 -License as published by the Free Software Foundation; either 5.10 -version 2.1 of the License, or (at your option) any later version. 5.11 +This program is free software; you can redistribute it and/or modify it under 5.12 +the terms of the GNU Lesser General Public License as published by the Free 5.13 +Software Foundation; either version 3 of the License, or (at your option) any 5.14 +later version. 5.15 5.16 -This library is distributed in the hope that it will be useful, 5.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 5.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 5.19 -Lesser General Public License for more details. 5.20 +This program is distributed in the hope that it will be useful, but WITHOUT 5.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 5.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 5.23 +details. 5.24 5.25 -You should have received a copy of the GNU Lesser General Public 5.26 -License along with this library; if not, write to the Free Software 5.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 5.28 +You should have received a copy of the GNU Lesser General Public License along 5.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 5.30 """ 5.31 5.32 import Constants
6.1 --- a/XSLForms/Prepare.py Sun Jun 10 22:52:12 2007 +0000 6.2 +++ b/XSLForms/Prepare.py Sat Jul 07 16:17:29 2007 +0000 6.3 @@ -5,19 +5,18 @@ 6.4 6.5 Copyright (C) 2005, 2006 Paul Boddie <paul@boddie.org.uk> 6.6 6.7 -This library is free software; you can redistribute it and/or 6.8 -modify it under the terms of the GNU Lesser General Public 6.9 -License as published by the Free Software Foundation; either 6.10 -version 2.1 of the License, or (at your option) any later version. 6.11 +This program is free software; you can redistribute it and/or modify it under 6.12 +the terms of the GNU Lesser General Public License as published by the Free 6.13 +Software Foundation; either version 3 of the License, or (at your option) any 6.14 +later version. 6.15 6.16 -This library is distributed in the hope that it will be useful, 6.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 6.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 6.19 -Lesser General Public License for more details. 6.20 +This program is distributed in the hope that it will be useful, but WITHOUT 6.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 6.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 6.23 +details. 6.24 6.25 -You should have received a copy of the GNU Lesser General Public 6.26 -License along with this library; if not, write to the Free Software 6.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 6.28 +You should have received a copy of the GNU Lesser General Public License along 6.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 6.30 """ 6.31 6.32 from XSLTools import XSLOutput
7.1 --- a/XSLForms/Resources/Common.py Sun Jun 10 22:52:12 2007 +0000 7.2 +++ b/XSLForms/Resources/Common.py Sat Jul 07 16:17:29 2007 +0000 7.3 @@ -5,19 +5,18 @@ 7.4 7.5 Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 7.6 7.7 -This library is free software; you can redistribute it and/or 7.8 -modify it under the terms of the GNU Lesser General Public 7.9 -License as published by the Free Software Foundation; either 7.10 -version 2.1 of the License, or (at your option) any later version. 7.11 +This program is free software; you can redistribute it and/or modify it under 7.12 +the terms of the GNU Lesser General Public License as published by the Free 7.13 +Software Foundation; either version 3 of the License, or (at your option) any 7.14 +later version. 7.15 7.16 -This library is distributed in the hope that it will be useful, 7.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 7.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 7.19 -Lesser General Public License for more details. 7.20 +This program is distributed in the hope that it will be useful, but WITHOUT 7.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 7.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 7.23 +details. 7.24 7.25 -You should have received a copy of the GNU Lesser General Public 7.26 -License along with this library; if not, write to the Free Software 7.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 7.28 +You should have received a copy of the GNU Lesser General Public License along 7.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 7.30 """ 7.31 7.32 import os
8.1 --- a/XSLForms/Resources/Login.py Sun Jun 10 22:52:12 2007 +0000 8.2 +++ b/XSLForms/Resources/Login.py Sat Jul 07 16:17:29 2007 +0000 8.3 @@ -7,20 +7,18 @@ 8.4 8.5 Copyright (C) 2006, 2007 Paul Boddie <paul@boddie.org.uk> 8.6 8.7 -This software is free software; you can redistribute it and/or 8.8 -modify it under the terms of the GNU General Public License as 8.9 -published by the Free Software Foundation; either version 2 of 8.10 -the License, or (at your option) any later version. 8.11 +This program is free software; you can redistribute it and/or modify it under 8.12 +the terms of the GNU Lesser General Public License as published by the Free 8.13 +Software Foundation; either version 3 of the License, or (at your option) any 8.14 +later version. 8.15 8.16 -This software is distributed in the hope that it will be useful, 8.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 8.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 8.19 -GNU General Public License for more details. 8.20 +This program is distributed in the hope that it will be useful, but WITHOUT 8.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 8.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 8.23 +details. 8.24 8.25 -You should have received a copy of the GNU General Public 8.26 -License along with this library; see the file LICENCE.txt 8.27 -If not, write to the Free Software Foundation, Inc., 8.28 -51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 8.29 +You should have received a copy of the GNU Lesser General Public License along 8.30 +with this program. If not, see <http://www.gnu.org/licenses/>. 8.31 """ 8.32 8.33 from WebStack.Generic import ContentType, EndOfResponse
9.1 --- a/XSLForms/Resources/PyQtCommon.py Sun Jun 10 22:52:12 2007 +0000 9.2 +++ b/XSLForms/Resources/PyQtCommon.py Sat Jul 07 16:17:29 2007 +0000 9.3 @@ -5,19 +5,18 @@ 9.4 9.5 Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 9.6 9.7 -This library is free software; you can redistribute it and/or 9.8 -modify it under the terms of the GNU Lesser General Public 9.9 -License as published by the Free Software Foundation; either 9.10 -version 2.1 of the License, or (at your option) any later version. 9.11 +This program is free software; you can redistribute it and/or modify it under 9.12 +the terms of the GNU Lesser General Public License as published by the Free 9.13 +Software Foundation; either version 3 of the License, or (at your option) any 9.14 +later version. 9.15 9.16 -This library is distributed in the hope that it will be useful, 9.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 9.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 9.19 -Lesser General Public License for more details. 9.20 +This program is distributed in the hope that it will be useful, but WITHOUT 9.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 9.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 9.23 +details. 9.24 9.25 -You should have received a copy of the GNU Lesser General Public 9.26 -License along with this library; if not, write to the Free Software 9.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 9.28 +You should have received a copy of the GNU Lesser General Public License along 9.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 9.30 """ 9.31 9.32 import os
10.1 --- a/XSLForms/Resources/PyQtResources.py Sun Jun 10 22:52:12 2007 +0000 10.2 +++ b/XSLForms/Resources/PyQtResources.py Sat Jul 07 16:17:29 2007 +0000 10.3 @@ -5,19 +5,18 @@ 10.4 10.5 Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 10.6 10.7 -This library is free software; you can redistribute it and/or 10.8 -modify it under the terms of the GNU Lesser General Public 10.9 -License as published by the Free Software Foundation; either 10.10 -version 2.1 of the License, or (at your option) any later version. 10.11 +This program is free software; you can redistribute it and/or modify it under 10.12 +the terms of the GNU Lesser General Public License as published by the Free 10.13 +Software Foundation; either version 3 of the License, or (at your option) any 10.14 +later version. 10.15 10.16 -This library is distributed in the hope that it will be useful, 10.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 10.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 10.19 -Lesser General Public License for more details. 10.20 +This program is distributed in the hope that it will be useful, but WITHOUT 10.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 10.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 10.23 +details. 10.24 10.25 -You should have received a copy of the GNU Lesser General Public 10.26 -License along with this library; if not, write to the Free Software 10.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 10.28 +You should have received a copy of the GNU Lesser General Public License along 10.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 10.30 """ 10.31 10.32 import XSLForms.Prepare
11.1 --- a/XSLForms/Resources/PyQtWebResources.py Sun Jun 10 22:52:12 2007 +0000 11.2 +++ b/XSLForms/Resources/PyQtWebResources.py Sat Jul 07 16:17:29 2007 +0000 11.3 @@ -5,19 +5,18 @@ 11.4 11.5 Copyright (C) 2005, 2007 Paul Boddie <paul@boddie.org.uk> 11.6 11.7 -This library is free software; you can redistribute it and/or 11.8 -modify it under the terms of the GNU Lesser General Public 11.9 -License as published by the Free Software Foundation; either 11.10 -version 2.1 of the License, or (at your option) any later version. 11.11 +This program is free software; you can redistribute it and/or modify it under 11.12 +the terms of the GNU Lesser General Public License as published by the Free 11.13 +Software Foundation; either version 3 of the License, or (at your option) any 11.14 +later version. 11.15 11.16 -This library is distributed in the hope that it will be useful, 11.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 11.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 11.19 -Lesser General Public License for more details. 11.20 +This program is distributed in the hope that it will be useful, but WITHOUT 11.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 11.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 11.23 +details. 11.24 11.25 -You should have received a copy of the GNU Lesser General Public 11.26 -License along with this library; if not, write to the Free Software 11.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 11.28 +You should have received a copy of the GNU Lesser General Public License along 11.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 11.30 """ 11.31 11.32 import XSLForms.Prepare
12.1 --- a/XSLForms/Resources/WebResources.py Sun Jun 10 22:52:12 2007 +0000 12.2 +++ b/XSLForms/Resources/WebResources.py Sat Jul 07 16:17:29 2007 +0000 12.3 @@ -5,19 +5,18 @@ 12.4 12.5 Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk> 12.6 12.7 -This library is free software; you can redistribute it and/or 12.8 -modify it under the terms of the GNU Lesser General Public 12.9 -License as published by the Free Software Foundation; either 12.10 -version 2.1 of the License, or (at your option) any later version. 12.11 +This program is free software; you can redistribute it and/or modify it under 12.12 +the terms of the GNU Lesser General Public License as published by the Free 12.13 +Software Foundation; either version 3 of the License, or (at your option) any 12.14 +later version. 12.15 12.16 -This library is distributed in the hope that it will be useful, 12.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 12.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12.19 -Lesser General Public License for more details. 12.20 +This program is distributed in the hope that it will be useful, but WITHOUT 12.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 12.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 12.23 +details. 12.24 12.25 -You should have received a copy of the GNU Lesser General Public 12.26 -License along with this library; if not, write to the Free Software 12.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 12.28 +You should have received a copy of the GNU Lesser General Public License along 12.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 12.30 """ 12.31 12.32 import WebStack.Generic
13.1 --- a/XSLForms/Resources/__init__.py Sun Jun 10 22:52:12 2007 +0000 13.2 +++ b/XSLForms/Resources/__init__.py Sat Jul 07 16:17:29 2007 +0000 13.3 @@ -5,19 +5,18 @@ 13.4 13.5 Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 13.6 13.7 -This library is free software; you can redistribute it and/or 13.8 -modify it under the terms of the GNU Lesser General Public 13.9 -License as published by the Free Software Foundation; either 13.10 -version 2.1 of the License, or (at your option) any later version. 13.11 +This program is free software; you can redistribute it and/or modify it under 13.12 +the terms of the GNU Lesser General Public License as published by the Free 13.13 +Software Foundation; either version 3 of the License, or (at your option) any 13.14 +later version. 13.15 13.16 -This library is distributed in the hope that it will be useful, 13.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 13.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13.19 -Lesser General Public License for more details. 13.20 +This program is distributed in the hope that it will be useful, but WITHOUT 13.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 13.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 13.23 +details. 13.24 13.25 -You should have received a copy of the GNU Lesser General Public 13.26 -License along with this library; if not, write to the Free Software 13.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 13.28 +You should have received a copy of the GNU Lesser General Public License along 13.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 13.30 """ 13.31 13.32 # vim: tabstop=4 expandtab shiftwidth=4
14.1 --- a/XSLForms/Utils.py Sun Jun 10 22:52:12 2007 +0000 14.2 +++ b/XSLForms/Utils.py Sat Jul 07 16:17:29 2007 +0000 14.3 @@ -5,19 +5,18 @@ 14.4 14.5 Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 14.6 14.7 -This library is free software; you can redistribute it and/or 14.8 -modify it under the terms of the GNU Lesser General Public 14.9 -License as published by the Free Software Foundation; either 14.10 -version 2.1 of the License, or (at your option) any later version. 14.11 +This program is free software; you can redistribute it and/or modify it under 14.12 +the terms of the GNU Lesser General Public License as published by the Free 14.13 +Software Foundation; either version 3 of the License, or (at your option) any 14.14 +later version. 14.15 14.16 -This library is distributed in the hope that it will be useful, 14.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 14.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 14.19 -Lesser General Public License for more details. 14.20 +This program is distributed in the hope that it will be useful, but WITHOUT 14.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 14.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 14.23 +details. 14.24 14.25 -You should have received a copy of the GNU Lesser General Public 14.26 -License along with this library; if not, write to the Free Software 14.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 14.28 +You should have received a copy of the GNU Lesser General Public License along 14.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 14.30 """ 14.31 14.32 def add_elements(positions, *element_names):
15.1 --- a/XSLForms/__init__.py Sun Jun 10 22:52:12 2007 +0000 15.2 +++ b/XSLForms/__init__.py Sat Jul 07 16:17:29 2007 +0000 15.3 @@ -5,19 +5,18 @@ 15.4 15.5 Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk> 15.6 15.7 -This library is free software; you can redistribute it and/or 15.8 -modify it under the terms of the GNU Lesser General Public 15.9 -License as published by the Free Software Foundation; either 15.10 -version 2.1 of the License, or (at your option) any later version. 15.11 +This program is free software; you can redistribute it and/or modify it under 15.12 +the terms of the GNU Lesser General Public License as published by the Free 15.13 +Software Foundation; either version 3 of the License, or (at your option) any 15.14 +later version. 15.15 15.16 -This library is distributed in the hope that it will be useful, 15.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 15.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15.19 -Lesser General Public License for more details. 15.20 +This program is distributed in the hope that it will be useful, but WITHOUT 15.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 15.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 15.23 +details. 15.24 15.25 -You should have received a copy of the GNU Lesser General Public 15.26 -License along with this library; if not, write to the Free Software 15.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 15.28 +You should have received a copy of the GNU Lesser General Public License along 15.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 15.30 """ 15.31 15.32 __version__ = "0.4.6"
16.1 --- a/XSLTools/XMLCalendar.py Sun Jun 10 22:52:12 2007 +0000 16.2 +++ b/XSLTools/XMLCalendar.py Sat Jul 07 16:17:29 2007 +0000 16.3 @@ -10,19 +10,18 @@ 16.4 Copyright (c) 1995-2001 Corporation for National Research Initiatives. 16.5 Copyright (c) 1991-1995 Stichting Mathematisch Centrum. 16.6 16.7 -This library is free software; you can redistribute it and/or 16.8 -modify it under the terms of the GNU Lesser General Public 16.9 -License as published by the Free Software Foundation; either 16.10 -version 2.1 of the License, or (at your option) any later version. 16.11 +This program is free software; you can redistribute it and/or modify it under 16.12 +the terms of the GNU Lesser General Public License as published by the Free 16.13 +Software Foundation; either version 3 of the License, or (at your option) any 16.14 +later version. 16.15 16.16 -This library is distributed in the hope that it will be useful, 16.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 16.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 16.19 -Lesser General Public License for more details. 16.20 +This program is distributed in the hope that it will be useful, but WITHOUT 16.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 16.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 16.23 +details. 16.24 16.25 -You should have received a copy of the GNU Lesser General Public 16.26 -License along with this library; if not, write to the Free Software 16.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 16.28 +You should have received a copy of the GNU Lesser General Public License along 16.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 16.30 """ 16.31 16.32 import libxml2dom
17.1 --- a/XSLTools/XMLTable.py Sun Jun 10 22:52:12 2007 +0000 17.2 +++ b/XSLTools/XMLTable.py Sat Jul 07 16:17:29 2007 +0000 17.3 @@ -1,6 +1,23 @@ 17.4 #!/usr/bin/env python 17.5 17.6 -"A list of tuples to XML document converter." 17.7 +""" 17.8 +A list of tuples to XML document converter. 17.9 + 17.10 +Copyright (C) 2005 Paul Boddie <paul@boddie.org.uk> 17.11 + 17.12 +This program is free software; you can redistribute it and/or modify it under 17.13 +the terms of the GNU Lesser General Public License as published by the Free 17.14 +Software Foundation; either version 3 of the License, or (at your option) any 17.15 +later version. 17.16 + 17.17 +This program is distributed in the hope that it will be useful, but WITHOUT 17.18 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 17.19 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 17.20 +details. 17.21 + 17.22 +You should have received a copy of the GNU Lesser General Public License along 17.23 +with this program. If not, see <http://www.gnu.org/licenses/>. 17.24 +""" 17.25 17.26 import libxml2dom 17.27 from UserDict import UserDict
18.1 --- a/XSLTools/XSLOutput.py Sun Jun 10 22:52:12 2007 +0000 18.2 +++ b/XSLTools/XSLOutput.py Sat Jul 07 16:17:29 2007 +0000 18.3 @@ -5,19 +5,18 @@ 18.4 18.5 Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk> 18.6 18.7 -This library is free software; you can redistribute it and/or 18.8 -modify it under the terms of the GNU Lesser General Public 18.9 -License as published by the Free Software Foundation; either 18.10 -version 2.1 of the License, or (at your option) any later version. 18.11 +This program is free software; you can redistribute it and/or modify it under 18.12 +the terms of the GNU Lesser General Public License as published by the Free 18.13 +Software Foundation; either version 3 of the License, or (at your option) any 18.14 +later version. 18.15 18.16 -This library is distributed in the hope that it will be useful, 18.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 18.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 18.19 -Lesser General Public License for more details. 18.20 +This program is distributed in the hope that it will be useful, but WITHOUT 18.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 18.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 18.23 +details. 18.24 18.25 -You should have received a copy of the GNU Lesser General Public 18.26 -License along with this library; if not, write to the Free Software 18.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 18.28 +You should have received a copy of the GNU Lesser General Public License along 18.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 18.30 """ 18.31 18.32 # NOTE: Make this use other XSLT implementations, too.
19.1 --- a/XSLTools/__init__.py Sun Jun 10 22:52:12 2007 +0000 19.2 +++ b/XSLTools/__init__.py Sat Jul 07 16:17:29 2007 +0000 19.3 @@ -5,19 +5,18 @@ 19.4 19.5 Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk> 19.6 19.7 -This library is free software; you can redistribute it and/or 19.8 -modify it under the terms of the GNU Lesser General Public 19.9 -License as published by the Free Software Foundation; either 19.10 -version 2.1 of the License, or (at your option) any later version. 19.11 +This program is free software; you can redistribute it and/or modify it under 19.12 +the terms of the GNU Lesser General Public License as published by the Free 19.13 +Software Foundation; either version 3 of the License, or (at your option) any 19.14 +later version. 19.15 19.16 -This library is distributed in the hope that it will be useful, 19.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 19.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 19.19 -Lesser General Public License for more details. 19.20 +This program is distributed in the hope that it will be useful, but WITHOUT 19.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 19.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 19.23 +details. 19.24 19.25 -You should have received a copy of the GNU Lesser General Public 19.26 -License along with this library; if not, write to the Free Software 19.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 19.28 +You should have received a copy of the GNU Lesser General Public License along 19.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 19.30 """ 19.31 19.32 __version__ = "0.4.6"
20.1 --- a/docs/COPYING.txt Sun Jun 10 22:52:12 2007 +0000 20.2 +++ b/docs/COPYING.txt Sat Jul 07 16:17:29 2007 +0000 20.3 @@ -3,28 +3,28 @@ 20.4 20.5 Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk> 20.6 20.7 -This library is free software; you can redistribute it and/or 20.8 -modify it under the terms of the GNU Lesser General Public 20.9 -License as published by the Free Software Foundation; either 20.10 -version 2.1 of the License, or (at your option) any later version. 20.11 +This program is free software; you can redistribute it and/or modify it under 20.12 +the terms of the GNU Lesser General Public License as published by the Free 20.13 +Software Foundation; either version 3 of the License, or (at your option) any 20.14 +later version. 20.15 20.16 -This library is distributed in the hope that it will be useful, 20.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 20.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20.19 -Lesser General Public License for more details. 20.20 +This program is distributed in the hope that it will be useful, but WITHOUT 20.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 20.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 20.23 +details. 20.24 20.25 -You should have received a copy of the GNU Lesser General Public 20.26 -License along with this library; if not, write to the Free Software 20.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 20.28 +You should have received a copy of the GNU Lesser General Public License along 20.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 20.30 20.31 Copyright and Licensing Information for Other Software 20.32 ------------------------------------------------------ 20.33 20.34 Certain examples in XSLTools use files from the Sarissa distribution (see 20.35 http://sarissa.sourceforge.net). These files were made available under the GNU 20.36 -Lesser General Public License and under the GNU General Public License; the 20.37 -former licence is identical to that found in the LICENCE.txt file, whereas the 20.38 -latter can be found in the LICENCE-Sarissa.txt file. 20.39 +Lesser General Public License (version 2.1 or later) and under the GNU General 20.40 +Public License (version 2 or later); the former licence is found in the 20.41 +LICENCE-Sarissa-lgpl.txt file, whereas the latter is found in the 20.42 +LICENCE-Sarissa-gpl.txt file. 20.43 20.44 The XMLTools.XMLCalendar module uses a modified version of the monthcalendar 20.45 function from the Python standard library's calendar module. This code was
21.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 21.2 +++ b/docs/LICENCE-Sarissa-gpl.txt Sat Jul 07 16:17:29 2007 +0000 21.3 @@ -0,0 +1,340 @@ 21.4 + GNU GENERAL PUBLIC LICENSE 21.5 + Version 2, June 1991 21.6 + 21.7 + Copyright (C) 1989, 1991 Free Software Foundation, Inc. 21.8 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21.9 + Everyone is permitted to copy and distribute verbatim copies 21.10 + of this license document, but changing it is not allowed. 21.11 + 21.12 + Preamble 21.13 + 21.14 + The licenses for most software are designed to take away your 21.15 +freedom to share and change it. By contrast, the GNU General Public 21.16 +License is intended to guarantee your freedom to share and change free 21.17 +software--to make sure the software is free for all its users. This 21.18 +General Public License applies to most of the Free Software 21.19 +Foundation's software and to any other program whose authors commit to 21.20 +using it. (Some other Free Software Foundation software is covered by 21.21 +the GNU Library General Public License instead.) You can apply it to 21.22 +your programs, too. 21.23 + 21.24 + When we speak of free software, we are referring to freedom, not 21.25 +price. Our General Public Licenses are designed to make sure that you 21.26 +have the freedom to distribute copies of free software (and charge for 21.27 +this service if you wish), that you receive source code or can get it 21.28 +if you want it, that you can change the software or use pieces of it 21.29 +in new free programs; and that you know you can do these things. 21.30 + 21.31 + To protect your rights, we need to make restrictions that forbid 21.32 +anyone to deny you these rights or to ask you to surrender the rights. 21.33 +These restrictions translate to certain responsibilities for you if you 21.34 +distribute copies of the software, or if you modify it. 21.35 + 21.36 + For example, if you distribute copies of such a program, whether 21.37 +gratis or for a fee, you must give the recipients all the rights that 21.38 +you have. You must make sure that they, too, receive or can get the 21.39 +source code. And you must show them these terms so they know their 21.40 +rights. 21.41 + 21.42 + We protect your rights with two steps: (1) copyright the software, and 21.43 +(2) offer you this license which gives you legal permission to copy, 21.44 +distribute and/or modify the software. 21.45 + 21.46 + Also, for each author's protection and ours, we want to make certain 21.47 +that everyone understands that there is no warranty for this free 21.48 +software. If the software is modified by someone else and passed on, we 21.49 +want its recipients to know that what they have is not the original, so 21.50 +that any problems introduced by others will not reflect on the original 21.51 +authors' reputations. 21.52 + 21.53 + Finally, any free program is threatened constantly by software 21.54 +patents. We wish to avoid the danger that redistributors of a free 21.55 +program will individually obtain patent licenses, in effect making the 21.56 +program proprietary. To prevent this, we have made it clear that any 21.57 +patent must be licensed for everyone's free use or not licensed at all. 21.58 + 21.59 + The precise terms and conditions for copying, distribution and 21.60 +modification follow. 21.61 + 21.62 + GNU GENERAL PUBLIC LICENSE 21.63 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 21.64 + 21.65 + 0. This License applies to any program or other work which contains 21.66 +a notice placed by the copyright holder saying it may be distributed 21.67 +under the terms of this General Public License. The "Program", below, 21.68 +refers to any such program or work, and a "work based on the Program" 21.69 +means either the Program or any derivative work under copyright law: 21.70 +that is to say, a work containing the Program or a portion of it, 21.71 +either verbatim or with modifications and/or translated into another 21.72 +language. (Hereinafter, translation is included without limitation in 21.73 +the term "modification".) Each licensee is addressed as "you". 21.74 + 21.75 +Activities other than copying, distribution and modification are not 21.76 +covered by this License; they are outside its scope. The act of 21.77 +running the Program is not restricted, and the output from the Program 21.78 +is covered only if its contents constitute a work based on the 21.79 +Program (independent of having been made by running the Program). 21.80 +Whether that is true depends on what the Program does. 21.81 + 21.82 + 1. You may copy and distribute verbatim copies of the Program's 21.83 +source code as you receive it, in any medium, provided that you 21.84 +conspicuously and appropriately publish on each copy an appropriate 21.85 +copyright notice and disclaimer of warranty; keep intact all the 21.86 +notices that refer to this License and to the absence of any warranty; 21.87 +and give any other recipients of the Program a copy of this License 21.88 +along with the Program. 21.89 + 21.90 +You may charge a fee for the physical act of transferring a copy, and 21.91 +you may at your option offer warranty protection in exchange for a fee. 21.92 + 21.93 + 2. You may modify your copy or copies of the Program or any portion 21.94 +of it, thus forming a work based on the Program, and copy and 21.95 +distribute such modifications or work under the terms of Section 1 21.96 +above, provided that you also meet all of these conditions: 21.97 + 21.98 + a) You must cause the modified files to carry prominent notices 21.99 + stating that you changed the files and the date of any change. 21.100 + 21.101 + b) You must cause any work that you distribute or publish, that in 21.102 + whole or in part contains or is derived from the Program or any 21.103 + part thereof, to be licensed as a whole at no charge to all third 21.104 + parties under the terms of this License. 21.105 + 21.106 + c) If the modified program normally reads commands interactively 21.107 + when run, you must cause it, when started running for such 21.108 + interactive use in the most ordinary way, to print or display an 21.109 + announcement including an appropriate copyright notice and a 21.110 + notice that there is no warranty (or else, saying that you provide 21.111 + a warranty) and that users may redistribute the program under 21.112 + these conditions, and telling the user how to view a copy of this 21.113 + License. (Exception: if the Program itself is interactive but 21.114 + does not normally print such an announcement, your work based on 21.115 + the Program is not required to print an announcement.) 21.116 + 21.117 +These requirements apply to the modified work as a whole. If 21.118 +identifiable sections of that work are not derived from the Program, 21.119 +and can be reasonably considered independent and separate works in 21.120 +themselves, then this License, and its terms, do not apply to those 21.121 +sections when you distribute them as separate works. But when you 21.122 +distribute the same sections as part of a whole which is a work based 21.123 +on the Program, the distribution of the whole must be on the terms of 21.124 +this License, whose permissions for other licensees extend to the 21.125 +entire whole, and thus to each and every part regardless of who wrote it. 21.126 + 21.127 +Thus, it is not the intent of this section to claim rights or contest 21.128 +your rights to work written entirely by you; rather, the intent is to 21.129 +exercise the right to control the distribution of derivative or 21.130 +collective works based on the Program. 21.131 + 21.132 +In addition, mere aggregation of another work not based on the Program 21.133 +with the Program (or with a work based on the Program) on a volume of 21.134 +a storage or distribution medium does not bring the other work under 21.135 +the scope of this License. 21.136 + 21.137 + 3. You may copy and distribute the Program (or a work based on it, 21.138 +under Section 2) in object code or executable form under the terms of 21.139 +Sections 1 and 2 above provided that you also do one of the following: 21.140 + 21.141 + a) Accompany it with the complete corresponding machine-readable 21.142 + source code, which must be distributed under the terms of Sections 21.143 + 1 and 2 above on a medium customarily used for software interchange; or, 21.144 + 21.145 + b) Accompany it with a written offer, valid for at least three 21.146 + years, to give any third party, for a charge no more than your 21.147 + cost of physically performing source distribution, a complete 21.148 + machine-readable copy of the corresponding source code, to be 21.149 + distributed under the terms of Sections 1 and 2 above on a medium 21.150 + customarily used for software interchange; or, 21.151 + 21.152 + c) Accompany it with the information you received as to the offer 21.153 + to distribute corresponding source code. (This alternative is 21.154 + allowed only for noncommercial distribution and only if you 21.155 + received the program in object code or executable form with such 21.156 + an offer, in accord with Subsection b above.) 21.157 + 21.158 +The source code for a work means the preferred form of the work for 21.159 +making modifications to it. For an executable work, complete source 21.160 +code means all the source code for all modules it contains, plus any 21.161 +associated interface definition files, plus the scripts used to 21.162 +control compilation and installation of the executable. However, as a 21.163 +special exception, the source code distributed need not include 21.164 +anything that is normally distributed (in either source or binary 21.165 +form) with the major components (compiler, kernel, and so on) of the 21.166 +operating system on which the executable runs, unless that component 21.167 +itself accompanies the executable. 21.168 + 21.169 +If distribution of executable or object code is made by offering 21.170 +access to copy from a designated place, then offering equivalent 21.171 +access to copy the source code from the same place counts as 21.172 +distribution of the source code, even though third parties are not 21.173 +compelled to copy the source along with the object code. 21.174 + 21.175 + 4. You may not copy, modify, sublicense, or distribute the Program 21.176 +except as expressly provided under this License. Any attempt 21.177 +otherwise to copy, modify, sublicense or distribute the Program is 21.178 +void, and will automatically terminate your rights under this License. 21.179 +However, parties who have received copies, or rights, from you under 21.180 +this License will not have their licenses terminated so long as such 21.181 +parties remain in full compliance. 21.182 + 21.183 + 5. You are not required to accept this License, since you have not 21.184 +signed it. However, nothing else grants you permission to modify or 21.185 +distribute the Program or its derivative works. These actions are 21.186 +prohibited by law if you do not accept this License. Therefore, by 21.187 +modifying or distributing the Program (or any work based on the 21.188 +Program), you indicate your acceptance of this License to do so, and 21.189 +all its terms and conditions for copying, distributing or modifying 21.190 +the Program or works based on it. 21.191 + 21.192 + 6. Each time you redistribute the Program (or any work based on the 21.193 +Program), the recipient automatically receives a license from the 21.194 +original licensor to copy, distribute or modify the Program subject to 21.195 +these terms and conditions. You may not impose any further 21.196 +restrictions on the recipients' exercise of the rights granted herein. 21.197 +You are not responsible for enforcing compliance by third parties to 21.198 +this License. 21.199 + 21.200 + 7. If, as a consequence of a court judgment or allegation of patent 21.201 +infringement or for any other reason (not limited to patent issues), 21.202 +conditions are imposed on you (whether by court order, agreement or 21.203 +otherwise) that contradict the conditions of this License, they do not 21.204 +excuse you from the conditions of this License. If you cannot 21.205 +distribute so as to satisfy simultaneously your obligations under this 21.206 +License and any other pertinent obligations, then as a consequence you 21.207 +may not distribute the Program at all. For example, if a patent 21.208 +license would not permit royalty-free redistribution of the Program by 21.209 +all those who receive copies directly or indirectly through you, then 21.210 +the only way you could satisfy both it and this License would be to 21.211 +refrain entirely from distribution of the Program. 21.212 + 21.213 +If any portion of this section is held invalid or unenforceable under 21.214 +any particular circumstance, the balance of the section is intended to 21.215 +apply and the section as a whole is intended to apply in other 21.216 +circumstances. 21.217 + 21.218 +It is not the purpose of this section to induce you to infringe any 21.219 +patents or other property right claims or to contest validity of any 21.220 +such claims; this section has the sole purpose of protecting the 21.221 +integrity of the free software distribution system, which is 21.222 +implemented by public license practices. Many people have made 21.223 +generous contributions to the wide range of software distributed 21.224 +through that system in reliance on consistent application of that 21.225 +system; it is up to the author/donor to decide if he or she is willing 21.226 +to distribute software through any other system and a licensee cannot 21.227 +impose that choice. 21.228 + 21.229 +This section is intended to make thoroughly clear what is believed to 21.230 +be a consequence of the rest of this License. 21.231 + 21.232 + 8. If the distribution and/or use of the Program is restricted in 21.233 +certain countries either by patents or by copyrighted interfaces, the 21.234 +original copyright holder who places the Program under this License 21.235 +may add an explicit geographical distribution limitation excluding 21.236 +those countries, so that distribution is permitted only in or among 21.237 +countries not thus excluded. In such case, this License incorporates 21.238 +the limitation as if written in the body of this License. 21.239 + 21.240 + 9. The Free Software Foundation may publish revised and/or new versions 21.241 +of the General Public License from time to time. Such new versions will 21.242 +be similar in spirit to the present version, but may differ in detail to 21.243 +address new problems or concerns. 21.244 + 21.245 +Each version is given a distinguishing version number. If the Program 21.246 +specifies a version number of this License which applies to it and "any 21.247 +later version", you have the option of following the terms and conditions 21.248 +either of that version or of any later version published by the Free 21.249 +Software Foundation. If the Program does not specify a version number of 21.250 +this License, you may choose any version ever published by the Free Software 21.251 +Foundation. 21.252 + 21.253 + 10. If you wish to incorporate parts of the Program into other free 21.254 +programs whose distribution conditions are different, write to the author 21.255 +to ask for permission. For software which is copyrighted by the Free 21.256 +Software Foundation, write to the Free Software Foundation; we sometimes 21.257 +make exceptions for this. Our decision will be guided by the two goals 21.258 +of preserving the free status of all derivatives of our free software and 21.259 +of promoting the sharing and reuse of software generally. 21.260 + 21.261 + NO WARRANTY 21.262 + 21.263 + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 21.264 +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 21.265 +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 21.266 +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 21.267 +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 21.268 +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 21.269 +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 21.270 +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 21.271 +REPAIR OR CORRECTION. 21.272 + 21.273 + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 21.274 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 21.275 +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 21.276 +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 21.277 +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 21.278 +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 21.279 +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 21.280 +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 21.281 +POSSIBILITY OF SUCH DAMAGES. 21.282 + 21.283 + END OF TERMS AND CONDITIONS 21.284 + 21.285 + How to Apply These Terms to Your New Programs 21.286 + 21.287 + If you develop a new program, and you want it to be of the greatest 21.288 +possible use to the public, the best way to achieve this is to make it 21.289 +free software which everyone can redistribute and change under these terms. 21.290 + 21.291 + To do so, attach the following notices to the program. It is safest 21.292 +to attach them to the start of each source file to most effectively 21.293 +convey the exclusion of warranty; and each file should have at least 21.294 +the "copyright" line and a pointer to where the full notice is found. 21.295 + 21.296 + <one line to give the program's name and a brief idea of what it does.> 21.297 + Copyright (C) <year> <name of author> 21.298 + 21.299 + This program is free software; you can redistribute it and/or modify 21.300 + it under the terms of the GNU General Public License as published by 21.301 + the Free Software Foundation; either version 2 of the License, or 21.302 + (at your option) any later version. 21.303 + 21.304 + This program is distributed in the hope that it will be useful, 21.305 + but WITHOUT ANY WARRANTY; without even the implied warranty of 21.306 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 21.307 + GNU General Public License for more details. 21.308 + 21.309 + You should have received a copy of the GNU General Public License 21.310 + along with this program; if not, write to the Free Software 21.311 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 21.312 + 21.313 + 21.314 +Also add information on how to contact you by electronic and paper mail. 21.315 + 21.316 +If the program is interactive, make it output a short notice like this 21.317 +when it starts in an interactive mode: 21.318 + 21.319 + Gnomovision version 69, Copyright (C) year name of author 21.320 + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 21.321 + This is free software, and you are welcome to redistribute it 21.322 + under certain conditions; type `show c' for details. 21.323 + 21.324 +The hypothetical commands `show w' and `show c' should show the appropriate 21.325 +parts of the General Public License. Of course, the commands you use may 21.326 +be called something other than `show w' and `show c'; they could even be 21.327 +mouse-clicks or menu items--whatever suits your program. 21.328 + 21.329 +You should also get your employer (if you work as a programmer) or your 21.330 +school, if any, to sign a "copyright disclaimer" for the program, if 21.331 +necessary. Here is a sample; alter the names: 21.332 + 21.333 + Yoyodyne, Inc., hereby disclaims all copyright interest in the program 21.334 + `Gnomovision' (which makes passes at compilers) written by James Hacker. 21.335 + 21.336 + <signature of Ty Coon>, 1 April 1989 21.337 + Ty Coon, President of Vice 21.338 + 21.339 +This General Public License does not permit incorporating your program into 21.340 +proprietary programs. If your program is a subroutine library, you may 21.341 +consider it more useful to permit linking proprietary applications with the 21.342 +library. If this is what you want to do, use the GNU Library General 21.343 +Public License instead of this License.
22.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 22.2 +++ b/docs/LICENCE-Sarissa-lgpl.txt Sat Jul 07 16:17:29 2007 +0000 22.3 @@ -0,0 +1,504 @@ 22.4 + GNU LESSER GENERAL PUBLIC LICENSE 22.5 + Version 2.1, February 1999 22.6 + 22.7 + Copyright (C) 1991, 1999 Free Software Foundation, Inc. 22.8 + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22.9 + Everyone is permitted to copy and distribute verbatim copies 22.10 + of this license document, but changing it is not allowed. 22.11 + 22.12 +[This is the first released version of the Lesser GPL. It also counts 22.13 + as the successor of the GNU Library Public License, version 2, hence 22.14 + the version number 2.1.] 22.15 + 22.16 + Preamble 22.17 + 22.18 + The licenses for most software are designed to take away your 22.19 +freedom to share and change it. By contrast, the GNU General Public 22.20 +Licenses are intended to guarantee your freedom to share and change 22.21 +free software--to make sure the software is free for all its users. 22.22 + 22.23 + This license, the Lesser General Public License, applies to some 22.24 +specially designated software packages--typically libraries--of the 22.25 +Free Software Foundation and other authors who decide to use it. You 22.26 +can use it too, but we suggest you first think carefully about whether 22.27 +this license or the ordinary General Public License is the better 22.28 +strategy to use in any particular case, based on the explanations below. 22.29 + 22.30 + When we speak of free software, we are referring to freedom of use, 22.31 +not price. Our General Public Licenses are designed to make sure that 22.32 +you have the freedom to distribute copies of free software (and charge 22.33 +for this service if you wish); that you receive source code or can get 22.34 +it if you want it; that you can change the software and use pieces of 22.35 +it in new free programs; and that you are informed that you can do 22.36 +these things. 22.37 + 22.38 + To protect your rights, we need to make restrictions that forbid 22.39 +distributors to deny you these rights or to ask you to surrender these 22.40 +rights. These restrictions translate to certain responsibilities for 22.41 +you if you distribute copies of the library or if you modify it. 22.42 + 22.43 + For example, if you distribute copies of the library, whether gratis 22.44 +or for a fee, you must give the recipients all the rights that we gave 22.45 +you. You must make sure that they, too, receive or can get the source 22.46 +code. If you link other code with the library, you must provide 22.47 +complete object files to the recipients, so that they can relink them 22.48 +with the library after making changes to the library and recompiling 22.49 +it. And you must show them these terms so they know their rights. 22.50 + 22.51 + We protect your rights with a two-step method: (1) we copyright the 22.52 +library, and (2) we offer you this license, which gives you legal 22.53 +permission to copy, distribute and/or modify the library. 22.54 + 22.55 + To protect each distributor, we want to make it very clear that 22.56 +there is no warranty for the free library. Also, if the library is 22.57 +modified by someone else and passed on, the recipients should know 22.58 +that what they have is not the original version, so that the original 22.59 +author's reputation will not be affected by problems that might be 22.60 +introduced by others. 22.61 + 22.62 + Finally, software patents pose a constant threat to the existence of 22.63 +any free program. We wish to make sure that a company cannot 22.64 +effectively restrict the users of a free program by obtaining a 22.65 +restrictive license from a patent holder. Therefore, we insist that 22.66 +any patent license obtained for a version of the library must be 22.67 +consistent with the full freedom of use specified in this license. 22.68 + 22.69 + Most GNU software, including some libraries, is covered by the 22.70 +ordinary GNU General Public License. This license, the GNU Lesser 22.71 +General Public License, applies to certain designated libraries, and 22.72 +is quite different from the ordinary General Public License. We use 22.73 +this license for certain libraries in order to permit linking those 22.74 +libraries into non-free programs. 22.75 + 22.76 + When a program is linked with a library, whether statically or using 22.77 +a shared library, the combination of the two is legally speaking a 22.78 +combined work, a derivative of the original library. The ordinary 22.79 +General Public License therefore permits such linking only if the 22.80 +entire combination fits its criteria of freedom. The Lesser General 22.81 +Public License permits more lax criteria for linking other code with 22.82 +the library. 22.83 + 22.84 + We call this license the "Lesser" General Public License because it 22.85 +does Less to protect the user's freedom than the ordinary General 22.86 +Public License. It also provides other free software developers Less 22.87 +of an advantage over competing non-free programs. These disadvantages 22.88 +are the reason we use the ordinary General Public License for many 22.89 +libraries. However, the Lesser license provides advantages in certain 22.90 +special circumstances. 22.91 + 22.92 + For example, on rare occasions, there may be a special need to 22.93 +encourage the widest possible use of a certain library, so that it becomes 22.94 +a de-facto standard. To achieve this, non-free programs must be 22.95 +allowed to use the library. A more frequent case is that a free 22.96 +library does the same job as widely used non-free libraries. In this 22.97 +case, there is little to gain by limiting the free library to free 22.98 +software only, so we use the Lesser General Public License. 22.99 + 22.100 + In other cases, permission to use a particular library in non-free 22.101 +programs enables a greater number of people to use a large body of 22.102 +free software. For example, permission to use the GNU C Library in 22.103 +non-free programs enables many more people to use the whole GNU 22.104 +operating system, as well as its variant, the GNU/Linux operating 22.105 +system. 22.106 + 22.107 + Although the Lesser General Public License is Less protective of the 22.108 +users' freedom, it does ensure that the user of a program that is 22.109 +linked with the Library has the freedom and the wherewithal to run 22.110 +that program using a modified version of the Library. 22.111 + 22.112 + The precise terms and conditions for copying, distribution and 22.113 +modification follow. Pay close attention to the difference between a 22.114 +"work based on the library" and a "work that uses the library". The 22.115 +former contains code derived from the library, whereas the latter must 22.116 +be combined with the library in order to run. 22.117 + 22.118 + GNU LESSER GENERAL PUBLIC LICENSE 22.119 + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 22.120 + 22.121 + 0. This License Agreement applies to any software library or other 22.122 +program which contains a notice placed by the copyright holder or 22.123 +other authorized party saying it may be distributed under the terms of 22.124 +this Lesser General Public License (also called "this License"). 22.125 +Each licensee is addressed as "you". 22.126 + 22.127 + A "library" means a collection of software functions and/or data 22.128 +prepared so as to be conveniently linked with application programs 22.129 +(which use some of those functions and data) to form executables. 22.130 + 22.131 + The "Library", below, refers to any such software library or work 22.132 +which has been distributed under these terms. A "work based on the 22.133 +Library" means either the Library or any derivative work under 22.134 +copyright law: that is to say, a work containing the Library or a 22.135 +portion of it, either verbatim or with modifications and/or translated 22.136 +straightforwardly into another language. (Hereinafter, translation is 22.137 +included without limitation in the term "modification".) 22.138 + 22.139 + "Source code" for a work means the preferred form of the work for 22.140 +making modifications to it. For a library, complete source code means 22.141 +all the source code for all modules it contains, plus any associated 22.142 +interface definition files, plus the scripts used to control compilation 22.143 +and installation of the library. 22.144 + 22.145 + Activities other than copying, distribution and modification are not 22.146 +covered by this License; they are outside its scope. The act of 22.147 +running a program using the Library is not restricted, and output from 22.148 +such a program is covered only if its contents constitute a work based 22.149 +on the Library (independent of the use of the Library in a tool for 22.150 +writing it). Whether that is true depends on what the Library does 22.151 +and what the program that uses the Library does. 22.152 + 22.153 + 1. You may copy and distribute verbatim copies of the Library's 22.154 +complete source code as you receive it, in any medium, provided that 22.155 +you conspicuously and appropriately publish on each copy an 22.156 +appropriate copyright notice and disclaimer of warranty; keep intact 22.157 +all the notices that refer to this License and to the absence of any 22.158 +warranty; and distribute a copy of this License along with the 22.159 +Library. 22.160 + 22.161 + You may charge a fee for the physical act of transferring a copy, 22.162 +and you may at your option offer warranty protection in exchange for a 22.163 +fee. 22.164 + 22.165 + 2. You may modify your copy or copies of the Library or any portion 22.166 +of it, thus forming a work based on the Library, and copy and 22.167 +distribute such modifications or work under the terms of Section 1 22.168 +above, provided that you also meet all of these conditions: 22.169 + 22.170 + a) The modified work must itself be a software library. 22.171 + 22.172 + b) You must cause the files modified to carry prominent notices 22.173 + stating that you changed the files and the date of any change. 22.174 + 22.175 + c) You must cause the whole of the work to be licensed at no 22.176 + charge to all third parties under the terms of this License. 22.177 + 22.178 + d) If a facility in the modified Library refers to a function or a 22.179 + table of data to be supplied by an application program that uses 22.180 + the facility, other than as an argument passed when the facility 22.181 + is invoked, then you must make a good faith effort to ensure that, 22.182 + in the event an application does not supply such function or 22.183 + table, the facility still operates, and performs whatever part of 22.184 + its purpose remains meaningful. 22.185 + 22.186 + (For example, a function in a library to compute square roots has 22.187 + a purpose that is entirely well-defined independent of the 22.188 + application. Therefore, Subsection 2d requires that any 22.189 + application-supplied function or table used by this function must 22.190 + be optional: if the application does not supply it, the square 22.191 + root function must still compute square roots.) 22.192 + 22.193 +These requirements apply to the modified work as a whole. If 22.194 +identifiable sections of that work are not derived from the Library, 22.195 +and can be reasonably considered independent and separate works in 22.196 +themselves, then this License, and its terms, do not apply to those 22.197 +sections when you distribute them as separate works. But when you 22.198 +distribute the same sections as part of a whole which is a work based 22.199 +on the Library, the distribution of the whole must be on the terms of 22.200 +this License, whose permissions for other licensees extend to the 22.201 +entire whole, and thus to each and every part regardless of who wrote 22.202 +it. 22.203 + 22.204 +Thus, it is not the intent of this section to claim rights or contest 22.205 +your rights to work written entirely by you; rather, the intent is to 22.206 +exercise the right to control the distribution of derivative or 22.207 +collective works based on the Library. 22.208 + 22.209 +In addition, mere aggregation of another work not based on the Library 22.210 +with the Library (or with a work based on the Library) on a volume of 22.211 +a storage or distribution medium does not bring the other work under 22.212 +the scope of this License. 22.213 + 22.214 + 3. You may opt to apply the terms of the ordinary GNU General Public 22.215 +License instead of this License to a given copy of the Library. To do 22.216 +this, you must alter all the notices that refer to this License, so 22.217 +that they refer to the ordinary GNU General Public License, version 2, 22.218 +instead of to this License. (If a newer version than version 2 of the 22.219 +ordinary GNU General Public License has appeared, then you can specify 22.220 +that version instead if you wish.) Do not make any other change in 22.221 +these notices. 22.222 + 22.223 + Once this change is made in a given copy, it is irreversible for 22.224 +that copy, so the ordinary GNU General Public License applies to all 22.225 +subsequent copies and derivative works made from that copy. 22.226 + 22.227 + This option is useful when you wish to copy part of the code of 22.228 +the Library into a program that is not a library. 22.229 + 22.230 + 4. You may copy and distribute the Library (or a portion or 22.231 +derivative of it, under Section 2) in object code or executable form 22.232 +under the terms of Sections 1 and 2 above provided that you accompany 22.233 +it with the complete corresponding machine-readable source code, which 22.234 +must be distributed under the terms of Sections 1 and 2 above on a 22.235 +medium customarily used for software interchange. 22.236 + 22.237 + If distribution of object code is made by offering access to copy 22.238 +from a designated place, then offering equivalent access to copy the 22.239 +source code from the same place satisfies the requirement to 22.240 +distribute the source code, even though third parties are not 22.241 +compelled to copy the source along with the object code. 22.242 + 22.243 + 5. A program that contains no derivative of any portion of the 22.244 +Library, but is designed to work with the Library by being compiled or 22.245 +linked with it, is called a "work that uses the Library". Such a 22.246 +work, in isolation, is not a derivative work of the Library, and 22.247 +therefore falls outside the scope of this License. 22.248 + 22.249 + However, linking a "work that uses the Library" with the Library 22.250 +creates an executable that is a derivative of the Library (because it 22.251 +contains portions of the Library), rather than a "work that uses the 22.252 +library". The executable is therefore covered by this License. 22.253 +Section 6 states terms for distribution of such executables. 22.254 + 22.255 + When a "work that uses the Library" uses material from a header file 22.256 +that is part of the Library, the object code for the work may be a 22.257 +derivative work of the Library even though the source code is not. 22.258 +Whether this is true is especially significant if the work can be 22.259 +linked without the Library, or if the work is itself a library. The 22.260 +threshold for this to be true is not precisely defined by law. 22.261 + 22.262 + If such an object file uses only numerical parameters, data 22.263 +structure layouts and accessors, and small macros and small inline 22.264 +functions (ten lines or less in length), then the use of the object 22.265 +file is unrestricted, regardless of whether it is legally a derivative 22.266 +work. (Executables containing this object code plus portions of the 22.267 +Library will still fall under Section 6.) 22.268 + 22.269 + Otherwise, if the work is a derivative of the Library, you may 22.270 +distribute the object code for the work under the terms of Section 6. 22.271 +Any executables containing that work also fall under Section 6, 22.272 +whether or not they are linked directly with the Library itself. 22.273 + 22.274 + 6. As an exception to the Sections above, you may also combine or 22.275 +link a "work that uses the Library" with the Library to produce a 22.276 +work containing portions of the Library, and distribute that work 22.277 +under terms of your choice, provided that the terms permit 22.278 +modification of the work for the customer's own use and reverse 22.279 +engineering for debugging such modifications. 22.280 + 22.281 + You must give prominent notice with each copy of the work that the 22.282 +Library is used in it and that the Library and its use are covered by 22.283 +this License. You must supply a copy of this License. If the work 22.284 +during execution displays copyright notices, you must include the 22.285 +copyright notice for the Library among them, as well as a reference 22.286 +directing the user to the copy of this License. Also, you must do one 22.287 +of these things: 22.288 + 22.289 + a) Accompany the work with the complete corresponding 22.290 + machine-readable source code for the Library including whatever 22.291 + changes were used in the work (which must be distributed under 22.292 + Sections 1 and 2 above); and, if the work is an executable linked 22.293 + with the Library, with the complete machine-readable "work that 22.294 + uses the Library", as object code and/or source code, so that the 22.295 + user can modify the Library and then relink to produce a modified 22.296 + executable containing the modified Library. (It is understood 22.297 + that the user who changes the contents of definitions files in the 22.298 + Library will not necessarily be able to recompile the application 22.299 + to use the modified definitions.) 22.300 + 22.301 + b) Use a suitable shared library mechanism for linking with the 22.302 + Library. A suitable mechanism is one that (1) uses at run time a 22.303 + copy of the library already present on the user's computer system, 22.304 + rather than copying library functions into the executable, and (2) 22.305 + will operate properly with a modified version of the library, if 22.306 + the user installs one, as long as the modified version is 22.307 + interface-compatible with the version that the work was made with. 22.308 + 22.309 + c) Accompany the work with a written offer, valid for at 22.310 + least three years, to give the same user the materials 22.311 + specified in Subsection 6a, above, for a charge no more 22.312 + than the cost of performing this distribution. 22.313 + 22.314 + d) If distribution of the work is made by offering access to copy 22.315 + from a designated place, offer equivalent access to copy the above 22.316 + specified materials from the same place. 22.317 + 22.318 + e) Verify that the user has already received a copy of these 22.319 + materials or that you have already sent this user a copy. 22.320 + 22.321 + For an executable, the required form of the "work that uses the 22.322 +Library" must include any data and utility programs needed for 22.323 +reproducing the executable from it. However, as a special exception, 22.324 +the materials to be distributed need not include anything that is 22.325 +normally distributed (in either source or binary form) with the major 22.326 +components (compiler, kernel, and so on) of the operating system on 22.327 +which the executable runs, unless that component itself accompanies 22.328 +the executable. 22.329 + 22.330 + It may happen that this requirement contradicts the license 22.331 +restrictions of other proprietary libraries that do not normally 22.332 +accompany the operating system. Such a contradiction means you cannot 22.333 +use both them and the Library together in an executable that you 22.334 +distribute. 22.335 + 22.336 + 7. You may place library facilities that are a work based on the 22.337 +Library side-by-side in a single library together with other library 22.338 +facilities not covered by this License, and distribute such a combined 22.339 +library, provided that the separate distribution of the work based on 22.340 +the Library and of the other library facilities is otherwise 22.341 +permitted, and provided that you do these two things: 22.342 + 22.343 + a) Accompany the combined library with a copy of the same work 22.344 + based on the Library, uncombined with any other library 22.345 + facilities. This must be distributed under the terms of the 22.346 + Sections above. 22.347 + 22.348 + b) Give prominent notice with the combined library of the fact 22.349 + that part of it is a work based on the Library, and explaining 22.350 + where to find the accompanying uncombined form of the same work. 22.351 + 22.352 + 8. You may not copy, modify, sublicense, link with, or distribute 22.353 +the Library except as expressly provided under this License. Any 22.354 +attempt otherwise to copy, modify, sublicense, link with, or 22.355 +distribute the Library is void, and will automatically terminate your 22.356 +rights under this License. However, parties who have received copies, 22.357 +or rights, from you under this License will not have their licenses 22.358 +terminated so long as such parties remain in full compliance. 22.359 + 22.360 + 9. You are not required to accept this License, since you have not 22.361 +signed it. However, nothing else grants you permission to modify or 22.362 +distribute the Library or its derivative works. These actions are 22.363 +prohibited by law if you do not accept this License. Therefore, by 22.364 +modifying or distributing the Library (or any work based on the 22.365 +Library), you indicate your acceptance of this License to do so, and 22.366 +all its terms and conditions for copying, distributing or modifying 22.367 +the Library or works based on it. 22.368 + 22.369 + 10. Each time you redistribute the Library (or any work based on the 22.370 +Library), the recipient automatically receives a license from the 22.371 +original licensor to copy, distribute, link with or modify the Library 22.372 +subject to these terms and conditions. You may not impose any further 22.373 +restrictions on the recipients' exercise of the rights granted herein. 22.374 +You are not responsible for enforcing compliance by third parties with 22.375 +this License. 22.376 + 22.377 + 11. If, as a consequence of a court judgment or allegation of patent 22.378 +infringement or for any other reason (not limited to patent issues), 22.379 +conditions are imposed on you (whether by court order, agreement or 22.380 +otherwise) that contradict the conditions of this License, they do not 22.381 +excuse you from the conditions of this License. If you cannot 22.382 +distribute so as to satisfy simultaneously your obligations under this 22.383 +License and any other pertinent obligations, then as a consequence you 22.384 +may not distribute the Library at all. For example, if a patent 22.385 +license would not permit royalty-free redistribution of the Library by 22.386 +all those who receive copies directly or indirectly through you, then 22.387 +the only way you could satisfy both it and this License would be to 22.388 +refrain entirely from distribution of the Library. 22.389 + 22.390 +If any portion of this section is held invalid or unenforceable under any 22.391 +particular circumstance, the balance of the section is intended to apply, 22.392 +and the section as a whole is intended to apply in other circumstances. 22.393 + 22.394 +It is not the purpose of this section to induce you to infringe any 22.395 +patents or other property right claims or to contest validity of any 22.396 +such claims; this section has the sole purpose of protecting the 22.397 +integrity of the free software distribution system which is 22.398 +implemented by public license practices. Many people have made 22.399 +generous contributions to the wide range of software distributed 22.400 +through that system in reliance on consistent application of that 22.401 +system; it is up to the author/donor to decide if he or she is willing 22.402 +to distribute software through any other system and a licensee cannot 22.403 +impose that choice. 22.404 + 22.405 +This section is intended to make thoroughly clear what is believed to 22.406 +be a consequence of the rest of this License. 22.407 + 22.408 + 12. If the distribution and/or use of the Library is restricted in 22.409 +certain countries either by patents or by copyrighted interfaces, the 22.410 +original copyright holder who places the Library under this License may add 22.411 +an explicit geographical distribution limitation excluding those countries, 22.412 +so that distribution is permitted only in or among countries not thus 22.413 +excluded. In such case, this License incorporates the limitation as if 22.414 +written in the body of this License. 22.415 + 22.416 + 13. The Free Software Foundation may publish revised and/or new 22.417 +versions of the Lesser General Public License from time to time. 22.418 +Such new versions will be similar in spirit to the present version, 22.419 +but may differ in detail to address new problems or concerns. 22.420 + 22.421 +Each version is given a distinguishing version number. If the Library 22.422 +specifies a version number of this License which applies to it and 22.423 +"any later version", you have the option of following the terms and 22.424 +conditions either of that version or of any later version published by 22.425 +the Free Software Foundation. If the Library does not specify a 22.426 +license version number, you may choose any version ever published by 22.427 +the Free Software Foundation. 22.428 + 22.429 + 14. If you wish to incorporate parts of the Library into other free 22.430 +programs whose distribution conditions are incompatible with these, 22.431 +write to the author to ask for permission. For software which is 22.432 +copyrighted by the Free Software Foundation, write to the Free 22.433 +Software Foundation; we sometimes make exceptions for this. Our 22.434 +decision will be guided by the two goals of preserving the free status 22.435 +of all derivatives of our free software and of promoting the sharing 22.436 +and reuse of software generally. 22.437 + 22.438 + NO WARRANTY 22.439 + 22.440 + 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 22.441 +WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 22.442 +EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 22.443 +OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 22.444 +KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 22.445 +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 22.446 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 22.447 +LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 22.448 +THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 22.449 + 22.450 + 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 22.451 +WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 22.452 +AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 22.453 +FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 22.454 +CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 22.455 +LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 22.456 +RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 22.457 +FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 22.458 +SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 22.459 +DAMAGES. 22.460 + 22.461 + END OF TERMS AND CONDITIONS 22.462 + 22.463 + How to Apply These Terms to Your New Libraries 22.464 + 22.465 + If you develop a new library, and you want it to be of the greatest 22.466 +possible use to the public, we recommend making it free software that 22.467 +everyone can redistribute and change. You can do so by permitting 22.468 +redistribution under these terms (or, alternatively, under the terms of the 22.469 +ordinary General Public License). 22.470 + 22.471 + To apply these terms, attach the following notices to the library. It is 22.472 +safest to attach them to the start of each source file to most effectively 22.473 +convey the exclusion of warranty; and each file should have at least the 22.474 +"copyright" line and a pointer to where the full notice is found. 22.475 + 22.476 + <one line to give the library's name and a brief idea of what it does.> 22.477 + Copyright (C) <year> <name of author> 22.478 + 22.479 + This library is free software; you can redistribute it and/or 22.480 + modify it under the terms of the GNU Lesser General Public 22.481 + License as published by the Free Software Foundation; either 22.482 + version 2.1 of the License, or (at your option) any later version. 22.483 + 22.484 + This library is distributed in the hope that it will be useful, 22.485 + but WITHOUT ANY WARRANTY; without even the implied warranty of 22.486 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 22.487 + Lesser General Public License for more details. 22.488 + 22.489 + You should have received a copy of the GNU Lesser General Public 22.490 + License along with this library; if not, write to the Free Software 22.491 + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 22.492 + 22.493 +Also add information on how to contact you by electronic and paper mail. 22.494 + 22.495 +You should also get your employer (if you work as a programmer) or your 22.496 +school, if any, to sign a "copyright disclaimer" for the library, if 22.497 +necessary. Here is a sample; alter the names: 22.498 + 22.499 + Yoyodyne, Inc., hereby disclaims all copyright interest in the 22.500 + library `Frob' (a library for tweaking knobs) written by James Random Hacker. 22.501 + 22.502 + <signature of Ty Coon>, 1 April 1990 22.503 + Ty Coon, President of Vice 22.504 + 22.505 +That's all there is to it! 22.506 + 22.507 +
23.1 --- a/docs/LICENCE-Sarissa.txt Sun Jun 10 22:52:12 2007 +0000 23.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 23.3 @@ -1,280 +0,0 @@ 23.4 - GNU GENERAL PUBLIC LICENSE 23.5 - Version 2, June 1991 23.6 - 23.7 - Copyright (C) 1989, 1991 Free Software Foundation, Inc. 23.8 - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 23.9 - Everyone is permitted to copy and distribute verbatim copies 23.10 - of this license document, but changing it is not allowed. 23.11 - 23.12 - Preamble 23.13 - 23.14 - The licenses for most software are designed to take away your 23.15 -freedom to share and change it. By contrast, the GNU General Public 23.16 -License is intended to guarantee your freedom to share and change free 23.17 -software--to make sure the software is free for all its users. This 23.18 -General Public License applies to most of the Free Software 23.19 -Foundation's software and to any other program whose authors commit to 23.20 -using it. (Some other Free Software Foundation software is covered by 23.21 -the GNU Library General Public License instead.) You can apply it to 23.22 -your programs, too. 23.23 - 23.24 - When we speak of free software, we are referring to freedom, not 23.25 -price. Our General Public Licenses are designed to make sure that you 23.26 -have the freedom to distribute copies of free software (and charge for 23.27 -this service if you wish), that you receive source code or can get it 23.28 -if you want it, that you can change the software or use pieces of it 23.29 -in new free programs; and that you know you can do these things. 23.30 - 23.31 - To protect your rights, we need to make restrictions that forbid 23.32 -anyone to deny you these rights or to ask you to surrender the rights. 23.33 -These restrictions translate to certain responsibilities for you if you 23.34 -distribute copies of the software, or if you modify it. 23.35 - 23.36 - For example, if you distribute copies of such a program, whether 23.37 -gratis or for a fee, you must give the recipients all the rights that 23.38 -you have. You must make sure that they, too, receive or can get the 23.39 -source code. And you must show them these terms so they know their 23.40 -rights. 23.41 - 23.42 - We protect your rights with two steps: (1) copyright the software, and 23.43 -(2) offer you this license which gives you legal permission to copy, 23.44 -distribute and/or modify the software. 23.45 - 23.46 - Also, for each author's protection and ours, we want to make certain 23.47 -that everyone understands that there is no warranty for this free 23.48 -software. If the software is modified by someone else and passed on, we 23.49 -want its recipients to know that what they have is not the original, so 23.50 -that any problems introduced by others will not reflect on the original 23.51 -authors' reputations. 23.52 - 23.53 - Finally, any free program is threatened constantly by software 23.54 -patents. We wish to avoid the danger that redistributors of a free 23.55 -program will individually obtain patent licenses, in effect making the 23.56 -program proprietary. To prevent this, we have made it clear that any 23.57 -patent must be licensed for everyone's free use or not licensed at all. 23.58 - 23.59 - The precise terms and conditions for copying, distribution and 23.60 -modification follow. 23.61 - 23.62 - GNU GENERAL PUBLIC LICENSE 23.63 - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 23.64 - 23.65 - 0. This License applies to any program or other work which contains 23.66 -a notice placed by the copyright holder saying it may be distributed 23.67 -under the terms of this General Public License. The "Program", below, 23.68 -refers to any such program or work, and a "work based on the Program" 23.69 -means either the Program or any derivative work under copyright law: 23.70 -that is to say, a work containing the Program or a portion of it, 23.71 -either verbatim or with modifications and/or translated into another 23.72 -language. (Hereinafter, translation is included without limitation in 23.73 -the term "modification".) Each licensee is addressed as "you". 23.74 - 23.75 -Activities other than copying, distribution and modification are not 23.76 -covered by this License; they are outside its scope. The act of 23.77 -running the Program is not restricted, and the output from the Program 23.78 -is covered only if its contents constitute a work based on the 23.79 -Program (independent of having been made by running the Program). 23.80 -Whether that is true depends on what the Program does. 23.81 - 23.82 - 1. You may copy and distribute verbatim copies of the Program's 23.83 -source code as you receive it, in any medium, provided that you 23.84 -conspicuously and appropriately publish on each copy an appropriate 23.85 -copyright notice and disclaimer of warranty; keep intact all the 23.86 -notices that refer to this License and to the absence of any warranty; 23.87 -and give any other recipients of the Program a copy of this License 23.88 -along with the Program. 23.89 - 23.90 -You may charge a fee for the physical act of transferring a copy, and 23.91 -you may at your option offer warranty protection in exchange for a fee. 23.92 - 23.93 - 2. You may modify your copy or copies of the Program or any portion 23.94 -of it, thus forming a work based on the Program, and copy and 23.95 -distribute such modifications or work under the terms of Section 1 23.96 -above, provided that you also meet all of these conditions: 23.97 - 23.98 - a) You must cause the modified files to carry prominent notices 23.99 - stating that you changed the files and the date of any change. 23.100 - 23.101 - b) You must cause any work that you distribute or publish, that in 23.102 - whole or in part contains or is derived from the Program or any 23.103 - part thereof, to be licensed as a whole at no charge to all third 23.104 - parties under the terms of this License. 23.105 - 23.106 - c) If the modified program normally reads commands interactively 23.107 - when run, you must cause it, when started running for such 23.108 - interactive use in the most ordinary way, to print or display an 23.109 - announcement including an appropriate copyright notice and a 23.110 - notice that there is no warranty (or else, saying that you provide 23.111 - a warranty) and that users may redistribute the program under 23.112 - these conditions, and telling the user how to view a copy of this 23.113 - License. (Exception: if the Program itself is interactive but 23.114 - does not normally print such an announcement, your work based on 23.115 - the Program is not required to print an announcement.) 23.116 - 23.117 -These requirements apply to the modified work as a whole. If 23.118 -identifiable sections of that work are not derived from the Program, 23.119 -and can be reasonably considered independent and separate works in 23.120 -themselves, then this License, and its terms, do not apply to those 23.121 -sections when you distribute them as separate works. But when you 23.122 -distribute the same sections as part of a whole which is a work based 23.123 -on the Program, the distribution of the whole must be on the terms of 23.124 -this License, whose permissions for other licensees extend to the 23.125 -entire whole, and thus to each and every part regardless of who wrote it. 23.126 - 23.127 -Thus, it is not the intent of this section to claim rights or contest 23.128 -your rights to work written entirely by you; rather, the intent is to 23.129 -exercise the right to control the distribution of derivative or 23.130 -collective works based on the Program. 23.131 - 23.132 -In addition, mere aggregation of another work not based on the Program 23.133 -with the Program (or with a work based on the Program) on a volume of 23.134 -a storage or distribution medium does not bring the other work under 23.135 -the scope of this License. 23.136 - 23.137 - 3. You may copy and distribute the Program (or a work based on it, 23.138 -under Section 2) in object code or executable form under the terms of 23.139 -Sections 1 and 2 above provided that you also do one of the following: 23.140 - 23.141 - a) Accompany it with the complete corresponding machine-readable 23.142 - source code, which must be distributed under the terms of Sections 23.143 - 1 and 2 above on a medium customarily used for software interchange; or, 23.144 - 23.145 - b) Accompany it with a written offer, valid for at least three 23.146 - years, to give any third party, for a charge no more than your 23.147 - cost of physically performing source distribution, a complete 23.148 - machine-readable copy of the corresponding source code, to be 23.149 - distributed under the terms of Sections 1 and 2 above on a medium 23.150 - customarily used for software interchange; or, 23.151 - 23.152 - c) Accompany it with the information you received as to the offer 23.153 - to distribute corresponding source code. (This alternative is 23.154 - allowed only for noncommercial distribution and only if you 23.155 - received the program in object code or executable form with such 23.156 - an offer, in accord with Subsection b above.) 23.157 - 23.158 -The source code for a work means the preferred form of the work for 23.159 -making modifications to it. For an executable work, complete source 23.160 -code means all the source code for all modules it contains, plus any 23.161 -associated interface definition files, plus the scripts used to 23.162 -control compilation and installation of the executable. However, as a 23.163 -special exception, the source code distributed need not include 23.164 -anything that is normally distributed (in either source or binary 23.165 -form) with the major components (compiler, kernel, and so on) of the 23.166 -operating system on which the executable runs, unless that component 23.167 -itself accompanies the executable. 23.168 - 23.169 -If distribution of executable or object code is made by offering 23.170 -access to copy from a designated place, then offering equivalent 23.171 -access to copy the source code from the same place counts as 23.172 -distribution of the source code, even though third parties are not 23.173 -compelled to copy the source along with the object code. 23.174 - 23.175 - 4. You may not copy, modify, sublicense, or distribute the Program 23.176 -except as expressly provided under this License. Any attempt 23.177 -otherwise to copy, modify, sublicense or distribute the Program is 23.178 -void, and will automatically terminate your rights under this License. 23.179 -However, parties who have received copies, or rights, from you under 23.180 -this License will not have their licenses terminated so long as such 23.181 -parties remain in full compliance. 23.182 - 23.183 - 5. You are not required to accept this License, since you have not 23.184 -signed it. However, nothing else grants you permission to modify or 23.185 -distribute the Program or its derivative works. These actions are 23.186 -prohibited by law if you do not accept this License. Therefore, by 23.187 -modifying or distributing the Program (or any work based on the 23.188 -Program), you indicate your acceptance of this License to do so, and 23.189 -all its terms and conditions for copying, distributing or modifying 23.190 -the Program or works based on it. 23.191 - 23.192 - 6. Each time you redistribute the Program (or any work based on the 23.193 -Program), the recipient automatically receives a license from the 23.194 -original licensor to copy, distribute or modify the Program subject to 23.195 -these terms and conditions. You may not impose any further 23.196 -restrictions on the recipients' exercise of the rights granted herein. 23.197 -You are not responsible for enforcing compliance by third parties to 23.198 -this License. 23.199 - 23.200 - 7. If, as a consequence of a court judgment or allegation of patent 23.201 -infringement or for any other reason (not limited to patent issues), 23.202 -conditions are imposed on you (whether by court order, agreement or 23.203 -otherwise) that contradict the conditions of this License, they do not 23.204 -excuse you from the conditions of this License. If you cannot 23.205 -distribute so as to satisfy simultaneously your obligations under this 23.206 -License and any other pertinent obligations, then as a consequence you 23.207 -may not distribute the Program at all. For example, if a patent 23.208 -license would not permit royalty-free redistribution of the Program by 23.209 -all those who receive copies directly or indirectly through you, then 23.210 -the only way you could satisfy both it and this License would be to 23.211 -refrain entirely from distribution of the Program. 23.212 - 23.213 -If any portion of this section is held invalid or unenforceable under 23.214 -any particular circumstance, the balance of the section is intended to 23.215 -apply and the section as a whole is intended to apply in other 23.216 -circumstances. 23.217 - 23.218 -It is not the purpose of this section to induce you to infringe any 23.219 -patents or other property right claims or to contest validity of any 23.220 -such claims; this section has the sole purpose of protecting the 23.221 -integrity of the free software distribution system, which is 23.222 -implemented by public license practices. Many people have made 23.223 -generous contributions to the wide range of software distributed 23.224 -through that system in reliance on consistent application of that 23.225 -system; it is up to the author/donor to decide if he or she is willing 23.226 -to distribute software through any other system and a licensee cannot 23.227 -impose that choice. 23.228 - 23.229 -This section is intended to make thoroughly clear what is believed to 23.230 -be a consequence of the rest of this License. 23.231 - 23.232 - 8. If the distribution and/or use of the Program is restricted in 23.233 -certain countries either by patents or by copyrighted interfaces, the 23.234 -original copyright holder who places the Program under this License 23.235 -may add an explicit geographical distribution limitation excluding 23.236 -those countries, so that distribution is permitted only in or among 23.237 -countries not thus excluded. In such case, this License incorporates 23.238 -the limitation as if written in the body of this License. 23.239 - 23.240 - 9. The Free Software Foundation may publish revised and/or new versions 23.241 -of the General Public License from time to time. Such new versions will 23.242 -be similar in spirit to the present version, but may differ in detail to 23.243 -address new problems or concerns. 23.244 - 23.245 -Each version is given a distinguishing version number. If the Program 23.246 -specifies a version number of this License which applies to it and "any 23.247 -later version", you have the option of following the terms and conditions 23.248 -either of that version or of any later version published by the Free 23.249 -Software Foundation. If the Program does not specify a version number of 23.250 -this License, you may choose any version ever published by the Free Software 23.251 -Foundation. 23.252 - 23.253 - 10. If you wish to incorporate parts of the Program into other free 23.254 -programs whose distribution conditions are different, write to the author 23.255 -to ask for permission. For software which is copyrighted by the Free 23.256 -Software Foundation, write to the Free Software Foundation; we sometimes 23.257 -make exceptions for this. Our decision will be guided by the two goals 23.258 -of preserving the free status of all derivatives of our free software and 23.259 -of promoting the sharing and reuse of software generally. 23.260 - 23.261 - NO WARRANTY 23.262 - 23.263 - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY 23.264 -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN 23.265 -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES 23.266 -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED 23.267 -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 23.268 -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS 23.269 -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE 23.270 -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, 23.271 -REPAIR OR CORRECTION. 23.272 - 23.273 - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 23.274 -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR 23.275 -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, 23.276 -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING 23.277 -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED 23.278 -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY 23.279 -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER 23.280 -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE 23.281 -POSSIBILITY OF SUCH DAMAGES. 23.282 - 23.283 - END OF TERMS AND CONDITIONS
24.1 --- a/docs/LICENCE.txt Sun Jun 10 22:52:12 2007 +0000 24.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 24.3 @@ -1,458 +0,0 @@ 24.4 - GNU LESSER GENERAL PUBLIC LICENSE 24.5 - Version 2.1, February 1999 24.6 - 24.7 - Copyright (C) 1991, 1999 Free Software Foundation, Inc. 24.8 - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 24.9 - Everyone is permitted to copy and distribute verbatim copies 24.10 - of this license document, but changing it is not allowed. 24.11 - 24.12 -[This is the first released version of the Lesser GPL. It also counts 24.13 - as the successor of the GNU Library Public License, version 2, hence 24.14 - the version number 2.1.] 24.15 - 24.16 - Preamble 24.17 - 24.18 - The licenses for most software are designed to take away your 24.19 -freedom to share and change it. By contrast, the GNU General Public 24.20 -Licenses are intended to guarantee your freedom to share and change 24.21 -free software--to make sure the software is free for all its users. 24.22 - 24.23 - This license, the Lesser General Public License, applies to some 24.24 -specially designated software packages--typically libraries--of the 24.25 -Free Software Foundation and other authors who decide to use it. You 24.26 -can use it too, but we suggest you first think carefully about whether 24.27 -this license or the ordinary General Public License is the better 24.28 -strategy to use in any particular case, based on the explanations below. 24.29 - 24.30 - When we speak of free software, we are referring to freedom of use, 24.31 -not price. Our General Public Licenses are designed to make sure that 24.32 -you have the freedom to distribute copies of free software (and charge 24.33 -for this service if you wish); that you receive source code or can get 24.34 -it if you want it; that you can change the software and use pieces of 24.35 -it in new free programs; and that you are informed that you can do 24.36 -these things. 24.37 - 24.38 - To protect your rights, we need to make restrictions that forbid 24.39 -distributors to deny you these rights or to ask you to surrender these 24.40 -rights. These restrictions translate to certain responsibilities for 24.41 -you if you distribute copies of the library or if you modify it. 24.42 - 24.43 - For example, if you distribute copies of the library, whether gratis 24.44 -or for a fee, you must give the recipients all the rights that we gave 24.45 -you. You must make sure that they, too, receive or can get the source 24.46 -code. If you link other code with the library, you must provide 24.47 -complete object files to the recipients, so that they can relink them 24.48 -with the library after making changes to the library and recompiling 24.49 -it. And you must show them these terms so they know their rights. 24.50 - 24.51 - We protect your rights with a two-step method: (1) we copyright the 24.52 -library, and (2) we offer you this license, which gives you legal 24.53 -permission to copy, distribute and/or modify the library. 24.54 - 24.55 - To protect each distributor, we want to make it very clear that 24.56 -there is no warranty for the free library. Also, if the library is 24.57 -modified by someone else and passed on, the recipients should know 24.58 -that what they have is not the original version, so that the original 24.59 -author's reputation will not be affected by problems that might be 24.60 -introduced by others. 24.61 - 24.62 - Finally, software patents pose a constant threat to the existence of 24.63 -any free program. We wish to make sure that a company cannot 24.64 -effectively restrict the users of a free program by obtaining a 24.65 -restrictive license from a patent holder. Therefore, we insist that 24.66 -any patent license obtained for a version of the library must be 24.67 -consistent with the full freedom of use specified in this license. 24.68 - 24.69 - Most GNU software, including some libraries, is covered by the 24.70 -ordinary GNU General Public License. This license, the GNU Lesser 24.71 -General Public License, applies to certain designated libraries, and 24.72 -is quite different from the ordinary General Public License. We use 24.73 -this license for certain libraries in order to permit linking those 24.74 -libraries into non-free programs. 24.75 - 24.76 - When a program is linked with a library, whether statically or using 24.77 -a shared library, the combination of the two is legally speaking a 24.78 -combined work, a derivative of the original library. The ordinary 24.79 -General Public License therefore permits such linking only if the 24.80 -entire combination fits its criteria of freedom. The Lesser General 24.81 -Public License permits more lax criteria for linking other code with 24.82 -the library. 24.83 - 24.84 - We call this license the "Lesser" General Public License because it 24.85 -does Less to protect the user's freedom than the ordinary General 24.86 -Public License. It also provides other free software developers Less 24.87 -of an advantage over competing non-free programs. These disadvantages 24.88 -are the reason we use the ordinary General Public License for many 24.89 -libraries. However, the Lesser license provides advantages in certain 24.90 -special circumstances. 24.91 - 24.92 - For example, on rare occasions, there may be a special need to 24.93 -encourage the widest possible use of a certain library, so that it becomes 24.94 -a de-facto standard. To achieve this, non-free programs must be 24.95 -allowed to use the library. A more frequent case is that a free 24.96 -library does the same job as widely used non-free libraries. In this 24.97 -case, there is little to gain by limiting the free library to free 24.98 -software only, so we use the Lesser General Public License. 24.99 - 24.100 - In other cases, permission to use a particular library in non-free 24.101 -programs enables a greater number of people to use a large body of 24.102 -free software. For example, permission to use the GNU C Library in 24.103 -non-free programs enables many more people to use the whole GNU 24.104 -operating system, as well as its variant, the GNU/Linux operating 24.105 -system. 24.106 - 24.107 - Although the Lesser General Public License is Less protective of the 24.108 -users' freedom, it does ensure that the user of a program that is 24.109 -linked with the Library has the freedom and the wherewithal to run 24.110 -that program using a modified version of the Library. 24.111 - 24.112 - The precise terms and conditions for copying, distribution and 24.113 -modification follow. Pay close attention to the difference between a 24.114 -"work based on the library" and a "work that uses the library". The 24.115 -former contains code derived from the library, whereas the latter must 24.116 -be combined with the library in order to run. 24.117 - 24.118 - GNU LESSER GENERAL PUBLIC LICENSE 24.119 - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 24.120 - 24.121 - 0. This License Agreement applies to any software library or other 24.122 -program which contains a notice placed by the copyright holder or 24.123 -other authorized party saying it may be distributed under the terms of 24.124 -this Lesser General Public License (also called "this License"). 24.125 -Each licensee is addressed as "you". 24.126 - 24.127 - A "library" means a collection of software functions and/or data 24.128 -prepared so as to be conveniently linked with application programs 24.129 -(which use some of those functions and data) to form executables. 24.130 - 24.131 - The "Library", below, refers to any such software library or work 24.132 -which has been distributed under these terms. A "work based on the 24.133 -Library" means either the Library or any derivative work under 24.134 -copyright law: that is to say, a work containing the Library or a 24.135 -portion of it, either verbatim or with modifications and/or translated 24.136 -straightforwardly into another language. (Hereinafter, translation is 24.137 -included without limitation in the term "modification".) 24.138 - 24.139 - "Source code" for a work means the preferred form of the work for 24.140 -making modifications to it. For a library, complete source code means 24.141 -all the source code for all modules it contains, plus any associated 24.142 -interface definition files, plus the scripts used to control compilation 24.143 -and installation of the library. 24.144 - 24.145 - Activities other than copying, distribution and modification are not 24.146 -covered by this License; they are outside its scope. The act of 24.147 -running a program using the Library is not restricted, and output from 24.148 -such a program is covered only if its contents constitute a work based 24.149 -on the Library (independent of the use of the Library in a tool for 24.150 -writing it). Whether that is true depends on what the Library does 24.151 -and what the program that uses the Library does. 24.152 - 24.153 - 1. You may copy and distribute verbatim copies of the Library's 24.154 -complete source code as you receive it, in any medium, provided that 24.155 -you conspicuously and appropriately publish on each copy an 24.156 -appropriate copyright notice and disclaimer of warranty; keep intact 24.157 -all the notices that refer to this License and to the absence of any 24.158 -warranty; and distribute a copy of this License along with the 24.159 -Library. 24.160 - 24.161 - You may charge a fee for the physical act of transferring a copy, 24.162 -and you may at your option offer warranty protection in exchange for a 24.163 -fee. 24.164 - 24.165 - 2. You may modify your copy or copies of the Library or any portion 24.166 -of it, thus forming a work based on the Library, and copy and 24.167 -distribute such modifications or work under the terms of Section 1 24.168 -above, provided that you also meet all of these conditions: 24.169 - 24.170 - a) The modified work must itself be a software library. 24.171 - 24.172 - b) You must cause the files modified to carry prominent notices 24.173 - stating that you changed the files and the date of any change. 24.174 - 24.175 - c) You must cause the whole of the work to be licensed at no 24.176 - charge to all third parties under the terms of this License. 24.177 - 24.178 - d) If a facility in the modified Library refers to a function or a 24.179 - table of data to be supplied by an application program that uses 24.180 - the facility, other than as an argument passed when the facility 24.181 - is invoked, then you must make a good faith effort to ensure that, 24.182 - in the event an application does not supply such function or 24.183 - table, the facility still operates, and performs whatever part of 24.184 - its purpose remains meaningful. 24.185 - 24.186 - (For example, a function in a library to compute square roots has 24.187 - a purpose that is entirely well-defined independent of the 24.188 - application. Therefore, Subsection 2d requires that any 24.189 - application-supplied function or table used by this function must 24.190 - be optional: if the application does not supply it, the square 24.191 - root function must still compute square roots.) 24.192 - 24.193 -These requirements apply to the modified work as a whole. If 24.194 -identifiable sections of that work are not derived from the Library, 24.195 -and can be reasonably considered independent and separate works in 24.196 -themselves, then this License, and its terms, do not apply to those 24.197 -sections when you distribute them as separate works. But when you 24.198 -distribute the same sections as part of a whole which is a work based 24.199 -on the Library, the distribution of the whole must be on the terms of 24.200 -this License, whose permissions for other licensees extend to the 24.201 -entire whole, and thus to each and every part regardless of who wrote 24.202 -it. 24.203 - 24.204 -Thus, it is not the intent of this section to claim rights or contest 24.205 -your rights to work written entirely by you; rather, the intent is to 24.206 -exercise the right to control the distribution of derivative or 24.207 -collective works based on the Library. 24.208 - 24.209 -In addition, mere aggregation of another work not based on the Library 24.210 -with the Library (or with a work based on the Library) on a volume of 24.211 -a storage or distribution medium does not bring the other work under 24.212 -the scope of this License. 24.213 - 24.214 - 3. You may opt to apply the terms of the ordinary GNU General Public 24.215 -License instead of this License to a given copy of the Library. To do 24.216 -this, you must alter all the notices that refer to this License, so 24.217 -that they refer to the ordinary GNU General Public License, version 2, 24.218 -instead of to this License. (If a newer version than version 2 of the 24.219 -ordinary GNU General Public License has appeared, then you can specify 24.220 -that version instead if you wish.) Do not make any other change in 24.221 -these notices. 24.222 - 24.223 - Once this change is made in a given copy, it is irreversible for 24.224 -that copy, so the ordinary GNU General Public License applies to all 24.225 -subsequent copies and derivative works made from that copy. 24.226 - 24.227 - This option is useful when you wish to copy part of the code of 24.228 -the Library into a program that is not a library. 24.229 - 24.230 - 4. You may copy and distribute the Library (or a portion or 24.231 -derivative of it, under Section 2) in object code or executable form 24.232 -under the terms of Sections 1 and 2 above provided that you accompany 24.233 -it with the complete corresponding machine-readable source code, which 24.234 -must be distributed under the terms of Sections 1 and 2 above on a 24.235 -medium customarily used for software interchange. 24.236 - 24.237 - If distribution of object code is made by offering access to copy 24.238 -from a designated place, then offering equivalent access to copy the 24.239 -source code from the same place satisfies the requirement to 24.240 -distribute the source code, even though third parties are not 24.241 -compelled to copy the source along with the object code. 24.242 - 24.243 - 5. A program that contains no derivative of any portion of the 24.244 -Library, but is designed to work with the Library by being compiled or 24.245 -linked with it, is called a "work that uses the Library". Such a 24.246 -work, in isolation, is not a derivative work of the Library, and 24.247 -therefore falls outside the scope of this License. 24.248 - 24.249 - However, linking a "work that uses the Library" with the Library 24.250 -creates an executable that is a derivative of the Library (because it 24.251 -contains portions of the Library), rather than a "work that uses the 24.252 -library". The executable is therefore covered by this License. 24.253 -Section 6 states terms for distribution of such executables. 24.254 - 24.255 - When a "work that uses the Library" uses material from a header file 24.256 -that is part of the Library, the object code for the work may be a 24.257 -derivative work of the Library even though the source code is not. 24.258 -Whether this is true is especially significant if the work can be 24.259 -linked without the Library, or if the work is itself a library. The 24.260 -threshold for this to be true is not precisely defined by law. 24.261 - 24.262 - If such an object file uses only numerical parameters, data 24.263 -structure layouts and accessors, and small macros and small inline 24.264 -functions (ten lines or less in length), then the use of the object 24.265 -file is unrestricted, regardless of whether it is legally a derivative 24.266 -work. (Executables containing this object code plus portions of the 24.267 -Library will still fall under Section 6.) 24.268 - 24.269 - Otherwise, if the work is a derivative of the Library, you may 24.270 -distribute the object code for the work under the terms of Section 6. 24.271 -Any executables containing that work also fall under Section 6, 24.272 -whether or not they are linked directly with the Library itself. 24.273 - 24.274 - 6. As an exception to the Sections above, you may also combine or 24.275 -link a "work that uses the Library" with the Library to produce a 24.276 -work containing portions of the Library, and distribute that work 24.277 -under terms of your choice, provided that the terms permit 24.278 -modification of the work for the customer's own use and reverse 24.279 -engineering for debugging such modifications. 24.280 - 24.281 - You must give prominent notice with each copy of the work that the 24.282 -Library is used in it and that the Library and its use are covered by 24.283 -this License. You must supply a copy of this License. If the work 24.284 -during execution displays copyright notices, you must include the 24.285 -copyright notice for the Library among them, as well as a reference 24.286 -directing the user to the copy of this License. Also, you must do one 24.287 -of these things: 24.288 - 24.289 - a) Accompany the work with the complete corresponding 24.290 - machine-readable source code for the Library including whatever 24.291 - changes were used in the work (which must be distributed under 24.292 - Sections 1 and 2 above); and, if the work is an executable linked 24.293 - with the Library, with the complete machine-readable "work that 24.294 - uses the Library", as object code and/or source code, so that the 24.295 - user can modify the Library and then relink to produce a modified 24.296 - executable containing the modified Library. (It is understood 24.297 - that the user who changes the contents of definitions files in the 24.298 - Library will not necessarily be able to recompile the application 24.299 - to use the modified definitions.) 24.300 - 24.301 - b) Use a suitable shared library mechanism for linking with the 24.302 - Library. A suitable mechanism is one that (1) uses at run time a 24.303 - copy of the library already present on the user's computer system, 24.304 - rather than copying library functions into the executable, and (2) 24.305 - will operate properly with a modified version of the library, if 24.306 - the user installs one, as long as the modified version is 24.307 - interface-compatible with the version that the work was made with. 24.308 - 24.309 - c) Accompany the work with a written offer, valid for at 24.310 - least three years, to give the same user the materials 24.311 - specified in Subsection 6a, above, for a charge no more 24.312 - than the cost of performing this distribution. 24.313 - 24.314 - d) If distribution of the work is made by offering access to copy 24.315 - from a designated place, offer equivalent access to copy the above 24.316 - specified materials from the same place. 24.317 - 24.318 - e) Verify that the user has already received a copy of these 24.319 - materials or that you have already sent this user a copy. 24.320 - 24.321 - For an executable, the required form of the "work that uses the 24.322 -Library" must include any data and utility programs needed for 24.323 -reproducing the executable from it. However, as a special exception, 24.324 -the materials to be distributed need not include anything that is 24.325 -normally distributed (in either source or binary form) with the major 24.326 -components (compiler, kernel, and so on) of the operating system on 24.327 -which the executable runs, unless that component itself accompanies 24.328 -the executable. 24.329 - 24.330 - It may happen that this requirement contradicts the license 24.331 -restrictions of other proprietary libraries that do not normally 24.332 -accompany the operating system. Such a contradiction means you cannot 24.333 -use both them and the Library together in an executable that you 24.334 -distribute. 24.335 - 24.336 - 7. You may place library facilities that are a work based on the 24.337 -Library side-by-side in a single library together with other library 24.338 -facilities not covered by this License, and distribute such a combined 24.339 -library, provided that the separate distribution of the work based on 24.340 -the Library and of the other library facilities is otherwise 24.341 -permitted, and provided that you do these two things: 24.342 - 24.343 - a) Accompany the combined library with a copy of the same work 24.344 - based on the Library, uncombined with any other library 24.345 - facilities. This must be distributed under the terms of the 24.346 - Sections above. 24.347 - 24.348 - b) Give prominent notice with the combined library of the fact 24.349 - that part of it is a work based on the Library, and explaining 24.350 - where to find the accompanying uncombined form of the same work. 24.351 - 24.352 - 8. You may not copy, modify, sublicense, link with, or distribute 24.353 -the Library except as expressly provided under this License. Any 24.354 -attempt otherwise to copy, modify, sublicense, link with, or 24.355 -distribute the Library is void, and will automatically terminate your 24.356 -rights under this License. However, parties who have received copies, 24.357 -or rights, from you under this License will not have their licenses 24.358 -terminated so long as such parties remain in full compliance. 24.359 - 24.360 - 9. You are not required to accept this License, since you have not 24.361 -signed it. However, nothing else grants you permission to modify or 24.362 -distribute the Library or its derivative works. These actions are 24.363 -prohibited by law if you do not accept this License. Therefore, by 24.364 -modifying or distributing the Library (or any work based on the 24.365 -Library), you indicate your acceptance of this License to do so, and 24.366 -all its terms and conditions for copying, distributing or modifying 24.367 -the Library or works based on it. 24.368 - 24.369 - 10. Each time you redistribute the Library (or any work based on the 24.370 -Library), the recipient automatically receives a license from the 24.371 -original licensor to copy, distribute, link with or modify the Library 24.372 -subject to these terms and conditions. You may not impose any further 24.373 -restrictions on the recipients' exercise of the rights granted herein. 24.374 -You are not responsible for enforcing compliance by third parties with 24.375 -this License. 24.376 - 24.377 - 11. If, as a consequence of a court judgment or allegation of patent 24.378 -infringement or for any other reason (not limited to patent issues), 24.379 -conditions are imposed on you (whether by court order, agreement or 24.380 -otherwise) that contradict the conditions of this License, they do not 24.381 -excuse you from the conditions of this License. If you cannot 24.382 -distribute so as to satisfy simultaneously your obligations under this 24.383 -License and any other pertinent obligations, then as a consequence you 24.384 -may not distribute the Library at all. For example, if a patent 24.385 -license would not permit royalty-free redistribution of the Library by 24.386 -all those who receive copies directly or indirectly through you, then 24.387 -the only way you could satisfy both it and this License would be to 24.388 -refrain entirely from distribution of the Library. 24.389 - 24.390 -If any portion of this section is held invalid or unenforceable under any 24.391 -particular circumstance, the balance of the section is intended to apply, 24.392 -and the section as a whole is intended to apply in other circumstances. 24.393 - 24.394 -It is not the purpose of this section to induce you to infringe any 24.395 -patents or other property right claims or to contest validity of any 24.396 -such claims; this section has the sole purpose of protecting the 24.397 -integrity of the free software distribution system which is 24.398 -implemented by public license practices. Many people have made 24.399 -generous contributions to the wide range of software distributed 24.400 -through that system in reliance on consistent application of that 24.401 -system; it is up to the author/donor to decide if he or she is willing 24.402 -to distribute software through any other system and a licensee cannot 24.403 -impose that choice. 24.404 - 24.405 -This section is intended to make thoroughly clear what is believed to 24.406 -be a consequence of the rest of this License. 24.407 - 24.408 - 12. If the distribution and/or use of the Library is restricted in 24.409 -certain countries either by patents or by copyrighted interfaces, the 24.410 -original copyright holder who places the Library under this License may add 24.411 -an explicit geographical distribution limitation excluding those countries, 24.412 -so that distribution is permitted only in or among countries not thus 24.413 -excluded. In such case, this License incorporates the limitation as if 24.414 -written in the body of this License. 24.415 - 24.416 - 13. The Free Software Foundation may publish revised and/or new 24.417 -versions of the Lesser General Public License from time to time. 24.418 -Such new versions will be similar in spirit to the present version, 24.419 -but may differ in detail to address new problems or concerns. 24.420 - 24.421 -Each version is given a distinguishing version number. If the Library 24.422 -specifies a version number of this License which applies to it and 24.423 -"any later version", you have the option of following the terms and 24.424 -conditions either of that version or of any later version published by 24.425 -the Free Software Foundation. If the Library does not specify a 24.426 -license version number, you may choose any version ever published by 24.427 -the Free Software Foundation. 24.428 - 24.429 - 14. If you wish to incorporate parts of the Library into other free 24.430 -programs whose distribution conditions are incompatible with these, 24.431 -write to the author to ask for permission. For software which is 24.432 -copyrighted by the Free Software Foundation, write to the Free 24.433 -Software Foundation; we sometimes make exceptions for this. Our 24.434 -decision will be guided by the two goals of preserving the free status 24.435 -of all derivatives of our free software and of promoting the sharing 24.436 -and reuse of software generally. 24.437 - 24.438 - NO WARRANTY 24.439 - 24.440 - 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO 24.441 -WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW. 24.442 -EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR 24.443 -OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY 24.444 -KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE 24.445 -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 24.446 -PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE 24.447 -LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME 24.448 -THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 24.449 - 24.450 - 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN 24.451 -WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY 24.452 -AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU 24.453 -FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR 24.454 -CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE 24.455 -LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING 24.456 -RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A 24.457 -FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF 24.458 -SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH 24.459 -DAMAGES. 24.460 - 24.461 - END OF TERMS AND CONDITIONS
25.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 25.2 +++ b/docs/gpl-3.0.txt Sat Jul 07 16:17:29 2007 +0000 25.3 @@ -0,0 +1,674 @@ 25.4 + GNU GENERAL PUBLIC LICENSE 25.5 + Version 3, 29 June 2007 25.6 + 25.7 + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> 25.8 + Everyone is permitted to copy and distribute verbatim copies 25.9 + of this license document, but changing it is not allowed. 25.10 + 25.11 + Preamble 25.12 + 25.13 + The GNU General Public License is a free, copyleft license for 25.14 +software and other kinds of works. 25.15 + 25.16 + The licenses for most software and other practical works are designed 25.17 +to take away your freedom to share and change the works. By contrast, 25.18 +the GNU General Public License is intended to guarantee your freedom to 25.19 +share and change all versions of a program--to make sure it remains free 25.20 +software for all its users. We, the Free Software Foundation, use the 25.21 +GNU General Public License for most of our software; it applies also to 25.22 +any other work released this way by its authors. You can apply it to 25.23 +your programs, too. 25.24 + 25.25 + When we speak of free software, we are referring to freedom, not 25.26 +price. Our General Public Licenses are designed to make sure that you 25.27 +have the freedom to distribute copies of free software (and charge for 25.28 +them if you wish), that you receive source code or can get it if you 25.29 +want it, that you can change the software or use pieces of it in new 25.30 +free programs, and that you know you can do these things. 25.31 + 25.32 + To protect your rights, we need to prevent others from denying you 25.33 +these rights or asking you to surrender the rights. Therefore, you have 25.34 +certain responsibilities if you distribute copies of the software, or if 25.35 +you modify it: responsibilities to respect the freedom of others. 25.36 + 25.37 + For example, if you distribute copies of such a program, whether 25.38 +gratis or for a fee, you must pass on to the recipients the same 25.39 +freedoms that you received. You must make sure that they, too, receive 25.40 +or can get the source code. And you must show them these terms so they 25.41 +know their rights. 25.42 + 25.43 + Developers that use the GNU GPL protect your rights with two steps: 25.44 +(1) assert copyright on the software, and (2) offer you this License 25.45 +giving you legal permission to copy, distribute and/or modify it. 25.46 + 25.47 + For the developers' and authors' protection, the GPL clearly explains 25.48 +that there is no warranty for this free software. For both users' and 25.49 +authors' sake, the GPL requires that modified versions be marked as 25.50 +changed, so that their problems will not be attributed erroneously to 25.51 +authors of previous versions. 25.52 + 25.53 + Some devices are designed to deny users access to install or run 25.54 +modified versions of the software inside them, although the manufacturer 25.55 +can do so. This is fundamentally incompatible with the aim of 25.56 +protecting users' freedom to change the software. The systematic 25.57 +pattern of such abuse occurs in the area of products for individuals to 25.58 +use, which is precisely where it is most unacceptable. Therefore, we 25.59 +have designed this version of the GPL to prohibit the practice for those 25.60 +products. If such problems arise substantially in other domains, we 25.61 +stand ready to extend this provision to those domains in future versions 25.62 +of the GPL, as needed to protect the freedom of users. 25.63 + 25.64 + Finally, every program is threatened constantly by software patents. 25.65 +States should not allow patents to restrict development and use of 25.66 +software on general-purpose computers, but in those that do, we wish to 25.67 +avoid the special danger that patents applied to a free program could 25.68 +make it effectively proprietary. To prevent this, the GPL assures that 25.69 +patents cannot be used to render the program non-free. 25.70 + 25.71 + The precise terms and conditions for copying, distribution and 25.72 +modification follow. 25.73 + 25.74 + TERMS AND CONDITIONS 25.75 + 25.76 + 0. Definitions. 25.77 + 25.78 + "This License" refers to version 3 of the GNU General Public License. 25.79 + 25.80 + "Copyright" also means copyright-like laws that apply to other kinds of 25.81 +works, such as semiconductor masks. 25.82 + 25.83 + "The Program" refers to any copyrightable work licensed under this 25.84 +License. Each licensee is addressed as "you". "Licensees" and 25.85 +"recipients" may be individuals or organizations. 25.86 + 25.87 + To "modify" a work means to copy from or adapt all or part of the work 25.88 +in a fashion requiring copyright permission, other than the making of an 25.89 +exact copy. The resulting work is called a "modified version" of the 25.90 +earlier work or a work "based on" the earlier work. 25.91 + 25.92 + A "covered work" means either the unmodified Program or a work based 25.93 +on the Program. 25.94 + 25.95 + To "propagate" a work means to do anything with it that, without 25.96 +permission, would make you directly or secondarily liable for 25.97 +infringement under applicable copyright law, except executing it on a 25.98 +computer or modifying a private copy. Propagation includes copying, 25.99 +distribution (with or without modification), making available to the 25.100 +public, and in some countries other activities as well. 25.101 + 25.102 + To "convey" a work means any kind of propagation that enables other 25.103 +parties to make or receive copies. Mere interaction with a user through 25.104 +a computer network, with no transfer of a copy, is not conveying. 25.105 + 25.106 + An interactive user interface displays "Appropriate Legal Notices" 25.107 +to the extent that it includes a convenient and prominently visible 25.108 +feature that (1) displays an appropriate copyright notice, and (2) 25.109 +tells the user that there is no warranty for the work (except to the 25.110 +extent that warranties are provided), that licensees may convey the 25.111 +work under this License, and how to view a copy of this License. If 25.112 +the interface presents a list of user commands or options, such as a 25.113 +menu, a prominent item in the list meets this criterion. 25.114 + 25.115 + 1. Source Code. 25.116 + 25.117 + The "source code" for a work means the preferred form of the work 25.118 +for making modifications to it. "Object code" means any non-source 25.119 +form of a work. 25.120 + 25.121 + A "Standard Interface" means an interface that either is an official 25.122 +standard defined by a recognized standards body, or, in the case of 25.123 +interfaces specified for a particular programming language, one that 25.124 +is widely used among developers working in that language. 25.125 + 25.126 + The "System Libraries" of an executable work include anything, other 25.127 +than the work as a whole, that (a) is included in the normal form of 25.128 +packaging a Major Component, but which is not part of that Major 25.129 +Component, and (b) serves only to enable use of the work with that 25.130 +Major Component, or to implement a Standard Interface for which an 25.131 +implementation is available to the public in source code form. A 25.132 +"Major Component", in this context, means a major essential component 25.133 +(kernel, window system, and so on) of the specific operating system 25.134 +(if any) on which the executable work runs, or a compiler used to 25.135 +produce the work, or an object code interpreter used to run it. 25.136 + 25.137 + The "Corresponding Source" for a work in object code form means all 25.138 +the source code needed to generate, install, and (for an executable 25.139 +work) run the object code and to modify the work, including scripts to 25.140 +control those activities. However, it does not include the work's 25.141 +System Libraries, or general-purpose tools or generally available free 25.142 +programs which are used unmodified in performing those activities but 25.143 +which are not part of the work. For example, Corresponding Source 25.144 +includes interface definition files associated with source files for 25.145 +the work, and the source code for shared libraries and dynamically 25.146 +linked subprograms that the work is specifically designed to require, 25.147 +such as by intimate data communication or control flow between those 25.148 +subprograms and other parts of the work. 25.149 + 25.150 + The Corresponding Source need not include anything that users 25.151 +can regenerate automatically from other parts of the Corresponding 25.152 +Source. 25.153 + 25.154 + The Corresponding Source for a work in source code form is that 25.155 +same work. 25.156 + 25.157 + 2. Basic Permissions. 25.158 + 25.159 + All rights granted under this License are granted for the term of 25.160 +copyright on the Program, and are irrevocable provided the stated 25.161 +conditions are met. This License explicitly affirms your unlimited 25.162 +permission to run the unmodified Program. The output from running a 25.163 +covered work is covered by this License only if the output, given its 25.164 +content, constitutes a covered work. This License acknowledges your 25.165 +rights of fair use or other equivalent, as provided by copyright law. 25.166 + 25.167 + You may make, run and propagate covered works that you do not 25.168 +convey, without conditions so long as your license otherwise remains 25.169 +in force. You may convey covered works to others for the sole purpose 25.170 +of having them make modifications exclusively for you, or provide you 25.171 +with facilities for running those works, provided that you comply with 25.172 +the terms of this License in conveying all material for which you do 25.173 +not control copyright. Those thus making or running the covered works 25.174 +for you must do so exclusively on your behalf, under your direction 25.175 +and control, on terms that prohibit them from making any copies of 25.176 +your copyrighted material outside their relationship with you. 25.177 + 25.178 + Conveying under any other circumstances is permitted solely under 25.179 +the conditions stated below. Sublicensing is not allowed; section 10 25.180 +makes it unnecessary. 25.181 + 25.182 + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 25.183 + 25.184 + No covered work shall be deemed part of an effective technological 25.185 +measure under any applicable law fulfilling obligations under article 25.186 +11 of the WIPO copyright treaty adopted on 20 December 1996, or 25.187 +similar laws prohibiting or restricting circumvention of such 25.188 +measures. 25.189 + 25.190 + When you convey a covered work, you waive any legal power to forbid 25.191 +circumvention of technological measures to the extent such circumvention 25.192 +is effected by exercising rights under this License with respect to 25.193 +the covered work, and you disclaim any intention to limit operation or 25.194 +modification of the work as a means of enforcing, against the work's 25.195 +users, your or third parties' legal rights to forbid circumvention of 25.196 +technological measures. 25.197 + 25.198 + 4. Conveying Verbatim Copies. 25.199 + 25.200 + You may convey verbatim copies of the Program's source code as you 25.201 +receive it, in any medium, provided that you conspicuously and 25.202 +appropriately publish on each copy an appropriate copyright notice; 25.203 +keep intact all notices stating that this License and any 25.204 +non-permissive terms added in accord with section 7 apply to the code; 25.205 +keep intact all notices of the absence of any warranty; and give all 25.206 +recipients a copy of this License along with the Program. 25.207 + 25.208 + You may charge any price or no price for each copy that you convey, 25.209 +and you may offer support or warranty protection for a fee. 25.210 + 25.211 + 5. Conveying Modified Source Versions. 25.212 + 25.213 + You may convey a work based on the Program, or the modifications to 25.214 +produce it from the Program, in the form of source code under the 25.215 +terms of section 4, provided that you also meet all of these conditions: 25.216 + 25.217 + a) The work must carry prominent notices stating that you modified 25.218 + it, and giving a relevant date. 25.219 + 25.220 + b) The work must carry prominent notices stating that it is 25.221 + released under this License and any conditions added under section 25.222 + 7. This requirement modifies the requirement in section 4 to 25.223 + "keep intact all notices". 25.224 + 25.225 + c) You must license the entire work, as a whole, under this 25.226 + License to anyone who comes into possession of a copy. This 25.227 + License will therefore apply, along with any applicable section 7 25.228 + additional terms, to the whole of the work, and all its parts, 25.229 + regardless of how they are packaged. This License gives no 25.230 + permission to license the work in any other way, but it does not 25.231 + invalidate such permission if you have separately received it. 25.232 + 25.233 + d) If the work has interactive user interfaces, each must display 25.234 + Appropriate Legal Notices; however, if the Program has interactive 25.235 + interfaces that do not display Appropriate Legal Notices, your 25.236 + work need not make them do so. 25.237 + 25.238 + A compilation of a covered work with other separate and independent 25.239 +works, which are not by their nature extensions of the covered work, 25.240 +and which are not combined with it such as to form a larger program, 25.241 +in or on a volume of a storage or distribution medium, is called an 25.242 +"aggregate" if the compilation and its resulting copyright are not 25.243 +used to limit the access or legal rights of the compilation's users 25.244 +beyond what the individual works permit. Inclusion of a covered work 25.245 +in an aggregate does not cause this License to apply to the other 25.246 +parts of the aggregate. 25.247 + 25.248 + 6. Conveying Non-Source Forms. 25.249 + 25.250 + You may convey a covered work in object code form under the terms 25.251 +of sections 4 and 5, provided that you also convey the 25.252 +machine-readable Corresponding Source under the terms of this License, 25.253 +in one of these ways: 25.254 + 25.255 + a) Convey the object code in, or embodied in, a physical product 25.256 + (including a physical distribution medium), accompanied by the 25.257 + Corresponding Source fixed on a durable physical medium 25.258 + customarily used for software interchange. 25.259 + 25.260 + b) Convey the object code in, or embodied in, a physical product 25.261 + (including a physical distribution medium), accompanied by a 25.262 + written offer, valid for at least three years and valid for as 25.263 + long as you offer spare parts or customer support for that product 25.264 + model, to give anyone who possesses the object code either (1) a 25.265 + copy of the Corresponding Source for all the software in the 25.266 + product that is covered by this License, on a durable physical 25.267 + medium customarily used for software interchange, for a price no 25.268 + more than your reasonable cost of physically performing this 25.269 + conveying of source, or (2) access to copy the 25.270 + Corresponding Source from a network server at no charge. 25.271 + 25.272 + c) Convey individual copies of the object code with a copy of the 25.273 + written offer to provide the Corresponding Source. This 25.274 + alternative is allowed only occasionally and noncommercially, and 25.275 + only if you received the object code with such an offer, in accord 25.276 + with subsection 6b. 25.277 + 25.278 + d) Convey the object code by offering access from a designated 25.279 + place (gratis or for a charge), and offer equivalent access to the 25.280 + Corresponding Source in the same way through the same place at no 25.281 + further charge. You need not require recipients to copy the 25.282 + Corresponding Source along with the object code. If the place to 25.283 + copy the object code is a network server, the Corresponding Source 25.284 + may be on a different server (operated by you or a third party) 25.285 + that supports equivalent copying facilities, provided you maintain 25.286 + clear directions next to the object code saying where to find the 25.287 + Corresponding Source. Regardless of what server hosts the 25.288 + Corresponding Source, you remain obligated to ensure that it is 25.289 + available for as long as needed to satisfy these requirements. 25.290 + 25.291 + e) Convey the object code using peer-to-peer transmission, provided 25.292 + you inform other peers where the object code and Corresponding 25.293 + Source of the work are being offered to the general public at no 25.294 + charge under subsection 6d. 25.295 + 25.296 + A separable portion of the object code, whose source code is excluded 25.297 +from the Corresponding Source as a System Library, need not be 25.298 +included in conveying the object code work. 25.299 + 25.300 + A "User Product" is either (1) a "consumer product", which means any 25.301 +tangible personal property which is normally used for personal, family, 25.302 +or household purposes, or (2) anything designed or sold for incorporation 25.303 +into a dwelling. In determining whether a product is a consumer product, 25.304 +doubtful cases shall be resolved in favor of coverage. For a particular 25.305 +product received by a particular user, "normally used" refers to a 25.306 +typical or common use of that class of product, regardless of the status 25.307 +of the particular user or of the way in which the particular user 25.308 +actually uses, or expects or is expected to use, the product. A product 25.309 +is a consumer product regardless of whether the product has substantial 25.310 +commercial, industrial or non-consumer uses, unless such uses represent 25.311 +the only significant mode of use of the product. 25.312 + 25.313 + "Installation Information" for a User Product means any methods, 25.314 +procedures, authorization keys, or other information required to install 25.315 +and execute modified versions of a covered work in that User Product from 25.316 +a modified version of its Corresponding Source. The information must 25.317 +suffice to ensure that the continued functioning of the modified object 25.318 +code is in no case prevented or interfered with solely because 25.319 +modification has been made. 25.320 + 25.321 + If you convey an object code work under this section in, or with, or 25.322 +specifically for use in, a User Product, and the conveying occurs as 25.323 +part of a transaction in which the right of possession and use of the 25.324 +User Product is transferred to the recipient in perpetuity or for a 25.325 +fixed term (regardless of how the transaction is characterized), the 25.326 +Corresponding Source conveyed under this section must be accompanied 25.327 +by the Installation Information. But this requirement does not apply 25.328 +if neither you nor any third party retains the ability to install 25.329 +modified object code on the User Product (for example, the work has 25.330 +been installed in ROM). 25.331 + 25.332 + The requirement to provide Installation Information does not include a 25.333 +requirement to continue to provide support service, warranty, or updates 25.334 +for a work that has been modified or installed by the recipient, or for 25.335 +the User Product in which it has been modified or installed. Access to a 25.336 +network may be denied when the modification itself materially and 25.337 +adversely affects the operation of the network or violates the rules and 25.338 +protocols for communication across the network. 25.339 + 25.340 + Corresponding Source conveyed, and Installation Information provided, 25.341 +in accord with this section must be in a format that is publicly 25.342 +documented (and with an implementation available to the public in 25.343 +source code form), and must require no special password or key for 25.344 +unpacking, reading or copying. 25.345 + 25.346 + 7. Additional Terms. 25.347 + 25.348 + "Additional permissions" are terms that supplement the terms of this 25.349 +License by making exceptions from one or more of its conditions. 25.350 +Additional permissions that are applicable to the entire Program shall 25.351 +be treated as though they were included in this License, to the extent 25.352 +that they are valid under applicable law. If additional permissions 25.353 +apply only to part of the Program, that part may be used separately 25.354 +under those permissions, but the entire Program remains governed by 25.355 +this License without regard to the additional permissions. 25.356 + 25.357 + When you convey a copy of a covered work, you may at your option 25.358 +remove any additional permissions from that copy, or from any part of 25.359 +it. (Additional permissions may be written to require their own 25.360 +removal in certain cases when you modify the work.) You may place 25.361 +additional permissions on material, added by you to a covered work, 25.362 +for which you have or can give appropriate copyright permission. 25.363 + 25.364 + Notwithstanding any other provision of this License, for material you 25.365 +add to a covered work, you may (if authorized by the copyright holders of 25.366 +that material) supplement the terms of this License with terms: 25.367 + 25.368 + a) Disclaiming warranty or limiting liability differently from the 25.369 + terms of sections 15 and 16 of this License; or 25.370 + 25.371 + b) Requiring preservation of specified reasonable legal notices or 25.372 + author attributions in that material or in the Appropriate Legal 25.373 + Notices displayed by works containing it; or 25.374 + 25.375 + c) Prohibiting misrepresentation of the origin of that material, or 25.376 + requiring that modified versions of such material be marked in 25.377 + reasonable ways as different from the original version; or 25.378 + 25.379 + d) Limiting the use for publicity purposes of names of licensors or 25.380 + authors of the material; or 25.381 + 25.382 + e) Declining to grant rights under trademark law for use of some 25.383 + trade names, trademarks, or service marks; or 25.384 + 25.385 + f) Requiring indemnification of licensors and authors of that 25.386 + material by anyone who conveys the material (or modified versions of 25.387 + it) with contractual assumptions of liability to the recipient, for 25.388 + any liability that these contractual assumptions directly impose on 25.389 + those licensors and authors. 25.390 + 25.391 + All other non-permissive additional terms are considered "further 25.392 +restrictions" within the meaning of section 10. If the Program as you 25.393 +received it, or any part of it, contains a notice stating that it is 25.394 +governed by this License along with a term that is a further 25.395 +restriction, you may remove that term. If a license document contains 25.396 +a further restriction but permits relicensing or conveying under this 25.397 +License, you may add to a covered work material governed by the terms 25.398 +of that license document, provided that the further restriction does 25.399 +not survive such relicensing or conveying. 25.400 + 25.401 + If you add terms to a covered work in accord with this section, you 25.402 +must place, in the relevant source files, a statement of the 25.403 +additional terms that apply to those files, or a notice indicating 25.404 +where to find the applicable terms. 25.405 + 25.406 + Additional terms, permissive or non-permissive, may be stated in the 25.407 +form of a separately written license, or stated as exceptions; 25.408 +the above requirements apply either way. 25.409 + 25.410 + 8. Termination. 25.411 + 25.412 + You may not propagate or modify a covered work except as expressly 25.413 +provided under this License. Any attempt otherwise to propagate or 25.414 +modify it is void, and will automatically terminate your rights under 25.415 +this License (including any patent licenses granted under the third 25.416 +paragraph of section 11). 25.417 + 25.418 + However, if you cease all violation of this License, then your 25.419 +license from a particular copyright holder is reinstated (a) 25.420 +provisionally, unless and until the copyright holder explicitly and 25.421 +finally terminates your license, and (b) permanently, if the copyright 25.422 +holder fails to notify you of the violation by some reasonable means 25.423 +prior to 60 days after the cessation. 25.424 + 25.425 + Moreover, your license from a particular copyright holder is 25.426 +reinstated permanently if the copyright holder notifies you of the 25.427 +violation by some reasonable means, this is the first time you have 25.428 +received notice of violation of this License (for any work) from that 25.429 +copyright holder, and you cure the violation prior to 30 days after 25.430 +your receipt of the notice. 25.431 + 25.432 + Termination of your rights under this section does not terminate the 25.433 +licenses of parties who have received copies or rights from you under 25.434 +this License. If your rights have been terminated and not permanently 25.435 +reinstated, you do not qualify to receive new licenses for the same 25.436 +material under section 10. 25.437 + 25.438 + 9. Acceptance Not Required for Having Copies. 25.439 + 25.440 + You are not required to accept this License in order to receive or 25.441 +run a copy of the Program. Ancillary propagation of a covered work 25.442 +occurring solely as a consequence of using peer-to-peer transmission 25.443 +to receive a copy likewise does not require acceptance. However, 25.444 +nothing other than this License grants you permission to propagate or 25.445 +modify any covered work. These actions infringe copyright if you do 25.446 +not accept this License. Therefore, by modifying or propagating a 25.447 +covered work, you indicate your acceptance of this License to do so. 25.448 + 25.449 + 10. Automatic Licensing of Downstream Recipients. 25.450 + 25.451 + Each time you convey a covered work, the recipient automatically 25.452 +receives a license from the original licensors, to run, modify and 25.453 +propagate that work, subject to this License. You are not responsible 25.454 +for enforcing compliance by third parties with this License. 25.455 + 25.456 + An "entity transaction" is a transaction transferring control of an 25.457 +organization, or substantially all assets of one, or subdividing an 25.458 +organization, or merging organizations. If propagation of a covered 25.459 +work results from an entity transaction, each party to that 25.460 +transaction who receives a copy of the work also receives whatever 25.461 +licenses to the work the party's predecessor in interest had or could 25.462 +give under the previous paragraph, plus a right to possession of the 25.463 +Corresponding Source of the work from the predecessor in interest, if 25.464 +the predecessor has it or can get it with reasonable efforts. 25.465 + 25.466 + You may not impose any further restrictions on the exercise of the 25.467 +rights granted or affirmed under this License. For example, you may 25.468 +not impose a license fee, royalty, or other charge for exercise of 25.469 +rights granted under this License, and you may not initiate litigation 25.470 +(including a cross-claim or counterclaim in a lawsuit) alleging that 25.471 +any patent claim is infringed by making, using, selling, offering for 25.472 +sale, or importing the Program or any portion of it. 25.473 + 25.474 + 11. Patents. 25.475 + 25.476 + A "contributor" is a copyright holder who authorizes use under this 25.477 +License of the Program or a work on which the Program is based. The 25.478 +work thus licensed is called the contributor's "contributor version". 25.479 + 25.480 + A contributor's "essential patent claims" are all patent claims 25.481 +owned or controlled by the contributor, whether already acquired or 25.482 +hereafter acquired, that would be infringed by some manner, permitted 25.483 +by this License, of making, using, or selling its contributor version, 25.484 +but do not include claims that would be infringed only as a 25.485 +consequence of further modification of the contributor version. For 25.486 +purposes of this definition, "control" includes the right to grant 25.487 +patent sublicenses in a manner consistent with the requirements of 25.488 +this License. 25.489 + 25.490 + Each contributor grants you a non-exclusive, worldwide, royalty-free 25.491 +patent license under the contributor's essential patent claims, to 25.492 +make, use, sell, offer for sale, import and otherwise run, modify and 25.493 +propagate the contents of its contributor version. 25.494 + 25.495 + In the following three paragraphs, a "patent license" is any express 25.496 +agreement or commitment, however denominated, not to enforce a patent 25.497 +(such as an express permission to practice a patent or covenant not to 25.498 +sue for patent infringement). To "grant" such a patent license to a 25.499 +party means to make such an agreement or commitment not to enforce a 25.500 +patent against the party. 25.501 + 25.502 + If you convey a covered work, knowingly relying on a patent license, 25.503 +and the Corresponding Source of the work is not available for anyone 25.504 +to copy, free of charge and under the terms of this License, through a 25.505 +publicly available network server or other readily accessible means, 25.506 +then you must either (1) cause the Corresponding Source to be so 25.507 +available, or (2) arrange to deprive yourself of the benefit of the 25.508 +patent license for this particular work, or (3) arrange, in a manner 25.509 +consistent with the requirements of this License, to extend the patent 25.510 +license to downstream recipients. "Knowingly relying" means you have 25.511 +actual knowledge that, but for the patent license, your conveying the 25.512 +covered work in a country, or your recipient's use of the covered work 25.513 +in a country, would infringe one or more identifiable patents in that 25.514 +country that you have reason to believe are valid. 25.515 + 25.516 + If, pursuant to or in connection with a single transaction or 25.517 +arrangement, you convey, or propagate by procuring conveyance of, a 25.518 +covered work, and grant a patent license to some of the parties 25.519 +receiving the covered work authorizing them to use, propagate, modify 25.520 +or convey a specific copy of the covered work, then the patent license 25.521 +you grant is automatically extended to all recipients of the covered 25.522 +work and works based on it. 25.523 + 25.524 + A patent license is "discriminatory" if it does not include within 25.525 +the scope of its coverage, prohibits the exercise of, or is 25.526 +conditioned on the non-exercise of one or more of the rights that are 25.527 +specifically granted under this License. You may not convey a covered 25.528 +work if you are a party to an arrangement with a third party that is 25.529 +in the business of distributing software, under which you make payment 25.530 +to the third party based on the extent of your activity of conveying 25.531 +the work, and under which the third party grants, to any of the 25.532 +parties who would receive the covered work from you, a discriminatory 25.533 +patent license (a) in connection with copies of the covered work 25.534 +conveyed by you (or copies made from those copies), or (b) primarily 25.535 +for and in connection with specific products or compilations that 25.536 +contain the covered work, unless you entered into that arrangement, 25.537 +or that patent license was granted, prior to 28 March 2007. 25.538 + 25.539 + Nothing in this License shall be construed as excluding or limiting 25.540 +any implied license or other defenses to infringement that may 25.541 +otherwise be available to you under applicable patent law. 25.542 + 25.543 + 12. No Surrender of Others' Freedom. 25.544 + 25.545 + If conditions are imposed on you (whether by court order, agreement or 25.546 +otherwise) that contradict the conditions of this License, they do not 25.547 +excuse you from the conditions of this License. If you cannot convey a 25.548 +covered work so as to satisfy simultaneously your obligations under this 25.549 +License and any other pertinent obligations, then as a consequence you may 25.550 +not convey it at all. For example, if you agree to terms that obligate you 25.551 +to collect a royalty for further conveying from those to whom you convey 25.552 +the Program, the only way you could satisfy both those terms and this 25.553 +License would be to refrain entirely from conveying the Program. 25.554 + 25.555 + 13. Use with the GNU Affero General Public License. 25.556 + 25.557 + Notwithstanding any other provision of this License, you have 25.558 +permission to link or combine any covered work with a work licensed 25.559 +under version 3 of the GNU Affero General Public License into a single 25.560 +combined work, and to convey the resulting work. The terms of this 25.561 +License will continue to apply to the part which is the covered work, 25.562 +but the special requirements of the GNU Affero General Public License, 25.563 +section 13, concerning interaction through a network will apply to the 25.564 +combination as such. 25.565 + 25.566 + 14. Revised Versions of this License. 25.567 + 25.568 + The Free Software Foundation may publish revised and/or new versions of 25.569 +the GNU General Public License from time to time. Such new versions will 25.570 +be similar in spirit to the present version, but may differ in detail to 25.571 +address new problems or concerns. 25.572 + 25.573 + Each version is given a distinguishing version number. If the 25.574 +Program specifies that a certain numbered version of the GNU General 25.575 +Public License "or any later version" applies to it, you have the 25.576 +option of following the terms and conditions either of that numbered 25.577 +version or of any later version published by the Free Software 25.578 +Foundation. If the Program does not specify a version number of the 25.579 +GNU General Public License, you may choose any version ever published 25.580 +by the Free Software Foundation. 25.581 + 25.582 + If the Program specifies that a proxy can decide which future 25.583 +versions of the GNU General Public License can be used, that proxy's 25.584 +public statement of acceptance of a version permanently authorizes you 25.585 +to choose that version for the Program. 25.586 + 25.587 + Later license versions may give you additional or different 25.588 +permissions. However, no additional obligations are imposed on any 25.589 +author or copyright holder as a result of your choosing to follow a 25.590 +later version. 25.591 + 25.592 + 15. Disclaimer of Warranty. 25.593 + 25.594 + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 25.595 +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 25.596 +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 25.597 +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 25.598 +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 25.599 +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 25.600 +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 25.601 +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 25.602 + 25.603 + 16. Limitation of Liability. 25.604 + 25.605 + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 25.606 +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 25.607 +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 25.608 +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 25.609 +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 25.610 +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 25.611 +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 25.612 +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 25.613 +SUCH DAMAGES. 25.614 + 25.615 + 17. Interpretation of Sections 15 and 16. 25.616 + 25.617 + If the disclaimer of warranty and limitation of liability provided 25.618 +above cannot be given local legal effect according to their terms, 25.619 +reviewing courts shall apply local law that most closely approximates 25.620 +an absolute waiver of all civil liability in connection with the 25.621 +Program, unless a warranty or assumption of liability accompanies a 25.622 +copy of the Program in return for a fee. 25.623 + 25.624 + END OF TERMS AND CONDITIONS 25.625 + 25.626 + How to Apply These Terms to Your New Programs 25.627 + 25.628 + If you develop a new program, and you want it to be of the greatest 25.629 +possible use to the public, the best way to achieve this is to make it 25.630 +free software which everyone can redistribute and change under these terms. 25.631 + 25.632 + To do so, attach the following notices to the program. It is safest 25.633 +to attach them to the start of each source file to most effectively 25.634 +state the exclusion of warranty; and each file should have at least 25.635 +the "copyright" line and a pointer to where the full notice is found. 25.636 + 25.637 + <one line to give the program's name and a brief idea of what it does.> 25.638 + Copyright (C) <year> <name of author> 25.639 + 25.640 + This program is free software: you can redistribute it and/or modify 25.641 + it under the terms of the GNU General Public License as published by 25.642 + the Free Software Foundation, either version 3 of the License, or 25.643 + (at your option) any later version. 25.644 + 25.645 + This program is distributed in the hope that it will be useful, 25.646 + but WITHOUT ANY WARRANTY; without even the implied warranty of 25.647 + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 25.648 + GNU General Public License for more details. 25.649 + 25.650 + You should have received a copy of the GNU General Public License 25.651 + along with this program. If not, see <http://www.gnu.org/licenses/>. 25.652 + 25.653 +Also add information on how to contact you by electronic and paper mail. 25.654 + 25.655 + If the program does terminal interaction, make it output a short 25.656 +notice like this when it starts in an interactive mode: 25.657 + 25.658 + <program> Copyright (C) <year> <name of author> 25.659 + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 25.660 + This is free software, and you are welcome to redistribute it 25.661 + under certain conditions; type `show c' for details. 25.662 + 25.663 +The hypothetical commands `show w' and `show c' should show the appropriate 25.664 +parts of the General Public License. Of course, your program's commands 25.665 +might be different; for a GUI interface, you would use an "about box". 25.666 + 25.667 + You should also get your employer (if you work as a programmer) or school, 25.668 +if any, to sign a "copyright disclaimer" for the program, if necessary. 25.669 +For more information on this, and how to apply and follow the GNU GPL, see 25.670 +<http://www.gnu.org/licenses/>. 25.671 + 25.672 + The GNU General Public License does not permit incorporating your program 25.673 +into proprietary programs. If your program is a subroutine library, you 25.674 +may consider it more useful to permit linking proprietary applications with 25.675 +the library. If this is what you want to do, use the GNU Lesser General 25.676 +Public License instead of this License. But first, please read 25.677 +<http://www.gnu.org/philosophy/why-not-lgpl.html>.
26.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 26.2 +++ b/docs/lgpl-3.0.txt Sat Jul 07 16:17:29 2007 +0000 26.3 @@ -0,0 +1,165 @@ 26.4 + GNU LESSER GENERAL PUBLIC LICENSE 26.5 + Version 3, 29 June 2007 26.6 + 26.7 + Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/> 26.8 + Everyone is permitted to copy and distribute verbatim copies 26.9 + of this license document, but changing it is not allowed. 26.10 + 26.11 + 26.12 + This version of the GNU Lesser General Public License incorporates 26.13 +the terms and conditions of version 3 of the GNU General Public 26.14 +License, supplemented by the additional permissions listed below. 26.15 + 26.16 + 0. Additional Definitions. 26.17 + 26.18 + As used herein, "this License" refers to version 3 of the GNU Lesser 26.19 +General Public License, and the "GNU GPL" refers to version 3 of the GNU 26.20 +General Public License. 26.21 + 26.22 + "The Library" refers to a covered work governed by this License, 26.23 +other than an Application or a Combined Work as defined below. 26.24 + 26.25 + An "Application" is any work that makes use of an interface provided 26.26 +by the Library, but which is not otherwise based on the Library. 26.27 +Defining a subclass of a class defined by the Library is deemed a mode 26.28 +of using an interface provided by the Library. 26.29 + 26.30 + A "Combined Work" is a work produced by combining or linking an 26.31 +Application with the Library. The particular version of the Library 26.32 +with which the Combined Work was made is also called the "Linked 26.33 +Version". 26.34 + 26.35 + The "Minimal Corresponding Source" for a Combined Work means the 26.36 +Corresponding Source for the Combined Work, excluding any source code 26.37 +for portions of the Combined Work that, considered in isolation, are 26.38 +based on the Application, and not on the Linked Version. 26.39 + 26.40 + The "Corresponding Application Code" for a Combined Work means the 26.41 +object code and/or source code for the Application, including any data 26.42 +and utility programs needed for reproducing the Combined Work from the 26.43 +Application, but excluding the System Libraries of the Combined Work. 26.44 + 26.45 + 1. Exception to Section 3 of the GNU GPL. 26.46 + 26.47 + You may convey a covered work under sections 3 and 4 of this License 26.48 +without being bound by section 3 of the GNU GPL. 26.49 + 26.50 + 2. Conveying Modified Versions. 26.51 + 26.52 + If you modify a copy of the Library, and, in your modifications, a 26.53 +facility refers to a function or data to be supplied by an Application 26.54 +that uses the facility (other than as an argument passed when the 26.55 +facility is invoked), then you may convey a copy of the modified 26.56 +version: 26.57 + 26.58 + a) under this License, provided that you make a good faith effort to 26.59 + ensure that, in the event an Application does not supply the 26.60 + function or data, the facility still operates, and performs 26.61 + whatever part of its purpose remains meaningful, or 26.62 + 26.63 + b) under the GNU GPL, with none of the additional permissions of 26.64 + this License applicable to that copy. 26.65 + 26.66 + 3. Object Code Incorporating Material from Library Header Files. 26.67 + 26.68 + The object code form of an Application may incorporate material from 26.69 +a header file that is part of the Library. You may convey such object 26.70 +code under terms of your choice, provided that, if the incorporated 26.71 +material is not limited to numerical parameters, data structure 26.72 +layouts and accessors, or small macros, inline functions and templates 26.73 +(ten or fewer lines in length), you do both of the following: 26.74 + 26.75 + a) Give prominent notice with each copy of the object code that the 26.76 + Library is used in it and that the Library and its use are 26.77 + covered by this License. 26.78 + 26.79 + b) Accompany the object code with a copy of the GNU GPL and this license 26.80 + document. 26.81 + 26.82 + 4. Combined Works. 26.83 + 26.84 + You may convey a Combined Work under terms of your choice that, 26.85 +taken together, effectively do not restrict modification of the 26.86 +portions of the Library contained in the Combined Work and reverse 26.87 +engineering for debugging such modifications, if you also do each of 26.88 +the following: 26.89 + 26.90 + a) Give prominent notice with each copy of the Combined Work that 26.91 + the Library is used in it and that the Library and its use are 26.92 + covered by this License. 26.93 + 26.94 + b) Accompany the Combined Work with a copy of the GNU GPL and this license 26.95 + document. 26.96 + 26.97 + c) For a Combined Work that displays copyright notices during 26.98 + execution, include the copyright notice for the Library among 26.99 + these notices, as well as a reference directing the user to the 26.100 + copies of the GNU GPL and this license document. 26.101 + 26.102 + d) Do one of the following: 26.103 + 26.104 + 0) Convey the Minimal Corresponding Source under the terms of this 26.105 + License, and the Corresponding Application Code in a form 26.106 + suitable for, and under terms that permit, the user to 26.107 + recombine or relink the Application with a modified version of 26.108 + the Linked Version to produce a modified Combined Work, in the 26.109 + manner specified by section 6 of the GNU GPL for conveying 26.110 + Corresponding Source. 26.111 + 26.112 + 1) Use a suitable shared library mechanism for linking with the 26.113 + Library. A suitable mechanism is one that (a) uses at run time 26.114 + a copy of the Library already present on the user's computer 26.115 + system, and (b) will operate properly with a modified version 26.116 + of the Library that is interface-compatible with the Linked 26.117 + Version. 26.118 + 26.119 + e) Provide Installation Information, but only if you would otherwise 26.120 + be required to provide such information under section 6 of the 26.121 + GNU GPL, and only to the extent that such information is 26.122 + necessary to install and execute a modified version of the 26.123 + Combined Work produced by recombining or relinking the 26.124 + Application with a modified version of the Linked Version. (If 26.125 + you use option 4d0, the Installation Information must accompany 26.126 + the Minimal Corresponding Source and Corresponding Application 26.127 + Code. If you use option 4d1, you must provide the Installation 26.128 + Information in the manner specified by section 6 of the GNU GPL 26.129 + for conveying Corresponding Source.) 26.130 + 26.131 + 5. Combined Libraries. 26.132 + 26.133 + You may place library facilities that are a work based on the 26.134 +Library side by side in a single library together with other library 26.135 +facilities that are not Applications and are not covered by this 26.136 +License, and convey such a combined library under terms of your 26.137 +choice, if you do both of the following: 26.138 + 26.139 + a) Accompany the combined library with a copy of the same work based 26.140 + on the Library, uncombined with any other library facilities, 26.141 + conveyed under the terms of this License. 26.142 + 26.143 + b) Give prominent notice with the combined library that part of it 26.144 + is a work based on the Library, and explaining where to find the 26.145 + accompanying uncombined form of the same work. 26.146 + 26.147 + 6. Revised Versions of the GNU Lesser General Public License. 26.148 + 26.149 + The Free Software Foundation may publish revised and/or new versions 26.150 +of the GNU Lesser General Public License from time to time. Such new 26.151 +versions will be similar in spirit to the present version, but may 26.152 +differ in detail to address new problems or concerns. 26.153 + 26.154 + Each version is given a distinguishing version number. If the 26.155 +Library as you received it specifies that a certain numbered version 26.156 +of the GNU Lesser General Public License "or any later version" 26.157 +applies to it, you have the option of following the terms and 26.158 +conditions either of that published version or of any later version 26.159 +published by the Free Software Foundation. If the Library as you 26.160 +received it does not specify a version number of the GNU Lesser 26.161 +General Public License, you may choose any version of the GNU Lesser 26.162 +General Public License ever published by the Free Software Foundation. 26.163 + 26.164 + If the Library as you received it specifies that a proxy can decide 26.165 +whether future versions of the GNU Lesser General Public License shall 26.166 +apply, that proxy's public statement of acceptance of any version is 26.167 +permanent authorization for you to choose that version for the 26.168 +Library.
27.1 --- a/examples/Common/Configurator/Resources/scripts/sarissa.js Sun Jun 10 22:52:12 2007 +0000 27.2 +++ b/examples/Common/Configurator/Resources/scripts/sarissa.js Sat Jul 07 16:17:29 2007 +0000 27.3 @@ -2,72 +2,54 @@ 27.4 * ==================================================================== 27.5 * About 27.6 * ==================================================================== 27.7 - * Sarissa cross browser XML library 27.8 - * @version 0.9.6 27.9 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 27.10 - * 27.11 * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. 27.12 * The library supports Gecko based browsers like Mozilla and Firefox, 27.13 - * Internet Explorer (5.5+ with MSXML3.0+) and, last but not least, KHTML based browsers like 27.14 - * Konqueror and Safari. 27.15 - * 27.16 + * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 27.17 + * @version ${project.version} 27.18 + * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 27.19 * ==================================================================== 27.20 * Licence 27.21 * ==================================================================== 27.22 - * This program is free software; you can redistribute it and/or modify 27.23 - * it under the terms of the GNU General Public License version 2 or 27.24 - * the GNU Lesser General Public License version 2.1 as published by 27.25 - * the Free Software Foundation (your choice of the two). 27.26 - * 27.27 - * This program is distributed in the hope that it will be useful, 27.28 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 27.29 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 27.30 - * GNU General Public License or GNU Lesser General Public License for more details. 27.31 - * 27.32 - * You should have received a copy of the GNU General Public License 27.33 - * or GNU Lesser General Public License along with this program; if not, 27.34 - * write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 27.35 - * or visit http://www.gnu.org 27.36 - * 27.37 + * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher, 27.38 + * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher 27.39 + * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If 27.40 + * you make modifications under the ASL, i would appreciate it if you submitted those. 27.41 + * In case your copy of Sarissa does not include the license texts, you may find 27.42 + * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 27.43 + * <a href="http://www.apache.org">http://www.apache.org</a>. 27.44 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 27.45 + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 27.46 + * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 27.47 + * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 27.48 + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27.49 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 27.50 + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 27.51 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 27.52 */ 27.53 /** 27.54 - * <p>Sarissa is a utility class. Provides static methods for DOMDocument and 27.55 - * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.</p> 27.56 + * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument, 27.57 + * DOM Node serialization to XML strings and other utility goodies.</p> 27.58 * @constructor 27.59 */ 27.60 function Sarissa(){}; 27.61 -/** @private */ 27.62 +Sarissa.VERSION = "${project.version}"; 27.63 Sarissa.PARSED_OK = "Document contains no parsing errors"; 27.64 -/** 27.65 - * Tells you whether transformNode and transformNodeToObject are available. This functionality 27.66 - * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations 27.67 - * use the XSLTProcessor 27.68 - * @deprecated 27.69 - * @type boolean 27.70 - */ 27.71 +Sarissa.PARSED_EMPTY = "Document is empty"; 27.72 +Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error"; 27.73 Sarissa.IS_ENABLED_TRANSFORM_NODE = false; 27.74 -/** 27.75 - * tells you whether XMLHttpRequest (or equivalent) is available 27.76 - * @type boolean 27.77 - */ 27.78 -Sarissa.IS_ENABLED_XMLHTTP = false; 27.79 -/** 27.80 - * tells you whether selectNodes/selectSingleNode is available 27.81 - * @type boolean 27.82 - */ 27.83 -Sarissa.IS_ENABLED_SELECT_NODES = false; 27.84 var _sarissa_iNsCounter = 0; 27.85 var _SARISSA_IEPREFIX4XSLPARAM = ""; 27.86 var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true; 27.87 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 27.88 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 27.89 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 27.90 -var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1; 27.91 +var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 27.92 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 27.93 +if(!window.Node || !Node.ELEMENT_NODE){ 27.94 + Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 27.95 +}; 27.96 27.97 -if(!window.Node || !window.Node.ELEMENT_NODE){ 27.98 - var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 27.99 -}; 27.100 +if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 27.101 27.102 // IE initialization 27.103 if(_SARISSA_IS_IE){ 27.104 @@ -76,13 +58,15 @@ 27.105 // used to store the most recent ProgID available out of the above 27.106 var _SARISSA_DOM_PROGID = ""; 27.107 var _SARISSA_XMLHTTP_PROGID = ""; 27.108 + var _SARISSA_DOM_XMLWRITER = ""; 27.109 /** 27.110 * Called when the Sarissa_xx.js file is parsed, to pick most recent 27.111 * ProgIDs for IE, then gets destroyed. 27.112 + * @private 27.113 * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object 27.114 * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled 27.115 */ 27.116 - pickRecentProgID = function (idList, enabledList){ 27.117 + Sarissa.pickRecentProgID = function (idList){ 27.118 // found progID flag 27.119 var bFound = false; 27.120 for(var i=0; i < idList.length && !bFound; i++){ 27.121 @@ -90,50 +74,69 @@ 27.122 var oDoc = new ActiveXObject(idList[i]); 27.123 o2Store = idList[i]; 27.124 bFound = true; 27.125 - for(var j=0;j<enabledList.length;j++) 27.126 - if(i <= enabledList[j][1]) 27.127 - Sarissa["IS_ENABLED_"+enabledList[j][0]] = true; 27.128 }catch (objException){ 27.129 // trap; try next progID 27.130 }; 27.131 }; 27.132 - if (!bFound) 27.133 + if (!bFound) { 27.134 throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 27.135 + }; 27.136 idList = null; 27.137 return o2Store; 27.138 }; 27.139 // pick best available MSXML progIDs 27.140 - _SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]); 27.141 - _SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]); 27.142 - _SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 27.143 - _SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]); 27.144 + _SARISSA_DOM_PROGID = null; 27.145 + _SARISSA_THREADEDDOM_PROGID = null; 27.146 + _SARISSA_XSLTEMPLATE_PROGID = null; 27.147 + _SARISSA_XMLHTTP_PROGID = null; 27.148 + if(!window.XMLHttpRequest){ 27.149 + /** 27.150 + * Emulate XMLHttpRequest 27.151 + * @constructor 27.152 + */ 27.153 + XMLHttpRequest = function() { 27.154 + if(!_SARISSA_XMLHTTP_PROGID){ 27.155 + _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); 27.156 + }; 27.157 + return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 27.158 + }; 27.159 + }; 27.160 // we dont need this anymore 27.161 - pickRecentProgID = null; 27.162 //============================================ 27.163 // Factory methods (IE) 27.164 //============================================ 27.165 // see non-IE version 27.166 Sarissa.getDomDocument = function(sUri, sName){ 27.167 + if(!_SARISSA_DOM_PROGID){ 27.168 + _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); 27.169 + }; 27.170 var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 27.171 - // if a root tag name was provided, we need to load it in the DOM 27.172 - // object 27.173 + // if a root tag name was provided, we need to load it in the DOM object 27.174 if (sName){ 27.175 - // if needed, create an artifical namespace prefix the way Moz 27.176 - // does 27.177 - if (sUri){ 27.178 - oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + "=\"" + sUri + "\" />"); 27.179 - // don't use the same prefix again 27.180 - ++_sarissa_iNsCounter; 27.181 - } 27.182 - else 27.183 - oDoc.loadXML("<" + sName + "/>"); 27.184 + // create an artifical namespace prefix 27.185 + // or reuse existing prefix if applicable 27.186 + var prefix = ""; 27.187 + if(sUri){ 27.188 + if(sName.indexOf(":") > 1){ 27.189 + prefix = sName.substring(0, sName.indexOf(":")); 27.190 + sName = sName.substring(sName.indexOf(":")+1); 27.191 + }else{ 27.192 + prefix = "a" + (_sarissa_iNsCounter++); 27.193 + }; 27.194 + }; 27.195 + // use namespaces if a namespace URI exists 27.196 + if(sUri){ 27.197 + oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />"); 27.198 + } else { 27.199 + oDoc.loadXML('<' + sName + " />"); 27.200 + }; 27.201 }; 27.202 return oDoc; 27.203 }; 27.204 // see non-IE version 27.205 Sarissa.getParseErrorText = function (oDoc) { 27.206 var parseErrorText = Sarissa.PARSED_OK; 27.207 - if(oDoc.parseError != 0){ 27.208 + if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){ 27.209 parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + 27.210 "\nLocation: " + oDoc.parseError.url + 27.211 "\nLine Number " + oDoc.parseError.line + ", Column " + 27.212 @@ -144,6 +147,9 @@ 27.213 parseErrorText += "-"; 27.214 }; 27.215 parseErrorText += "^\n"; 27.216 + } 27.217 + else if(oDoc.documentElement == null){ 27.218 + parseErrorText = Sarissa.PARSED_EMPTY; 27.219 }; 27.220 return parseErrorText; 27.221 }; 27.222 @@ -158,43 +164,109 @@ 27.223 * @constructor 27.224 */ 27.225 XSLTProcessor = function(){ 27.226 + if(!_SARISSA_XSLTEMPLATE_PROGID){ 27.227 + _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]); 27.228 + }; 27.229 this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID); 27.230 this.processor = null; 27.231 }; 27.232 /** 27.233 - * Impoprts the given XSLT DOM and compiles it to a reusable transform 27.234 + * Imports the given XSLT DOM and compiles it to a reusable transform 27.235 + * <b>Note:</b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those 27.236 * @argument xslDoc The XSLT DOMDocument to import 27.237 */ 27.238 XSLTProcessor.prototype.importStylesheet = function(xslDoc){ 27.239 + if(!_SARISSA_THREADEDDOM_PROGID){ 27.240 + _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 27.241 + }; 27.242 + xslDoc.setProperty("SelectionLanguage", "XPath"); 27.243 + xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 27.244 // convert stylesheet to free threaded 27.245 - var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 27.246 - converted.loadXML(xslDoc.xml); 27.247 + var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 27.248 + // make included/imported stylesheets work if exist and xsl was originally loaded from url 27.249 + if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 27.250 + converted.async = false; 27.251 + if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 27.252 + converted.setProperty("AllowDocumentFunction", true); 27.253 + converted.resolveExternals = true; 27.254 + } 27.255 + converted.load(xslDoc.url); 27.256 + } else { 27.257 + converted.loadXML(xslDoc.xml); 27.258 + }; 27.259 + converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 27.260 + var output = converted.selectSingleNode("//xsl:output"); 27.261 + this.outputMethod = output ? output.getAttribute("method") : "html"; 27.262 this.template.stylesheet = converted; 27.263 this.processor = this.template.createProcessor(); 27.264 - // (re)set default param values 27.265 + // for getParameter and clearParameters 27.266 this.paramsSet = new Array(); 27.267 }; 27.268 + 27.269 /** 27.270 - * Transform the given XML DOM 27.271 + * Transform the given XML DOM and return the transformation result as a new DOM document 27.272 * @argument sourceDoc The XML DOMDocument to transform 27.273 * @return The transformation result as a DOM Document 27.274 */ 27.275 XSLTProcessor.prototype.transformToDocument = function(sourceDoc){ 27.276 - this.processor.input = sourceDoc; 27.277 - var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 27.278 - this.processor.output = outDoc; 27.279 - this.processor.transform(); 27.280 - return outDoc; 27.281 + // fix for bug 1549749 27.282 + if(_SARISSA_THREADEDDOM_PROGID){ 27.283 + this.processor.input=sourceDoc; 27.284 + var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID); 27.285 + this.processor.output=outDoc; 27.286 + this.processor.transform(); 27.287 + return outDoc; 27.288 + } 27.289 + else{ 27.290 + if(!_SARISSA_DOM_XMLWRITER){ 27.291 + _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); 27.292 + }; 27.293 + this.processor.input = sourceDoc; 27.294 + var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER); 27.295 + this.processor.output = outDoc; 27.296 + this.processor.transform(); 27.297 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 27.298 + oDoc.loadXML(outDoc.output+""); 27.299 + return oDoc; 27.300 + }; 27.301 }; 27.302 + 27.303 /** 27.304 - * Not sure if this works in IE. Maybe this will allow non-well-formed 27.305 - * transformation results (i.e. with no single root element) 27.306 + * Transform the given XML DOM and return the transformation result as a new DOM fragment. 27.307 + * <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML). 27.308 * @argument sourceDoc The XML DOMDocument to transform 27.309 - * @return The transformation result as a DOM Fragment 27.310 + * @argument ownerDoc The owner of the result fragment 27.311 + * @return The transformation result as a DOM Document 27.312 */ 27.313 - XSLTProcessor.prototype.transformToFragment = function(sourceDoc, ownerDocument){ 27.314 - return this.transformToDocument(sourceDoc); 27.315 + XSLTProcessor.prototype.transformToFragment = function (sourceDoc, ownerDoc) { 27.316 + this.processor.input = sourceDoc; 27.317 + this.processor.transform(); 27.318 + var s = this.processor.output; 27.319 + var f = ownerDoc.createDocumentFragment(); 27.320 + if (this.outputMethod == 'text') { 27.321 + f.appendChild(ownerDoc.createTextNode(s)); 27.322 + } else if (ownerDoc.body && ownerDoc.body.innerHTML) { 27.323 + var container = ownerDoc.createElement('div'); 27.324 + container.innerHTML = s; 27.325 + while (container.hasChildNodes()) { 27.326 + f.appendChild(container.firstChild); 27.327 + } 27.328 + } 27.329 + else { 27.330 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 27.331 + if (s.substring(0, 5) == '<?xml') { 27.332 + s = s.substring(s.indexOf('?>') + 2); 27.333 + } 27.334 + var xml = ''.concat('<my>', s, '</my>'); 27.335 + oDoc.loadXML(xml); 27.336 + var container = oDoc.documentElement; 27.337 + while (container.hasChildNodes()) { 27.338 + f.appendChild(container.firstChild); 27.339 + } 27.340 + } 27.341 + return f; 27.342 }; 27.343 + 27.344 /** 27.345 * Set global XSLT parameter of the imported stylesheet 27.346 * @argument nsURI The parameter namespace URI 27.347 @@ -202,13 +274,15 @@ 27.348 * @argument value The new parameter value 27.349 */ 27.350 XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 27.351 - /* nsURI is optional but cannot be null */ 27.352 + // make value a zero length string if null to allow clearing 27.353 + value = value ? value : ""; 27.354 + // nsURI is optional but cannot be null 27.355 if(nsURI){ 27.356 this.processor.addParameter(name, value, nsURI); 27.357 }else{ 27.358 this.processor.addParameter(name, value); 27.359 }; 27.360 - /* update updated params for getParameter */ 27.361 + // update updated params for getParameter 27.362 if(!this.paramsSet[""+nsURI]){ 27.363 this.paramsSet[""+nsURI] = new Array(); 27.364 }; 27.365 @@ -222,102 +296,38 @@ 27.366 * @return The parameter value if reviously set by setParameter, null otherwise 27.367 */ 27.368 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 27.369 - if(this.paramsSet[""+nsURI] && this.paramsSet[""+nsURI][name]) 27.370 - return this.paramsSet[""+nsURI][name]; 27.371 - else 27.372 + nsURI = "" + nsURI; 27.373 + if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 27.374 + return this.paramsSet[nsURI][name]; 27.375 + }else{ 27.376 return null; 27.377 + }; 27.378 }; 27.379 -} 27.380 -else{ /* end IE initialization, try to deal with real browsers now ;-) */ 27.381 - if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 27.382 - if(window.XMLDocument){ 27.383 - /** 27.384 - * <p>Emulate IE's onreadystatechange attribute</p> 27.385 - */ 27.386 - XMLDocument.prototype.onreadystatechange = null; 27.387 - /** 27.388 - * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 27.389 - * <ul><li>1 == LOADING,</li> 27.390 - * <li>2 == LOADED,</li> 27.391 - * <li>3 == INTERACTIVE,</li> 27.392 - * <li>4 == COMPLETED</li></ul> 27.393 - */ 27.394 - XMLDocument.prototype.readyState = 0; 27.395 - /** 27.396 - * <p>Emulate IE's parseError attribute</p> 27.397 - */ 27.398 - XMLDocument.prototype.parseError = 0; 27.399 - 27.400 - // NOTE: setting async to false will only work with documents 27.401 - // called over HTTP (meaning a server), not the local file system, 27.402 - // unless you are using Moz 1.4+. 27.403 - // BTW the try>catch block is for 1.4; I haven't found a way to check if 27.404 - // the property is implemented without 27.405 - // causing an error and I dont want to use user agent stuff for that... 27.406 - var _SARISSA_SYNC_NON_IMPLEMENTED = false; 27.407 - try{ 27.408 - /** 27.409 - * <p>Emulates IE's async property for Moz versions prior to 1.4. 27.410 - * It controls whether loading of remote XML files works 27.411 - * synchronously or asynchronously.</p> 27.412 - */ 27.413 - XMLDocument.prototype.async = true; 27.414 - _SARISSA_SYNC_NON_IMPLEMENTED = true; 27.415 - }catch(e){/* trap */}; 27.416 - /** 27.417 - * <p>Keeps a handle to the original load() method. Internal use and only 27.418 - * if Mozilla version is lower than 1.4</p> 27.419 - * @private 27.420 - */ 27.421 - XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; 27.422 - 27.423 - /** 27.424 - * <p>Overrides the original load method to provide synchronous loading for 27.425 - * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if 27.426 - * async is set to false)</p> 27.427 - * @returns the DOM Object as it was before the load() call (may be empty) 27.428 - */ 27.429 - XMLDocument.prototype.load = function(sURI) { 27.430 - var oDoc = document.implementation.createDocument("", "", null); 27.431 - Sarissa.copyChildNodes(this, oDoc); 27.432 - this.parseError = 0; 27.433 - Sarissa.__setReadyState__(this, 1); 27.434 - try { 27.435 - if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { 27.436 - var tmp = new XMLHttpRequest(); 27.437 - tmp.open("GET", sURI, false); 27.438 - tmp.send(null); 27.439 - Sarissa.__setReadyState__(this, 2); 27.440 - Sarissa.copyChildNodes(tmp.responseXML, this); 27.441 - Sarissa.__setReadyState__(this, 3); 27.442 - } 27.443 - else { 27.444 - this._sarissa_load(sURI); 27.445 - }; 27.446 - } 27.447 - catch (objException) { 27.448 - this.parseError = -1; 27.449 - } 27.450 - finally { 27.451 - if(this.async == false){ 27.452 - Sarissa.__handleLoad__(this); 27.453 - }; 27.454 + /** 27.455 + * Clear parameters (set them to default values as defined in the stylesheet itself) 27.456 + */ 27.457 + XSLTProcessor.prototype.clearParameters = function(){ 27.458 + for(var nsURI in this.paramsSet){ 27.459 + for(var name in this.paramsSet[nsURI]){ 27.460 + if(nsURI){ 27.461 + this.processor.addParameter(name, "", nsURI); 27.462 + }else{ 27.463 + this.processor.addParameter(name, ""); 27.464 }; 27.465 - return oDoc; 27.466 }; 27.467 - };//if(window.XMLDocument) 27.468 - 27.469 + }; 27.470 + this.paramsSet = new Array(); 27.471 + }; 27.472 +}else{ /* end IE initialization, try to deal with real browsers now ;-) */ 27.473 + if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 27.474 /** 27.475 * <p>Ensures the document was loaded correctly, otherwise sets the 27.476 * parseError to -1 to indicate something went wrong. Internal use</p> 27.477 * @private 27.478 */ 27.479 Sarissa.__handleLoad__ = function(oDoc){ 27.480 - if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") 27.481 - oDoc.parseError = -1; 27.482 Sarissa.__setReadyState__(oDoc, 4); 27.483 }; 27.484 - 27.485 /** 27.486 * <p>Attached by an event handler to the load event. Internal use.</p> 27.487 * @private 27.488 @@ -325,7 +335,6 @@ 27.489 _sarissa_XMLDocument_onload = function(){ 27.490 Sarissa.__handleLoad__(this); 27.491 }; 27.492 - 27.493 /** 27.494 * <p>Sets the readyState property of the given DOM Document object. 27.495 * Internal use.</p> 27.496 @@ -336,80 +345,129 @@ 27.497 */ 27.498 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 27.499 oDoc.readyState = iReadyState; 27.500 + oDoc.readystate = iReadyState; 27.501 if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 27.502 oDoc.onreadystatechange(); 27.503 }; 27.504 - /** 27.505 - * <p>Factory method to obtain a new DOM Document object</p> 27.506 - * @argument sUri the namespace of the root node (if any) 27.507 - * @argument sUri the local name of the root node (if any) 27.508 - * @returns a new DOM Document 27.509 - */ 27.510 Sarissa.getDomDocument = function(sUri, sName){ 27.511 - var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); 27.512 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 27.513 + if(!oDoc.onreadystatechange){ 27.514 + 27.515 + /** 27.516 + * <p>Emulate IE's onreadystatechange attribute</p> 27.517 + */ 27.518 + oDoc.onreadystatechange = null; 27.519 + }; 27.520 + if(!oDoc.readyState){ 27.521 + /** 27.522 + * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 27.523 + * <ul><li>1 == LOADING,</li> 27.524 + * <li>2 == LOADED,</li> 27.525 + * <li>3 == INTERACTIVE,</li> 27.526 + * <li>4 == COMPLETED</li></ul> 27.527 + */ 27.528 + oDoc.readyState = 0; 27.529 + }; 27.530 oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); 27.531 return oDoc; 27.532 - }; 27.533 + }; 27.534 + if(window.XMLDocument){ 27.535 + // do nothing 27.536 + }// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS 27.537 + else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ 27.538 + //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good 27.539 + /** 27.540 + * <p>Factory method to obtain a new DOM Document object</p> 27.541 + * @argument sUri the namespace of the root node (if any) 27.542 + * @argument sUri the local name of the root node (if any) 27.543 + * @returns a new DOM Document 27.544 + */ 27.545 + Sarissa.getDomDocument = function(sUri, sName){ 27.546 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 27.547 + return oDoc; 27.548 + }; 27.549 + } 27.550 + else { 27.551 + Sarissa.getDomDocument = function(sUri, sName){ 27.552 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 27.553 + // looks like safari does not create the root element for some unknown reason 27.554 + if(oDoc && (sUri || sName) && !oDoc.documentElement){ 27.555 + oDoc.appendChild(oDoc.createElementNS(sUri, sName)); 27.556 + }; 27.557 + return oDoc; 27.558 + }; 27.559 + }; 27.560 };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT) 27.561 }; 27.562 //========================================== 27.563 // Common stuff 27.564 //========================================== 27.565 if(!window.DOMParser){ 27.566 - /** 27.567 - * DOMParser is a utility class, used to construct DOMDocuments from XML strings 27.568 - * @constructor 27.569 - */ 27.570 - DOMParser = function() { 27.571 + if(_SARISSA_IS_SAFARI){ 27.572 + /* 27.573 + * DOMParser is a utility class, used to construct DOMDocuments from XML strings 27.574 + * @constructor 27.575 + */ 27.576 + DOMParser = function() { }; 27.577 + /** 27.578 + * Construct a new DOM Document from the given XMLstring 27.579 + * @param sXml the given XML string 27.580 + * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 27.581 + * @return a new DOM Document from the given XML string 27.582 + */ 27.583 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 27.584 + var xmlhttp = new XMLHttpRequest(); 27.585 + xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(sXml), false); 27.586 + xmlhttp.send(null); 27.587 + return xmlhttp.responseXML; 27.588 + }; 27.589 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 27.590 + DOMParser = function() { }; 27.591 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 27.592 + var doc = Sarissa.getDomDocument(); 27.593 + doc.loadXML(sXml); 27.594 + return doc; 27.595 + }; 27.596 }; 27.597 - /** 27.598 - * Construct a new DOM Document from the given XMLstring 27.599 - * @param sXml the given XML string 27.600 - * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 27.601 - * @return a new DOM Document from the given XML string 27.602 - */ 27.603 - DOMParser.prototype.parseFromString = function(sXml, contentType){ 27.604 - var doc = Sarissa.getDomDocument(); 27.605 - doc.loadXML(sXml); 27.606 - return doc; 27.607 - }; 27.608 - 27.609 }; 27.610 27.611 -if(window.XMLHttpRequest){ 27.612 - Sarissa.IS_ENABLED_XMLHTTP = true; 27.613 -} 27.614 -else if(_SARISSA_IS_IE){ 27.615 - /** 27.616 - * Emulate XMLHttpRequest 27.617 - * @constructor 27.618 - */ 27.619 - XMLHttpRequest = function() { 27.620 - return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 27.621 - }; 27.622 - Sarissa.IS_ENABLED_XMLHTTP = true; 27.623 -}; 27.624 - 27.625 -if(!window.document.importNode && _SARISSA_IS_IE){ 27.626 +if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){ 27.627 try{ 27.628 /** 27.629 - * Implements importNode for the current window document in IE using innerHTML. 27.630 - * Testing showed that DOM was multiple times slower than innerHTML for this, 27.631 - * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML) 27.632 - * please gimme a call. 27.633 + * Implementation of importNode for the context window document in IE. 27.634 + * If <code>oNode</code> is a TextNode, <code>bChildren</code> is ignored. 27.635 * @param oNode the Node to import 27.636 * @param bChildren whether to include the children of oNode 27.637 * @returns the imported node for further use 27.638 */ 27.639 - window.document.importNode = function(oNode, bChildren){ 27.640 - var importNode = document.createElement("div"); 27.641 - if(bChildren) 27.642 - importNode.innerHTML = Sarissa.serialize(oNode); 27.643 - else 27.644 - importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false)); 27.645 - return importNode.firstChild; 27.646 + document.importNode = function(oNode, bChildren){ 27.647 + var tmp; 27.648 + if (oNode.nodeName=='#text') { 27.649 + return document.createTextElement(oNode.data); 27.650 + } 27.651 + else { 27.652 + if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){ 27.653 + tmp = document.createElement("table"); 27.654 + } 27.655 + else if(oNode.nodeName == "td"){ 27.656 + tmp = document.createElement("tr"); 27.657 + } 27.658 + else if(oNode.nodeName == "option"){ 27.659 + tmp = document.createElement("select"); 27.660 + } 27.661 + else{ 27.662 + tmp = document.createElement("div"); 27.663 + }; 27.664 + if(bChildren){ 27.665 + tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML; 27.666 + }else{ 27.667 + tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML; 27.668 + }; 27.669 + return tmp.getElementsByTagName("*")[0]; 27.670 + }; 27.671 + 27.672 }; 27.673 - }catch(e){}; 27.674 + }catch(e){ }; 27.675 }; 27.676 if(!Sarissa.getParseErrorText){ 27.677 /** 27.678 @@ -423,17 +481,16 @@ 27.679 */ 27.680 Sarissa.getParseErrorText = function (oDoc){ 27.681 var parseErrorText = Sarissa.PARSED_OK; 27.682 - if(oDoc.parseError != 0){ 27.683 - /*moz*/ 27.684 - if(oDoc.documentElement.tagName == "parsererror"){ 27.685 - parseErrorText = oDoc.documentElement.firstChild.data; 27.686 - parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 27.687 - }/*konq*/ 27.688 - else if(oDoc.documentElement.tagName == "html"){ 27.689 - parseErrorText = Sarissa.getText(oDoc.documentElement.getElementsByTagName("h1")[0], false) + "\n"; 27.690 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n"; 27.691 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false); 27.692 - }; 27.693 + if(!oDoc.documentElement){ 27.694 + parseErrorText = Sarissa.PARSED_EMPTY; 27.695 + } else if(oDoc.documentElement.tagName == "parsererror"){ 27.696 + parseErrorText = oDoc.documentElement.firstChild.data; 27.697 + parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 27.698 + } else if(oDoc.getElementsByTagName("parsererror").length > 0){ 27.699 + var parsererror = oDoc.getElementsByTagName("parsererror")[0]; 27.700 + parseErrorText = Sarissa.getText(parsererror, true)+"\n"; 27.701 + } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){ 27.702 + parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR; 27.703 }; 27.704 return parseErrorText; 27.705 }; 27.706 @@ -446,8 +503,7 @@ 27.707 var nodeType = node.nodeType; 27.708 if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){ 27.709 s += node.data; 27.710 - } 27.711 - else if(deep == true 27.712 + } else if(deep == true 27.713 && (nodeType == Node.ELEMENT_NODE 27.714 || nodeType == Node.DOCUMENT_NODE 27.715 || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ 27.716 @@ -456,33 +512,20 @@ 27.717 }; 27.718 return s; 27.719 }; 27.720 -if(window.XMLSerializer){ 27.721 +if(!window.XMLSerializer 27.722 + && Sarissa.getDomDocument 27.723 + && Sarissa.getDomDocument("","foo", null).xml){ 27.724 /** 27.725 - * <p>Factory method to obtain the serialization of a DOM Node</p> 27.726 - * @returns the serialized Node as an XML string 27.727 + * Utility class to serialize DOM Node objects to XML strings 27.728 + * @constructor 27.729 */ 27.730 - Sarissa.serialize = function(oDoc){ 27.731 - return (new XMLSerializer()).serializeToString(oDoc); 27.732 - }; 27.733 -}else{ 27.734 - if((Sarissa.getDomDocument("","foo", null)).xml){ 27.735 - // see non-IE version 27.736 - Sarissa.serialize = function(oDoc) { 27.737 - // TODO: check for HTML document and return innerHTML instead 27.738 - return oDoc.xml; 27.739 - }; 27.740 - /** 27.741 - * Utility class to serialize DOM Node objects to XML strings 27.742 - * @constructor 27.743 - */ 27.744 - XMLSerializer = function(){}; 27.745 - /** 27.746 - * Serialize the given DOM Node to an XML string 27.747 - * @param oNode the DOM Node to serialize 27.748 - */ 27.749 - XMLSerializer.prototype.serializeToString = function(oNode) { 27.750 - return oNode.xml; 27.751 - }; 27.752 + XMLSerializer = function(){}; 27.753 + /** 27.754 + * Serialize the given DOM Node to an XML string 27.755 + * @param oNode the DOM Node to serialize 27.756 + */ 27.757 + XMLSerializer.prototype.serializeToString = function(oNode) { 27.758 + return oNode.xml; 27.759 }; 27.760 }; 27.761 27.762 @@ -497,7 +540,8 @@ 27.763 * @argument oNode the Node to empty 27.764 */ 27.765 Sarissa.clearChildNodes = function(oNode) { 27.766 - while(oNode.hasChildNodes()){ 27.767 + // need to check for firstChild due to opera 8 bug with hasChildNodes 27.768 + while(oNode.firstChild) { 27.769 oNode.removeChild(oNode.firstChild); 27.770 }; 27.771 }; 27.772 @@ -510,17 +554,19 @@ 27.773 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 27.774 */ 27.775 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 27.776 + if((!nodeFrom) || (!nodeTo)){ 27.777 + throw "Both source and destination nodes must be provided"; 27.778 + }; 27.779 if(!bPreserveExisting){ 27.780 Sarissa.clearChildNodes(nodeTo); 27.781 }; 27.782 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 27.783 var nodes = nodeFrom.childNodes; 27.784 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 27.785 + if(typeof(ownerDoc.importNode) != "undefined") { 27.786 for(var i=0;i < nodes.length;i++) { 27.787 nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 27.788 }; 27.789 - } 27.790 - else{ 27.791 + } else { 27.792 for(var i=0;i < nodes.length;i++) { 27.793 nodeTo.appendChild(nodes[i].cloneNode(true)); 27.794 }; 27.795 @@ -533,32 +579,34 @@ 27.796 * the move operation, unless you supply a true third parameter</p> 27.797 * @argument nodeFrom the Node to copy the childNodes from 27.798 * @argument nodeTo the Node to copy the childNodes to 27.799 - * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 27.800 - */ 27.801 + * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is 27.802 + */ 27.803 Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 27.804 + if((!nodeFrom) || (!nodeTo)){ 27.805 + throw "Both source and destination nodes must be provided"; 27.806 + }; 27.807 if(!bPreserveExisting){ 27.808 Sarissa.clearChildNodes(nodeTo); 27.809 }; 27.810 - 27.811 var nodes = nodeFrom.childNodes; 27.812 // if within the same doc, just move, else copy and delete 27.813 if(nodeFrom.ownerDocument == nodeTo.ownerDocument){ 27.814 - nodeTo.appendChild(nodes[i]); 27.815 - }else{ 27.816 + while(nodeFrom.firstChild){ 27.817 + nodeTo.appendChild(nodeFrom.firstChild); 27.818 + }; 27.819 + } else { 27.820 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 27.821 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 27.822 - for(var i=0;i < nodes.length;i++) { 27.823 - nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 27.824 - }; 27.825 - } 27.826 - else{ 27.827 - for(var i=0;i < nodes.length;i++) { 27.828 - nodeTo.appendChild(nodes[i].cloneNode(true)); 27.829 - }; 27.830 + if(typeof(ownerDoc.importNode) != "undefined") { 27.831 + for(var i=0;i < nodes.length;i++) { 27.832 + nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 27.833 + }; 27.834 + }else{ 27.835 + for(var i=0;i < nodes.length;i++) { 27.836 + nodeTo.appendChild(nodes[i].cloneNode(true)); 27.837 + }; 27.838 }; 27.839 Sarissa.clearChildNodes(nodeFrom); 27.840 }; 27.841 - 27.842 }; 27.843 27.844 /**
28.1 --- a/examples/Common/Dictionary/Resources/scripts/sarissa.js Sun Jun 10 22:52:12 2007 +0000 28.2 +++ b/examples/Common/Dictionary/Resources/scripts/sarissa.js Sat Jul 07 16:17:29 2007 +0000 28.3 @@ -2,72 +2,54 @@ 28.4 * ==================================================================== 28.5 * About 28.6 * ==================================================================== 28.7 - * Sarissa cross browser XML library 28.8 - * @version 0.9.6 28.9 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 28.10 - * 28.11 * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. 28.12 * The library supports Gecko based browsers like Mozilla and Firefox, 28.13 - * Internet Explorer (5.5+ with MSXML3.0+) and, last but not least, KHTML based browsers like 28.14 - * Konqueror and Safari. 28.15 - * 28.16 + * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 28.17 + * @version ${project.version} 28.18 + * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 28.19 * ==================================================================== 28.20 * Licence 28.21 * ==================================================================== 28.22 - * This program is free software; you can redistribute it and/or modify 28.23 - * it under the terms of the GNU General Public License version 2 or 28.24 - * the GNU Lesser General Public License version 2.1 as published by 28.25 - * the Free Software Foundation (your choice of the two). 28.26 - * 28.27 - * This program is distributed in the hope that it will be useful, 28.28 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 28.29 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 28.30 - * GNU General Public License or GNU Lesser General Public License for more details. 28.31 - * 28.32 - * You should have received a copy of the GNU General Public License 28.33 - * or GNU Lesser General Public License along with this program; if not, 28.34 - * write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 28.35 - * or visit http://www.gnu.org 28.36 - * 28.37 + * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher, 28.38 + * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher 28.39 + * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If 28.40 + * you make modifications under the ASL, i would appreciate it if you submitted those. 28.41 + * In case your copy of Sarissa does not include the license texts, you may find 28.42 + * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 28.43 + * <a href="http://www.apache.org">http://www.apache.org</a>. 28.44 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 28.45 + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 28.46 + * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 28.47 + * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 28.48 + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 28.49 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 28.50 + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 28.51 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 28.52 */ 28.53 /** 28.54 - * <p>Sarissa is a utility class. Provides static methods for DOMDocument and 28.55 - * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.</p> 28.56 + * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument, 28.57 + * DOM Node serialization to XML strings and other utility goodies.</p> 28.58 * @constructor 28.59 */ 28.60 function Sarissa(){}; 28.61 -/** @private */ 28.62 +Sarissa.VERSION = "${project.version}"; 28.63 Sarissa.PARSED_OK = "Document contains no parsing errors"; 28.64 -/** 28.65 - * Tells you whether transformNode and transformNodeToObject are available. This functionality 28.66 - * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations 28.67 - * use the XSLTProcessor 28.68 - * @deprecated 28.69 - * @type boolean 28.70 - */ 28.71 +Sarissa.PARSED_EMPTY = "Document is empty"; 28.72 +Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error"; 28.73 Sarissa.IS_ENABLED_TRANSFORM_NODE = false; 28.74 -/** 28.75 - * tells you whether XMLHttpRequest (or equivalent) is available 28.76 - * @type boolean 28.77 - */ 28.78 -Sarissa.IS_ENABLED_XMLHTTP = false; 28.79 -/** 28.80 - * tells you whether selectNodes/selectSingleNode is available 28.81 - * @type boolean 28.82 - */ 28.83 -Sarissa.IS_ENABLED_SELECT_NODES = false; 28.84 var _sarissa_iNsCounter = 0; 28.85 var _SARISSA_IEPREFIX4XSLPARAM = ""; 28.86 var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true; 28.87 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 28.88 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 28.89 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 28.90 -var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1; 28.91 +var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 28.92 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 28.93 +if(!window.Node || !Node.ELEMENT_NODE){ 28.94 + Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 28.95 +}; 28.96 28.97 -if(!window.Node || !window.Node.ELEMENT_NODE){ 28.98 - var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 28.99 -}; 28.100 +if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 28.101 28.102 // IE initialization 28.103 if(_SARISSA_IS_IE){ 28.104 @@ -76,13 +58,15 @@ 28.105 // used to store the most recent ProgID available out of the above 28.106 var _SARISSA_DOM_PROGID = ""; 28.107 var _SARISSA_XMLHTTP_PROGID = ""; 28.108 + var _SARISSA_DOM_XMLWRITER = ""; 28.109 /** 28.110 * Called when the Sarissa_xx.js file is parsed, to pick most recent 28.111 * ProgIDs for IE, then gets destroyed. 28.112 + * @private 28.113 * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object 28.114 * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled 28.115 */ 28.116 - pickRecentProgID = function (idList, enabledList){ 28.117 + Sarissa.pickRecentProgID = function (idList){ 28.118 // found progID flag 28.119 var bFound = false; 28.120 for(var i=0; i < idList.length && !bFound; i++){ 28.121 @@ -90,50 +74,69 @@ 28.122 var oDoc = new ActiveXObject(idList[i]); 28.123 o2Store = idList[i]; 28.124 bFound = true; 28.125 - for(var j=0;j<enabledList.length;j++) 28.126 - if(i <= enabledList[j][1]) 28.127 - Sarissa["IS_ENABLED_"+enabledList[j][0]] = true; 28.128 }catch (objException){ 28.129 // trap; try next progID 28.130 }; 28.131 }; 28.132 - if (!bFound) 28.133 + if (!bFound) { 28.134 throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 28.135 + }; 28.136 idList = null; 28.137 return o2Store; 28.138 }; 28.139 // pick best available MSXML progIDs 28.140 - _SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]); 28.141 - _SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]); 28.142 - _SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 28.143 - _SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]); 28.144 + _SARISSA_DOM_PROGID = null; 28.145 + _SARISSA_THREADEDDOM_PROGID = null; 28.146 + _SARISSA_XSLTEMPLATE_PROGID = null; 28.147 + _SARISSA_XMLHTTP_PROGID = null; 28.148 + if(!window.XMLHttpRequest){ 28.149 + /** 28.150 + * Emulate XMLHttpRequest 28.151 + * @constructor 28.152 + */ 28.153 + XMLHttpRequest = function() { 28.154 + if(!_SARISSA_XMLHTTP_PROGID){ 28.155 + _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); 28.156 + }; 28.157 + return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 28.158 + }; 28.159 + }; 28.160 // we dont need this anymore 28.161 - pickRecentProgID = null; 28.162 //============================================ 28.163 // Factory methods (IE) 28.164 //============================================ 28.165 // see non-IE version 28.166 Sarissa.getDomDocument = function(sUri, sName){ 28.167 + if(!_SARISSA_DOM_PROGID){ 28.168 + _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); 28.169 + }; 28.170 var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 28.171 - // if a root tag name was provided, we need to load it in the DOM 28.172 - // object 28.173 + // if a root tag name was provided, we need to load it in the DOM object 28.174 if (sName){ 28.175 - // if needed, create an artifical namespace prefix the way Moz 28.176 - // does 28.177 - if (sUri){ 28.178 - oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + "=\"" + sUri + "\" />"); 28.179 - // don't use the same prefix again 28.180 - ++_sarissa_iNsCounter; 28.181 - } 28.182 - else 28.183 - oDoc.loadXML("<" + sName + "/>"); 28.184 + // create an artifical namespace prefix 28.185 + // or reuse existing prefix if applicable 28.186 + var prefix = ""; 28.187 + if(sUri){ 28.188 + if(sName.indexOf(":") > 1){ 28.189 + prefix = sName.substring(0, sName.indexOf(":")); 28.190 + sName = sName.substring(sName.indexOf(":")+1); 28.191 + }else{ 28.192 + prefix = "a" + (_sarissa_iNsCounter++); 28.193 + }; 28.194 + }; 28.195 + // use namespaces if a namespace URI exists 28.196 + if(sUri){ 28.197 + oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />"); 28.198 + } else { 28.199 + oDoc.loadXML('<' + sName + " />"); 28.200 + }; 28.201 }; 28.202 return oDoc; 28.203 }; 28.204 // see non-IE version 28.205 Sarissa.getParseErrorText = function (oDoc) { 28.206 var parseErrorText = Sarissa.PARSED_OK; 28.207 - if(oDoc.parseError != 0){ 28.208 + if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){ 28.209 parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + 28.210 "\nLocation: " + oDoc.parseError.url + 28.211 "\nLine Number " + oDoc.parseError.line + ", Column " + 28.212 @@ -144,6 +147,9 @@ 28.213 parseErrorText += "-"; 28.214 }; 28.215 parseErrorText += "^\n"; 28.216 + } 28.217 + else if(oDoc.documentElement == null){ 28.218 + parseErrorText = Sarissa.PARSED_EMPTY; 28.219 }; 28.220 return parseErrorText; 28.221 }; 28.222 @@ -158,43 +164,109 @@ 28.223 * @constructor 28.224 */ 28.225 XSLTProcessor = function(){ 28.226 + if(!_SARISSA_XSLTEMPLATE_PROGID){ 28.227 + _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]); 28.228 + }; 28.229 this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID); 28.230 this.processor = null; 28.231 }; 28.232 /** 28.233 - * Impoprts the given XSLT DOM and compiles it to a reusable transform 28.234 + * Imports the given XSLT DOM and compiles it to a reusable transform 28.235 + * <b>Note:</b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those 28.236 * @argument xslDoc The XSLT DOMDocument to import 28.237 */ 28.238 XSLTProcessor.prototype.importStylesheet = function(xslDoc){ 28.239 + if(!_SARISSA_THREADEDDOM_PROGID){ 28.240 + _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 28.241 + }; 28.242 + xslDoc.setProperty("SelectionLanguage", "XPath"); 28.243 + xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 28.244 // convert stylesheet to free threaded 28.245 - var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 28.246 - converted.loadXML(xslDoc.xml); 28.247 + var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 28.248 + // make included/imported stylesheets work if exist and xsl was originally loaded from url 28.249 + if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 28.250 + converted.async = false; 28.251 + if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 28.252 + converted.setProperty("AllowDocumentFunction", true); 28.253 + converted.resolveExternals = true; 28.254 + } 28.255 + converted.load(xslDoc.url); 28.256 + } else { 28.257 + converted.loadXML(xslDoc.xml); 28.258 + }; 28.259 + converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 28.260 + var output = converted.selectSingleNode("//xsl:output"); 28.261 + this.outputMethod = output ? output.getAttribute("method") : "html"; 28.262 this.template.stylesheet = converted; 28.263 this.processor = this.template.createProcessor(); 28.264 - // (re)set default param values 28.265 + // for getParameter and clearParameters 28.266 this.paramsSet = new Array(); 28.267 }; 28.268 + 28.269 /** 28.270 - * Transform the given XML DOM 28.271 + * Transform the given XML DOM and return the transformation result as a new DOM document 28.272 * @argument sourceDoc The XML DOMDocument to transform 28.273 * @return The transformation result as a DOM Document 28.274 */ 28.275 XSLTProcessor.prototype.transformToDocument = function(sourceDoc){ 28.276 - this.processor.input = sourceDoc; 28.277 - var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 28.278 - this.processor.output = outDoc; 28.279 - this.processor.transform(); 28.280 - return outDoc; 28.281 + // fix for bug 1549749 28.282 + if(_SARISSA_THREADEDDOM_PROGID){ 28.283 + this.processor.input=sourceDoc; 28.284 + var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID); 28.285 + this.processor.output=outDoc; 28.286 + this.processor.transform(); 28.287 + return outDoc; 28.288 + } 28.289 + else{ 28.290 + if(!_SARISSA_DOM_XMLWRITER){ 28.291 + _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); 28.292 + }; 28.293 + this.processor.input = sourceDoc; 28.294 + var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER); 28.295 + this.processor.output = outDoc; 28.296 + this.processor.transform(); 28.297 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 28.298 + oDoc.loadXML(outDoc.output+""); 28.299 + return oDoc; 28.300 + }; 28.301 }; 28.302 + 28.303 /** 28.304 - * Not sure if this works in IE. Maybe this will allow non-well-formed 28.305 - * transformation results (i.e. with no single root element) 28.306 + * Transform the given XML DOM and return the transformation result as a new DOM fragment. 28.307 + * <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML). 28.308 * @argument sourceDoc The XML DOMDocument to transform 28.309 - * @return The transformation result as a DOM Fragment 28.310 + * @argument ownerDoc The owner of the result fragment 28.311 + * @return The transformation result as a DOM Document 28.312 */ 28.313 - XSLTProcessor.prototype.transformToFragment = function(sourceDoc, ownerDocument){ 28.314 - return this.transformToDocument(sourceDoc); 28.315 + XSLTProcessor.prototype.transformToFragment = function (sourceDoc, ownerDoc) { 28.316 + this.processor.input = sourceDoc; 28.317 + this.processor.transform(); 28.318 + var s = this.processor.output; 28.319 + var f = ownerDoc.createDocumentFragment(); 28.320 + if (this.outputMethod == 'text') { 28.321 + f.appendChild(ownerDoc.createTextNode(s)); 28.322 + } else if (ownerDoc.body && ownerDoc.body.innerHTML) { 28.323 + var container = ownerDoc.createElement('div'); 28.324 + container.innerHTML = s; 28.325 + while (container.hasChildNodes()) { 28.326 + f.appendChild(container.firstChild); 28.327 + } 28.328 + } 28.329 + else { 28.330 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 28.331 + if (s.substring(0, 5) == '<?xml') { 28.332 + s = s.substring(s.indexOf('?>') + 2); 28.333 + } 28.334 + var xml = ''.concat('<my>', s, '</my>'); 28.335 + oDoc.loadXML(xml); 28.336 + var container = oDoc.documentElement; 28.337 + while (container.hasChildNodes()) { 28.338 + f.appendChild(container.firstChild); 28.339 + } 28.340 + } 28.341 + return f; 28.342 }; 28.343 + 28.344 /** 28.345 * Set global XSLT parameter of the imported stylesheet 28.346 * @argument nsURI The parameter namespace URI 28.347 @@ -202,13 +274,15 @@ 28.348 * @argument value The new parameter value 28.349 */ 28.350 XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 28.351 - /* nsURI is optional but cannot be null */ 28.352 + // make value a zero length string if null to allow clearing 28.353 + value = value ? value : ""; 28.354 + // nsURI is optional but cannot be null 28.355 if(nsURI){ 28.356 this.processor.addParameter(name, value, nsURI); 28.357 }else{ 28.358 this.processor.addParameter(name, value); 28.359 }; 28.360 - /* update updated params for getParameter */ 28.361 + // update updated params for getParameter 28.362 if(!this.paramsSet[""+nsURI]){ 28.363 this.paramsSet[""+nsURI] = new Array(); 28.364 }; 28.365 @@ -222,102 +296,38 @@ 28.366 * @return The parameter value if reviously set by setParameter, null otherwise 28.367 */ 28.368 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 28.369 - if(this.paramsSet[""+nsURI] && this.paramsSet[""+nsURI][name]) 28.370 - return this.paramsSet[""+nsURI][name]; 28.371 - else 28.372 + nsURI = "" + nsURI; 28.373 + if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 28.374 + return this.paramsSet[nsURI][name]; 28.375 + }else{ 28.376 return null; 28.377 + }; 28.378 }; 28.379 -} 28.380 -else{ /* end IE initialization, try to deal with real browsers now ;-) */ 28.381 - if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 28.382 - if(window.XMLDocument){ 28.383 - /** 28.384 - * <p>Emulate IE's onreadystatechange attribute</p> 28.385 - */ 28.386 - XMLDocument.prototype.onreadystatechange = null; 28.387 - /** 28.388 - * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 28.389 - * <ul><li>1 == LOADING,</li> 28.390 - * <li>2 == LOADED,</li> 28.391 - * <li>3 == INTERACTIVE,</li> 28.392 - * <li>4 == COMPLETED</li></ul> 28.393 - */ 28.394 - XMLDocument.prototype.readyState = 0; 28.395 - /** 28.396 - * <p>Emulate IE's parseError attribute</p> 28.397 - */ 28.398 - XMLDocument.prototype.parseError = 0; 28.399 - 28.400 - // NOTE: setting async to false will only work with documents 28.401 - // called over HTTP (meaning a server), not the local file system, 28.402 - // unless you are using Moz 1.4+. 28.403 - // BTW the try>catch block is for 1.4; I haven't found a way to check if 28.404 - // the property is implemented without 28.405 - // causing an error and I dont want to use user agent stuff for that... 28.406 - var _SARISSA_SYNC_NON_IMPLEMENTED = false; 28.407 - try{ 28.408 - /** 28.409 - * <p>Emulates IE's async property for Moz versions prior to 1.4. 28.410 - * It controls whether loading of remote XML files works 28.411 - * synchronously or asynchronously.</p> 28.412 - */ 28.413 - XMLDocument.prototype.async = true; 28.414 - _SARISSA_SYNC_NON_IMPLEMENTED = true; 28.415 - }catch(e){/* trap */}; 28.416 - /** 28.417 - * <p>Keeps a handle to the original load() method. Internal use and only 28.418 - * if Mozilla version is lower than 1.4</p> 28.419 - * @private 28.420 - */ 28.421 - XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; 28.422 - 28.423 - /** 28.424 - * <p>Overrides the original load method to provide synchronous loading for 28.425 - * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if 28.426 - * async is set to false)</p> 28.427 - * @returns the DOM Object as it was before the load() call (may be empty) 28.428 - */ 28.429 - XMLDocument.prototype.load = function(sURI) { 28.430 - var oDoc = document.implementation.createDocument("", "", null); 28.431 - Sarissa.copyChildNodes(this, oDoc); 28.432 - this.parseError = 0; 28.433 - Sarissa.__setReadyState__(this, 1); 28.434 - try { 28.435 - if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { 28.436 - var tmp = new XMLHttpRequest(); 28.437 - tmp.open("GET", sURI, false); 28.438 - tmp.send(null); 28.439 - Sarissa.__setReadyState__(this, 2); 28.440 - Sarissa.copyChildNodes(tmp.responseXML, this); 28.441 - Sarissa.__setReadyState__(this, 3); 28.442 - } 28.443 - else { 28.444 - this._sarissa_load(sURI); 28.445 - }; 28.446 - } 28.447 - catch (objException) { 28.448 - this.parseError = -1; 28.449 - } 28.450 - finally { 28.451 - if(this.async == false){ 28.452 - Sarissa.__handleLoad__(this); 28.453 - }; 28.454 + /** 28.455 + * Clear parameters (set them to default values as defined in the stylesheet itself) 28.456 + */ 28.457 + XSLTProcessor.prototype.clearParameters = function(){ 28.458 + for(var nsURI in this.paramsSet){ 28.459 + for(var name in this.paramsSet[nsURI]){ 28.460 + if(nsURI){ 28.461 + this.processor.addParameter(name, "", nsURI); 28.462 + }else{ 28.463 + this.processor.addParameter(name, ""); 28.464 }; 28.465 - return oDoc; 28.466 }; 28.467 - };//if(window.XMLDocument) 28.468 - 28.469 + }; 28.470 + this.paramsSet = new Array(); 28.471 + }; 28.472 +}else{ /* end IE initialization, try to deal with real browsers now ;-) */ 28.473 + if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 28.474 /** 28.475 * <p>Ensures the document was loaded correctly, otherwise sets the 28.476 * parseError to -1 to indicate something went wrong. Internal use</p> 28.477 * @private 28.478 */ 28.479 Sarissa.__handleLoad__ = function(oDoc){ 28.480 - if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") 28.481 - oDoc.parseError = -1; 28.482 Sarissa.__setReadyState__(oDoc, 4); 28.483 }; 28.484 - 28.485 /** 28.486 * <p>Attached by an event handler to the load event. Internal use.</p> 28.487 * @private 28.488 @@ -325,7 +335,6 @@ 28.489 _sarissa_XMLDocument_onload = function(){ 28.490 Sarissa.__handleLoad__(this); 28.491 }; 28.492 - 28.493 /** 28.494 * <p>Sets the readyState property of the given DOM Document object. 28.495 * Internal use.</p> 28.496 @@ -336,80 +345,129 @@ 28.497 */ 28.498 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 28.499 oDoc.readyState = iReadyState; 28.500 + oDoc.readystate = iReadyState; 28.501 if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 28.502 oDoc.onreadystatechange(); 28.503 }; 28.504 - /** 28.505 - * <p>Factory method to obtain a new DOM Document object</p> 28.506 - * @argument sUri the namespace of the root node (if any) 28.507 - * @argument sUri the local name of the root node (if any) 28.508 - * @returns a new DOM Document 28.509 - */ 28.510 Sarissa.getDomDocument = function(sUri, sName){ 28.511 - var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); 28.512 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 28.513 + if(!oDoc.onreadystatechange){ 28.514 + 28.515 + /** 28.516 + * <p>Emulate IE's onreadystatechange attribute</p> 28.517 + */ 28.518 + oDoc.onreadystatechange = null; 28.519 + }; 28.520 + if(!oDoc.readyState){ 28.521 + /** 28.522 + * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 28.523 + * <ul><li>1 == LOADING,</li> 28.524 + * <li>2 == LOADED,</li> 28.525 + * <li>3 == INTERACTIVE,</li> 28.526 + * <li>4 == COMPLETED</li></ul> 28.527 + */ 28.528 + oDoc.readyState = 0; 28.529 + }; 28.530 oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); 28.531 return oDoc; 28.532 - }; 28.533 + }; 28.534 + if(window.XMLDocument){ 28.535 + // do nothing 28.536 + }// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS 28.537 + else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ 28.538 + //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good 28.539 + /** 28.540 + * <p>Factory method to obtain a new DOM Document object</p> 28.541 + * @argument sUri the namespace of the root node (if any) 28.542 + * @argument sUri the local name of the root node (if any) 28.543 + * @returns a new DOM Document 28.544 + */ 28.545 + Sarissa.getDomDocument = function(sUri, sName){ 28.546 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 28.547 + return oDoc; 28.548 + }; 28.549 + } 28.550 + else { 28.551 + Sarissa.getDomDocument = function(sUri, sName){ 28.552 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 28.553 + // looks like safari does not create the root element for some unknown reason 28.554 + if(oDoc && (sUri || sName) && !oDoc.documentElement){ 28.555 + oDoc.appendChild(oDoc.createElementNS(sUri, sName)); 28.556 + }; 28.557 + return oDoc; 28.558 + }; 28.559 + }; 28.560 };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT) 28.561 }; 28.562 //========================================== 28.563 // Common stuff 28.564 //========================================== 28.565 if(!window.DOMParser){ 28.566 - /** 28.567 - * DOMParser is a utility class, used to construct DOMDocuments from XML strings 28.568 - * @constructor 28.569 - */ 28.570 - DOMParser = function() { 28.571 + if(_SARISSA_IS_SAFARI){ 28.572 + /* 28.573 + * DOMParser is a utility class, used to construct DOMDocuments from XML strings 28.574 + * @constructor 28.575 + */ 28.576 + DOMParser = function() { }; 28.577 + /** 28.578 + * Construct a new DOM Document from the given XMLstring 28.579 + * @param sXml the given XML string 28.580 + * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 28.581 + * @return a new DOM Document from the given XML string 28.582 + */ 28.583 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 28.584 + var xmlhttp = new XMLHttpRequest(); 28.585 + xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(sXml), false); 28.586 + xmlhttp.send(null); 28.587 + return xmlhttp.responseXML; 28.588 + }; 28.589 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 28.590 + DOMParser = function() { }; 28.591 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 28.592 + var doc = Sarissa.getDomDocument(); 28.593 + doc.loadXML(sXml); 28.594 + return doc; 28.595 + }; 28.596 }; 28.597 - /** 28.598 - * Construct a new DOM Document from the given XMLstring 28.599 - * @param sXml the given XML string 28.600 - * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 28.601 - * @return a new DOM Document from the given XML string 28.602 - */ 28.603 - DOMParser.prototype.parseFromString = function(sXml, contentType){ 28.604 - var doc = Sarissa.getDomDocument(); 28.605 - doc.loadXML(sXml); 28.606 - return doc; 28.607 - }; 28.608 - 28.609 }; 28.610 28.611 -if(window.XMLHttpRequest){ 28.612 - Sarissa.IS_ENABLED_XMLHTTP = true; 28.613 -} 28.614 -else if(_SARISSA_IS_IE){ 28.615 - /** 28.616 - * Emulate XMLHttpRequest 28.617 - * @constructor 28.618 - */ 28.619 - XMLHttpRequest = function() { 28.620 - return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 28.621 - }; 28.622 - Sarissa.IS_ENABLED_XMLHTTP = true; 28.623 -}; 28.624 - 28.625 -if(!window.document.importNode && _SARISSA_IS_IE){ 28.626 +if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){ 28.627 try{ 28.628 /** 28.629 - * Implements importNode for the current window document in IE using innerHTML. 28.630 - * Testing showed that DOM was multiple times slower than innerHTML for this, 28.631 - * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML) 28.632 - * please gimme a call. 28.633 + * Implementation of importNode for the context window document in IE. 28.634 + * If <code>oNode</code> is a TextNode, <code>bChildren</code> is ignored. 28.635 * @param oNode the Node to import 28.636 * @param bChildren whether to include the children of oNode 28.637 * @returns the imported node for further use 28.638 */ 28.639 - window.document.importNode = function(oNode, bChildren){ 28.640 - var importNode = document.createElement("div"); 28.641 - if(bChildren) 28.642 - importNode.innerHTML = Sarissa.serialize(oNode); 28.643 - else 28.644 - importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false)); 28.645 - return importNode.firstChild; 28.646 + document.importNode = function(oNode, bChildren){ 28.647 + var tmp; 28.648 + if (oNode.nodeName=='#text') { 28.649 + return document.createTextElement(oNode.data); 28.650 + } 28.651 + else { 28.652 + if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){ 28.653 + tmp = document.createElement("table"); 28.654 + } 28.655 + else if(oNode.nodeName == "td"){ 28.656 + tmp = document.createElement("tr"); 28.657 + } 28.658 + else if(oNode.nodeName == "option"){ 28.659 + tmp = document.createElement("select"); 28.660 + } 28.661 + else{ 28.662 + tmp = document.createElement("div"); 28.663 + }; 28.664 + if(bChildren){ 28.665 + tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML; 28.666 + }else{ 28.667 + tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML; 28.668 + }; 28.669 + return tmp.getElementsByTagName("*")[0]; 28.670 + }; 28.671 + 28.672 }; 28.673 - }catch(e){}; 28.674 + }catch(e){ }; 28.675 }; 28.676 if(!Sarissa.getParseErrorText){ 28.677 /** 28.678 @@ -423,17 +481,16 @@ 28.679 */ 28.680 Sarissa.getParseErrorText = function (oDoc){ 28.681 var parseErrorText = Sarissa.PARSED_OK; 28.682 - if(oDoc.parseError != 0){ 28.683 - /*moz*/ 28.684 - if(oDoc.documentElement.tagName == "parsererror"){ 28.685 - parseErrorText = oDoc.documentElement.firstChild.data; 28.686 - parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 28.687 - }/*konq*/ 28.688 - else if(oDoc.documentElement.tagName == "html"){ 28.689 - parseErrorText = Sarissa.getText(oDoc.documentElement.getElementsByTagName("h1")[0], false) + "\n"; 28.690 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n"; 28.691 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false); 28.692 - }; 28.693 + if(!oDoc.documentElement){ 28.694 + parseErrorText = Sarissa.PARSED_EMPTY; 28.695 + } else if(oDoc.documentElement.tagName == "parsererror"){ 28.696 + parseErrorText = oDoc.documentElement.firstChild.data; 28.697 + parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 28.698 + } else if(oDoc.getElementsByTagName("parsererror").length > 0){ 28.699 + var parsererror = oDoc.getElementsByTagName("parsererror")[0]; 28.700 + parseErrorText = Sarissa.getText(parsererror, true)+"\n"; 28.701 + } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){ 28.702 + parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR; 28.703 }; 28.704 return parseErrorText; 28.705 }; 28.706 @@ -446,8 +503,7 @@ 28.707 var nodeType = node.nodeType; 28.708 if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){ 28.709 s += node.data; 28.710 - } 28.711 - else if(deep == true 28.712 + } else if(deep == true 28.713 && (nodeType == Node.ELEMENT_NODE 28.714 || nodeType == Node.DOCUMENT_NODE 28.715 || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ 28.716 @@ -456,33 +512,20 @@ 28.717 }; 28.718 return s; 28.719 }; 28.720 -if(window.XMLSerializer){ 28.721 +if(!window.XMLSerializer 28.722 + && Sarissa.getDomDocument 28.723 + && Sarissa.getDomDocument("","foo", null).xml){ 28.724 /** 28.725 - * <p>Factory method to obtain the serialization of a DOM Node</p> 28.726 - * @returns the serialized Node as an XML string 28.727 + * Utility class to serialize DOM Node objects to XML strings 28.728 + * @constructor 28.729 */ 28.730 - Sarissa.serialize = function(oDoc){ 28.731 - return (new XMLSerializer()).serializeToString(oDoc); 28.732 - }; 28.733 -}else{ 28.734 - if((Sarissa.getDomDocument("","foo", null)).xml){ 28.735 - // see non-IE version 28.736 - Sarissa.serialize = function(oDoc) { 28.737 - // TODO: check for HTML document and return innerHTML instead 28.738 - return oDoc.xml; 28.739 - }; 28.740 - /** 28.741 - * Utility class to serialize DOM Node objects to XML strings 28.742 - * @constructor 28.743 - */ 28.744 - XMLSerializer = function(){}; 28.745 - /** 28.746 - * Serialize the given DOM Node to an XML string 28.747 - * @param oNode the DOM Node to serialize 28.748 - */ 28.749 - XMLSerializer.prototype.serializeToString = function(oNode) { 28.750 - return oNode.xml; 28.751 - }; 28.752 + XMLSerializer = function(){}; 28.753 + /** 28.754 + * Serialize the given DOM Node to an XML string 28.755 + * @param oNode the DOM Node to serialize 28.756 + */ 28.757 + XMLSerializer.prototype.serializeToString = function(oNode) { 28.758 + return oNode.xml; 28.759 }; 28.760 }; 28.761 28.762 @@ -497,7 +540,8 @@ 28.763 * @argument oNode the Node to empty 28.764 */ 28.765 Sarissa.clearChildNodes = function(oNode) { 28.766 - while(oNode.hasChildNodes()){ 28.767 + // need to check for firstChild due to opera 8 bug with hasChildNodes 28.768 + while(oNode.firstChild) { 28.769 oNode.removeChild(oNode.firstChild); 28.770 }; 28.771 }; 28.772 @@ -510,17 +554,19 @@ 28.773 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 28.774 */ 28.775 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 28.776 + if((!nodeFrom) || (!nodeTo)){ 28.777 + throw "Both source and destination nodes must be provided"; 28.778 + }; 28.779 if(!bPreserveExisting){ 28.780 Sarissa.clearChildNodes(nodeTo); 28.781 }; 28.782 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 28.783 var nodes = nodeFrom.childNodes; 28.784 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 28.785 + if(typeof(ownerDoc.importNode) != "undefined") { 28.786 for(var i=0;i < nodes.length;i++) { 28.787 nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 28.788 }; 28.789 - } 28.790 - else{ 28.791 + } else { 28.792 for(var i=0;i < nodes.length;i++) { 28.793 nodeTo.appendChild(nodes[i].cloneNode(true)); 28.794 }; 28.795 @@ -533,32 +579,34 @@ 28.796 * the move operation, unless you supply a true third parameter</p> 28.797 * @argument nodeFrom the Node to copy the childNodes from 28.798 * @argument nodeTo the Node to copy the childNodes to 28.799 - * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 28.800 - */ 28.801 + * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is 28.802 + */ 28.803 Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 28.804 + if((!nodeFrom) || (!nodeTo)){ 28.805 + throw "Both source and destination nodes must be provided"; 28.806 + }; 28.807 if(!bPreserveExisting){ 28.808 Sarissa.clearChildNodes(nodeTo); 28.809 }; 28.810 - 28.811 var nodes = nodeFrom.childNodes; 28.812 // if within the same doc, just move, else copy and delete 28.813 if(nodeFrom.ownerDocument == nodeTo.ownerDocument){ 28.814 - nodeTo.appendChild(nodes[i]); 28.815 - }else{ 28.816 + while(nodeFrom.firstChild){ 28.817 + nodeTo.appendChild(nodeFrom.firstChild); 28.818 + }; 28.819 + } else { 28.820 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 28.821 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 28.822 - for(var i=0;i < nodes.length;i++) { 28.823 - nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 28.824 - }; 28.825 - } 28.826 - else{ 28.827 - for(var i=0;i < nodes.length;i++) { 28.828 - nodeTo.appendChild(nodes[i].cloneNode(true)); 28.829 - }; 28.830 + if(typeof(ownerDoc.importNode) != "undefined") { 28.831 + for(var i=0;i < nodes.length;i++) { 28.832 + nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 28.833 + }; 28.834 + }else{ 28.835 + for(var i=0;i < nodes.length;i++) { 28.836 + nodeTo.appendChild(nodes[i].cloneNode(true)); 28.837 + }; 28.838 }; 28.839 Sarissa.clearChildNodes(nodeFrom); 28.840 }; 28.841 - 28.842 }; 28.843 28.844 /**
29.1 --- a/examples/Common/PEP241/Resources/scripts/sarissa.js Sun Jun 10 22:52:12 2007 +0000 29.2 +++ b/examples/Common/PEP241/Resources/scripts/sarissa.js Sat Jul 07 16:17:29 2007 +0000 29.3 @@ -2,72 +2,54 @@ 29.4 * ==================================================================== 29.5 * About 29.6 * ==================================================================== 29.7 - * Sarissa cross browser XML library 29.8 - * @version 0.9.6 29.9 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 29.10 - * 29.11 * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. 29.12 * The library supports Gecko based browsers like Mozilla and Firefox, 29.13 - * Internet Explorer (5.5+ with MSXML3.0+) and, last but not least, KHTML based browsers like 29.14 - * Konqueror and Safari. 29.15 - * 29.16 + * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 29.17 + * @version ${project.version} 29.18 + * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 29.19 * ==================================================================== 29.20 * Licence 29.21 * ==================================================================== 29.22 - * This program is free software; you can redistribute it and/or modify 29.23 - * it under the terms of the GNU General Public License version 2 or 29.24 - * the GNU Lesser General Public License version 2.1 as published by 29.25 - * the Free Software Foundation (your choice of the two). 29.26 - * 29.27 - * This program is distributed in the hope that it will be useful, 29.28 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 29.29 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 29.30 - * GNU General Public License or GNU Lesser General Public License for more details. 29.31 - * 29.32 - * You should have received a copy of the GNU General Public License 29.33 - * or GNU Lesser General Public License along with this program; if not, 29.34 - * write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 29.35 - * or visit http://www.gnu.org 29.36 - * 29.37 + * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher, 29.38 + * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher 29.39 + * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If 29.40 + * you make modifications under the ASL, i would appreciate it if you submitted those. 29.41 + * In case your copy of Sarissa does not include the license texts, you may find 29.42 + * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 29.43 + * <a href="http://www.apache.org">http://www.apache.org</a>. 29.44 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 29.45 + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 29.46 + * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 29.47 + * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 29.48 + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 29.49 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 29.50 + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 29.51 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 29.52 */ 29.53 /** 29.54 - * <p>Sarissa is a utility class. Provides static methods for DOMDocument and 29.55 - * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.</p> 29.56 + * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument, 29.57 + * DOM Node serialization to XML strings and other utility goodies.</p> 29.58 * @constructor 29.59 */ 29.60 function Sarissa(){}; 29.61 -/** @private */ 29.62 +Sarissa.VERSION = "${project.version}"; 29.63 Sarissa.PARSED_OK = "Document contains no parsing errors"; 29.64 -/** 29.65 - * Tells you whether transformNode and transformNodeToObject are available. This functionality 29.66 - * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations 29.67 - * use the XSLTProcessor 29.68 - * @deprecated 29.69 - * @type boolean 29.70 - */ 29.71 +Sarissa.PARSED_EMPTY = "Document is empty"; 29.72 +Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error"; 29.73 Sarissa.IS_ENABLED_TRANSFORM_NODE = false; 29.74 -/** 29.75 - * tells you whether XMLHttpRequest (or equivalent) is available 29.76 - * @type boolean 29.77 - */ 29.78 -Sarissa.IS_ENABLED_XMLHTTP = false; 29.79 -/** 29.80 - * tells you whether selectNodes/selectSingleNode is available 29.81 - * @type boolean 29.82 - */ 29.83 -Sarissa.IS_ENABLED_SELECT_NODES = false; 29.84 var _sarissa_iNsCounter = 0; 29.85 var _SARISSA_IEPREFIX4XSLPARAM = ""; 29.86 var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true; 29.87 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 29.88 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 29.89 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 29.90 -var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1; 29.91 +var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 29.92 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 29.93 +if(!window.Node || !Node.ELEMENT_NODE){ 29.94 + Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 29.95 +}; 29.96 29.97 -if(!window.Node || !window.Node.ELEMENT_NODE){ 29.98 - var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 29.99 -}; 29.100 +if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 29.101 29.102 // IE initialization 29.103 if(_SARISSA_IS_IE){ 29.104 @@ -76,13 +58,15 @@ 29.105 // used to store the most recent ProgID available out of the above 29.106 var _SARISSA_DOM_PROGID = ""; 29.107 var _SARISSA_XMLHTTP_PROGID = ""; 29.108 + var _SARISSA_DOM_XMLWRITER = ""; 29.109 /** 29.110 * Called when the Sarissa_xx.js file is parsed, to pick most recent 29.111 * ProgIDs for IE, then gets destroyed. 29.112 + * @private 29.113 * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object 29.114 * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled 29.115 */ 29.116 - pickRecentProgID = function (idList, enabledList){ 29.117 + Sarissa.pickRecentProgID = function (idList){ 29.118 // found progID flag 29.119 var bFound = false; 29.120 for(var i=0; i < idList.length && !bFound; i++){ 29.121 @@ -90,50 +74,69 @@ 29.122 var oDoc = new ActiveXObject(idList[i]); 29.123 o2Store = idList[i]; 29.124 bFound = true; 29.125 - for(var j=0;j<enabledList.length;j++) 29.126 - if(i <= enabledList[j][1]) 29.127 - Sarissa["IS_ENABLED_"+enabledList[j][0]] = true; 29.128 }catch (objException){ 29.129 // trap; try next progID 29.130 }; 29.131 }; 29.132 - if (!bFound) 29.133 + if (!bFound) { 29.134 throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 29.135 + }; 29.136 idList = null; 29.137 return o2Store; 29.138 }; 29.139 // pick best available MSXML progIDs 29.140 - _SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]); 29.141 - _SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]); 29.142 - _SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 29.143 - _SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]); 29.144 + _SARISSA_DOM_PROGID = null; 29.145 + _SARISSA_THREADEDDOM_PROGID = null; 29.146 + _SARISSA_XSLTEMPLATE_PROGID = null; 29.147 + _SARISSA_XMLHTTP_PROGID = null; 29.148 + if(!window.XMLHttpRequest){ 29.149 + /** 29.150 + * Emulate XMLHttpRequest 29.151 + * @constructor 29.152 + */ 29.153 + XMLHttpRequest = function() { 29.154 + if(!_SARISSA_XMLHTTP_PROGID){ 29.155 + _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); 29.156 + }; 29.157 + return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 29.158 + }; 29.159 + }; 29.160 // we dont need this anymore 29.161 - pickRecentProgID = null; 29.162 //============================================ 29.163 // Factory methods (IE) 29.164 //============================================ 29.165 // see non-IE version 29.166 Sarissa.getDomDocument = function(sUri, sName){ 29.167 + if(!_SARISSA_DOM_PROGID){ 29.168 + _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); 29.169 + }; 29.170 var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 29.171 - // if a root tag name was provided, we need to load it in the DOM 29.172 - // object 29.173 + // if a root tag name was provided, we need to load it in the DOM object 29.174 if (sName){ 29.175 - // if needed, create an artifical namespace prefix the way Moz 29.176 - // does 29.177 - if (sUri){ 29.178 - oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + "=\"" + sUri + "\" />"); 29.179 - // don't use the same prefix again 29.180 - ++_sarissa_iNsCounter; 29.181 - } 29.182 - else 29.183 - oDoc.loadXML("<" + sName + "/>"); 29.184 + // create an artifical namespace prefix 29.185 + // or reuse existing prefix if applicable 29.186 + var prefix = ""; 29.187 + if(sUri){ 29.188 + if(sName.indexOf(":") > 1){ 29.189 + prefix = sName.substring(0, sName.indexOf(":")); 29.190 + sName = sName.substring(sName.indexOf(":")+1); 29.191 + }else{ 29.192 + prefix = "a" + (_sarissa_iNsCounter++); 29.193 + }; 29.194 + }; 29.195 + // use namespaces if a namespace URI exists 29.196 + if(sUri){ 29.197 + oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />"); 29.198 + } else { 29.199 + oDoc.loadXML('<' + sName + " />"); 29.200 + }; 29.201 }; 29.202 return oDoc; 29.203 }; 29.204 // see non-IE version 29.205 Sarissa.getParseErrorText = function (oDoc) { 29.206 var parseErrorText = Sarissa.PARSED_OK; 29.207 - if(oDoc.parseError != 0){ 29.208 + if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){ 29.209 parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + 29.210 "\nLocation: " + oDoc.parseError.url + 29.211 "\nLine Number " + oDoc.parseError.line + ", Column " + 29.212 @@ -144,6 +147,9 @@ 29.213 parseErrorText += "-"; 29.214 }; 29.215 parseErrorText += "^\n"; 29.216 + } 29.217 + else if(oDoc.documentElement == null){ 29.218 + parseErrorText = Sarissa.PARSED_EMPTY; 29.219 }; 29.220 return parseErrorText; 29.221 }; 29.222 @@ -158,43 +164,109 @@ 29.223 * @constructor 29.224 */ 29.225 XSLTProcessor = function(){ 29.226 + if(!_SARISSA_XSLTEMPLATE_PROGID){ 29.227 + _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]); 29.228 + }; 29.229 this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID); 29.230 this.processor = null; 29.231 }; 29.232 /** 29.233 - * Impoprts the given XSLT DOM and compiles it to a reusable transform 29.234 + * Imports the given XSLT DOM and compiles it to a reusable transform 29.235 + * <b>Note:</b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those 29.236 * @argument xslDoc The XSLT DOMDocument to import 29.237 */ 29.238 XSLTProcessor.prototype.importStylesheet = function(xslDoc){ 29.239 + if(!_SARISSA_THREADEDDOM_PROGID){ 29.240 + _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 29.241 + }; 29.242 + xslDoc.setProperty("SelectionLanguage", "XPath"); 29.243 + xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 29.244 // convert stylesheet to free threaded 29.245 - var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 29.246 - converted.loadXML(xslDoc.xml); 29.247 + var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 29.248 + // make included/imported stylesheets work if exist and xsl was originally loaded from url 29.249 + if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 29.250 + converted.async = false; 29.251 + if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 29.252 + converted.setProperty("AllowDocumentFunction", true); 29.253 + converted.resolveExternals = true; 29.254 + } 29.255 + converted.load(xslDoc.url); 29.256 + } else { 29.257 + converted.loadXML(xslDoc.xml); 29.258 + }; 29.259 + converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 29.260 + var output = converted.selectSingleNode("//xsl:output"); 29.261 + this.outputMethod = output ? output.getAttribute("method") : "html"; 29.262 this.template.stylesheet = converted; 29.263 this.processor = this.template.createProcessor(); 29.264 - // (re)set default param values 29.265 + // for getParameter and clearParameters 29.266 this.paramsSet = new Array(); 29.267 }; 29.268 + 29.269 /** 29.270 - * Transform the given XML DOM 29.271 + * Transform the given XML DOM and return the transformation result as a new DOM document 29.272 * @argument sourceDoc The XML DOMDocument to transform 29.273 * @return The transformation result as a DOM Document 29.274 */ 29.275 XSLTProcessor.prototype.transformToDocument = function(sourceDoc){ 29.276 - this.processor.input = sourceDoc; 29.277 - var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 29.278 - this.processor.output = outDoc; 29.279 - this.processor.transform(); 29.280 - return outDoc; 29.281 + // fix for bug 1549749 29.282 + if(_SARISSA_THREADEDDOM_PROGID){ 29.283 + this.processor.input=sourceDoc; 29.284 + var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID); 29.285 + this.processor.output=outDoc; 29.286 + this.processor.transform(); 29.287 + return outDoc; 29.288 + } 29.289 + else{ 29.290 + if(!_SARISSA_DOM_XMLWRITER){ 29.291 + _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); 29.292 + }; 29.293 + this.processor.input = sourceDoc; 29.294 + var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER); 29.295 + this.processor.output = outDoc; 29.296 + this.processor.transform(); 29.297 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 29.298 + oDoc.loadXML(outDoc.output+""); 29.299 + return oDoc; 29.300 + }; 29.301 }; 29.302 + 29.303 /** 29.304 - * Not sure if this works in IE. Maybe this will allow non-well-formed 29.305 - * transformation results (i.e. with no single root element) 29.306 + * Transform the given XML DOM and return the transformation result as a new DOM fragment. 29.307 + * <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML). 29.308 * @argument sourceDoc The XML DOMDocument to transform 29.309 - * @return The transformation result as a DOM Fragment 29.310 + * @argument ownerDoc The owner of the result fragment 29.311 + * @return The transformation result as a DOM Document 29.312 */ 29.313 - XSLTProcessor.prototype.transformToFragment = function(sourceDoc, ownerDocument){ 29.314 - return this.transformToDocument(sourceDoc); 29.315 + XSLTProcessor.prototype.transformToFragment = function (sourceDoc, ownerDoc) { 29.316 + this.processor.input = sourceDoc; 29.317 + this.processor.transform(); 29.318 + var s = this.processor.output; 29.319 + var f = ownerDoc.createDocumentFragment(); 29.320 + if (this.outputMethod == 'text') { 29.321 + f.appendChild(ownerDoc.createTextNode(s)); 29.322 + } else if (ownerDoc.body && ownerDoc.body.innerHTML) { 29.323 + var container = ownerDoc.createElement('div'); 29.324 + container.innerHTML = s; 29.325 + while (container.hasChildNodes()) { 29.326 + f.appendChild(container.firstChild); 29.327 + } 29.328 + } 29.329 + else { 29.330 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 29.331 + if (s.substring(0, 5) == '<?xml') { 29.332 + s = s.substring(s.indexOf('?>') + 2); 29.333 + } 29.334 + var xml = ''.concat('<my>', s, '</my>'); 29.335 + oDoc.loadXML(xml); 29.336 + var container = oDoc.documentElement; 29.337 + while (container.hasChildNodes()) { 29.338 + f.appendChild(container.firstChild); 29.339 + } 29.340 + } 29.341 + return f; 29.342 }; 29.343 + 29.344 /** 29.345 * Set global XSLT parameter of the imported stylesheet 29.346 * @argument nsURI The parameter namespace URI 29.347 @@ -202,13 +274,15 @@ 29.348 * @argument value The new parameter value 29.349 */ 29.350 XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 29.351 - /* nsURI is optional but cannot be null */ 29.352 + // make value a zero length string if null to allow clearing 29.353 + value = value ? value : ""; 29.354 + // nsURI is optional but cannot be null 29.355 if(nsURI){ 29.356 this.processor.addParameter(name, value, nsURI); 29.357 }else{ 29.358 this.processor.addParameter(name, value); 29.359 }; 29.360 - /* update updated params for getParameter */ 29.361 + // update updated params for getParameter 29.362 if(!this.paramsSet[""+nsURI]){ 29.363 this.paramsSet[""+nsURI] = new Array(); 29.364 }; 29.365 @@ -222,102 +296,38 @@ 29.366 * @return The parameter value if reviously set by setParameter, null otherwise 29.367 */ 29.368 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 29.369 - if(this.paramsSet[""+nsURI] && this.paramsSet[""+nsURI][name]) 29.370 - return this.paramsSet[""+nsURI][name]; 29.371 - else 29.372 + nsURI = "" + nsURI; 29.373 + if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 29.374 + return this.paramsSet[nsURI][name]; 29.375 + }else{ 29.376 return null; 29.377 + }; 29.378 }; 29.379 -} 29.380 -else{ /* end IE initialization, try to deal with real browsers now ;-) */ 29.381 - if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 29.382 - if(window.XMLDocument){ 29.383 - /** 29.384 - * <p>Emulate IE's onreadystatechange attribute</p> 29.385 - */ 29.386 - XMLDocument.prototype.onreadystatechange = null; 29.387 - /** 29.388 - * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 29.389 - * <ul><li>1 == LOADING,</li> 29.390 - * <li>2 == LOADED,</li> 29.391 - * <li>3 == INTERACTIVE,</li> 29.392 - * <li>4 == COMPLETED</li></ul> 29.393 - */ 29.394 - XMLDocument.prototype.readyState = 0; 29.395 - /** 29.396 - * <p>Emulate IE's parseError attribute</p> 29.397 - */ 29.398 - XMLDocument.prototype.parseError = 0; 29.399 - 29.400 - // NOTE: setting async to false will only work with documents 29.401 - // called over HTTP (meaning a server), not the local file system, 29.402 - // unless you are using Moz 1.4+. 29.403 - // BTW the try>catch block is for 1.4; I haven't found a way to check if 29.404 - // the property is implemented without 29.405 - // causing an error and I dont want to use user agent stuff for that... 29.406 - var _SARISSA_SYNC_NON_IMPLEMENTED = false; 29.407 - try{ 29.408 - /** 29.409 - * <p>Emulates IE's async property for Moz versions prior to 1.4. 29.410 - * It controls whether loading of remote XML files works 29.411 - * synchronously or asynchronously.</p> 29.412 - */ 29.413 - XMLDocument.prototype.async = true; 29.414 - _SARISSA_SYNC_NON_IMPLEMENTED = true; 29.415 - }catch(e){/* trap */}; 29.416 - /** 29.417 - * <p>Keeps a handle to the original load() method. Internal use and only 29.418 - * if Mozilla version is lower than 1.4</p> 29.419 - * @private 29.420 - */ 29.421 - XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; 29.422 - 29.423 - /** 29.424 - * <p>Overrides the original load method to provide synchronous loading for 29.425 - * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if 29.426 - * async is set to false)</p> 29.427 - * @returns the DOM Object as it was before the load() call (may be empty) 29.428 - */ 29.429 - XMLDocument.prototype.load = function(sURI) { 29.430 - var oDoc = document.implementation.createDocument("", "", null); 29.431 - Sarissa.copyChildNodes(this, oDoc); 29.432 - this.parseError = 0; 29.433 - Sarissa.__setReadyState__(this, 1); 29.434 - try { 29.435 - if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { 29.436 - var tmp = new XMLHttpRequest(); 29.437 - tmp.open("GET", sURI, false); 29.438 - tmp.send(null); 29.439 - Sarissa.__setReadyState__(this, 2); 29.440 - Sarissa.copyChildNodes(tmp.responseXML, this); 29.441 - Sarissa.__setReadyState__(this, 3); 29.442 - } 29.443 - else { 29.444 - this._sarissa_load(sURI); 29.445 - }; 29.446 - } 29.447 - catch (objException) { 29.448 - this.parseError = -1; 29.449 - } 29.450 - finally { 29.451 - if(this.async == false){ 29.452 - Sarissa.__handleLoad__(this); 29.453 - }; 29.454 + /** 29.455 + * Clear parameters (set them to default values as defined in the stylesheet itself) 29.456 + */ 29.457 + XSLTProcessor.prototype.clearParameters = function(){ 29.458 + for(var nsURI in this.paramsSet){ 29.459 + for(var name in this.paramsSet[nsURI]){ 29.460 + if(nsURI){ 29.461 + this.processor.addParameter(name, "", nsURI); 29.462 + }else{ 29.463 + this.processor.addParameter(name, ""); 29.464 }; 29.465 - return oDoc; 29.466 }; 29.467 - };//if(window.XMLDocument) 29.468 - 29.469 + }; 29.470 + this.paramsSet = new Array(); 29.471 + }; 29.472 +}else{ /* end IE initialization, try to deal with real browsers now ;-) */ 29.473 + if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 29.474 /** 29.475 * <p>Ensures the document was loaded correctly, otherwise sets the 29.476 * parseError to -1 to indicate something went wrong. Internal use</p> 29.477 * @private 29.478 */ 29.479 Sarissa.__handleLoad__ = function(oDoc){ 29.480 - if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") 29.481 - oDoc.parseError = -1; 29.482 Sarissa.__setReadyState__(oDoc, 4); 29.483 }; 29.484 - 29.485 /** 29.486 * <p>Attached by an event handler to the load event. Internal use.</p> 29.487 * @private 29.488 @@ -325,7 +335,6 @@ 29.489 _sarissa_XMLDocument_onload = function(){ 29.490 Sarissa.__handleLoad__(this); 29.491 }; 29.492 - 29.493 /** 29.494 * <p>Sets the readyState property of the given DOM Document object. 29.495 * Internal use.</p> 29.496 @@ -336,80 +345,129 @@ 29.497 */ 29.498 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 29.499 oDoc.readyState = iReadyState; 29.500 + oDoc.readystate = iReadyState; 29.501 if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 29.502 oDoc.onreadystatechange(); 29.503 }; 29.504 - /** 29.505 - * <p>Factory method to obtain a new DOM Document object</p> 29.506 - * @argument sUri the namespace of the root node (if any) 29.507 - * @argument sUri the local name of the root node (if any) 29.508 - * @returns a new DOM Document 29.509 - */ 29.510 Sarissa.getDomDocument = function(sUri, sName){ 29.511 - var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); 29.512 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 29.513 + if(!oDoc.onreadystatechange){ 29.514 + 29.515 + /** 29.516 + * <p>Emulate IE's onreadystatechange attribute</p> 29.517 + */ 29.518 + oDoc.onreadystatechange = null; 29.519 + }; 29.520 + if(!oDoc.readyState){ 29.521 + /** 29.522 + * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 29.523 + * <ul><li>1 == LOADING,</li> 29.524 + * <li>2 == LOADED,</li> 29.525 + * <li>3 == INTERACTIVE,</li> 29.526 + * <li>4 == COMPLETED</li></ul> 29.527 + */ 29.528 + oDoc.readyState = 0; 29.529 + }; 29.530 oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); 29.531 return oDoc; 29.532 - }; 29.533 + }; 29.534 + if(window.XMLDocument){ 29.535 + // do nothing 29.536 + }// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS 29.537 + else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ 29.538 + //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good 29.539 + /** 29.540 + * <p>Factory method to obtain a new DOM Document object</p> 29.541 + * @argument sUri the namespace of the root node (if any) 29.542 + * @argument sUri the local name of the root node (if any) 29.543 + * @returns a new DOM Document 29.544 + */ 29.545 + Sarissa.getDomDocument = function(sUri, sName){ 29.546 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 29.547 + return oDoc; 29.548 + }; 29.549 + } 29.550 + else { 29.551 + Sarissa.getDomDocument = function(sUri, sName){ 29.552 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 29.553 + // looks like safari does not create the root element for some unknown reason 29.554 + if(oDoc && (sUri || sName) && !oDoc.documentElement){ 29.555 + oDoc.appendChild(oDoc.createElementNS(sUri, sName)); 29.556 + }; 29.557 + return oDoc; 29.558 + }; 29.559 + }; 29.560 };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT) 29.561 }; 29.562 //========================================== 29.563 // Common stuff 29.564 //========================================== 29.565 if(!window.DOMParser){ 29.566 - /** 29.567 - * DOMParser is a utility class, used to construct DOMDocuments from XML strings 29.568 - * @constructor 29.569 - */ 29.570 - DOMParser = function() { 29.571 + if(_SARISSA_IS_SAFARI){ 29.572 + /* 29.573 + * DOMParser is a utility class, used to construct DOMDocuments from XML strings 29.574 + * @constructor 29.575 + */ 29.576 + DOMParser = function() { }; 29.577 + /** 29.578 + * Construct a new DOM Document from the given XMLstring 29.579 + * @param sXml the given XML string 29.580 + * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 29.581 + * @return a new DOM Document from the given XML string 29.582 + */ 29.583 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 29.584 + var xmlhttp = new XMLHttpRequest(); 29.585 + xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(sXml), false); 29.586 + xmlhttp.send(null); 29.587 + return xmlhttp.responseXML; 29.588 + }; 29.589 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 29.590 + DOMParser = function() { }; 29.591 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 29.592 + var doc = Sarissa.getDomDocument(); 29.593 + doc.loadXML(sXml); 29.594 + return doc; 29.595 + }; 29.596 }; 29.597 - /** 29.598 - * Construct a new DOM Document from the given XMLstring 29.599 - * @param sXml the given XML string 29.600 - * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 29.601 - * @return a new DOM Document from the given XML string 29.602 - */ 29.603 - DOMParser.prototype.parseFromString = function(sXml, contentType){ 29.604 - var doc = Sarissa.getDomDocument(); 29.605 - doc.loadXML(sXml); 29.606 - return doc; 29.607 - }; 29.608 - 29.609 }; 29.610 29.611 -if(window.XMLHttpRequest){ 29.612 - Sarissa.IS_ENABLED_XMLHTTP = true; 29.613 -} 29.614 -else if(_SARISSA_IS_IE){ 29.615 - /** 29.616 - * Emulate XMLHttpRequest 29.617 - * @constructor 29.618 - */ 29.619 - XMLHttpRequest = function() { 29.620 - return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 29.621 - }; 29.622 - Sarissa.IS_ENABLED_XMLHTTP = true; 29.623 -}; 29.624 - 29.625 -if(!window.document.importNode && _SARISSA_IS_IE){ 29.626 +if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){ 29.627 try{ 29.628 /** 29.629 - * Implements importNode for the current window document in IE using innerHTML. 29.630 - * Testing showed that DOM was multiple times slower than innerHTML for this, 29.631 - * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML) 29.632 - * please gimme a call. 29.633 + * Implementation of importNode for the context window document in IE. 29.634 + * If <code>oNode</code> is a TextNode, <code>bChildren</code> is ignored. 29.635 * @param oNode the Node to import 29.636 * @param bChildren whether to include the children of oNode 29.637 * @returns the imported node for further use 29.638 */ 29.639 - window.document.importNode = function(oNode, bChildren){ 29.640 - var importNode = document.createElement("div"); 29.641 - if(bChildren) 29.642 - importNode.innerHTML = Sarissa.serialize(oNode); 29.643 - else 29.644 - importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false)); 29.645 - return importNode.firstChild; 29.646 + document.importNode = function(oNode, bChildren){ 29.647 + var tmp; 29.648 + if (oNode.nodeName=='#text') { 29.649 + return document.createTextElement(oNode.data); 29.650 + } 29.651 + else { 29.652 + if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){ 29.653 + tmp = document.createElement("table"); 29.654 + } 29.655 + else if(oNode.nodeName == "td"){ 29.656 + tmp = document.createElement("tr"); 29.657 + } 29.658 + else if(oNode.nodeName == "option"){ 29.659 + tmp = document.createElement("select"); 29.660 + } 29.661 + else{ 29.662 + tmp = document.createElement("div"); 29.663 + }; 29.664 + if(bChildren){ 29.665 + tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML; 29.666 + }else{ 29.667 + tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML; 29.668 + }; 29.669 + return tmp.getElementsByTagName("*")[0]; 29.670 + }; 29.671 + 29.672 }; 29.673 - }catch(e){}; 29.674 + }catch(e){ }; 29.675 }; 29.676 if(!Sarissa.getParseErrorText){ 29.677 /** 29.678 @@ -423,17 +481,16 @@ 29.679 */ 29.680 Sarissa.getParseErrorText = function (oDoc){ 29.681 var parseErrorText = Sarissa.PARSED_OK; 29.682 - if(oDoc.parseError != 0){ 29.683 - /*moz*/ 29.684 - if(oDoc.documentElement.tagName == "parsererror"){ 29.685 - parseErrorText = oDoc.documentElement.firstChild.data; 29.686 - parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 29.687 - }/*konq*/ 29.688 - else if(oDoc.documentElement.tagName == "html"){ 29.689 - parseErrorText = Sarissa.getText(oDoc.documentElement.getElementsByTagName("h1")[0], false) + "\n"; 29.690 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n"; 29.691 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false); 29.692 - }; 29.693 + if(!oDoc.documentElement){ 29.694 + parseErrorText = Sarissa.PARSED_EMPTY; 29.695 + } else if(oDoc.documentElement.tagName == "parsererror"){ 29.696 + parseErrorText = oDoc.documentElement.firstChild.data; 29.697 + parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 29.698 + } else if(oDoc.getElementsByTagName("parsererror").length > 0){ 29.699 + var parsererror = oDoc.getElementsByTagName("parsererror")[0]; 29.700 + parseErrorText = Sarissa.getText(parsererror, true)+"\n"; 29.701 + } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){ 29.702 + parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR; 29.703 }; 29.704 return parseErrorText; 29.705 }; 29.706 @@ -446,8 +503,7 @@ 29.707 var nodeType = node.nodeType; 29.708 if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){ 29.709 s += node.data; 29.710 - } 29.711 - else if(deep == true 29.712 + } else if(deep == true 29.713 && (nodeType == Node.ELEMENT_NODE 29.714 || nodeType == Node.DOCUMENT_NODE 29.715 || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ 29.716 @@ -456,33 +512,20 @@ 29.717 }; 29.718 return s; 29.719 }; 29.720 -if(window.XMLSerializer){ 29.721 +if(!window.XMLSerializer 29.722 + && Sarissa.getDomDocument 29.723 + && Sarissa.getDomDocument("","foo", null).xml){ 29.724 /** 29.725 - * <p>Factory method to obtain the serialization of a DOM Node</p> 29.726 - * @returns the serialized Node as an XML string 29.727 + * Utility class to serialize DOM Node objects to XML strings 29.728 + * @constructor 29.729 */ 29.730 - Sarissa.serialize = function(oDoc){ 29.731 - return (new XMLSerializer()).serializeToString(oDoc); 29.732 - }; 29.733 -}else{ 29.734 - if((Sarissa.getDomDocument("","foo", null)).xml){ 29.735 - // see non-IE version 29.736 - Sarissa.serialize = function(oDoc) { 29.737 - // TODO: check for HTML document and return innerHTML instead 29.738 - return oDoc.xml; 29.739 - }; 29.740 - /** 29.741 - * Utility class to serialize DOM Node objects to XML strings 29.742 - * @constructor 29.743 - */ 29.744 - XMLSerializer = function(){}; 29.745 - /** 29.746 - * Serialize the given DOM Node to an XML string 29.747 - * @param oNode the DOM Node to serialize 29.748 - */ 29.749 - XMLSerializer.prototype.serializeToString = function(oNode) { 29.750 - return oNode.xml; 29.751 - }; 29.752 + XMLSerializer = function(){}; 29.753 + /** 29.754 + * Serialize the given DOM Node to an XML string 29.755 + * @param oNode the DOM Node to serialize 29.756 + */ 29.757 + XMLSerializer.prototype.serializeToString = function(oNode) { 29.758 + return oNode.xml; 29.759 }; 29.760 }; 29.761 29.762 @@ -497,7 +540,8 @@ 29.763 * @argument oNode the Node to empty 29.764 */ 29.765 Sarissa.clearChildNodes = function(oNode) { 29.766 - while(oNode.hasChildNodes()){ 29.767 + // need to check for firstChild due to opera 8 bug with hasChildNodes 29.768 + while(oNode.firstChild) { 29.769 oNode.removeChild(oNode.firstChild); 29.770 }; 29.771 }; 29.772 @@ -510,17 +554,19 @@ 29.773 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 29.774 */ 29.775 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 29.776 + if((!nodeFrom) || (!nodeTo)){ 29.777 + throw "Both source and destination nodes must be provided"; 29.778 + }; 29.779 if(!bPreserveExisting){ 29.780 Sarissa.clearChildNodes(nodeTo); 29.781 }; 29.782 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 29.783 var nodes = nodeFrom.childNodes; 29.784 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 29.785 + if(typeof(ownerDoc.importNode) != "undefined") { 29.786 for(var i=0;i < nodes.length;i++) { 29.787 nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 29.788 }; 29.789 - } 29.790 - else{ 29.791 + } else { 29.792 for(var i=0;i < nodes.length;i++) { 29.793 nodeTo.appendChild(nodes[i].cloneNode(true)); 29.794 }; 29.795 @@ -533,32 +579,34 @@ 29.796 * the move operation, unless you supply a true third parameter</p> 29.797 * @argument nodeFrom the Node to copy the childNodes from 29.798 * @argument nodeTo the Node to copy the childNodes to 29.799 - * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 29.800 - */ 29.801 + * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is 29.802 + */ 29.803 Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 29.804 + if((!nodeFrom) || (!nodeTo)){ 29.805 + throw "Both source and destination nodes must be provided"; 29.806 + }; 29.807 if(!bPreserveExisting){ 29.808 Sarissa.clearChildNodes(nodeTo); 29.809 }; 29.810 - 29.811 var nodes = nodeFrom.childNodes; 29.812 // if within the same doc, just move, else copy and delete 29.813 if(nodeFrom.ownerDocument == nodeTo.ownerDocument){ 29.814 - nodeTo.appendChild(nodes[i]); 29.815 - }else{ 29.816 + while(nodeFrom.firstChild){ 29.817 + nodeTo.appendChild(nodeFrom.firstChild); 29.818 + }; 29.819 + } else { 29.820 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 29.821 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 29.822 - for(var i=0;i < nodes.length;i++) { 29.823 - nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 29.824 - }; 29.825 - } 29.826 - else{ 29.827 - for(var i=0;i < nodes.length;i++) { 29.828 - nodeTo.appendChild(nodes[i].cloneNode(true)); 29.829 - }; 29.830 + if(typeof(ownerDoc.importNode) != "undefined") { 29.831 + for(var i=0;i < nodes.length;i++) { 29.832 + nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 29.833 + }; 29.834 + }else{ 29.835 + for(var i=0;i < nodes.length;i++) { 29.836 + nodeTo.appendChild(nodes[i].cloneNode(true)); 29.837 + }; 29.838 }; 29.839 Sarissa.clearChildNodes(nodeFrom); 29.840 }; 29.841 - 29.842 }; 29.843 29.844 /**
30.1 --- a/examples/Common/QtConfigurator/Resources/scripts/sarissa.js Sun Jun 10 22:52:12 2007 +0000 30.2 +++ b/examples/Common/QtConfigurator/Resources/scripts/sarissa.js Sat Jul 07 16:17:29 2007 +0000 30.3 @@ -2,72 +2,54 @@ 30.4 * ==================================================================== 30.5 * About 30.6 * ==================================================================== 30.7 - * Sarissa cross browser XML library 30.8 - * @version 0.9.6 30.9 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 30.10 - * 30.11 * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. 30.12 * The library supports Gecko based browsers like Mozilla and Firefox, 30.13 - * Internet Explorer (5.5+ with MSXML3.0+) and, last but not least, KHTML based browsers like 30.14 - * Konqueror and Safari. 30.15 - * 30.16 + * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 30.17 + * @version ${project.version} 30.18 + * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 30.19 * ==================================================================== 30.20 * Licence 30.21 * ==================================================================== 30.22 - * This program is free software; you can redistribute it and/or modify 30.23 - * it under the terms of the GNU General Public License version 2 or 30.24 - * the GNU Lesser General Public License version 2.1 as published by 30.25 - * the Free Software Foundation (your choice of the two). 30.26 - * 30.27 - * This program is distributed in the hope that it will be useful, 30.28 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 30.29 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 30.30 - * GNU General Public License or GNU Lesser General Public License for more details. 30.31 - * 30.32 - * You should have received a copy of the GNU General Public License 30.33 - * or GNU Lesser General Public License along with this program; if not, 30.34 - * write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 30.35 - * or visit http://www.gnu.org 30.36 - * 30.37 + * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher, 30.38 + * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher 30.39 + * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If 30.40 + * you make modifications under the ASL, i would appreciate it if you submitted those. 30.41 + * In case your copy of Sarissa does not include the license texts, you may find 30.42 + * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 30.43 + * <a href="http://www.apache.org">http://www.apache.org</a>. 30.44 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 30.45 + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 30.46 + * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 30.47 + * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 30.48 + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 30.49 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 30.50 + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 30.51 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 30.52 */ 30.53 /** 30.54 - * <p>Sarissa is a utility class. Provides static methods for DOMDocument and 30.55 - * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.</p> 30.56 + * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument, 30.57 + * DOM Node serialization to XML strings and other utility goodies.</p> 30.58 * @constructor 30.59 */ 30.60 function Sarissa(){}; 30.61 -/** @private */ 30.62 +Sarissa.VERSION = "${project.version}"; 30.63 Sarissa.PARSED_OK = "Document contains no parsing errors"; 30.64 -/** 30.65 - * Tells you whether transformNode and transformNodeToObject are available. This functionality 30.66 - * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations 30.67 - * use the XSLTProcessor 30.68 - * @deprecated 30.69 - * @type boolean 30.70 - */ 30.71 +Sarissa.PARSED_EMPTY = "Document is empty"; 30.72 +Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error"; 30.73 Sarissa.IS_ENABLED_TRANSFORM_NODE = false; 30.74 -/** 30.75 - * tells you whether XMLHttpRequest (or equivalent) is available 30.76 - * @type boolean 30.77 - */ 30.78 -Sarissa.IS_ENABLED_XMLHTTP = false; 30.79 -/** 30.80 - * tells you whether selectNodes/selectSingleNode is available 30.81 - * @type boolean 30.82 - */ 30.83 -Sarissa.IS_ENABLED_SELECT_NODES = false; 30.84 var _sarissa_iNsCounter = 0; 30.85 var _SARISSA_IEPREFIX4XSLPARAM = ""; 30.86 var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true; 30.87 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 30.88 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 30.89 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 30.90 -var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1; 30.91 +var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 30.92 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 30.93 +if(!window.Node || !Node.ELEMENT_NODE){ 30.94 + Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 30.95 +}; 30.96 30.97 -if(!window.Node || !window.Node.ELEMENT_NODE){ 30.98 - var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 30.99 -}; 30.100 +if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 30.101 30.102 // IE initialization 30.103 if(_SARISSA_IS_IE){ 30.104 @@ -76,13 +58,15 @@ 30.105 // used to store the most recent ProgID available out of the above 30.106 var _SARISSA_DOM_PROGID = ""; 30.107 var _SARISSA_XMLHTTP_PROGID = ""; 30.108 + var _SARISSA_DOM_XMLWRITER = ""; 30.109 /** 30.110 * Called when the Sarissa_xx.js file is parsed, to pick most recent 30.111 * ProgIDs for IE, then gets destroyed. 30.112 + * @private 30.113 * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object 30.114 * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled 30.115 */ 30.116 - pickRecentProgID = function (idList, enabledList){ 30.117 + Sarissa.pickRecentProgID = function (idList){ 30.118 // found progID flag 30.119 var bFound = false; 30.120 for(var i=0; i < idList.length && !bFound; i++){ 30.121 @@ -90,50 +74,69 @@ 30.122 var oDoc = new ActiveXObject(idList[i]); 30.123 o2Store = idList[i]; 30.124 bFound = true; 30.125 - for(var j=0;j<enabledList.length;j++) 30.126 - if(i <= enabledList[j][1]) 30.127 - Sarissa["IS_ENABLED_"+enabledList[j][0]] = true; 30.128 }catch (objException){ 30.129 // trap; try next progID 30.130 }; 30.131 }; 30.132 - if (!bFound) 30.133 + if (!bFound) { 30.134 throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 30.135 + }; 30.136 idList = null; 30.137 return o2Store; 30.138 }; 30.139 // pick best available MSXML progIDs 30.140 - _SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]); 30.141 - _SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]); 30.142 - _SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 30.143 - _SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]); 30.144 + _SARISSA_DOM_PROGID = null; 30.145 + _SARISSA_THREADEDDOM_PROGID = null; 30.146 + _SARISSA_XSLTEMPLATE_PROGID = null; 30.147 + _SARISSA_XMLHTTP_PROGID = null; 30.148 + if(!window.XMLHttpRequest){ 30.149 + /** 30.150 + * Emulate XMLHttpRequest 30.151 + * @constructor 30.152 + */ 30.153 + XMLHttpRequest = function() { 30.154 + if(!_SARISSA_XMLHTTP_PROGID){ 30.155 + _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); 30.156 + }; 30.157 + return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 30.158 + }; 30.159 + }; 30.160 // we dont need this anymore 30.161 - pickRecentProgID = null; 30.162 //============================================ 30.163 // Factory methods (IE) 30.164 //============================================ 30.165 // see non-IE version 30.166 Sarissa.getDomDocument = function(sUri, sName){ 30.167 + if(!_SARISSA_DOM_PROGID){ 30.168 + _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); 30.169 + }; 30.170 var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 30.171 - // if a root tag name was provided, we need to load it in the DOM 30.172 - // object 30.173 + // if a root tag name was provided, we need to load it in the DOM object 30.174 if (sName){ 30.175 - // if needed, create an artifical namespace prefix the way Moz 30.176 - // does 30.177 - if (sUri){ 30.178 - oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + "=\"" + sUri + "\" />"); 30.179 - // don't use the same prefix again 30.180 - ++_sarissa_iNsCounter; 30.181 - } 30.182 - else 30.183 - oDoc.loadXML("<" + sName + "/>"); 30.184 + // create an artifical namespace prefix 30.185 + // or reuse existing prefix if applicable 30.186 + var prefix = ""; 30.187 + if(sUri){ 30.188 + if(sName.indexOf(":") > 1){ 30.189 + prefix = sName.substring(0, sName.indexOf(":")); 30.190 + sName = sName.substring(sName.indexOf(":")+1); 30.191 + }else{ 30.192 + prefix = "a" + (_sarissa_iNsCounter++); 30.193 + }; 30.194 + }; 30.195 + // use namespaces if a namespace URI exists 30.196 + if(sUri){ 30.197 + oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />"); 30.198 + } else { 30.199 + oDoc.loadXML('<' + sName + " />"); 30.200 + }; 30.201 }; 30.202 return oDoc; 30.203 }; 30.204 // see non-IE version 30.205 Sarissa.getParseErrorText = function (oDoc) { 30.206 var parseErrorText = Sarissa.PARSED_OK; 30.207 - if(oDoc.parseError != 0){ 30.208 + if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){ 30.209 parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + 30.210 "\nLocation: " + oDoc.parseError.url + 30.211 "\nLine Number " + oDoc.parseError.line + ", Column " + 30.212 @@ -144,6 +147,9 @@ 30.213 parseErrorText += "-"; 30.214 }; 30.215 parseErrorText += "^\n"; 30.216 + } 30.217 + else if(oDoc.documentElement == null){ 30.218 + parseErrorText = Sarissa.PARSED_EMPTY; 30.219 }; 30.220 return parseErrorText; 30.221 }; 30.222 @@ -158,43 +164,109 @@ 30.223 * @constructor 30.224 */ 30.225 XSLTProcessor = function(){ 30.226 + if(!_SARISSA_XSLTEMPLATE_PROGID){ 30.227 + _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]); 30.228 + }; 30.229 this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID); 30.230 this.processor = null; 30.231 }; 30.232 /** 30.233 - * Impoprts the given XSLT DOM and compiles it to a reusable transform 30.234 + * Imports the given XSLT DOM and compiles it to a reusable transform 30.235 + * <b>Note:</b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those 30.236 * @argument xslDoc The XSLT DOMDocument to import 30.237 */ 30.238 XSLTProcessor.prototype.importStylesheet = function(xslDoc){ 30.239 + if(!_SARISSA_THREADEDDOM_PROGID){ 30.240 + _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 30.241 + }; 30.242 + xslDoc.setProperty("SelectionLanguage", "XPath"); 30.243 + xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 30.244 // convert stylesheet to free threaded 30.245 - var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 30.246 - converted.loadXML(xslDoc.xml); 30.247 + var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 30.248 + // make included/imported stylesheets work if exist and xsl was originally loaded from url 30.249 + if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 30.250 + converted.async = false; 30.251 + if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 30.252 + converted.setProperty("AllowDocumentFunction", true); 30.253 + converted.resolveExternals = true; 30.254 + } 30.255 + converted.load(xslDoc.url); 30.256 + } else { 30.257 + converted.loadXML(xslDoc.xml); 30.258 + }; 30.259 + converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 30.260 + var output = converted.selectSingleNode("//xsl:output"); 30.261 + this.outputMethod = output ? output.getAttribute("method") : "html"; 30.262 this.template.stylesheet = converted; 30.263 this.processor = this.template.createProcessor(); 30.264 - // (re)set default param values 30.265 + // for getParameter and clearParameters 30.266 this.paramsSet = new Array(); 30.267 }; 30.268 + 30.269 /** 30.270 - * Transform the given XML DOM 30.271 + * Transform the given XML DOM and return the transformation result as a new DOM document 30.272 * @argument sourceDoc The XML DOMDocument to transform 30.273 * @return The transformation result as a DOM Document 30.274 */ 30.275 XSLTProcessor.prototype.transformToDocument = function(sourceDoc){ 30.276 - this.processor.input = sourceDoc; 30.277 - var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 30.278 - this.processor.output = outDoc; 30.279 - this.processor.transform(); 30.280 - return outDoc; 30.281 + // fix for bug 1549749 30.282 + if(_SARISSA_THREADEDDOM_PROGID){ 30.283 + this.processor.input=sourceDoc; 30.284 + var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID); 30.285 + this.processor.output=outDoc; 30.286 + this.processor.transform(); 30.287 + return outDoc; 30.288 + } 30.289 + else{ 30.290 + if(!_SARISSA_DOM_XMLWRITER){ 30.291 + _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); 30.292 + }; 30.293 + this.processor.input = sourceDoc; 30.294 + var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER); 30.295 + this.processor.output = outDoc; 30.296 + this.processor.transform(); 30.297 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 30.298 + oDoc.loadXML(outDoc.output+""); 30.299 + return oDoc; 30.300 + }; 30.301 }; 30.302 + 30.303 /** 30.304 - * Not sure if this works in IE. Maybe this will allow non-well-formed 30.305 - * transformation results (i.e. with no single root element) 30.306 + * Transform the given XML DOM and return the transformation result as a new DOM fragment. 30.307 + * <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML). 30.308 * @argument sourceDoc The XML DOMDocument to transform 30.309 - * @return The transformation result as a DOM Fragment 30.310 + * @argument ownerDoc The owner of the result fragment 30.311 + * @return The transformation result as a DOM Document 30.312 */ 30.313 - XSLTProcessor.prototype.transformToFragment = function(sourceDoc, ownerDocument){ 30.314 - return this.transformToDocument(sourceDoc); 30.315 + XSLTProcessor.prototype.transformToFragment = function (sourceDoc, ownerDoc) { 30.316 + this.processor.input = sourceDoc; 30.317 + this.processor.transform(); 30.318 + var s = this.processor.output; 30.319 + var f = ownerDoc.createDocumentFragment(); 30.320 + if (this.outputMethod == 'text') { 30.321 + f.appendChild(ownerDoc.createTextNode(s)); 30.322 + } else if (ownerDoc.body && ownerDoc.body.innerHTML) { 30.323 + var container = ownerDoc.createElement('div'); 30.324 + container.innerHTML = s; 30.325 + while (container.hasChildNodes()) { 30.326 + f.appendChild(container.firstChild); 30.327 + } 30.328 + } 30.329 + else { 30.330 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 30.331 + if (s.substring(0, 5) == '<?xml') { 30.332 + s = s.substring(s.indexOf('?>') + 2); 30.333 + } 30.334 + var xml = ''.concat('<my>', s, '</my>'); 30.335 + oDoc.loadXML(xml); 30.336 + var container = oDoc.documentElement; 30.337 + while (container.hasChildNodes()) { 30.338 + f.appendChild(container.firstChild); 30.339 + } 30.340 + } 30.341 + return f; 30.342 }; 30.343 + 30.344 /** 30.345 * Set global XSLT parameter of the imported stylesheet 30.346 * @argument nsURI The parameter namespace URI 30.347 @@ -202,13 +274,15 @@ 30.348 * @argument value The new parameter value 30.349 */ 30.350 XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 30.351 - /* nsURI is optional but cannot be null */ 30.352 + // make value a zero length string if null to allow clearing 30.353 + value = value ? value : ""; 30.354 + // nsURI is optional but cannot be null 30.355 if(nsURI){ 30.356 this.processor.addParameter(name, value, nsURI); 30.357 }else{ 30.358 this.processor.addParameter(name, value); 30.359 }; 30.360 - /* update updated params for getParameter */ 30.361 + // update updated params for getParameter 30.362 if(!this.paramsSet[""+nsURI]){ 30.363 this.paramsSet[""+nsURI] = new Array(); 30.364 }; 30.365 @@ -222,102 +296,38 @@ 30.366 * @return The parameter value if reviously set by setParameter, null otherwise 30.367 */ 30.368 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 30.369 - if(this.paramsSet[""+nsURI] && this.paramsSet[""+nsURI][name]) 30.370 - return this.paramsSet[""+nsURI][name]; 30.371 - else 30.372 + nsURI = "" + nsURI; 30.373 + if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 30.374 + return this.paramsSet[nsURI][name]; 30.375 + }else{ 30.376 return null; 30.377 + }; 30.378 }; 30.379 -} 30.380 -else{ /* end IE initialization, try to deal with real browsers now ;-) */ 30.381 - if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 30.382 - if(window.XMLDocument){ 30.383 - /** 30.384 - * <p>Emulate IE's onreadystatechange attribute</p> 30.385 - */ 30.386 - XMLDocument.prototype.onreadystatechange = null; 30.387 - /** 30.388 - * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 30.389 - * <ul><li>1 == LOADING,</li> 30.390 - * <li>2 == LOADED,</li> 30.391 - * <li>3 == INTERACTIVE,</li> 30.392 - * <li>4 == COMPLETED</li></ul> 30.393 - */ 30.394 - XMLDocument.prototype.readyState = 0; 30.395 - /** 30.396 - * <p>Emulate IE's parseError attribute</p> 30.397 - */ 30.398 - XMLDocument.prototype.parseError = 0; 30.399 - 30.400 - // NOTE: setting async to false will only work with documents 30.401 - // called over HTTP (meaning a server), not the local file system, 30.402 - // unless you are using Moz 1.4+. 30.403 - // BTW the try>catch block is for 1.4; I haven't found a way to check if 30.404 - // the property is implemented without 30.405 - // causing an error and I dont want to use user agent stuff for that... 30.406 - var _SARISSA_SYNC_NON_IMPLEMENTED = false; 30.407 - try{ 30.408 - /** 30.409 - * <p>Emulates IE's async property for Moz versions prior to 1.4. 30.410 - * It controls whether loading of remote XML files works 30.411 - * synchronously or asynchronously.</p> 30.412 - */ 30.413 - XMLDocument.prototype.async = true; 30.414 - _SARISSA_SYNC_NON_IMPLEMENTED = true; 30.415 - }catch(e){/* trap */}; 30.416 - /** 30.417 - * <p>Keeps a handle to the original load() method. Internal use and only 30.418 - * if Mozilla version is lower than 1.4</p> 30.419 - * @private 30.420 - */ 30.421 - XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; 30.422 - 30.423 - /** 30.424 - * <p>Overrides the original load method to provide synchronous loading for 30.425 - * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if 30.426 - * async is set to false)</p> 30.427 - * @returns the DOM Object as it was before the load() call (may be empty) 30.428 - */ 30.429 - XMLDocument.prototype.load = function(sURI) { 30.430 - var oDoc = document.implementation.createDocument("", "", null); 30.431 - Sarissa.copyChildNodes(this, oDoc); 30.432 - this.parseError = 0; 30.433 - Sarissa.__setReadyState__(this, 1); 30.434 - try { 30.435 - if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { 30.436 - var tmp = new XMLHttpRequest(); 30.437 - tmp.open("GET", sURI, false); 30.438 - tmp.send(null); 30.439 - Sarissa.__setReadyState__(this, 2); 30.440 - Sarissa.copyChildNodes(tmp.responseXML, this); 30.441 - Sarissa.__setReadyState__(this, 3); 30.442 - } 30.443 - else { 30.444 - this._sarissa_load(sURI); 30.445 - }; 30.446 - } 30.447 - catch (objException) { 30.448 - this.parseError = -1; 30.449 - } 30.450 - finally { 30.451 - if(this.async == false){ 30.452 - Sarissa.__handleLoad__(this); 30.453 - }; 30.454 + /** 30.455 + * Clear parameters (set them to default values as defined in the stylesheet itself) 30.456 + */ 30.457 + XSLTProcessor.prototype.clearParameters = function(){ 30.458 + for(var nsURI in this.paramsSet){ 30.459 + for(var name in this.paramsSet[nsURI]){ 30.460 + if(nsURI){ 30.461 + this.processor.addParameter(name, "", nsURI); 30.462 + }else{ 30.463 + this.processor.addParameter(name, ""); 30.464 }; 30.465 - return oDoc; 30.466 }; 30.467 - };//if(window.XMLDocument) 30.468 - 30.469 + }; 30.470 + this.paramsSet = new Array(); 30.471 + }; 30.472 +}else{ /* end IE initialization, try to deal with real browsers now ;-) */ 30.473 + if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 30.474 /** 30.475 * <p>Ensures the document was loaded correctly, otherwise sets the 30.476 * parseError to -1 to indicate something went wrong. Internal use</p> 30.477 * @private 30.478 */ 30.479 Sarissa.__handleLoad__ = function(oDoc){ 30.480 - if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") 30.481 - oDoc.parseError = -1; 30.482 Sarissa.__setReadyState__(oDoc, 4); 30.483 }; 30.484 - 30.485 /** 30.486 * <p>Attached by an event handler to the load event. Internal use.</p> 30.487 * @private 30.488 @@ -325,7 +335,6 @@ 30.489 _sarissa_XMLDocument_onload = function(){ 30.490 Sarissa.__handleLoad__(this); 30.491 }; 30.492 - 30.493 /** 30.494 * <p>Sets the readyState property of the given DOM Document object. 30.495 * Internal use.</p> 30.496 @@ -336,80 +345,129 @@ 30.497 */ 30.498 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 30.499 oDoc.readyState = iReadyState; 30.500 + oDoc.readystate = iReadyState; 30.501 if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 30.502 oDoc.onreadystatechange(); 30.503 }; 30.504 - /** 30.505 - * <p>Factory method to obtain a new DOM Document object</p> 30.506 - * @argument sUri the namespace of the root node (if any) 30.507 - * @argument sUri the local name of the root node (if any) 30.508 - * @returns a new DOM Document 30.509 - */ 30.510 Sarissa.getDomDocument = function(sUri, sName){ 30.511 - var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); 30.512 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 30.513 + if(!oDoc.onreadystatechange){ 30.514 + 30.515 + /** 30.516 + * <p>Emulate IE's onreadystatechange attribute</p> 30.517 + */ 30.518 + oDoc.onreadystatechange = null; 30.519 + }; 30.520 + if(!oDoc.readyState){ 30.521 + /** 30.522 + * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 30.523 + * <ul><li>1 == LOADING,</li> 30.524 + * <li>2 == LOADED,</li> 30.525 + * <li>3 == INTERACTIVE,</li> 30.526 + * <li>4 == COMPLETED</li></ul> 30.527 + */ 30.528 + oDoc.readyState = 0; 30.529 + }; 30.530 oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); 30.531 return oDoc; 30.532 - }; 30.533 + }; 30.534 + if(window.XMLDocument){ 30.535 + // do nothing 30.536 + }// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS 30.537 + else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ 30.538 + //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good 30.539 + /** 30.540 + * <p>Factory method to obtain a new DOM Document object</p> 30.541 + * @argument sUri the namespace of the root node (if any) 30.542 + * @argument sUri the local name of the root node (if any) 30.543 + * @returns a new DOM Document 30.544 + */ 30.545 + Sarissa.getDomDocument = function(sUri, sName){ 30.546 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 30.547 + return oDoc; 30.548 + }; 30.549 + } 30.550 + else { 30.551 + Sarissa.getDomDocument = function(sUri, sName){ 30.552 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 30.553 + // looks like safari does not create the root element for some unknown reason 30.554 + if(oDoc && (sUri || sName) && !oDoc.documentElement){ 30.555 + oDoc.appendChild(oDoc.createElementNS(sUri, sName)); 30.556 + }; 30.557 + return oDoc; 30.558 + }; 30.559 + }; 30.560 };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT) 30.561 }; 30.562 //========================================== 30.563 // Common stuff 30.564 //========================================== 30.565 if(!window.DOMParser){ 30.566 - /** 30.567 - * DOMParser is a utility class, used to construct DOMDocuments from XML strings 30.568 - * @constructor 30.569 - */ 30.570 - DOMParser = function() { 30.571 + if(_SARISSA_IS_SAFARI){ 30.572 + /* 30.573 + * DOMParser is a utility class, used to construct DOMDocuments from XML strings 30.574 + * @constructor 30.575 + */ 30.576 + DOMParser = function() { }; 30.577 + /** 30.578 + * Construct a new DOM Document from the given XMLstring 30.579 + * @param sXml the given XML string 30.580 + * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 30.581 + * @return a new DOM Document from the given XML string 30.582 + */ 30.583 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 30.584 + var xmlhttp = new XMLHttpRequest(); 30.585 + xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(sXml), false); 30.586 + xmlhttp.send(null); 30.587 + return xmlhttp.responseXML; 30.588 + }; 30.589 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 30.590 + DOMParser = function() { }; 30.591 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 30.592 + var doc = Sarissa.getDomDocument(); 30.593 + doc.loadXML(sXml); 30.594 + return doc; 30.595 + }; 30.596 }; 30.597 - /** 30.598 - * Construct a new DOM Document from the given XMLstring 30.599 - * @param sXml the given XML string 30.600 - * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 30.601 - * @return a new DOM Document from the given XML string 30.602 - */ 30.603 - DOMParser.prototype.parseFromString = function(sXml, contentType){ 30.604 - var doc = Sarissa.getDomDocument(); 30.605 - doc.loadXML(sXml); 30.606 - return doc; 30.607 - }; 30.608 - 30.609 }; 30.610 30.611 -if(window.XMLHttpRequest){ 30.612 - Sarissa.IS_ENABLED_XMLHTTP = true; 30.613 -} 30.614 -else if(_SARISSA_IS_IE){ 30.615 - /** 30.616 - * Emulate XMLHttpRequest 30.617 - * @constructor 30.618 - */ 30.619 - XMLHttpRequest = function() { 30.620 - return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 30.621 - }; 30.622 - Sarissa.IS_ENABLED_XMLHTTP = true; 30.623 -}; 30.624 - 30.625 -if(!window.document.importNode && _SARISSA_IS_IE){ 30.626 +if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){ 30.627 try{ 30.628 /** 30.629 - * Implements importNode for the current window document in IE using innerHTML. 30.630 - * Testing showed that DOM was multiple times slower than innerHTML for this, 30.631 - * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML) 30.632 - * please gimme a call. 30.633 + * Implementation of importNode for the context window document in IE. 30.634 + * If <code>oNode</code> is a TextNode, <code>bChildren</code> is ignored. 30.635 * @param oNode the Node to import 30.636 * @param bChildren whether to include the children of oNode 30.637 * @returns the imported node for further use 30.638 */ 30.639 - window.document.importNode = function(oNode, bChildren){ 30.640 - var importNode = document.createElement("div"); 30.641 - if(bChildren) 30.642 - importNode.innerHTML = Sarissa.serialize(oNode); 30.643 - else 30.644 - importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false)); 30.645 - return importNode.firstChild; 30.646 + document.importNode = function(oNode, bChildren){ 30.647 + var tmp; 30.648 + if (oNode.nodeName=='#text') { 30.649 + return document.createTextElement(oNode.data); 30.650 + } 30.651 + else { 30.652 + if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){ 30.653 + tmp = document.createElement("table"); 30.654 + } 30.655 + else if(oNode.nodeName == "td"){ 30.656 + tmp = document.createElement("tr"); 30.657 + } 30.658 + else if(oNode.nodeName == "option"){ 30.659 + tmp = document.createElement("select"); 30.660 + } 30.661 + else{ 30.662 + tmp = document.createElement("div"); 30.663 + }; 30.664 + if(bChildren){ 30.665 + tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML; 30.666 + }else{ 30.667 + tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML; 30.668 + }; 30.669 + return tmp.getElementsByTagName("*")[0]; 30.670 + }; 30.671 + 30.672 }; 30.673 - }catch(e){}; 30.674 + }catch(e){ }; 30.675 }; 30.676 if(!Sarissa.getParseErrorText){ 30.677 /** 30.678 @@ -423,17 +481,16 @@ 30.679 */ 30.680 Sarissa.getParseErrorText = function (oDoc){ 30.681 var parseErrorText = Sarissa.PARSED_OK; 30.682 - if(oDoc.parseError != 0){ 30.683 - /*moz*/ 30.684 - if(oDoc.documentElement.tagName == "parsererror"){ 30.685 - parseErrorText = oDoc.documentElement.firstChild.data; 30.686 - parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 30.687 - }/*konq*/ 30.688 - else if(oDoc.documentElement.tagName == "html"){ 30.689 - parseErrorText = Sarissa.getText(oDoc.documentElement.getElementsByTagName("h1")[0], false) + "\n"; 30.690 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n"; 30.691 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false); 30.692 - }; 30.693 + if(!oDoc.documentElement){ 30.694 + parseErrorText = Sarissa.PARSED_EMPTY; 30.695 + } else if(oDoc.documentElement.tagName == "parsererror"){ 30.696 + parseErrorText = oDoc.documentElement.firstChild.data; 30.697 + parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 30.698 + } else if(oDoc.getElementsByTagName("parsererror").length > 0){ 30.699 + var parsererror = oDoc.getElementsByTagName("parsererror")[0]; 30.700 + parseErrorText = Sarissa.getText(parsererror, true)+"\n"; 30.701 + } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){ 30.702 + parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR; 30.703 }; 30.704 return parseErrorText; 30.705 }; 30.706 @@ -446,8 +503,7 @@ 30.707 var nodeType = node.nodeType; 30.708 if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){ 30.709 s += node.data; 30.710 - } 30.711 - else if(deep == true 30.712 + } else if(deep == true 30.713 && (nodeType == Node.ELEMENT_NODE 30.714 || nodeType == Node.DOCUMENT_NODE 30.715 || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ 30.716 @@ -456,33 +512,20 @@ 30.717 }; 30.718 return s; 30.719 }; 30.720 -if(window.XMLSerializer){ 30.721 +if(!window.XMLSerializer 30.722 + && Sarissa.getDomDocument 30.723 + && Sarissa.getDomDocument("","foo", null).xml){ 30.724 /** 30.725 - * <p>Factory method to obtain the serialization of a DOM Node</p> 30.726 - * @returns the serialized Node as an XML string 30.727 + * Utility class to serialize DOM Node objects to XML strings 30.728 + * @constructor 30.729 */ 30.730 - Sarissa.serialize = function(oDoc){ 30.731 - return (new XMLSerializer()).serializeToString(oDoc); 30.732 - }; 30.733 -}else{ 30.734 - if((Sarissa.getDomDocument("","foo", null)).xml){ 30.735 - // see non-IE version 30.736 - Sarissa.serialize = function(oDoc) { 30.737 - // TODO: check for HTML document and return innerHTML instead 30.738 - return oDoc.xml; 30.739 - }; 30.740 - /** 30.741 - * Utility class to serialize DOM Node objects to XML strings 30.742 - * @constructor 30.743 - */ 30.744 - XMLSerializer = function(){}; 30.745 - /** 30.746 - * Serialize the given DOM Node to an XML string 30.747 - * @param oNode the DOM Node to serialize 30.748 - */ 30.749 - XMLSerializer.prototype.serializeToString = function(oNode) { 30.750 - return oNode.xml; 30.751 - }; 30.752 + XMLSerializer = function(){}; 30.753 + /** 30.754 + * Serialize the given DOM Node to an XML string 30.755 + * @param oNode the DOM Node to serialize 30.756 + */ 30.757 + XMLSerializer.prototype.serializeToString = function(oNode) { 30.758 + return oNode.xml; 30.759 }; 30.760 }; 30.761 30.762 @@ -497,7 +540,8 @@ 30.763 * @argument oNode the Node to empty 30.764 */ 30.765 Sarissa.clearChildNodes = function(oNode) { 30.766 - while(oNode.hasChildNodes()){ 30.767 + // need to check for firstChild due to opera 8 bug with hasChildNodes 30.768 + while(oNode.firstChild) { 30.769 oNode.removeChild(oNode.firstChild); 30.770 }; 30.771 }; 30.772 @@ -510,17 +554,19 @@ 30.773 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 30.774 */ 30.775 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 30.776 + if((!nodeFrom) || (!nodeTo)){ 30.777 + throw "Both source and destination nodes must be provided"; 30.778 + }; 30.779 if(!bPreserveExisting){ 30.780 Sarissa.clearChildNodes(nodeTo); 30.781 }; 30.782 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 30.783 var nodes = nodeFrom.childNodes; 30.784 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 30.785 + if(typeof(ownerDoc.importNode) != "undefined") { 30.786 for(var i=0;i < nodes.length;i++) { 30.787 nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 30.788 }; 30.789 - } 30.790 - else{ 30.791 + } else { 30.792 for(var i=0;i < nodes.length;i++) { 30.793 nodeTo.appendChild(nodes[i].cloneNode(true)); 30.794 }; 30.795 @@ -533,32 +579,34 @@ 30.796 * the move operation, unless you supply a true third parameter</p> 30.797 * @argument nodeFrom the Node to copy the childNodes from 30.798 * @argument nodeTo the Node to copy the childNodes to 30.799 - * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 30.800 - */ 30.801 + * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is 30.802 + */ 30.803 Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 30.804 + if((!nodeFrom) || (!nodeTo)){ 30.805 + throw "Both source and destination nodes must be provided"; 30.806 + }; 30.807 if(!bPreserveExisting){ 30.808 Sarissa.clearChildNodes(nodeTo); 30.809 }; 30.810 - 30.811 var nodes = nodeFrom.childNodes; 30.812 // if within the same doc, just move, else copy and delete 30.813 if(nodeFrom.ownerDocument == nodeTo.ownerDocument){ 30.814 - nodeTo.appendChild(nodes[i]); 30.815 - }else{ 30.816 + while(nodeFrom.firstChild){ 30.817 + nodeTo.appendChild(nodeFrom.firstChild); 30.818 + }; 30.819 + } else { 30.820 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 30.821 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 30.822 - for(var i=0;i < nodes.length;i++) { 30.823 - nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 30.824 - }; 30.825 - } 30.826 - else{ 30.827 - for(var i=0;i < nodes.length;i++) { 30.828 - nodeTo.appendChild(nodes[i].cloneNode(true)); 30.829 - }; 30.830 + if(typeof(ownerDoc.importNode) != "undefined") { 30.831 + for(var i=0;i < nodes.length;i++) { 30.832 + nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 30.833 + }; 30.834 + }else{ 30.835 + for(var i=0;i < nodes.length;i++) { 30.836 + nodeTo.appendChild(nodes[i].cloneNode(true)); 30.837 + }; 30.838 }; 30.839 Sarissa.clearChildNodes(nodeFrom); 30.840 }; 30.841 - 30.842 }; 30.843 30.844 /**
31.1 --- a/examples/Common/VerySimple/Resources/scripts/sarissa.js Sun Jun 10 22:52:12 2007 +0000 31.2 +++ b/examples/Common/VerySimple/Resources/scripts/sarissa.js Sat Jul 07 16:17:29 2007 +0000 31.3 @@ -2,72 +2,54 @@ 31.4 * ==================================================================== 31.5 * About 31.6 * ==================================================================== 31.7 - * Sarissa cross browser XML library 31.8 - * @version 0.9.6 31.9 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 31.10 - * 31.11 * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. 31.12 * The library supports Gecko based browsers like Mozilla and Firefox, 31.13 - * Internet Explorer (5.5+ with MSXML3.0+) and, last but not least, KHTML based browsers like 31.14 - * Konqueror and Safari. 31.15 - * 31.16 + * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 31.17 + * @version ${project.version} 31.18 + * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 31.19 * ==================================================================== 31.20 * Licence 31.21 * ==================================================================== 31.22 - * This program is free software; you can redistribute it and/or modify 31.23 - * it under the terms of the GNU General Public License version 2 or 31.24 - * the GNU Lesser General Public License version 2.1 as published by 31.25 - * the Free Software Foundation (your choice of the two). 31.26 - * 31.27 - * This program is distributed in the hope that it will be useful, 31.28 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 31.29 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 31.30 - * GNU General Public License or GNU Lesser General Public License for more details. 31.31 - * 31.32 - * You should have received a copy of the GNU General Public License 31.33 - * or GNU Lesser General Public License along with this program; if not, 31.34 - * write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 31.35 - * or visit http://www.gnu.org 31.36 - * 31.37 + * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher, 31.38 + * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher 31.39 + * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If 31.40 + * you make modifications under the ASL, i would appreciate it if you submitted those. 31.41 + * In case your copy of Sarissa does not include the license texts, you may find 31.42 + * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 31.43 + * <a href="http://www.apache.org">http://www.apache.org</a>. 31.44 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 31.45 + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 31.46 + * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 31.47 + * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 31.48 + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 31.49 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 31.50 + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 31.51 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 31.52 */ 31.53 /** 31.54 - * <p>Sarissa is a utility class. Provides static methods for DOMDocument and 31.55 - * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.</p> 31.56 + * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument, 31.57 + * DOM Node serialization to XML strings and other utility goodies.</p> 31.58 * @constructor 31.59 */ 31.60 function Sarissa(){}; 31.61 -/** @private */ 31.62 +Sarissa.VERSION = "${project.version}"; 31.63 Sarissa.PARSED_OK = "Document contains no parsing errors"; 31.64 -/** 31.65 - * Tells you whether transformNode and transformNodeToObject are available. This functionality 31.66 - * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations 31.67 - * use the XSLTProcessor 31.68 - * @deprecated 31.69 - * @type boolean 31.70 - */ 31.71 +Sarissa.PARSED_EMPTY = "Document is empty"; 31.72 +Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error"; 31.73 Sarissa.IS_ENABLED_TRANSFORM_NODE = false; 31.74 -/** 31.75 - * tells you whether XMLHttpRequest (or equivalent) is available 31.76 - * @type boolean 31.77 - */ 31.78 -Sarissa.IS_ENABLED_XMLHTTP = false; 31.79 -/** 31.80 - * tells you whether selectNodes/selectSingleNode is available 31.81 - * @type boolean 31.82 - */ 31.83 -Sarissa.IS_ENABLED_SELECT_NODES = false; 31.84 var _sarissa_iNsCounter = 0; 31.85 var _SARISSA_IEPREFIX4XSLPARAM = ""; 31.86 var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true; 31.87 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 31.88 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 31.89 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 31.90 -var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1; 31.91 +var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 31.92 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 31.93 +if(!window.Node || !Node.ELEMENT_NODE){ 31.94 + Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 31.95 +}; 31.96 31.97 -if(!window.Node || !window.Node.ELEMENT_NODE){ 31.98 - var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 31.99 -}; 31.100 +if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 31.101 31.102 // IE initialization 31.103 if(_SARISSA_IS_IE){ 31.104 @@ -76,13 +58,15 @@ 31.105 // used to store the most recent ProgID available out of the above 31.106 var _SARISSA_DOM_PROGID = ""; 31.107 var _SARISSA_XMLHTTP_PROGID = ""; 31.108 + var _SARISSA_DOM_XMLWRITER = ""; 31.109 /** 31.110 * Called when the Sarissa_xx.js file is parsed, to pick most recent 31.111 * ProgIDs for IE, then gets destroyed. 31.112 + * @private 31.113 * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object 31.114 * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled 31.115 */ 31.116 - pickRecentProgID = function (idList, enabledList){ 31.117 + Sarissa.pickRecentProgID = function (idList){ 31.118 // found progID flag 31.119 var bFound = false; 31.120 for(var i=0; i < idList.length && !bFound; i++){ 31.121 @@ -90,50 +74,69 @@ 31.122 var oDoc = new ActiveXObject(idList[i]); 31.123 o2Store = idList[i]; 31.124 bFound = true; 31.125 - for(var j=0;j<enabledList.length;j++) 31.126 - if(i <= enabledList[j][1]) 31.127 - Sarissa["IS_ENABLED_"+enabledList[j][0]] = true; 31.128 }catch (objException){ 31.129 // trap; try next progID 31.130 }; 31.131 }; 31.132 - if (!bFound) 31.133 + if (!bFound) { 31.134 throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 31.135 + }; 31.136 idList = null; 31.137 return o2Store; 31.138 }; 31.139 // pick best available MSXML progIDs 31.140 - _SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]); 31.141 - _SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]); 31.142 - _SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 31.143 - _SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]); 31.144 + _SARISSA_DOM_PROGID = null; 31.145 + _SARISSA_THREADEDDOM_PROGID = null; 31.146 + _SARISSA_XSLTEMPLATE_PROGID = null; 31.147 + _SARISSA_XMLHTTP_PROGID = null; 31.148 + if(!window.XMLHttpRequest){ 31.149 + /** 31.150 + * Emulate XMLHttpRequest 31.151 + * @constructor 31.152 + */ 31.153 + XMLHttpRequest = function() { 31.154 + if(!_SARISSA_XMLHTTP_PROGID){ 31.155 + _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); 31.156 + }; 31.157 + return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 31.158 + }; 31.159 + }; 31.160 // we dont need this anymore 31.161 - pickRecentProgID = null; 31.162 //============================================ 31.163 // Factory methods (IE) 31.164 //============================================ 31.165 // see non-IE version 31.166 Sarissa.getDomDocument = function(sUri, sName){ 31.167 + if(!_SARISSA_DOM_PROGID){ 31.168 + _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); 31.169 + }; 31.170 var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 31.171 - // if a root tag name was provided, we need to load it in the DOM 31.172 - // object 31.173 + // if a root tag name was provided, we need to load it in the DOM object 31.174 if (sName){ 31.175 - // if needed, create an artifical namespace prefix the way Moz 31.176 - // does 31.177 - if (sUri){ 31.178 - oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + "=\"" + sUri + "\" />"); 31.179 - // don't use the same prefix again 31.180 - ++_sarissa_iNsCounter; 31.181 - } 31.182 - else 31.183 - oDoc.loadXML("<" + sName + "/>"); 31.184 + // create an artifical namespace prefix 31.185 + // or reuse existing prefix if applicable 31.186 + var prefix = ""; 31.187 + if(sUri){ 31.188 + if(sName.indexOf(":") > 1){ 31.189 + prefix = sName.substring(0, sName.indexOf(":")); 31.190 + sName = sName.substring(sName.indexOf(":")+1); 31.191 + }else{ 31.192 + prefix = "a" + (_sarissa_iNsCounter++); 31.193 + }; 31.194 + }; 31.195 + // use namespaces if a namespace URI exists 31.196 + if(sUri){ 31.197 + oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />"); 31.198 + } else { 31.199 + oDoc.loadXML('<' + sName + " />"); 31.200 + }; 31.201 }; 31.202 return oDoc; 31.203 }; 31.204 // see non-IE version 31.205 Sarissa.getParseErrorText = function (oDoc) { 31.206 var parseErrorText = Sarissa.PARSED_OK; 31.207 - if(oDoc.parseError != 0){ 31.208 + if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){ 31.209 parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + 31.210 "\nLocation: " + oDoc.parseError.url + 31.211 "\nLine Number " + oDoc.parseError.line + ", Column " + 31.212 @@ -144,6 +147,9 @@ 31.213 parseErrorText += "-"; 31.214 }; 31.215 parseErrorText += "^\n"; 31.216 + } 31.217 + else if(oDoc.documentElement == null){ 31.218 + parseErrorText = Sarissa.PARSED_EMPTY; 31.219 }; 31.220 return parseErrorText; 31.221 }; 31.222 @@ -158,43 +164,109 @@ 31.223 * @constructor 31.224 */ 31.225 XSLTProcessor = function(){ 31.226 + if(!_SARISSA_XSLTEMPLATE_PROGID){ 31.227 + _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]); 31.228 + }; 31.229 this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID); 31.230 this.processor = null; 31.231 }; 31.232 /** 31.233 - * Impoprts the given XSLT DOM and compiles it to a reusable transform 31.234 + * Imports the given XSLT DOM and compiles it to a reusable transform 31.235 + * <b>Note:</b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those 31.236 * @argument xslDoc The XSLT DOMDocument to import 31.237 */ 31.238 XSLTProcessor.prototype.importStylesheet = function(xslDoc){ 31.239 + if(!_SARISSA_THREADEDDOM_PROGID){ 31.240 + _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 31.241 + }; 31.242 + xslDoc.setProperty("SelectionLanguage", "XPath"); 31.243 + xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 31.244 // convert stylesheet to free threaded 31.245 - var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 31.246 - converted.loadXML(xslDoc.xml); 31.247 + var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 31.248 + // make included/imported stylesheets work if exist and xsl was originally loaded from url 31.249 + if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 31.250 + converted.async = false; 31.251 + if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 31.252 + converted.setProperty("AllowDocumentFunction", true); 31.253 + converted.resolveExternals = true; 31.254 + } 31.255 + converted.load(xslDoc.url); 31.256 + } else { 31.257 + converted.loadXML(xslDoc.xml); 31.258 + }; 31.259 + converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 31.260 + var output = converted.selectSingleNode("//xsl:output"); 31.261 + this.outputMethod = output ? output.getAttribute("method") : "html"; 31.262 this.template.stylesheet = converted; 31.263 this.processor = this.template.createProcessor(); 31.264 - // (re)set default param values 31.265 + // for getParameter and clearParameters 31.266 this.paramsSet = new Array(); 31.267 }; 31.268 + 31.269 /** 31.270 - * Transform the given XML DOM 31.271 + * Transform the given XML DOM and return the transformation result as a new DOM document 31.272 * @argument sourceDoc The XML DOMDocument to transform 31.273 * @return The transformation result as a DOM Document 31.274 */ 31.275 XSLTProcessor.prototype.transformToDocument = function(sourceDoc){ 31.276 - this.processor.input = sourceDoc; 31.277 - var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 31.278 - this.processor.output = outDoc; 31.279 - this.processor.transform(); 31.280 - return outDoc; 31.281 + // fix for bug 1549749 31.282 + if(_SARISSA_THREADEDDOM_PROGID){ 31.283 + this.processor.input=sourceDoc; 31.284 + var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID); 31.285 + this.processor.output=outDoc; 31.286 + this.processor.transform(); 31.287 + return outDoc; 31.288 + } 31.289 + else{ 31.290 + if(!_SARISSA_DOM_XMLWRITER){ 31.291 + _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); 31.292 + }; 31.293 + this.processor.input = sourceDoc; 31.294 + var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER); 31.295 + this.processor.output = outDoc; 31.296 + this.processor.transform(); 31.297 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 31.298 + oDoc.loadXML(outDoc.output+""); 31.299 + return oDoc; 31.300 + }; 31.301 }; 31.302 + 31.303 /** 31.304 - * Not sure if this works in IE. Maybe this will allow non-well-formed 31.305 - * transformation results (i.e. with no single root element) 31.306 + * Transform the given XML DOM and return the transformation result as a new DOM fragment. 31.307 + * <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML). 31.308 * @argument sourceDoc The XML DOMDocument to transform 31.309 - * @return The transformation result as a DOM Fragment 31.310 + * @argument ownerDoc The owner of the result fragment 31.311 + * @return The transformation result as a DOM Document 31.312 */ 31.313 - XSLTProcessor.prototype.transformToFragment = function(sourceDoc, ownerDocument){ 31.314 - return this.transformToDocument(sourceDoc); 31.315 + XSLTProcessor.prototype.transformToFragment = function (sourceDoc, ownerDoc) { 31.316 + this.processor.input = sourceDoc; 31.317 + this.processor.transform(); 31.318 + var s = this.processor.output; 31.319 + var f = ownerDoc.createDocumentFragment(); 31.320 + if (this.outputMethod == 'text') { 31.321 + f.appendChild(ownerDoc.createTextNode(s)); 31.322 + } else if (ownerDoc.body && ownerDoc.body.innerHTML) { 31.323 + var container = ownerDoc.createElement('div'); 31.324 + container.innerHTML = s; 31.325 + while (container.hasChildNodes()) { 31.326 + f.appendChild(container.firstChild); 31.327 + } 31.328 + } 31.329 + else { 31.330 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 31.331 + if (s.substring(0, 5) == '<?xml') { 31.332 + s = s.substring(s.indexOf('?>') + 2); 31.333 + } 31.334 + var xml = ''.concat('<my>', s, '</my>'); 31.335 + oDoc.loadXML(xml); 31.336 + var container = oDoc.documentElement; 31.337 + while (container.hasChildNodes()) { 31.338 + f.appendChild(container.firstChild); 31.339 + } 31.340 + } 31.341 + return f; 31.342 }; 31.343 + 31.344 /** 31.345 * Set global XSLT parameter of the imported stylesheet 31.346 * @argument nsURI The parameter namespace URI 31.347 @@ -202,13 +274,15 @@ 31.348 * @argument value The new parameter value 31.349 */ 31.350 XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 31.351 - /* nsURI is optional but cannot be null */ 31.352 + // make value a zero length string if null to allow clearing 31.353 + value = value ? value : ""; 31.354 + // nsURI is optional but cannot be null 31.355 if(nsURI){ 31.356 this.processor.addParameter(name, value, nsURI); 31.357 }else{ 31.358 this.processor.addParameter(name, value); 31.359 }; 31.360 - /* update updated params for getParameter */ 31.361 + // update updated params for getParameter 31.362 if(!this.paramsSet[""+nsURI]){ 31.363 this.paramsSet[""+nsURI] = new Array(); 31.364 }; 31.365 @@ -222,102 +296,38 @@ 31.366 * @return The parameter value if reviously set by setParameter, null otherwise 31.367 */ 31.368 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 31.369 - if(this.paramsSet[""+nsURI] && this.paramsSet[""+nsURI][name]) 31.370 - return this.paramsSet[""+nsURI][name]; 31.371 - else 31.372 + nsURI = "" + nsURI; 31.373 + if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 31.374 + return this.paramsSet[nsURI][name]; 31.375 + }else{ 31.376 return null; 31.377 + }; 31.378 }; 31.379 -} 31.380 -else{ /* end IE initialization, try to deal with real browsers now ;-) */ 31.381 - if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 31.382 - if(window.XMLDocument){ 31.383 - /** 31.384 - * <p>Emulate IE's onreadystatechange attribute</p> 31.385 - */ 31.386 - XMLDocument.prototype.onreadystatechange = null; 31.387 - /** 31.388 - * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 31.389 - * <ul><li>1 == LOADING,</li> 31.390 - * <li>2 == LOADED,</li> 31.391 - * <li>3 == INTERACTIVE,</li> 31.392 - * <li>4 == COMPLETED</li></ul> 31.393 - */ 31.394 - XMLDocument.prototype.readyState = 0; 31.395 - /** 31.396 - * <p>Emulate IE's parseError attribute</p> 31.397 - */ 31.398 - XMLDocument.prototype.parseError = 0; 31.399 - 31.400 - // NOTE: setting async to false will only work with documents 31.401 - // called over HTTP (meaning a server), not the local file system, 31.402 - // unless you are using Moz 1.4+. 31.403 - // BTW the try>catch block is for 1.4; I haven't found a way to check if 31.404 - // the property is implemented without 31.405 - // causing an error and I dont want to use user agent stuff for that... 31.406 - var _SARISSA_SYNC_NON_IMPLEMENTED = false; 31.407 - try{ 31.408 - /** 31.409 - * <p>Emulates IE's async property for Moz versions prior to 1.4. 31.410 - * It controls whether loading of remote XML files works 31.411 - * synchronously or asynchronously.</p> 31.412 - */ 31.413 - XMLDocument.prototype.async = true; 31.414 - _SARISSA_SYNC_NON_IMPLEMENTED = true; 31.415 - }catch(e){/* trap */}; 31.416 - /** 31.417 - * <p>Keeps a handle to the original load() method. Internal use and only 31.418 - * if Mozilla version is lower than 1.4</p> 31.419 - * @private 31.420 - */ 31.421 - XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; 31.422 - 31.423 - /** 31.424 - * <p>Overrides the original load method to provide synchronous loading for 31.425 - * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if 31.426 - * async is set to false)</p> 31.427 - * @returns the DOM Object as it was before the load() call (may be empty) 31.428 - */ 31.429 - XMLDocument.prototype.load = function(sURI) { 31.430 - var oDoc = document.implementation.createDocument("", "", null); 31.431 - Sarissa.copyChildNodes(this, oDoc); 31.432 - this.parseError = 0; 31.433 - Sarissa.__setReadyState__(this, 1); 31.434 - try { 31.435 - if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { 31.436 - var tmp = new XMLHttpRequest(); 31.437 - tmp.open("GET", sURI, false); 31.438 - tmp.send(null); 31.439 - Sarissa.__setReadyState__(this, 2); 31.440 - Sarissa.copyChildNodes(tmp.responseXML, this); 31.441 - Sarissa.__setReadyState__(this, 3); 31.442 - } 31.443 - else { 31.444 - this._sarissa_load(sURI); 31.445 - }; 31.446 - } 31.447 - catch (objException) { 31.448 - this.parseError = -1; 31.449 - } 31.450 - finally { 31.451 - if(this.async == false){ 31.452 - Sarissa.__handleLoad__(this); 31.453 - }; 31.454 + /** 31.455 + * Clear parameters (set them to default values as defined in the stylesheet itself) 31.456 + */ 31.457 + XSLTProcessor.prototype.clearParameters = function(){ 31.458 + for(var nsURI in this.paramsSet){ 31.459 + for(var name in this.paramsSet[nsURI]){ 31.460 + if(nsURI){ 31.461 + this.processor.addParameter(name, "", nsURI); 31.462 + }else{ 31.463 + this.processor.addParameter(name, ""); 31.464 }; 31.465 - return oDoc; 31.466 }; 31.467 - };//if(window.XMLDocument) 31.468 - 31.469 + }; 31.470 + this.paramsSet = new Array(); 31.471 + }; 31.472 +}else{ /* end IE initialization, try to deal with real browsers now ;-) */ 31.473 + if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 31.474 /** 31.475 * <p>Ensures the document was loaded correctly, otherwise sets the 31.476 * parseError to -1 to indicate something went wrong. Internal use</p> 31.477 * @private 31.478 */ 31.479 Sarissa.__handleLoad__ = function(oDoc){ 31.480 - if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") 31.481 - oDoc.parseError = -1; 31.482 Sarissa.__setReadyState__(oDoc, 4); 31.483 }; 31.484 - 31.485 /** 31.486 * <p>Attached by an event handler to the load event. Internal use.</p> 31.487 * @private 31.488 @@ -325,7 +335,6 @@ 31.489 _sarissa_XMLDocument_onload = function(){ 31.490 Sarissa.__handleLoad__(this); 31.491 }; 31.492 - 31.493 /** 31.494 * <p>Sets the readyState property of the given DOM Document object. 31.495 * Internal use.</p> 31.496 @@ -336,80 +345,129 @@ 31.497 */ 31.498 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 31.499 oDoc.readyState = iReadyState; 31.500 + oDoc.readystate = iReadyState; 31.501 if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 31.502 oDoc.onreadystatechange(); 31.503 }; 31.504 - /** 31.505 - * <p>Factory method to obtain a new DOM Document object</p> 31.506 - * @argument sUri the namespace of the root node (if any) 31.507 - * @argument sUri the local name of the root node (if any) 31.508 - * @returns a new DOM Document 31.509 - */ 31.510 Sarissa.getDomDocument = function(sUri, sName){ 31.511 - var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); 31.512 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 31.513 + if(!oDoc.onreadystatechange){ 31.514 + 31.515 + /** 31.516 + * <p>Emulate IE's onreadystatechange attribute</p> 31.517 + */ 31.518 + oDoc.onreadystatechange = null; 31.519 + }; 31.520 + if(!oDoc.readyState){ 31.521 + /** 31.522 + * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 31.523 + * <ul><li>1 == LOADING,</li> 31.524 + * <li>2 == LOADED,</li> 31.525 + * <li>3 == INTERACTIVE,</li> 31.526 + * <li>4 == COMPLETED</li></ul> 31.527 + */ 31.528 + oDoc.readyState = 0; 31.529 + }; 31.530 oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); 31.531 return oDoc; 31.532 - }; 31.533 + }; 31.534 + if(window.XMLDocument){ 31.535 + // do nothing 31.536 + }// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS 31.537 + else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ 31.538 + //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good 31.539 + /** 31.540 + * <p>Factory method to obtain a new DOM Document object</p> 31.541 + * @argument sUri the namespace of the root node (if any) 31.542 + * @argument sUri the local name of the root node (if any) 31.543 + * @returns a new DOM Document 31.544 + */ 31.545 + Sarissa.getDomDocument = function(sUri, sName){ 31.546 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 31.547 + return oDoc; 31.548 + }; 31.549 + } 31.550 + else { 31.551 + Sarissa.getDomDocument = function(sUri, sName){ 31.552 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 31.553 + // looks like safari does not create the root element for some unknown reason 31.554 + if(oDoc && (sUri || sName) && !oDoc.documentElement){ 31.555 + oDoc.appendChild(oDoc.createElementNS(sUri, sName)); 31.556 + }; 31.557 + return oDoc; 31.558 + }; 31.559 + }; 31.560 };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT) 31.561 }; 31.562 //========================================== 31.563 // Common stuff 31.564 //========================================== 31.565 if(!window.DOMParser){ 31.566 - /** 31.567 - * DOMParser is a utility class, used to construct DOMDocuments from XML strings 31.568 - * @constructor 31.569 - */ 31.570 - DOMParser = function() { 31.571 + if(_SARISSA_IS_SAFARI){ 31.572 + /* 31.573 + * DOMParser is a utility class, used to construct DOMDocuments from XML strings 31.574 + * @constructor 31.575 + */ 31.576 + DOMParser = function() { }; 31.577 + /** 31.578 + * Construct a new DOM Document from the given XMLstring 31.579 + * @param sXml the given XML string 31.580 + * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 31.581 + * @return a new DOM Document from the given XML string 31.582 + */ 31.583 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 31.584 + var xmlhttp = new XMLHttpRequest(); 31.585 + xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(sXml), false); 31.586 + xmlhttp.send(null); 31.587 + return xmlhttp.responseXML; 31.588 + }; 31.589 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 31.590 + DOMParser = function() { }; 31.591 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 31.592 + var doc = Sarissa.getDomDocument(); 31.593 + doc.loadXML(sXml); 31.594 + return doc; 31.595 + }; 31.596 }; 31.597 - /** 31.598 - * Construct a new DOM Document from the given XMLstring 31.599 - * @param sXml the given XML string 31.600 - * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 31.601 - * @return a new DOM Document from the given XML string 31.602 - */ 31.603 - DOMParser.prototype.parseFromString = function(sXml, contentType){ 31.604 - var doc = Sarissa.getDomDocument(); 31.605 - doc.loadXML(sXml); 31.606 - return doc; 31.607 - }; 31.608 - 31.609 }; 31.610 31.611 -if(window.XMLHttpRequest){ 31.612 - Sarissa.IS_ENABLED_XMLHTTP = true; 31.613 -} 31.614 -else if(_SARISSA_IS_IE){ 31.615 - /** 31.616 - * Emulate XMLHttpRequest 31.617 - * @constructor 31.618 - */ 31.619 - XMLHttpRequest = function() { 31.620 - return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 31.621 - }; 31.622 - Sarissa.IS_ENABLED_XMLHTTP = true; 31.623 -}; 31.624 - 31.625 -if(!window.document.importNode && _SARISSA_IS_IE){ 31.626 +if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){ 31.627 try{ 31.628 /** 31.629 - * Implements importNode for the current window document in IE using innerHTML. 31.630 - * Testing showed that DOM was multiple times slower than innerHTML for this, 31.631 - * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML) 31.632 - * please gimme a call. 31.633 + * Implementation of importNode for the context window document in IE. 31.634 + * If <code>oNode</code> is a TextNode, <code>bChildren</code> is ignored. 31.635 * @param oNode the Node to import 31.636 * @param bChildren whether to include the children of oNode 31.637 * @returns the imported node for further use 31.638 */ 31.639 - window.document.importNode = function(oNode, bChildren){ 31.640 - var importNode = document.createElement("div"); 31.641 - if(bChildren) 31.642 - importNode.innerHTML = Sarissa.serialize(oNode); 31.643 - else 31.644 - importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false)); 31.645 - return importNode.firstChild; 31.646 + document.importNode = function(oNode, bChildren){ 31.647 + var tmp; 31.648 + if (oNode.nodeName=='#text') { 31.649 + return document.createTextElement(oNode.data); 31.650 + } 31.651 + else { 31.652 + if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){ 31.653 + tmp = document.createElement("table"); 31.654 + } 31.655 + else if(oNode.nodeName == "td"){ 31.656 + tmp = document.createElement("tr"); 31.657 + } 31.658 + else if(oNode.nodeName == "option"){ 31.659 + tmp = document.createElement("select"); 31.660 + } 31.661 + else{ 31.662 + tmp = document.createElement("div"); 31.663 + }; 31.664 + if(bChildren){ 31.665 + tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML; 31.666 + }else{ 31.667 + tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML; 31.668 + }; 31.669 + return tmp.getElementsByTagName("*")[0]; 31.670 + }; 31.671 + 31.672 }; 31.673 - }catch(e){}; 31.674 + }catch(e){ }; 31.675 }; 31.676 if(!Sarissa.getParseErrorText){ 31.677 /** 31.678 @@ -423,17 +481,16 @@ 31.679 */ 31.680 Sarissa.getParseErrorText = function (oDoc){ 31.681 var parseErrorText = Sarissa.PARSED_OK; 31.682 - if(oDoc.parseError != 0){ 31.683 - /*moz*/ 31.684 - if(oDoc.documentElement.tagName == "parsererror"){ 31.685 - parseErrorText = oDoc.documentElement.firstChild.data; 31.686 - parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 31.687 - }/*konq*/ 31.688 - else if(oDoc.documentElement.tagName == "html"){ 31.689 - parseErrorText = Sarissa.getText(oDoc.documentElement.getElementsByTagName("h1")[0], false) + "\n"; 31.690 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n"; 31.691 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false); 31.692 - }; 31.693 + if(!oDoc.documentElement){ 31.694 + parseErrorText = Sarissa.PARSED_EMPTY; 31.695 + } else if(oDoc.documentElement.tagName == "parsererror"){ 31.696 + parseErrorText = oDoc.documentElement.firstChild.data; 31.697 + parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 31.698 + } else if(oDoc.getElementsByTagName("parsererror").length > 0){ 31.699 + var parsererror = oDoc.getElementsByTagName("parsererror")[0]; 31.700 + parseErrorText = Sarissa.getText(parsererror, true)+"\n"; 31.701 + } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){ 31.702 + parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR; 31.703 }; 31.704 return parseErrorText; 31.705 }; 31.706 @@ -446,8 +503,7 @@ 31.707 var nodeType = node.nodeType; 31.708 if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){ 31.709 s += node.data; 31.710 - } 31.711 - else if(deep == true 31.712 + } else if(deep == true 31.713 && (nodeType == Node.ELEMENT_NODE 31.714 || nodeType == Node.DOCUMENT_NODE 31.715 || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ 31.716 @@ -456,33 +512,20 @@ 31.717 }; 31.718 return s; 31.719 }; 31.720 -if(window.XMLSerializer){ 31.721 +if(!window.XMLSerializer 31.722 + && Sarissa.getDomDocument 31.723 + && Sarissa.getDomDocument("","foo", null).xml){ 31.724 /** 31.725 - * <p>Factory method to obtain the serialization of a DOM Node</p> 31.726 - * @returns the serialized Node as an XML string 31.727 + * Utility class to serialize DOM Node objects to XML strings 31.728 + * @constructor 31.729 */ 31.730 - Sarissa.serialize = function(oDoc){ 31.731 - return (new XMLSerializer()).serializeToString(oDoc); 31.732 - }; 31.733 -}else{ 31.734 - if((Sarissa.getDomDocument("","foo", null)).xml){ 31.735 - // see non-IE version 31.736 - Sarissa.serialize = function(oDoc) { 31.737 - // TODO: check for HTML document and return innerHTML instead 31.738 - return oDoc.xml; 31.739 - }; 31.740 - /** 31.741 - * Utility class to serialize DOM Node objects to XML strings 31.742 - * @constructor 31.743 - */ 31.744 - XMLSerializer = function(){}; 31.745 - /** 31.746 - * Serialize the given DOM Node to an XML string 31.747 - * @param oNode the DOM Node to serialize 31.748 - */ 31.749 - XMLSerializer.prototype.serializeToString = function(oNode) { 31.750 - return oNode.xml; 31.751 - }; 31.752 + XMLSerializer = function(){}; 31.753 + /** 31.754 + * Serialize the given DOM Node to an XML string 31.755 + * @param oNode the DOM Node to serialize 31.756 + */ 31.757 + XMLSerializer.prototype.serializeToString = function(oNode) { 31.758 + return oNode.xml; 31.759 }; 31.760 }; 31.761 31.762 @@ -497,7 +540,8 @@ 31.763 * @argument oNode the Node to empty 31.764 */ 31.765 Sarissa.clearChildNodes = function(oNode) { 31.766 - while(oNode.hasChildNodes()){ 31.767 + // need to check for firstChild due to opera 8 bug with hasChildNodes 31.768 + while(oNode.firstChild) { 31.769 oNode.removeChild(oNode.firstChild); 31.770 }; 31.771 }; 31.772 @@ -510,17 +554,19 @@ 31.773 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 31.774 */ 31.775 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 31.776 + if((!nodeFrom) || (!nodeTo)){ 31.777 + throw "Both source and destination nodes must be provided"; 31.778 + }; 31.779 if(!bPreserveExisting){ 31.780 Sarissa.clearChildNodes(nodeTo); 31.781 }; 31.782 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 31.783 var nodes = nodeFrom.childNodes; 31.784 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 31.785 + if(typeof(ownerDoc.importNode) != "undefined") { 31.786 for(var i=0;i < nodes.length;i++) { 31.787 nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 31.788 }; 31.789 - } 31.790 - else{ 31.791 + } else { 31.792 for(var i=0;i < nodes.length;i++) { 31.793 nodeTo.appendChild(nodes[i].cloneNode(true)); 31.794 }; 31.795 @@ -533,32 +579,34 @@ 31.796 * the move operation, unless you supply a true third parameter</p> 31.797 * @argument nodeFrom the Node to copy the childNodes from 31.798 * @argument nodeTo the Node to copy the childNodes to 31.799 - * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 31.800 - */ 31.801 + * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is 31.802 + */ 31.803 Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 31.804 + if((!nodeFrom) || (!nodeTo)){ 31.805 + throw "Both source and destination nodes must be provided"; 31.806 + }; 31.807 if(!bPreserveExisting){ 31.808 Sarissa.clearChildNodes(nodeTo); 31.809 }; 31.810 - 31.811 var nodes = nodeFrom.childNodes; 31.812 // if within the same doc, just move, else copy and delete 31.813 if(nodeFrom.ownerDocument == nodeTo.ownerDocument){ 31.814 - nodeTo.appendChild(nodes[i]); 31.815 - }else{ 31.816 + while(nodeFrom.firstChild){ 31.817 + nodeTo.appendChild(nodeFrom.firstChild); 31.818 + }; 31.819 + } else { 31.820 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 31.821 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 31.822 - for(var i=0;i < nodes.length;i++) { 31.823 - nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 31.824 - }; 31.825 - } 31.826 - else{ 31.827 - for(var i=0;i < nodes.length;i++) { 31.828 - nodeTo.appendChild(nodes[i].cloneNode(true)); 31.829 - }; 31.830 + if(typeof(ownerDoc.importNode) != "undefined") { 31.831 + for(var i=0;i < nodes.length;i++) { 31.832 + nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 31.833 + }; 31.834 + }else{ 31.835 + for(var i=0;i < nodes.length;i++) { 31.836 + nodeTo.appendChild(nodes[i].cloneNode(true)); 31.837 + }; 31.838 }; 31.839 Sarissa.clearChildNodes(nodeFrom); 31.840 }; 31.841 - 31.842 }; 31.843 31.844 /**
32.1 --- a/examples/Common/VerySimpleWithLogin/Resources/scripts/sarissa.js Sun Jun 10 22:52:12 2007 +0000 32.2 +++ b/examples/Common/VerySimpleWithLogin/Resources/scripts/sarissa.js Sat Jul 07 16:17:29 2007 +0000 32.3 @@ -2,72 +2,54 @@ 32.4 * ==================================================================== 32.5 * About 32.6 * ==================================================================== 32.7 - * Sarissa cross browser XML library 32.8 - * @version 0.9.6 32.9 - * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 32.10 - * 32.11 * Sarissa is an ECMAScript library acting as a cross-browser wrapper for native XML APIs. 32.12 * The library supports Gecko based browsers like Mozilla and Firefox, 32.13 - * Internet Explorer (5.5+ with MSXML3.0+) and, last but not least, KHTML based browsers like 32.14 - * Konqueror and Safari. 32.15 - * 32.16 + * Internet Explorer (5.5+ with MSXML3.0+), Konqueror, Safari and a little of Opera 32.17 + * @version ${project.version} 32.18 + * @author: Manos Batsis, mailto: mbatsis at users full stop sourceforge full stop net 32.19 * ==================================================================== 32.20 * Licence 32.21 * ==================================================================== 32.22 - * This program is free software; you can redistribute it and/or modify 32.23 - * it under the terms of the GNU General Public License version 2 or 32.24 - * the GNU Lesser General Public License version 2.1 as published by 32.25 - * the Free Software Foundation (your choice of the two). 32.26 - * 32.27 - * This program is distributed in the hope that it will be useful, 32.28 - * but WITHOUT ANY WARRANTY; without even the implied warranty of 32.29 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 32.30 - * GNU General Public License or GNU Lesser General Public License for more details. 32.31 - * 32.32 - * You should have received a copy of the GNU General Public License 32.33 - * or GNU Lesser General Public License along with this program; if not, 32.34 - * write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 32.35 - * or visit http://www.gnu.org 32.36 - * 32.37 + * Sarissa is free software distributed under the GNU GPL version 2 (see <a href="gpl.txt">gpl.txt</a>) or higher, 32.38 + * GNU LGPL version 2.1 (see <a href="lgpl.txt">lgpl.txt</a>) or higher and Apache Software License 2.0 or higher 32.39 + * (see <a href="asl.txt">asl.txt</a>). This means you can choose one of the three and use that if you like. If 32.40 + * you make modifications under the ASL, i would appreciate it if you submitted those. 32.41 + * In case your copy of Sarissa does not include the license texts, you may find 32.42 + * them online in various formats at <a href="http://www.gnu.org">http://www.gnu.org</a> and 32.43 + * <a href="http://www.apache.org">http://www.apache.org</a>. 32.44 + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY 32.45 + * KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE 32.46 + * WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE 32.47 + * AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 32.48 + * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 32.49 + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR 32.50 + * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 32.51 + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 32.52 */ 32.53 /** 32.54 - * <p>Sarissa is a utility class. Provides static methods for DOMDocument and 32.55 - * XMLHTTP objects, DOM Node serializatrion to XML strings and other goodies.</p> 32.56 + * <p>Sarissa is a utility class. Provides "static" methods for DOMDocument, 32.57 + * DOM Node serialization to XML strings and other utility goodies.</p> 32.58 * @constructor 32.59 */ 32.60 function Sarissa(){}; 32.61 -/** @private */ 32.62 +Sarissa.VERSION = "${project.version}"; 32.63 Sarissa.PARSED_OK = "Document contains no parsing errors"; 32.64 -/** 32.65 - * Tells you whether transformNode and transformNodeToObject are available. This functionality 32.66 - * is contained in sarissa_ieemu_xslt.js and is deprecated. If you want to control XSLT transformations 32.67 - * use the XSLTProcessor 32.68 - * @deprecated 32.69 - * @type boolean 32.70 - */ 32.71 +Sarissa.PARSED_EMPTY = "Document is empty"; 32.72 +Sarissa.PARSED_UNKNOWN_ERROR = "Not well-formed or other error"; 32.73 Sarissa.IS_ENABLED_TRANSFORM_NODE = false; 32.74 -/** 32.75 - * tells you whether XMLHttpRequest (or equivalent) is available 32.76 - * @type boolean 32.77 - */ 32.78 -Sarissa.IS_ENABLED_XMLHTTP = false; 32.79 -/** 32.80 - * tells you whether selectNodes/selectSingleNode is available 32.81 - * @type boolean 32.82 - */ 32.83 -Sarissa.IS_ENABLED_SELECT_NODES = false; 32.84 var _sarissa_iNsCounter = 0; 32.85 var _SARISSA_IEPREFIX4XSLPARAM = ""; 32.86 var _SARISSA_HAS_DOM_IMPLEMENTATION = document.implementation && true; 32.87 var _SARISSA_HAS_DOM_CREATE_DOCUMENT = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.createDocument; 32.88 var _SARISSA_HAS_DOM_FEATURE = _SARISSA_HAS_DOM_IMPLEMENTATION && document.implementation.hasFeature; 32.89 var _SARISSA_IS_MOZ = _SARISSA_HAS_DOM_CREATE_DOCUMENT && _SARISSA_HAS_DOM_FEATURE; 32.90 -var _SARISSA_IS_SAFARI = navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1; 32.91 +var _SARISSA_IS_SAFARI = (navigator.userAgent && navigator.vendor && (navigator.userAgent.toLowerCase().indexOf("applewebkit") != -1 || navigator.vendor.indexOf("Apple") != -1)); 32.92 var _SARISSA_IS_IE = document.all && window.ActiveXObject && navigator.userAgent.toLowerCase().indexOf("msie") > -1 && navigator.userAgent.toLowerCase().indexOf("opera") == -1; 32.93 +if(!window.Node || !Node.ELEMENT_NODE){ 32.94 + Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 32.95 +}; 32.96 32.97 -if(!window.Node || !window.Node.ELEMENT_NODE){ 32.98 - var Node = {ELEMENT_NODE: 1, ATTRIBUTE_NODE: 2, TEXT_NODE: 3, CDATA_SECTION_NODE: 4, ENTITY_REFERENCE_NODE: 5, ENTITY_NODE: 6, PROCESSING_INSTRUCTION_NODE: 7, COMMENT_NODE: 8, DOCUMENT_NODE: 9, DOCUMENT_TYPE_NODE: 10, DOCUMENT_FRAGMENT_NODE: 11, NOTATION_NODE: 12}; 32.99 -}; 32.100 +if(typeof XMLDocument == "undefined" && typeof Document !="undefined"){ XMLDocument = Document; } 32.101 32.102 // IE initialization 32.103 if(_SARISSA_IS_IE){ 32.104 @@ -76,13 +58,15 @@ 32.105 // used to store the most recent ProgID available out of the above 32.106 var _SARISSA_DOM_PROGID = ""; 32.107 var _SARISSA_XMLHTTP_PROGID = ""; 32.108 + var _SARISSA_DOM_XMLWRITER = ""; 32.109 /** 32.110 * Called when the Sarissa_xx.js file is parsed, to pick most recent 32.111 * ProgIDs for IE, then gets destroyed. 32.112 + * @private 32.113 * @param idList an array of MSXML PROGIDs from which the most recent will be picked for a given object 32.114 * @param enabledList an array of arrays where each array has two items; the index of the PROGID for which a certain feature is enabled 32.115 */ 32.116 - pickRecentProgID = function (idList, enabledList){ 32.117 + Sarissa.pickRecentProgID = function (idList){ 32.118 // found progID flag 32.119 var bFound = false; 32.120 for(var i=0; i < idList.length && !bFound; i++){ 32.121 @@ -90,50 +74,69 @@ 32.122 var oDoc = new ActiveXObject(idList[i]); 32.123 o2Store = idList[i]; 32.124 bFound = true; 32.125 - for(var j=0;j<enabledList.length;j++) 32.126 - if(i <= enabledList[j][1]) 32.127 - Sarissa["IS_ENABLED_"+enabledList[j][0]] = true; 32.128 }catch (objException){ 32.129 // trap; try next progID 32.130 }; 32.131 }; 32.132 - if (!bFound) 32.133 + if (!bFound) { 32.134 throw "Could not retreive a valid progID of Class: " + idList[idList.length-1]+". (original exception: "+e+")"; 32.135 + }; 32.136 idList = null; 32.137 return o2Store; 32.138 }; 32.139 // pick best available MSXML progIDs 32.140 - _SARISSA_DOM_PROGID = pickRecentProgID(["Msxml2.DOMDocument.5.0", "Msxml2.DOMDocument.4.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"], [["SELECT_NODES", 2],["TRANSFORM_NODE", 2]]); 32.141 - _SARISSA_XMLHTTP_PROGID = pickRecentProgID(["Msxml2.XMLHTTP.5.0", "Msxml2.XMLHTTP.4.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"], [["XMLHTTP", 4]]); 32.142 - _SARISSA_THREADEDDOM_PROGID = pickRecentProgID(["Msxml2.FreeThreadedDOMDocument.5.0", "MSXML2.FreeThreadedDOMDocument.4.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 32.143 - _SARISSA_XSLTEMPLATE_PROGID = pickRecentProgID(["Msxml2.XSLTemplate.5.0", "Msxml2.XSLTemplate.4.0", "MSXML2.XSLTemplate.3.0"], [["XSLTPROC", 2]]); 32.144 + _SARISSA_DOM_PROGID = null; 32.145 + _SARISSA_THREADEDDOM_PROGID = null; 32.146 + _SARISSA_XSLTEMPLATE_PROGID = null; 32.147 + _SARISSA_XMLHTTP_PROGID = null; 32.148 + if(!window.XMLHttpRequest){ 32.149 + /** 32.150 + * Emulate XMLHttpRequest 32.151 + * @constructor 32.152 + */ 32.153 + XMLHttpRequest = function() { 32.154 + if(!_SARISSA_XMLHTTP_PROGID){ 32.155 + _SARISSA_XMLHTTP_PROGID = Sarissa.pickRecentProgID(["Msxml2.XMLHTTP.6.0", "MSXML2.XMLHTTP.3.0", "MSXML2.XMLHTTP", "Microsoft.XMLHTTP"]); 32.156 + }; 32.157 + return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 32.158 + }; 32.159 + }; 32.160 // we dont need this anymore 32.161 - pickRecentProgID = null; 32.162 //============================================ 32.163 // Factory methods (IE) 32.164 //============================================ 32.165 // see non-IE version 32.166 Sarissa.getDomDocument = function(sUri, sName){ 32.167 + if(!_SARISSA_DOM_PROGID){ 32.168 + _SARISSA_DOM_PROGID = Sarissa.pickRecentProgID(["Msxml2.DOMDocument.6.0", "Msxml2.DOMDocument.3.0", "MSXML2.DOMDocument", "MSXML.DOMDocument", "Microsoft.XMLDOM"]); 32.169 + }; 32.170 var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 32.171 - // if a root tag name was provided, we need to load it in the DOM 32.172 - // object 32.173 + // if a root tag name was provided, we need to load it in the DOM object 32.174 if (sName){ 32.175 - // if needed, create an artifical namespace prefix the way Moz 32.176 - // does 32.177 - if (sUri){ 32.178 - oDoc.loadXML("<a" + _sarissa_iNsCounter + ":" + sName + " xmlns:a" + _sarissa_iNsCounter + "=\"" + sUri + "\" />"); 32.179 - // don't use the same prefix again 32.180 - ++_sarissa_iNsCounter; 32.181 - } 32.182 - else 32.183 - oDoc.loadXML("<" + sName + "/>"); 32.184 + // create an artifical namespace prefix 32.185 + // or reuse existing prefix if applicable 32.186 + var prefix = ""; 32.187 + if(sUri){ 32.188 + if(sName.indexOf(":") > 1){ 32.189 + prefix = sName.substring(0, sName.indexOf(":")); 32.190 + sName = sName.substring(sName.indexOf(":")+1); 32.191 + }else{ 32.192 + prefix = "a" + (_sarissa_iNsCounter++); 32.193 + }; 32.194 + }; 32.195 + // use namespaces if a namespace URI exists 32.196 + if(sUri){ 32.197 + oDoc.loadXML('<' + prefix+':'+sName + " xmlns:" + prefix + "=\"" + sUri + "\"" + " />"); 32.198 + } else { 32.199 + oDoc.loadXML('<' + sName + " />"); 32.200 + }; 32.201 }; 32.202 return oDoc; 32.203 }; 32.204 // see non-IE version 32.205 Sarissa.getParseErrorText = function (oDoc) { 32.206 var parseErrorText = Sarissa.PARSED_OK; 32.207 - if(oDoc.parseError != 0){ 32.208 + if(oDoc && oDoc.parseError && oDoc.parseError.errorCode && oDoc.parseError.errorCode != 0){ 32.209 parseErrorText = "XML Parsing Error: " + oDoc.parseError.reason + 32.210 "\nLocation: " + oDoc.parseError.url + 32.211 "\nLine Number " + oDoc.parseError.line + ", Column " + 32.212 @@ -144,6 +147,9 @@ 32.213 parseErrorText += "-"; 32.214 }; 32.215 parseErrorText += "^\n"; 32.216 + } 32.217 + else if(oDoc.documentElement == null){ 32.218 + parseErrorText = Sarissa.PARSED_EMPTY; 32.219 }; 32.220 return parseErrorText; 32.221 }; 32.222 @@ -158,43 +164,109 @@ 32.223 * @constructor 32.224 */ 32.225 XSLTProcessor = function(){ 32.226 + if(!_SARISSA_XSLTEMPLATE_PROGID){ 32.227 + _SARISSA_XSLTEMPLATE_PROGID = Sarissa.pickRecentProgID(["Msxml2.XSLTemplate.6.0", "MSXML2.XSLTemplate.3.0"]); 32.228 + }; 32.229 this.template = new ActiveXObject(_SARISSA_XSLTEMPLATE_PROGID); 32.230 this.processor = null; 32.231 }; 32.232 /** 32.233 - * Impoprts the given XSLT DOM and compiles it to a reusable transform 32.234 + * Imports the given XSLT DOM and compiles it to a reusable transform 32.235 + * <b>Note:</b> If the stylesheet was loaded from a URL and contains xsl:import or xsl:include elements,it will be reloaded to resolve those 32.236 * @argument xslDoc The XSLT DOMDocument to import 32.237 */ 32.238 XSLTProcessor.prototype.importStylesheet = function(xslDoc){ 32.239 + if(!_SARISSA_THREADEDDOM_PROGID){ 32.240 + _SARISSA_THREADEDDOM_PROGID = Sarissa.pickRecentProgID(["MSXML2.FreeThreadedDOMDocument.6.0", "MSXML2.FreeThreadedDOMDocument.3.0"]); 32.241 + }; 32.242 + xslDoc.setProperty("SelectionLanguage", "XPath"); 32.243 + xslDoc.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 32.244 // convert stylesheet to free threaded 32.245 - var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 32.246 - converted.loadXML(xslDoc.xml); 32.247 + var converted = new ActiveXObject(_SARISSA_THREADEDDOM_PROGID); 32.248 + // make included/imported stylesheets work if exist and xsl was originally loaded from url 32.249 + if(xslDoc.url && xslDoc.selectSingleNode("//xsl:*[local-name() = 'import' or local-name() = 'include']") != null){ 32.250 + converted.async = false; 32.251 + if (_SARISSA_THREADEDDOM_PROGID == "MSXML2.FreeThreadedDOMDocument.6.0") { 32.252 + converted.setProperty("AllowDocumentFunction", true); 32.253 + converted.resolveExternals = true; 32.254 + } 32.255 + converted.load(xslDoc.url); 32.256 + } else { 32.257 + converted.loadXML(xslDoc.xml); 32.258 + }; 32.259 + converted.setProperty("SelectionNamespaces", "xmlns:xsl='http://www.w3.org/1999/XSL/Transform'"); 32.260 + var output = converted.selectSingleNode("//xsl:output"); 32.261 + this.outputMethod = output ? output.getAttribute("method") : "html"; 32.262 this.template.stylesheet = converted; 32.263 this.processor = this.template.createProcessor(); 32.264 - // (re)set default param values 32.265 + // for getParameter and clearParameters 32.266 this.paramsSet = new Array(); 32.267 }; 32.268 + 32.269 /** 32.270 - * Transform the given XML DOM 32.271 + * Transform the given XML DOM and return the transformation result as a new DOM document 32.272 * @argument sourceDoc The XML DOMDocument to transform 32.273 * @return The transformation result as a DOM Document 32.274 */ 32.275 XSLTProcessor.prototype.transformToDocument = function(sourceDoc){ 32.276 - this.processor.input = sourceDoc; 32.277 - var outDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 32.278 - this.processor.output = outDoc; 32.279 - this.processor.transform(); 32.280 - return outDoc; 32.281 + // fix for bug 1549749 32.282 + if(_SARISSA_THREADEDDOM_PROGID){ 32.283 + this.processor.input=sourceDoc; 32.284 + var outDoc=new ActiveXObject(_SARISSA_DOM_PROGID); 32.285 + this.processor.output=outDoc; 32.286 + this.processor.transform(); 32.287 + return outDoc; 32.288 + } 32.289 + else{ 32.290 + if(!_SARISSA_DOM_XMLWRITER){ 32.291 + _SARISSA_DOM_XMLWRITER = Sarissa.pickRecentProgID(["Msxml2.MXXMLWriter.6.0", "Msxml2.MXXMLWriter.3.0", "MSXML2.MXXMLWriter", "MSXML.MXXMLWriter", "Microsoft.XMLDOM"]); 32.292 + }; 32.293 + this.processor.input = sourceDoc; 32.294 + var outDoc = new ActiveXObject(_SARISSA_DOM_XMLWRITER); 32.295 + this.processor.output = outDoc; 32.296 + this.processor.transform(); 32.297 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 32.298 + oDoc.loadXML(outDoc.output+""); 32.299 + return oDoc; 32.300 + }; 32.301 }; 32.302 + 32.303 /** 32.304 - * Not sure if this works in IE. Maybe this will allow non-well-formed 32.305 - * transformation results (i.e. with no single root element) 32.306 + * Transform the given XML DOM and return the transformation result as a new DOM fragment. 32.307 + * <b>Note</b>: The xsl:output method must match the nature of the owner document (XML/HTML). 32.308 * @argument sourceDoc The XML DOMDocument to transform 32.309 - * @return The transformation result as a DOM Fragment 32.310 + * @argument ownerDoc The owner of the result fragment 32.311 + * @return The transformation result as a DOM Document 32.312 */ 32.313 - XSLTProcessor.prototype.transformToFragment = function(sourceDoc, ownerDocument){ 32.314 - return this.transformToDocument(sourceDoc); 32.315 + XSLTProcessor.prototype.transformToFragment = function (sourceDoc, ownerDoc) { 32.316 + this.processor.input = sourceDoc; 32.317 + this.processor.transform(); 32.318 + var s = this.processor.output; 32.319 + var f = ownerDoc.createDocumentFragment(); 32.320 + if (this.outputMethod == 'text') { 32.321 + f.appendChild(ownerDoc.createTextNode(s)); 32.322 + } else if (ownerDoc.body && ownerDoc.body.innerHTML) { 32.323 + var container = ownerDoc.createElement('div'); 32.324 + container.innerHTML = s; 32.325 + while (container.hasChildNodes()) { 32.326 + f.appendChild(container.firstChild); 32.327 + } 32.328 + } 32.329 + else { 32.330 + var oDoc = new ActiveXObject(_SARISSA_DOM_PROGID); 32.331 + if (s.substring(0, 5) == '<?xml') { 32.332 + s = s.substring(s.indexOf('?>') + 2); 32.333 + } 32.334 + var xml = ''.concat('<my>', s, '</my>'); 32.335 + oDoc.loadXML(xml); 32.336 + var container = oDoc.documentElement; 32.337 + while (container.hasChildNodes()) { 32.338 + f.appendChild(container.firstChild); 32.339 + } 32.340 + } 32.341 + return f; 32.342 }; 32.343 + 32.344 /** 32.345 * Set global XSLT parameter of the imported stylesheet 32.346 * @argument nsURI The parameter namespace URI 32.347 @@ -202,13 +274,15 @@ 32.348 * @argument value The new parameter value 32.349 */ 32.350 XSLTProcessor.prototype.setParameter = function(nsURI, name, value){ 32.351 - /* nsURI is optional but cannot be null */ 32.352 + // make value a zero length string if null to allow clearing 32.353 + value = value ? value : ""; 32.354 + // nsURI is optional but cannot be null 32.355 if(nsURI){ 32.356 this.processor.addParameter(name, value, nsURI); 32.357 }else{ 32.358 this.processor.addParameter(name, value); 32.359 }; 32.360 - /* update updated params for getParameter */ 32.361 + // update updated params for getParameter 32.362 if(!this.paramsSet[""+nsURI]){ 32.363 this.paramsSet[""+nsURI] = new Array(); 32.364 }; 32.365 @@ -222,102 +296,38 @@ 32.366 * @return The parameter value if reviously set by setParameter, null otherwise 32.367 */ 32.368 XSLTProcessor.prototype.getParameter = function(nsURI, name){ 32.369 - if(this.paramsSet[""+nsURI] && this.paramsSet[""+nsURI][name]) 32.370 - return this.paramsSet[""+nsURI][name]; 32.371 - else 32.372 + nsURI = "" + nsURI; 32.373 + if(this.paramsSet[nsURI] && this.paramsSet[nsURI][name]){ 32.374 + return this.paramsSet[nsURI][name]; 32.375 + }else{ 32.376 return null; 32.377 + }; 32.378 }; 32.379 -} 32.380 -else{ /* end IE initialization, try to deal with real browsers now ;-) */ 32.381 - if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 32.382 - if(window.XMLDocument){ 32.383 - /** 32.384 - * <p>Emulate IE's onreadystatechange attribute</p> 32.385 - */ 32.386 - XMLDocument.prototype.onreadystatechange = null; 32.387 - /** 32.388 - * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 32.389 - * <ul><li>1 == LOADING,</li> 32.390 - * <li>2 == LOADED,</li> 32.391 - * <li>3 == INTERACTIVE,</li> 32.392 - * <li>4 == COMPLETED</li></ul> 32.393 - */ 32.394 - XMLDocument.prototype.readyState = 0; 32.395 - /** 32.396 - * <p>Emulate IE's parseError attribute</p> 32.397 - */ 32.398 - XMLDocument.prototype.parseError = 0; 32.399 - 32.400 - // NOTE: setting async to false will only work with documents 32.401 - // called over HTTP (meaning a server), not the local file system, 32.402 - // unless you are using Moz 1.4+. 32.403 - // BTW the try>catch block is for 1.4; I haven't found a way to check if 32.404 - // the property is implemented without 32.405 - // causing an error and I dont want to use user agent stuff for that... 32.406 - var _SARISSA_SYNC_NON_IMPLEMENTED = false; 32.407 - try{ 32.408 - /** 32.409 - * <p>Emulates IE's async property for Moz versions prior to 1.4. 32.410 - * It controls whether loading of remote XML files works 32.411 - * synchronously or asynchronously.</p> 32.412 - */ 32.413 - XMLDocument.prototype.async = true; 32.414 - _SARISSA_SYNC_NON_IMPLEMENTED = true; 32.415 - }catch(e){/* trap */}; 32.416 - /** 32.417 - * <p>Keeps a handle to the original load() method. Internal use and only 32.418 - * if Mozilla version is lower than 1.4</p> 32.419 - * @private 32.420 - */ 32.421 - XMLDocument.prototype._sarissa_load = XMLDocument.prototype.load; 32.422 - 32.423 - /** 32.424 - * <p>Overrides the original load method to provide synchronous loading for 32.425 - * Mozilla versions prior to 1.4, using an XMLHttpRequest object (if 32.426 - * async is set to false)</p> 32.427 - * @returns the DOM Object as it was before the load() call (may be empty) 32.428 - */ 32.429 - XMLDocument.prototype.load = function(sURI) { 32.430 - var oDoc = document.implementation.createDocument("", "", null); 32.431 - Sarissa.copyChildNodes(this, oDoc); 32.432 - this.parseError = 0; 32.433 - Sarissa.__setReadyState__(this, 1); 32.434 - try { 32.435 - if(this.async == false && _SARISSA_SYNC_NON_IMPLEMENTED) { 32.436 - var tmp = new XMLHttpRequest(); 32.437 - tmp.open("GET", sURI, false); 32.438 - tmp.send(null); 32.439 - Sarissa.__setReadyState__(this, 2); 32.440 - Sarissa.copyChildNodes(tmp.responseXML, this); 32.441 - Sarissa.__setReadyState__(this, 3); 32.442 - } 32.443 - else { 32.444 - this._sarissa_load(sURI); 32.445 - }; 32.446 - } 32.447 - catch (objException) { 32.448 - this.parseError = -1; 32.449 - } 32.450 - finally { 32.451 - if(this.async == false){ 32.452 - Sarissa.__handleLoad__(this); 32.453 - }; 32.454 + /** 32.455 + * Clear parameters (set them to default values as defined in the stylesheet itself) 32.456 + */ 32.457 + XSLTProcessor.prototype.clearParameters = function(){ 32.458 + for(var nsURI in this.paramsSet){ 32.459 + for(var name in this.paramsSet[nsURI]){ 32.460 + if(nsURI){ 32.461 + this.processor.addParameter(name, "", nsURI); 32.462 + }else{ 32.463 + this.processor.addParameter(name, ""); 32.464 }; 32.465 - return oDoc; 32.466 }; 32.467 - };//if(window.XMLDocument) 32.468 - 32.469 + }; 32.470 + this.paramsSet = new Array(); 32.471 + }; 32.472 +}else{ /* end IE initialization, try to deal with real browsers now ;-) */ 32.473 + if(_SARISSA_HAS_DOM_CREATE_DOCUMENT){ 32.474 /** 32.475 * <p>Ensures the document was loaded correctly, otherwise sets the 32.476 * parseError to -1 to indicate something went wrong. Internal use</p> 32.477 * @private 32.478 */ 32.479 Sarissa.__handleLoad__ = function(oDoc){ 32.480 - if (!oDoc.documentElement || oDoc.documentElement.tagName == "parsererror") 32.481 - oDoc.parseError = -1; 32.482 Sarissa.__setReadyState__(oDoc, 4); 32.483 }; 32.484 - 32.485 /** 32.486 * <p>Attached by an event handler to the load event. Internal use.</p> 32.487 * @private 32.488 @@ -325,7 +335,6 @@ 32.489 _sarissa_XMLDocument_onload = function(){ 32.490 Sarissa.__handleLoad__(this); 32.491 }; 32.492 - 32.493 /** 32.494 * <p>Sets the readyState property of the given DOM Document object. 32.495 * Internal use.</p> 32.496 @@ -336,80 +345,129 @@ 32.497 */ 32.498 Sarissa.__setReadyState__ = function(oDoc, iReadyState){ 32.499 oDoc.readyState = iReadyState; 32.500 + oDoc.readystate = iReadyState; 32.501 if (oDoc.onreadystatechange != null && typeof oDoc.onreadystatechange == "function") 32.502 oDoc.onreadystatechange(); 32.503 }; 32.504 - /** 32.505 - * <p>Factory method to obtain a new DOM Document object</p> 32.506 - * @argument sUri the namespace of the root node (if any) 32.507 - * @argument sUri the local name of the root node (if any) 32.508 - * @returns a new DOM Document 32.509 - */ 32.510 Sarissa.getDomDocument = function(sUri, sName){ 32.511 - var oDoc = document.implementation.createDocument(sUri?sUri:"", sName?sName:"", null); 32.512 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 32.513 + if(!oDoc.onreadystatechange){ 32.514 + 32.515 + /** 32.516 + * <p>Emulate IE's onreadystatechange attribute</p> 32.517 + */ 32.518 + oDoc.onreadystatechange = null; 32.519 + }; 32.520 + if(!oDoc.readyState){ 32.521 + /** 32.522 + * <p>Emulates IE's readyState property, which always gives an integer from 0 to 4:</p> 32.523 + * <ul><li>1 == LOADING,</li> 32.524 + * <li>2 == LOADED,</li> 32.525 + * <li>3 == INTERACTIVE,</li> 32.526 + * <li>4 == COMPLETED</li></ul> 32.527 + */ 32.528 + oDoc.readyState = 0; 32.529 + }; 32.530 oDoc.addEventListener("load", _sarissa_XMLDocument_onload, false); 32.531 return oDoc; 32.532 - }; 32.533 + }; 32.534 + if(window.XMLDocument){ 32.535 + // do nothing 32.536 + }// TODO: check if the new document has content before trying to copynodes, check for error handling in DOM 3 LS 32.537 + else if(_SARISSA_HAS_DOM_FEATURE && window.Document && !Document.prototype.load && document.implementation.hasFeature('LS', '3.0')){ 32.538 + //Opera 9 may get the XPath branch which gives creates XMLDocument, therefore it doesn't reach here which is good 32.539 + /** 32.540 + * <p>Factory method to obtain a new DOM Document object</p> 32.541 + * @argument sUri the namespace of the root node (if any) 32.542 + * @argument sUri the local name of the root node (if any) 32.543 + * @returns a new DOM Document 32.544 + */ 32.545 + Sarissa.getDomDocument = function(sUri, sName){ 32.546 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 32.547 + return oDoc; 32.548 + }; 32.549 + } 32.550 + else { 32.551 + Sarissa.getDomDocument = function(sUri, sName){ 32.552 + var oDoc = document.implementation.createDocument(sUri?sUri:null, sName?sName:null, null); 32.553 + // looks like safari does not create the root element for some unknown reason 32.554 + if(oDoc && (sUri || sName) && !oDoc.documentElement){ 32.555 + oDoc.appendChild(oDoc.createElementNS(sUri, sName)); 32.556 + }; 32.557 + return oDoc; 32.558 + }; 32.559 + }; 32.560 };//if(_SARISSA_HAS_DOM_CREATE_DOCUMENT) 32.561 }; 32.562 //========================================== 32.563 // Common stuff 32.564 //========================================== 32.565 if(!window.DOMParser){ 32.566 - /** 32.567 - * DOMParser is a utility class, used to construct DOMDocuments from XML strings 32.568 - * @constructor 32.569 - */ 32.570 - DOMParser = function() { 32.571 + if(_SARISSA_IS_SAFARI){ 32.572 + /* 32.573 + * DOMParser is a utility class, used to construct DOMDocuments from XML strings 32.574 + * @constructor 32.575 + */ 32.576 + DOMParser = function() { }; 32.577 + /** 32.578 + * Construct a new DOM Document from the given XMLstring 32.579 + * @param sXml the given XML string 32.580 + * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 32.581 + * @return a new DOM Document from the given XML string 32.582 + */ 32.583 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 32.584 + var xmlhttp = new XMLHttpRequest(); 32.585 + xmlhttp.open("GET", "data:text/xml;charset=utf-8," + encodeURIComponent(sXml), false); 32.586 + xmlhttp.send(null); 32.587 + return xmlhttp.responseXML; 32.588 + }; 32.589 + }else if(Sarissa.getDomDocument && Sarissa.getDomDocument() && Sarissa.getDomDocument(null, "bar").xml){ 32.590 + DOMParser = function() { }; 32.591 + DOMParser.prototype.parseFromString = function(sXml, contentType){ 32.592 + var doc = Sarissa.getDomDocument(); 32.593 + doc.loadXML(sXml); 32.594 + return doc; 32.595 + }; 32.596 }; 32.597 - /** 32.598 - * Construct a new DOM Document from the given XMLstring 32.599 - * @param sXml the given XML string 32.600 - * @param contentType the content type of the document the given string represents (one of text/xml, application/xml, application/xhtml+xml). 32.601 - * @return a new DOM Document from the given XML string 32.602 - */ 32.603 - DOMParser.prototype.parseFromString = function(sXml, contentType){ 32.604 - var doc = Sarissa.getDomDocument(); 32.605 - doc.loadXML(sXml); 32.606 - return doc; 32.607 - }; 32.608 - 32.609 }; 32.610 32.611 -if(window.XMLHttpRequest){ 32.612 - Sarissa.IS_ENABLED_XMLHTTP = true; 32.613 -} 32.614 -else if(_SARISSA_IS_IE){ 32.615 - /** 32.616 - * Emulate XMLHttpRequest 32.617 - * @constructor 32.618 - */ 32.619 - XMLHttpRequest = function() { 32.620 - return new ActiveXObject(_SARISSA_XMLHTTP_PROGID); 32.621 - }; 32.622 - Sarissa.IS_ENABLED_XMLHTTP = true; 32.623 -}; 32.624 - 32.625 -if(!window.document.importNode && _SARISSA_IS_IE){ 32.626 +if((typeof(document.importNode) == "undefined") && _SARISSA_IS_IE){ 32.627 try{ 32.628 /** 32.629 - * Implements importNode for the current window document in IE using innerHTML. 32.630 - * Testing showed that DOM was multiple times slower than innerHTML for this, 32.631 - * sorry folks. If you encounter trouble (who knows what IE does behind innerHTML) 32.632 - * please gimme a call. 32.633 + * Implementation of importNode for the context window document in IE. 32.634 + * If <code>oNode</code> is a TextNode, <code>bChildren</code> is ignored. 32.635 * @param oNode the Node to import 32.636 * @param bChildren whether to include the children of oNode 32.637 * @returns the imported node for further use 32.638 */ 32.639 - window.document.importNode = function(oNode, bChildren){ 32.640 - var importNode = document.createElement("div"); 32.641 - if(bChildren) 32.642 - importNode.innerHTML = Sarissa.serialize(oNode); 32.643 - else 32.644 - importNode.innerHTML = Sarissa.serialize(oNode.cloneNode(false)); 32.645 - return importNode.firstChild; 32.646 + document.importNode = function(oNode, bChildren){ 32.647 + var tmp; 32.648 + if (oNode.nodeName=='#text') { 32.649 + return document.createTextElement(oNode.data); 32.650 + } 32.651 + else { 32.652 + if(oNode.nodeName == "tbody" || oNode.nodeName == "tr"){ 32.653 + tmp = document.createElement("table"); 32.654 + } 32.655 + else if(oNode.nodeName == "td"){ 32.656 + tmp = document.createElement("tr"); 32.657 + } 32.658 + else if(oNode.nodeName == "option"){ 32.659 + tmp = document.createElement("select"); 32.660 + } 32.661 + else{ 32.662 + tmp = document.createElement("div"); 32.663 + }; 32.664 + if(bChildren){ 32.665 + tmp.innerHTML = oNode.xml ? oNode.xml : oNode.outerHTML; 32.666 + }else{ 32.667 + tmp.innerHTML = oNode.xml ? oNode.cloneNode(false).xml : oNode.cloneNode(false).outerHTML; 32.668 + }; 32.669 + return tmp.getElementsByTagName("*")[0]; 32.670 + }; 32.671 + 32.672 }; 32.673 - }catch(e){}; 32.674 + }catch(e){ }; 32.675 }; 32.676 if(!Sarissa.getParseErrorText){ 32.677 /** 32.678 @@ -423,17 +481,16 @@ 32.679 */ 32.680 Sarissa.getParseErrorText = function (oDoc){ 32.681 var parseErrorText = Sarissa.PARSED_OK; 32.682 - if(oDoc.parseError != 0){ 32.683 - /*moz*/ 32.684 - if(oDoc.documentElement.tagName == "parsererror"){ 32.685 - parseErrorText = oDoc.documentElement.firstChild.data; 32.686 - parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 32.687 - }/*konq*/ 32.688 - else if(oDoc.documentElement.tagName == "html"){ 32.689 - parseErrorText = Sarissa.getText(oDoc.documentElement.getElementsByTagName("h1")[0], false) + "\n"; 32.690 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("body")[0], false) + "\n"; 32.691 - parseErrorText += Sarissa.getText(oDoc.documentElement.getElementsByTagName("pre")[0], false); 32.692 - }; 32.693 + if(!oDoc.documentElement){ 32.694 + parseErrorText = Sarissa.PARSED_EMPTY; 32.695 + } else if(oDoc.documentElement.tagName == "parsererror"){ 32.696 + parseErrorText = oDoc.documentElement.firstChild.data; 32.697 + parseErrorText += "\n" + oDoc.documentElement.firstChild.nextSibling.firstChild.data; 32.698 + } else if(oDoc.getElementsByTagName("parsererror").length > 0){ 32.699 + var parsererror = oDoc.getElementsByTagName("parsererror")[0]; 32.700 + parseErrorText = Sarissa.getText(parsererror, true)+"\n"; 32.701 + } else if(oDoc.parseError && oDoc.parseError.errorCode != 0){ 32.702 + parseErrorText = Sarissa.PARSED_UNKNOWN_ERROR; 32.703 }; 32.704 return parseErrorText; 32.705 }; 32.706 @@ -446,8 +503,7 @@ 32.707 var nodeType = node.nodeType; 32.708 if(nodeType == Node.TEXT_NODE || nodeType == Node.CDATA_SECTION_NODE){ 32.709 s += node.data; 32.710 - } 32.711 - else if(deep == true 32.712 + } else if(deep == true 32.713 && (nodeType == Node.ELEMENT_NODE 32.714 || nodeType == Node.DOCUMENT_NODE 32.715 || nodeType == Node.DOCUMENT_FRAGMENT_NODE)){ 32.716 @@ -456,33 +512,20 @@ 32.717 }; 32.718 return s; 32.719 }; 32.720 -if(window.XMLSerializer){ 32.721 +if(!window.XMLSerializer 32.722 + && Sarissa.getDomDocument 32.723 + && Sarissa.getDomDocument("","foo", null).xml){ 32.724 /** 32.725 - * <p>Factory method to obtain the serialization of a DOM Node</p> 32.726 - * @returns the serialized Node as an XML string 32.727 + * Utility class to serialize DOM Node objects to XML strings 32.728 + * @constructor 32.729 */ 32.730 - Sarissa.serialize = function(oDoc){ 32.731 - return (new XMLSerializer()).serializeToString(oDoc); 32.732 - }; 32.733 -}else{ 32.734 - if((Sarissa.getDomDocument("","foo", null)).xml){ 32.735 - // see non-IE version 32.736 - Sarissa.serialize = function(oDoc) { 32.737 - // TODO: check for HTML document and return innerHTML instead 32.738 - return oDoc.xml; 32.739 - }; 32.740 - /** 32.741 - * Utility class to serialize DOM Node objects to XML strings 32.742 - * @constructor 32.743 - */ 32.744 - XMLSerializer = function(){}; 32.745 - /** 32.746 - * Serialize the given DOM Node to an XML string 32.747 - * @param oNode the DOM Node to serialize 32.748 - */ 32.749 - XMLSerializer.prototype.serializeToString = function(oNode) { 32.750 - return oNode.xml; 32.751 - }; 32.752 + XMLSerializer = function(){}; 32.753 + /** 32.754 + * Serialize the given DOM Node to an XML string 32.755 + * @param oNode the DOM Node to serialize 32.756 + */ 32.757 + XMLSerializer.prototype.serializeToString = function(oNode) { 32.758 + return oNode.xml; 32.759 }; 32.760 }; 32.761 32.762 @@ -497,7 +540,8 @@ 32.763 * @argument oNode the Node to empty 32.764 */ 32.765 Sarissa.clearChildNodes = function(oNode) { 32.766 - while(oNode.hasChildNodes()){ 32.767 + // need to check for firstChild due to opera 8 bug with hasChildNodes 32.768 + while(oNode.firstChild) { 32.769 oNode.removeChild(oNode.firstChild); 32.770 }; 32.771 }; 32.772 @@ -510,17 +554,19 @@ 32.773 * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 32.774 */ 32.775 Sarissa.copyChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 32.776 + if((!nodeFrom) || (!nodeTo)){ 32.777 + throw "Both source and destination nodes must be provided"; 32.778 + }; 32.779 if(!bPreserveExisting){ 32.780 Sarissa.clearChildNodes(nodeTo); 32.781 }; 32.782 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 32.783 var nodes = nodeFrom.childNodes; 32.784 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 32.785 + if(typeof(ownerDoc.importNode) != "undefined") { 32.786 for(var i=0;i < nodes.length;i++) { 32.787 nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 32.788 }; 32.789 - } 32.790 - else{ 32.791 + } else { 32.792 for(var i=0;i < nodes.length;i++) { 32.793 nodeTo.appendChild(nodes[i].cloneNode(true)); 32.794 }; 32.795 @@ -533,32 +579,34 @@ 32.796 * the move operation, unless you supply a true third parameter</p> 32.797 * @argument nodeFrom the Node to copy the childNodes from 32.798 * @argument nodeTo the Node to copy the childNodes to 32.799 - * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is false 32.800 - */ 32.801 + * @argument bPreserveExisting whether to preserve the original content of nodeTo, default is 32.802 + */ 32.803 Sarissa.moveChildNodes = function(nodeFrom, nodeTo, bPreserveExisting) { 32.804 + if((!nodeFrom) || (!nodeTo)){ 32.805 + throw "Both source and destination nodes must be provided"; 32.806 + }; 32.807 if(!bPreserveExisting){ 32.808 Sarissa.clearChildNodes(nodeTo); 32.809 }; 32.810 - 32.811 var nodes = nodeFrom.childNodes; 32.812 // if within the same doc, just move, else copy and delete 32.813 if(nodeFrom.ownerDocument == nodeTo.ownerDocument){ 32.814 - nodeTo.appendChild(nodes[i]); 32.815 - }else{ 32.816 + while(nodeFrom.firstChild){ 32.817 + nodeTo.appendChild(nodeFrom.firstChild); 32.818 + }; 32.819 + } else { 32.820 var ownerDoc = nodeTo.nodeType == Node.DOCUMENT_NODE ? nodeTo : nodeTo.ownerDocument; 32.821 - if(ownerDoc.importNode && (!_SARISSA_IS_IE)) { 32.822 - for(var i=0;i < nodes.length;i++) { 32.823 - nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 32.824 - }; 32.825 - } 32.826 - else{ 32.827 - for(var i=0;i < nodes.length;i++) { 32.828 - nodeTo.appendChild(nodes[i].cloneNode(true)); 32.829 - }; 32.830 + if(typeof(ownerDoc.importNode) != "undefined") { 32.831 + for(var i=0;i < nodes.length;i++) { 32.832 + nodeTo.appendChild(ownerDoc.importNode(nodes[i], true)); 32.833 + }; 32.834 + }else{ 32.835 + for(var i=0;i < nodes.length;i++) { 32.836 + nodeTo.appendChild(nodes[i].cloneNode(true)); 32.837 + }; 32.838 }; 32.839 Sarissa.clearChildNodes(nodeFrom); 32.840 }; 32.841 - 32.842 }; 32.843 32.844 /**
33.1 --- a/examples/ModPython/CandidateApp/CandidateHandler.py Sun Jun 10 22:52:12 2007 +0000 33.2 +++ b/examples/ModPython/CandidateApp/CandidateHandler.py Sat Jul 07 16:17:29 2007 +0000 33.3 @@ -3,10 +3,10 @@ 33.4 # NOTE: Path manipulation requires manual customisation. 33.5 33.6 import sys 33.7 -sys.path.append("/home/paulb/Software/Python/WebStack") 33.8 -sys.path.append("/home/paulb/Software/Python/XSLTools") 33.9 -sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 33.10 -sys.path.append("/home/paulb/Software/Python/libxml2dom") 33.11 +#sys.path.append("/home/paulb/Software/Python/WebStack") 33.12 +#sys.path.append("/home/paulb/Software/Python/XSLTools") 33.13 +#sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 33.14 +#sys.path.append("/home/paulb/Software/Python/libxml2dom") 33.15 33.16 from WebStack.Adapters import ModPython 33.17 import Candidate
34.1 --- a/examples/ModPython/ConfiguratorApp/ConfiguratorHandler.py Sun Jun 10 22:52:12 2007 +0000 34.2 +++ b/examples/ModPython/ConfiguratorApp/ConfiguratorHandler.py Sat Jul 07 16:17:29 2007 +0000 34.3 @@ -3,10 +3,10 @@ 34.4 # NOTE: Path manipulation requires manual customisation. 34.5 34.6 import sys 34.7 -sys.path.append("/home/paulb/Software/Python/WebStack") 34.8 -sys.path.append("/home/paulb/Software/Python/XSLTools") 34.9 -sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 34.10 -sys.path.append("/home/paulb/Software/Python/libxml2dom") 34.11 +#sys.path.append("/home/paulb/Software/Python/WebStack") 34.12 +#sys.path.append("/home/paulb/Software/Python/XSLTools") 34.13 +#sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 34.14 +#sys.path.append("/home/paulb/Software/Python/libxml2dom") 34.15 34.16 from WebStack.Adapters import ModPython 34.17 import Configurator
35.1 --- a/examples/ModPython/DictionaryApp/DictionaryHandler.py Sun Jun 10 22:52:12 2007 +0000 35.2 +++ b/examples/ModPython/DictionaryApp/DictionaryHandler.py Sat Jul 07 16:17:29 2007 +0000 35.3 @@ -4,11 +4,12 @@ 35.4 # NOTE: Path manipulation requires manual customisation. 35.5 35.6 import sys 35.7 -sys.path.append("/home/paulb/Software/Python/WebStack") 35.8 -sys.path.append("/home/paulb/Software/Python/XSLTools") 35.9 -sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 35.10 -sys.path.append("/home/paulb/Software/Python/libxml2dom") 35.11 -filename = "/home/paulb/Software/Python/XSLTools/docs/LICENCE.txt" 35.12 +#sys.path.append("/home/paulb/Software/Python/WebStack") 35.13 +#sys.path.append("/home/paulb/Software/Python/XSLTools") 35.14 +#sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 35.15 +#sys.path.append("/home/paulb/Software/Python/libxml2dom") 35.16 +#filename = "/home/paulb/Software/Python/XSLTools/docs/LICENCE.txt" 35.17 +filename = "/usr/share/doc/python2.4-xsltools/docs/gpl-3.0.txt" 35.18 encoding = None 35.19 35.20 from WebStack.Adapters import ModPython
36.1 --- a/examples/ModPython/PEP241App/PEP241Handler.py Sun Jun 10 22:52:12 2007 +0000 36.2 +++ b/examples/ModPython/PEP241App/PEP241Handler.py Sat Jul 07 16:17:29 2007 +0000 36.3 @@ -3,10 +3,10 @@ 36.4 # NOTE: Path manipulation requires manual customisation. 36.5 36.6 import sys 36.7 -sys.path.append("/home/paulb/Software/Python/WebStack") 36.8 -sys.path.append("/home/paulb/Software/Python/XSLTools") 36.9 -sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 36.10 -sys.path.append("/home/paulb/Software/Python/libxml2dom") 36.11 +#sys.path.append("/home/paulb/Software/Python/WebStack") 36.12 +#sys.path.append("/home/paulb/Software/Python/XSLTools") 36.13 +#sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 36.14 +#sys.path.append("/home/paulb/Software/Python/libxml2dom") 36.15 36.16 from WebStack.Adapters import ModPython 36.17 import PEP241
37.1 --- a/examples/ModPython/QuestionnaireApp/QuestionnaireHandler.py Sun Jun 10 22:52:12 2007 +0000 37.2 +++ b/examples/ModPython/QuestionnaireApp/QuestionnaireHandler.py Sat Jul 07 16:17:29 2007 +0000 37.3 @@ -3,10 +3,10 @@ 37.4 # NOTE: Path manipulation requires manual customisation. 37.5 37.6 import sys 37.7 -sys.path.append("/home/paulb/Software/Python/WebStack") 37.8 -sys.path.append("/home/paulb/Software/Python/XSLTools") 37.9 -sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 37.10 -sys.path.append("/home/paulb/Software/Python/libxml2dom") 37.11 +#sys.path.append("/home/paulb/Software/Python/WebStack") 37.12 +#sys.path.append("/home/paulb/Software/Python/XSLTools") 37.13 +#sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 37.14 +#sys.path.append("/home/paulb/Software/Python/libxml2dom") 37.15 37.16 from WebStack.Adapters import ModPython 37.17 import Questionnaire
38.1 --- a/examples/ModPython/VerySimpleApp/VerySimpleHandler.py Sun Jun 10 22:52:12 2007 +0000 38.2 +++ b/examples/ModPython/VerySimpleApp/VerySimpleHandler.py Sat Jul 07 16:17:29 2007 +0000 38.3 @@ -3,10 +3,10 @@ 38.4 # NOTE: Path manipulation requires manual customisation. 38.5 38.6 import sys 38.7 -sys.path.append("/home/paulb/Software/Python/WebStack") 38.8 -sys.path.append("/home/paulb/Software/Python/XSLTools") 38.9 -sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 38.10 -sys.path.append("/home/paulb/Software/Python/libxml2dom") 38.11 +#sys.path.append("/home/paulb/Software/Python/WebStack") 38.12 +#sys.path.append("/home/paulb/Software/Python/XSLTools") 38.13 +#sys.path.append("/home/paulb/Software/Python/XSLTools/examples/Common") 38.14 +#sys.path.append("/home/paulb/Software/Python/libxml2dom") 38.15 38.16 from WebStack.Adapters import ModPython 38.17 import VerySimple
39.1 --- a/packages/ubuntu-hoary/python2.4-xsltools/debian/changelog Sun Jun 10 22:52:12 2007 +0000 39.2 +++ b/packages/ubuntu-hoary/python2.4-xsltools/debian/changelog Sat Jul 07 16:17:29 2007 +0000 39.3 @@ -2,8 +2,11 @@ 39.4 39.5 * Improved the Login module, enabling the 39.6 VerySimpleWithLogin example for various frameworks. 39.7 + * Relicensed under the LGPL version 3 or later. 39.8 + * Upgraded to Sarissa 0.9.7.8 (compatible with LGPL/GPL 39.9 + version 3). 39.10 39.11 - -- Paul Boddie <paul@boddie.org.uk> Mon, 11 Jun 2007 00:51:43 +0200 39.12 + -- Paul Boddie <paul@boddie.org.uk> Sat, 7 Jul 2007 18:16:51 +0200 39.13 39.14 xsltools (0.4.5-0ubuntu1) hoary; urgency=low 39.15
40.1 --- a/packages/ubuntu-hoary/python2.4-xsltools/debian/copyright Sun Jun 10 22:52:12 2007 +0000 40.2 +++ b/packages/ubuntu-hoary/python2.4-xsltools/debian/copyright Sat Jul 07 16:17:29 2007 +0000 40.3 @@ -17,28 +17,28 @@ 40.4 40.5 Copyright (C) 2005, 2006, 2007 Paul Boddie <paul@boddie.org.uk> 40.6 40.7 -This library is free software; you can redistribute it and/or 40.8 -modify it under the terms of the GNU Lesser General Public 40.9 -License as published by the Free Software Foundation; either 40.10 -version 2.1 of the License, or (at your option) any later version. 40.11 +This program is free software; you can redistribute it and/or modify it under 40.12 +the terms of the GNU Lesser General Public License as published by the Free 40.13 +Software Foundation; either version 3 of the License, or (at your option) any 40.14 +later version. 40.15 40.16 -This library is distributed in the hope that it will be useful, 40.17 -but WITHOUT ANY WARRANTY; without even the implied warranty of 40.18 -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 40.19 -Lesser General Public License for more details. 40.20 +This program is distributed in the hope that it will be useful, but WITHOUT 40.21 +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS 40.22 +FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 40.23 +details. 40.24 40.25 -You should have received a copy of the GNU Lesser General Public 40.26 -License along with this library; if not, write to the Free Software 40.27 -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA 40.28 +You should have received a copy of the GNU Lesser General Public License along 40.29 +with this program. If not, see <http://www.gnu.org/licenses/>. 40.30 40.31 Copyright and Licensing Information for Other Software 40.32 ------------------------------------------------------ 40.33 40.34 Certain examples in XSLTools use files from the Sarissa distribution (see 40.35 http://sarissa.sourceforge.net). These files were made available under the GNU 40.36 -Lesser General Public License and under the GNU General Public License; the 40.37 -former licence is identical to that found in the LICENCE.txt file, whereas the 40.38 -latter can be found in the LICENCE-Sarissa.txt file. 40.39 +Lesser General Public License (version 2.1 or later) and under the GNU General 40.40 +Public License (version 2 or later); the former licence is found in the 40.41 +LICENCE-Sarissa-lgpl.txt file, whereas the latter is found in the 40.42 +LICENCE-Sarissa-gpl.txt file. 40.43 40.44 The XMLTools.XMLCalendar module uses a modified version of the monthcalendar 40.45 function from the Python standard library's calendar module. This code was