Announce: XML::Filter::NSNormalise 0.01
by Grant McLean other posts by this author
Oct 9 2002 3:39AM messages near this date
view in the new Beta List Site
Re: Calling anyone working on a XML Schema module for Perl
|
Re: Announce: XML::Filter::NSNormalise 0.01
Uploaded to CPAN - coming to a mirror near you soon ...
NAME
XML::Filter::NSNormalise - SAX filter to normalise namespace prefixes
SYNOPSIS
use XML::SAX::Machines qw( :all );
use XML::Filter::NSNormalise;
my $p = Pipeline(
XML::Filter::NSNormalise-> new(
Map => {
'http://purl.org/dc/elements/1.1/' => 'dc',
'http://purl.org/rss/1.0/modules/syndication/' => 'syn'
}
)
=> \*STDOUT
);
$p-> parse_uri($filename);
DESCRIPTION
This SAX (version 2) filter can be used to transform documents
to ensure the prefixes associated with namespaces are used
consistently.
For example, feeding this document...
<rdf:RDF
xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:theonetruedublincore="http://purl.org/dc/elements/1.1/" >
<theonetruedublincore:date> 2002-10-08</theonetruedublincore:date>
</rdf:RDF>
... through this filter ...
XML::Filter::NSNormalise-> new(
Map => {=20
'http://purl.org/dc/elements/1.1/' => 'dc'
}
)
... would produce this output ...
<rdf:RDF
xmlns="http://purl.org/rss/1.0/"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:dc="http://purl.org/dc/elements/1.1/" >
<dc:date> 2002-10-08</dc:date>
</rdf:RDF>
You can specify more than one namespace URI to prefix mapping.
METHODS
new()
The constructor expects a list of options as Key => Value pairs.
The 'Map' option must be specified and must be set to a hashref.
Each key of the hashref is a namespace URI and each value is the
corresponding namespace prefix you want in the output document.
Any namespaces which occur in the document but do not occur in
the Map hash, will be passed through unaltered.
All other options are passed to the default constructor in the
XML::SAX::Base manpage.
ERROR HANDLING
Attempting to map more than one URI to the same prefix will
cause a fatal exception.
Attempting to map a URI to a prefix that is already mapped to a
different URI will cause a fatal exception.
SEE ALSO
the XML::SAX manpage, the XML::SAX::Base manpage, the
XML::SAX::Machines manpage.
COPYRIGHT
Copyright 2002 Grant McLean <grantm@[...].org>
This library is free software; you can redistribute it and/or
modify it under the same terms as Perl itself.
===============================================================
Grant McLean BearingPoint Inc - formerly The Web Limited
+64 4 495 8250 Level 6, 20 Customhouse Quay, Box 1195
gmclean@[...].biz Wellington, New Zealand
_______________________________________________
Perl-XML mailing list
Perl-XML@[...].com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Thread:
Grant McLean
Robin Berjon
|