Perl Utility: xmlfilter


From     perl-xml-admin@lyris.activestate.com Fri Sep 18 10:50:28 1998
Date:    Fri, 18 Sep 1998 11:47:56 -0400 (EDT)
From:    Clark Cooper <coopercl@sch.ge.com>
Subject: xmlfilter
To:      Perl-XML Mailing List <perl-xml@lyris.activestate.com>

I've uploaded a new sample utility, xmlfilter, to:

     http://www.netheaven.com/~coopercc/xmlparser/samples/xmlfilter.

This utility filters in or out elements from an XML document. The output of the filter should be a well-formed XML document.


Here's the Usage message:

Usage is:
    xmlfilter [-h] [{-+}root] [{-+}el=elname] [{-+}el:elnamepat]
              [{-+}att:attname] [{-+}att:attname:attvalpat] xmlfile

Prints on standard output the result of filtering the given xmlfile
for elements according to the switches. A '-' option will drop the
element from the output; a '+' will keep it. The output should also
be a well-formed XML document.

    -h          Print this message

    [-+]root    Drop (or keep) the root element. Defaults to keep.
                If the root element were named "foo", then -root
                would be equivalent to -el=foo. Note that even if
                you're dropping the root element, it's start and
                end tag are kept in order that the output remains
                a well-formed XML document.

    [-+]el=elname
                Drop (or keep) elements of type elname.

    [-+]el:elnamepat
                Drop (or keep) element whose type name matches elnamepat.

    [-+]att:attname]
                Drop (or keep) elements which have an attribute = attname.

    [-+]att:attname:attvalpat]
                Drop (or keep) elements which have an attribute = attname
                and for which the attribute value matches attvalpat.


Clark Cooper    Logic Technology Inc.           cccooper@ltionline.com
(518) 385-8380  650 Franklin St., Suite 304     coopercl@sch.ge.com
                Schenectady,  NY 12305