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


Java Element類代碼示例

本文整理匯總了Java中org.dom4j.Element的典型用法代碼示例。如果您正苦於以下問題:Java Element類的具體用法?Java Element怎麽用?Java Element使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


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

示例1: getMultiBoxLabel

import org.dom4j.Element; //導入依賴的package包/類
/**
 *  Create label for a mulitBoxLabel element that will collapse the mulitBox
 *  input.<P>
 *
 *  Based on getComplexTypeLabel, but will always display collapse widget,
 *  rather than first testing for nodeIsExpandable as getComplexTypeLabel does.
 *  <P>
 *
 *  Depends on the multibox input having an id and display style initialized to
 *  value of collapseBean.displayState.
 *
 * @param  xpath  NOT YET DOCUMENTED
 * @return        The multiBoxLabel value
 */
public Label getMultiBoxLabel(String xpath) {
	ComplexTypeLabel labelObj = getComplexTypeLabel(xpath);
	Element alwaysExpandable = df.createElement("c__if")
		.addAttribute("test", "${true}");
	Element labelLink = alwaysExpandable.addElement("a")
		.addAttribute("href", "javascript__toggleDisplayState(" + RendererHelper.jspQuotedString("${id}") + ");");

	Element notExpandableTest = df.createElement("c__if")
		.addAttribute("test", "${false}");

	labelObj.isExpandableTest = alwaysExpandable.createCopy();
	labelObj.notExpandableTest = notExpandableTest.createCopy();
	labelObj.collapseWidget = getCollapseWidget().createCopy();
	return labelObj;
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:30,代碼來源:EditorRenderer.java

示例2: getRequiredMultiSelectControl

import org.dom4j.Element; //導入依賴的package包/類
/**
 *  Create "choose" controller for the case where an empty requiredMultiSelect
 *  node is closed. Called from renderComplexTypeConcrete, this controller
 *  provides a prompt for user when the required multiselect boxes are empty
 *  and not visible
 *
 * @return    The requiredMultiSelectControl value
 */
public Element getRequiredMultiSelectControl() {

	Element actionElement = df.createElement("span")
		.addAttribute("class", "action-button");

	// test to see if child node (the multiSelect) is empty
	Element isEmptyTest = actionElement.addElement("logic__equal")
		.addAttribute("name", formBeanName)
		.addAttribute("property", "nodeIsEmpty(" + xpath + ")")
		.addAttribute("value", "true");

	// test to see if the node is closed
	Element isOpenTest = isEmptyTest.addElement("c__if")
		.addAttribute("test", "${not " + formBeanName + ".collapseBean.isOpen}");

	//  "choose" controller link that toogles DisplayState of node
	Element chooseController = isOpenTest.addElement("a")
		.addAttribute("href", "javascript__toggleDisplayState(" + RendererHelper.jspQuotedString("${id}") + ")");
	chooseController.setText("choose");

	return actionElement;
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:31,代碼來源:MdeComplexType.java

示例3: readXML

import org.dom4j.Element; //導入依賴的package包/類
/**
 * 摸查項目輸出目錄
 * <p>
 * @param projectPath
 * @param kind        output 或 src
 * @return
 */
public static String readXML(String projectPath, String kind) {
    try {
        SAXReader saxReader = new SAXReader();
        File classpath = new File(projectPath + "/.classpath");
        if (classpath.exists()) {
            Document document = saxReader.read(classpath);
            List<Element> out = (List<Element>) document.selectNodes("/classpath/classpathentry[@kind='" + kind + "']");
            String tmp = "";
            for (Element out1 : out) {
                String combineaccessrules = out1.attributeValue("combineaccessrules");
                if ("false".equals(combineaccessrules) && "src".equals(kind)) {
                    continue;
                }
                tmp += out1.attributeValue("path") + ",";
            }
            return tmp.isEmpty() ? tmp : tmp.substring(0, tmp.length() - 1);
        }
    } catch (DocumentException ex) {
        MainFrame.LOGGER.log(Level.SEVERE, null, ex);
        JOptionPane.showMessageDialog(null, ex.getLocalizedMessage());
    }
    return "";
}
 
開發者ID:ajtdnyy,項目名稱:PackagePlugin,代碼行數:31,代碼來源:FileUtil.java

示例4: buildValidatorElement

import org.dom4j.Element; //導入依賴的package包/類
private Element buildValidatorElement(Validator validator){
	BaseElement element=new BaseElement("Validator");
	int pos=validator.getName().lastIndexOf("Validator");
	String validatorType=validator.getName().substring(0,pos);
	validatorType=validatorType.substring(0,1).toLowerCase()+validatorType.substring(1,validatorType.length());
	element.addAttribute("type",validatorType);
	if(validator.getProperties()!=null){
		for(ValidatorProperty vp:validator.getProperties()){
			if(StringHelper.isNotEmpty(vp.getName()) && StringHelper.isNotEmpty(vp.getValue())){
				Element propertyElement=createPropertyElement(vp.getName(),vp.getValue());
				element.add(propertyElement);					
			}
		}
	}
	return element;
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:17,代碼來源:ModelBuilder.java

示例5: getNamedStoredProcedureQueries

import org.dom4j.Element; //導入依賴的package包/類
private NamedStoredProcedureQueries getNamedStoredProcedureQueries(Element tree, XMLContext.Default defaults) {
	List<NamedStoredProcedureQuery> queries = buildNamedStoreProcedureQueries( tree, defaults );
	if ( defaults.canUseJavaAnnotations() ) {
		NamedStoredProcedureQuery annotation = getPhysicalAnnotation( NamedStoredProcedureQuery.class );
		addNamedStoredProcedureQueryIfNeeded( annotation, queries );
		NamedStoredProcedureQueries annotations = getPhysicalAnnotation( NamedStoredProcedureQueries.class );
		if ( annotations != null ) {
			for ( NamedStoredProcedureQuery current : annotations.value() ) {
				addNamedStoredProcedureQueryIfNeeded( current, queries );
			}
		}
	}
	if ( queries.size() > 0 ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( NamedStoredProcedureQueries.class );
		ad.setValue( "value", queries.toArray( new NamedStoredProcedureQuery[queries.size()] ) );
		return AnnotationFactory.create( ad );
	}
	else {
		return null;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:22,代碼來源:JPAOverriddenAnnotationReader.java

示例6: insertHtmlComment

import org.dom4j.Element; //導入依賴的package包/類
/**
 *  Insert an HTML comment into the html source.
 *
 * @param  e  NOT YET DOCUMENTED
 * @param  s  NOT YET DOCUMENTED
 */
protected void insertHtmlComment(Element e, String s) {
	prtln("\ninsertHtmlComment()");
	Element comment = df.createElement("st__htmlComment");
	comment.setText(s);
	Element parent = e.getParent();

	if (parent != null) {
		List children = parent.elements();
		int index = children.indexOf(e);
		children.add(index, comment);
	}
	else {
		// prtlnErr("PARENT NOT FOUND");
	}
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:22,代碼來源:MdeNode.java

示例7: fillDataSetAndDataPathProperty

import org.dom4j.Element; //導入依賴的package包/類
protected void fillDataSetAndDataPathProperty(Element element,ComponentInfo component,boolean isCollection){
	String[] dataSetDataPath=this.retriveDataSetAndDataPath(component);
	if(dataSetDataPath!=null){
		if(StringHelper.isNotEmpty(dataSetDataPath[0])){
			BaseElement dataSetElement=new BaseElement("Property");	
			dataSetElement.addAttribute("name", "dataSet");
			dataSetElement.setText(dataSetDataPath[0]);
			element.add(dataSetElement);
		}
		if(StringHelper.isNotEmpty(dataSetDataPath[1]) && !hasDataPath(component)){
			BaseElement dataPathElement=new BaseElement("Property");
			dataPathElement.addAttribute("name", "dataPath");
			String dataPath=dataSetDataPath[1];
			if(!isCollection){
				int pos=dataPath.lastIndexOf(".");
				if(pos>0){
					dataPath=dataPath.substring(0,pos)+".#"+dataPath.substring(pos+1,dataPath.length());
				}					
			}
			
			dataPathElement.setText(dataPath);
			element.add(dataPathElement);
		}
	}
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:26,代碼來源:AbstractConverter.java

示例8: createReferencePropertyDef

import org.dom4j.Element; //導入依賴的package包/類
private Element createReferencePropertyDef(Entity entity,RuleSet ruleSet,boolean isSelf){
	String nodeName=Reference.class.getSimpleName();
	Rule rule=ruleSet.getRule(nodeName);
	Element referenceDefElement=new BaseElement(rule.getNodeName());
	referenceDefElement.addAttribute("name", entity.getName());
	//創建dataType與dataProvider屬性
	Element dataTypeElement=createPropertyElement("dataType",null);
	if(isSelf){
		dataTypeElement.setText("[SELF]");			
	}else{
		dataTypeElement.setText("["+ entity.getName()+"]");						
	}
	referenceDefElement.add(dataTypeElement);
	String entityName=entity.getName();
	Element dataProviderElement=createPropertyElement("dataProvider","dataProvider"+entityName.substring(0,1).toUpperCase()+entityName.substring(1,entityName.length()));
	if(entity.getPageSize()>0){
		Element pageSizeElement=createPropertyElement("pageSize",String.valueOf(entity.getPageSize()));
		referenceDefElement.add(pageSizeElement);
	}
	referenceDefElement.add(dataProviderElement);
	referenceDefElement.add(createReferenceParameterElement(entity));
	return referenceDefElement;
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:24,代碼來源:ModelBuilder.java

示例9: parseFilterDef

import org.dom4j.Element; //導入依賴的package包/類
private static void parseFilterDef(Element element, Mappings mappings) {
	String name = element.attributeValue( "name" );
	LOG.debugf( "Parsing filter-def [%s]", name );
	String defaultCondition = element.getTextTrim();
	if ( StringHelper.isEmpty( defaultCondition ) ) {
		defaultCondition = element.attributeValue( "condition" );
	}
	HashMap paramMappings = new HashMap();
	Iterator params = element.elementIterator( "filter-param" );
	while ( params.hasNext() ) {
		final Element param = (Element) params.next();
		final String paramName = param.attributeValue( "name" );
		final String paramType = param.attributeValue( "type" );
		LOG.debugf( "Adding filter parameter : %s -> %s", paramName, paramType );
		final Type heuristicType = mappings.getTypeResolver().heuristicType( paramType );
		LOG.debugf( "Parameter heuristic type : %s", heuristicType );
		paramMappings.put( paramName, heuristicType );
	}
	LOG.debugf( "Parsed filter-def [%s]", name );
	FilterDefinition def = new FilterDefinition( name, defaultCondition, paramMappings );
	mappings.addFilterDefinition( def );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:23,代碼來源:HbmBinder.java

示例10: parse

import org.dom4j.Element; //導入依賴的package包/類
public Object parse(Element element, long processId, boolean parseChildren) {
	ForeachNode node=new ForeachNode();
	node.setProcessId(processId);
	parseNodeCommonInfo(element, node);
	node.setSequenceFlows(parseFlowElement(element,processId,parseChildren));
	String type=element.attributeValue("foreach-type");
	if(StringUtils.isNotEmpty(type)){
		node.setForeachType(ForeachType.valueOf(type));			
	}
	node.setVariable(unescape(element.attributeValue("var")));
	if(StringUtils.isNotBlank(element.attributeValue("process-variable"))){
		node.setProcessVariable(unescape(element.attributeValue("process-variable")));			
	}else{
		node.setProcessVariable(unescape(element.attributeValue("in")));						
	}
	node.setHandlerBean(unescape(element.attributeValue("handler-bean")));
	NodeDiagram diagram=parseDiagram(element);
	diagram.setIcon("/icons/foreach.svg");
	diagram.setShapeType(ShapeType.Circle);
	diagram.setBorderWidth(1);
	node.setDiagram(diagram);
	return node;
}
 
開發者ID:youseries,項目名稱:uflo,代碼行數:24,代碼來源:ForeachParser.java

示例11: elementValue

import org.dom4j.Element; //導入依賴的package包/類
/**
 * 獲取節點值
 * @param root
 * @param clazz
 * @param name
 * @return
 */
@SuppressWarnings("unchecked")
protected Optional<Object> elementValue(Element root, Class<?> clazz, String name) {
    Optional<String> elementTextOptional = elementText(root, name);
    if (elementTextOptional.isPresent()) {
        if (clazz == Integer.class) {
            return Optional.of(new Integer(elementTextOptional.get()));
        } else if (clazz == Long.class) {
            return Optional.of(new Long(elementTextOptional.get()));
        } else if (Enum.class.isAssignableFrom(clazz)) {
            try {
                Class enumClass = Class.forName(clazz.getName());
                return Optional.of(Enum.valueOf(enumClass, elementTextOptional.get()));
            } catch (ClassNotFoundException e) {
                e.printStackTrace();
                return Optional.empty();
            }
        } else {
            return Optional.of(elementTextOptional.get());
        }
    } else {
        return Optional.empty();
    }
}
 
開發者ID:minlia-projects,項目名稱:minlia-iot,代碼行數:31,代碼來源:AbstractApiComponent.java

示例12: getAcceptableMembers

import org.dom4j.Element; //導入依賴的package包/類
/**
 * Returns the members that could be added to the specified instanceElement
 * according to schema constraints.
 */
public List getAcceptableMembers (Element instanceElement) { 
	prtln ("\ngetAcceptableMembers with instanceElement:");
	prtln (instanceElement.asXML());
	ChoiceGuard guard;
	try {
		guard = new ChoiceGuard (this, instanceElement);
	} catch (Exception e) {
		prtln ("ChoiceGard init error: " + e.getMessage());
		return new ArrayList();
	}
	prtln ("about to call ChoiceGuard getAcceptableMembers()");
	List members = guard.getAcceptableMembers();
	prtln ("acceptable members:");
	printMemberList (members);
	return members;
}
 
開發者ID:NCAR,項目名稱:joai-project,代碼行數:21,代碼來源:Choice.java

示例13: toJpdl

import org.dom4j.Element; //導入依賴的package包/類
public JpdlInfo toJpdl(Element element) {
	BaseElement targetElement=new BaseElement("decision");
	String name=this.buildCommonJpdlElement(element, targetElement);
	String decisionType=element.attributeValue("decisionType");
	String decisionValue=element.attributeValue("decisionValue");
	if(decisionType.equals("handler")){
		BaseElement handlerElement=new BaseElement("handler");
		handlerElement.addAttribute("class", decisionValue);
		targetElement.add(handlerElement);
	}else{
		targetElement.addAttribute("expr",decisionValue);
	}
	JpdlInfo info=new JpdlInfo();
	info.setName(name);
	info.setElement(targetElement);
	return info;
}
 
開發者ID:bsteker,項目名稱:bdf2,代碼行數:18,代碼來源:DecisionConverter.java

示例14: parse

import org.dom4j.Element; //導入依賴的package包/類
public Object parse(Element element,long processId,boolean parseChildren) {
	EndNode node=new EndNode();
	node.setProcessId(processId);
	parseNodeCommonInfo(element, node);
	String terminate=element.attributeValue("terminate");
	if(StringUtils.isNotEmpty(terminate)){
		node.setTerminate(Boolean.valueOf(terminate));
	}
	NodeDiagram diagram=parseDiagram(element);
	if(node.isTerminate()){
		diagram.setIcon("/icons/end-terminate.svg");
	}else{
		diagram.setIcon("/icons/end.svg");
	}
	diagram.setShapeType(ShapeType.Circle);
	diagram.setBorderWidth(1);
	node.setDiagram(diagram);
	return node;
}
 
開發者ID:youseries,項目名稱:uflo,代碼行數:20,代碼來源:EndParser.java

示例15: toMap

import org.dom4j.Element; //導入依賴的package包/類
@Override
public Map toMap(Document document) {
  Map<String, String> m = new HashMap<String, String>();
  /**
   * <contentList> <content contentuid=
   * "h00007224gb454g4b8bgb762g7865d9ee3dbb">如果不是這樣的話!哈,開玩笑啦,我們在一起很合適,就像麵包上的果醬。你想和我組隊嗎?我敢說你們需要一點野獸風味!</content>
   * <content contentuid="h0001d8b9g13d6g4605g85e9g708fe1e537c8">定製</content> </contentList>
   */
  // 獲取根節點元素對象
  Element root = document.getRootElement();
  // 子節點
  List<Element> list = root.elements();
  // 使用遞歸
  Iterator<Element> iterator = list.iterator();
  while (iterator.hasNext()) {
    Element e = iterator.next();
    Attribute attribute = e.attribute("contentuid");
    m.put(attribute.getValue(), e.getText());
  }
  return m;
}
 
開發者ID:SvenAugustus,項目名稱:Divinity_Original_Sin_2_zhCN,代碼行數:22,代碼來源:DOS2ToMap.java


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