當前位置: 首頁>>代碼示例>>Java>>正文


Java Document.createElement方法代碼示例

本文整理匯總了Java中org.w3c.dom.Document.createElement方法的典型用法代碼示例。如果您正苦於以下問題:Java Document.createElement方法的具體用法?Java Document.createElement怎麽用?Java Document.createElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.w3c.dom.Document的用法示例。


在下文中一共展示了Document.createElement方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getXML

import org.w3c.dom.Document; //導入方法依賴的package包/類
@Override
public Element getXML(String key, String value, boolean hideDefault, Document doc) {
	Element element = doc.createElement("list");
	element.setAttribute("key", key);
	List<String[]> list = null;
	if (value != null) {
		list = transformString2List(value);
	} else {
		list = getDefaultValue();
	}
	if (list != null) {
		for (Object object : list) {
			Object[] entry = (Object[]) object;
			element.appendChild(valueType.getXML((String) entry[0], entry[1].toString(), false, doc));
		}
	}
	return element;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:19,代碼來源:ParameterTypeList.java

示例2: getServiceResult

import org.w3c.dom.Document; //導入方法依賴的package包/類
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
	Element rootElement = document.getDocumentElement();
	Element objectElement;
	Text objectText;

	objectElement = document.createElement("threads");
	rootElement.appendChild(objectElement);
	objectText = document.createTextNode("" + com.twinsoft.convertigo.beans.core.RequestableObject.nbCurrentWorkerThreads);
	objectElement.appendChild(objectText);

	objectElement = document.createElement("contexts");
	rootElement.appendChild(objectElement);
	try {
		objectText = document.createTextNode(Engine.isStarted ? "" + Engine.theApp.contextManager.getNumberOfContexts() : "0");
	} catch (Exception e) {
		objectText = document.createTextNode("0");
	}
	objectElement.appendChild(objectText);

	objectElement = document.createElement("requests");
	rootElement.appendChild(objectElement);
	long i = EngineStatistics.getAverage(EngineStatistics.REQUEST);
	if (i == -1) i = 0;
	objectText = document.createTextNode("" + i);
	objectElement.appendChild(objectText);
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:27,代碼來源:Monitor.java

示例3: toXml

import org.w3c.dom.Document; //導入方法依賴的package包/類
@Override
public Element toXml(Document document) throws EngineException {
	Element element = super.toXml(document);

	// Storing the transaction WSDL type
	try {
		Element wsdlTypeElement = document.createElement("wsdltype");
		if (wsdlType != null) {
			CDATASection cDATASection = document.createCDATASection(wsdlType);
			wsdlTypeElement.appendChild(cDATASection);
			element.appendChild(wsdlTypeElement);
		}
	} catch (NullPointerException e) {
		// Silently ignore
	}

	return element;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:19,代碼來源:TransactionStep.java

示例4: writeMergedItems

import org.w3c.dom.Document; //導入方法依賴的package包/類
@Override
protected void writeMergedItems(Document document, Node rootNode) {
    Node mergedItemsNode = document.createElement(NODE_MERGED_ITEMS);
    rootNode.appendChild(mergedItemsNode);

    for (String qualifier : mMergedItems.keySet()) {
        Map<String, ResourceItem> itemMap = mMergedItems.get(qualifier);

        Node qualifierNode = document.createElement(NODE_CONFIGURATION);
        NodeUtils.addAttribute(document, qualifierNode, null, ATTR_QUALIFIER,
                qualifier);

        mergedItemsNode.appendChild(qualifierNode);

        for (ResourceItem item : itemMap.values()) {
            Node adoptedNode = item.getAdoptedNode(document);
            if (adoptedNode != null) {
                qualifierNode.appendChild(adoptedNode);
            }
        }
    }
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:23,代碼來源:ResourceMerger.java

示例5: storeIniSettings

import org.w3c.dom.Document; //導入方法依賴的package包/類
public static void storeIniSettings( String iniFile, String iniSettingName,String iniSettingValue){
	Document doc= getXmlDocument((new File (iniFile)).getAbsolutePath() );	
	Node lastDir = getElementByTagName(doc,iniSettingName );
	if (lastDir==null ){//neues ini setting tag kreieren
		Element neuesElement = doc.createElement(iniSettingName);
		neuesElement.appendChild(doc.createTextNode(iniSettingValue));
		getElementByTagName(doc,"ROOT" ).appendChild(neuesElement);
	}
	else 
		if (lastDir.hasChildNodes()){//altes ini setting �berschreiben
			lastDir.getFirstChild().setTextContent(iniSettingValue); 
		}
	if (lastDir!= null && !lastDir.hasChildNodes()){//ini setting im leeren tag schreiben 
		lastDir.appendChild(doc.createTextNode(iniSettingValue)); 
	}
	storeXmlDocToFile(iniFile, doc);	
}
 
開發者ID:RaduMarcel,項目名稱:EspressoViews,代碼行數:18,代碼來源:QueryDefinitionParser.java

示例6: duplicateNode

import org.w3c.dom.Document; //導入方法依賴的package包/類
static Node duplicateNode(Document document, Node node) {
    Node newNode;
    if (node.getNamespaceURI() != null) {
        newNode = document.createElementNS(node.getNamespaceURI(), node.getLocalName());
    } else {
        newNode = document.createElement(node.getNodeName());
    }

    // copy the attributes
    NamedNodeMap attributes = node.getAttributes();
    for (int i = 0 ; i < attributes.getLength(); i++) {
        Attr attr = (Attr) attributes.item(i);

        Attr newAttr;
        if (attr.getNamespaceURI() != null) {
            newAttr = document.createAttributeNS(attr.getNamespaceURI(), attr.getLocalName());
            newNode.getAttributes().setNamedItemNS(newAttr);
        } else {
            newAttr = document.createAttribute(attr.getName());
            newNode.getAttributes().setNamedItem(newAttr);
        }

        newAttr.setValue(attr.getValue());
    }

    // then duplicate the sub-nodes.
    NodeList children = node.getChildNodes();
    for (int i = 0 ; i < children.getLength() ; i++) {
        Node child = children.item(i);
        if (child.getNodeType() != Node.ELEMENT_NODE) {
            continue;
        }
        Node duplicatedChild = duplicateNode(document, child);
        newNode.appendChild(duplicatedChild);
    }

    return newNode;
}
 
開發者ID:tranleduy2000,項目名稱:javaide,代碼行數:39,代碼來源:NodeUtils.java

示例7: getServiceResult

import org.w3c.dom.Document; //導入方法依賴的package包/類
protected void getServiceResult(HttpServletRequest request, Document document) throws Exception {
	Element root = document.getDocumentElement();
	Element response = document.createElement("response");

	try {
		Engine.theApp.databaseObjectsManager.symbolsDeleteAll();
		response.setAttribute("state", "success");
		response.setAttribute("message","All global symbols have been successfully deleted!");
	} catch (Exception e) {
		Engine.logAdmin.error("Error during deleting the global symbols!\n" + e.getMessage());
		
		response.setAttribute("state", "error");
		response.setAttribute("message","Error during deleting the global symbols!\n" + e.getMessage());
	}
	root.appendChild(response);		
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:17,代碼來源:DeleteAll.java

示例8: createNewDocument

import org.w3c.dom.Document; //導入方法依賴的package包/類
private static Document createNewDocument(Metadata metadata)
{
    Document document = DOCUMENT_BUILDER.value().newDocument();
    Element html = document.createElement("html");
    document.appendChild(html);

    Element head = document.createElement("head");
    html.appendChild(head);

    Element script = document.createElement("script");
    script.appendChild(document.createTextNode(getVisibilityFunction()));
    head.appendChild(script);

    Element style = document.createElement("style");
    style.setAttribute("type", "text/css");
    style.appendChild(document.createTextNode(getCSSDefinitions()));
    head.appendChild(style);

    Element meta = document.createElement("meta");
    meta.setAttribute("http-equiv", "Content-type");
    meta.setAttribute("content", "text/html;charset=UTF-8");
    head.appendChild(meta);

    head.appendChild(ResultCell.createNodeWithText(document, "title", "Test Results"));

    Element body = document.createElement("body");
    html.appendChild(body);

    Element div = document.createElement("div");
    div.setAttribute("class", "metadata");
    if (metadata != null)
    {
        div.appendChild(ResultCell.createNodeWithText(document, "i", metadata.toString()));
    }
    body.appendChild(div);

    return document;
}
 
開發者ID:goldmansachs,項目名稱:tablasco,代碼行數:39,代碼來源:HtmlFormatter.java

示例9: createOval

import org.w3c.dom.Document; //導入方法依賴的package包/類
public static Element createOval(Document doc, Oval oval) {
	double x = oval.getX();
	double y = oval.getY();
	double width = oval.getWidth();
	double height = oval.getHeight();
	Element elt = doc.createElement("ellipse");
	elt.setAttribute("cx", "" + (x + width / 2));
	elt.setAttribute("cy", "" + (y + height / 2));
	elt.setAttribute("rx", "" + (width / 2));
	elt.setAttribute("ry", "" + (height / 2));
	populateFill(elt, oval);
	return elt;
}
 
開發者ID:LogisimIt,項目名稱:Logisim,代碼行數:14,代碼來源:SvgCreator.java

示例10: storeToXML

import org.w3c.dom.Document; //導入方法依賴的package包/類
@Override
public Node storeToXML(Document doc) {
    Object value = getValue();
    org.w3c.dom.Element el = null;
    if (value instanceof FormTableHeader) {
        FormTableHeader header = (FormTableHeader)value;
        el = doc.createElement(XML_TABLE_HEADER);
        el.setAttribute(ATTR_RESIZING, Boolean.toString(header.isResizingAllowed()));
        el.setAttribute(ATTR_REORDERING, Boolean.toString(header.isReorderingAllowed()));
    }
    return el;
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:JTableHeaderEditor.java

示例11: addInterfaceNode

import org.w3c.dom.Document; //導入方法依賴的package包/類
private static void addInterfaceNode(Document doc, ClassNode node, Element parent, Graph pGraph, boolean isChild){
    Element umlClass = doc.createElement("UML:Interface");
    if(isChild){
        umlClass.setAttribute("namespace", ((Element)parent.getParentNode()).getAttribute("xmi.id"));
    } else {
        umlClass.setAttribute("namespace", pGraph.getId());
    }
    umlClass.setAttribute("name", node.getTitle());
    umlClass.setAttribute("xmi.id", node.getId());
    Element classifierFeature = doc.createElement("UML:Classifier.feature");
    umlClass.appendChild(classifierFeature);

    int attIdCount = 0;
    int opIdCount = 0;
    if(node.getAttributes() != null){
        String attributes[] = node.getAttributes().split("\\r?\\n");
        for(String att : attributes){
            Element attribute = doc.createElement("UML:Attribute");
            attribute.setAttribute("name", att);
            attribute.setAttribute("xmi.id", "att" + ++attIdCount + "_" + node.getId());
            classifierFeature.appendChild(attribute);
        }
    }
    if(node.getOperations() != null){
        String operations[] = node.getOperations().split("\\r?\\n");
        for(String op : operations) {
            Element operation = doc.createElement("UML:Operation");
            operation.setAttribute("name", op);
            operation.setAttribute("xmi.id", "oper" + ++opIdCount + "_" + node.getId());
            classifierFeature.appendChild(operation);
        }
    }
    parent.appendChild(umlClass);
}
 
開發者ID:kaanburaksener,項目名稱:octoBubbles,代碼行數:35,代碼來源:PersistenceManager.java

示例12: writeToXML

import org.w3c.dom.Document; //導入方法依賴的package包/類
public static Element writeToXML(Document document, PlotterConfigurationModel model) {
	Element parameters = document.createElement("plottersettings");
	parameters.setAttribute("plotter", model.getPlotter().getPlotterName());
	for (String key : model.settings.getParameterSettings().keySet()) {
		Element parameter = document.createElement("setting");
		parameter.setAttribute("key", key);
		parameter.setAttribute("value", model.settings.getParameterSettings().get(key).toString());
		parameters.appendChild(parameter);
	}
	return parameters;
}
 
開發者ID:transwarpio,項目名稱:rapidminer,代碼行數:12,代碼來源:PlotterConfigurationModel.java

示例13: ExportCustom

import org.w3c.dom.Document; //導入方法依賴的package包/類
@Override
protected Element ExportCustom(Document root)
{
	Element eAdd = root.createElement("Put") ;
	if (m_PutFile != null)
	{
		Element e = root.createElement("File") ;
		m_PutFile.ExportTo(e, root) ;
		eAdd.appendChild(e) ;
	}
	return eAdd ;
}
 
開發者ID:costea7,項目名稱:ChronoBike,代碼行數:13,代碼來源:CFPacPut.java

示例14: writeXml

import org.w3c.dom.Document; //導入方法依賴的package包/類
public Node writeXml(Document document) throws Exception {
    Element element = document.createElement(getClass().getName());
    
    for(E object : this){
    	Node objectNode = XMLUtils.writeObjectToXml(document, object);
    	element.appendChild(objectNode);
    }
    
    return element;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:11,代碼來源:XMLVector.java

示例15: createElementActionBaseAttr

import org.w3c.dom.Document; //導入方法依賴的package包/類
private Element createElementActionBaseAttr(Document document, String id, String label, String className, boolean isEnabled, String menubarPath) {
	Element newAction = document.createElement("action");
	newAction.setAttribute("id", id);
	newAction.setAttribute("label", label);

	// Action class
	newAction.setAttribute("class", className);
	newAction.setAttribute("icon", computeIconNameCSS(id));
	newAction.setAttribute("isEnabled", Boolean.toString(isEnabled));

	// menubarPath = category
	newAction.setAttribute("menubarPath", menubarPath);

	return newAction;
}
 
開發者ID:convertigo,項目名稱:convertigo-engine,代碼行數:16,代碼來源:Get.java


注:本文中的org.w3c.dom.Document.createElement方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。