blob: 12800b29fb48c01e0d03062b225263c45a771774 [file] [log] [blame]
/*******************************************************************************
* Copyright (c) 2014 TwelveTone LLC and others.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* which accompanies this distribution, and is available at
* http://www.eclipse.org/legal/epl-v10.html
*
* Contributors:
* Steven Spungin <steven@spungin.tv> - initial API and implementation
*******************************************************************************/
package org.eclipse.e4.tools.emf.ui.internal.common.component.tabs;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
/**
* Helper functions for working with documents.
*
* @author Steven Spungin
*
*/
public class DocUtil {
public static Element createChild(Element parent, String name) {
Element element = parent.getOwnerDocument().createElement(name);
parent.appendChild(element);
return element;
}
public static Document createDocument(String name) throws ParserConfigurationException {
Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
doc.appendChild(doc.createElement(name));
return doc;
}
}