You can subscribe to this list here.
2002 |
Jan
(8) |
Feb
(22) |
Mar
(3) |
Apr
(13) |
May
(1) |
Jun
(4) |
Jul
|
Aug
(5) |
Sep
(9) |
Oct
(36) |
Nov
(7) |
Dec
(15) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(4) |
Feb
(1) |
Mar
(55) |
Apr
(25) |
May
(25) |
Jun
(4) |
Jul
(2) |
Aug
|
Sep
(12) |
Oct
(6) |
Nov
(14) |
Dec
(1) |
2004 |
Jan
(1) |
Feb
(8) |
Mar
(6) |
Apr
(5) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(1) |
Oct
(3) |
Nov
(11) |
Dec
|
2005 |
Jan
(14) |
Feb
(3) |
Mar
(4) |
Apr
(14) |
May
(1) |
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
(2) |
Nov
(2) |
Dec
(1) |
2006 |
Jan
|
Feb
|
Mar
|
Apr
(3) |
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
(8) |
Oct
(19) |
Nov
(5) |
Dec
|
2007 |
Jan
(5) |
Feb
(1) |
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
(8) |
Sep
|
Oct
|
Nov
|
Dec
|
2008 |
Jan
|
Feb
|
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Grant M. <gr...@us...> - 2004-11-20 00:40:24
|
Update of /cvsroot/perl-xml/xml-simple/lib/XML/Simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23672/lib/XML/Simple Modified Files: FAQ.pod Log Message: - add mising comma (spotted by Philip Wooldridge) Index: FAQ.pod =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/lib/XML/Simple/FAQ.pod,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- FAQ.pod 9 Sep 2003 09:35:11 -0000 1.5 +++ FAQ.pod 20 Nov 2004 00:40:15 -0000 1.6 @@ -475,7 +475,7 @@ You probably want to be as specific as you can be too. For instance, the safest way to parse the E<lt>catalogE<gt> example above would be: - my $catalog = XMLin($xml, keyattr => { part => 'partnum'} + my $catalog = XMLin($xml, keyattr => { part => 'partnum'}, forcearray => ['part']); By using the hashref for keyattr, you can specify that only E<lt>partE<gt> |
From: Grant M. <gr...@us...> - 2004-11-17 09:01:10
|
Update of /cvsroot/perl-xml/xml-simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19491 Modified Files: Changes README Log Message: - for 2.13 release Index: Changes =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Changes,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- Changes 5 Apr 2004 09:13:08 -0000 1.17 +++ Changes 17 Nov 2004 09:01:00 -0000 1.18 @@ -1,5 +1,15 @@ Revision history for Perl module XML::Simple +2.13 Nov 17 2004 + - Fixed bug where NoIndent broke KeyAttr (reported by David Haas) + - Added copy_hash helper method which may be overridden to avoid + tied hashes becoming untied during XMLout (patch from Jan Sundberg) + - Fixed bug where GroupTags corrupted source hashref in XMLout + (reported by Bram) + - Tweaks to SuppressEmpty for undef with XMLout (report from jamesb), + behaviour now matches docs and additional behaviour of setting + option to 1 will skip undefined values altogether + 2.12 Apr 05 2004 - added NumericEscape option - added ValueAttr option (patch from Anton Berezin) Index: README =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/README,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- README 5 Apr 2004 09:13:08 -0000 1.17 +++ README 17 Nov 2004 09:01:01 -0000 1.18 @@ -56,7 +56,7 @@ STATUS - This version (2.12) is the current stable release. + This version (2.13) is the current stable release. Please send any feedback to the author: gr...@cp... |
From: Grant M. <gr...@us...> - 2004-11-17 09:01:10
|
Update of /cvsroot/perl-xml/xml-simple/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19491/t Modified Files: 1_XMLin.t Log Message: - for 2.13 release Index: 1_XMLin.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/1_XMLin.t,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- 1_XMLin.t 5 Apr 2004 09:12:51 -0000 1.20 +++ 1_XMLin.t 17 Nov 2004 09:01:01 -0000 1.21 @@ -25,8 +25,8 @@ $@ = ''; eval "use XML::Simple;"; is($@, '', 'Module compiled OK'); -unless($XML::Simple::VERSION eq '2.12') { - diag("Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 2.12)"); +unless($XML::Simple::VERSION eq '2.13') { + diag("Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 2.13)"); } |
From: Grant M. <gr...@us...> - 2004-11-17 08:44:03
|
Update of /cvsroot/perl-xml/xml-simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16082 Modified Files: Makefile.PL Log Message: - tweak check for older Perls Index: Makefile.PL =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Makefile.PL,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- Makefile.PL 9 Sep 2003 09:37:15 -0000 1.6 +++ Makefile.PL 17 Nov 2004 08:43:52 -0000 1.7 @@ -2,6 +2,17 @@ use ExtUtils::MakeMaker; +BEGIN { + if($] < 5.006) { + warn + qq(This version of XML::Simple requires Perl version 5.6 or better.\n) . + qq(You might prefer to install an older version of XML::Simple\n\n) . + qq( perl -MCPAN -e "install 'G/GR/GRANTM/XML-Simple-1.08.tar.gz'"\n\n); + } +} + +require 5.006; + my $make_params = { 'NAME' => 'XML::Simple', 'VERSION_FROM' => 'lib/XML/Simple.pm', @@ -10,10 +21,8 @@ Test::Simple => 0.41, }, 'dist' => { COMPRESS => 'gzip --best', SUFFIX => 'gz' }, - ($] >= 5.005 ? ( - 'AUTHOR' => 'Grant McLean <gr...@cp...>', - 'ABSTRACT_FROM' => 'lib/XML/Simple.pm', - ) : () ) + 'AUTHOR' => 'Grant McLean <gr...@cp...>', + 'ABSTRACT_FROM' => 'lib/XML/Simple.pm', }; print "Checking installed modules ...\n"; |
From: Grant M. <gr...@us...> - 2004-11-17 08:36:59
|
Update of /cvsroot/perl-xml/xml-simple/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14674/t Modified Files: 2_XMLout.t Log Message: - fix inconsistencies in SuppressEmpty with XMLout Index: 2_XMLout.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/2_XMLout.t,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- 2_XMLout.t 17 Nov 2004 08:35:12 -0000 1.13 +++ 2_XMLout.t 17 Nov 2004 08:36:49 -0000 1.14 @@ -7,7 +7,7 @@ $^W = 1; -plan tests => 193; +plan tests => 196; ############################################################################## @@ -654,21 +654,20 @@ local($^W) = 1; my $warn = ''; local $SIG{__WARN__} = sub { $warn = $_[0] }; - $_ = eval { - $ref = { 'tag' => undef }; - XMLout($ref); - }; + $ref = { 'one' => 1, 'two' => undef }; + my $expect = qr/^<\w+(\s+one="1"|\s+two=""){2}/; + + $_ = XMLout($ref); like($warn, qr/Use of uninitialized value/, 'caught warning re uninitialised value'); + like($_, $expect, 'undef maps to any empty attribute by default'); # unless warnings are disabled $^W = 0; $warn = ''; - $_ = eval { - $ref = { 'tag' => undef }; - XMLout($ref); - }; + $_ = XMLout($ref); is($warn, '', 'no warning re uninitialised value if warnings off'); + like($_, $expect, 'undef still maps to any empty attribute'); } @@ -680,6 +679,14 @@ 'uninitialiased values successfully mapped to empty elements'); +# Set suppressempty to 1 to not output anything for undef + +$ref = { 'one' => 1, 'two' => undef }; +$_ = XMLout($ref, suppressempty => 1, noattr => 1); +like($_, qr{^\s*<(\w*)\s*>\s*<one\s*>1</one\s*>\s*</\1\s*>\s*$}s, + 'uninitialiased values successfully skipped'); + + # Test the keeproot option $ref = { |
From: Grant M. <gr...@us...> - 2004-11-17 08:36:59
|
Update of /cvsroot/perl-xml/xml-simple/lib/XML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14674/lib/XML Modified Files: Simple.pm Log Message: - fix inconsistencies in SuppressEmpty with XMLout Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/lib/XML/Simple.pm,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- Simple.pm 17 Nov 2004 08:35:12 -0000 1.21 +++ Simple.pm 17 Nov 2004 08:36:49 -0000 1.22 @@ -1375,6 +1375,7 @@ my $value = $ref->{$key}; next if(substr($key, 0, 1) eq '-'); if(!defined($value)) { + next if $self->{opt}->{suppressempty}; unless(exists($self->{opt}->{suppressempty}) and !defined($self->{opt}->{suppressempty}) ) { @@ -1384,7 +1385,7 @@ $text_content = ''; } else { - $value = {}; + $value = exists($self->{opt}->{suppressempty}) ? {} : ''; } } @@ -2477,10 +2478,11 @@ the empty string respectively. The latter two alternatives are a little easier to test for in your code than a hash with no keys. -The option also controls what C<XMLout()> does with undefined values. -Setting the option to undef causes undefined values to be output as -empty elements (rather than empty attributes), it also suppresses the -generation of warnings about undefined values. +The option also controls what C<XMLout()> does with undefined values. Setting +the option to undef causes undefined values to be output as empty elements +(rather than empty attributes), it also suppresses the generation of warnings +about undefined values. Setting the option to a true value (eg: 1) causes +undefined values to be skipped altogether on output. =head2 ValueAttr => [ names ] I<# in - handy> |
From: Grant M. <gr...@us...> - 2004-11-17 08:35:22
|
Update of /cvsroot/perl-xml/xml-simple/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13925/t Modified Files: 2_XMLout.t Log Message: - fix GroupTags/XMLout corrupting Index: 2_XMLout.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/2_XMLout.t,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -r1.12 -r1.13 --- 2_XMLout.t 5 Apr 2004 09:12:51 -0000 1.12 +++ 2_XMLout.t 17 Nov 2004 08:35:12 -0000 1.13 @@ -7,7 +7,7 @@ $^W = 1; -plan tests => 190; +plan tests => 193; ############################################################################## @@ -844,6 +844,11 @@ ok(s{\s*<dirs>LIST</dirs>\s*}{ELEM}s, 'group OK'); like($_, qr{^<(\w+)\s*>ELEMELEMELEM</\1>$}, 'document OK'); +is_deeply($ref, { + prefix => 'before', + dirs => [ '/usr/bin', '/usr/local/bin' ], + suffix => 'after', +}, 'original ref is not messed with'); # Try again with multiple groupings @@ -957,6 +962,34 @@ 'NoIndent worked ok'); +# Check 'NoIndent' works with KeyAttr + +$ref = { + person => { + bob => { age => 25 }, + kate => { age => 22 }, + }, +}; + +# Expect: +# +# <opt><person name="bob" age="25"><person name="kate" age="22"></opt> +# + +$_ = XMLout($ref, NoIndent => 1, KeyAttr => {person => 'name'}); + +is_deeply(XMLin($_), $ref, 'parses ok'); +like($_, qr{ + <opt> + ( + <person(\s+name="bob"|\s+age="25"){2}\s*/> + |<person(\s+name="kate"|\s+age="22"){2}\s*/> + ){2} + </opt> +}sx, +'NoIndent worked ok with KeyAttr'); + + # Try the 'AttrIndent' option (assume NoSort defaults to off) $ref = { |
From: Grant M. <gr...@us...> - 2004-11-17 08:35:22
|
Update of /cvsroot/perl-xml/xml-simple/lib/XML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13925/lib/XML Modified Files: Simple.pm Log Message: - fix GroupTags/XMLout corrupting Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/lib/XML/Simple.pm,v retrieving revision 1.20 retrieving revision 1.21 diff -u -d -r1.20 -r1.21 --- Simple.pm 5 Apr 2004 09:12:47 -0000 1.20 +++ Simple.pm 17 Nov 2004 08:35:12 -0000 1.21 @@ -53,7 +53,7 @@ @ISA = qw(Exporter); @EXPORT = qw(XMLin XMLout); @EXPORT_OK = qw(xml_in xml_out); -$VERSION = '2.12'; +$VERSION = '2.13'; $PREFERRED_PARSER = undef; my $StrictMode = 0; @@ -765,7 +765,7 @@ } - # Special cleanup for {foldattr} which could be arrayref or hashref + # Special cleanup for {valueattr} which could be arrayref or hashref if(exists($opt->{valueattr})) { if(ref($opt->{valueattr}) eq 'ARRAY') { @@ -1247,6 +1247,7 @@ my $nl = "\n"; + my $is_root = $indent eq '' ? 1 : 0; # Warning, dirty hack! if($self->{opt}->{noindent}) { $indent = ''; $nl = ''; @@ -1279,7 +1280,7 @@ if(UNIVERSAL::isa($ref, 'HASH') # It is a hash and keys %$ref # and it's not empty and $self->{opt}->{keyattr} # and folding is enabled - and $indent # and its not the root element + and !$is_root # and its not the root element ) { $ref = $self->hash_to_array($name, $ref); } @@ -1296,6 +1297,7 @@ # Reintermediate grouped values if applicable if($self->{opt}->{grouptags}) { + $ref = $self->copy_hash($ref); while(my($key, $val) = each %$ref) { if($self->{opt}->{grouptags}->{$key}) { $ref->{$key} = { $self->{opt}->{grouptags}->{$key} => $val }; @@ -1309,7 +1311,7 @@ my $nsdecls = ''; my $default_ns_uri; if($self->{nsup}) { - $ref = { %$ref }; # Make a copy before we mess with it + $ref = $self->copy_hash($ref); $self->{nsup}->push_context(); # Look for default namespace declaration first @@ -1573,8 +1575,9 @@ if(ref($self->{opt}->{keyattr}) eq 'HASH') { return($hashref) unless(defined($self->{opt}->{keyattr}->{$parent})); - push(@$arrayref, { $self->{opt}->{keyattr}->{$parent}->[0] => $key, - %$value }); + push @$arrayref, $self->copy_hash( + $value, $self->{opt}->{keyattr}->{$parent}->[0] => $key + ); } else { push(@$arrayref, { $self->{opt}->{keyattr}->[0] => $key, %$value }); @@ -1586,6 +1589,22 @@ ############################################################################## +# Method: copy_hash() +# +# Helper routine for hash_to_array(). When unfolding a hash of hashes into +# an array of hashes, we need to copy the key from the outer hash into the +# inner hash. This routine makes a copy of the original hash so we don't +# destroy the original data structure. You might wish to override this +# method if you're using tied hashes and don't want them to get untied. +# + +sub copy_hash { + my($self, $orig, @extra) = @_; + + return { @extra, %$orig }; +} + +############################################################################## # Methods required for building trees from SAX events ############################################################################## @@ -2156,6 +2175,9 @@ searchpath => [ '/usr/bin', '/usr/local/bin', '/usr/X11/bin' ] } +The grouping element (C<< <searchpath> >> in the example) must not contain any +attributes or elements other than the grouped element. + You can specify multiple 'grouping element' to 'grouped element' mappings in the same hashref. If this option is combined with C<KeyAttr>, the array folding will occur first and then the grouped element names will be eliminated. @@ -2407,7 +2429,7 @@ 'OutputFile' option. This option also accepts an IO handle object - especially useful in Perl 5.8.0 -and later for writing out in an encoding other than UTF-8, eg: +and later for output using an encoding other than UTF-8, eg: open my $fh, '>:encoding(iso-8859-1)', $path or die "open($path): $!"; XMLout($ref, OutputFile => $fh); |
From: Grant M. <gr...@us...> - 2004-11-11 09:25:24
|
Update of /cvsroot/perl-xml/perl-xml-faq In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18818 Modified Files: perl-xml-faq.xml Log Message: - added Q&A re 'use utf8;' in 5.8 Index: perl-xml-faq.xml =================================================================== RCS file: /cvsroot/perl-xml/perl-xml-faq/perl-xml-faq.xml,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- perl-xml-faq.xml 11 Nov 2004 08:57:33 -0000 1.18 +++ perl-xml-faq.xml 11 Nov 2004 09:25:15 -0000 1.19 @@ -1401,7 +1401,7 @@ </formalpara> <programlisting><![CDATA[ -use utf8; +use utf8; # Only needed for 5.6, not 5.8 or later s/([\x{80}-\x{FFFF}])/'&#' . ord($1) . ';'/gse; ]]></programlisting> @@ -1413,8 +1413,8 @@ s/([^\x20-\x7F])/'&#' . ord($1) . ';'/gse; ]]></programlisting> - <para>This version does not require 'use utf8'; does not require a - version of Perl which recognises \x{NN} and handles characters + <para>This version does not require 'use utf8' with Perl 5.6; does not + require a version of Perl which recognises \x{NN} and handles characters outside the 0x80-0xFFFF range.</para> <para>Even if you are outputting Latin1, you will need to use a technique @@ -1495,7 +1495,7 @@ </formalpara> <programlisting><![CDATA[ -use utf8; +use utf8; # Not required with 5.8 or later my $u_city = "S\x{E3}o Paulo"; my $l_city = pack("C*", unpack('U*', $u_city)); @@ -1581,6 +1581,33 @@ </qandaentry> + <qandaentry id="use_utf8"> + <question> + <para>What does 'use utf8;' do?</para> + </question> + + <answer> + + <para>In Perl 5.8 and later, the sole use of the 'use utf8;' pragma is to + tell Perl that your script is written in UTF-8 (ie: any non-ASCII or + multibyte characters should be interpreted as UTF-8). So if your code is + plain ASCII, you don't need the pragma.</para> + + <para>The original UTF8 support in Perl 5.6 required the pragma to + enable wide character support for builtin functions (such as length) + and the regular expression engine. This is no longer necessary in 5.8 + since Perl automatically uses character rather than byte semantics + with strings that have the utf8 flag set.</para> + + <para>You can find out more about how Unicode handling changed in + Perl 5.8 from the <ulink + url="http://search.cpan.org/dist/perl/pod/perl58delta.pod">perl58delta.pod</ulink> + file that ships with Perl.</para> + + </answer> + + </qandaentry> + <qandaentry id="encoding_common"> <question> <para>What are some commonly encountered problems with encodings?</para> |
From: Grant M. <gr...@us...> - 2004-11-11 08:57:42
|
Update of /cvsroot/perl-xml/perl-xml-faq In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13324 Modified Files: perl-xml-faq.xml Log Message: - fixed up PPM syntax as per email from V Barta Index: perl-xml-faq.xml =================================================================== RCS file: /cvsroot/perl-xml/perl-xml-faq/perl-xml-faq.xml,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- perl-xml-faq.xml 21 Oct 2004 18:01:32 -0000 1.17 +++ perl-xml-faq.xml 11 Nov 2004 08:57:33 -0000 1.18 @@ -855,7 +855,7 @@ <programlisting><![CDATA[ C:\> ppm -ppm> set repository RK http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58 +ppm> repository add RK http://theoryx5.uwinnipeg.ca/cgi-bin/ppmserver?urn:/PPMServer58 ppm> set save ppm> install XML::LibXML ]]></programlisting> |
From: Petr C. <pci...@us...> - 2004-11-10 08:27:29
|
Update of /cvsroot/perl-xml/sax-perl-org In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv15457 Modified Files: changes-2.1.html changes-2.1.xml Log Message: Index: changes-2.1.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/changes-2.1.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- changes-2.1.html 25 Oct 2004 09:22:38 -0000 1.2 +++ changes-2.1.html 10 Nov 2004 08:26:59 -0000 1.3 @@ -190,5 +190,18 @@ To support all of the above mentioned types. <br /> </p> + <p class="open"> + <b>Issue <a name="I12">I12</a> + </b> + <i> status: open, resolution: none</i> + <br /> + The spec should be more explicit about what a document locator is + supposed to return. It could for example read: + <br /> + If possible, a Perl SAX driver should provide the line and column position + of the first character after the text associated with the document event. + The first line is line 1; the first column in each line is column 1. + <br /> + </p> </body> </html> Index: changes-2.1.xml =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/changes-2.1.xml,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- changes-2.1.xml 25 Oct 2004 09:22:38 -0000 1.2 +++ changes-2.1.xml 10 Nov 2004 08:26:59 -0000 1.3 @@ -165,6 +165,18 @@ </para> </issue> + <issue id="I12" status="open" resolution="none" change-ref=""> + <para> + The spec should be more explicit about what a document locator is + supposed to return. It could for example read: + </para> + <para> + If possible, a Perl SAX driver should provide the line and column position + of the first character after the text associated with the document event. + The first line is line 1; the first column in each line is column 1. + </para> + </issue> + </issue-list> </change-log> |
From: Petr C. <pci...@us...> - 2004-10-25 09:27:23
|
Update of /cvsroot/perl-xml/sax-perl-org In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23212 Modified Files: sax-2.1-adv.html sax-2.1-idx.html sax-2.1.html Log Message: Index: sax-2.1-adv.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1-adv.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sax-2.1-adv.html 25 Oct 2004 09:22:38 -0000 1.3 +++ sax-2.1-adv.html 25 Oct 2004 09:27:14 -0000 1.4 @@ -1017,10 +1017,8 @@ a Filter will be available from CPAN in the not distant future. </p> -<!-- -<p>[FIXME: need to list package/class name equivalents for all -hashes.]</p> ---> +<div>$Revision$</div> +<div>$Date$</div> </body> </html> Index: sax-2.1-idx.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1-idx.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- sax-2.1-idx.html 25 Oct 2004 09:22:38 -0000 1.4 +++ sax-2.1-idx.html 25 Oct 2004 09:27:14 -0000 1.5 @@ -199,7 +199,8 @@ </div> </div> -<div>Revision: $Revision$, $Date$</div> +<div>$Revision$</div> +<div>$Date$</div> </body> </html> Index: sax-2.1.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sax-2.1.html 25 Oct 2004 09:22:38 -0000 1.3 +++ sax-2.1.html 25 Oct 2004 09:27:14 -0000 1.4 @@ -374,5 +374,8 @@ <li><a href="sax-2.1-adv.html#Java">Java and DOM Compatibility</a></li> </ul> - </body> + +<div>$Revision$</div> +<div>$Date$</div> +</body> </html> |
From: Petr C. <pci...@us...> - 2004-10-25 09:22:52
|
Update of /cvsroot/perl-xml/sax-perl-org In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22447 Modified Files: changes-2.1.html changes-2.1.xml changes.css sax-2.1-adv.html sax-2.1-idx.html sax-2.1.html Added Files: perl-sax.css Log Message: --- NEW FILE: perl-sax.css --- BODY { font-size: 11pt; color: #173c82; } DIV { padding: 5px 5px 5px 20px; margin: 0px 0px 5px 0px; border: 1px solid #173c82; } UL { margin: 0px 0px 0px 0px; } DIV.Header { background-color: #dce4ec; } DIV.Title { font-size: 20pt; padding: 0px 0px 5px 0px; border: none; } DIV.SubTitle { font-size: 14pt; padding: 0px 0px 0px 0px; border: none; } Index: changes-2.1.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/changes-2.1.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- changes-2.1.html 27 Sep 2004 09:03:18 -0000 1.1 +++ changes-2.1.html 25 Oct 2004 09:22:38 -0000 1.2 @@ -139,5 +139,56 @@ (to have the UTF-8 flag on). <br /> </p> + <p class="open"> + <b>Issue <a name="I9">I9</a> + </b> + <i> status: open, resolution: none</i> + <br /> + Input sources don't have a String property defined though the + parse_string() method exists and use it. Current XML::SAX::Base version + (0.12) already implements String property. The properties are checked in + this order: CharacterStream, ByteStream, String, SystemId. + <br /> + Suggested solution: To add the following paragraph: + <br /> + String - The character or byte string for this input source. + If there is a string specified, the SAX parser will ignore any byte + or character stream and will not attempt to open a URI connection to + the system identifier. + If the UTF-8 flag of the string is turned on, the effect is as if + the Encoding property is set to UTF-8. + <br /> + The order of properties to be checked has to be determined. + <br /> + </p> + <p class="open"> + <b>Issue <a name="I10">I10</a> + </b> + <i> status: open, resolution: none</i> + <br /> + parse_file() is meant to accept streams in Perl SAX, while other + modules (such as XML::LibXML and XML::Parser) accept system paths for + this method. + <br /> + Suggested solution: + To change parse_file() so that it accepts a string in addition to the + currently supported types. Alternatively, parse_file() can be considered + deprecated (though supported for compatibility) and another method + (? parse_stream) used to accept streams. + <br /> + </p> + <p class="open"> + <b>Issue <a name="I11">I11</a> + </b> + <i> status: open, resolution: none</i> + <br /> + The specification should state explicitly what is meant be "streams", + what are supported types for parse_file(): file handles, + glob references, IO::Handle sub-classes, ... + <br /> + Suggested solution: + To support all of the above mentioned types. + <br /> + </p> </body> </html> Index: changes-2.1.xml =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/changes-2.1.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- changes-2.1.xml 27 Sep 2004 09:03:18 -0000 1.1 +++ changes-2.1.xml 25 Oct 2004 09:22:38 -0000 1.2 @@ -115,6 +115,56 @@ </para> </issue> + <issue id="I9" status="open" resolution="none" change-ref=""> + <para> + Input sources don't have a String property defined though the + parse_string() method exists and use it. Current XML::SAX::Base version + (0.12) already implements String property. The properties are checked in + this order: CharacterStream, ByteStream, String, SystemId. + </para> + <para> + Suggested solution: To add the following paragraph: + </para> + <para> + String - The character or byte string for this input source. + If there is a string specified, the SAX parser will ignore any byte + or character stream and will not attempt to open a URI connection to + the system identifier. + If the UTF-8 flag of the string is turned on, the effect is as if + the Encoding property is set to UTF-8. + </para> + <para> + The order of properties to be checked has to be determined. + </para> + </issue> + + <issue id="I10" status="open" resolution="none" change-ref=""> + <para> + parse_file() is meant to accept streams in Perl SAX, while other + modules (such as XML::LibXML and XML::Parser) accept system paths for + this method. + </para> + <para> + Suggested solution: + To change parse_file() so that it accepts a string in addition to the + currently supported types. Alternatively, parse_file() can be considered + deprecated (though supported for compatibility) and another method + (? parse_stream) used to accept streams. + </para> + </issue> + + <issue id="I11" status="open" resolution="none" change-ref=""> + <para> + The specification should state explicitly what is meant be "streams", + what are supported types for parse_file(): file handles, + glob references, IO::Handle sub-classes, ... + </para> + <para> + Suggested solution: + To support all of the above mentioned types. + </para> + </issue> + </issue-list> </change-log> Index: changes.css =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/changes.css,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- changes.css 27 Sep 2004 09:03:18 -0000 1.1 +++ changes.css 25 Oct 2004 09:22:38 -0000 1.2 @@ -4,7 +4,7 @@ .change { border: solid 1px #999999; - background-color: #bbbbbb; + background-color: #bbeeff; } .open { Index: sax-2.1-adv.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1-adv.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sax-2.1-adv.html 6 Aug 2004 10:23:38 -0000 1.2 +++ sax-2.1-adv.html 25 Oct 2004 09:22:38 -0000 1.3 @@ -1,10 +1,19 @@ <!-- $Id$ --> <html> - <head> - <title>Advanced Features of the Perl SAX 2.1 Binding</title> - <meta name="keywords" content="XML SGML SAX Perl libxml libxml-perl" /> - </head> - <body> +<head> +<title>Advanced Features of the Perl SAX 2.1 Binding</title> +<meta name="keywords" content="XML SGML SAX Perl libxml libxml-perl" /> +<style type="text/css"> +.prop { + font-family: monospace; + font-weight: bold; + vertical-align: top; + padding-right: 1em; +} +</style> +</head> + +<body> <h1>Advanced SAX</h1> @@ -49,7 +58,7 @@ <tt>end_document()</tt> handler.</dd></dl></p> <p> -<dl><dt><b><tt>ContentHandler</tt></b></dt> +<dl><dt class="prop">ContentHandler</dt> <dd> Object to receive document content events. The <tt>ContentHandler</tt>, with additional events defined below, is the @@ -59,7 +68,7 @@ reported by the SAX parser will be silently ignored.</dd></dl></p> <p> -<dl><dt><b><tt>DTDHandler</tt></b></dt> +<dl><dt class="prop">DTDHandler</dt> <dd> Object to receive basic DTD events. If the application does not register a DTD handler or DTD event handlers on the default handler, @@ -67,14 +76,14 @@ ignored.</dd></dl></p> <p> -<dl><dt><b><tt>EntityResolver</tt></b></dt> +<dl><dt class="prop">EntityResolver</dt> <dd> Object to resolve external entities. If the application does not register an entity resolver or entity events on the default handler, the SAX parser will perform its own default resolution.</dd></dl></p> <p> -<dl><dt><b><tt>ErrorHandler</tt></b></dt> +<dl><dt class="prop">ErrorHandler</dt> <dd> Object to receive error-message events. If the application does not register an error handler or error event handlers on the default @@ -84,7 +93,7 @@ avoid unexpected bugs.</dd></dl></p> <p> -<dl><dt><b><tt>LexicalHandler</tt></b></dt> +<dl><dt class="prop">LexicalHandler</dt> <dd> Object to receive lexical events. If the application does not register a lexical handler or lexical event handlers on the default @@ -92,7 +101,7 @@ ignored.</dd></dl></p> <p> -<dl><dt><b><tt>DeclHandler</tt></b></dt> +<dl><dt class="prop">DeclHandler</dt> <dd> Object to receive information about DTD declarations. If the application does not register a declaration handler or declaration @@ -100,14 +109,14 @@ the SAX parser will be silently ignored.</dd></dl></p> <p> -<dl><dt><b><tt>Source</tt></b></dt> +<dl><dt class="prop">Source</dt> <dd> A hash reference containing information about the XML instance to be parsed. See <a href="#InputSources">Input Sources</a> below. Note that <tt>Source</tt> cannot be changed during the parse</dd></dl></p> <p> -<dl><dt><strong><tt>Features</tt></strong></dt> +<dl><dt class="prop">Features</dt> <dd> A hash reference containing Feature information, as described below. Features can be set at runtime but not directly on the @@ -255,7 +264,6 @@ </p> - <h2><a name="InputSources">Input Sources</a></h2> <p>Input sources may be provided to parser objects or are returned by @@ -263,14 +271,14 @@ properties:</p> <dl> -<dt><b><tt>PublicId</tt></b></dt> +<dt class="prop">PublicId</dt> <dd>The public identifier of this input source. <p>The public identifier is always optional: if the application writer includes one, it will be provided as part of the location information.</p></dd> -<dt><b><tt>SystemId</tt></b></dt> +<dt class="prop">SystemId</dt> <dd>The system identifier (URI) of this input source. <p>The system identifier is optional if there is a byte stream or a @@ -284,7 +292,7 @@ pointed to by the system identifier, it can register the encoding using the <tt>Encoding</tt> property.</dd> -<dt><b><tt>ByteStream</tt></b></dt> +<dt class="prop">ByteStream</dt> <dd>The byte stream for this input source. <p>The SAX parser will ignore this if there is also a character stream @@ -294,7 +302,7 @@ If the application knows the character encoding of the byte stream, it should set the <tt>Encoding</tt> property.</dd> -<dt><b><tt>CharacterStream</tt></b></dt> +<dt class="prop">CharacterStream</dt> <dd>The character stream for this input source. <p>If there is a character stream specified, the SAX parser will @@ -306,12 +314,11 @@ and only works under Perl 5.7.2 or higher using PerlIO. To get a single character, or number of characters from it, use the perl core read() function. To get a single byte from it (or number of bytes), you can -use sysread(). The encoding of the stream should be in the Encoding -entry for the Source.</p> +use sysread().</p> </dd> -<dt><b><tt>Encoding</tt></b></dt> +<dt class="prop">Encoding</dt> <dd>The character encoding, if known. <p>The encoding must be a string acceptable for an XML encoding @@ -371,17 +378,19 @@ <blockquote> <table> -<tr><td><b><tt>ColumnNumber</tt></b></td> +<tr><td class="prop">ColumnNumber</td> <td>The column number of the end of the current event text.</td></tr> -<tr><td><b><tt>LineNumber</tt></b></td> +<tr><td class="prop">LineNumber</td> <td>The line number of the end of the current event text.</td></tr> -<tr><td><b><tt>PublicId</tt></b></td> +<tr><td class="prop">PublicId</td> <td>The public identifier of the current entity.</td></tr> -<tr><td><b><tt>SystemId</tt></b></td> +<tr><td class="prop">SystemId</td> <td>The system identifier of the current entity.</td></tr> -<tr><td><b><tt>Encoding</tt></b></td> -<td>The character encoding of the current entity.</td></tr> -<tr><td><b><tt>XMLVersion</tt></b></td> +<tr><td class="prop">Encoding</td> +<td>The character encoding the parser uses to decode the current entity if +it decodes the current entity. Otherwise (the entity has been provided +as a character stream) this property is undef.</td></tr> +<tr><td class="prop">XMLVersion</td> <td>The XML version of the current entity.</td></tr> </table> </blockquote></dd> @@ -417,9 +426,9 @@ <blockquote> <table> -<tr><td><b><tt>Prefix</tt></b></td> +<tr><td class="prop">Prefix</td> <td>The Namespace prefix being declared.</td></tr> -<tr><td><b><tt>NamespaceURI</tt></b></td> +<tr><td class="prop">NamespaceURI</td> <td>The Namespace URI the prefix is mapped to.</td></tr> </table> </blockquote></dd> @@ -439,7 +448,7 @@ <blockquote> <table> -<tr><td><b><tt>Prefix</tt></b></td> +<tr><td class="prop">Prefix</td> <td>The Namespace prefix that was being mapped.</td></tr> </table> </blockquote></dd> @@ -462,10 +471,10 @@ <blockquote> <table> -<tr><td><b><tt>Target</tt></b></td> +<tr><td class="prop">Target</td> <td>The processing instruction target.</td></tr> -<tr><td><b><tt>Data</tt></b></td> -<td>The processing instruction data, or null if none was +<tr><td class="prop">Data</td> +<td>The processing instruction data, or undef if none was supplied.</td></tr> </table> </blockquote></dd> @@ -489,7 +498,7 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The name of the skipped entity. If it is a parameter entity, the name will begin with '<tt>%</tt>'.</td></tr> </table> @@ -532,9 +541,9 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The element type name.</td></tr> -<tr><td><b><tt>Model</tt></b></td> +<tr><td class="prop">Model</td> <td>The content model as a normalized string.</td></tr> </table> </blockquote></dd> @@ -556,18 +565,18 @@ <blockquote> <table> -<tr><td><b><tt>eName</tt></b></td> +<tr><td class="prop">eName</td> <td>The name of the associated element.</td></tr> -<tr><td><b><tt>aName</tt></b></td> +<tr><td class="prop">aName</td> <td>The name of the attribute.</td></tr> -<tr><td><b><tt>Type</tt></b></td> +<tr><td class="prop">Type</td> <td>A string representing the attribute type.</td></tr> -<tr><td><b><tt>Mode</tt></b></td> +<tr><td class="prop">Mode</td> <td>A string representing the attribute mode ("<tt>#IMPLIED</tt>", "<tt>#REQUIRED</tt>", or "<tt>#FIXED</tt>") or undef if none of these applies.</td></tr> -<tr><td><b><tt>Value</tt></b></td> -<td>A string representing the attribute's default value, or null if +<tr><td class="prop">Value</td> +<td>A string representing the attribute's default value, or undef if there is none.</td></tr> </table> </blockquote></dd> @@ -606,13 +615,13 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The name of the entity. If it is a parameter entity, the name will begin with '%'.</td></tr> -<tr><td><b><tt>PublicId</tt></b></td> +<tr><td class="prop">PublicId</td> <td>The public identifier of the entity, or <tt>undef</tt> if none was declared.</td></tr> -<tr><td><b><tt>SystemId</tt></b></td> +<tr><td class="prop">SystemId</td> <td>The system identifier of the entity.</td></tr> </table> </blockquote></dd> @@ -653,12 +662,12 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The notation name.</td></tr> -<tr><td><b><tt>PublicId</tt></b></td> +<tr><td class="prop">PublicId</td> <td>The public identifier of the entity, or <tt>undef</tt> if none was declared.</td></tr> -<tr><td><b><tt>SystemId</tt></b></td> +<tr><td class="prop">SystemId</td> <td>The system identifier of the entity, or <tt>undef</tt> if none was declared.</td></tr> </table> @@ -681,14 +690,14 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The unparsed entity's name.</td></tr> -<tr><td><b><tt>PublicId</tt></b></td> +<tr><td class="prop">PublicId</td> <td>The public identifier of the entity, or <tt>undef</tt> if none was declared.</td></tr> -<tr><td><b><tt>SystemId</tt></b></td> +<tr><td class="prop">SystemId</td> <td>The system identifier of the entity.</td></tr> -<tr><td><b><tt>Notation</tt></b></td> +<tr><td class="prop">Notation</td> <td>The name of the associated notation.</td></tr> </table> </blockquote></dd> @@ -739,10 +748,10 @@ <blockquote> <table> -<tr><td><b><tt>PublicId</tt></b></td> +<tr><td class="prop">PublicId</td> <td>The public identifier of the entity being referenced, or <tt>undef</tt> if none was declared.</td></tr> -<tr><td><b><tt>SystemId</tt></b></td> +<tr><td class="prop">SystemId</td> <td>The system identifier of the entity being referenced.</td></tr> </table> </blockquote></dd> @@ -844,12 +853,12 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The document type name.</td></tr> -<tr><td><b><tt>PublicId</tt></b></td> +<tr><td class="prop">PublicId</td> <td>The declared public identifier for the external DTD subset, or <tt>undef</tt> if none was declared.</td></tr> -<tr><td><b><tt>SystemId</tt></b></td> +<tr><td class="prop">SystemId</td> <td>The declared system identifier for the external DTD subset, or <tt>undef</tt> if none was declared.</td></tr> </table> @@ -884,7 +893,7 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The name of the entity. If it is a parameter entity, the name will begin with '%'.</td></tr> </table> @@ -900,7 +909,7 @@ <blockquote> <table> -<tr><td><b><tt>Name</tt></b></td> +<tr><td class="prop">Name</td> <td>The name of the entity that is ending.</td></tr> </table> </blockquote></dd> @@ -938,7 +947,7 @@ <blockquote> <table> -<tr><td><b><tt>Data</tt></b></td> +<tr><td class="prop">Data</td> <td>The comment characters.</td></tr> </table> </blockquote></dd> @@ -952,7 +961,7 @@ stream of events as they pass on to the final application.</p> <p> -<dl><dt><b><tt>Parent</tt></b></dt> +<dl><dt class="prop">Parent</dt> <dd> The parent reader. Index: sax-2.1-idx.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1-idx.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- sax-2.1-idx.html 6 Aug 2004 10:23:38 -0000 1.3 +++ sax-2.1-idx.html 25 Oct 2004 09:22:38 -0000 1.4 @@ -2,7 +2,7 @@ <html> <head> <title>Perl SAX 2.1</title> - <style> + <style type="text/css"> a {text-decoration:none} div {font-size: 14px; color: #777777;} div.box {padding:4px 2px 4px 2px; @@ -199,5 +199,7 @@ </div> </div> +<div>Revision: $Revision$, $Date$</div> + </body> </html> Index: sax-2.1.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sax-2.1.html 6 Aug 2004 10:23:38 -0000 1.2 +++ sax-2.1.html 25 Oct 2004 09:22:38 -0000 1.3 @@ -1,9 +1,9 @@ <!-- $Id$ --> <html> - <head> - <title>Perl SAX 2.1 Binding</title> - </head> - <body> +<head> +<title>Perl SAX 2.1 Binding</title> +</head> +<body> <h1>Perl SAX 2.1 Binding</h1> @@ -122,7 +122,7 @@ <dd> This is a generic method that calls one of the above methods based on the <tt>Source</tt> option. <var>options</var> can be a list of -options, value pairs or a hash (reference).</dd> +options, value pairs or a hash (reference).</dd></dl> </p> <p> @@ -143,11 +143,11 @@ <p><a name="startDocument"/> <dl><dt><b><tt class='function'>start_document</tt></b>(<var>document</var>)</dt> <dd> -Receive notification of the beginning of a document. +Receive notification of the beginning of a document.</p> <p>The SAX parser will invoke this method only once, before any other methods (except for <tt>set_document_locator()</tt> in advanced SAX -handlers).</p> +handlers). No properties are defined for this event (<var>document</var> is empty).</dd></dl></p> |
From: Grant M. <gr...@us...> - 2004-10-21 18:01:42
|
Update of /cvsroot/perl-xml/perl-xml-faq In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29057 Modified Files: perl-xml-faq.xml Log Message: - add note about CPAN.pm conf init Index: perl-xml-faq.xml =================================================================== RCS file: /cvsroot/perl-xml/perl-xml-faq/perl-xml-faq.xml,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- perl-xml-faq.xml 19 Feb 2004 09:05:44 -0000 1.16 +++ perl-xml-faq.xml 21 Oct 2004 18:01:32 -0000 1.17 @@ -785,6 +785,34 @@ </answer> </qandaentry> + <qandaentry id="xml_xpathscript"> + <question> + <para><classname>XML::XPathScript</classname></para> + </question> + <answer> + + <para>XPathScript is a stylesheet language comparable to XSLT, for + transforming XML from one format to another (possibly HTML, but + XPathScript also shines for non-XML-like output).</para> + + <para>Like XSLT, XPathScript offers a dialect to mix verbatim portions of + documents and code. Also like XSLT, it leverages the powerful + "templates/apply-templates" and "cascading stylesheets" design + patterns, that greatly simplify the design of stylesheets for + programmers. The availability of the XPath query language inside + stylesheets promotes the use of a purely document-dependent, + side-effect-free coding style. But unlike XSLT which uses its own + dedicated control language with an XML-compliant syntax, XPathScript + uses Perl which is terse and highly extendable.</para> + + <para>As of version 0.13 of XML::XPathScript, the module can use either + <classname>XML::LibXML</classname> or <classname>XML::XPath</classname> + as its parsing engine. Transformations can be performed either using + a shell-based script or, in a web environment, within AxKit.</para> + + </answer> + </qandaentry> + <qandaentry id="win32_expat"> <question> <para>How can I install <classname>XML::Parser</classname> under @@ -877,7 +905,13 @@ <classname>Compress::Zlib</classname>, <classname>Archive::Tar</classname> and <classname>Net::FTP</classname> modules if they are installed - and they are part of the ActiveState Perl - distribution.</para> + distribution. Also don't worry if you make a mistake, you can repeat the + configuration process at any time by typing this command at the 'cpan>' + prompt:</para> + + <programlisting><![CDATA[ +o conf init + ]]></programlisting> <para>If you're behind a firewall, when you're asked for an FTP or HTTP proxy enter it's URL like this:</para> @@ -1331,8 +1365,8 @@ to a file as ISO-8859-1:</para> <programlisting><![CDATA[ -open($fh,'>:encoding(iso-8859-1)', $path) or die "open($path): $!"; -$fh->print($utf_string); +open my $fh, '>:encoding(iso-8859-1)', $path or die "open($path): $!"; +print $fh $utf_string; ]]></programlisting> <para>The new core module 'Encode' can be used to translate between @@ -1408,8 +1442,8 @@ </formalpara> <programlisting><![CDATA[ -$fh = new IO::File $path, ">:encoding(iso-8859-1)" || die "open($path): $!"; -$fh->print($utf_string); +open my $fh, '>:encoding(iso-8859-1)', $path or die "open($path): $!"; +print $fh $utf_string; ]]></programlisting> <para>You can also push an encoding layer onto an already open filehandle |
From: Petr C. <pci...@us...> - 2004-09-27 09:03:45
|
Update of /cvsroot/perl-xml/sax-perl-org In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31264 Modified Files: changes-2.1 index.html Added Files: changes-2.1.html changes-2.1.xml changes.css changes.xsl Log Message: Changes turned into xml/html --- NEW FILE: changes-2.1.html --- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <title>Perl SAX 2.1 Changes and Issues</title> <link href="changes.css" rel="STYLESHEET" type="text/css" /> </head> <body> <h1>Perl SAX 2.1 Changes and Issues</h1> <p> The development of <a href="http://perl-xml.sourceforge.net/perl-sax/">Perl SAX 2.1</a> API is in progress. Comments should be sent to Perl-XML mailing list (per...@li...). </p> <h2>Changes from Perl SAX 2.0</h2> <p class="change"> <b>Change <a name="C1">C1</a> </b> <i></i> <br /> XMLVersion and Encoding fields added to document locator (as in Locator2 interface of SAX 2.0 Ext. 1.1) </p> <p class="change"> <b>Change <a name="C2">C2</a> </b> <i> [resolves issue <a href="#I4">I4</a>]</i> <br /> The definition of parse() unified in the Basic and Advanced documents. parse_uri() added. The new definition fits to the current XML::SAX::Base implementation (as of XML::SAX v0.12). </p> <p class="change"> <b>Change <a name="C3">C3</a> </b> <i> [resolves issue <a href="#I6">I6</a>]</i> <br /> Changes in attribute_decl(): ValueDefault renamed to Mode. The new name is less confusing and corresponds to SAX Java API. </p> <h2>Summary of Issues</h2> <p class="open"> <b>Issue <a name="I1">I1</a> </b> <i> status: open, resolution: none</i> <br /> A parser should advertise SAX version it supports. There can be a new method ($parser->get_sax_version()) or a read-only feature (http://xmlns.perl.org/sax/version). This feature should be introduced also to Perl SAX 2.0 retrospectively to distinguish between 1.0, 2.0 and 2.1 drivers. <br /> </p> <p class="open"> <b>Issue <a name="I2">I2</a> </b> <i> status: open, resolution: none</i> <br /> "http://xml.org/sax/handlers/LexicalHandler" feature on the parser needs to be set to the object to receive lexical events currently. If the reader does not support lexical events, it will throw a XML::SAX::Exception::NotRecognized or a XML::SAX::Exception::NotSupported when you attempt to register the handler. DeclHandler works in the same way. Actually, this is a theory - XML::SAX::Base doesn't implement this currently. <br /> This approach is very different from the common PerlSAX mechanism: look for a specific handler, then look for a handler method on the default handler, ignore the callback when not found. It would be more 'perlish' to apply this simple mechanism to LexicalHandler and DeclHandler too. If we want these two be extension handlers (compliant 2.1 parsers are not required to support them) there could be read-only features to let apps to know whether extension handlers are supported o not (http://xmlns.perl.org/sax/LexicalHandler, DeclHandler). <br /> </p> <p class="open"> <b>Issue <a name="I3">I3</a> </b> <i> status: open, resolution: none</i> <br /> SAX 2.0 Ext. 1.1 has a new Attributes2 interface which extends attributes with new properties (Declared, Specified) to distinguish between attributed specified in an XML doc and those declared in DTD. This could be introduced into Perl SAX 2.1 as an optional extension (advertised by a feature). <br /> </p> <p class="decided"> <b>Issue <a name="I4">I4</a> </b> <i> status: decided, resolution: applied [resolved as change <a href="#C2">C2</a>]</i> <br /> The parse() method is defined in different ways in the Basic and Advanced documents. Proposed solution: to add an explicit parse_uri() method, parse() would call either parse_uri(), parse_string(), or parse_stream() based on InputSource. <br /> </p> <p class="open"> <b>Issue <a name="I5">I5</a> </b> <i> status: open, resolution: none</i> <br /> All hash references could be replaced with blessed classes. Need to clarify what would be benefits of such change. <br /> </p> <p class="decided"> <b>Issue <a name="I6">I6</a> </b> <i> status: decided, resolution: applied [resolved as change <a href="#C3">C3</a>]</i> <br /> Changes in attribute_decl eName, aName, Type, Mode (was ValueDefault), Value <br /> </p> <p class="open"> <b>Issue <a name="I7">I7</a> </b> <i> status: open, resolution: none</i> <br /> The effect of turning off namespace processing is unclear in Perl SAX. The spec should state that all namespace-related processing is skipped, and no namespace-related information is made available. <br /> Suggestion: All node keys are always present, NamespaceURI, Prefix and LocalName are undef. Attributes keys are prefixed with {} (for example {}pfx:lname). NS declarations are treated as common attributes. <br /> </p> <p class="open"> <b>Issue <a name="I8">I8</a> </b> <i> status: open, resolution: none</i> <br /> Perl SAX should require explicitly all event data to be Unicode strings (to have the UTF-8 flag on). <br /> </p> </body> </html> --- NEW FILE: changes-2.1.xml --- <?xml version="1.0"?> <change-log xmlns="http://sax.perl.org/changeLog"> <title>Perl SAX 2.1 Changes and Issues</title> <description> The purpose of this file is to record changes done from Perl SAX 2.0 and to track related issues.</description> <change-list> <change id="C1" issue-ref=""> XMLVersion and Encoding fields added to document locator (as in Locator2 interface of SAX 2.0 Ext. 1.1) </change> <change id="C2" issue-ref="I4"> The definition of parse() unified in the Basic and Advanced documents. parse_uri() added. The new definition fits to the current XML::SAX::Base implementation (as of XML::SAX v0.12). </change> <change id="C3" issue-ref="I6"> Changes in attribute_decl(): ValueDefault renamed to Mode. The new name is less confusing and corresponds to SAX Java API. </change> </change-list> <issue-list> <issue id="I1" status="open" resolution="none" change-ref=""> <para> A parser should advertise SAX version it supports. There can be a new method ($parser->get_sax_version()) or a read-only feature (http://xmlns.perl.org/sax/version). This feature should be introduced also to Perl SAX 2.0 retrospectively to distinguish between 1.0, 2.0 and 2.1 drivers. </para> </issue> <issue id="I2" status="open" resolution="none" change-ref=""> <para> "http://xml.org/sax/handlers/LexicalHandler" feature on the parser needs to be set to the object to receive lexical events currently. If the reader does not support lexical events, it will throw a XML::SAX::Exception::NotRecognized or a XML::SAX::Exception::NotSupported when you attempt to register the handler. DeclHandler works in the same way. Actually, this is a theory - XML::SAX::Base doesn't implement this currently. </para> <para> This approach is very different from the common PerlSAX mechanism: look for a specific handler, then look for a handler method on the default handler, ignore the callback when not found. It would be more 'perlish' to apply this simple mechanism to LexicalHandler and DeclHandler too. If we want these two be extension handlers (compliant 2.1 parsers are not required to support them) there could be read-only features to let apps to know whether extension handlers are supported o not (http://xmlns.perl.org/sax/LexicalHandler, DeclHandler). </para> </issue> <issue id="I3" status="open" resolution="none" change-ref=""> <para> SAX 2.0 Ext. 1.1 has a new Attributes2 interface which extends attributes with new properties (Declared, Specified) to distinguish between attributed specified in an XML doc and those declared in DTD. This could be introduced into Perl SAX 2.1 as an optional extension (advertised by a feature). </para> </issue> <issue id="I4" status="decided" resolution="applied" change-ref="C2"> <para> The parse() method is defined in different ways in the Basic and Advanced documents. Proposed solution: to add an explicit parse_uri() method, parse() would call either parse_uri(), parse_string(), or parse_stream() based on InputSource. </para> </issue> <issue id="I5" status="open" resolution="none" change-ref=""> <para> All hash references could be replaced with blessed classes. Need to clarify what would be benefits of such change. </para> </issue> <issue id="I6" status="decided" resolution="applied" change-ref="C3"> <para> Changes in attribute_decl eName, aName, Type, Mode (was ValueDefault), Value </para> </issue> <issue id="I7" status="open" resolution="none" change-ref=""> <para> The effect of turning off namespace processing is unclear in Perl SAX. The spec should state that all namespace-related processing is skipped, and no namespace-related information is made available. </para> <para> Suggestion: All node keys are always present, NamespaceURI, Prefix and LocalName are undef. Attributes keys are prefixed with {} (for example {}pfx:lname). NS declarations are treated as common attributes. </para> </issue> <issue id="I8" status="open" resolution="none" change-ref=""> <para> Perl SAX should require explicitly all event data to be Unicode strings (to have the UTF-8 flag on). </para> </issue> </issue-list> </change-log> --- NEW FILE: changes.css --- p { padding: 2px 5px 2px 5px; } .change { border: solid 1px #999999; background-color: #bbbbbb; } .open { border: solid 1px #999999; background-color: #ffbbbb; } .decided { border: solid 1px #999999; background-color: #bbffbb; } .closed { border: solid 1px #999999; background-color: #bbbbff; } --- NEW FILE: changes.xsl --- <?xml version="1.0" encoding="UTF-8"?> <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:chg="http://sax.perl.org/changeLog" xmlns="http://www.w3.org/1999/xhtml" exclude-result-prefixes="chg"> <xsl:output method="xhtml" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" doctype-system="http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"/> <xsl:template match="/chg:change-log"> <html> <head> <title>Perl SAX 2.1 Changes and Issues</title> <link href="changes.css" rel="STYLESHEET" type="text/css"/> </head> <body> <h1>Perl SAX 2.1 Changes and Issues</h1> <p> The development of <a href="http://perl-xml.sourceforge.net/perl-sax/">Perl SAX 2.1</a> API is in progress. Comments should be sent to Perl-XML mailing list (per...@li...). </p> <h2>Changes from Perl SAX 2.0</h2> <xsl:apply-templates select="chg:change-list/chg:change"/> <h2>Summary of Issues</h2> <xsl:apply-templates select="chg:issue-list/chg:issue"/> </body> </html> </xsl:template> <xsl:template match="chg:change"> <p class="change"> <b> <xsl:text>Change </xsl:text> <a name="{@id}"> <xsl:value-of select="@id"/> </a> </b> <i> <xsl:if test="@issue-ref != ''"> <xsl:text> [resolves issue </xsl:text> <a href="#{@issue-ref}"> <xsl:value-of select="@issue-ref"/> </a> <xsl:text>]</xsl:text> </xsl:if> </i> <br /> <xsl:value-of select="text()"/> </p> </xsl:template> <xsl:template match="chg:issue"> <p class="{@status}"> <b> <xsl:text>Issue </xsl:text> <a name="{@id}"> <xsl:value-of select="@id"/> </a> </b> <i> <xsl:text> status: </xsl:text> <xsl:value-of select="@status"/> <xsl:text>, resolution: </xsl:text> <xsl:value-of select="@resolution"/> <xsl:if test="@change-ref != ''"> <xsl:text> [resolved as change </xsl:text> <a href="#{@change-ref}"> <xsl:value-of select="@change-ref"/> </a> <xsl:text>]</xsl:text> </xsl:if> </i> <br /> <xsl:for-each select="chg:para"> <xsl:value-of select="text()"/> <br /> </xsl:for-each> </p> </xsl:template> </xsl:stylesheet> Index: changes-2.1 =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/changes-2.1,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- changes-2.1 6 Aug 2004 10:23:38 -0000 1.2 +++ changes-2.1 27 Sep 2004 09:03:18 -0000 1.3 @@ -1,89 +1,4 @@ -======================================= -= Perl SAX 2.1 Changes and Issues = -======================================= - -The purpose of this file is to record changes done from Perl SAX 2.0 -and to track related issues. - - ---------------------------------------- -Changes ---------------------------------------- - - -[C1] XMLVersion and Encoding fields added to document locator -(as in Locator2 interface of SAX 2.0 Ext. 1.1) - - -[C2] (issue I4) The definition of parse() unified in the Basic and -Advanced documents. parse_uri() added. The new definition fits to -the current XML::SAX::Base implementation (as of XML::SAX v0.12). - - -[C3] (issue I6) Changes in attribute_decl(): ValueDefault renamed -to Mode. The new name is less confusing and corresponds to SAX -Java API. - - ---------------------------------------- -Issues ---------------------------------------- - - -[I1] Resolution: none ---------------------------------------- -A parser should advertise SAX version it supports. There can be -a new method ($parser->get_sax_version()) or a read-only feature -(http://xmlns.perl.org/sax/version). This feature should be introduced -also to Perl SAX 2.0 retrospectively to distinguish between 1.0, 2.0 -and 2.1 drivers. - - -[I2] Resolution: none ---------------------------------------- -"http://xml.org/sax/handlers/LexicalHandler" feature on the parser -needs to be set to the object to receive lexical events currently. If -the reader does not support lexical events, it will throw -a XML::SAX::Exception::NotRecognized or a -XML::SAX::Exception::NotSupported when you attempt to register the -handler. DeclHandler works in the same way. Actually, this is a theory -- XML::SAX::Base doesn't implement this currently. - -This approach is very different from the common PerlSAX mechanism: -look for a specific handler, then look for a handler method on the -default handler, ignore the callback when not found. It would be more -'perlish' to apply this simple mechanism to LexicalHandler and -DeclHandler too. If we want these two be extension handlers (compliant -2.1 parsers are not required to support them) there could be read-only -features to let apps to know whether extension handlers are supported -o not (http://xmlns.perl.org/sax/LexicalHandler, DeclHandler). - - -[I3] Resolution: none ---------------------------------------- -SAX 2.0 Ext. 1.1 has a new Attributes2 interface which extends -attributes with new properties (Declared, Specified) to distinguish -between attributed specified in an XML doc and those declared in -DTD. This could be introduced into Perl SAX 2.1 as an optional -extension (advertised by a feature). - - -[I4] Resolution: applied as [C2] ---------------------------------------- -The parse() method is defined in different ways in the Basic and -Advanced documents. -Proposed solution: to add an explicit parse_uri() method, parse() -would call either parse_uri(), parse_string(), or parse_stream() -based on InputSource. - - -[I5] Resolution: none ---------------------------------------- -All hash references could be replaced with blessed classes. Need to -clarify what would be benefits of such change. - +This document is deprecated. +It has been replaced with changes-2.1.html +as of September 27, 2004. -[I6] Resolution: applied as [C3] ---------------------------------------- -Changes in attribute_decl -eName, aName, Type, Mode (was ValueDefault), Value \ No newline at end of file Index: index.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/index.html,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- index.html 6 Aug 2004 10:23:38 -0000 1.4 +++ index.html 27 Sep 2004 09:03:18 -0000 1.5 @@ -16,7 +16,7 @@ hosted by <a href="http://www.sourceforge.net/">Sourceforge</a>. </div> <div> - <div class="SubTitle">SAX 2.0</div> + <div class="SubTitle">Perl SAX 2.0</div> Current stable version of Perl SAX is 2.0. The API is defined by the following documents: <ul> @@ -27,13 +27,13 @@ </ul> </div> <div> - <div class="SubTitle">SAX 2.1</div> + <div class="SubTitle">Perl SAX 2.1</div> The version 2.1 is under development: <ul> <li><a href="sax-2.1.html">Perl SAX 2.1 Binding</a></li> <li><a href="sax-2.1-adv.html">Perl SAX 2.1 Advanced</a></li> <li><a href="sax-2.1-ref.html">Perl SAX 2.1 Reference</a> (an indexed view of the two above docs)</li> - <li><a href="changes-2.1">Changes and Issues</a></li> + <li><a href="changes-2.1.html">Changes and Issues</a></li> </ul> </div> <div> @@ -44,4 +44,4 @@ </div> </body> -</html> \ No newline at end of file +</html> |
From: Petr C. <pci...@us...> - 2004-08-06 10:23:49
|
Update of /cvsroot/perl-xml/sax-perl-org In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31422 Modified Files: changes-2.1 index.html sax-2.1-adv.html sax-2.1-idx.html sax-2.1-ref.html sax-2.1.html Log Message: parse_uri(), attribute_decl() Index: changes-2.1 =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/changes-2.1,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- changes-2.1 19 Feb 2004 09:50:04 -0000 1.1 +++ changes-2.1 6 Aug 2004 10:23:38 -0000 1.2 @@ -15,12 +15,23 @@ (as in Locator2 interface of SAX 2.0 Ext. 1.1) +[C2] (issue I4) The definition of parse() unified in the Basic and +Advanced documents. parse_uri() added. The new definition fits to +the current XML::SAX::Base implementation (as of XML::SAX v0.12). + + +[C3] (issue I6) Changes in attribute_decl(): ValueDefault renamed +to Mode. The new name is less confusing and corresponds to SAX +Java API. + + --------------------------------------- Issues --------------------------------------- [I1] Resolution: none +--------------------------------------- A parser should advertise SAX version it supports. There can be a new method ($parser->get_sax_version()) or a read-only feature (http://xmlns.perl.org/sax/version). This feature should be introduced @@ -29,6 +40,7 @@ [I2] Resolution: none +--------------------------------------- "http://xml.org/sax/handlers/LexicalHandler" feature on the parser needs to be set to the object to receive lexical events currently. If the reader does not support lexical events, it will throw @@ -48,8 +60,30 @@ [I3] Resolution: none +--------------------------------------- SAX 2.0 Ext. 1.1 has a new Attributes2 interface which extends attributes with new properties (Declared, Specified) to distinguish between attributed specified in an XML doc and those declared in DTD. This could be introduced into Perl SAX 2.1 as an optional extension (advertised by a feature). + + +[I4] Resolution: applied as [C2] +--------------------------------------- +The parse() method is defined in different ways in the Basic and +Advanced documents. +Proposed solution: to add an explicit parse_uri() method, parse() +would call either parse_uri(), parse_string(), or parse_stream() +based on InputSource. + + +[I5] Resolution: none +--------------------------------------- +All hash references could be replaced with blessed classes. Need to +clarify what would be benefits of such change. + + +[I6] Resolution: applied as [C3] +--------------------------------------- +Changes in attribute_decl +eName, aName, Type, Mode (was ValueDefault), Value \ No newline at end of file Index: index.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/index.html,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- index.html 19 Feb 2004 13:49:18 -0000 1.3 +++ index.html 6 Aug 2004 10:23:38 -0000 1.4 @@ -1,61 +1,47 @@ -<html> - <head> - - <title>Perl SAX</title> - <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> - </head> -<body bgcolor="#ffffff" text="#000000"> -<div align="center"> - <p><font size="6"><b>Perl SAX (Simple API for XML) Page</b></font></p> - <p align="center"><b>The <a href="http://perl-xml.sourceforge.net/">Perl XML - Project</a> is hosted by <a href="http://www.sourceforge.net/">Sourceforge</a>. - This is the official Perl SAX page.</b></p> - <table width="95%" border="0"> - <tbody><tr> - <td><b>SAX 2.0</b></td> - </tr> - <tr> - <td height="11"> +<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> +<html xmlns="http://www.w3.org/1999/xhtml"> + <head> + <title>Perl SAX</title> + <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> + <link href="perl-sax.css" rel="STYLESHEET" type="text/css" /> + </head> + <body> + <div class="Header"> + <div class="Title">Perl SAX (Simple API for XML) Page</div> + This is the current Perl SAX page. The former official + <a href="http://sax.perl.org">Perl SAX page</a> is no more + maintained for various reasons. + Perl SAX is a part of + the <a href="http://perl-xml.sourceforge.net/">Perl XML Project</a> + hosted by <a href="http://www.sourceforge.net/">Sourceforge</a>. + </div> + <div> + <div class="SubTitle">SAX 2.0</div> + Current stable version of Perl SAX is 2.0. The API is defined + by the following documents: <ul> <li><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/perl-xml/libxml-perl/doc/sax-2.0.html?rev=HEAD&content-type=text/html">Perl SAX 2.0 Binding</a></li> <li><a href="http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/*checkout*/perl-xml/libxml-perl/doc/sax-2.0-adv.html?rev=HEAD&content-type=text/html">Perl SAX 2.0 Advanced</a></li> - <li>List of Perl's SAX Modules</li> </ul> - </td> - </tr> - - <tr> - <td><b>SAX 2.1 Working Drafts</b></td> - </tr> - <tr> - <td> + </div> + <div> + <div class="SubTitle">SAX 2.1</div> + The version 2.1 is under development: <ul> - <li><a href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-xml/sax-perl-org/sax-2.1.html?rev=HEAD&content-type=text/html">Perl - SAX 2.1 Binding</a></li> - <li><a href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-xml/sax-perl-org/sax-2.1-adv.html?rev=HEAD&content-type=text/html">Perl - SAX 2.1 Advanced</a></li> - <li><a href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-xml/sax-perl-org/sax-2.1-ref.html?rev=HEAD&content-type=text/html">Perl - SAX 2.1 Reference</a></li> - <li><a href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-xml/sax-perl-org/changes-2.1?rev=HEAD&content-type=text/plain">Changes - and Issues</a></li> + <li><a href="sax-2.1.html">Perl SAX 2.1 Binding</a></li> + <li><a href="sax-2.1-adv.html">Perl SAX 2.1 Advanced</a></li> + <li><a href="sax-2.1-ref.html">Perl SAX 2.1 Reference</a> (an indexed view of the two above docs)</li> + <li><a href="changes-2.1">Changes and Issues</a></li> </ul> - </td> - </tr> - - <tr> - <td><b>Misc.</b></td> - </tr> - <tr> - <td> + </div> + <div> + <div class="SubTitle">Related Pages</div> <ul> <li><a href="http://www.saxproject.org/">Official SAX Page</a></li> </ul> - </td> - </tr> - </tbody></table> - -</div> + </div> -</body></html> + </body> +</html> \ No newline at end of file Index: sax-2.1-adv.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1-adv.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sax-2.1-adv.html 19 Feb 2004 09:50:04 -0000 1.1 +++ sax-2.1-adv.html 6 Aug 2004 10:23:38 -0000 1.2 @@ -239,7 +239,7 @@ <dd> Look up all Features that this parser claims to support. <p> -This method returns a reference to hash of Features which the parser +This method returns a hash of Features which the parser claims to support. The value of the hash is currently unspecified though it may be used later. This method is meant to be inherited so that Features supported by the base parser @@ -562,8 +562,8 @@ <td>The name of the attribute.</td></tr> <tr><td><b><tt>Type</tt></b></td> <td>A string representing the attribute type.</td></tr> -<tr><td><b><tt>ValueDefault</tt></b></td> -<td>A string representing the attribute default ("<tt>#IMPLIED</tt>", +<tr><td><b><tt>Mode</tt></b></td> +<td>A string representing the attribute mode ("<tt>#IMPLIED</tt>", "<tt>#REQUIRED</tt>", or "<tt>#FIXED</tt>") or undef if none of these applies.</td></tr> <tr><td><b><tt>Value</tt></b></td> @@ -724,6 +724,9 @@ alternative URI, or that it use an entirely different input source.</p> +<p>This method returns an <a href="sax-2.1-adv.html#InputSources">Input +Source</a> hash reference.</p> + <p>Application writers can use this method to redirect external system identifiers to secure and/or local URIs, to look up public identifiers in a catalogue, or to read an entity from a database or other input Index: sax-2.1-idx.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1-idx.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sax-2.1-idx.html 19 Feb 2004 13:49:18 -0000 1.2 +++ sax-2.1-idx.html 6 Aug 2004 10:23:38 -0000 1.3 @@ -18,7 +18,7 @@ <div class="box" style="background-color:#eeeeee"> <div class="title">Perl SAX 2.1</div> - <div class="right">[<a href="http://sax.perl.org">home</a>]</div> + <div class="right">[<a target="_top" href="http://perl-xml.sourceforge.net/perl-sax/">home</a>]</div> <div class="item"> <a href="#parser">Parser</a> </div> @@ -26,19 +26,19 @@ <a href="#content">ContentHandler</a> </div> <div class="item"> - <a href="#error">ErrorHandler</a> + <a href="#dtd">DTDHandler</a> </div> <div class="item"> - <a href="#lexical">LexicalHandler</a> + <a href="#error">ErrorHandler</a> </div> <div class="item"> - <a href="#dtd">DTDHandler</a> + <a href="#resolver">Entity Resolver</a> </div> <div class="item"> - <a href="#decl">DeclHandler</a> + <a href="#lexical">LexicalHandler</a> </div> <div class="item"> - <a href="#resolver">Entity Resolver</a> + <a href="#decl">DeclHandler</a> </div> <div class="item"> <a href="#other">other objects</a> @@ -49,22 +49,25 @@ <div class="title"><a name="parser"/>Parser</div> <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#parse" target="cnt">parse()</a> + <a href="sax-2.1.html?#parse" target="cnt">parse()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#parseFile" target="cnt">parse_file()</a> + <a href="sax-2.1.html?#parseURI" target="cnt">parse_uri()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#parseString" target="cnt">parse_string()</a> + <a href="sax-2.1.html?#parseFile" target="cnt">parse_file()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#getFeature" target="cnt">get_feature()</a> + <a href="sax-2.1.html?#parseString" target="cnt">parse_string()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#setFeature" target="cnt">set_feature()</a> + <a href="sax-2.1-adv.html?#getFeature" target="cnt">get_feature()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#getFeatures" target="cnt">get_features()</a> + <a href="sax-2.1-adv.html?#setFeature" target="cnt">set_feature()</a> + </div> + <div class="item"> + <a href="sax-2.1-adv.html?#getFeatures" target="cnt">get_features()</a> </div> </div> @@ -72,37 +75,48 @@ <div class="title"><a name="content"/>ContentHandler</div> <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#setDocumentLocator" target="cnt">set_document_locator()</a> + <a href="sax-2.1-adv.html?#setDocumentLocator" target="cnt">set_document_locator()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#startDocument" target="cnt">start_document()</a> + <a href="sax-2.1.html?#startDocument" target="cnt">start_document()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#endDocument" target="cnt">end_document()</a> + <a href="sax-2.1.html?#endDocument" target="cnt">end_document()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#startElement" target="cnt">start_element()</a> + <a href="sax-2.1.html?#startElement" target="cnt">start_element()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#endElement" target="cnt">end_element()</a> + <a href="sax-2.1.html?#endElement" target="cnt">end_element()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#characters" target="cnt">characters()</a> + <a href="sax-2.1.html?#characters" target="cnt">characters()</a> </div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#ignorableWhitespace" target="cnt">ignorable_whitespace()</a> + <a href="sax-2.1.html?#ignorableWhitespace" target="cnt">ignorable_whitespace()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#startPrefixMapping" target="cnt">start_prefix_mapping()</a> + <a href="sax-2.1-adv.html?#startPrefixMapping" target="cnt">start_prefix_mapping()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#endPrefixMapping" target="cnt">end_prefix_mapping()</a> + <a href="sax-2.1-adv.html?#endPrefixMapping" target="cnt">end_prefix_mapping()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#processingInstruction" target="cnt">processing_instruction()</a> + <a href="sax-2.1-adv.html?#processingInstruction" target="cnt">processing_instruction()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#skippedEntity" target="cnt">skipped_entity()</a> + <a href="sax-2.1-adv.html?#skippedEntity" target="cnt">skipped_entity()</a> + </div> +</div> + +<div class="box"> + <div class="title"><a name="dtd"/>DTDHandler</div> + <div class="right">[<a href="#top">top</a>]</div> + <div class="item"> + <a href="sax-2.1-adv.html?#notationDecl" target="cnt">notation_decl()</a> + </div> + <div class="item"> + <a href="sax-2.1-adv.html?#unparsedEntity" target="cnt">unparsed_entity_decl()</a> </div> </div> @@ -110,50 +124,47 @@ <div class="title"><a name="error"/>ErrorHandler</div> <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#warning" target="cnt">warning()</a> + <a href="sax-2.1-adv.html?#warning" target="cnt">warning()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#error" target="cnt">error()</a> + <a href="sax-2.1-adv.html?#error" target="cnt">error()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#fatalError" target="cnt">fatal_error()</a> + <a href="sax-2.1-adv.html?#fatalError" target="cnt">fatal_error()</a> </div> </div> <div class="box"> - <div class="title"><a name="lexical"/>LexicalHandler</div> + <div class="title"><a name="resolver"/>EntityResolver</div> <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#startDTD" target="cnt">start_dtd()</a> + <a href="sax-2.1-adv.html?#resolveEntity" target="cnt">resolve_entity()</a> </div> +</div> + +<div class="box"> + <div class="title"><a name="lexical"/>LexicalHandler</div> + <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#endDTD" target="cnt">end_dtd()</a> + <a href="sax-2.1-adv.html?#startDTD" target="cnt">start_dtd()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#startEntity" target="cnt">start_entity()</a> + <a href="sax-2.1-adv.html?#endDTD" target="cnt">end_dtd()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#endEntity" target="cnt">end_entity()</a> + <a href="sax-2.1-adv.html?#startEntity" target="cnt">start_entity()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#startCDATA" target="cnt">start_cdata()</a> + <a href="sax-2.1-adv.html?#endEntity" target="cnt">end_entity()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#endCDATA" target="cnt">end_cdata()</a> + <a href="sax-2.1-adv.html?#startCDATA" target="cnt">start_cdata()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#comment" target="cnt">comment()</a> - </div> -</div> - -<div class="box"> - <div class="title"><a name="dtd"/>DTDHandler</div> - <div class="right">[<a href="#top">top</a>]</div> - <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#notationDecl" target="cnt">notation_decl()</a> + <a href="sax-2.1-adv.html?#endCDATA" target="cnt">end_cdata()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#unparsedEntity" target="cnt">unparsed_entity_decl()</a> + <a href="sax-2.1-adv.html?#comment" target="cnt">comment()</a> </div> </div> @@ -161,24 +172,16 @@ <div class="title"><a name="decl"/>DeclHandler</div> <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#elementDecl" target="cnt">element_decl()</a> - </div> - <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#attributeDecl" target="cnt">attribute_decl()</a> + <a href="sax-2.1-adv.html?#elementDecl" target="cnt">element_decl()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#internalEntityDecl" target="cnt">internal_entity_decl()</a> + <a href="sax-2.1-adv.html?#attributeDecl" target="cnt">attribute_decl()</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#externalEntityDecl" target="cnt">external_entity_decl()</a> + <a href="sax-2.1-adv.html?#internalEntityDecl" target="cnt">internal_entity_decl()</a> </div> -</div> - -<div class="box"> - <div class="title"><a name="resolver"/>EntityResolver</div> - <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#resolveEntity" target="cnt">resolve_entity()</a> + <a href="sax-2.1-adv.html?#externalEntityDecl" target="cnt">external_entity_decl()</a> </div> </div> @@ -186,13 +189,13 @@ <div class="title"><a name="other"/>other objects</div> <div class="right">[<a href="#top">top</a>]</div> <div class="item"> - <a href="sax-2.1.html?rev=HEAD&content-type=text/html#Exceptions" target="cnt">Exceptions</a> + <a href="sax-2.1.html?#Exceptions" target="cnt">Exceptions</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#InputSources" target="cnt">Input Sources</a> + <a href="sax-2.1-adv.html?#InputSources" target="cnt">Input Sources</a> </div> <div class="item"> - <a href="sax-2.1-adv.html?rev=HEAD&content-type=text/html#Features" target="cnt">Features</a> + <a href="sax-2.1-adv.html?#Features" target="cnt">Features</a> </div> </div> Index: sax-2.1-ref.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1-ref.html,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- sax-2.1-ref.html 19 Feb 2004 13:49:18 -0000 1.2 +++ sax-2.1-ref.html 6 Aug 2004 10:23:38 -0000 1.3 @@ -3,9 +3,9 @@ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> <frameset cols="225, *"> <noframes> - <a href="http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-xml/sax-perl-org/sax-2.1.html?rev=HEAD&content-type=text/html">Perl SAX 2.1 Binding</a> + <a href="sax-2.1.html">Perl SAX 2.1 Binding</a> </noframes> - <frame name="idx" id="idx" src="http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-xml/sax-perl-org/sax-2.1-idx.html?rev=HEAD&content-type=text/html" /> - <frame name="cnt" id="cnt"src="http://cvs.sourceforge.net/viewcvs.py/*checkout*/perl-xml/sax-perl-org/sax-2.1.html?rev=HEAD&content-type=text/html" /> + <frame name="idx" id="idx" src="sax-2.1-idx.html" /> + <frame name="cnt" id="cnt"src="sax-2.1.html" /> </frameset> Index: sax-2.1.html =================================================================== RCS file: /cvsroot/perl-xml/sax-perl-org/sax-2.1.html,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- sax-2.1.html 19 Feb 2004 09:50:04 -0000 1.1 +++ sax-2.1.html 6 Aug 2004 10:23:38 -0000 1.2 @@ -89,15 +89,15 @@ unless otherwise specified. </p> -<p><a name="parse"/> -<dl><dt><b><tt class='function'>parse</tt></b>(<var>uri</var> [, <var>options</var>])</dt> +<p><a name="parseURI"/> +<dl><dt><b><tt class='function'>parse_uri</tt></b>(<var>uri</var> [, <var>options</var>])</dt> <dd> Parses the XML instance identified by <var>uri</var> (a system identifier). <var>options</var> can be a list of options, value pairs or a hash (reference). Options include <tt>Handler</tt>, features and properties, -and advanced SAX parser options. <tt>parse()</tt> returns the result +and advanced SAX parser options. <tt>parse_uri()</tt> returns the result of calling the <tt>end_document()</tt> handler. The options supported -by <tt>parse()</tt> may vary slightly if what is being "parsed" isn't +by <tt>parse_uri()</tt> may vary slightly if what is being "parsed" isn't XML. </dd></dl></p> @@ -117,6 +117,14 @@ <tt>parse_string()</tt> returns the result of calling the <tt>end_document()</tt> handler.</dd></dl></p> +<p><a name="parse"/> +<dl><dt><b><tt class='function'>parse</tt></b>([<var>options</var>])</dt> +<dd> +This is a generic method that calls one of the above methods based on +the <tt>Source</tt> option. <var>options</var> can be a list of +options, value pairs or a hash (reference).</dd> +</p> + <p> <dl><dt><b><tt>Handler</tt></b></dt> <dd> |
From: Grant M. <gr...@us...> - 2004-04-05 09:25:45
|
Update of /cvsroot/perl-xml/xml-simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6444 Modified Files: Changes README Log Message: - for the 2.12 release Index: Changes =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Changes,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- Changes 2 Mar 2004 08:18:01 -0000 1.16 +++ Changes 5 Apr 2004 09:13:08 -0000 1.17 @@ -1,6 +1,11 @@ Revision history for Perl module XML::Simple -2.11 Mar 31 2004 +2.12 Apr 05 2004 + - added NumericEscape option + - added ValueAttr option (patch from Anton Berezin) + - suppress 'wide character in print' warning (reported by Dawei Lin) + +2.11 Mar 02 2004 - Fixed hash ordering assumption in a new test (reported by Jost Krieger) 2.10 Feb 29 2004 Index: README =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/README,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- README 2 Mar 2004 08:18:01 -0000 1.16 +++ README 5 Apr 2004 09:13:08 -0000 1.17 @@ -56,27 +56,10 @@ STATUS - This version (2.11) is the current stable release. + This version (2.12) is the current stable release. Please send any feedback to the author: gr...@cp... - -NEW IN THIS RELEASE - - Fix for a broken test - - New in Version 2.10 - - Added AttrIndent option (patch from Volker Moell) - - Hash keys are now sorted alphabetically by default; enable the new - NoSort option if you don't want this (patch from Volker Moell) - - Fixed bug where disabling array folding broke anonymous array handling - - Fixed bug when unfolding a tied hash - - SuppressEmpty patch from Douglas Wilson - - Numerous test improvements - Devel::Cover rocks! - - POD updates - - New in Version 2.09 - - test fixes and POD updates - See 'Changes' for a detailed history. See 'perldoc XML::Simple' for full documentation. @@ -86,7 +69,7 @@ COPYRIGHT - Copyright 1999-2003 Grant McLean <gr...@cp...> + Copyright 1999-2004 Grant McLean <gr...@cp...> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
From: Grant M. <gr...@us...> - 2004-04-05 09:25:29
|
Update of /cvsroot/perl-xml/xml-simple/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6360/t Modified Files: 1_XMLin.t 2_XMLout.t 8_Namespaces.t Log Message: - added NumericEscape option - added ValueAttr option (patch from Anton Berezin) - suppress 'wide character in print' warning (reported by Dawei Lin) Index: 2_XMLout.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/2_XMLout.t,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -r1.11 -r1.12 --- 2_XMLout.t 2 Mar 2004 08:17:45 -0000 1.11 +++ 2_XMLout.t 5 Apr 2004 09:12:51 -0000 1.12 @@ -7,7 +7,7 @@ $^W = 1; -plan tests => 185; +plan tests => 190; ############################################################################## @@ -1076,6 +1076,46 @@ } +# Check ValueAttr => {} can expand the relevant records + +$ref = { one => 1, two => 2, six => 6 }; + +$xml = XMLout($ref, ValueAttr => { one => 'value', six => 'num' }); + +like($xml, qr{ + ^<opt\s+two="2"\s*> + ( + \s*<one\s+value="1"\s*/> + | \s*<six\s+num="6"\s*/> + ){2} + \s*</opt>$ + }sx, 'Correct attributes inserted when ValueAttr specified' +); + +# Try out the NumericEscape option + +SKIP: { + skip "Perl 5.6 or better required", 4 unless($] >= 5.006); + + $ref = { euro => "\x{20AC}", nbsp => "\x{A0}" }; + + $xml = XMLout($ref); # Default: no numeric escaping + my $ents = join ',', sort ($xml =~ m{&#(\d+);}g); + is($ents, '', "No numeric escaping by default"); + + $xml = XMLout($ref, NumericEscape => 0); + $ents = join ',', sort ($xml =~ m{&#(\d+);}g); + is($ents, '', "No numeric escaping: explicit"); + + $xml = XMLout($ref, NumericEscape => 2); + $ents = join ',', sort ($xml =~ m{&#(\d+);}g); + is($ents, '160,8364', "Level 2 numeric escaping looks good"); + + $xml = XMLout($ref, NumericEscape => 1); + $ents = join ',', sort ($xml =~ m{&#(\d+);}g); + is($ents, '8364', "Level 1 numeric escaping looks good"); +} + # 'Stress test' with a data structure that maps to several thousand elements. # Unfold elements with XMLout() and fold them up again with XMLin() Index: 8_Namespaces.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/8_Namespaces.t,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -r1.6 -r1.7 --- 8_Namespaces.t 29 Feb 2004 09:49:18 -0000 1.6 +++ 8_Namespaces.t 5 Apr 2004 09:12:51 -0000 1.7 @@ -22,7 +22,7 @@ plan skip_all => "XML::NamespaceSupport is too old (upgrade to 1.04 or better)"; } -plan tests => 7; +plan tests => 8; ############################################################################## @@ -206,20 +206,24 @@ if($xml =~ m{<list\s+xmlns:(\w+)="http://www.phantom.com/"\s*>}) { $prefix = $1; } + # regex match split in two to workaround 5.8.1/utf8/regex match prob like($xml, qr{ - ^\s*<opt + \s*<opt \s+xmlns="http://www.orgsoc.org/" \s*> - \s*<list\s+xmlns:${prefix}="http://www.phantom.com/"\s*> + .*? + </list> + \s*</opt> +}sx, 'namespace prefixes are generated automatically (part 1)'); + +like($xml, qr{ (\s*<member>Tom</member> \s*<member>Dick</member> \s*<member>Larry</member> |\s*<${prefix}:director>Bill</${prefix}:director> \s*<${prefix}:director>Ben</${prefix}:director>){2} - \s*</list> - \s*</opt> - \s*$ -}sx, 'namespace prefixes are generated automatically'); + #\s*</list> +}sx, 'namespace prefixes are generated automatically (part 2)'); exit(0); |
From: Grant M. <gr...@us...> - 2004-04-05 09:25:28
|
Update of /cvsroot/perl-xml/xml-simple/lib/XML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6360/lib/XML Modified Files: Simple.pm Log Message: - added NumericEscape option - added ValueAttr option (patch from Anton Berezin) - suppress 'wide character in print' warning (reported by Dawei Lin) Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/lib/XML/Simple.pm,v retrieving revision 1.19 retrieving revision 1.20 diff -u -d -r1.19 -r1.20 --- Simple.pm 31 Mar 2004 10:07:46 -0000 1.19 +++ Simple.pm 5 Apr 2004 09:12:47 -0000 1.20 @@ -70,7 +70,8 @@ my @KnownOptOut = qw(keyattr keeproot contentkey noattr rootname xmldecl outputfile noescape suppressempty - grouptags nsexpand handler noindent attrindent nosort); + grouptags nsexpand handler noindent attrindent nosort + valueattr numericescape); my @DefKeyAttr = qw(name key id); my $DefRootName = qq(opt); @@ -330,7 +331,7 @@ if($filename) { # $tree = $xp->parsefile($filename); # Changed due to prob w/mod_perl local(*XML_FILE); - open(XML_FILE, "<$filename") || croak qq($filename - $!); + open(XML_FILE, '<', $filename) || croak qq($filename - $!); $tree = $xp->parse(*XML_FILE); close(XML_FILE); } @@ -540,8 +541,9 @@ } else { local(*OUT); - open(OUT, ">$self->{opt}->{outputfile}") || + open(OUT, '>', "$self->{opt}->{outputfile}") || croak "open($self->{opt}->{outputfile}): $!"; + binmode(OUT, ':utf8') if($] >= 5.008); print OUT $xml || croak "print: $!"; close(OUT); } @@ -1251,7 +1253,6 @@ } - # Convert to XML if(ref($ref)) { @@ -1283,7 +1284,7 @@ $ref = $self->hash_to_array($name, $ref); } - + my @result = (); my($key, $value); @@ -1384,6 +1385,14 @@ $value = {}; } } + + if(!ref($value) + and $self->{opt}->{valueattr} + and $self->{opt}->{valueattr}->{$key} + ) { + $value = { $self->{opt}->{valueattr}->{$key} => $value }; + } + if(ref($value) or $self->{opt}->{noattr}) { push @nested, $self->value_to_xml($value, $key, "$indent "); @@ -1518,7 +1527,24 @@ $data =~ s/>/>/sg; $data =~ s/"/"/sg; - return($data); + my $level = $self->{opt}->{numericescape} or return $data; + + return $self->numeric_escape($data, $level); +} + +sub numeric_escape { + my($self, $data, $level) = @_; + + use utf8; # required for 5.6 + + if($self->{opt}->{numericescape} eq '2') { + $data =~ s/([^\x00-\x7F])/'&#' . ord($1) . ';'/gse; + } + else { + $data =~ s/([^\x00-\xFF])/'&#' . ord($1) . ';'/gse; + } + + return $data; } @@ -2362,12 +2388,29 @@ I<Note: You must have the XML::NamespaceSupport module installed if you want C<XMLout()> to translate URIs back to prefixes>. +=head2 NumericEscape => 0 | 1 | 2 I<# out - handy> + +Use this option to have 'high' (non-ASCII) characters in your Perl data +structure converted to numeric entities (eg: €) in the XML output. Three +levels are possible: + +0 - default: no numeric escaping (OK if you're writing out UTF8) + +1 - only characters above 0xFF are escaped (ie: characters in the 0x80-FF range are not escaped), possibly useful with ISO8859-1 output + +2 - all characters above 0x7F are escaped (good for plain ASCII output) + =head2 OutputFile => <file specifier> I<# out - handy> The default behaviour of C<XMLout()> is to return the XML as a string. If you wish to write the XML to a file, simply supply the filename using the -'OutputFile' option. Alternatively, you can supply an IO handle object instead -of a filename. +'OutputFile' option. + +This option also accepts an IO handle object - especially useful in Perl 5.8.0 +and later for writing out in an encoding other than UTF-8, eg: + + open my $fh, '>:encoding(iso-8859-1)', $path or die "open($path): $!"; + XMLout($ref, OutputFile => $fh); =head2 ParserOpts => [ XML::Parser Options ] I<# in - don't use this> @@ -2417,17 +2460,6 @@ empty elements (rather than empty attributes), it also suppresses the generation of warnings about undefined values. -=head2 Variables => { name => value } I<# in - handy> - -This option allows variables in the XML to be expanded when the file is read. -(there is no facility for putting the variable names back if you regenerate -XML using C<XMLout>). - -A 'variable' is any text of the form C<${name}> which occurs in an attribute -value or in the text content of an element. If 'name' matches a key in the -supplied hashref, C<${name}> will be replaced with the corresponding value from -the hashref. If no matching key is found, the variable will not be replaced. - =head2 ValueAttr => [ names ] I<# in - handy> Use this option to deal elements which always have a single attribute and no @@ -2462,6 +2494,20 @@ the element and the attribute names. This is not only safer, it also allows the original XML to be reconstructed by C<XMLout()>. +Note: You probably don't want to use this option and the NoAttr option at the +same time. + +=head2 Variables => { name => value } I<# in - handy> + +This option allows variables in the XML to be expanded when the file is read. +(there is no facility for putting the variable names back if you regenerate +XML using C<XMLout>). + +A 'variable' is any text of the form C<${name}> which occurs in an attribute +value or in the text content of an element. If 'name' matches a key in the +supplied hashref, C<${name}> will be replaced with the corresponding value from +the hashref. If no matching key is found, the variable will not be replaced. + =head2 VarAttr => 'attr_name' I<# in - handy> In addition to the variables defined using C<Variables>, this option allows |
From: Petr P. <pa...@us...> - 2004-04-03 21:12:41
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11923 Modified Files: Makefile.PL Log Message: making LibXML 1.58 a PREREQ version Index: Makefile.PL =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/Makefile.PL,v retrieving revision 1.1.1.1 retrieving revision 1.2 diff -u -d -r1.1.1.1 -r1.2 --- Makefile.PL 14 Mar 2003 14:31:59 -0000 1.1.1.1 +++ Makefile.PL 3 Apr 2004 21:00:19 -0000 1.2 @@ -141,7 +141,7 @@ WriteMakefile( NAME => 'XML::LibXML::XPathContext', VERSION_FROM => 'XPathContext.pm', - PREREQ_PM => { 'XML::LibXML' => 1.51 }, + PREREQ_PM => { 'XML::LibXML' => 1.58 }, # add the DOM extensions to libxml2 'OBJECT' => '$(O_FILES)', %config, |
From: Petr P. <pa...@us...> - 2004-04-03 21:06:59
|
Update of /cvsroot/perl-xml/XML-LibXML-XPathContext In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11030 Modified Files: perl-libxml-mm.c Log Message: replaced malloc with Newc in accord with the same change in XML::LibXML 1.58 (reported and patch provided by Steve Hay). Index: perl-libxml-mm.c =================================================================== RCS file: /cvsroot/perl-xml/XML-LibXML-XPathContext/perl-libxml-mm.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- perl-libxml-mm.c 7 Nov 2003 15:19:23 -0000 1.4 +++ perl-libxml-mm.c 3 Apr 2004 20:54:35 -0000 1.5 @@ -146,8 +146,8 @@ } if ( node->_private == NULL ) { - proxy = (xpc_ProxyNodePtr)malloc(sizeof(struct _xpc_ProxyNode)); - /* proxy = (xpc_ProxyNodePtr)Newz(0, proxy, 0, xpc_ProxyNode); */ + /* proxy = (xpc_ProxyNodePtr)malloc(sizeof(struct _xpc_ProxyNode)); */ + Newc(0, proxy, 1, xpc_ProxyNode, xpc_ProxyNode); if (proxy != NULL) { proxy->node = node; proxy->owner = NULL; @@ -271,8 +271,8 @@ xpc_PmmFreeNode( libnode ); } - /* Safefree( node ); */ - free( node ); + Safefree( node ); + /* free( node ); */ } } else { |
From: Grant M. <gr...@us...> - 2004-03-31 10:19:47
|
Update of /cvsroot/perl-xml/xml-simple/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29794/t Modified Files: 1_XMLin.t Log Message: - integrate ValueAttr patch from Anton Berezin Index: 1_XMLin.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/1_XMLin.t,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- 1_XMLin.t 2 Mar 2004 08:18:02 -0000 1.18 +++ 1_XMLin.t 31 Mar 2004 10:07:58 -0000 1.19 @@ -17,7 +17,7 @@ plan skip_all => 'Test data missing'; } -plan tests => 117; +plan tests => 122; my $last_warning = ''; @@ -25,8 +25,8 @@ $@ = ''; eval "use XML::Simple;"; is($@, '', 'Module compiled OK'); -unless($XML::Simple::VERSION eq '2.11') { - diag("Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 2.11)"); +unless($XML::Simple::VERSION eq '2.12') { + diag("Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 2.12)"); } @@ -1261,6 +1261,97 @@ is_deeply($opt, [ 'one two', 'three four five', 'six', 'seveneightnine' ], "NS-11: space normalized in anonymous array"); +# Check that attributes called 'value' are not special + +$xml = q(<graphics> + <today value="today.png"/> + <nav-prev value="prev.png"/> + <nav-home value="home.png"/> + <nav-next value="next.png"/> +</graphics>); + +$opt = XMLin($xml); + +is_deeply($opt, { + 'today' => { value => "today.png" }, + 'nav-prev' => { value => "prev.png" }, + 'nav-home' => { value => "home.png" }, + 'nav-next' => { value => "next.png" }, +}, "Nothing special about 'value' attributes"); + +# Now turn on the ValueAttr option and try again + +$opt = XMLin($xml, ValueAttr => [ 'value' ]); + +is_deeply($opt, { + 'today' => "today.png", + 'nav-prev' => "prev.png", + 'nav-home' => "home.png", + 'nav-next' => "next.png", +}, "ValueAttr as arrayref works"); + +# Try with a list of different ValueAttr names + +$xml = q(<graphics> + <today xxx="today.png"/> + <nav-prev yyy="prev.png"/> + <nav-home zzz="home.png"/> + <nav-next value="next.png"/> +</graphics>); + +$opt = XMLin($xml, ValueAttr => [ qw(xxx yyy zzz) ]); + +is_deeply($opt, { + 'today' => "today.png", + 'nav-prev' => "prev.png", + 'nav-home' => "home.png", + 'nav-next' => { value => "next.png" }, +}, "ValueAttr as arrayref works"); + +# Try specifying ValueAttr as a hashref + +$xml = q(<graphics> + <today xxx="today.png"/> + <nav-prev value="prev.png"/> + <nav-home yyy="home.png"/> + <nav-next value="next.png"/> +</graphics>); + +$opt = XMLin($xml, + ValueAttr => { + 'today' => 'xxx', + 'nav-home' => 'yyy', + 'nav-next' => 'value' + } +); + +is_deeply($opt, { + 'today' => "today.png", + 'nav-prev' => { value => "prev.png" }, + 'nav-home' => "home.png", + 'nav-next' => "next.png", +}, "ValueAttr as hashref works too"); + +# Confirm that there's no conflict with KeyAttr or ContentKey defaults + +$xml = q(<graphics> + <today value="today.png"/> + <animal name="lion" age="7"/> + <animal name="elephant" age="97"/> + <colour rgb="#FF0000">red</colour> +</graphics>); + +$opt = XMLin($xml, ValueAttr => { 'today' => 'value' }); + +is_deeply($opt, { + today => 'today.png', + animal => { + lion => { age => 7 }, + elephant => { age => 97 }, + }, + colour => { rgb => '#FF0000', content => 'red' }, +}, "ValueAttr as hashref works too"); + # Now for a 'real world' test, try slurping in an SRT config file $opt = XMLin(File::Spec->catfile('t', 'srt.xml'), |
From: Grant M. <gr...@us...> - 2004-03-31 10:19:32
|
Update of /cvsroot/perl-xml/xml-simple/lib/XML In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29761/lib/XML Modified Files: Simple.pm Log Message: - integrate ValueAttr patch from Anton Berezin (XMLout() support still pending) Index: Simple.pm =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/lib/XML/Simple.pm,v retrieving revision 1.18 retrieving revision 1.19 diff -u -d -r1.18 -r1.19 --- Simple.pm 2 Mar 2004 08:18:02 -0000 1.18 +++ Simple.pm 31 Mar 2004 10:07:46 -0000 1.19 @@ -53,7 +53,7 @@ @ISA = qw(Exporter); @EXPORT = qw(XMLin XMLout); @EXPORT_OK = qw(xml_in xml_out); -$VERSION = '2.11'; +$VERSION = '2.12'; $PREFERRED_PARSER = undef; my $StrictMode = 0; @@ -66,7 +66,7 @@ my @KnownOptIn = qw(keyattr keeproot forcecontent contentkey noattr searchpath forcearray cache suppressempty parseropts grouptags nsexpand datahandler varattr variables - normalisespace normalizespace); + normalisespace normalizespace valueattr); my @KnownOptOut = qw(keyattr keeproot contentkey noattr rootname xmldecl outputfile noescape suppressempty @@ -763,6 +763,15 @@ } + # Special cleanup for {foldattr} which could be arrayref or hashref + + if(exists($opt->{valueattr})) { + if(ref($opt->{valueattr}) eq 'ARRAY') { + $opt->{valueattrlist} = {}; + $opt->{valueattrlist}->{$_} = 1 foreach(@{ delete $opt->{valueattr} }); + } + } + # make sure there's nothing weird in {grouptags} if($opt->{grouptags} and !UNIVERSAL::isa($opt->{grouptags}, 'HASH')) { @@ -880,6 +889,16 @@ } + # Roll up 'value' attributes (but only if no nested elements) + + if(!@_ and keys %$attr == 1) { + my($k) = keys %$attr; + if($self->{opt}->{valueattrlist} and $self->{opt}->{valueattrlist}->{$k}) { + return $attr->{$k}; + } + } + + # Add any nested elements my($key, $val); @@ -1008,6 +1027,19 @@ return(undef); } + + # Roll up named elements with named nested 'value' attributes + + if($self->{opt}->{valueattr}) { + while(my($key, $val) = each(%$attr)) { + next unless($self->{opt}->{valueattr}->{$key}); + next unless(UNIVERSAL::isa($val, 'HASH') and (keys %$val == 1)); + my($k) = keys %$val; + next unless($k eq $self->{opt}->{valueattr}->{$key}); + $attr->{$key} = $val->{$k}; + } + } + return($attr) } @@ -2396,6 +2428,40 @@ supplied hashref, C<${name}> will be replaced with the corresponding value from the hashref. If no matching key is found, the variable will not be replaced. +=head2 ValueAttr => [ names ] I<# in - handy> + +Use this option to deal elements which always have a single attribute and no +content. Eg: + + <opt> + <colour value="red" /> + <size value="XXL" /> + </opt> + +Setting C<< ValueAttr => [ 'value' ] >> will cause the above XML to parse to: + + { + colour => 'red', + size => 'XXL' + } + +instead of this (the default): + + { + colour => { value => 'red' }, + size => { value => 'XXL' } + } + +Note: This form of the ValueAttr option is not compatible with C<XMLout()> - +since the attribute name is discarded at parse time, the original XML cannot be +reconstructed. + +=head2 ValueAttr => { element => attribute, ... } I<# in+out - handy> + +This (preferred) form of the ValueAttr option requires you to specify both +the element and the attribute names. This is not only safer, it also allows +the original XML to be reconstructed by C<XMLout()>. + =head2 VarAttr => 'attr_name' I<# in - handy> In addition to the variables defined using C<Variables>, this option allows |
From: Grant M. <gr...@us...> - 2004-03-02 08:29:42
|
Update of /cvsroot/perl-xml/xml-simple In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32112 Modified Files: Changes README Log Message: - for release 2.11 Index: Changes =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/Changes,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- Changes 29 Feb 2004 10:06:51 -0000 1.15 +++ Changes 2 Mar 2004 08:18:01 -0000 1.16 @@ -1,5 +1,8 @@ Revision history for Perl module XML::Simple +2.11 Mar 31 2004 + - Fixed hash ordering assumption in a new test (reported by Jost Krieger) + 2.10 Feb 29 2004 - Added AttrIndent option (patch from Volker Moell) - Hash keys are now sorted alphabetically by default; enable the Index: README =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/README,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- README 29 Feb 2004 10:06:51 -0000 1.15 +++ README 2 Mar 2004 08:18:01 -0000 1.16 @@ -13,13 +13,13 @@ consider installing XML::SAX::Expat or XML::LibXML to replace the (slower) PurePerl parser from the XML::SAX distribution. + If you install using the CPAN.pm shell and you do not have either XML::Parser + or XML::SAX installed, then XML::SAX will be installed by default. + To generate documents with namespaces, XML::NamespaceSupport is required. The optional caching features of XML::Simple also require Storable.pm. - Note: These prerequisites cannot be resolved automatically by CPAN.pm - since you must decide whether to use XML::Parser or XML::SAX. - WARNING MESSAGES FROM XML::SAX @@ -56,12 +56,15 @@ STATUS - This version (2.10) is the current stable release. + This version (2.11) is the current stable release. Please send any feedback to the author: gr...@cp... NEW IN THIS RELEASE + - Fix for a broken test + + New in Version 2.10 - Added AttrIndent option (patch from Volker Moell) - Hash keys are now sorted alphabetically by default; enable the new NoSort option if you don't want this (patch from Volker Moell) |
From: Grant M. <gr...@us...> - 2004-03-02 08:29:40
|
Update of /cvsroot/perl-xml/xml-simple/t In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32112/t Modified Files: 1_XMLin.t Log Message: - for release 2.11 Index: 1_XMLin.t =================================================================== RCS file: /cvsroot/perl-xml/xml-simple/t/1_XMLin.t,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- 1_XMLin.t 29 Feb 2004 09:49:18 -0000 1.17 +++ 1_XMLin.t 2 Mar 2004 08:18:02 -0000 1.18 @@ -25,8 +25,8 @@ $@ = ''; eval "use XML::Simple;"; is($@, '', 'Module compiled OK'); -unless($XML::Simple::VERSION eq '2.10') { - diag("Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 2.10)"); +unless($XML::Simple::VERSION eq '2.11') { + diag("Warning: XML::Simple::VERSION = $XML::Simple::VERSION (expected 2.11)"); } |