public interface DOMImplementation
DOMImplementation接口提供了许多用于执行与文档对象模型的任何特定实例无关的操作的方法。
| Modifier and Type | Method and Description |
|---|---|
Document |
createDocument(String namespaceURI, String qualifiedName, DocumentType doctype)
使用其文档元素创建指定类型的DOM文档对象。
|
DocumentType |
createDocumentType(String qualifiedName, String publicId, String systemId)
创建一个空的
DocumentType节点。
|
Object |
getFeature(String feature, String version)
该方法返回一个专门的对象,该对象实现了特定功能和版本的专用API,如DOM Features中
所述 。
|
boolean |
hasFeature(String feature, String version)
测试DOM实现是否实现特定功能和版本,如DOM Features中
所述 。
|
boolean hasFeature(String feature, String version)
feature - 要测试的功能的名称。
version - 这是要测试的功能的版本号。
true如果该功能在指定版本中实现,
false false。
DocumentType createDocumentType(String qualifiedName, String publicId, String systemId) throws DOMException
DocumentType节点。
实体声明和符号不可用。
实体引用扩展和默认属性添加不会发生。
qualifiedName - 要创建的文档类型的限定名称。
publicId - 外部子集公共标识符。
systemId - 外部子系统标识符。
DocumentType节点,
Node.ownerDocument设置为
null 。
DOMException - INVALID_CHARACTER_ERR:如果指定的限定名称不是根据[ XML 1.0 ]的XML名称,则引发 。
qualifiedName则提起。
Document createDocument(String namespaceURI, String qualifiedName, DocumentType doctype) throws DOMException
DocumentType给出的创建文档,实现可以实例化专用的Document对象,其支持比“Core”更多的功能,例如“HTML”[ DOM Level 2 HTML ]。
另一方面,在创建文档后设置DocumentType ,这不太可能发生。
或者,可以使用专门的Document创建方法,例如createHTMLDocument [ DOM Level 2 HTML ]来获得特定类型的Document对象。
namespaceURI - 要创建的文档元素的命名空间URI或
null 。
qualifiedName - 要创建的文档元素的限定名称或
null 。
doctype - 要创建的文档类型或null 。
当doctype不是null时,其Node.ownerDocument属性设置为正在创建的文档。
Document对象与其文档元素。
如果NamespaceURI , qualifiedName和doctype是null ,返回Document是空的,没有文档元素。
DOMException - INVALID_CHARACTER_ERR:如果指定的限定名称不是根据[ XML 1.0 ]的XML名称,则引发 。
qualifiedName是畸形的,如果qualifiedName有一个前缀, namespaceURI是null ,或者如果qualifiedName为null和namespaceURI不同于null ,或者如果qualifiedName有前缀为“xml”和namespaceURI不同于“ http://www.w3.org/XML/1998/namespace ”[ XML Namespaces ],或者如果DOM实现不支持"XML"功能,但提供了非空名称空间URI,因为命名空间由XML定义。
doctype已经与其他文档一起使用,或者是由其他实现创建的,则引发。
Object getFeature(String feature, String version)
DOMImplementation接口的DOMImplementation对象。
feature - feature的功能的名称。
请注意,功能名称之前的任何加号“+”将被忽略,因为在此方法的上下文中不重要。
version - 这是要测试的功能的版本号。
null如果没有对象实现与该功能相关的接口。
如果DOMObject返回的方法实现了DOMImplementation接口,则必须委托给主核心DOMImplementation ,而不返回与主要核心DOMImplementation ( DOMImplementation等) hasFeature getFeature 。
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.