Java Code Examples for org.w3c.dom.ls.LSParserFilter#FILTER_REJECT

The following examples show how to use org.w3c.dom.ls.LSParserFilter#FILTER_REJECT . 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: AbstractDOMParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 2
Source File: AbstractDOMParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 3
Source File: AbstractDOMParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 4
Source File: AbstractDOMParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 5
Source File: AbstractDOMParser.java    From hottub with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 6
Source File: AbstractDOMParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 7
Source File: AbstractDOMParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 8
Source File: AbstractDOMParser.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
@SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
protected void  setCharacterData (boolean sawChars){

    // handle character data
    fFirstChunk = sawChars;


    // if we have data in the buffer we must have created
    // a text node already.

    Node child = fCurrentNode.getLastChild ();
    if (child != null) {
        if (fStringBuilder.length () > 0) {
            // REVISIT: should this check be performed?
            if (child.getNodeType () == Node.TEXT_NODE) {
                if (fDocumentImpl != null) {
                    ((TextImpl)child).replaceData (fStringBuilder.toString ());
                }
                else {
                    ((Text)child).setData (fStringBuilder.toString ());
                }
            }
            // reset string buffer
            fStringBuilder.setLength (0);
        }

        if (fDOMFilter !=null && !fInEntityRef) {
            if ( (child.getNodeType () == Node.TEXT_NODE ) &&
            ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                short code = fDOMFilter.acceptNode (child);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since Comment has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        fCurrentNode.removeChild (child);
                        return;
                    }
                    default: {
                        // accept node -- do nothing
                    }
                }
            }
        }   // end-if fDOMFilter !=null

    } // end-if child !=null
}
 
Example 9
Source File: AbstractDOMParser.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
@SuppressWarnings("fallthrough") // by design at case LSParserFilter.FILTER_REJECT
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 10
Source File: AbstractDOMParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 11
Source File: AbstractDOMParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 12
Source File: AbstractDOMParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 13
Source File: AbstractDOMParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 14
Source File: AbstractDOMParser.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 15
Source File: AbstractDOMParser.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 16
Source File: AbstractDOMParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 17
Source File: AbstractDOMParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 18
Source File: AbstractDOMParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }
 
Example 19
Source File: AbstractDOMParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * The end of a CDATA section.
 * @param augs     Additional information that may include infoset augmentations
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void endCDATA (Augmentations augs) throws XNIException {

    fInCDATASection = false;
    if (!fDeferNodeExpansion) {

        if (fFilterReject) {
            return;
        }

        if (fCurrentCDATASection !=null) {

            if (fDOMFilter !=null && !fInEntityRef &&
            (fDOMFilter.getWhatToShow () & NodeFilter.SHOW_CDATA_SECTION)!= 0) {
                short code = fDOMFilter.acceptNode (fCurrentCDATASection);
                switch (code) {
                    case LSParserFilter.FILTER_INTERRUPT:{
                        throw Abort.INSTANCE;
                    }
                    case LSParserFilter.FILTER_REJECT:{
                        // fall through to SKIP since CDATA section has no children.
                    }
                    case LSParserFilter.FILTER_SKIP: {
                        Node parent = fCurrentNode.getParentNode ();
                        parent.removeChild (fCurrentCDATASection);
                        fCurrentNode = parent;
                        return;
                    }

                    default: {
                        // accept node
                    }
                }
            }

            fCurrentNode = fCurrentNode.getParentNode ();
            fCurrentCDATASection = null;
        }
    }
    else {
        if (fCurrentCDATASectionIndex !=-1) {
            fCurrentNodeIndex =
            fDeferredDocumentImpl.getParentNode (fCurrentNodeIndex, false);
            fCurrentCDATASectionIndex = -1;
        }
    }

}
 
Example 20
Source File: AbstractDOMParser.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
protected void  setCharacterData (boolean sawChars){

        // handle character data
        fFirstChunk = sawChars;


        // if we have data in the buffer we must have created
        // a text node already.

        Node child = fCurrentNode.getLastChild ();
        if (child != null) {
            if (fStringBuilder.length () > 0) {
                // REVISIT: should this check be performed?
                if (child.getNodeType () == Node.TEXT_NODE) {
                    if (fDocumentImpl != null) {
                        ((TextImpl)child).replaceData (fStringBuilder.toString ());
                    }
                    else {
                        ((Text)child).setData (fStringBuilder.toString ());
                    }
                }
                // reset string buffer
                fStringBuilder.setLength (0);
            }

            if (fDOMFilter !=null && !fInEntityRef) {
                if ( (child.getNodeType () == Node.TEXT_NODE ) &&
                ((fDOMFilter.getWhatToShow () & NodeFilter.SHOW_TEXT)!= 0) ) {
                    short code = fDOMFilter.acceptNode (child);
                    switch (code) {
                        case LSParserFilter.FILTER_INTERRUPT:{
                            throw Abort.INSTANCE;
                        }
                        case LSParserFilter.FILTER_REJECT:{
                            // fall through to SKIP since Comment has no children.
                        }
                        case LSParserFilter.FILTER_SKIP: {
                            fCurrentNode.removeChild (child);
                            return;
                        }
                        default: {
                            // accept node -- do nothing
                        }
                    }
                }
            }   // end-if fDOMFilter !=null

        } // end-if child !=null
    }