当前位置: 首页>>代码示例>>Java>>正文


Java Element.setAttribute方法代码示例

本文整理汇总了Java中org.w3c.dom.Element.setAttribute方法的典型用法代码示例。如果您正苦于以下问题:Java Element.setAttribute方法的具体用法?Java Element.setAttribute怎么用?Java Element.setAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.w3c.dom.Element的用法示例。


在下文中一共展示了Element.setAttribute方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ExportCustom

import org.w3c.dom.Element; //导入方法依赖的package包/类
public Element ExportCustom(Document root)
{
	Element eSelect = null;
	Element eReturned = null;
	if(m_bCursor)
	{
		Element eCursor = root.createElement("SQLCursor") ;
		eReturned = eCursor; 
		eCursor.setAttribute("Name", m_csCursorName);
		
		eSelect = root.createElement("SQLSelect") ;
		eCursor.appendChild(eSelect);
	}
	else
	{
		eSelect = root.createElement("SQLSelect") ;
		eReturned = eSelect;
	}
	eSelect.setAttribute("Clause", m_Clause) ;
	//ExportParameters(root, eSelect);
	//ExportInto(root, eSelect);

	return eReturned;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:25,代码来源:CExecSQLSelect.java

示例2: createAppCleanup

import org.w3c.dom.Element; //导入方法依赖的package包/类
private void createAppCleanup ( final Element product )
{
    final Element ca = createElement ( product, "CustomAction" ); //$NON-NLS-1$
    ca.setAttribute ( "Id", "CleanupApps" ); //$NON-NLS-1$ //$NON-NLS-2$
    ca.setAttribute ( "Directory", "INSTALLDIR" ); //$NON-NLS-1$ //$NON-NLS-2$
    ca.setAttribute ( "Execute", "deferred" ); //$NON-NLS-1$ //$NON-NLS-2$
    ca.setAttribute ( "Return", "ignore" ); //$NON-NLS-1$ //$NON-NLS-2$
    ca.setAttribute ( "HideTarget", "no" ); //$NON-NLS-1$ //$NON-NLS-2$
    ca.setAttribute ( "Impersonate", "no" ); //$NON-NLS-1$ //$NON-NLS-2$
    ca.setAttribute ( "ExeCommand", "cmd /C \"rmdir /Q /S apps\"" ); //$NON-NLS-1$ //$NON-NLS-2$

    final Element ies = createElement ( product, "InstallExecuteSequence" ); //$NON-NLS-1$
    final Element c = createElement ( ies, "Custom" ); //$NON-NLS-1$
    c.setAttribute ( "Action", "CleanupApps" ); //$NON-NLS-1$ //$NON-NLS-2$
    c.setAttribute ( "After", "RemoveFiles" ); //$NON-NLS-1$ //$NON-NLS-2$
    c.appendChild ( product.getOwnerDocument ().createTextNode ( "REMOVE=\"ALL\"" ) ); //$NON-NLS-1$
}
 
开发者ID:eclipse,项目名称:neoscada,代码行数:18,代码来源:WixDeploymentSetupBuilder.java

示例3: generateDoc

import org.w3c.dom.Element; //导入方法依赖的package包/类
Document generateDoc() {
	Document result = XMLUtils.docBuilder.newDocument();
	
	Element root = XMLUtils.createRootElement(result, "alvisnlp-doc");
	root.setAttribute("target", fullName);
	root.setAttribute("author", "");
	root.setAttribute("date", "");

	Element synopsis = XMLUtils.createElement(result, root, 1, "synopsis");
	XMLUtils.createElement(result, synopsis, 2, "p", "synopsis");

	Element converter = XMLUtils.createElement(result, root, 1, "converter-doc");
	Element stringConversion = XMLUtils.createElement(result, converter, 2, "string-conversion");
	XMLUtils.createElement(result, stringConversion, 3, "p", "string conversion");
	Element xmlConversion = XMLUtils.createElement(result, converter, 2, "xml-conversion");
	XMLUtils.createElement(result, xmlConversion, 3, "p", "XML conversion");

	return result;
}
 
开发者ID:Bibliome,项目名称:alvisnlp,代码行数:20,代码来源:ConverterModel.java

示例4: xmlUpdateDemo

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static void xmlUpdateDemo() {
  	String s = PaseXml.class.getResource("/").toString();
  	s = s.substring(0,s.indexOf("WEB-INF/"));
  	s = s.substring(s.indexOf("D:/"));
  	s = s+"xml/images.xml";
      Document document = load(s);
      try {
      	NodeList list=document.getElementsByTagName("menu");
      	for(int i=0;i<list.getLength();i++){
      	Element brandElement=(Element) list.item(i);
      		brandElement.setAttribute("a", "00");
      	}
      }catch (Exception e) {
}
      doc2XmlFile(document, s);
  }
 
开发者ID:yulele166,项目名称:pub-service,代码行数:17,代码来源:PaseXml.java

示例5: appendRoles

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * Appends the role nodes to the technical product node including its
 * localized values.
 * 
 * @param xmldoc
 *            the dom document used to create elements
 * @param parent
 *            the parent node
 * @param localizer
 *            the localizer
 * @param technicalProduct
 *            the technical product
 */
void appendRoles(Document xmldoc, Element parent,
        LocalizerServiceLocal localizer, TechnicalProduct technicalProduct) {
    List<RoleDefinition> roleDefs = technicalProduct.getRoleDefinitions();
    for (RoleDefinition role : roleDefs) {
        Element defNode = xmldoc.createElement("Role");
        defNode.setAttribute("id", role.getRoleId());
        parent.appendChild(defNode);
        appendLocalizedValues(xmldoc, localizer, defNode,
                LocalizedObjectTypes.ROLE_DEF_NAME, role.getKey(),
                "LocalizedName");
        appendLocalizedValues(xmldoc, localizer, defNode,
                LocalizedObjectTypes.ROLE_DEF_DESC, role.getKey(),
                "LocalizedDescription");
    }
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:29,代码来源:TechnicalProductXmlConverter.java

示例6: AddField

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * @param eRoot
 * @param ref
 * @param val
 */
private void AddField(Document eRoot, String ref, String val, boolean bUpdated)
{
	Element field = eRoot.createElement("field") ;
	eRoot.getDocumentElement().appendChild(field) ;
	field.setAttribute("name", ref) ;
	field.setAttribute("value", val) ;
	if (bUpdated)
	{
		field.setAttribute("updated", "true") ;
	}
	else
	{
		field.setAttribute("updated", "false") ;
	}
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:21,代码来源:InputAnalyser.java

示例7: testRunStarted

import org.w3c.dom.Element; //导入方法依赖的package包/类
@Override
public void testRunStarted(Description description) throws Exception {
	if (working) {
		suiteStartTime.set(System.currentTimeMillis());

		Element testsuite = xml.createElement("testsuite");

		if (description.getChildren().size() == 1) {
			testsuite.setAttribute("name", safeString(description.getChildren().get(0).getDisplayName()));
		}

		xml.appendChild(testsuite);
		this.testsuite.set(testsuite);
		writeXml();
	}
}
 
开发者ID:xtf-cz,项目名称:xtf,代码行数:17,代码来源:IntermediateReporter.java

示例8: exportProcess

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
 * This method will create a document, append the complete process that contains the given
 * operator. The {@link Document} is then returned.
 */
public Document exportProcess(Operator operator, boolean hideDefault) throws IOException {
	try {
		Document doc = DocumentBuilderFactory.newInstance().newDocumentBuilder().newDocument();
		Element rootElement = doc.createElement(ELEMENT_PROCESS);
		doc.appendChild(rootElement);
		rootElement.setAttribute("version", RapidMiner.getLongVersion());

		final Process process = operator.getProcess();
		if (process != null) {
			rootElement.appendChild(exportProcessContext(process.getContext(), doc));
			if (!process.getAnnotations().isEmpty()) {
				rootElement.appendChild(exportAnnotations(process.getAnnotations(), doc));
			}
		}
		rootElement.appendChild(exportOperator(operator, hideDefault, doc));
		return doc;
	} catch (ParserConfigurationException e) {
		throw new IOException("Cannot create XML document builder: " + e, e);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:25,代码来源:XMLExporter.java

示例9: ExportCustom

import org.w3c.dom.Element; //导入方法依赖的package包/类
protected Element ExportCustom(Document root)
{
	Element ePerf = root.createElement("PerformUntil") ;
	if (m_Reference != null)
	{
		ePerf.setAttribute("Reference", m_Reference.GetName()) ;
	}
	if (m_RefThru != null)
	{
		ePerf.setAttribute("Thru", m_RefThru.GetName()) ;
	}
	Element eCond = m_cond.Export(root) ;
	ePerf.appendChild(eCond) ;
	return ePerf ;
}
 
开发者ID:costea7,项目名称:ChronoBike,代码行数:16,代码来源:CPerformUntil.java

示例10: marshallAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
/** {@inheritDoc} */
protected void marshallAttributes(XMLObject xmlObject, Element domElement) throws MarshallingException {
    PolicySetCombinerParametersType policySetCombinerParametersType = (PolicySetCombinerParametersType)xmlObject;
    
    if(!DatatypeHelper.isEmpty(policySetCombinerParametersType.getPolicySetIdRef())){
        domElement.setAttribute(PolicySetCombinerParametersType.POLICY_SET_ID_REF_ATTRIB_NAME,
                policySetCombinerParametersType.getPolicySetIdRef());
    }   
    super.marshallAttributes(xmlObject, domElement);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:PolicySetCombinerParametersTypeMarshaller.java

示例11: addAttributes

import org.w3c.dom.Element; //导入方法依赖的package包/类
public static void addAttributes(Element element, Map<String, Object> map) {
    if (map != null) {
        for (Map.Entry<String, Object> entry : map.entrySet()) {
            Object attrValue = entry.getValue();
            element.setAttribute(entry.getKey(), attrValue == null ? null : attrValue.toString());
        }
    }
}
 
开发者ID:intuit,项目名称:karate,代码行数:9,代码来源:XmlUtils.java

示例12: startElement

import org.w3c.dom.Element; //导入方法依赖的package包/类
public void startElement(String namespace, String localName, String qName, Attributes attrs) {
  final Element tmp = (Element) _document.createElementNS(namespace, qName);

  // Add name space declarations first
  if (_namespaceDecls != null) {
    final int nDecls = _namespaceDecls.size();
    for (int i = 0; i < nDecls; i++) {
      final String prefix = (String) _namespaceDecls.elementAt(i++);

      if (prefix == null || prefix.equals(EMPTYSTRING)) {
        tmp.setAttributeNS(XMLNS_URI, XMLNS_PREFIX, (String) _namespaceDecls.elementAt(i));
      } else {
        tmp.setAttributeNS(XMLNS_URI, XMLNS_STRING + prefix,
            (String) _namespaceDecls.elementAt(i));
      }
    }
    _namespaceDecls.clear();
  }

  // Add attributes to element
  final int nattrs = attrs.getLength();
  for (int i = 0; i < nattrs; i++) {
    if (attrs.getLocalName(i) == null) {
      tmp.setAttribute(attrs.getQName(i), attrs.getValue(i));
    } else {
      tmp.setAttributeNS(attrs.getURI(i), attrs.getQName(i), attrs.getValue(i));
    }
  }

  // Append this new node onto current stack node
  Node last = _nodeStk.peek();
  last.appendChild(tmp);

  // Push this node onto stack
  _nodeStk.push(tmp);
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:37,代码来源:Sax2Dom.java

示例13: extendXMLMap

import org.w3c.dom.Element; //导入方法依赖的package包/类
public Element extendXMLMap(Element elt) {
	
	if (elt != null) {
		NodeList childs = elt.getChildNodes();
		int len = childs.getLength();
		if (len > 0) {
			for (int i=0; i<len; i++) {
				Node children = childs.item(i);
				if (children.getNodeType() == Node.ELEMENT_NODE)
					extendXMLMap((Element)children);
			}
			
		}
		String sOccurs = elt.getAttribute("occurs");
		if ((sOccurs != null) && (!sOccurs.equalsIgnoreCase(""))) {
			String aOccurs[] = sOccurs.split(":");
			int j = Integer.parseInt(aOccurs[0],10);
			if (aOccurs.length>1)
				j = Integer.parseInt(aOccurs[1],10);
			int count = 1;
			elt.setAttribute("occurence",""+count);
			while (count++ < j) {
				Element clone = (Element)elt.cloneNode(true);
				clone.setAttribute("occurence",""+count);
				elt.getParentNode().appendChild(clone);
			}
		}
	}
	
	return elt;	
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:32,代码来源:Copybook.java

示例14: exportEssayQuestion

import org.w3c.dom.Element; //导入方法依赖的package包/类
/**
    * Creates a XML element with contents of a single essay question.
    */
   private Element exportEssayQuestion(Question question) {
Element itemElem = doc.createElement("item");
itemElem.setAttribute("title", question.getTitle());
itemId++;
itemElem.setAttribute("ident", "QUE_" + itemId);

// question text
Element presentationElem = (Element) itemElem.appendChild(doc.createElement("presentation"));
if (!StringUtils.isBlank(question.getText())) {
    Element materialElem = (Element) presentationElem.appendChild(doc.createElement("material"));
    appendMaterialElements(materialElem, question.getText());
}

// just a single response element
itemId++;
Element responseStrElem = (Element) presentationElem.appendChild(doc.createElement("response_str"));
responseStrElem.setAttribute("ident", "QUE_" + itemId + "_RS");
Element renderFibElem = (Element) responseStrElem.appendChild(doc.createElement("render_fib"));
renderFibElem.setAttribute("fibtype", "String");
renderFibElem.setAttribute("prompt", "Box");
renderFibElem.setAttribute("rows", "5");
renderFibElem.setAttribute("columns", "50");
itemId++;
Element responseLabelElem = (Element) renderFibElem.appendChild(doc.createElement("response_label"));
responseLabelElem.setAttribute("ident", "QUE_" + itemId + "_ANS");

// just a single feedback element
if (!StringUtils.isBlank(question.getFeedback())) {
    Element overallFeedbackElem = createFeedbackElem("_ALL", question.getFeedback(), "All");

    Element resprocessingElem = (Element) itemElem.appendChild(doc.createElement("resprocessing"));
    Element respconditionElem = (Element) resprocessingElem.appendChild(doc.createElement("respcondition"));
    Element conditionvarElem = (Element) respconditionElem.appendChild(doc.createElement("conditionvar"));
    conditionvarElem.appendChild(doc.createElement("other"));
    Element displayfeedbackElem = (Element) respconditionElem.appendChild(doc.createElement("displayfeedback"));
    displayfeedbackElem.setAttribute("feedbacktype", "Response");
    displayfeedbackElem.setAttribute("linkrefid", overallFeedbackElem.getAttribute("ident"));

    itemElem.appendChild(overallFeedbackElem);
}

return itemElem;
   }
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:47,代码来源:QuestionExporter.java

示例15: addReferer

import org.w3c.dom.Element; //导入方法依赖的package包/类
public void addReferer(Element parentNode) {
	if (displayReferer) parentNode.setAttribute("referer", referer==null?"":referer);
}
 
开发者ID:convertigo,项目名称:convertigo-engine,代码行数:4,代码来源:AbstractXMLReferer.java


注:本文中的org.w3c.dom.Element.setAttribute方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。