Running DOMFilter

DOMFilter parses an XML document, searching for specific elements by name, or elements with specific attributes. To run the DOMFilter, type the following all on one command line:

    jre -cp xml4j.jar;xml4jSamples.jar
        dom.DOMFilter
        -e name
        data\personal.xml

Source code:

 

To run DOMFilter with the default settings, use the following command line (all on one line):

    jre -cp xml4j.jar;xml4jSamples.jar
    dom.DOMFilter data\personal.xml

DOMFilter also allows you to change the default behavior via the following command line flags:

  • -p Specify the parser class to be used. The available parsers are:
              dom.wrappers.NonValidatingDOMParser
              dom.wrappers.DOMParser [default parser]
              dom.wrappers.TXParser
  • -h Print DOMFilter help information. [default is no help]
  • -e Specify the name of the element to search for. [defaults to matching all elements]
  • -a Specify the name of the attribute to search for. [defaults to matching all attributes]

Running DOMFilter with the default settings is equivalent to running DOMFilter like this (type this in as one long command line):

    jre -cp xml4j.jar;xml4jSamples.jar
        dom.DOMFilter
        -p dom.wrappers.DOMParser
        data\personal.xml

Return to Samples