Java Code Examples for org.xml.sax.ContentHandler#endPrefixMapping()

The following examples show how to use org.xml.sax.ContentHandler#endPrefixMapping() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TagInfoset.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes the end element event.
 */
public void writeEnd(ContentHandler contentHandler) throws SAXException{
    contentHandler.endElement(fixNull(nsUri),localName,getQName());
    for( int i=ns.length-2; i>=0; i-=2 ) {
        contentHandler.endPrefixMapping(fixNull(ns[i]));
    }
}
 
Example 2
Source File: NamespaceMappings.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = m_nodeStack.peek();
        int depth = map.m_declarationDepth;
        if (depth < elemDepth)
            return;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        map = m_nodeStack.pop();
        final String prefix = map.m_prefix;
        popNamespace(prefix);
        if (saxHandler != null)
        {
            try
            {
                saxHandler.endPrefixMapping(prefix);
            }
            catch (SAXException e)
            {
                // not much we can do if they aren't willing to listen
            }
        }

    }
}
 
Example 3
Source File: NamespaceMappings.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = (MappingRecord)(m_nodeStack.peek());
        int depth = map.m_declarationDepth;
        if (depth < elemDepth)
            return;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        map = (MappingRecord) m_nodeStack.pop();
        final String prefix = map.m_prefix;
        popNamespace(prefix);
        if (saxHandler != null)
        {
            try
            {
                saxHandler.endPrefixMapping(prefix);
            }
            catch (SAXException e)
            {
                // not much we can do if they aren't willing to listen
            }
        }

    }
}
 
Example 4
Source File: TagInfoset.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes the end element event.
 */
public void writeEnd(ContentHandler contentHandler) throws SAXException{
    contentHandler.endElement(fixNull(nsUri),localName,getQName());
    for( int i=ns.length-2; i>=0; i-=2 ) {
        contentHandler.endPrefixMapping(fixNull(ns[i]));
    }
}
 
Example 5
Source File: SAAJMessage.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
private void endPrefixMapping(ContentHandler contentHandler, NamedNodeMap attrs, String excludePrefix) throws SAXException {
    if(attrs == null)
        return;
    for(int i=0; i < attrs.getLength();i++) {
        Attr a = (Attr)attrs.item(i);
        //check if attr is ns declaration
        if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) {
            if(!fixNull(a.getPrefix()).equals(excludePrefix)) {
                contentHandler.endPrefixMapping(fixNull(a.getPrefix()));
            }
        }
    }
}
 
Example 6
Source File: NamespaceMappings.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = (MappingRecord)(m_nodeStack.peek());
        int depth = map.m_declarationDepth;
        if (depth < elemDepth)
            return;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        map = (MappingRecord) m_nodeStack.pop();
        final String prefix = map.m_prefix;
        popNamespace(prefix);
        if (saxHandler != null)
        {
            try
            {
                saxHandler.endPrefixMapping(prefix);
            }
            catch (SAXException e)
            {
                // not much we can do if they aren't willing to listen
            }
        }

    }
}
 
Example 7
Source File: TagInfoset.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes the end element event.
 */
public void writeEnd(ContentHandler contentHandler) throws SAXException{
    contentHandler.endElement(fixNull(nsUri),localName,getQName());
    for( int i=ns.length-2; i>=0; i-=2 ) {
        contentHandler.endPrefixMapping(fixNull(ns[i]));
    }
}
 
Example 8
Source File: SAAJMessage.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
private void endPrefixMapping(ContentHandler contentHandler, NamedNodeMap attrs, String excludePrefix) throws SAXException {
    if(attrs == null)
        return;
    for(int i=0; i < attrs.getLength();i++) {
        Attr a = (Attr)attrs.item(i);
        //check if attr is ns declaration
        if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) {
            if(!fixNull(a.getPrefix()).equals(excludePrefix)) {
                contentHandler.endPrefixMapping(fixNull(a.getPrefix()));
            }
        }
    }
}
 
Example 9
Source File: NamespaceMappings.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = (MappingRecord)(m_nodeStack.peek());
        int depth = map.m_declarationDepth;
        if (depth < elemDepth)
            return;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        map = (MappingRecord) m_nodeStack.pop();
        final String prefix = map.m_prefix;
        popNamespace(prefix);
        if (saxHandler != null)
        {
            try
            {
                saxHandler.endPrefixMapping(prefix);
            }
            catch (SAXException e)
            {
                // not much we can do if they aren't willing to listen
            }
        }

    }
}
 
Example 10
Source File: NamespaceMappings.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = (MappingRecord)(m_nodeStack.peek());
        int depth = map.m_declarationDepth;
        if (depth < elemDepth)
            return;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        map = (MappingRecord) m_nodeStack.pop();
        final String prefix = map.m_prefix;
        popNamespace(prefix);
        if (saxHandler != null)
        {
            try
            {
                saxHandler.endPrefixMapping(prefix);
            }
            catch (SAXException e)
            {
                // not much we can do if they aren't willing to listen
            }
        }

    }
}
 
Example 11
Source File: TagInfoset.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes the end element event.
 */
public void writeEnd(ContentHandler contentHandler) throws SAXException{
    contentHandler.endElement(fixNull(nsUri),localName,getQName());
    for( int i=ns.length-2; i>=0; i-=2 ) {
        contentHandler.endPrefixMapping(fixNull(ns[i]));
    }
}
 
Example 12
Source File: SAAJMessage.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
private void endPrefixMapping(ContentHandler contentHandler, NamedNodeMap attrs, String excludePrefix) throws SAXException {
    if(attrs == null)
        return;
    for(int i=0; i < attrs.getLength();i++) {
        Attr a = (Attr)attrs.item(i);
        //check if attr is ns declaration
        if("xmlns".equals(a.getPrefix()) || "xmlns".equals(a.getLocalName())) {
            if(!fixNull(a.getPrefix()).equals(excludePrefix)) {
                contentHandler.endPrefixMapping(fixNull(a.getPrefix()));
            }
        }
    }
}
 
Example 13
Source File: ForkContentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public void endPrefixMapping(String prefix) throws SAXException {
   ContentHandler[] arr$ = this.handlers;
   int len$ = arr$.length;

   for(int i$ = 0; i$ < len$; ++i$) {
      ContentHandler handler = arr$[i$];
      handler.endPrefixMapping(prefix);
   }

}
 
Example 14
Source File: ForkContentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public void endPrefixMapping(String prefix) throws SAXException {
   ContentHandler[] arr$ = this.handlers;
   int len$ = arr$.length;

   for(int i$ = 0; i$ < len$; ++i$) {
      ContentHandler handler = arr$[i$];
      handler.endPrefixMapping(prefix);
   }

}
 
Example 15
Source File: ForkContentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public void endPrefixMapping(String prefix) throws SAXException {
   ContentHandler[] arr$ = this.handlers;
   int len$ = arr$.length;

   for(int i$ = 0; i$ < len$; ++i$) {
      ContentHandler handler = arr$[i$];
      handler.endPrefixMapping(prefix);
   }

}
 
Example 16
Source File: ForkContentHandler.java    From freehealth-connector with GNU Affero General Public License v3.0 5 votes vote down vote up
public void endPrefixMapping(String prefix) throws SAXException {
   ContentHandler[] arr$ = this.handlers;
   int len$ = arr$.length;

   for(int i$ = 0; i$ < len$; ++i$) {
      ContentHandler handler = arr$[i$];
      handler.endPrefixMapping(prefix);
   }

}
 
Example 17
Source File: NamespaceMappings.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = (MappingRecord)(m_nodeStack.peek());
        int depth = map.m_declarationDepth;
        if (depth < elemDepth)
            return;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        map = (MappingRecord) m_nodeStack.pop();
        final String prefix = map.m_prefix;
        popNamespace(prefix);
        if (saxHandler != null)
        {
            try
            {
                saxHandler.endPrefixMapping(prefix);
            }
            catch (SAXException e)
            {
                // not much we can do if they aren't willing to listen
            }
        }

    }
}
 
Example 18
Source File: TagInfoset.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Writes the end element event.
 */
public void writeEnd(ContentHandler contentHandler) throws SAXException{
    contentHandler.endElement(fixNull(nsUri),localName,getQName());
    for( int i=ns.length-2; i>=0; i-=2 ) {
        contentHandler.endPrefixMapping(fixNull(ns[i]));
    }
}
 
Example 19
Source File: NamespaceMappings.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = (MappingRecord)(m_nodeStack.peek());
        int depth = map.m_declarationDepth;
        if (depth < elemDepth)
            return;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        map = (MappingRecord) m_nodeStack.pop();
        final String prefix = map.m_prefix;
        popNamespace(prefix);
        if (saxHandler != null)
        {
            try
            {
                saxHandler.endPrefixMapping(prefix);
            }
            catch (SAXException e)
            {
                // not much we can do if they aren't willing to listen
            }
        }

    }
}
 
Example 20
Source File: NamespaceMappings.java    From j2objc with Apache License 2.0 4 votes vote down vote up
/**
 * Pop, or undeclare all namespace definitions that are currently
 * declared at the given element depth, or deepter.
 * @param elemDepth the element depth for which mappings declared at this
 * depth or deeper will no longer be valid
 * @param saxHandler The ContentHandler to notify of any endPrefixMapping()
 * calls.  This parameter can be null.
 */
void popNamespaces(int elemDepth, ContentHandler saxHandler)
{
    while (true)
    {
        if (m_nodeStack.isEmpty())
            return;
        MappingRecord map = (MappingRecord) (m_nodeStack.peek());
        int depth = map.m_declarationDepth;
        if (elemDepth < 1 || map.m_declarationDepth < elemDepth)
            break;
        /* the depth of the declared mapping is elemDepth or deeper
         * so get rid of it
         */

        MappingRecord nm1 = (MappingRecord) m_nodeStack.pop();
        // pop the node from the stack
        String prefix = map.m_prefix;

        Stack prefixStack = getPrefixStack(prefix);
        MappingRecord nm2 = (MappingRecord) prefixStack.peek();
        if (nm1 == nm2)
        {
            // It would be nice to always pop() but we
            // need to check that the prefix stack still has
            // the node we want to get rid of. This is because
            // the optimization of essentially this situation:
            // <a xmlns:x="abc"><b xmlns:x="" xmlns:x="abc" /></a>
            // will remove both mappings in <b> because the
            // new mapping is the same as the masked one and we get
            // <a xmlns:x="abc"><b/></a>
            // So we are only removing xmlns:x="" or
            // xmlns:x="abc" from the depth of element <b>
            // when going back to <a> if in fact they have
            // not been optimized away.
            //
            prefixStack.pop();
            if (saxHandler != null)
            {
                try
                {
                    saxHandler.endPrefixMapping(prefix);
                }
                catch (SAXException e)
                {
                    // not much we can do if they aren't willing to listen
                }
            }
        }

    }
}