Show / Hide Table of Contents

    Namespace Sax.Helpers

    Classes

    Attributes

    Default implementation of the Attributes interface.

    DefaultHandler

    Default base class for SAX2 event handlers.

    Locator

    Provide an optional convenience implementation of ILocator.

    NamespaceSupport

    Encapsulate Namespace logic for use by applications using SAX, or internally by SAX drivers.

    This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.

    This class encapsulates the logic of Namespace processing: it tracks the declarations currently in force for each context and automatically processes qualified XML names into their Namespace parts; it can also be used in reverse for generating XML qnames from Namespaces.

    Namespace support objects are reusable, but the reset method must be invoked between each session.

    Here is a simple session:

        string parts[] = new string[3];
        NamespaceSupport support = new NamespaceSupport();
        support.PushContext();
        support.DeclarePrefix("", "http://www.w3.org/1999/xhtml");
        support.DeclarePrefix("dc", "http://www.purl.org/dc#");
        parts = support.ProcessName("p", parts, false);
        Console.WriteLine("Namespace URI: " + parts[0]);
        Console.WriteLine("Local name: " + parts[1]);
        Console.WriteLine("Raw name: " + parts[2]);
        parts = support.ProcessName("dc:title", parts, false);
        Console.WriteLine("Namespace URI: " + parts[0]);
        Console.WriteLine("Local name: " + parts[1]);
        Console.WriteLine("Raw name: " + parts[2]);
        support.PopContext();

    Note that this class is optimized for the use case where most elements do not contain Namespace declarations: if the same prefix/URI mapping is repeated for each context (for example), this class will be somewhat less efficient.

    Although SAX drivers (parsers) may choose to use this class to implement namespace handling, they are not required to do so. Applications must track namespace information themselves if they want to use namespace information.

    XMLFilter

    Base class for deriving an XML filter.

    This module, both source code and documentation, is in the Public Domain, and comes with NO WARRANTY. See http://www.saxproject.org for further information.

    This class is designed to sit between an IXMLReader and the client application's event handlers. By default, it does nothing but pass requests up to the reader and events on to the handlers unmodified, but subclasses can override specific methods to modify the event stream or the configuration requests as they pass through.

    Back to top Copyright © 2020 Licensed to the Apache Software Foundation (ASF)