XML-Generator-1.13 000755 001750 001750 0 14423335056 12574 5 ustar 00tim tim 000000 000000 README 100644 001750 001750 63272 14423335056 13567 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 NAME
XML::Generator - Perl extension for generating XML
SYNOPSIS
use XML::Generator ':pretty';
print foo(bar({ baz => 3 }, bam()),
bar([ 'qux' => 'http://qux.com/' ],
"Hey there, world"));
# OR
require XML::Generator;
my $X = XML::Generator->new(':pretty');
print $X->foo($X->bar({ baz => 3 }, $X->bam()),
$X->bar([ 'qux' => 'http://qux.com/' ],
"Hey there, world"));
Either of the above yield:
Hey there, world
DESCRIPTION
In general, once you have an XML::Generator object, you then simply call
methods on that object named for each XML tag you wish to generate.
XML::Generator can also arrange for undefined subroutines in the
caller's package to generate the corresponding XML, by exporting an
"AUTOLOAD" subroutine to your package. Just supply an ':import' argument
to your "use XML::Generator;" call. If you already have an "AUTOLOAD"
defined then XML::Generator can be configured to cooperate with it. See
"STACKABLE AUTOLOADs".
Say you want to generate this XML:
Bob
34
Accountant
Here's a snippet of code that does the job, complete with pretty
printing:
use XML::Generator;
my $gen = XML::Generator->new(':pretty');
print $gen->person(
$gen->name("Bob"),
$gen->age(34),
$gen->job("Accountant")
);
The only problem with this is if you want to use a tag name that Perl's
lexer won't understand as a method name, such as "shoe-size".
Fortunately, since you can store the name of a method in a variable,
there's a simple work-around:
my $shoe_size = "shoe-size";
$xml = $gen->$shoe_size("12 1/2");
Which correctly generates:
12 1/2
You can use a hash ref as the first parameter if the tag should include
atributes. Normally this means that the order of the attributes will be
unpredictable, but if you have the Tie::IxHash module, you can use it to
get the order you want, like this:
use Tie::IxHash;
tie my %attr, 'Tie::IxHash';
%attr = (name => 'Bob',
age => 34,
job => 'Accountant',
'shoe-size' => '12 1/2');
print $gen->person(\%attr);
This produces
An array ref can also be supplied as the first argument to indicate a
namespace for the element and the attributes.
If there is one element in the array, it is considered the URI of the
default namespace, and the tag will have an xmlns="URI" attribute added
automatically. If there are two elements, the first should be the tag
prefix to use for the namespace and the second element should be the
URI. In this case, the prefix will be used for the tag and an
xmlns:PREFIX attribute will be automatically added. Prior to version
0.99, this prefix was also automatically added to each attribute name.
Now, the default behavior is to leave the attributes alone (although you
may always explicitly add a prefix to an attribute name). If the prior
behavior is desired, use the constructor option "qualified_attributes".
If you specify more than two elements, then each pair should correspond
to a tag prefix and the corresponding URL. An xmlns:PREFIX attribute
will be added for each pair, and the prefix from the first such pair
will be used as the tag's namespace. If you wish to specify a default
namespace, use '#default' for the prefix. If the default namespace is
first, then the tag will use the default namespace itself.
If you want to specify a namespace as well as attributes, you can make
the second argument a hash ref. If you do it the other way around, the
array ref will simply get stringified and included as part of the
content of the tag.
Here's an example to show how the attribute and namespace parameters
work:
$xml = $gen->account(
$gen->open(['transaction'], 2000),
$gen->deposit(['transaction'], { date => '1999.04.03'}, 1500)
);
This generates:
2000
1500
Because default namespaces inherit, XML::Generator takes care to output
the xmlns="URI" attribute as few times as strictly necessary. For
example,
$xml = $gen->account(
$gen->open(['transaction'], 2000),
$gen->deposit(['transaction'], { date => '1999.04.03'},
$gen->amount(['transaction'], 1500)
)
);
This generates:
2000
1500
Notice how "xmlns="transaction"" was left out of the " tag.
Here is an example that uses the two-argument form of the namespace:
$xml = $gen->widget(['wru' => 'http://www.widgets-r-us.com/xml/'],
{'id' => 123}, $gen->contents());
Here is an example that uses multiple namespaces. It generates the first
example from the RDF primer ().
my $contactNS = [contact => "http://www.w3.org/2000/10/swap/pim/contact#"];
$xml = $gen->xml(
$gen->RDF([ rdf => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
@$contactNS ],
$gen->Person($contactNS, { 'rdf:about' => "http://www.w3.org/People/EM/contact#me" },
$gen->fullName($contactNS, 'Eric Miller'),
$gen->mailbox($contactNS, {'rdf:resource' => "mailto:em@w3.org"}),
$gen->personalTitle($contactNS, 'Dr.'))));
Eric Miller
Dr.
CONSTRUCTOR
XML::Generator->new(':option', ...);
XML::Generator->new(option => 'value', ...);
(Both styles may be combined)
The following options are available:
:std, :standard
Equivalent to
escape => 'always',
conformance => 'strict',
:strict
Equivalent to
conformance => 'strict',
:pretty[=N]
Equivalent to
escape => 'always',
conformance => 'strict',
pretty => N # N defaults to 2
namespace
This value of this option must be an array reference containing one or
two values. If the array contains one value, it should be a URI and will
be the value of an 'xmlns' attribute in the top-level tag. If there are
two or more elements, the first of each pair should be the namespace tag
prefix and the second the URI of the namespace. This will enable
behavior similar to the namespace behavior in previous versions; the tag
prefix will be applied to each tag. In addition, an xmlns:NAME="URI"
attribute will be added to the top-level tag. Prior to version 0.99, the
tag prefix was also automatically added to each attribute name, unless
overridden with an explicit prefix. Now, the attribute names are left
alone, but if the prior behavior is desired, use the constructor option
"qualified_attributes".
The value of this option is used as the global default namespace. For
example,
my $html = XML::Generator->new(
pretty => 2,
namespace => [HTML => "http://www.w3.org/TR/REC-html40"]);
print $html->html(
$html->body(
$html->font({ face => 'Arial' },
"Hello, there")));
would yield
Hello, there
Here is the same example except without all the prefixes:
my $html = XML::Generator->new(
pretty => 2,
namespace => ["http://www.w3.org/TR/REC-html40"]);
print $html->html(
$html->body(
$html->font({ 'face' => 'Arial' },
"Hello, there")));
would yield
Hello, there
qualifiedAttributes, qualified_attributes
Set this to a true value to emulate the attribute prefixing behavior of
XML::Generator prior to version 0.99. Here is an example:
my $foo = XML::Generator->new(
namespace => [foo => "http://foo.com/"],
qualifiedAttributes => 1);
print $foo->bar({baz => 3});
yields
escape
The contents and the values of each attribute have any illegal XML
characters escaped if this option is supplied. If the value is 'always',
then &, < and > (and " within attribute values) will be converted into
the corresponding XML entity, although & will not be converted if it
looks like it could be part of a valid entity (but see below). If the
value is 'unescaped', then the escaping will be turned off
character-by-character if the character in question is preceded by a
backslash, or for the entire string if it is supplied as a scalar
reference. So, for example,
use XML::Generator escape => 'always';
one('<'); # <
two('\&'); # \&
three(\''); # (scalar refs always allowed)
four('<'); # < (looks like an entity)
five('"'); # " (looks like an entity)
but
use XML::Generator escape => 'unescaped';
one('<'); # <
two('\&'); # &
three(\'');# (scalar refs always allowed)
four('<'); # < (no special case for entities)
By default, high-bit data will be passed through unmodified, so that
UTF-8 data can be generated with pre-Unicode perls. If you know that
your data is ASCII, use the value 'high-bit' for the escape option and
bytes with the high bit set will be turned into numeric entities. You
can combine this functionality with the other escape options by
comma-separating the values:
my $a = XML::Generator->new(escape => 'always,high-bit');
print $a->foo("<\242>");
yields
<¢>
Because XML::Generator always uses double quotes ("") around attribute
values, it does not escape single quotes. If you want single quotes
inside attribute values to be escaped, use the value 'apos' along with
'always' or 'unescaped' for the escape option. For example:
my $gen = XML::Generator->new(escape => 'always,apos');
print $gen->foo({'bar' => "It's all good"});
If you actually want & to be converted to & even if it looks like it
could be part of a valid entity, use the value 'even-entities' along
with 'always'. Supplying 'even-entities' to the 'unescaped' option is
meaningless as entities are already escaped with that option.
pretty
To have nice pretty printing of the output XML (great for config files
that you might also want to edit by hand), supply an integer for the
number of spaces per level of indenting, eg.
my $gen = XML::Generator->new(pretty => 2);
print $gen->foo($gen->bar('baz'),
$gen->qux({ tricky => 'no'}, 'quux'));
would yield
baz
quux
You may also supply a non-numeric string as the argument to 'pretty', in
which case the indents will consist of repetitions of that string. So if
you want tabbed indents, you would use:
my $gen = XML::Generator->new(pretty => "\t");
Pretty printing does not apply to CDATA sections or Processing
Instructions.
conformance
If the value of this option is 'strict', a number of syntactic checks
are performed to ensure that generated XML conforms to the formal XML
specification. In addition, since entity names beginning with 'xml' are
reserved by the W3C, inclusion of this option enables several special
tag names: xmlpi, xmlcmnt, xmldecl, xmldtd, xmlcdata, and xml to allow
generation of processing instructions, comments, XML declarations,
DTD's, character data sections and "final" XML documents, respectively.
Invalid characters (http://www.w3.org/TR/xml11/#charsets) will be
filtered out. To disable this behavior, supply the
'filter_invalid_chars' option with the value 0.
See "XML CONFORMANCE" and "SPECIAL TAGS" for more information.
filterInvalidChars, filter_invalid_chars
Set this to a 1 to enable filtering of invalid characters, or to 0 to
disable the filtering. See http://www.w3.org/TR/xml11/#charsets for the
set of valid characters.
allowedXMLTags, allowed_xml_tags
If you have specified 'conformance' => 'strict' but need to use tags
that start with 'xml', you can supply a reference to an array containing
those tags and they will be accepted without error. It is not an error
to supply this option if 'conformance' => 'strict' is not supplied, but
it will have no effect.
empty
There are 5 possible values for this option:
self - create empty tags as (default)
compact - create empty tags as
close - close empty tags as
ignore - don't do anything (non-compliant!)
args - use count of arguments to decide between and
Many web browsers like the 'self' form, but any one of the forms besides
'ignore' is acceptable under the XML standard.
'ignore' is intended for subclasses that deal with HTML and other SGML
subsets which allow atomic tags. It is an error to specify both
'conformance' => 'strict' and 'empty' => 'ignore'.
'args' will produce if there are no arguments at all, or if there
is just a single undef argument, and otherwise.
version
Sets the default XML version for use in XML declarations. See "xmldecl"
below.
encoding
Sets the default encoding for use in XML declarations.
dtd
Specify the dtd. The value should be an array reference with three
values; the type, the name and the uri.
xml
This is an hash ref value that should contain the version, encoding and
dtd values (same as above). This is used in case "conformance" is set to
"loose", but you still want to use the xml declaration or prolog.
IMPORT ARGUMENTS
use XML::Generator ':option';
use XML::Generator option => 'value';
(Both styles may be combined)
:import
Cause "use XML::Generator;" to export an "AUTOLOAD" to your package that
makes undefined subroutines generate XML tags corresponding to their
name. Note that if you already have an "AUTOLOAD" defined, it will be
overwritten.
:stacked
Implies :import, but if there is already an "AUTOLOAD" defined, the
overriding "AUTOLOAD" will still give it a chance to run. See "STACKABLE
AUTOLOADs".
ANYTHING ELSE
If you supply any other options, :import is implied and the
XML::Generator object that is created to generate tags will be
constructed with those options.
XML CONFORMANCE
When the 'conformance' => 'strict' option is supplied, a number of
syntactic checks are enabled. All entity and attribute names are checked
to conform to the XML specification, which states that they must begin
with either an alphabetic character or an underscore and may then
consist of any number of alphanumerics, underscores, periods or hyphens.
Alphabetic and alphanumeric are interpreted according to the current
locale if 'use locale' is in effect and according to the Unicode
standard for Perl versions >= 5.6. Furthermore, entity or attribute
names are not allowed to begin with 'xml' (in any case), although a
number of special tags beginning with 'xml' are allowed (see "SPECIAL
TAGS"). Note that you can also supply an explicit list of allowed tags
with the 'allowed_xml_tags' option.
Also, the filter_invalid_chars option is automatically set to 1 unless
it is explicitly set to 0.
SPECIAL TAGS
The following special tags are available when running under strict
conformance (otherwise they don't act special):
xmlpi
Processing instruction; first argument is target, remaining arguments
are attribute, value pairs. Attribute names are syntax checked, values
are escaped.
xmlcmnt
Comment. Arguments are concatenated and placed inside
comment delimiters. Any occurences of '--' in the concatenated arguments
are converted to '--'
xmldecl (@args)
Declaration. This can be used to specify the version, encoding, and
other XML-related declarations (i.e., anything inside the tag).
@args can be used to control what is output, as keyword-value pairs.
By default, the version is set to the value specified in the
constructor, or to 1.0 if it was not specified. This can be overridden
by providing a 'version' key in @args. If you do not want the version at
all, explicitly provide undef as the value in @args.
By default, the encoding is set to the value specified in the
constructor; if no value was specified, the encoding will be left out
altogether. Provide an 'encoding' key in @args to override this.
If a dtd was set in the constructor, the standalone attribute of the
declaration will be set to 'no' and the doctype declaration will be
appended to the XML declartion, otherwise the standalone attribute will
be set to 'yes'. This can be overridden by providing a 'standalone' key
in @args. If you do not want the standalone attribute to show up,
explicitly provide undef as the value.
xmldtd
DTD tag creation. The format of this method is different from
others. Since DTD's are global and cannot contain namespace information,
the first argument should be a reference to an array; the elements are
concatenated together to form the DTD:
print $xml->xmldtd([ 'html', 'PUBLIC', $xhtml_w3c, $xhtml_dtd ])
This would produce the following declaration:
Assuming that $xhtml_w3c and $xhtml_dtd had the correct values.
Note that you can also specify a DTD on creation using the new()
method's dtd option.
xmlcdata
Character data section; arguments are concatenated and placed inside
character data section delimiters. Any occurences of
']]>' in the concatenated arguments are converted to ']]>'.
xml
"Final" XML document. Must be called with one and exactly one
XML::Generator-produced XML document. Any combination of
XML::Generator-produced XML comments or processing instructions may also
be supplied as arguments. Prepends an XML declaration, and re-blesses
the argument into a "final" class that can't be embedded.
CREATING A SUBCLASS
For a simpler way to implement subclass-like behavior, see "STACKABLE
AUTOLOADs".
At times, you may find it desireable to subclass XML::Generator. For
example, you might want to provide a more application-specific interface
to the XML generation routines provided. Perhaps you have a custom
database application and would really like to say:
my $dbxml = new XML::Generator::MyDatabaseApp;
print $dbxml->xml($dbxml->custom_tag_handler(@data));
Here, custom_tag_handler() may be a method that builds a recursive XML
structure based on the contents of @data. In fact, it may even be named
for a tag you want generated, such as authors(), whose behavior changes
based on the contents (perhaps creating recursive definitions in the
case of multiple elements).
Creating a subclass of XML::Generator is actually relatively
straightforward, there are just three things you have to remember:
1. All of the useful utilities are in XML::Generator::util.
2. To construct a tag you simply have to call SUPER::tagname,
where "tagname" is the name of your tag.
3. You must fully-qualify the methods in XML::Generator::util.
So, let's assume that we want to provide a custom HTML table() method:
package XML::Generator::CustomHTML;
use base 'XML::Generator';
sub table {
my $self = shift;
# parse our args to get namespace and attribute info
my($namespace, $attr, @content) =
$self->XML::Generator::util::parse_args(@_)
# check for strict conformance
if ( $self->XML::Generator::util::config('conformance') eq 'strict' ) {
# ... special checks ...
}
# ... special formatting magic happens ...
# construct our custom tags
return $self->SUPER::table($attr, $self->tr($self->td(@content)));
}
That's pretty much all there is to it. We have to explicitly call
SUPER::table() since we're inside the class's table() method. The others
can simply be called directly, assuming that we don't have a tr() in the
current package.
If you want to explicitly create a specific tag by name, or just want a
faster approach than AUTOLOAD provides, you can use the tag() method
directly. So, we could replace that last line above with:
# construct our custom tags
return $self->XML::Generator::util::tag('table', $attr, ...);
Here, we must explicitly call tag() with the tag name itself as its
first argument so it knows what to generate. These are the methods that
you might find useful:
XML::Generator::util::parse_args()
This parses the argument list and returns the namespace (arrayref),
attributes (hashref), and remaining content (array), in that order.
XML::Generator::util::tag()
This does the work of generating the appropriate tag. The first
argument must be the name of the tag to generate.
XML::Generator::util::config()
This retrieves options as set via the new() method.
XML::Generator::util::escape()
This escapes any illegal XML characters.
Remember that all of these methods must be fully-qualified with the
XML::Generator::util package name. This is because AUTOLOAD is used by
the main XML::Generator package to create tags. Simply calling
parse_args() will result in a set of XML tags called .
Finally, remember that since you are subclassing XML::Generator, you do
not need to provide your own new() method. The one from XML::Generator
is designed to allow you to properly subclass it.
STACKABLE AUTOLOADs
As a simpler alternative to traditional subclassing, the "AUTOLOAD" that
"use XML::Generator;" exports can be configured to work with a
pre-defined "AUTOLOAD" with the ':stacked' option. Simply ensure that
your "AUTOLOAD" is defined before "use XML::Generator ':stacked';"
executes. The "AUTOLOAD" will get a chance to run first; the subroutine
name will be in your $AUTOLOAD as normal. Return an empty list to let
the default XML::Generator "AUTOLOAD" run or any other value to abort
it. This value will be returned as the result of the original method
call.
If there is no "import" defined, XML::Generator will create one. All
that this "import" does is export AUTOLOAD, but that lets your package
be used as if it were a subclass of XML::Generator.
An example will help:
package MyGenerator;
my %entities = ( copy => '©',
nbsp => ' ', ... );
sub AUTOLOAD {
my($tag) = our $AUTOLOAD =~ /.*::(.*)/;
return $entities{$tag} if defined $entities{$tag};
return;
}
use XML::Generator qw(:pretty :stacked);
This lets someone do:
use MyGenerator;
print html(head(title("My Title", copy())));
Producing:
My Title©
AUTHORS
Benjamin Holzman
Original author and maintainer
Bron Gondwana
First modular version
Nathan Wiger
Modular rewrite to enable subclassing
LICENSE
This library is free software, you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
The XML::Writer module
http://search.cpan.org/search?mode=module&query=XML::Writer
LICENSE 100644 001750 001750 43711 14423335056 13710 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 This software is copyright (c) 1998 - 2023 by Benjamin Holzman.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
Terms of the Perl programming language system itself
a) the GNU General Public License as published by the Free
Software Foundation; either version 1, or (at your option) any
later version, or
b) the "Artistic License"
--- The GNU General Public License, Version 1, February 1989 ---
This software is Copyright (c) 1998 - 2023 by Benjamin Holzman.
This is free software, licensed under:
The GNU General Public License, Version 1, February 1989
GNU GENERAL PUBLIC LICENSE
Version 1, February 1989
Copyright (C) 1989 Free Software Foundation, Inc.
51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
Preamble
The license agreements of most software companies try to keep users
at the mercy of those companies. By contrast, our General Public
License is intended to guarantee your freedom to share and change free
software--to make sure the software is free for all its users. The
General Public License applies to the Free Software Foundation's
software and to any other program whose authors commit to using it.
You can use it for your programs, too.
When we speak of free software, we are referring to freedom, not
price. Specifically, the General Public License is designed to make
sure that you have the freedom to give away or sell copies of free
software, that you receive source code or can get it if you want it,
that you can change the software or use pieces of it in new free
programs; and that you know you can do these things.
To protect your rights, we need to make restrictions that forbid
anyone to deny you these rights or to ask you to surrender the rights.
These restrictions translate to certain responsibilities for you if you
distribute copies of the software, or if you modify it.
For example, if you distribute copies of a such a program, whether
gratis or for a fee, you must give the recipients all the rights that
you have. You must make sure that they, too, receive or can get the
source code. And you must tell them their rights.
We protect your rights with two steps: (1) copyright the software, and
(2) offer you this license which gives you legal permission to copy,
distribute and/or modify the software.
Also, for each author's protection and ours, we want to make certain
that everyone understands that there is no warranty for this free
software. If the software is modified by someone else and passed on, we
want its recipients to know that what they have is not the original, so
that any problems introduced by others will not reflect on the original
authors' reputations.
The precise terms and conditions for copying, distribution and
modification follow.
GNU GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any program or other work which
contains a notice placed by the copyright holder saying it may be
distributed under the terms of this General Public License. The
"Program", below, refers to any such program or work, and a "work based
on the Program" means either the Program or any work containing the
Program or a portion of it, either verbatim or with modifications. Each
licensee is addressed as "you".
1. You may copy and distribute verbatim copies of the Program's source
code as you receive it, in any medium, provided that you conspicuously and
appropriately publish on each copy an appropriate copyright notice and
disclaimer of warranty; keep intact all the notices that refer to this
General Public License and to the absence of any warranty; and give any
other recipients of the Program a copy of this General Public License
along with the Program. You may charge a fee for the physical act of
transferring a copy.
2. You may modify your copy or copies of the Program or any portion of
it, and copy and distribute such modifications under the terms of Paragraph
1 above, provided that you also do the following:
a) cause the modified files to carry prominent notices stating that
you changed the files and the date of any change; and
b) cause the whole of any work that you distribute or publish, that
in whole or in part contains the Program or any part thereof, either
with or without modifications, to be licensed at no charge to all
third parties under the terms of this General Public License (except
that you may choose to grant warranty protection to some or all
third parties, at your option).
c) If the modified program normally reads commands interactively when
run, you must cause it, when started running for such interactive use
in the simplest and most usual way, to print or display an
announcement including an appropriate copyright notice and a notice
that there is no warranty (or else, saying that you provide a
warranty) and that users may redistribute the program under these
conditions, and telling the user how to view a copy of this General
Public License.
d) You may charge a fee for the physical act of transferring a
copy, and you may at your option offer warranty protection in
exchange for a fee.
Mere aggregation of another independent work with the Program (or its
derivative) on a volume of a storage or distribution medium does not bring
the other work under the scope of these terms.
3. You may copy and distribute the Program (or a portion or derivative of
it, under Paragraph 2) in object code or executable form under the terms of
Paragraphs 1 and 2 above provided that you also do one of the following:
a) accompany it with the complete corresponding machine-readable
source code, which must be distributed under the terms of
Paragraphs 1 and 2 above; or,
b) accompany it with a written offer, valid for at least three
years, to give any third party free (except for a nominal charge
for the cost of distribution) a complete machine-readable copy of the
corresponding source code, to be distributed under the terms of
Paragraphs 1 and 2 above; or,
c) accompany it with the information you received as to where the
corresponding source code may be obtained. (This alternative is
allowed only for noncommercial distribution and only if you
received the program in object code or executable form alone.)
Source code for a work means the preferred form of the work for making
modifications to it. For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.
4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License. However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.
5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.
6. Each time you redistribute the Program (or any work based on the
Program), the recipient automatically receives a license from the original
licensor to copy, distribute or modify the Program subject to these
terms and conditions. You may not impose any further restrictions on the
recipients' exercise of the rights granted herein.
7. The Free Software Foundation may publish revised and/or new versions
of the General Public License from time to time. Such new versions will
be similar in spirit to the present version, but may differ in detail to
address new problems or concerns.
Each version is given a distinguishing version number. If the Program
specifies a version number of the license which applies to it and "any
later version", you have the option of following the terms and conditions
either of that version or of any later version published by the Free
Software Foundation. If the Program does not specify a version number of
the license, you may choose any version ever published by the Free Software
Foundation.
8. If you wish to incorporate parts of the Program into other free
programs whose distribution conditions are different, write to the author
to ask for permission. For software which is copyrighted by the Free
Software Foundation, write to the Free Software Foundation; we sometimes
make exceptions for this. Our decision will be guided by the two goals
of preserving the free status of all derivatives of our free software and
of promoting the sharing and reuse of software generally.
NO WARRANTY
9. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
REPAIR OR CORRECTION.
10. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
POSSIBILITY OF SUCH DAMAGES.
END OF TERMS AND CONDITIONS
Appendix: How to Apply These Terms to Your New Programs
If you develop a new program, and you want it to be of the greatest
possible use to humanity, the best way to achieve this is to make it
free software which everyone can redistribute and change under these
terms.
To do so, attach the following notices to the program. It is safest to
attach them to the start of each source file to most effectively convey
the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
Copyright (C) 19yy
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 1, or (at your option)
any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301 USA
Also add information on how to contact you by electronic and paper mail.
If the program is interactive, make it output a short notice like this
when it starts in an interactive mode:
Gnomovision version 69, Copyright (C) 19xx name of author
Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
This is free software, and you are welcome to redistribute it
under certain conditions; type `show c' for details.
The hypothetical commands `show w' and `show c' should show the
appropriate parts of the General Public License. Of course, the
commands you use may be called something other than `show w' and `show
c'; they could even be mouse-clicks or menu items--whatever suits your
program.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the program, if
necessary. Here a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
program `Gnomovision' (a program to direct compilers to make passes
at assemblers) written by James Hacker.
, 1 April 1989
Ty Coon, President of Vice
That's all there is to it!
--- The Artistic License 1.0 ---
This software is Copyright (c) 1998 - 2023 by Benjamin Holzman.
This is free software, licensed under:
The Artistic License 1.0
The Artistic License
Preamble
The intent of this document is to state the conditions under which a Package
may be copied, such that the Copyright Holder maintains some semblance of
artistic control over the development of the package, while giving the users of
the package the right to use and distribute the Package in a more-or-less
customary fashion, plus the right to make reasonable modifications.
Definitions:
- "Package" refers to the collection of files distributed by the Copyright
Holder, and derivatives of that collection of files created through
textual modification.
- "Standard Version" refers to such a Package if it has not been modified,
or has been modified in accordance with the wishes of the Copyright
Holder.
- "Copyright Holder" is whoever is named in the copyright or copyrights for
the package.
- "You" is you, if you're thinking about copying or distributing this Package.
- "Reasonable copying fee" is whatever you can justify on the basis of media
cost, duplication charges, time of people involved, and so on. (You will
not be required to justify it to the Copyright Holder, but only to the
computing community at large as a market that must bear the fee.)
- "Freely Available" means that no fee is charged for the item itself, though
there may be fees involved in handling the item. It also means that
recipients of the item may redistribute it under the same conditions they
received it.
1. You may make and give away verbatim copies of the source form of the
Standard Version of this Package without restriction, provided that you
duplicate all of the original copyright notices and associated disclaimers.
2. You may apply bug fixes, portability fixes and other modifications derived
from the Public Domain or from the Copyright Holder. A Package modified in such
a way shall still be considered the Standard Version.
3. You may otherwise modify your copy of this Package in any way, provided that
you insert a prominent notice in each changed file stating how and when you
changed that file, and provided that you do at least ONE of the following:
a) place your modifications in the Public Domain or otherwise make them
Freely Available, such as by posting said modifications to Usenet or an
equivalent medium, or placing the modifications on a major archive site
such as ftp.uu.net, or by allowing the Copyright Holder to include your
modifications in the Standard Version of the Package.
b) use the modified Package only within your corporation or organization.
c) rename any non-standard executables so the names do not conflict with
standard executables, which must also be provided, and provide a separate
manual page for each non-standard executable that clearly documents how it
differs from the Standard Version.
d) make other distribution arrangements with the Copyright Holder.
4. You may distribute the programs of this Package in object code or executable
form, provided that you do at least ONE of the following:
a) distribute a Standard Version of the executables and library files,
together with instructions (in the manual page or equivalent) on where to
get the Standard Version.
b) accompany the distribution with the machine-readable source of the Package
with your modifications.
c) accompany any non-standard executables with their corresponding Standard
Version executables, giving the non-standard executables non-standard
names, and clearly documenting the differences in manual pages (or
equivalent), together with instructions on where to get the Standard
Version.
d) make other distribution arrangements with the Copyright Holder.
5. You may charge a reasonable copying fee for any distribution of this
Package. You may charge any fee you choose for support of this Package. You
may not charge a fee for this Package itself. However, you may distribute this
Package in aggregate with other (possibly commercial) programs as part of a
larger (possibly commercial) software distribution provided that you do not
advertise this Package as a product of your own.
6. The scripts and library files supplied as input to or produced as output
from the programs of this Package do not automatically fall under the copyright
of this Package, but belong to whomever generated them, and may be sold
commercially, and may be aggregated with this Package.
7. C or perl subroutines supplied by you and linked into this Package shall not
be considered part of this Package.
8. The name of the Copyright Holder may not be used to endorse or promote
products derived from this software without specific prior written permission.
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED
WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
The End
Changes 100644 001750 001750 23160 14423335056 14172 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 Revision history for Perl extension XML::Generator.
1.13 -- Sat Apr 29 21:45:32 ADT 2023
Production Release of 1.12 no changes.
[Significant Updates since 1.11]
Two fairly minor updates that should not impact anyone much.
Dropping support for 5.008 - if you really need it send a PR
to fix. There has been a longstanding "bug" that inserted
standalone in the xml declaration whether it was needed or not.
This makes it optional if it is not required for
externally-defined DTD or directly specified.
- 1a4e7a0 Update version for Release 1.13
- abb366d v1.12
1.12 -- Sat Apr 29 11:55:46 ADT 2023
[Significant Updates since 1.11]
Two fairly minor updates that should not impact anyone much.
Dropping support for 5.008 - if you really need it send a PR
to fix. There has been a longstanding "bug" that inserted
standalone in the xml declaration whether it was needed or not.
This makes it optional if it is not required for
externally-defined DTD or directly specified.
- 1a7defd Forgot to increment the number of tests
- 7a05609 Fix standalone bug
- aa3c19d Add autoprereqs
- a458ec3 Drop support for perl 5.008
- 85847a1 v1.11
1.11 -- Mon Apr 17 17:17:55 ADT 2023
[Significant Updates since 1.09]
Allow the xml tag attributes to be specified during construction
when conformance is not 'strict' by Wesley Schwengle (waterkip)
Release 1.10 for production
- 0ff9e8b Update for production release
- 85396bc Update Copyright year
- 30c95bf v1.10
1.10 -- Sun Apr 16 20:10:11 ADT 2023
[Significant Updates since 1.09]
Allow the xml tag attributes to be specified during construction
when conformance is not 'strict'
- efc7d9d Update for release
- 83b1699 Remove VERSION number from git repo
- a49e891 Add new xml option to constructor
- 4171530 v1.09
1.09 -- Fri Feb 18 23:06:27 AST 2022
- b31c19f Increment version
- 1a3fa9e Fix RT 49038: Doc bug - escaping
- d398d9c Fix dependency info
1.08 -- Thu Feb 17 20:00:24 AST 2022
[Significant Updates since 1.04]
- Fix RT 77323: escape all characters outside the normal ASCII range
- Fix RT 80273 v1.04 incorrectly escaping stringified inner tags
- Fix RT 70986 and provides test
- Move to Dist::Zilla to build
[Changes since 1.07]
- 6258a3b Update version number for release
- c9a09d4 v1.07
1.07 -- Thu Feb 17 16:58:42 AST 2022
- c70c220 Add .gitignore
- 124e36a Update version and Dist::Zilla settings
- 0f6ccd0 Fix some pod issues
1.06 -- Thu Feb 17 08:04:38 AST 2022
- 7c9d6d5 v1.06
- a676ff3 Merge pull request #1 from perl-net-saml2/distzilla
- d565282 Move to Dist::Zilla
1.05 Wed Feb 16 22:00:00 2022
- 1eb746e (tag: 1.05) Update for new release
- 0e895a0 Add github action
- f636f4b Fix RT 77323: escape all characters outside the normal ASCII range
- 423c2cf Fix RT 80273 v1.04 incorrectly escaping stringified inner tags
- 8ef1c52 Fixes RT 70986 and provides test
1.04 Fri Jul 15 08:35:00 2011
- Added the filter_invalid_chars option, which is turned on by default
under strict mode.
1.03 Thu Jul 30 17:02:00 2009
- Version bump because somebody released an unauthorized
XML-Generator-1.02
1.01 Tue Jul 8 11:45:00 2007
- Documentation cleanup.
1.0 Fri Jun 22 16:51:00 2007
- Fixed bug #23594, "Embedded escaping does not work as expected",
reported by M. Zizka; clarified documentation and added 'even-entities'
argument to 'escape' parameter.
- As part of above fix, supplying an unexpected true argument to 'escape'
parameter results in warning.
- Fixed bug #18609, "cdata also pretty-printed", reported by Daniel Schroeer.
- Fixed bug #18656, reported by Peter (Stig) Edwards; just removed single
quotes around Tie::IxHash in require line.
0.99_02 Tue Oct 19 23:02:00 2004
- Fixed mistake in RDF example.
0.99_01 Tue Oct 19 22:58:00 2004
- Changed default behavior of 'use XML::Generator' to not attempt to export
AUTOLOAD. Removed ':noimport' option.
- Allowed more than two components in a namespace, to allow explicit xmlns:
attributes to be output on demand. Introduced '#default' token.
- Improved output aesthetics when there are lot of attributes and the generator
was configured with the 'pretty' option.
- Added allowedXMLTags (alias to allowed_xml_tags) and qualified_attributes
(alias to qualifiedAttributes) to rationalize interface.
0.99 Tue Mar 23 11:17:00 2004
- Removed automatic prefixing of attribute names when using a namespace.
- Added 'qualifiedAttributes' constructor option to emulate prior attribute
prefixing behavior.
- Always syntax check attribute names under strict conformance.
- Add documentation on using Tie::IxHash to get predictable attribute ordering.
- Allow tag 'AUTOLOAD'.
- Fixed bug with default namespace.
- More tests
0.98 Mon Mar 1 18:26:00 2004
- Fixed bug in DOM.t when XML::DOM not installed (caused by fix in 0.97)
0.97 Mon Mar 1 15:22:00 2004
- Fixed bugs in DOM.t reported by David Wheeler.
0.96 Sun Feb 29 23:00:00 2004
- More documentation fixups.
- Only check for xml() subs under strict conformance.
- Small performance optimizations.
0.95 Sun Feb 29 22:21:00 2004
- Enhanced STACKED AUTOLOAD feature to provide a default import()
- Documentation fixups.
0.94 Sun Feb 29 14:21:00 2004
- FIXED IMPLEMENTATION OF NAMESPACES!! XML::Generator is now conformant.
Note that the semantics of namespaces have changed!
- Implemented AUTOLOAD exporting to simplify syntax.
- Implement STACKED AUTOLOADs to simplify sub-classing.
- Added "macro" options ':standard', ':std', ':strict' and ':pretty'.
- Added new 'allowed_xml_tags' option to allow tags starting with 'xml'
under strict conformance.
- Documented the 'version', 'encoding' and 'dtd' options.
- Added arguments to xmldecl() to allow more control.
- Changed XML comment behavior when escaping '--' to escape both dashes.
- Fixed memory leak in constructor. Bug #4513.
- Fixed bug in t/DOM.t that caused it to fail when DOM.pm was installed. Bug #3220.
0.93 Wed Jan 22 10:41:00 2003
- Added 'high-bit' option to escape to allow escaping of upper ASCII.
- Fixed a test bug that assumed the order of elements in a hash.
0.92 Tue Jan 21 13:12:00 2003
- Finally (after multiple bug reports) stopped requiring that XML::DOM be
installed for the tests to pass. Sorry this took so long to get fixed.
- Also fixed a bug in XML::Generator::DOM's POD that made it look strange
on search.cpan.org (reported by Ken Williams).
0.91 Mon Dec 11 11:33:32 2000
- Added XML::Generator::DOM subclass for producing DOM trees instead of
strings.
- New choices for the 'empty' option: 'compact' and 'args'.
- Changed the semantics of 'pretty' option; CDATA sections and Processing
Instructions are no longer subject to the pretty printing rules. Thanks
for the bug report from Murat Uenalan.
- Using closures for tag generation, which seems to save a little bit of
time. Might not be worth it in the long run, for maintainability's sake.
- Fix for perl versions that can't use 'for' as a statement modifier (pre 5.005)
courtesy of Neil Prockter (n.prockter@lse.ac.uk).
- Some documentation fixups.
0.9 Sat Nov 18 11:13:24 2000
- Massive code reorganization to support subclassing, courtesy of
Nathan Winger (nate@nateware.com)
- New instantiation option, 'empty', to control how empty tags are
rendered.
- Improved internal representation for improved performance
( $gen->foo($gen->bar($gen->baz( $really_big_string ))) used to copy
$really_big_string three times; as long as the 'pretty' option is not
supplied, this is no longer the case. )
- Fixed xml() tag to allow comments and processing instructions before
and/or after the xml document.
- New special tag, xmldtd(), which used to be part of xmldecl().
0.8 Wed Jul 12 17:10:12 2000
- Bug-fix for pretty-printing
- New special tag, "xml" which takes a complete XML document and
"finalizes" it, so it can't be further embedded.
- Arguments passed as scalar refs will not be escaped, even if the
XML::Generator object was constructed with the 'escape' => "always"
option.
0.7 Mon Jun 13 09:14:32 2000
- Pretty-printing patch from Bron Gondwana
- Undefined warnings patch from Bron Gondwana
0.6 Sun Jun 11 16:02:00 2000
- Cleaned-up, modularized rewrite courtesy of Bron Gondwana
(perlcode@brong.net)
- XML::Generator now returns objects blessed into XML::Generator::auto
which contains only an AUTOLOAD that redirects requests to the
proper method in XML::Generator.
- A new option is available in the constructor to force stricter
conformance to the XML specification ('conformance' => 'strict').
This also enables some special tags; "xmlpi", "xmlcmnt", "xmldecl"
and "xmlcdata" that can be used to generate, respectively, processing
instructions, comments, the XML declaration, and character data
sections.
0.5 Thu Sep 08 11:12:04 1999
- Fixed one lingering definedness bug
- Added escaping options to XMLify content
- Added global namespace option
- Fixed namespace support somewhat
0.4 Fri Jul 02 11:44:32 1999
- Fixed a few remarkably dumb bugs which I can't believe survived
this long. Improved the documentation slightly.
0.3 Tue Apr 13 09:11:13 1999
- Fixed undefined variables warnings as reported by John Labovitz
(johnl@meer.net)
0.2 Wed Feb 10 12:00:00 1999
- Added support for namespaces; bholzman
- Allowed "new" as a tag name; bholzman
0.1 Wed Nov 11 20:39:11 1998
- first public version; bholzman
0.01 Wed Nov 11 20:17:39 1998
- original version; created by h2xs 1.18
t 000755 001750 001750 0 14423335056 12760 5 ustar 00tim tim 000000 000000 XML-Generator-1.13 DOM.t 100644 001750 001750 6420 14423335056 13726 0 ustar 00tim tim 000000 000000 XML-Generator-1.13/t #!/usr/bin/perl -w
use Test;
unless (eval "use XML::DOM; 1;") {
print "1..0 # Skipped: XML::DOM not installed\n";
exit;
}
plan tests => 36;
require XML::Generator::DOM;
my $x = new XML::Generator::DOM;
ok($x);
my $xml = $x->foo();
ok($xml->toString, '');
$xml = $x->bar(42);
ok($xml->toString, '42');
$xml = $x->baz({'foo'=>3});
ok($xml->toString, '');
$xml = $x->password('パスワードをお忘れの方');
ok($xml->toString, 'パスワードをお忘れの方');
$xml = $x->bam({'bar'=>42},$x->foo(),"qux");
ok($xml->toString, 'qux');
$xml = $x->new(3);
ok($xml->toString, '3');
$xml = $x->foo(['baz']);
ok($xml->toString, '');
$xml = $x->foo(['baz'],{'bar'=>42},3);
ok($xml->toString, '3');
$xml = $x->foo({'id' => 4}, 3, 5);
ok($xml->toString, '35');
$xml = $x->foo({'id' => 4}, 0, 5);
ok($xml->toString, '05');
$xml = $x->foo({'id' => 4}, 3, 0);
ok($xml->toString, '30');
my $foo_bar = "foo-bar";
$xml = $x->$foo_bar(42);
ok($xml->toString, '42');
$x = new XML::Generator::DOM 'namespace' => ['A'];
$xml = $x->foo({'bar' => 42}, $x->bar(['B'], {'bar' => 54}));
ok($xml->toString, '');
$xml = $x->xmldecl();
ok(UNIVERSAL::isa($xml, 'XML::DOM::XMLDecl'));
ok($xml->getVersion, '1.0');
ok($xml->getStandalone, 'yes');
$xml = $x->xmlcmnt("test");
ok(UNIVERSAL::isa($xml, 'XML::DOM::Comment'));
ok($xml->getData, 'test');
$x = new XML::Generator::DOM
'version' => '1.1',
'encoding' => 'iso-8859-2';
$xml = $x->xmldecl();
ok($xml->getVersion, '1.1');
ok($xml->getEncoding, 'iso-8859-2');
$xml = $x->xmlpi("target", 'option="value"');
ok(UNIVERSAL::isa($xml, 'XML::DOM::ProcessingInstruction'));
ok($xml->getTarget, 'target');
ok($xml->getData, 'option="value"');
eval {
my $t = "42";
$x->$t();
};
ok(UNIVERSAL::isa($@, 'XML::DOM::DOMException'));
$xml = $x->foo(['bar'], {'baz:foo' => 'qux', 'fob' => 'gux'});
ok($xml->toString eq '' ||
$xml->toString eq '');
$x = new XML::Generator::DOM 'dtd' => [ 'foo', 'SYSTEM', '"http://foo.com/foo"' ];
$xml = $x->xmldecl();
ok($xml->getStandalone, 'no');
$xml = $x->xmlcdata("test");
ok(UNIVERSAL::isa($xml, 'XML::DOM::CDATASection'));
ok($xml->getData, 'test');
$x = new XML::Generator::DOM;
$xml = $x->foo($x->xmlcdata("bar"), $x->xmlpi("baz", "bam"));
ok($xml->toString, '');
$xml = $x->foo(42);
$xml = $x->xml($xml);
ok($xml->toString,
'
42
');
eval {
$xml = $x->bar($xml);
};
ok($@);
ok($@->getName, 'WRONG_DOCUMENT_ERR');
$xml = $x->foo();
$cmnt = $x->xmlcmnt("comment");
$pi = $x->xmlpi("foo", "bar");
$xml = $x->xml($cmnt, $xml, $pi);
ok($xml->toString, '
');
require XML::DOM;
$doc = XML::DOM::Parser->new->parse('');
$x = XML::Generator::DOM->new( dom_document => $doc );
$doc->getFirstChild->appendChild($x->foo(42));
ok($doc->toString,
'42
');
eval {
$xml = $x->xml($x->bar(12));
};
ok($@ =~ /method not allowed/);
META.yml 100644 001750 001750 3015 14423335056 14125 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 ---
abstract: 'Perl extension for generating XML'
author:
- 'Benjamin Holzman '
build_requires:
Test: '0'
Test::More: '0'
configure_requires:
ExtUtils::MakeMaker: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010'
license: perl
meta-spec:
url: http://module-build.sourceforge.net/META-spec-v1.4.html
version: '1.4'
name: XML-Generator
provides:
XML::Generator:
file: lib/XML/Generator.pm
version: '1.13'
XML::Generator::DOM:
file: lib/XML/Generator/DOM.pm
version: '1.13'
XML::Generator::DOM::util:
file: lib/XML/Generator/DOM.pm
version: '1.13'
XML::Generator::cdata:
file: lib/XML/Generator.pm
version: '1.13'
XML::Generator::comment:
file: lib/XML/Generator.pm
version: '1.13'
XML::Generator::final:
file: lib/XML/Generator.pm
version: '1.13'
XML::Generator::overload:
file: lib/XML/Generator.pm
version: '1.13'
XML::Generator::pi:
file: lib/XML/Generator.pm
version: '1.13'
XML::Generator::pretty:
file: lib/XML/Generator.pm
version: '1.13'
XML::Generator::util:
file: lib/XML/Generator.pm
version: '1.13'
recommends:
XML::DOM: '1.46'
requires:
Carp: '0'
perl: '5.010'
resources:
repository: git://github.com/timlegge/perl-XML-Generator.git
version: '1.13'
x_generated_by_perl: v5.34.0
x_maintainers:
- 'Timothy Legge '
x_serialization_backend: 'YAML::Tiny version 1.73'
x_spdx_expression: 'Artistic-1.0-Perl OR GPL-1.0-or-later'
MANIFEST 100644 001750 001750 473 14423335056 13772 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 # This file was automatically generated by Dist::Zilla::Plugin::Manifest v6.029.
Changes
LICENSE
MANIFEST
META.json
META.yml
Makefile.PL
README
SIGNATURE
cpanfile
dist.ini
lib/XML/Generator.pm
lib/XML/Generator/DOM.pm
t/DOM.t
t/Generator.t
t/Issue-70986.t
t/Issue-80273.t
t/author-pod-spell.t
t/author-pod-syntax.t
cpanfile 100644 001750 001750 1160 14423335056 14357 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 # This file is generated by Dist::Zilla::Plugin::CPANFile v6.029
# Do not edit this file directly. To change prereqs, edit the `dist.ini` file.
requires "Carp" => "0";
requires "perl" => "5.010";
recommends "XML::DOM" => "1.46";
suggests "Tie::IxHash" => "0";
on 'test' => sub {
requires "Test" => "0";
requires "Test::More" => "0";
};
on 'test' => sub {
recommends "XML::DOM" => "1.46";
};
on 'test' => sub {
suggests "Tie::IxHash" => "0";
};
on 'configure' => sub {
requires "ExtUtils::MakeMaker" => "0";
};
on 'develop' => sub {
requires "Test::Pod" => "1.41";
requires "Test::Spelling" => "0.12";
};
dist.ini 100644 001750 001750 4175 14423335056 14330 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 name = XML-Generator
author = Benjamin Holzman
license = Perl_5
copyright_holder = Benjamin Holzman
copyright_year = 1998 - 2023
[Meta::Maintainers]
maintainer = Timothy Legge
[@Filter]
bundle = @Basic
remove = Readme
remove = GatherDir
[AutoPrereqs]
skip = base
skip = constant
skip = overload
skip = strict
skip = vars
skip = warnings
skip = utf8
skip = Tie::IxHash
skip = XML::DOM
[Prereqs / RuntimeRequires]
perl = 5.010
[Prereqs / RuntimeRecommends]
XML::DOM = 1.46
[Prereqs / RuntimeSuggests]
Tie::IxHash = 0
[Prereqs / TestRecommends]
XML::DOM = 1.46
[Prereqs / TestSuggests]
Tie::IxHash = 0
[MetaProvides::Package]
[MetaJSON]
[Pod2Readme]
[CPANFile]
[ManifestSkip]
[NextRelease]
format = %v -- %{EEE MMM dd HH:mm:ss VVV yyyy}d
filename = Changes
[PodSyntaxTests]
[Test::PodSpelling]
stopword = Bron
stopword = CDATA
stopword = DTD
stopword = Gondwana
stopword = RDF
stopword = STACKABLE
stopword = Wiger
stopword = allowedXMLTags
stopword = apos
stopword = atributes
stopword = declartion
stopword = desireable
stopword = doctype
stopword = dtd
stopword = eg
stopword = filterInvalidChars
stopword = qualifiedAttributes
stopword = xml
stopword = xmlcdata
stopword = xmlcmnt
stopword = xmldecl
stopword = xmldtd
stopword = xmlns
stopword = xmlpi
stopword = prolog
[CopyFilesFromBuild::Filtered]
copy = cpanfile
copy = Makefile.PL
copy = README
[CopyFilesFromRelease]
copy = cpanfile, Makefile.PL, README
[Repository]
git_remote = origin
[Git::NextVersion]
first_version = 1.07 ; this is the default
version_by_branch = 0 ; this is the default
version_regexp = ^(1.\d+)$ ; this is the default
[OurPkgVersion]
[WriteVersion]
[Git::GatherDir]
exclude_filename = cpanfile
exclude_filename = Makefile.PL
exclude_filename = MANIFEST
exclude_filename = README
;[Git::Tag]
;tag_format = %V ; this is the default
;tag_message = %V ; this is the default
[@Git]
changelog = Changes ; this is the default
tag_format = %V ; Don't proceed tags with "v"
tag_message = %V ; this is the default
push_to = origin ; see Git::Push
[Signature]
[SignReleaseNotes]
META.json 100644 001750 001750 5456 14423335056 14310 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 {
"abstract" : "Perl extension for generating XML",
"author" : [
"Benjamin Holzman "
],
"dynamic_config" : 0,
"generated_by" : "Dist::Zilla version 6.029, CPAN::Meta::Converter version 2.150010",
"license" : [
"perl_5"
],
"meta-spec" : {
"url" : "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
"version" : 2
},
"name" : "XML-Generator",
"prereqs" : {
"configure" : {
"requires" : {
"ExtUtils::MakeMaker" : "0"
}
},
"develop" : {
"requires" : {
"Test::Pod" : "1.41",
"Test::Spelling" : "0.12"
}
},
"runtime" : {
"recommends" : {
"XML::DOM" : "1.46"
},
"requires" : {
"Carp" : "0",
"perl" : "5.010"
},
"suggests" : {
"Tie::IxHash" : "0"
}
},
"test" : {
"recommends" : {
"XML::DOM" : "1.46"
},
"requires" : {
"Test" : "0",
"Test::More" : "0"
},
"suggests" : {
"Tie::IxHash" : "0"
}
}
},
"provides" : {
"XML::Generator" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
},
"XML::Generator::DOM" : {
"file" : "lib/XML/Generator/DOM.pm",
"version" : "1.13"
},
"XML::Generator::DOM::util" : {
"file" : "lib/XML/Generator/DOM.pm",
"version" : "1.13"
},
"XML::Generator::cdata" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
},
"XML::Generator::comment" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
},
"XML::Generator::final" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
},
"XML::Generator::overload" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
},
"XML::Generator::pi" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
},
"XML::Generator::pretty" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
},
"XML::Generator::util" : {
"file" : "lib/XML/Generator.pm",
"version" : "1.13"
}
},
"release_status" : "stable",
"resources" : {
"repository" : {
"type" : "git",
"url" : "git://github.com/timlegge/perl-XML-Generator.git",
"web" : "https://github.com/timlegge/perl-XML-Generator"
}
},
"version" : "1.13",
"x_generated_by_perl" : "v5.34.0",
"x_maintainers" : [
"Timothy Legge "
],
"x_serialization_backend" : "Cpanel::JSON::XS version 4.27",
"x_spdx_expression" : "Artistic-1.0-Perl OR GPL-1.0-or-later"
}
SIGNATURE 100644 001750 001750 5404 14423335056 14144 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 This file contains message digests of all files listed in MANIFEST,
signed via the Module::Signature module, version 0.88.
To verify the content in this distribution, first make sure you have
Module::Signature installed, then type:
% cpansign -v
It will check each file's integrity, as well as the signature's
validity. If "==> Signature verified OK! <==" is not displayed,
the distribution may already have been compromised, and you should
not run its Makefile.PL or Build.PL.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: RIPEMD160
SHA256 6714c29c3ed8030465ce86ab4d1e3e3810da3d4c32e29faa625b6474d2b5364d Changes
SHA256 247594e05aa58423647027ab6cb089a1b86aa0de3aa011cd29982cd2a1abeeab LICENSE
SHA256 d14171325d8438f05adc239182a6c63ec37ba4fb9b033e17d935b436657b1f56 MANIFEST
SHA256 b78bbc2d0a2f0ee2083dae9521d4890daec51aef0444d8103f644c06890a8255 META.json
SHA256 ce1306147de85fe07235d1a33a6ecc75a094af4fff9c47af194dce06316b3479 META.yml
SHA256 d589827d8d4d46597320f55b495d01dc5b632dad7420c5601a84dd8770512a11 Makefile.PL
SHA256 c4244fb2930092c459e45d737f0ae4295a2819a3ab3428ef7ed4f80799a669a1 README
SHA256 9dc6905a003c16bd7e23b1457e6084b6ff246b3cf864dcfa4c4d4746687e1ec2 cpanfile
SHA256 2b8f192519fe706f52ea0657be912cdf2b1a294c3e048e2bb1f39fb1c82a5ca5 dist.ini
SHA256 c4f86e797af650b2567afb926a73a693ef1a93dc58410239f2f736353e5be62f lib/XML/Generator.pm
SHA256 da3f90810a5e081d1157bc12607171437e43e8e8ed93a7249d9b48e5fe54917c lib/XML/Generator/DOM.pm
SHA256 7df7002f3564227c578941eb38261186a00f48ced00eb51eb9e3cd7962855cea t/DOM.t
SHA256 c2e37c6dd6e9a02d50351035171aa3735f0832b66d5ffd8c7e6c515e8d049478 t/Generator.t
SHA256 e9f306660ec98b16b525dbe0aeb85ad9bef881e7cf01b7ca9528aed24ebacad5 t/Issue-70986.t
SHA256 fb0fa5c911eed07be6b0ac4ec3fe2df9401c1e47b1148f8ed38ec5c9e166f5b8 t/Issue-80273.t
SHA256 0b05df2bdbb8573798034e47d7602c764c8e55c82492eb9e9cee23b62b94718d t/author-pod-spell.t
SHA256 305c657c6b73f10767a0ea286b8a73d693940f4cbb8b6a0a4d34e2b5a1c04635 t/author-pod-syntax.t
-----BEGIN PGP SIGNATURE-----
iQIzBAEBAwAdFiEEMguXHBCUSzAt6mNu1fh7LgYGpfkFAmRNui4ACgkQ1fh7LgYG
pfkCqg/+MQHw9cYNCVe5V5gKNYrk44EZZh0Iowov5nVEoCju5kKqFsIGopQ72a1C
EAMvUjSQ3cuFBdH+sh7airAzyGXjWPxaHNLpfnw84sUYamL2OCtkAl+9+vNMEQ5N
guqwTLY1LZ9noOEelZleiBARX1gaJ0NmMZCQKdBS3WrPvuj/eexKUa7O41OUS3i7
vb5z1N0MjAs7DyzQfPcp2z41RULxXt9NEHS6IDkN2M/4tWJa3POv3ffXJ04HN/Uj
/MWXDKuDQYFfRaVP6V/wRBj4mJtiRMpXpgcChU9EVFrdzILWoc29H9TmNC6o5Hjx
YRowhkDhGofdUlGgYYzRqHekI42iYcZem5xkkWuEh7JaPh0y7dR6Q/gTrO3ehijw
oWd8E2j+rQZF8r7wSFsmjNBd1uBEind6BZMZ8D+fwagUz/rmbnQykH/se0vXD99K
zZa3Yb81bTKis6BSyLPb8kGkTKEoL/Ib3RpWKy28YgF/8lHypXZ8JDcudl/qW0e5
21LVteovpYEBZEX6PJiPheRv8zEItVU0laUDzOXBOWMoC+jcs8ZYrd1Hjt11pakq
Kpu4xCBAbQanHIq9RfuI0apgmqUfycn9l8aDGdDnA/Rw9ji4mKNWvP+TdKT3mu+S
jmJiL5SrKlDPnNGBw4fYILY0xNBpRD/ByCLKdOwrTZ3WUNFz6Jo=
=I8/z
-----END PGP SIGNATURE-----
Makefile.PL 100644 001750 001750 2045 14423335056 14630 0 ustar 00tim tim 000000 000000 XML-Generator-1.13 # This file was automatically generated by Dist::Zilla::Plugin::MakeMaker v6.029.
use strict;
use warnings;
use 5.010;
use ExtUtils::MakeMaker;
my %WriteMakefileArgs = (
"ABSTRACT" => "Perl extension for generating XML",
"AUTHOR" => "Benjamin Holzman ",
"CONFIGURE_REQUIRES" => {
"ExtUtils::MakeMaker" => 0
},
"DISTNAME" => "XML-Generator",
"LICENSE" => "perl",
"MIN_PERL_VERSION" => "5.010",
"NAME" => "XML::Generator",
"PREREQ_PM" => {
"Carp" => 0
},
"TEST_REQUIRES" => {
"Test" => 0,
"Test::More" => 0
},
"VERSION" => "1.13",
"test" => {
"TESTS" => "t/*.t"
}
);
my %FallbackPrereqs = (
"Carp" => 0,
"Test" => 0,
"Test::More" => 0
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
delete $WriteMakefileArgs{TEST_REQUIRES};
delete $WriteMakefileArgs{BUILD_REQUIRES};
$WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}
delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
WriteMakefile(%WriteMakefileArgs);
Generator.t 100644 001750 001750 37053 14423335056 15263 0 ustar 00tim tim 000000 000000 XML-Generator-1.13/t #!/usr/bin/perl -w
use Test;
use utf8;
BEGIN { $| = 1; plan tests => 109; }
use XML::Generator ();
ok(1);
my $x = XML::Generator->new();
ok($x);
my $xml = $x->foo();
ok($xml, '');
$xml = $x->bar(42);
ok($xml, '42');
$xml = $x->baz({'foo'=>3});
ok($xml, '');
$xml = $x->bam({'bar'=>42},$x->foo(),"qux");
ok($xml, 'qux');
eval { require Tie::IxHash; };
if ($@) {
skip('Tie::IxHash not installed', 1);
} else {
tie %h, 'Tie::IxHash';
@h{'a'..'z'} = 1..26;
$xml = $x->foo(\%h);
ok($xml, '');
}
$xml = $x->new(3);
ok($xml, '3');
$xml = $x->import(3);
ok($xml, '3');
$xml = $x->foo(['baz']);
ok($xml, '');
$xml = $x->foo(['baz','bam']);
ok($xml, '');
$xml = $x->foo(['baz'],{'bar'=>42},3);
ok($xml, '3');
$xml = $x->foo(['baz','bam'],{'bar'=>42},3);
ok($xml, '3');
$xml = $x->foo({'id' => 4}, 3, 5);
ok($xml, '35');
$xml = $x->foo({'id' => 4}, 0, 5);
ok($xml, '05');
$xml = $x->foo({'id' => 4}, 3, 0);
ok($xml, '30');
my $foo_bar = "foo-bar";
$xml = $x->$foo_bar(42);
ok($xml, '42');
$x = new XML::Generator 'escape' => 'always';
$xml = $x->foo({'bar' => '4"4'}, '<&>"\<', \"<>");
ok($xml, '<&>"\<<>');
$x = new XML::Generator 'escape' => 'unescaped';
$xml = $x->foo({'bar' => '4\"4'}, '<&>"\<', \"&& 6 < 5");
ok($xml, '<&>"<&& 6 < 5');
$x = new XML::Generator 'namespace' => ['A'];
$xml = $x->foo({'bar' => 42}, $x->bar(['B'], {'bar' => 54}));
ok($xml, '');
$x = new XML::Generator 'conformance' => 'strict';
$xml = $x->xmldecl();
ok($xml, qq(\n));
$xml = $x->xmlcmnt("test");
ok($xml, '');
$x = new XML::Generator 'conformance' => 'strict',
'version' => '1.1',
'encoding' => 'iso-8859-2';
$xml = $x->xmldecl();
ok($xml, qq(\n));
$xml = $x->xmldecl(version => undef, encoding => undef, standalone => undef);
ok($xml, qq(\n));
$xml = $x->xmldecl(version => '1.0', encoding => 'utf8', standalone => 'no');
ok($xml, qq(\n));
$xml = $x->xmldecl(version => '1.0', encoding => 'utf8', standalone => 'yes');
ok($xml, qq(\n));
$xml = $x->xmlpi("target", "option" => "value");
ok($xml, '');
eval {
$x->xmlfoo();
};
ok($@, qr{names beginning with 'xml' are reserved by the W3C});
eval {
$x->foo({xmlfoo => 4});
};
ok($@, qr{names beginning with 'xml' are reserved by the W3C});
eval {
my $t = "42";
$x->$t();
};
ok($@, qr{name \[42] may not begin with a number});
eval {
$x->q({42=>'the answer'});
};
ok($@, qr{name \[42] may not begin with a number});
eval {
my $t = "g:";
$x->$t();
};
ok($@, qr{name \[g:] contains illegal character\(s\)});
$xml = $x->foo(['bar'], {'baz:foo' => 'qux', 'fob' => 'gux'});
ok($xml eq '' ||
$xml eq '', 1, $xml);
$xml = $x->foo(['bar' => 'bam'], {'baz:foo' => 'qux', 'fob' => 'gux'});
ok($xml eq '' ||
$xml eq '', 1, $xml);
$x = XML::Generator->new(
conformance => 'loose',
xml => { version => "1.0", encoding => 'UTF-8' },
);
ok(
$x->xml($x->foo),
join("\n",
'',
''),
"Correct XML tag"
);
$x = XML::Generator->new(
conformance => 'loose',
xml => { version => "1.0", encoding => 'UTF-8', dtd => [ 'foo' ] },
);
ok(
$x->xml($x->foo),
join("\n",
'',
'',
''),
"Correct XML tag with doctype"
);
eval {
XML::Generator->new(
conformance => 'loose',
xml => [],
);
};
ok $@ =~ qr/XML arguments must be a hash/;
$x = new XML::Generator;
$xml = $x->xml();
ok($xml, '');
$x = new XML::Generator 'conformance' => 'strict',
'dtd' => [ 'foo', 'SYSTEM', '"http://foo.com/foo"' ];
$xml = $x->xmldecl();
ok($xml,
'
');
$xml = $x->xmlcdata("test");
ok($xml, '');
$x = new XML::Generator 'pretty' => 2, 'conformance' => 'strict';
$xml = $x->foo($x->bar());
ok($xml,
'
');
$xml = $x->foo($x->xmlcdata("bar"), $x->xmlpi("baz"));
ok($xml, '');
# test that cdata is not intended when pretty printing is on
$xml = $x->foo($x->bam($x->xmlcdata("bar\nbar")));
ok($xml, '
');
$x = new XML::Generator 'conformance' => 'strict';
$xml = $x->foo(42);
$xml = $x->xml($xml);
ok($xml,
'
42');
eval {
$x->xml();
};
ok($@ =~ /usage/, 1);
eval {
$x->xml(3);
};
ok($@ =~ /arguments to xml/, 1);
eval {
$xml = $x->bar($xml);
};
ok($@ =~ /cannot embed/, 1);
$x = new XML::Generator 'pretty' => 2;
$xml = $x->foo($x->bar($x->baz()));
ok($xml,
'
');
$xml = $x->foo("\n");
ok($xml,
'
');
$x = new XML::Generator 'empty' => 'close';
$xml = $x->foo();
ok($xml, '');
$x = new XML::Generator 'empty' => 'ignore';
$xml = $x->foo();
ok($xml, '');
eval {
$x = new XML::Generator 'empty' => 'ignore', 'conformance' => 'strict';
};
ok($@ =~ /not allowed/, 1);
$x = new XML::Generator 'conformance' => 'strict';
$xml = $x->foo();
$cmnt = $x->xmlcmnt("comment");
$pi = $x->xmlpi("foo");
$xml = $x->xml($cmnt, $xml, $pi);
ok($xml, '
');
$x = new XML::Generator 'empty' => 'compact';
$xml = $x->foo();
ok($xml, '');
$x = new XML::Generator 'empty' => 'args';
$xml = $x->foo(1);
ok($xml, '1');
$xml = $x->foo('');
ok($xml, '');
$xml = $x->foo();
ok($xml, '');
$xml = $x->foo(undef);
ok($xml, '');
$x = XML::Generator->new(escape => 'always,high-bit');
$xml = $x->foo("<\242>");
ok($xml, '<¢>');
# check :options
$x = XML::Generator->new(':standard');
$xml = $x->foo('<', $x->xmlcmnt('c'));
ok($xml, '<');
$x = XML::Generator->new(':pretty');
$xml = $x->foo('<', $x->bar($x->xmlcmnt('c')));
ok($xml, '<
');
$x = XML::Generator->new();
$xml = $x->foo('パスワードをお忘れの方');
ok($xml, 'パスワードをお忘れの方');
$x = XML::Generator->new(':strict');
$xml = $x->foo('パスワードをお忘れの方');
ok($xml, 'パスワードをお忘れの方');
ok($xml, "\x{30D1}\x{30B9}\x{30EF}\x{30FC}\x{30C9}\x{3092}\x{304A}\x{5FD8}\x{308C}\x{306E}\x{65B9}");
$x = XML::Generator->new(':strict', escape => 'high-bit');
$xml = $x->foo('パスワードをお忘れの方');
ok($xml, 'パスワードをお忘れの方');
$x = XML::Generator->new(':strict', escape => 'high-bit');
$xml = $x->foo("\\<\242", $x->xmlpi('g'));
ok($xml, '<¢');
$xml = $x->foo("\\<\x{2603}", $x->xmlpi('g'));
ok($xml, '<☃');
{ my $w; local $SIG{__WARN__} = sub { $w .= $_[0] };
$x = XML::Generator->new(':import');
ok($w =~ /Useless use of/, 1); $w = '';
}
# test AUTOLOAD
package Test1;
use XML::Generator ':import';
::ok(foo(), '');
package Test2;
use XML::Generator ':pretty';
::ok(foo(bar()), '
');
package Test3;
sub AUTOLOAD {
return "foo" if our $AUTOLOAD =~ /bar/;
return;
}
use XML::Generator;
::ok(barnyard(), 'foo');
::ok(foo(), undef);
package Test6;
sub AUTOLOAD {
return "foo" if our $AUTOLOAD =~ /bar/;
return;
}
use XML::Generator qw(:import);
::ok(barnyard(), '');
::ok(foo(), '');
package Test7;
sub AUTOLOAD {
return "foo" if our $AUTOLOAD =~ /bar/;
return;
}
use XML::Generator qw(:stacked);
::ok(barnyard(), 'foo');
::ok(foo(), '');
::ok(foo(barnyard()), 'foo');
# misc
package main;
$x = XML::Generator->new(':strict', allowed_xml_tags => ['xmlfoo']);
$xml = $x->xmlfoo('biznatch');
ok($xml, 'biznatch');
$xml = $x->xmlcmnt('--');
ok($xml, '');
$A = XML::Generator->new(namespace => ['A']);
$B = XML::Generator->new(namespace => ['B' => 'bee']);
$xml = $A->foo($B->bar($A->baz()));
ok($xml, '');
$xml = $A->foo($A->bar($B->baz()));
ok($xml, '');
$xml = $A->foo($B->bar($B->baz()));
ok($xml, '');
$C = XML::Generator->new(namespace => [undef]);
$xml = $A->foo($C->bar($B->baz()));
ok($xml, '');
$D = XML::Generator->new();
$xml = $D->foo(['A'],$D->bar([undef],$D->baz(['B'=>'bee'])));
ok($xml, '');
$E = XML::Generator->new();
$xml = $E->foo(['A'],$E->bar([undef],$E->baz(['B'=>'bee'], $E->bum(['A']))));
ok($xml, '');
package MyGenerator;
sub AUTOLOAD {
my($tag) = our $AUTOLOAD =~ /.*::(.*)/;
return '©' if $tag eq 'copy';
return;
}
use XML::Generator qw(:pretty :stacked);
package Test8;
MyGenerator->import();
$xml = html(title("My Title",copy()));
::ok($xml,
'
My Title©
');
package TestDoc1_1;
use XML::Generator ':pretty';
$prt = foo(bar({ baz => 3 }, bam()),
bar([ 'qux' => 'http://qux.com/' ],
"Hey there, world"));
::ok($prt,
'
Hey there, world
');
package TestDoc1_2;
use XML::Generator ();
my $X = XML::Generator->new(':pretty');
$prt = $X->foo($X->bar({ baz => 3 }, $X->bam()),
$X->bar([ 'qux' => 'http://qux.com/' ],
"Hey there, world"));
::ok($prt,
'
Hey there, world
');
package TestDoc2;
use XML::Generator;
my $gen = XML::Generator->new(':pretty');
$prt = $gen->person(
$gen->name("Bob"),
$gen->age(34),
$gen->job("Accountant")
);
::ok($prt,
'
Bob
34
Accountant
');
my $shoe_size = "shoe-size";
$xml = $gen->$shoe_size("12 1/2");
::ok($xml, '12 1/2');
$xml = $gen->account(
$gen->open(['transaction'], 2000),
$gen->deposit(['transaction'], { date => '1999.04.03'}, 1500)
);
::ok($xml,
'
2000
1500
');
$xml = $gen->account(
$gen->open(['transaction'], 2000),
$gen->deposit(['transaction'], { date => '1999.04.03'},
$gen->amount(['transaction'], 1500)
)
);
::ok($xml,
'
2000
1500
');
$xml = $gen->widget(['wru' => 'http://www.widgets-r-us.com/xml/'],
{'id' => 123}, $gen->contents());
::ok($xml,
'
');
package TestDoc3;
my $html = XML::Generator->new(
pretty => 2,
namespace => [HTML => "http://www.w3.org/TR/REC-html40"]);
$pt = $html->html(
$html->body(
$html->font({ face => 'Arial' },
"Hello, there")));
::ok($pt,
'
Hello, there
');
$html = XML::Generator->new(
pretty => 2,
namespace => ["http://www.w3.org/TR/REC-html40"]);
$pt = $html->html(
$html->body(
$html->font({ 'face' => 'Arial' },
"Hello, there")));
::ok($pt,
'
Hello, there
');
my $a = XML::Generator->new(escape => 'always,high-bit');
$pt = $a->foo("<\242>");
::ok($pt, '<¢>');
$gen = XML::Generator->new(escape => 'always,apos');
$pt = $gen->foo({'bar' => "It's all good"});
::ok($pt, '');
$gen = XML::Generator->new(pretty => 2);
$pt = $gen->foo($gen->bar('baz'),
$gen->qux({ tricky => 'no'}, 'quux'));
::ok($pt,
'
baz
quux
');
$gen = XML::Generator->new(namespace => [foo => "http://foo.com/"], qualifiedAttributes => 1);
$pt = $gen->bar({baz => 3});
::ok($pt, '');
$pt = $gen->bar({'wow:baz' => 3});
::ok($pt, '');
package TestMult;
$gen = XML::Generator->new(namespace => ['foo' => 'foo uri', 'bar' => 'bar uri']);
$pt = $gen->baz();
::ok($pt, '');
$pt = $gen->bam(['#default' => 'default uri']);
::ok($pt, '');
$pt = $gen->bam(['#default' => 'default uri', 'foo' => 'foo uri']);
::ok($pt, '');
$pt = $gen->bam(['foo' => 'foo uri', '#default' => 'default uri']);
::ok($pt, '');
package TestRDF;
my @contact = (contact => "http://www.w3.org/2000/10/swap/pim/contact#");
$gen = XML::Generator->new(':pretty');
$pt = $gen->xml(
$gen->RDF([ rdf => "http://www.w3.org/1999/02/22-rdf-syntax-ns#",
@contact ],
$gen->Person(\@contact, { 'rdf:about' => "http://www.w3.org/People/EM/contact#me" },
$gen->fullName(\@contact, 'Eric Miller'),
$gen->mailbox(\@contact, {'rdf:resource' => "mailto:em\@w3.org"}),
$gen->personalTitle(\@contact, 'Dr.'))));
::ok($pt, '
Eric Miller
Dr.
');
package TestEscapingEntities;
use XML::Generator escape => 'always,even-entities', conformance => 'strict', pretty => 2;
::ok(tag(">"), '>');
package TestInvalidChars1;
use XML::Generator filter_invalid_chars => '1';
::ok(tag(map chr,
0, 0x1, 0x8, 0xB, 0xC, 0xE..0x1F,
0x7F..0x84, 0x86..0x9F), '');
package TestInvalidCharsUnderStrict;
use XML::Generator ':strict';
::ok(tag("\0"), '');
package TestInvalidCharsUnderStrict2;
use XML::Generator ':strict', 'filter_invalid_chars' => 0;
::ok(tag("\0"), "\0");
Issue-70986.t 100644 001750 001750 2442 14423335056 15072 0 ustar 00tim tim 000000 000000 XML-Generator-1.13/t use Test::More qw/ tests 12 /;
use XML::Generator;
$s=XML::Generator->new( qw/ escape unescaped conformance strict pretty 2 /);
my $xml = $s->testme({ message => 'x"y'});
ok($xml eq '');
$xml = $s->testme({ message => 'x\"y'});
ok($xml eq '');
$xml = $s->testme({ message => 'x""y' });
ok($xml eq '');
$xml = $s->testme({ message => '"x""y' });
ok($xml eq '');
$xml = $s->testme({message => 'x"\"y'});
ok($xml eq '');
$xml = $s->testme({message => 'x\"\"y'});
ok($xml eq '');
$s=XML::Generator->new( qw/ escape always conformance strict pretty 2 /);
$xml = $s->testme({ message => 'x"y'});
ok($xml eq '');
$xml = $s->testme({ message => 'x\"y'});
ok($xml eq '');
$xml = $s->testme({ message => 'x""y' });
ok($xml eq '');
$xml = $s->testme({ message => '"x""y' });
ok($xml eq '');
$xml = $s->testme({message => 'x"\"y'});
ok($xml eq '');
$xml = $s->testme({message => 'x\"\"y'});
ok($xml eq '');
done_testing;
Issue-80273.t 100644 001750 001750 5071 14423335056 15061 0 ustar 00tim tim 000000 000000 XML-Generator-1.13/t use strict;
use Test::More qw/ tests 1 /;
use XML::Generator;
my $XML = XML::Generator->new(conformance => "strict");
my $result = $XML->record(join "\n", map { my ($k, $v) = @{$_}; $XML->$k($v); }
(
[threat => 1],
[desc => "godzilla"],
[value => "http://y.ahoooooooooo.it/0weifjwef"],
[detected => "2012-10-16 00:00:00"]
));
my $expected_result = '1
godzilla
http://y.ahoooooooooo.it/0weifjwef
2012-10-16 00:00:00';
ok($result eq $expected_result, 'Got expected results');
exit;
$XML = XML::Generator->new();
$result = $XML->record(
join "\n", map { my ($k, $v) = @{$_}; $XML->$k($v); }
(
[threat => 1],
[desc => "gozdilla"],
[value => "http://y.ahoooooooooo.it/0weifjwef"],
[detected => "2012-10-16 00:00:00"]
));
$expected_result = '1
gozdilla
http://y.ahoooooooooo.it/0weifjwef
2012-10-16 00:00:00';
ok($result eq $expected_result, 'Got expected results');
my $XML = XML::Generator->new(conformance => "strict", pretty => 1);
$result = $XML->record(
map { my ($k, $v) = @{$_}; $XML->$k($v); }
(
[threat => 1],
[desc => "godzilla"],
[value => "http://y.ahoooooooooo.it/0weifjwef"],
[detected => "2012-10-16 00:00:00"]
));
$expected_result = '
1
godzilla
http://y.ahoooooooooo.it/0weifjwef
2012-10-16 00:00:00
';
ok($result eq $expected_result, 'Got expected results');
$XML = XML::Generator->new(conformance => "strict", pretty => 1);
$result = $XML->record(
map { my ($k, $v) = @{$_}; $XML->$k($v); }
(
[threat => 1],
[desc => "godzilla"],
[value => "http://y.ahoooooooooo.it/0weifjwef"],
[detected => "2012-10-16 00:00:00"]
));
$expected_result = '
1
godzilla
http://y.ahoooooooooo.it/0weifjwef
2012-10-16 00:00:00
';
ok($result eq $expected_result, 'Got expected results');
author-pod-spell.t 100644 001750 001750 1143 14423335056 16503 0 ustar 00tim tim 000000 000000 XML-Generator-1.13/t
BEGIN {
unless ($ENV{AUTHOR_TESTING}) {
print qq{1..0 # SKIP these tests are for testing by the author\n};
exit
}
}
use strict;
use warnings;
use Test::More;
# generated by Dist::Zilla::Plugin::Test::PodSpelling 2.007005
use Test::Spelling 0.12;
use Pod::Wordlist;
add_stopwords();
all_pod_files_spelling_ok( qw( bin lib ) );
__DATA__
Benjamin
Bron
CDATA
DOM
DTD
Generator
Gondwana
Holzman
RDF
STACKABLE
Wiger
XML
allowedXMLTags
apos
atributes
bholzman
declartion
desireable
doctype
dtd
eg
filterInvalidChars
lib
prolog
qualifiedAttributes
xml
xmlcdata
xmlcmnt
xmldecl
xmldtd
xmlns
xmlpi
XML 000755 001750 001750 0 14423335056 13723 5 ustar 00tim tim 000000 000000 XML-Generator-1.13/lib Generator.pm 100644 001750 001750 133513 14423335056 16415 0 ustar 00tim tim 000000 000000 XML-Generator-1.13/lib/XML package XML::Generator;
use strict;
use warnings;
use Carp;
use vars qw/$VERSION $AUTOLOAD/;
our $VERSION = '1.13';
=head1 NAME
XML::Generator - Perl extension for generating XML
=head1 SYNOPSIS
use XML::Generator ':pretty';
print foo(bar({ baz => 3 }, bam()),
bar([ 'qux' => 'http://qux.com/' ],
"Hey there, world"));
# OR
require XML::Generator;
my $X = XML::Generator->new(':pretty');
print $X->foo($X->bar({ baz => 3 }, $X->bam()),
$X->bar([ 'qux' => 'http://qux.com/' ],
"Hey there, world"));
Either of the above yield:
Hey there, world
=head1 DESCRIPTION
In general, once you have an XML::Generator object, you then simply call
methods on that object named for each XML tag you wish to generate.
XML::Generator can also arrange for undefined subroutines in the caller's
package to generate the corresponding XML, by exporting an C
subroutine to your package. Just supply an ':import' argument to
your C