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


Java DocumentType类代码示例

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


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

示例1: processModelDocType

import org.dom4j.DocumentType; //导入依赖的package包/类
private InputStream processModelDocType(InputStream is, String dtdSchemaUrl) throws DocumentException, IOException
{
    SAXReader reader = new SAXReader();
    // read document without validation
    Document doc = reader.read(is);
    DocumentType docType = doc.getDocType();
    if (docType != null)
    {
        // replace DOCTYPE setting the full path to the xsd
        docType.setSystemID(dtdSchemaUrl);
    }
    else
    {
        // add the DOCTYPE
        docType = new DefaultDocumentType(doc.getRootElement().getName(), dtdSchemaUrl);
        doc.setDocType(docType);
    }

    ByteArrayOutputStream fos = new ByteArrayOutputStream();
    try
    {
        OutputFormat format = OutputFormat.createPrettyPrint(); // uses UTF-8
        XMLWriter writer = new XMLWriter(fos, format);
        writer.write(doc);
        writer.flush();
    }
    finally
    {
        fos.close();
    }
    
    return new ByteArrayInputStream(fos.toByteArray());
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:34,代码来源:PermissionModel.java

示例2: SQLConfigMap

import org.dom4j.DocumentType; //导入依赖的package包/类
/**
 * 合并mybatis配置文件
 */
public Document SQLConfigMap() {
	Document doc = DocumentHelper.createDocument();
	doc.setXMLEncoding("UTF-8");
	DocumentFactory documentFactory = new DocumentFactory();
	DocumentType docType = documentFactory.createDocType("configuration",
			"-//mybatis.org//DTD Config 3.0//EN",
			"http://mybatis.org/dtd/mybatis-3-config.dtd");
	doc.setDocType(docType);
	Element rootElement = doc.addElement("configuration");
	rootElement.addElement("typeAliases");
	rootElement.addElement("mappers");
	return doc;
}
 
开发者ID:IAMTJW,项目名称:TJWmybatis,代码行数:17,代码来源:MySQLSessionFactoryBean.java

示例3: assertNodesEqual

import org.dom4j.DocumentType; //导入依赖的package包/类
public void assertNodesEqual( DocumentType o1, DocumentType o2 ) {
    if ( o1 != o2 ) {
        if ( o1 == null ) {
            assertTrue( "Missing DocType: " + o2, false );
        }
        else if ( o2 == null ) {
            assertTrue( "Missing DocType: " + o1, false );
        }
        else {
            assertEquals( "DocType name equal", o1.getName(), o2.getName() );
            assertEquals( "DocType publicID equal", o1.getPublicID(), o2.getPublicID() );
            assertEquals( "DocType systemID equal", o1.getSystemID(), o2.getSystemID() );
        }
    }
}
 
开发者ID:NCAR,项目名称:dls-repository-stack,代码行数:16,代码来源:AbstractTestCase.java

示例4: getDocument

import org.dom4j.DocumentType; //导入依赖的package包/类
/**
 * Get the structure as an XML Document.
 * 
 * @return XML Document.
 */
public Document getDocument() {
    final Document tmp = DocumentHelper.createDocument();
    final DocumentType type = new DOMDocumentType();
    type.setElementName(DOCUMENT_ROOT);
    type.setSystemID(DOCUMENT_DTD);

    tmp.setDocType(type);
    final Element questestinterop = tmp.addElement(DOCUMENT_ROOT);
    this.assessment.addToElement(questestinterop);
    return tmp;
}
 
开发者ID:huihoo,项目名称:olat,代码行数:17,代码来源:QTIDocument.java

示例5: getDocType

import org.dom4j.DocumentType; //导入依赖的package包/类
public DocumentType getDocType() {
	return getWrapped().getDocType();
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:4,代码来源:VersionedDocument.java

示例6: setDocType

import org.dom4j.DocumentType; //导入依赖的package包/类
public void setDocType(DocumentType docType) {
	getWrapped().setDocType(docType);
}
 
开发者ID:jmfgdev,项目名称:gitplex-mit,代码行数:4,代码来源:VersionedDocument.java

示例7: writeDocType

import org.dom4j.DocumentType; //导入依赖的package包/类
protected void writeDocType(DocumentType docType) throws IOException {
	if (docType != null) {
		docType.write(writer);
		writePrintln();
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:7,代码来源:XMLAttibuteFormatWriter.java

示例8: write

import org.dom4j.DocumentType; //导入依赖的package包/类
/**
 * Writes the given {@link DocumentType}.
 * 
 * @param docType
 *            <code>DocumentType</code> to output.
 * 
 * @throws IOException
 *             DOCUMENT ME!
 */
public void write(DocumentType docType) throws IOException {
	writeDocType(docType);

	if (autoFlush) {
		flush();
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:17,代码来源:XMLAttibuteFormatWriter.java

示例9: writeNode

import org.dom4j.DocumentType; //导入依赖的package包/类
protected void writeNode(Node node) throws IOException {
	int nodeType = node.getNodeType();

	switch (nodeType) {
	case Node.ELEMENT_NODE:
		writeElement((Element) node);

		break;

	case Node.ATTRIBUTE_NODE:
		writeAttribute((Attribute) node);

		break;

	case Node.TEXT_NODE:
		writeNodeText(node);

		// write((Text) node);
		break;

	case Node.CDATA_SECTION_NODE:
		writeCDATA(node.getText());

		break;

	case Node.ENTITY_REFERENCE_NODE:
		writeEntity((Entity) node);

		break;

	case Node.PROCESSING_INSTRUCTION_NODE:
		writeProcessingInstruction((ProcessingInstruction) node);

		break;

	case Node.COMMENT_NODE:
		writeComment(node.getText());

		break;

	case Node.DOCUMENT_NODE:
		write((Document) node);

		break;

	case Node.DOCUMENT_TYPE_NODE:
		writeDocType((DocumentType) node);

		break;

	case Node.NAMESPACE_NODE:

		// Will be output with attributes
		// write((Namespace) node);
		break;

	default:
		throw new IOException("Invalid node type: " + node);
	}
}
 
开发者ID:callakrsos,项目名称:Gargoyle,代码行数:61,代码来源:XMLAttibuteFormatWriter.java


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