Writer2xhtml custom config ui + EPUB export
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@55 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
a58ea7fa19
commit
ce61f7bc3b
41 changed files with 1118 additions and 212 deletions
77
source/java/writer2latex/epub/ContainerWriter.java
Normal file
77
source/java/writer2latex/epub/ContainerWriter.java
Normal file
|
@ -0,0 +1,77 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* ContainerWriter.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2001-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* version 1.2 (2010-03-29)
|
||||
*
|
||||
*/
|
||||
|
||||
package writer2latex.epub;
|
||||
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
import javax.xml.parsers.ParserConfigurationException;
|
||||
|
||||
import org.w3c.dom.DOMImplementation;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.DocumentType;
|
||||
import org.w3c.dom.Element;
|
||||
|
||||
import writer2latex.xmerge.NewDOMDocument;
|
||||
|
||||
/** This class creates the required META-INF/container.xml file for an EPUB package
|
||||
* (see http://www.idpf.org/ocf/ocf1.0/download/ocf10.htm)
|
||||
*/
|
||||
public class ContainerWriter extends NewDOMDocument {
|
||||
|
||||
public ContainerWriter(String sRootFile) {
|
||||
super("container", "xml");
|
||||
|
||||
// create DOM
|
||||
Document contentDOM = null;
|
||||
try {
|
||||
DocumentBuilderFactory builderFactory = DocumentBuilderFactory.newInstance();
|
||||
DocumentBuilder builder = builderFactory.newDocumentBuilder();
|
||||
DOMImplementation domImpl = builder.getDOMImplementation();
|
||||
DocumentType doctype = domImpl.createDocumentType("container","","");
|
||||
contentDOM = domImpl.createDocument("urn:oasis:names:tc:opendocument:xmlns:container","container",doctype);
|
||||
}
|
||||
catch (ParserConfigurationException t) { // this should never happen
|
||||
throw new RuntimeException(t);
|
||||
}
|
||||
|
||||
// Populate the DOM tree
|
||||
Element container = contentDOM.getDocumentElement();
|
||||
container.setAttribute("version", "1.0");
|
||||
container.setAttribute("xmlns","urn:oasis:names:tc:opendocument:xmlns:container");
|
||||
|
||||
Element rootfiles = contentDOM.createElement("rootfiles");
|
||||
container.appendChild(rootfiles);
|
||||
|
||||
Element rootfile = contentDOM.createElement("rootfile");
|
||||
rootfile.setAttribute("full-path", sRootFile);
|
||||
rootfile.setAttribute("media-type", "application/oebps-package+xml");
|
||||
rootfiles.appendChild(rootfile);
|
||||
|
||||
setContentDOM(contentDOM);
|
||||
}
|
||||
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue