NamespaceSupport pushContext - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for NamespaceSupport pushContext method.

This code example shows how to use the following methods:declarePrefix, pushContext
    public void setUp() { 
        expected = new ArrayList<String>();
        expected.add("ak");
        expected.add("bk");
 
        ns = new NamespaceSupport();
        ns.pushContext();
 
        ns.declarePrefix("ak", marketUri);
        ns.declarePrefix("bk", marketUri);
        ns.declarePrefix("", defaultUri);
    } 
 
    @SuppressWarnings("unchecked") 
    public void testConstructor() { 
        String prefix;
        boolean xmlPrefixExists = false;
 
        ns = new NamespaceSupport();
        Enumeration<String> prefixes = ns.getDeclaredPrefixes();
8
CodeRank
This code example shows how to use the following methods:declarePrefix, getPrefixes, popContext, pushContext, reset
    } 
 
    public void testReset() { 
        int count;
 
        ns = new NamespaceSupport();
        count = countPrefixes();
 
        ns.pushContext();
        ns.declarePrefix("dc", "http://www.purl.org/dc#");
 
        assertEquals("Test 1: Incorrect prefix count;",
                count + 1, countPrefixes());
 
        ns.reset();
        assertEquals("Test 2: Incorrect prefix count;",
                count, countPrefixes());
 
        // Check that only one context has been created by reset(). 
        try { 

6
CodeRank
This code example shows how to use the following methods:declarePrefix, pushContext
    public void startPrefixMapping(String prefix, String uri)
            throws SAXException
    { 
        if (needNewNamespaceContext)
        { 
            namespaces.pushContext();
            needNewNamespaceContext = false;
        } 
        namespaces.declarePrefix(prefix, uri);
 
        super.startPrefixMapping(prefix, uri);
    } 
 
    /** 
     * End the scope of a prefix-URI mapping. 
     *  
     * @param prefix 
     *            The prefix that was being mapping. 
     */ 
    public void endPrefixMapping(String prefix) throws SAXException
5
CodeRank
This code example shows how to use the following methods:declarePrefix, pushContext
        mEntityResolver = null;
        mDTDHandler = null;
        mContentHandler = null;
        mErrorHandler = null;
 
        mSupport = new NamespaceSupport ();
        mSupport.pushContext ();
        mSupport.declarePrefix ("", "http://www.w3.org/TR/REC-html40");
        // todo: 
        //    xmlns:html='http://www.w3.org/TR/REC-html40' 
        // or xmlns:html='http://www.w3.org/1999/xhtml' 
        mParts = new String[3];
    } 
     
    //////////////////////////////////////////////////////////////////// 
    // Configuration. 
    //////////////////////////////////////////////////////////////////// 
 
 
    /** 
5
CodeRank
This code example shows how to use the following methods:declarePrefix, pushContext
        mEntityResolver = null;
        mDTDHandler = null;
        mContentHandler = null;
        mErrorHandler = null;
 
        mSupport = new NamespaceSupport ();
        mSupport.pushContext ();
        mSupport.declarePrefix ("", "http://www.w3.org/TR/REC-html40");
        // todo: 
        //    xmlns:html='http://www.w3.org/TR/REC-html40' 
        // or xmlns:html='http://www.w3.org/1999/xhtml' 
        mParts = new String[3];
    } 
     
    //////////////////////////////////////////////////////////////////// 
    // Configuration. 
    //////////////////////////////////////////////////////////////////// 
 
 
    /** 
4
CodeRank
This code example shows how to use the following methods:declarePrefix, pushContext
    public void startPrefixMapping(String prefix, String uri)
            throws SAXException
    { 
        if (needNewNamespaceContext)
        { 
            namespaces.pushContext();
            needNewNamespaceContext = false;
        } 
        namespaces.declarePrefix(prefix, uri);
 
        super.startPrefixMapping(prefix, uri);
    } 
 
    /** 
     * End the scope of a prefix-URI mapping. 
     *  
     * @param prefix 
     *            The prefix that was being mapping. 
     */ 
    public void endPrefixMapping(String prefix) throws SAXException
4
CodeRank
This code example shows how to use the following methods:pushContext
        /** 
         * Push a new Namespace Context 
         */ 
        private void pushContext() 
        { 
            context.pushContext();
        } 
 
        /** 
         * Pop a Namespace Context 
         */ 
        private void popContext() 
        { 
            context.popContext();
        } 
 
        /** 
         * Register a namespace prefix 
         *  
         * @param prefix 
5
CodeRank
This code example shows how to use the following methods:declarePrefix, pushContext
        mEntityResolver = null;
        mDTDHandler = null;
        mContentHandler = null;
        mErrorHandler = null;
 
        mSupport = new NamespaceSupport ();
        mSupport.pushContext ();
        mSupport.declarePrefix ("", "http://www.w3.org/TR/REC-html40");
        // todo: 
        //    xmlns:html='http://www.w3.org/TR/REC-html40' 
        // or xmlns:html='http://www.w3.org/1999/xhtml' 
        mParts = new String[3];
    } 
     
    //////////////////////////////////////////////////////////////////// 
    // Configuration. 
    //////////////////////////////////////////////////////////////////// 
 
 
    /** 
4
CodeRank
This code example shows how to use the following methods:declarePrefix, pushContext
    public void startPrefixMapping(String prefix, String uri)
            throws SAXException 
    { 
        if (needNewNamespaceContext)
        { 
            namespaces.pushContext();
            needNewNamespaceContext = false;
        } 
        namespaces.declarePrefix(prefix, uri);
 
        super.startPrefixMapping(prefix, uri);
    } 
 
    /** 
     * End the scope of a prefix-URI mapping. 
     *  
     * @param prefix 
     *            The prefix that was being mapping. 
     */ 
    public void endPrefixMapping(String prefix) throws SAXException
4
CodeRank
This code example shows how to use the following methods:declarePrefix, pushContext
     * to know all the effective namespace declarations. 
     */ 
    private NamespaceSupport namespaces = new NamespaceSupport();
     
    public void startPrefixMapping(String prefix, String uri) throws SAXException {
        namespaces.pushContext();
        namespaces.declarePrefix(prefix,uri);
         
        super.startPrefixMapping(prefix, uri);
    } 
 
    public void endPrefixMapping(String prefix) throws SAXException {
        namespaces.popContext();
         
        super.endPrefixMapping(prefix);
    } 
} 
4
CodeRank
pushContext Method Overview
Start a new Namespace context.
See Code Examples for other Java 8 NamespaceSupport Methods: