NAME

XML::Filter::Namespace - strip all but a single namespace

SYNOPSIS

# Standard SAX Machines pipeline setup...
my $strip = XML::Filter::Namespace->new;
$strip->ns( 'urn:my-namespace' );
my $m = Pipeline->new( $strip => \*STDOUT );
$m->parse_uri( "-" );

DESCRIPTION

This module strips out everything in an XML document that does not belong in a specified namespace. This often provides a view of the XML that is much clearer when multiple namespaces are in use.

A warning will be issued if a publicid is specified without a systemid.

Duplicate namespace declarations will be stripped out.

METHODS

ns ( NAMESPACE )

Set the namespace to include. Must be set before parsing.

systemid ( SYSTEMID )

Set to the SystemID of a DTD. This will cause a DOCTYPE declaration to be output.

publicid ( PUBLICID )

Set to the PublicId of a DTD. This will cause a DOCTYPE declaration to be output.

nl_after_tag ( HASHREF )

Set to a hash reference whose keys are tag names (sans prefix) and whose values are true. Those tags will have newlines output after their close tag.

SEE ALSO

XML::SAX::Base(3).

BUGS

There should be an option to keep attributes which are in the empty namespace.

AUTHOR

Dominic Mitchell <cpan@semantico.com>

VERSION

@(#) $Id: Namespace.pm,v 1.3 2002/12/04 14:30:33 dom Exp $

LICENSE

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.