当前位置: 首页>>代码示例>>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;未经允许,请勿转载。