You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xerces.apache.org by ja...@apache.org on 2005/12/03 16:52:34 UTC
svn commit: r351967 - in /xerces/xerces-p/trunk/samples: DOM2hash.pl
DOMCount.pl DOMCreate.pl DOMPrint.pl EnumVal.pl SAX2Count.pl SAXCount.pl
SEnumVal.pl XMLSimple.pm
Author: jasons
Date: Sat Dec 3 07:52:05 2005
New Revision: 351967
URL: http://svn.apache.org/viewcvs?rev=351967&view=rev
Log:
added new license
added INIT and END blocks
Modified:
xerces/xerces-p/trunk/samples/DOM2hash.pl
xerces/xerces-p/trunk/samples/DOMCount.pl
xerces/xerces-p/trunk/samples/DOMCreate.pl
xerces/xerces-p/trunk/samples/DOMPrint.pl
xerces/xerces-p/trunk/samples/EnumVal.pl
xerces/xerces-p/trunk/samples/SAX2Count.pl
xerces/xerces-p/trunk/samples/SAXCount.pl
xerces/xerces-p/trunk/samples/SEnumVal.pl
xerces/xerces-p/trunk/samples/XMLSimple.pm
Modified: xerces/xerces-p/trunk/samples/DOM2hash.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/DOM2hash.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/DOM2hash.pl (original)
+++ xerces/xerces-p/trunk/samples/DOM2hash.pl Sat Dec 3 07:52:05 2005
@@ -1,60 +1,18 @@
-######################################################################
-#
-# The Apache Software License, Version 1.1
-#
-# Copyright (c) 1999-2000 The Apache Software Foundation. All rights
-# reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. The end-user documentation included with the redistribution,
-# if any, must include the following acknowledgment:
-# "This product includes software developed by the
-# Apache Software Foundation (http://www.apache.org/)."
-# Alternately, this acknowledgment may appear in the software itself,
-# if and wherever such third-party acknowledgments normally appear.
-#
-# 4. The names "Xerces" and "Apache Software Foundation" must
-# not be used to endorse or promote products derived from this
-# software without prior written permission. For written
-# permission, please contact apache\@apache.org.
-#
-# 5. Products derived from this software may not be called "Apache",
-# nor may "Apache" appear in their name, without prior written
-# permission of the Apache Software Foundation.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-# ====================================================================
-#
-# This software consists of voluntary contributions made by many
-# individuals on behalf of the Apache Software Foundation, and was
-# originally based on software copyright (c) 1999, International
-# Business Machines, Inc., http://www.ibm.com . For more information
-# on the Apache Software Foundation, please see
-# <http://www.apache.org/>.
-#
-######################################################################
+ #
+ # Copyright 2002,2004 The Apache Software Foundation.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
use XML::Xerces qw(error);
use Getopt::Long;
@@ -74,6 +32,12 @@
die "Must specify input files\n$USAGE" unless scalar @ARGV;
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
package MyNodeFilter;
use strict;
use vars qw(@ISA);
@@ -123,4 +87,12 @@
if $text !~ /^\s*$/;
}
return $return;
+}
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
}
Modified: xerces/xerces-p/trunk/samples/DOMCount.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/DOMCount.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/DOMCount.pl (original)
+++ xerces/xerces-p/trunk/samples/DOMCount.pl Sat Dec 3 07:52:05 2005
@@ -98,9 +98,16 @@
-f $file or die "File '$file' does not exist!\n";
my $namespace = $OPTIONS{n} || 0;
-my $schema = $OPTIONS{s} || 0;
+my $schema = $OPTIONS{"s"} || 0;
my $validate = $OPTIONS{v} || 'auto';
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
+
if (uc($validate) eq 'ALWAYS') {
$validate = $XML::Xerces::AbstractDOMParser::Val_Always;
} elsif (uc($validate) eq 'NEVER') {
@@ -138,4 +145,13 @@
print STDOUT "$file: duration: ", timestr($td), "\n";
print STDOUT "\t($element_count elems)\n";
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
+}
+
exit(0);
Modified: xerces/xerces-p/trunk/samples/DOMCreate.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/DOMCreate.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/DOMCreate.pl (original)
+++ xerces/xerces-p/trunk/samples/DOMCreate.pl Sat Dec 3 07:52:05 2005
@@ -1,59 +1,19 @@
-######################################################################
-#
-# The Apache Software License, Version 1.1
-#
-# Copyright (c) 1999 The Apache Software Foundation. All rights
-# reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. The end-user documentation included with the redistribution,
-# if any, must include the following acknowledgment:
-# "This product includes software developed by the
-# Apache Software Foundation (http://www.apache.org/)."
-# Alternately, this acknowledgment may appear in the software itself,
-# if and wherever such third-party acknowledgments normally appear.
-#
-# 4. The names "Xerces" and "Apache Software Foundation" must
-# not be used to endorse or promote products derived from this
-# software without prior written permission. For written
-# permission, please contact apache\@apache.org.
-#
-# 5. Products derived from this software may not be called "Apache",
-# nor may "Apache" appear in their name, without prior written
-# permission of the Apache Software Foundation.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-# ====================================================================
-#
-# This software consists of voluntary contributions made by many
-# individuals on behalf of the Apache Software Foundation, and was
-# originally based on software copyright (c) 1999, International
-# Business Machines, Inc., http://www.ibm.com . For more information
-# on the Apache Software Foundation, please see
-# <http://www.apache.org/>.
-#
+ #
+ # Copyright 2002,2004 The Apache Software Foundation.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+
######################################################################
#
# DOMCreate
@@ -67,6 +27,12 @@
# use blib;
use XML::Xerces;
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
#
# create a document
#
@@ -108,6 +74,15 @@
$writer->writeNode($target,$doc);
exit(0);
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
+}
+
#################################################################
# routines to create the document
# no magic here ... they just organize many DOM calls
@@ -140,10 +115,5 @@
$emailNode->appendChild ($emailTextNode);
$person->appendChild ($emailNode);
}
-
-
-__END__
-
-
Modified: xerces/xerces-p/trunk/samples/DOMPrint.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/DOMPrint.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/DOMPrint.pl (original)
+++ xerces/xerces-p/trunk/samples/DOMPrint.pl Sat Dec 3 07:52:05 2005
@@ -114,6 +114,13 @@
die("Unknown value for -v: $validate\n$USAGE");
}
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
+
#
# Parse and print
#
@@ -132,9 +139,19 @@
my $doc = $parser->getDocument();
my $impl = XML::Xerces::DOMImplementationRegistry::getDOMImplementation('LS');
my $writer = $impl->createDOMWriter();
-if ($writer->canSetFeature("$XML::Xerces::XMLUni::fgDOMWRTFormatPrettyPrint",1)) {
- $writer->setFeature("$XML::Xerces::XMLUni::fgDOMWRTFormatPrettyPrint",1);
+if ($writer->canSetFeature($XML::Xerces::XMLUni::fgDOMWRTFormatPrettyPrint,1)) {
+ $writer->setFeature($XML::Xerces::XMLUni::fgDOMWRTFormatPrettyPrint,1);
}
my $target = XML::Xerces::StdOutFormatTarget->new();
$writer->writeNode($target,$doc);
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
+}
+
exit(0);
+
Modified: xerces/xerces-p/trunk/samples/EnumVal.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/EnumVal.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/EnumVal.pl (original)
+++ xerces/xerces-p/trunk/samples/EnumVal.pl Sat Dec 3 07:52:05 2005
@@ -1,70 +1,31 @@
-######################################################################
-#
-# The Apache Software License, Version 1.1
-#
-# Copyright (c) 1999-2000 The Apache Software Foundation. All rights
-# reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. The end-user documentation included with the redistribution,
-# if any, must include the following acknowledgment:
-# "This product includes software developed by the
-# Apache Software Foundation (http://www.apache.org/)."
-# Alternately, this acknowledgment may appear in the software itself,
-# if and wherever such third-party acknowledgments normally appear.
-#
-# 4. The names "Xerces" and "Apache Software Foundation" must
-# not be used to endorse or promote products derived from this
-# software without prior written permission. For written
-# permission, please contact apache\@apache.org.
-#
-# 5. Products derived from this software may not be called "Apache",
-# nor may "Apache" appear in their name, without prior written
-# permission of the Apache Software Foundation.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-# ====================================================================
-#
-# This software consists of voluntary contributions made by many
-# individuals on behalf of the Apache Software Foundation, and was
-# originally based on software copyright (c) 1999, International
-# Business Machines, Inc., http://www.ibm.com . For more information
-# on the Apache Software Foundation, please see
-# <http://www.apache.org/>.
-#
+ #
+ # Copyright 2002,2004 The Apache Software Foundation.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+
######################################################################
#
# EnumVal
#
-# This sample is modeled after its XML4C counterpart. You give it an
+# This sample is modeled after its Xeres-C counterpart. You give it an
# XML file and it parses it and enumerates the DTD Grammar. It shows
# how to access the DTD information stored in the internal data structurs
#
######################################################################
use strict;
+use blib;
use XML::Xerces qw(error);
use Getopt::Long;
use Benchmark;
@@ -88,8 +49,15 @@
my $file = $ARGV[0];
-f $file or die "File '$file' does not exist!\n";
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
my $val_to_use = XML::Xerces::DTDValidator->new();
my $parser = XML::Xerces::SAXParser->new($val_to_use);
+
$parser->setValidationScheme ($XML::Xerces::AbstractDOMParser::Val_Auto);
$parser->setErrorHandler(XML::Xerces::PerlErrorHandler->new());
@@ -153,3 +121,11 @@
print STDOUT "$file: duration: ", timestr($td), "\n";
exit(0);
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
+}
Modified: xerces/xerces-p/trunk/samples/SAX2Count.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/SAX2Count.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/SAX2Count.pl (original)
+++ xerces/xerces-p/trunk/samples/SAX2Count.pl Sat Dec 3 07:52:05 2005
@@ -1,59 +1,19 @@
-######################################################################
-#
-# The Apache Software License, Version 1.1
-#
-# Copyright (c) 1999-2000 The Apache Software Foundation. All rights
-# reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. The end-user documentation included with the redistribution,
-# if any, must include the following acknowledgment:
-# "This product includes software developed by the
-# Apache Software Foundation (http://www.apache.org/)."
-# Alternately, this acknowledgment may appear in the software itself,
-# if and wherever such third-party acknowledgments normally appear.
-#
-# 4. The names "Xerces" and "Apache Software Foundation" must
-# not be used to endorse or promote products derived from this
-# software without prior written permission. For written
-# permission, please contact apache\@apache.org.
-#
-# 5. Products derived from this software may not be called "Apache",
-# nor may "Apache" appear in their name, without prior written
-# permission of the Apache Software Foundation.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-# ====================================================================
-#
-# This software consists of voluntary contributions made by many
-# individuals on behalf of the Apache Software Foundation, and was
-# originally based on software copyright (c) 1999, International
-# Business Machines, Inc., http://www.ibm.com . For more information
-# on the Apache Software Foundation, please see
-# <http://www.apache.org/>.
-#
+ #
+ # Copyright 2002,2004 The Apache Software Foundation.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+
######################################################################
#
# SAX2Count
@@ -99,9 +59,15 @@
-f $file or die "File '$file' does not exist!\n";
my $namespace = $OPTIONS{n} || 0;
-my $schema = $OPTIONS{s} || 0;
+my $schema = $OPTIONS{'s'} || 0;
my $validate = $OPTIONS{v} || 'auto';
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
if (uc($validate) eq 'ALWAYS') {
$validate = $XML::Xerces::SAX2XMLReader::Val_Always;
} elsif (uc($validate) eq 'NEVER') {
@@ -181,3 +147,11 @@
print "characters: ", $CONTENT_HANDLER->{chars}, "\n";
exit(0);
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
+}
Modified: xerces/xerces-p/trunk/samples/SAXCount.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/SAXCount.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/SAXCount.pl (original)
+++ xerces/xerces-p/trunk/samples/SAXCount.pl Sat Dec 3 07:52:05 2005
@@ -1,59 +1,19 @@
-######################################################################
-#
-# The Apache Software License, Version 1.1
-#
-# Copyright (c) 1999-2000 The Apache Software Foundation. All rights
-# reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. The end-user documentation included with the redistribution,
-# if any, must include the following acknowledgment:
-# "This product includes software developed by the
-# Apache Software Foundation (http://www.apache.org/)."
-# Alternately, this acknowledgment may appear in the software itself,
-# if and wherever such third-party acknowledgments normally appear.
-#
-# 4. The names "Xerces" and "Apache Software Foundation" must
-# not be used to endorse or promote products derived from this
-# software without prior written permission. For written
-# permission, please contact apache\@apache.org.
-#
-# 5. Products derived from this software may not be called "Apache",
-# nor may "Apache" appear in their name, without prior written
-# permission of the Apache Software Foundation.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-# ====================================================================
-#
-# This software consists of voluntary contributions made by many
-# individuals on behalf of the Apache Software Foundation, and was
-# originally based on software copyright (c) 1999, International
-# Business Machines, Inc., http://www.ibm.com . For more information
-# on the Apache Software Foundation, please see
-# <http://www.apache.org/>.
-#
+ #
+ # Copyright 2002,2004 The Apache Software Foundation.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+
######################################################################
#
# SAXCount
@@ -98,8 +58,14 @@
my $file = $ARGV[0];
-f $file or die "File '$file' does not exist!\n";
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
my $namespace = $OPTIONS{n} || 0;
-my $schema = $OPTIONS{s} || 0;
+my $schema = $OPTIONS{'s'} || 0;
my $validate = $OPTIONS{v} || 'auto';
if (uc($validate) eq 'ALWAYS') {
@@ -168,3 +134,11 @@
print "whitespace: ", $DOCUMENT_HANDLER->{ws}, "\n";
print "characters: ", $DOCUMENT_HANDLER->{chars}, "\n";
exit(0);
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
+}
Modified: xerces/xerces-p/trunk/samples/SEnumVal.pl
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/SEnumVal.pl?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/SEnumVal.pl (original)
+++ xerces/xerces-p/trunk/samples/SEnumVal.pl Sat Dec 3 07:52:05 2005
@@ -1,70 +1,31 @@
+ #
+ # Copyright 2002,2004 The Apache Software Foundation.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+
######################################################################
#
-# The Apache Software License, Version 1.1
-#
-# Copyright (c) 1999-2000 The Apache Software Foundation. All rights
-# reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-#
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-#
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in
-# the documentation and/or other materials provided with the
-# distribution.
-#
-# 3. The end-user documentation included with the redistribution,
-# if any, must include the following acknowledgment:
-# "This product includes software developed by the
-# Apache Software Foundation (http://www.apache.org/)."
-# Alternately, this acknowledgment may appear in the software itself,
-# if and wherever such third-party acknowledgments normally appear.
-#
-# 4. The names "Xerces" and "Apache Software Foundation" must
-# not be used to endorse or promote products derived from this
-# software without prior written permission. For written
-# permission, please contact apache\@apache.org.
-#
-# 5. Products derived from this software may not be called "Apache",
-# nor may "Apache" appear in their name, without prior written
-# permission of the Apache Software Foundation.
-#
-# THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
-# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
-# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
-# DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
-# ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
-# USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
-# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
-# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
-# OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
-# SUCH DAMAGE.
-# ====================================================================
-#
-# This software consists of voluntary contributions made by many
-# individuals on behalf of the Apache Software Foundation, and was
-# originally based on software copyright (c) 1999, International
-# Business Machines, Inc., http://www.ibm.com . For more information
-# on the Apache Software Foundation, please see
-# <http://www.apache.org/>.
-#
-######################################################################
-#
-# EnumVal
+# SEnumVal
#
-# This sample is modeled after its XML4C counterpart. You give it an
-# XML file and it parses it and enumerates the DTD Grammar. It shows
-# how to access the DTD information stored in the internal data structurs
+# This sample is modeled after its Xerces-C counterpart. You give it an
+# XML file and it parses it and enumerates the Schema Grammar. It shows
+# how to access the Schema information stored in the internal data structurs
#
######################################################################
use strict;
+use blib;
use XML::Xerces qw(error);
use Getopt::Long;
use Benchmark;
@@ -88,8 +49,15 @@
my $file = $ARGV[0];
-f $file or die "File '$file' does not exist!\n";
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Initialize()
+ # when the module is loaded. Xerces.pm no longer does this.
+ #
+ #
+XML::Xerces::XMLPlatformUtils::Initialize();
+
my $val_to_use = XML::Xerces::SchemaValidator->new();
my $parser = XML::Xerces::SAXParser->new($val_to_use);
+
$parser->setValidationScheme ($XML::Xerces::AbstractDOMParser::Val_Auto);
$parser->setErrorHandler(XML::Xerces::PerlErrorHandler->new());
$parser->setDoNamespaces(1);
@@ -157,3 +125,11 @@
print STDOUT "$file: duration: ", timestr($td), "\n";
exit(0);
+
+END {
+ # NOTICE: We must now explicitly call XMLPlatformUtils::Terminate()
+ # when the module is unloaded. Xerces.pm no longer does this for us
+ #
+ #
+ XML::Xerces::XMLPlatformUtils::Terminate();
+}
Modified: xerces/xerces-p/trunk/samples/XMLSimple.pm
URL: http://svn.apache.org/viewcvs/xerces/xerces-p/trunk/samples/XMLSimple.pm?rev=351967&r1=351966&r2=351967&view=diff
==============================================================================
--- xerces/xerces-p/trunk/samples/XMLSimple.pm (original)
+++ xerces/xerces-p/trunk/samples/XMLSimple.pm Sat Dec 3 07:52:05 2005
@@ -1,3 +1,19 @@
+ #
+ # Copyright 2002,2004 The Apache Software Foundation.
+ #
+ # Licensed under the Apache License, Version 2.0 (the "License");
+ # you may not use this file except in compliance with the License.
+ # You may obtain a copy of the License at
+ #
+ # http://www.apache.org/licenses/LICENSE-2.0
+ #
+ # Unless required by applicable law or agreed to in writing, software
+ # distributed under the License is distributed on an "AS IS" BASIS,
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ # See the License for the specific language governing permissions and
+ # limitations under the License.
+ #
+
package XML::Xerces::XMLSimple;
# From: Brian Faull <bf...@mitre.org>
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@xerces.apache.org
For additional commands, e-mail: commits-help@xerces.apache.org