本文整理了Java中org.w3c.dom.Document.setXmlVersion()
方法的一些代码示例,展示了Document.setXmlVersion()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Document.setXmlVersion()
方法的具体详情如下:
包路径:org.w3c.dom.Document
类名称:Document
方法名:setXmlVersion
[英]An attribute specifying, as part of the XML declaration, the version number of this document. If there is no declaration and if this document supports the "XML" feature, the value is "1.0"
. If this document does not support the "XML" feature, the value is always null
. Changing this attribute will affect methods that check for invalid characters in XML names. Application should invoke Document.normalizeDocument()
in order to check for invalid characters in the Node
s that are already part of this Document
.
DOM applications may use the DOMImplementation.hasFeature(feature, version)
method with parameter values "XMLVersion" and "1.0" (respectively) to determine if an implementation supports [XML 1.0]. DOM applications may use the same method with parameter values "XMLVersion" and "1.1" (respectively) to determine if an implementation supports [XML 1.1]. In both cases, in order to support XML, an implementation must also support the "XML" feature defined in this specification. Document
objects supporting a version of the "XMLVersion" feature must not raise a NOT_SUPPORTED_ERR
exception for the same version number when using Document.xmlVersion
.
[中]一种属性,作为XML declaration的一部分,指定此文档的版本号。如果没有声明并且此文档支持“XML”功能,则值为"1.0"
。如果此文档不支持“XML”功能,则值始终为null
。更改此属性将影响检查XML名称中无效字符的方法。应用程序应调用Document.normalizeDocument()
以检查Node
s中已属于此Document
的无效字符。
DOM应用程序可以使用参数值分别为“XMLVersion”和“1.0”的DOMImplementation.hasFeature(feature, version)
方法来确定实现是否支持[XML 1.0]。DOM应用程序可以使用参数值分别为“XMLVersion”和“1.1”的相同方法来确定实现是否支持[XML 1.1]。在这两种情况下,为了支持XML,实现还必须支持本规范中定义的“XML”特性。使用Document.xmlVersion
时,支持“XMLVersion”功能版本的Document
对象不得对同一版本号引发NOT_SUPPORTED_ERR
异常。
代码示例来源:origin: plantuml/plantuml
public XmiClassDiagramAbstract(ClassDiagram classDiagram) throws ParserConfigurationException {
this.classDiagram = classDiagram;
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilder builder = factory.newDocumentBuilder();
this.document = builder.newDocument();
document.setXmlVersion("1.0");
document.setXmlStandalone(true);
final Element xmi = document.createElement("XMI");
xmi.setAttribute("xmi.version", "1.1");
xmi.setAttribute("xmlns:UML", "href://org.omg/UML/1.3");
document.appendChild(xmi);
final Element header = document.createElement("XMI.header");
xmi.appendChild(header);
final Element metamodel = document.createElement("XMI.metamodel");
metamodel.setAttribute("xmi.name", "UML");
metamodel.setAttribute("xmi.version", "1.3");
header.appendChild(metamodel);
final Element content = document.createElement("XMI.content");
xmi.appendChild(content);
// <UML:Model xmi.id="UMLModel.4" name="Design Model"
// visibility="public" isSpecification="false" isRoot="false"
// isLeaf="false" isAbstract="false">
final Element model = document.createElement("UML:Model");
model.setAttribute("xmi.id", CucaDiagramXmiMaker.getModel(classDiagram));
model.setAttribute("name", "PlantUML");
content.appendChild(model);
// <UML:Namespace.ownedElement>
this.ownedElement = document.createElement("UML:Namespace.ownedElement");
model.appendChild(ownedElement);
}
代码示例来源:origin: plantuml/plantuml
public ScxmlStateDiagramStandard(StateDiagram diagram) throws ParserConfigurationException {
this.diagram = diagram;
final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
final DocumentBuilder builder = factory.newDocumentBuilder();
this.document = builder.newDocument();
document.setXmlVersion("1.0");
document.setXmlStandalone(true);
final Element scxml = document.createElement("scxml");
scxml.setAttribute("xmlns", "http://www.w3.org/2005/07/scxml");
scxml.setAttribute("version", "1.0");
final String initial = getInitial();
if (initial != null) {
scxml.setAttribute("initial", initial);
}
document.appendChild(scxml);
for (final IEntity ent : diagram.getLeafsvalues()) {
scxml.appendChild(createState(ent));
}
}
代码示例来源:origin: plantuml/plantuml
document.setXmlVersion("1.0");
document.setXmlStandalone(true);
代码示例来源:origin: plantuml/plantuml
document.setXmlVersion("1.0");
document.setXmlStandalone(true);
代码示例来源:origin: org.jdom/jdom
basedoc.setXmlVersion("1.0");
代码示例来源:origin: org.vx68k.quercus/quercus
public void setXmlVersion(String xmlVersion)
throws DOMException
{
_delegate.setXmlVersion(xmlVersion);
}
代码示例来源:origin: apache/cxf
public void writeStartDocument(String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.cxf/cxf-core
public void writeStartDocument(String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.cxf/cxf-api
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: apache/cxf
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.cxf/cxf-core
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.cxf/cxf-api
public void writeStartDocument(String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.cxf/cxf-common-utilities
public void writeStartDocument(String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.cxf/cxf-common-utilities
public void writeStartDocument(String encoding, String version) throws XMLStreamException {
try {
document.setXmlVersion(version);
} catch (Exception ex) {
//ignore - likely not DOM level 3
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.jaxp-ri
private void setDocumentInfo() {
//try to set document version
if (locator == null) return;
try{
_document.setXmlVersion(((Locator2)locator).getXMLVersion());
}catch(ClassCastException e){}
}
代码示例来源:origin: com.sun.xml.parsers/jaxp-ri
private void setDocumentInfo() {
//try to set document version
if (locator == null) return;
try{
_document.setXmlVersion(((Locator2)locator).getXMLVersion());
}catch(ClassCastException e){}
}
代码示例来源:origin: org.ow2.bonita/bonita-server
/**
* Create the document
* @return the {@link XmlBuilder}
* @throws ParserConfigurationException
*/
public XmlBuilder createDocument() throws ParserConfigurationException {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.newDocument();
document.setXmlVersion("1.0");
document.setXmlStandalone(true);
return this;
}
代码示例来源:origin: org.ow2.bonita/bonita-client
/**
* Create the document
* @return the {@link XmlBuilder}
* @throws ParserConfigurationException
*/
public XmlBuilder createDocument() throws ParserConfigurationException {
DocumentBuilder documentBuilder = documentBuilderFactory.newDocumentBuilder();
document = documentBuilder.newDocument();
document.setXmlVersion("1.0");
document.setXmlStandalone(true);
return this;
}
代码示例来源:origin: com.marklogic/marklogic-mapreduce2
protected void initClonedOwnerDoc() throws ParserConfigurationException {
ownerDocCloned = getDocumentBuilderFactory().newDocumentBuilder().newDocument();
ownerDocCloned.setDocumentURI(getDocumentURI());
ownerDocCloned.setXmlVersion(getXmlVersion());
}
内容来源于网络,如有侵权,请联系作者删除!