org.w3c.dom.Notation Java Examples

The following examples show how to use org.w3c.dom.Notation. 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: AbstractNodeTester.java    From xmlunit with Apache License 2.0 5 votes vote down vote up
/**
 * Validate a single Node by delegating to node type specific methods.
 * @see #testAttribute(Attr)
 * @see #testCDATASection(CDATASection)
 * @see #testComment(Comment)
 * @see #testDocumentType(DocumentType)
 * @see #testElement(Element)
 * @see #testEntity(Entity)
 * @see #testEntityReference(EntityReference)
 * @see #testNotation(Notation)
 * @see #testProcessingInstruction(ProcessingInstruction)
 * @see #testText(Text)
 */
public void testNode(Node aNode, NodeTest forTest) throws NodeTestException {
    switch (aNode.getNodeType()) {
    case Node.ATTRIBUTE_NODE:
        // should not happen as attributes are not exposed by DOM traversal
        testAttribute((Attr)aNode);
        break;
    case Node.CDATA_SECTION_NODE:
        testCDATASection((CDATASection)aNode);
        break;
    case Node.COMMENT_NODE:
        testComment((Comment)aNode);
        break;
    case Node.DOCUMENT_TYPE_NODE:
        testDocumentType((DocumentType)aNode);
        break;
    case Node.ELEMENT_NODE:
        testElement((Element)aNode);
        break;
    case Node.ENTITY_NODE:
        testEntity((Entity)aNode);
        break;
    case Node.ENTITY_REFERENCE_NODE:
        testEntityReference((EntityReference)aNode);
        break;
    case Node.NOTATION_NODE:
        testNotation((Notation)aNode);
        break;
    case Node.PROCESSING_INSTRUCTION_NODE:
        testProcessingInstruction(
                                  (ProcessingInstruction) aNode);
        break;
    case Node.TEXT_NODE:
        testText((Text)aNode);
        break;
    default:
        throw new NodeTestException("No delegate method for Node type",
                                    aNode);
    }
}
 
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-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 #5
Source File: DOMResultBuilder.java    From hottub 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 #6
Source File: CoreDocumentImpl.java    From hottub with GNU General Public License v2.0 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #7
Source File: NotationTest.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
private Notation findNotation(String name) throws SAXException, IOException, ParserConfigurationException {
    Document document = createDOM("Notation01.xml");
    NamedNodeMap nm = document.getDoctype().getNotations();
    for (int i = 0; i < nm.getLength(); i++) {
        if (nm.item(i).getNodeName().equals(name)) {
            return (Notation) nm.item(i);
        }
    }
    throw new RuntimeException("Notation: '" + name + "' not found.");
}
 
Example #8
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 #9
Source File: CoreDocumentImpl.java    From openjdk-jdk9 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #10
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 #11
Source File: CoreDocumentImpl.java    From Bytecoder with Apache License 2.0 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #12
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 #13
Source File: CoreDocumentImpl.java    From openjdk-jdk8u-backup with GNU General Public License v2.0 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #14
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 #15
Source File: CoreDocumentImpl.java    From openjdk-jdk8u with GNU General Public License v2.0 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #16
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 #17
Source File: CoreDocumentImpl.java    From JDKSourceCode1.8 with MIT License 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #18
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 #19
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 #20
Source File: CoreDocumentImpl.java    From TencentKona-8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #21
Source File: CoreDocumentImpl.java    From jdk1.8-source-analysis with Apache License 2.0 5 votes vote down vote up
/**
 * NON-DOM Factory method; creates a Notation having this Document as its
 * OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building DTD
 * information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet implemented.)
 */
public Notation createNotation(String name)
        throws DOMException {

    if (errorChecking && !isXMLName(name, xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #22
Source File: CoreDocumentImpl.java    From jdk8u60 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #23
Source File: CoreDocumentImpl.java    From openjdk-8-source with GNU General Public License v2.0 3 votes vote down vote up
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #24
Source File: CoreDocumentImpl.java    From openjdk-8 with GNU General Public License v2.0 3 votes vote down vote up
/**
 * NON-DOM
 * Factory method; creates a Notation having this Document
 * as its OwnerDoc. (REC-DOM-Level-1-19981001 left the process of building
 * DTD information unspecified.)
 *
 * @param name The name of the Notation we wish to describe
 *
 * @throws DOMException(NOT_SUPPORTED_ERR) for HTML documents, where
 * notations are not permitted. (HTML not yet
 * implemented.)
 */
public Notation createNotation(String name)
throws DOMException {

    if (errorChecking && !isXMLName(name,xml11Version)) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "INVALID_CHARACTER_ERR", null);
        throw new DOMException(DOMException.INVALID_CHARACTER_ERR, msg);
    }
    return new NotationImpl(this, name);

}
 
Example #25
Source File: AbstractNodeTester.java    From xmlunit with Apache License 2.0 2 votes vote down vote up
/**
 * Template delegator for testNode() method. OVERRIDE to add custom logic
 * @param notation
 * @exception NodeTestException always: override if required in subclass
 */
public void testNotation(Notation notation) throws NodeTestException {
    unhandled(notation);
}