当前位置: 首页>>代码示例>>Java>>正文


Java DocumentType.getOwnerDocument方法代码示例

本文整理汇总了Java中org.w3c.dom.DocumentType.getOwnerDocument方法的典型用法代码示例。如果您正苦于以下问题:Java DocumentType.getOwnerDocument方法的具体用法?Java DocumentType.getOwnerDocument怎么用?Java DocumentType.getOwnerDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.w3c.dom.DocumentType的用法示例。


在下文中一共展示了DocumentType.getOwnerDocument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createDocument

import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
/**
 * Introduced in DOM Level 2. <p>
 *
 * Creates an XML Document object of the specified type with its document
 * element.
 *
 * @param namespaceURI     The namespace URI of the document
 *                         element to create, or null.
 * @param qualifiedName    The qualified name of the document
 *                         element to create.
 * @param doctype          The type of document to be created or null.<p>
 *
 *                         When doctype is not null, its
 *                         Node.ownerDocument attribute is set to
 *                         the document being created.
 * @return Document        A new Document object.
 * @throws DOMException    WRONG_DOCUMENT_ERR: Raised if doctype has
 *                         already been used with a different document.
 * @since WD-DOM-Level-2-19990923
 */
public Document           createDocument(String namespaceURI,
                                         String qualifiedName,
                                         DocumentType doctype)
                                         throws DOMException
{
    if(namespaceURI == null && qualifiedName == null && doctype == null){
    //if namespaceURI, qualifiedName and doctype are null, returned document is empty with
    //no document element
        return new DocumentImpl();
    }
    else if (doctype != null && doctype.getOwnerDocument() != null) {
        String msg = DOMMessageFormatter.formatMessage(DOMMessageFormatter.DOM_DOMAIN, "WRONG_DOCUMENT_ERR", null);
        throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
    }
    DocumentImpl doc = new DocumentImpl(doctype);
    Element e = doc.createElementNS( namespaceURI, qualifiedName);
    doc.appendChild(e);
    return doc;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:40,代码来源:DOMImplementationImpl.java

示例2: createDocument

import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
/**
 * Introduced in DOM Level 2. <p>
 *
 * Creates an XML Document object of the specified type with its document
 * element.
 *
 * @param namespaceURI     The namespace URI of the document
 *                         element to create, or null.
 * @param qualifiedName    The qualified name of the document
 *                         element to create.
 * @param doctype          The type of document to be created or null.<p>
 *
 *                         When doctype is not null, its
 *                         Node.ownerDocument attribute is set to
 *                         the document being created.
 * @return Document        A new Document object.
 * @throws DOMException    WRONG_DOCUMENT_ERR: Raised if doctype has
 *                         already been used with a different document.
 * @since WD-DOM-Level-2-19990923
 */
public Document           createDocument(String namespaceURI,
                                         String qualifiedName,
                                         DocumentType doctype)
                                         throws DOMException
{
    if (doctype != null && doctype.getOwnerDocument() != null) {
        throw new DOMException(DOMException.WRONG_DOCUMENT_ERR,
                               DOMMessageFormatter.formatMessage(
                               DOMMessageFormatter.XML_DOMAIN,
                                                   "WRONG_DOCUMENT_ERR", null));
    }
    DocumentImpl doc = new PSVIDocumentImpl(doctype);
    Element e = doc.createElementNS( namespaceURI, qualifiedName);
    doc.appendChild(e);
    return doc;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:37,代码来源:PSVIDOMImplementationImpl.java

示例3: createDocument

import org.w3c.dom.DocumentType; //导入方法依赖的package包/类
/**
 * Introduced in DOM Level 2. <p>
 *
 * Creates an XML Document object of the specified type with its document
 * element.
 *
 * @param namespaceURI     The namespace URI of the document
 *                         element to create, or null.
 * @param qualifiedName    The qualified name of the document
 *                         element to create.
 * @param doctype          The type of document to be created or null.<p>
 *
 *                         When doctype is not null, its
 *                         Node.ownerDocument attribute is set to
 *                         the document being created.
 * @return Document        A new Document object.
 * @throws DOMException    WRONG_DOCUMENT_ERR: Raised if doctype has
 *                         already been used with a different document.
 * @since WD-DOM-Level-2-19990923
 */
public Document createDocument(
        String namespaceURI,
        String qualifiedName,
        DocumentType doctype)
        throws DOMException {
        if (doctype != null && doctype.getOwnerDocument() != null) {
                String msg =
                        DOMMessageFormatter.formatMessage(
                                DOMMessageFormatter.DOM_DOMAIN,
                                "WRONG_DOCUMENT_ERR",
                                null);
                throw new DOMException(DOMException.WRONG_DOCUMENT_ERR, msg);
        }
        CoreDocumentImpl doc = new CoreDocumentImpl(doctype);
        Element e = doc.createElementNS(namespaceURI, qualifiedName);
        doc.appendChild(e);
        return doc;
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:39,代码来源:CoreDOMImplementationImpl.java


注:本文中的org.w3c.dom.DocumentType.getOwnerDocument方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。