[libxml-compile-perl] 01/05: Imported Upstream version 1.40

gregor herrmann gregoa at debian.org
Wed Dec 25 20:30:55 UTC 2013


This is an automated email from the git hooks/post-receive script.

gregoa pushed a commit to branch master
in repository libxml-compile-perl.

commit 88b0937a372b6351809864cdf52e817b5892b9b0
Author: gregor herrmann <gregoa at debian.org>
Date:   Wed Dec 25 21:26:58 2013 +0100

    Imported Upstream version 1.40
---
 ChangeLog                                |  8 +++++++
 META.json                                |  2 +-
 META.yml                                 |  2 +-
 Makefile.PL                              |  2 +-
 README                                   | 12 +++++------
 README.todo                              |  1 +
 lib/XML/Compile.pm                       |  2 +-
 lib/XML/Compile.pod                      |  4 ++--
 lib/XML/Compile/FAQ.pod                  |  4 ++--
 lib/XML/Compile/Iterator.pm              |  2 +-
 lib/XML/Compile/Iterator.pod             |  4 ++--
 lib/XML/Compile/Schema.pm                |  2 +-
 lib/XML/Compile/Schema.pod               | 37 +++++++++++++++++++++-----------
 lib/XML/Compile/Schema/BuiltInFacets.pm  | 37 +++++++++++++++++++++++++++++---
 lib/XML/Compile/Schema/BuiltInFacets.pod |  4 ++--
 lib/XML/Compile/Schema/BuiltInTypes.pm   |  2 +-
 lib/XML/Compile/Schema/BuiltInTypes.pod  | 15 +++++++++----
 lib/XML/Compile/Schema/Instance.pm       |  2 +-
 lib/XML/Compile/Schema/Instance.pod      |  4 ++--
 lib/XML/Compile/Schema/NameSpaces.pm     |  2 +-
 lib/XML/Compile/Schema/NameSpaces.pod    |  4 ++--
 lib/XML/Compile/Schema/Specs.pm          |  2 +-
 lib/XML/Compile/Schema/Specs.pod         |  4 ++--
 lib/XML/Compile/Translate.pm             | 30 +++++++++++++-------------
 lib/XML/Compile/Translate.pod            |  4 ++--
 lib/XML/Compile/Translate/Reader.pm      |  9 +++++---
 lib/XML/Compile/Translate/Reader.pod     |  4 ++--
 lib/XML/Compile/Translate/Template.pm    |  2 +-
 lib/XML/Compile/Translate/Template.pod   |  4 ++--
 lib/XML/Compile/Translate/Writer.pm      |  8 +++----
 lib/XML/Compile/Translate/Writer.pod     |  4 ++--
 lib/XML/Compile/Util.pm                  |  2 +-
 lib/XML/Compile/Util.pod                 |  4 ++--
 t/21types.t                              |  6 +++---
 t/54nil.t                                |  2 +-
 t/TestTools.pm                           |  2 +-
 36 files changed, 151 insertions(+), 88 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index f4a1b41..1123ea2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -6,6 +6,14 @@ Mark Overmeer.
 
 Plans and unwanted limitations? see README.todo
 
+version 1.40: Tue Nov 26 09:57:33 CET 2013
+	Fixes:
+	- whiteSpace facet on dateTime [magallanes]
+	- support for explicitTimeZone facet on dates
+
+	Improvements:
+	- error on build-in type now shows location [Radek Šťastný]
+
 version 1.39: Fri Oct 11 15:55:05 CEST 2013
 	Fixes:
 	- all: add enumeration and pattern facets on dates.
diff --git a/META.json b/META.json
index 75dae78..c13f8ff 100644
--- a/META.json
+++ b/META.json
@@ -48,5 +48,5 @@
       }
    },
    "release_status" : "stable",
-   "version" : "1.39"
+   "version" : "1.40"
 }
diff --git a/META.yml b/META.yml
index 572a629..653bd02 100644
--- a/META.yml
+++ b/META.yml
@@ -30,4 +30,4 @@ requires:
   XML::Compile::Tester: 0.9
   XML::LibXML: 1.94
   bignum: 0.1
-version: 1.39
+version: 1.40
diff --git a/Makefile.PL b/Makefile.PL
index f2e00da..58c0e95 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -4,7 +4,7 @@ use 5.008;
 
 WriteMakefile
  ( NAME	 	=> 'XML::Compile'
- , VERSION	=> '1.39'
+ , VERSION	=> '1.40'
 
  , PREREQ_PM    =>
    { XML::LibXML               => 1.94
diff --git a/README b/README
index 07e4f6b..92cd721 100644
--- a/README
+++ b/README
@@ -1,5 +1,5 @@
-=== README for XML-Compile version 1.39
-=   Generated on Fri Oct 11 15:55:15 2013 by OODoc 2.01
+=== README for XML-Compile version 1.40
+=   Generated on Tue Nov 26 10:00:24 2013 by OODoc 2.01
 
 There are various ways to install this module:
 
@@ -9,16 +9,16 @@ There are various ways to install this module:
  (2) if you use Windows, have a look at http://ppm.activestate.com/
 
  (3) if you have downloaded this module manually (as root/administrator)
-       gzip -d XML-Compile-1.39.tar.gz
-       tar -xf XML-Compile-1.39.tar
-       cd XML-Compile-1.39
+       gzip -d XML-Compile-1.40.tar.gz
+       tar -xf XML-Compile-1.40.tar
+       cd XML-Compile-1.40
        perl Makefile.PL
        make          # optional
        make test     # optional
        make install
 
 For usage, see the included manual-pages or
-    http://search.cpan.org/dist/XML-Compile-1.39/
+    http://search.cpan.org/dist/XML-Compile-1.40/
 
 Please report problems to
     http://rt.cpan.org/Dist/Display.html?Queue=XML-Compile
diff --git a/README.todo b/README.todo
index 399ae5d..aa93862 100644
--- a/README.todo
+++ b/README.todo
@@ -20,6 +20,7 @@ is incorrect.
  - typemaps on basic types
  - errors on types should show dynamic nested location in structure,
    not path in schema.
+ - the "assertions" facet
 
 = wishlist
  - handle XML::LibXML::Error objects
diff --git a/lib/XML/Compile.pm b/lib/XML/Compile.pm
index 6bf04e3..788fc76 100644
--- a/lib/XML/Compile.pm
+++ b/lib/XML/Compile.pm
@@ -8,7 +8,7 @@ use strict;
 
 package XML::Compile;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 
 use Log::Report 'xml-compile';
diff --git a/lib/XML/Compile.pod b/lib/XML/Compile.pod
index a889998..a3a87d4 100644
--- a/lib/XML/Compile.pod
+++ b/lib/XML/Compile.pod
@@ -289,8 +289,8 @@ other modules.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/FAQ.pod b/lib/XML/Compile/FAQ.pod
index 2f73f6b..7418e4f 100644
--- a/lib/XML/Compile/FAQ.pod
+++ b/lib/XML/Compile/FAQ.pod
@@ -214,8 +214,8 @@ Try turning on debugging with:
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Iterator.pm b/lib/XML/Compile/Iterator.pm
index cc24986..6d80f24 100644
--- a/lib/XML/Compile/Iterator.pm
+++ b/lib/XML/Compile/Iterator.pm
@@ -7,7 +7,7 @@ use strict;
 
 package XML::Compile::Iterator;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 
 use XML::Compile::Util  qw/pack_type type_of_node SCHEMA2001i/;
diff --git a/lib/XML/Compile/Iterator.pod b/lib/XML/Compile/Iterator.pod
index d08bd58..20a084c 100644
--- a/lib/XML/Compile/Iterator.pod
+++ b/lib/XML/Compile/Iterator.pod
@@ -132,8 +132,8 @@ Returns the textContent of the L<node()|XML::Compile::Iterator/"Attributes">, or
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Schema.pm b/lib/XML/Compile/Schema.pm
index 7ad1bf5..b20996c 100644
--- a/lib/XML/Compile/Schema.pm
+++ b/lib/XML/Compile/Schema.pm
@@ -5,7 +5,7 @@
 
 package XML::Compile::Schema;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'XML::Compile';
 
diff --git a/lib/XML/Compile/Schema.pod b/lib/XML/Compile/Schema.pod
index 00fe8fe..9d58924 100644
--- a/lib/XML/Compile/Schema.pod
+++ b/lib/XML/Compile/Schema.pod
@@ -22,12 +22,17 @@ XML::Compile::Schema - Compile a schema into CODE
  # get schema from string
  my $schema = XML::Compile::Schema->new($xml_string);
 
- # get schema from file
+ # get schema from file (most used)
  my $schema = XML::Compile::Schema->new($filename);
+ my $schema = XML::Compile::Schema->new([glob "*.xsd"]);
 
- # adding schemas
+ # the "::Cache" extension has more power
+ my $schema = XML::Compile::Cache->new(\@xsdfiles);
+
+ # adding more schemas, from parsed XML
  $schema->addSchemas($tree);
 
+ # adding more schemas from files
  # three times the same: well-known url, filename in schemadir, url
  # Just as example: usually not needed.
  $schema->importDefinitions('http://www.w3.org/2001/XMLSchema');
@@ -1256,7 +1261,7 @@ You can use hooks, for instance, to block processing parts of the message,
 to create work-arounds for schema bugs, or to extract more information
 during the process than done by default.
 
-=head3 defining hooks
+=head3 Defining hooks
 
 Multiple hooks can active during the compilation process of a type,
 when C<compile()> is called.  During Schema translation, each of the
@@ -1285,7 +1290,7 @@ evaluated before the global hooks.
  my $reader = $schema->compile(READER => $type
   , hook => HOOK, hooks => [ HOOK, HOOK, ...]);
 
-=head3 general syntax
+=head3 General syntax
 
 Each hook has three kinds of parameters:
 
@@ -1330,7 +1335,7 @@ are major differences.  Each of those manual-pages lists the specifics.
 The label tells us when the processing is initiated.  Available labels are
 C<before>, C<replace>, and C<after>.
 
-=head3 hooks on matching types
+=head3 Hooks on matching types
 
 The C<type> selector specifies a complexType of simpleType by name.
 Best is to base the selection on the full name, like C<{ns}type>,
@@ -1343,14 +1348,14 @@ If you use L<XML::Compile::Cache|XML::Compile::Cache> [release 0.90], then you c
 C<prefix:type> as type specification as well.  You have to explicitly
 define prefix to namespace beforehand.
 
-=head3 hooks on matching ids
+=head3 Hooks on matching ids
 
 Matching based on IDs can reach more schema elements: some types are
 anonymous but still have an ID.  Best is to base selection on the full
 ID name, like C<ns#id>, to avoid all kinds of name-space conflicts in
 the future.
 
-=head3 hooks on matching paths
+=head3 Hooks on matching paths
 
 When you see error messages, you always see some representation of
 the path where the problem was discovered.  You can use this path
@@ -1490,6 +1495,14 @@ which list this AUTO gets expanded.
 
   xsi_type => { $base_type => 'AUTO' }   # requires X::C v1.25
 
+L<XML::Compile::Cache|XML::Compile::Cache> (since v1.01) makes using C<xsi:type> easier.  When
+you have a ::Cache based object (for instance a L<XML::Compile::WSDL11|XML::Compile::WSDL11>)
+you can simply say
+
+  $wsdl->addXsiType( $base_type => 'AUTO' )
+
+Now, you do not need to pass the xsi table to each compilation call.
+
 =head2 Key rewrite
 
 [improved with release 1.10]
@@ -1537,7 +1550,7 @@ L<XML::Compile::Util::pack_type()|XML::Compile::Util/"Packing"> or by hand:
     );
   $schema->addKeyRewrite( \%table );
 
-=head3 rewrite via function
+=head3 Rewrite via function
 
 When a CODE reference is provided, it will get called for each key
 which is found in the schema.  Passed are the name-space of the
@@ -1572,7 +1585,7 @@ In the perl representation of the data, the name-spaces get ignored
 (to make the programmer's life simple) but that may cause these nasty
 conflicts.
 
-=head3 rewrite for convenience
+=head3 Rewrite for convenience
 
 In XML, we often see names like C<my-elem-name>, which in Perl
 would be accessed as
@@ -1593,7 +1606,7 @@ then C<< my-elem-name >> in XML will get mapped onto C<< my_elem_name >>
 in Perl, both in the READER as the WRITER.  Be warned that the substitute
 command returns the success, not the modified value!
 
-=head3 pre-defined key_rewrite rules
+=head3 Pre-defined key_rewrite rules
 
 =over 4
 
@@ -1653,8 +1666,8 @@ then still only one prefix is added.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Schema/BuiltInFacets.pm b/lib/XML/Compile/Schema/BuiltInFacets.pm
index 6a039b3..d1465b3 100644
--- a/lib/XML/Compile/Schema/BuiltInFacets.pm
+++ b/lib/XML/Compile/Schema/BuiltInFacets.pm
@@ -8,7 +8,7 @@ no warnings 'recursion';
 
 package XML::Compile::Schema::BuiltInFacets;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'Exporter';
 
@@ -62,6 +62,8 @@ my %facets_date =  # inclusive or exclusive times is rather useless.
   , minInclusive    => \&_d_min
   , enumeration     => \&_enumeration
   , pattern         => \&_pattern
+  , whiteSpace      => \&_d_whitespace
+  , explicitTimeZone=> \&_d_expl_tz
   );
 
 sub builtin_facet($$$$$$$$)
@@ -96,6 +98,16 @@ sub _s_whiteSpace($$$)
           , ws => $ws, path => $path;
 }
 
+sub _d_whiteSpace($$$)
+{   my ($path, undef, $ws) = @_;
+
+    # whitespace processing already in the dateTime parser
+    $ws eq 'collapse'
+        or error __x"illegal whiteSpace facet '{ws}' in {path}"
+          , ws => $ws, path => $path;
+    ();
+}
+
 sub _whitespace_replace($)
 {   (my $value = shift) =~ s/[\t\r\n]/ /gs;
     $value;
@@ -153,8 +165,8 @@ sub _s_minExclusive($$$)
 {   my ($path, $args, $min) = @_;
     $min = _maybe_big $path, $args, $min;
     sub { return $_[0] if $_[0] > $min;
-        error __x"too small exclusive {value}, larger {min} at {where}"
-          , value => $_[0], min => $min, where => $path;
+          error __x"too small exclusive {value}, larger {min} at {where}"
+             , value => $_[0], min => $min, where => $path;
     };
 }
 
@@ -400,4 +412,23 @@ sub _d_max($$$)
     };
 }
 
+sub _d_expl_tz($$$)
+{   my ($path, $args, $enum) = @_;
+    my $tz = qr/Z$ | [+-](?:(?:0[0-9]|1[0-3])\:[0-5][0-9] | 14\:00)$/x;
+
+      $enum eq 'optional'   ? ()
+    : $enum eq 'prohibited'
+    ? sub {   $_[0] !~ $tz
+                 or error __x"timezone forbidden on {date} at {where}"
+                    , date => $_[0], where => $path;
+          }
+    : $enum eq 'required'
+    ? sub {   $_[0] =~ $tz
+                 or error __x"timezone required on {date} at {where}"
+                    , date => $_[0], where => $path;
+          }
+    : error __x"illegal explicitTimeZone facet '{enum}' in {path}"
+          , enum => $enum, path => $path;
+}
+
 1;
diff --git a/lib/XML/Compile/Schema/BuiltInFacets.pod b/lib/XML/Compile/Schema/BuiltInFacets.pod
index 0adbf77..cf9d5fe 100644
--- a/lib/XML/Compile/Schema/BuiltInFacets.pod
+++ b/lib/XML/Compile/Schema/BuiltInFacets.pod
@@ -32,8 +32,8 @@ The content is not for end-users, but called by the schema translator.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Schema/BuiltInTypes.pm b/lib/XML/Compile/Schema/BuiltInTypes.pm
index dfbb81c..16f1fa9 100644
--- a/lib/XML/Compile/Schema/BuiltInTypes.pm
+++ b/lib/XML/Compile/Schema/BuiltInTypes.pm
@@ -8,7 +8,7 @@ no warnings 'recursion';
 
 package XML::Compile::Schema::BuiltInTypes;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'Exporter';
 
diff --git a/lib/XML/Compile/Schema/BuiltInTypes.pod b/lib/XML/Compile/Schema/BuiltInTypes.pod
index 9db4450..a46fcc6 100644
--- a/lib/XML/Compile/Schema/BuiltInTypes.pod
+++ b/lib/XML/Compile/Schema/BuiltInTypes.pod
@@ -216,8 +216,15 @@ because the default is not defined in the standard. For that reason,
 the C<dateTimeStamp> got introduced, which requires the timezone.
 
 When a decimal value is passed, it is interpreted as C<time> value in UTC,
-and will be formatted as required. When reading, the date string will
-not be parsed.
+and will be formatted as required.  This will not work when the dateTime
+extended type has facet C<explicitTimeZome="prohibited">.
+
+When reading, the date string will not be parsed.  Parsing timestamps
+is quite expensive, therefore not preformed automatically.   You may try
+Time::Local in combination with Date::Parse, or Time::Piece::ISO.
+Be very careful with the timezone settings in your program, which effects
+C<mktime> which is used by these implementations.  Best to run your
+application in GMT/UTC/UCT/Z.
 
 =item B<dateTimeStamp>()
 
@@ -355,8 +362,8 @@ Probably the same rules as L<anyURI()|XML::Compile::Schema::BuiltInTypes/"URI">.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Schema/Instance.pm b/lib/XML/Compile/Schema/Instance.pm
index 390fd59..0e11997 100644
--- a/lib/XML/Compile/Schema/Instance.pm
+++ b/lib/XML/Compile/Schema/Instance.pm
@@ -8,7 +8,7 @@ use strict;
 
 package XML::Compile::Schema::Instance;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 
 use Log::Report 'xml-compile', syntax => 'SHORT';
diff --git a/lib/XML/Compile/Schema/Instance.pod b/lib/XML/Compile/Schema/Instance.pod
index 9ffca64..5abd28f 100644
--- a/lib/XML/Compile/Schema/Instance.pod
+++ b/lib/XML/Compile/Schema/Instance.pod
@@ -176,8 +176,8 @@ anyway).
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Schema/NameSpaces.pm b/lib/XML/Compile/Schema/NameSpaces.pm
index 23cfcfd..ea16a66 100644
--- a/lib/XML/Compile/Schema/NameSpaces.pm
+++ b/lib/XML/Compile/Schema/NameSpaces.pm
@@ -8,7 +8,7 @@ use strict;
 
 package XML::Compile::Schema::NameSpaces;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 
 use Log::Report 'xml-compile', syntax => 'SHORT';
diff --git a/lib/XML/Compile/Schema/NameSpaces.pod b/lib/XML/Compile/Schema/NameSpaces.pod
index 0cc114c..5011e71 100644
--- a/lib/XML/Compile/Schema/NameSpaces.pod
+++ b/lib/XML/Compile/Schema/NameSpaces.pod
@@ -137,8 +137,8 @@ This method implements L<XML::Compile::Schema::useSchema()|XML::Compile::Schema/
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Schema/Specs.pm b/lib/XML/Compile/Schema/Specs.pm
index 53fce48..6e88c46 100644
--- a/lib/XML/Compile/Schema/Specs.pm
+++ b/lib/XML/Compile/Schema/Specs.pm
@@ -8,7 +8,7 @@ use strict;
 
 package XML::Compile::Schema::Specs;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 
 use Log::Report 'xml-compile', syntax => 'SHORT';
diff --git a/lib/XML/Compile/Schema/Specs.pod b/lib/XML/Compile/Schema/Specs.pod
index dc210ed..89566fb 100644
--- a/lib/XML/Compile/Schema/Specs.pod
+++ b/lib/XML/Compile/Schema/Specs.pod
@@ -58,8 +58,8 @@ Returns the uri of all predefined schemas.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Translate.pm b/lib/XML/Compile/Translate.pm
index 2400caf..92a6fdf 100644
--- a/lib/XML/Compile/Translate.pm
+++ b/lib/XML/Compile/Translate.pm
@@ -8,7 +8,7 @@ no warnings 'recursion';  # trees can be quite deep
 
 package XML::Compile::Translate;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 
 # Errors are either in _class 'usage': called with request
@@ -204,7 +204,8 @@ sub topLevel($$)
     my $node       = $top->{node};
     my $elems_qual = $top->{efd} eq 'qualified';
     my $qual
-      = exists $self->{elements_qualified} ? ($self->{elements_qualified} || 0)
+      = exists $self->{elements_qualified}
+      ? ($self->{elements_qualified} || 0)
       : $elems_qual ? 'ALL' : 'NONE';
 
     my $remove_form_attribute;
@@ -266,8 +267,8 @@ sub topLevel($$)
     $data;
 }
 
-sub typeByName($$)
-{   my ($self, $tree, $typename) = @_;
+sub typeByName($$$)
+{   my ($self, $where, $tree, $typename) = @_;
 
     my $node  = $tree->node;
 
@@ -281,7 +282,6 @@ sub typeByName($$)
 
     if($def)
     {   # Is built-in
-        my $where = $typename;
         my $st = $self->makeBuiltin($where, $node, $typename, $def, $self->{check_values});
 
         return +{ st => $st, is_list => $def->{is_list} };
@@ -293,7 +293,7 @@ sub typeByName($$)
     my $top = $self->namespaces->find(complexType => $typename)
            || $self->namespaces->find(simpleType  => $typename)
        or error __x"cannot find type {type} at {where}"
-            , type => $typename, where => $tree->path, _class => 'usage';
+            , type => $typename, where => $where, _class => 'usage';
 
     local @$self{ qw/elems_qual attrs_qual tns/ }
                  = $self->nsContext($top);
@@ -350,7 +350,7 @@ sub simpleList($)
 
         my $typename = $self->rel2abs($where, $node, $type);
         $per_item    = $self->blocked($where, simpleType => $typename)
-                    || $self->typeByName($tree, $typename);
+                    || $self->typeByName($where, $tree, $typename);
     }
     else
     {   $tree->nrChildren==1
@@ -393,7 +393,7 @@ sub simpleUnion($)
     {   foreach my $union (split " ", $members)
         {   my $typename = $self->rel2abs($where, $node, $union);
             my $type = $self->blocked($where, simpleType => $typename)
-                    || $self->typeByName($tree, $typename);
+                    || $self->typeByName($where, $tree, $typename);
             my $st   = $type->{st}
                 or error __x"union only of simpleTypes, but {type} is complex at {where}"
                      , type => $typename, where => $where, _class => 'schema';
@@ -429,7 +429,7 @@ sub simpleRestriction($$)
     if(my $basename = $node->getAttribute('base'))
     {   $typename = $self->rel2abs($where, $node, $basename);
         $base     = $self->blocked($where, simpleType => $typename)
-                 || $self->typeByName($tree, $typename);
+                 || $self->typeByName($where, $tree, $typename);
     }
     else
     {   my $simple   = $tree->firstChild
@@ -602,7 +602,7 @@ sub element($)
 
         $comptype = $self->rel2abs($where, $node, $isa);
         $comps    = $self->blocked($where, anyType => $comptype)
-                 || $self->typeByName($tree, $comptype);
+                 || $self->typeByName($where, $tree, $comptype);
     }
     elsif($nr_childs==0)
     {   if(my $subst = $node->getAttribute('substitutionGroup'))
@@ -613,13 +613,13 @@ sub element($)
             if(my $isa = $node->getAttribute('type'))
             {   $comptype  = $self->rel2abs($where, $node, $isa);
                 $comps     = $self->blocked($where, complexType => $comptype)
-                          || $self->typeByName($tree, $comptype);
+                          || $self->typeByName($where, $tree, $comptype);
             }
         }
         unless($comptype)
         {   # no type found, so anyType
             $comptype = $self->anyType($node);
-            $comps    = $self->typeByName($tree, $comptype);
+            $comps    = $self->typeByName($where, $tree, $comptype);
         }
     }
     elsif($nr_childs!=1)
@@ -1077,7 +1077,7 @@ sub attributeOne($)
           : $self->anyType($node);
 
          $type  = $self->blocked($where, simpleType => $typename)
-               || $self->typeByName($tree, $typename);
+               || $self->typeByName($where, $tree, $typename);
     }
 
     my $st      = $type->{st}
@@ -1361,7 +1361,7 @@ sub simpleContentExtension($)
      : $self->anyType($node);
 
     my $basetype = $self->blocked($where, simpleType => $typename)
-                || $self->typeByName($tree, $typename);
+                || $self->typeByName($where, $tree, $typename);
     defined $basetype->{st}
         or error __x"base of simpleContent not simple at {where}"
              , where => $where, _class => 'schema';
@@ -1396,7 +1396,7 @@ sub simpleContentRestriction($$)
     elsif(my $basename  = $node->getAttribute('base'))
     {   $typename = $self->rel2abs($where, $node, $basename);
         $type     = $self->blocked($where, simpleType => $type)
-                 || $self->typeByName($tree, $typename);
+                 || $self->typeByName($where, $tree, $typename);
     }
     else
     {   error __x"no base in complex-restriction, so simpleType required at {where}"
diff --git a/lib/XML/Compile/Translate.pod b/lib/XML/Compile/Translate.pod
index 7f09974..a02aa4d 100644
--- a/lib/XML/Compile/Translate.pod
+++ b/lib/XML/Compile/Translate.pod
@@ -396,8 +396,8 @@ element does not contains sub-elements, otherwise the XML node.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Translate/Reader.pm b/lib/XML/Compile/Translate/Reader.pm
index 4b51f16..71d5a92 100644
--- a/lib/XML/Compile/Translate/Reader.pm
+++ b/lib/XML/Compile/Translate/Reader.pm
@@ -4,7 +4,7 @@
 # Pod stripped from pm file by OODoc 2.01.
 package XML::Compile::Translate::Reader;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'XML::Compile::Translate';
 
@@ -1080,9 +1080,12 @@ sub makeHook($$$$$$)
        {   $xml = $_->($xml, $path);
            defined $xml or return ();
        }
+
+       my $process = sub { $r->($tree->descend($xml)) };
        my @h = @replace
-         ? map $_->($xml,$self,$path,$tag,sub{$r->($tree->descend($xml))}), @replace
-         : $r->($tree->descend($xml));
+         ? map $_->($xml, $self, $path, $tag, $process), @replace
+         : $process->();
+
        @h or return ();
        my $h = @h==1 && !ref $h[0] ? {_ => $h[0]} : $h[1];  # detect simpleType
        foreach my $after (@after)
diff --git a/lib/XML/Compile/Translate/Reader.pod b/lib/XML/Compile/Translate/Reader.pod
index c6f14c1..0623c80 100644
--- a/lib/XML/Compile/Translate/Reader.pod
+++ b/lib/XML/Compile/Translate/Reader.pod
@@ -301,8 +301,8 @@ with some extra checks.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Translate/Template.pm b/lib/XML/Compile/Translate/Template.pm
index 86c03ab..64046d7 100644
--- a/lib/XML/Compile/Translate/Template.pm
+++ b/lib/XML/Compile/Translate/Template.pm
@@ -5,7 +5,7 @@
 
 package XML::Compile::Translate::Template;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'XML::Compile::Translate';
 
diff --git a/lib/XML/Compile/Translate/Template.pod b/lib/XML/Compile/Translate/Template.pod
index 775aad8..20d8c13 100644
--- a/lib/XML/Compile/Translate/Template.pod
+++ b/lib/XML/Compile/Translate/Template.pod
@@ -83,8 +83,8 @@ of the specified class.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Translate/Writer.pm b/lib/XML/Compile/Translate/Writer.pm
index c531e54..3dc7795 100644
--- a/lib/XML/Compile/Translate/Writer.pm
+++ b/lib/XML/Compile/Translate/Writer.pm
@@ -5,7 +5,7 @@
  
 package XML::Compile::Translate::Writer;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'XML::Compile::Translate';
 
@@ -523,8 +523,8 @@ sub makeComplexElement
             if(@not_used)
             {   trace "available tags are: $tags";
                 mistake __xn "tag `{tags}' not used at {path}"
-                  , "unused tags {tags} at {path}"
-                  , scalar @not_used, tags => [sort @not_used], path => $path;
+                 , "unused tags {tags} at {path}"
+                 , scalar @not_used, tags => [sort @not_used], path => $path;
             }
         }
 
@@ -534,7 +534,7 @@ sub makeComplexElement
         {   defined $child or next;
             if(ref $child)
             {   next if UNIVERSAL::isa($child, 'XML::LibXML::Text')
-                     && $child->data eq '' ;
+                     && $child->data eq '';
             }
             else
             {   length $child or next;
diff --git a/lib/XML/Compile/Translate/Writer.pod b/lib/XML/Compile/Translate/Writer.pod
index d46d17e..fb28829 100644
--- a/lib/XML/Compile/Translate/Writer.pod
+++ b/lib/XML/Compile/Translate/Writer.pod
@@ -212,8 +212,8 @@ writer considerably.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/lib/XML/Compile/Util.pm b/lib/XML/Compile/Util.pm
index db301be..c045681 100644
--- a/lib/XML/Compile/Util.pm
+++ b/lib/XML/Compile/Util.pm
@@ -7,7 +7,7 @@ use strict;
 
 package XML::Compile::Util;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'Exporter';
 
diff --git a/lib/XML/Compile/Util.pod b/lib/XML/Compile/Util.pod
index 276159a..23bd875 100644
--- a/lib/XML/Compile/Util.pod
+++ b/lib/XML/Compile/Util.pod
@@ -87,8 +87,8 @@ Translate an XML::LibXML::Node into a packed type.
 
 =head1 SEE ALSO
 
-This module is part of XML-Compile distribution version 1.39,
-built on October 11, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
+This module is part of XML-Compile distribution version 1.40,
+built on November 26, 2013. Website: F<http://perl.overmeer.net/xml-compile/>
 
 Other distributions in this suite:
 L<XML::Compile>,
diff --git a/t/21types.t b/t/21types.t
index dbdc9e4..d4b5aa7 100644
--- a/t/21types.t
+++ b/t/21types.t
@@ -64,13 +64,13 @@ test_rw($schema, test3 => '<test3>-INF</test3>', Math::BigFloat->binf('-'));
 test_rw($schema, test3 => '<test3>NaN</test3>',  Math::BigFloat->bnan); 
 
 my $error = error_r($schema, test3 => '<test3></test3>');
-is($error, "illegal value `' for type {http://www.w3.org/2001/XMLSchema}float");
+is($error, "illegal value `' for type {http://www.w3.org/2001/XMLSchema}float at {http://test-types}test3");
 
 $error = error_w($schema, test3 => 'aap');
-is($error, "illegal value `aap' for type {http://www.w3.org/2001/XMLSchema}float");
+is($error, "illegal value `aap' for type {http://www.w3.org/2001/XMLSchema}float at {http://test-types}test3");
 
 $error = error_w($schema, test3 => '');
-is($error, "illegal value `' for type {http://www.w3.org/2001/XMLSchema}float");
+is($error, "illegal value `' for type {http://www.w3.org/2001/XMLSchema}float at {http://test-types}test3");
 
 ###
 
diff --git a/t/54nil.t b/t/54nil.t
index 960628b..ed2d8f5 100644
--- a/t/54nil.t
+++ b/t/54nil.t
@@ -156,7 +156,7 @@ _XMLWriter
 {   my $error = error_r($schema, test1 => <<_XML);
 <test1 xmlns:xsi="$xsi"><e1></e1><e2 xsi:nil="true"/><e3>45</e3></test1>
 _XML
-   is($error,"illegal value `' for type {http://www.w3.org/2001/XMLSchema}int");
+   is($error,"illegal value `' for type {http://www.w3.org/2001/XMLSchema}int at {http://test-types}test1/e1");
 }
 
 {   my %t1b = (e1 => undef, e2 => undef, e3 => 45);
diff --git a/t/TestTools.pm b/t/TestTools.pm
index 5649e36..067137a 100644
--- a/t/TestTools.pm
+++ b/t/TestTools.pm
@@ -7,7 +7,7 @@ use strict;
 
 package TestTools;
 use vars '$VERSION';
-$VERSION = '1.39';
+$VERSION = '1.40';
 
 use base 'Exporter';
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-perl/packages/libxml-compile-perl.git



More information about the Pkg-perl-cvs-commits mailing list