/usr/share/doc/libxml-writer-perl/examples/namespace-prefixes.pl is in libxml-writer-perl 0.625-1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 | #!/usr/bin/perl -w
# A skeleton Atom document with extensions, to show different
# behaviour of namespaces and prefixes
use strict;
use XML::Writer;
my $ATOM = 'http://www.w3.org/2005/Atom';
my $EXT = 'http://www.example.com/feed-extension';
my $EXT2 = 'http://www.example.com/feed-extension-2';
my $EXT3 = 'http://www.example.com/feed-extension-3';
my $w = XML::Writer->new(
NAMESPACES => 1,
DATA_MODE => 1,
# Define prefixes for most of the namespaces
PREFIX_MAP => {
$ATOM => '',
$EXT => 'ext',
$EXT2 => 'ext2'
},
# Force a declaration for the first extension on the root element
FORCED_NS_DECLS => [$EXT]
);
$w->comment(' An Atom feed with namespace declarations ');
$w->startTag([$ATOM, 'feed']);
# The root element will include a declaration for its own namespace
# and the contents of FORCED_NS_DECLS
$w->dataElement([$ATOM, 'title'], "Feed Title");
# This namespace has already been declared on the root as the default
$w->dataElement([$EXT, 'example'], "true");
# This namespace had its name defined but the declaration hasn't appeared yet.
# It will be included on demand, on this element.
$w->dataElement([$EXT2, 'definitely-an-example'], "true");
# This namespace has no prefix defined - an artificial prefix will be
# used (something like __NS1)
$w->dataElement([$EXT3, 'most-definitely-an-example'], "true");
$w->endTag([$ATOM, 'feed']);
$w->end();
|