Java Code Examples for com.sun.org.apache.xerces.internal.dom.NotationImpl#setSystemId()

The following examples show how to use com.sun.org.apache.xerces.internal.dom.NotationImpl#setSystemId() . 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: DOMResultBuilder.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 2
Source File: DOMResultBuilder.java    From openjdk-8-source with GNU General Public License v2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 3
Source File: DOMResultBuilder.java    From openjdk-8 with GNU General Public License v2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 4
Source File: DOMResultBuilder.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 5
Source File: DOMResultBuilder.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 6
Source File: DOMResultBuilder.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 7
Source File: DOMResultBuilder.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 8
Source File: DOMResultBuilder.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 9
Source File: DOMResultBuilder.java    From jdk8u60 with GNU General Public License v2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 10
Source File: DOMResultBuilder.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
public void doctypeDecl(DocumentType node) throws XNIException {
    /** Create new DocumentType node for the target. */
    if (fDocumentImpl != null) {
        DocumentType docType = fDocumentImpl.createDocumentType(node.getName(), node.getPublicId(), node.getSystemId());
        final String internalSubset = node.getInternalSubset();
        /** Copy internal subset. */
        if (internalSubset != null) {
            ((DocumentTypeImpl) docType).setInternalSubset(internalSubset);
        }
        /** Copy entities. */
        NamedNodeMap oldMap = node.getEntities();
        NamedNodeMap newMap = docType.getEntities();
        int length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Entity oldEntity = (Entity) oldMap.item(i);
            EntityImpl newEntity = (EntityImpl) fDocumentImpl.createEntity(oldEntity.getNodeName());
            newEntity.setPublicId(oldEntity.getPublicId());
            newEntity.setSystemId(oldEntity.getSystemId());
            newEntity.setNotationName(oldEntity.getNotationName());
            newMap.setNamedItem(newEntity);
        }
        /** Copy notations. */
        oldMap = node.getNotations();
        newMap = docType.getNotations();
        length = oldMap.getLength();
        for (int i = 0; i < length; ++i) {
            Notation oldNotation = (Notation) oldMap.item(i);
            NotationImpl newNotation = (NotationImpl) fDocumentImpl.createNotation(oldNotation.getNodeName());
            newNotation.setPublicId(oldNotation.getPublicId());
            newNotation.setSystemId(oldNotation.getSystemId());
            newMap.setNamedItem(newNotation);
        }
        append(docType);
    }
}
 
Example 11
Source File: AbstractDOMParser.java    From openjdk-jdk8u with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 12
Source File: AbstractDOMParser.java    From JDKSourceCode1.8 with MIT License 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 13
Source File: AbstractDOMParser.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 14
Source File: AbstractDOMParser.java    From Bytecoder with Apache License 2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 15
Source File: AbstractDOMParser.java    From jdk8u60 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 16
Source File: AbstractDOMParser.java    From openjdk-jdk9 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 17
Source File: AbstractDOMParser.java    From TencentKona-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 18
Source File: AbstractDOMParser.java    From openjdk-8 with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 19
Source File: AbstractDOMParser.java    From openjdk-8-source with GNU General Public License v2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}
 
Example 20
Source File: AbstractDOMParser.java    From jdk1.8-source-analysis with Apache License 2.0 4 votes vote down vote up
/**
 * A notation declaration
 *
 * @param name     The name of the notation.
 * @param identifier    An object containing all location information
 *                      pertinent to this notation.
 * @param augs Additional information that may include infoset
 *                      augmentations.
 *
 * @throws XNIException Thrown by handler to signal an error.
 */
public void notationDecl (String name, XMLResourceIdentifier identifier,
Augmentations augs) throws XNIException {

    // internal subset string
    String publicId = identifier.getPublicId ();
    String literalSystemId = identifier.getLiteralSystemId ();
    if (fInternalSubset != null && !fInDTDExternalSubset) {
        fInternalSubset.append ("<!NOTATION ");
        fInternalSubset.append (name);
        if (publicId != null) {
            fInternalSubset.append (" PUBLIC '");
            fInternalSubset.append (publicId);
            if (literalSystemId != null) {
                fInternalSubset.append ("' '");
                fInternalSubset.append (literalSystemId);
            }
        }
        else {
            fInternalSubset.append (" SYSTEM '");
            fInternalSubset.append (literalSystemId);
        }
        fInternalSubset.append ("'>\n");
    }

    // NOTE: We only know how to create these nodes for the Xerces
    //       DOM implementation because DOM Level 2 does not specify
    //       that functionality. -Ac

    // create full node
    if (fDocumentImpl !=null && fDocumentType != null) {
        NamedNodeMap notations = fDocumentType.getNotations ();
        if (notations.getNamedItem (name) == null) {
            NotationImpl notation = (NotationImpl)fDocumentImpl.createNotation (name);
            notation.setPublicId (publicId);
            notation.setSystemId (literalSystemId);
            notation.setBaseURI (identifier.getBaseSystemId ());
            notations.setNamedItem (notation);
        }
    }

    // create deferred node
    if (fDocumentTypeIndex != -1) {
        boolean found = false;
        int nodeIndex = fDeferredDocumentImpl.getLastChild (fDocumentTypeIndex, false);
        while (nodeIndex != -1) {
            short nodeType = fDeferredDocumentImpl.getNodeType (nodeIndex, false);
            if (nodeType == Node.NOTATION_NODE) {
                String nodeName = fDeferredDocumentImpl.getNodeName (nodeIndex, false);
                if (nodeName.equals (name)) {
                    found = true;
                    break;
                }
            }
            nodeIndex = fDeferredDocumentImpl.getPrevSibling (nodeIndex, false);
        }
        if (!found) {
            int notationIndex = fDeferredDocumentImpl.createDeferredNotation (
            name, publicId, literalSystemId, identifier.getBaseSystemId ());
            fDeferredDocumentImpl.appendChild (fDocumentTypeIndex, notationIndex);
        }
    }

}