# Create EditableDocument from file or markup This article explains how to create instance of the EditableDocument class from HTML files from disk or from HTML markup with resources using GroupDocs.Editor for Java API. > This demonstration shows how to create instance of the EditableDocument class from HTML files from disk or from HTML markup with resources ## Introduction When working with [**GroupDocs.Editor**](https://products.groupdocs.com/editor/java) in usual way by loading, opening, editing and saving documents, the instances of [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) class are produced by the [Editor.edit()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editor#edit--) method and accepted by the [Editor.save()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editor#save-com.groupdocs.editor.EditableDocument-java.io.OutputStream-com.groupdocs.editor.options.ISaveOptions-) method. However, in some cases it is required to create a [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) instance from existing HTML markup with optional resources. For example, some document was loaded to `Editor` class, opened for editing, and then [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) was saved to the disk as a set of HTML file and connected resources. Then this HTML document was passed to the WYSIWYG-editor, edited, and save back to the disk as modified HTML. Or raw output from the WYSIWYG-editor was saved to the `String` variable. In order to save it to some final format like DOCX or XLSX, user needs to pass the document to the [Editor.save()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editor#save-com.groupdocs.editor.EditableDocument-java.io.OutputStream-com.groupdocs.editor.options.ISaveOptions-) method in a form of [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) instance. This means that user should create an instance of [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) class manually. [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) contains three public static methods for creating its instances: [fromFile()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument#fromFile-java.lang.String-java.lang.String-), [fromMarkup()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument#fromMarkup-java.lang.String-java.util.List-) and [fromBodyMarkupAndResourceFolder()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument#fromMarkupAndResourceFolder-java.lang.String-java.lang.String-). This article reviews all of them. ## Opening from file Let's suppose that we have an HTML file with edited document content, that is saved on the disk. There is also a folder with resources (images, fonts, stylesheets), that are used by this document, and document has correct links to this resources. Let's say, HTML document has name "document.html" and is located in the "input" folder. Resource folder is located in the same "input" folder and has name "document\_resources". And, what is most important, HTML markup from "document.html" has proper links to files from "document\_resources" folder. For example, there will be in the "document.html", and "document\_resources" folder actually contains "style.css" file. In that case creating the [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) instance is the most simple: ```java String inputHtmlPath = "C://input//document.html"; EditableDocument document = EditableDocument.fromFile(inputHtmlPath, null); ``` The [fromFile()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument#fromFile-java.lang.String-java.lang.String-) method accepts two parameters, where first is a path to HTML file, while second is a path to resource folder. If HTML file contains correct links, as it is described above, second parameter is not necessary: GroupDocs.Editor will scan the links and automatically find the resource folder and correct resources. However, if path to resource folder doesn't match to the links in HTML file, it is possible to specify a resource folder forcibly, what is illustrated in code below: ```java String inputHtmlPath = "C://input//document.html"; String inputResourceFolderPath = "C://input//document_resources/"; EditableDocument document = EditableDocument.fromFile(inputHtmlPath, inputResourceFolderPath); ``` If HTML file contains a link to same resource, that is not present in the resource folder, it will be omitted. ## Opening from markup In some cases edited HTML document is not present as a file. It may be stored in database, obtained from remote storage, or something else. In such cases [EditableDocument](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument) class delivers a [fromMarkup()](https://reference.groupdocs.com/editor/java/com.groupdocs.editor/editabledocument#fromMarkup-java.lang.String-java.util.List-) method. This method, like previous, has two parameters: * `String newHtmlContent` — string, that contains raw HTML markup. This parameter is mandatory. * IEnumerable<[IHtmlResource](https://reference.groupdocs.com/editor/java/com.groupdocs.editor.htmlcss.resources/ihtmlresource)> resources — this is a set of prepared resources (images, fonts, stylesheets), that are used or may be used in the HTML document. User needs to prepare this collection by himself. This parameter is optional, user may pass NULL or empty collection. As with previous method, if HTML markup refers to some resource, that is not found in "resources" collection, that it will be skipped (omitted). The code example below demonstrates this approach. ```java String inputHtmlMarkup = "