NamespaceSupport.PushContext Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Start a new Namespace context.
[Android.Runtime.Register("pushContext", "()V", "GetPushContextHandler")]
public virtual void PushContext ();
[<Android.Runtime.Register("pushContext", "()V", "GetPushContextHandler")>]
abstract member PushContext : unit -> unit
override this.PushContext : unit -> unit
- Attributes
Remarks
Start a new Namespace context. The new context will automatically inherit the declarations of its parent context, but it will also keep track of which declarations were made within this context.
Event callback code should start a new context once per element. This means being ready to call this in either of two places. For elements that don't include namespace declarations, the <em>ContentHandler.startElement()</em> callback is the right place. For elements with such a declaration, it'd done in the first <em>ContentHandler.startPrefixMapping()</em> callback. A boolean flag can be used to track whether a context has been started yet. When either of those methods is called, it checks the flag to see if a new context needs to be started. If so, it starts the context and sets the flag. After <em>ContentHandler.startElement()</em> does that, it always clears the flag.
Normally, SAX drivers would push a new context at the beginning of each XML element. Then they perform a first pass over the attributes to process all namespace declarations, making <em>ContentHandler.startPrefixMapping()</em> callbacks. Then a second pass is made, to determine the namespace-qualified names for all attributes and for the element name. Finally all the information for the <em>ContentHandler.startElement()</em> callback is available, so it can then be made.
The Namespace support object always starts with a base context already in force: in this context, only the "xml" prefix is declared.
Java documentation for org.xml.sax.helpers.NamespaceSupport.pushContext()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.