org.dom4j.DocumentType Java Examples
The following examples show how to use
org.dom4j.DocumentType.
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: PermissionModel.java From alfresco-repository with GNU Lesser General Public License v3.0 | 5 votes |
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()); }
Example #2
Source File: QTIDocument.java From olat with Apache License 2.0 | 5 votes |
/** * 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; }
Example #3
Source File: QTIDocument.java From olat with Apache License 2.0 | 5 votes |
/** * 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; }
Example #4
Source File: VersionedXmlDoc.java From onedev with MIT License | 4 votes |
public DocumentType getDocType() { return getWrapped().getDocType(); }
Example #5
Source File: VersionedXmlDoc.java From onedev with MIT License | 4 votes |
public void setDocType(DocumentType docType) { getWrapped().setDocType(docType); }