gnu.xml.pipeline

Class NSFilter

public class NSFilter extends EventFilter

This filter ensures that element and attribute names are properly prefixed, and that such prefixes are declared. Such data is critical for operations like writing XML text, and validating against DTDs: names or their prefixes may have been discarded, although they are essential to the exchange of information using XML. There are various common ways that such data gets discarded:

This filter uses a heuristic to choose the prefix to assign to any particular name which wasn't already corectly prefixed. The associated namespace will be correct, and the prefix will be declared. Original structures facilitating text editing, such as conventions about use of mnemonic prefix names or the scoping of prefixes, can't always be reconstructed after they are discarded, as strongly encouraged by the current SAX2 defaults.

Note that this can't possibly know whether values inside attribute value or document content involve prefixed names. If your application requires using prefixed names in such locations you'll need to add some appropriate logic (perhaps adding additional heuristics in a subclass).

Version: $Date: 2001/11/09 22:53:17 $

Author: David Brownell

Constructor Summary
NSFilter(EventConsumer next)
Passes events through to the specified consumer, after first processing them.
Method Summary
voidendDocument()
voidendElement(String uri, String localName, String qName)
voidendPrefixMapping(String prefix)
This call is not passed to the next consumer in the chain.
voidstartDocument()
voidstartElement(String uri, String localName, String qName, Attributes atts)
voidstartPrefixMapping(String prefix, String uri)
This call is not passed to the next consumer in the chain.

Constructor Detail

NSFilter

public NSFilter(EventConsumer next)
Passes events through to the specified consumer, after first processing them.

Parameters: next the next event consumer to receive events.

Method Detail

endDocument

public void endDocument()

endElement

public void endElement(String uri, String localName, String qName)

endPrefixMapping

public void endPrefixMapping(String prefix)
This call is not passed to the next consumer in the chain. Prefix declarations and scopes are only exposed in their attribute form.

startDocument

public void startDocument()

startElement

public void startElement(String uri, String localName, String qName, Attributes atts)

startPrefixMapping

public void startPrefixMapping(String prefix, String uri)
This call is not passed to the next consumer in the chain. Prefix declarations and scopes are only exposed in the form of attributes; this callback just records a declaration that will be exposed as an attribute.

Source code is under GPL (with library exception) in the JAXP project at http://www.gnu.org/software/classpathx/jaxp
This documentation was derived from that source code on 2013-01-12.