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


Java Element.attribute方法代碼示例

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


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

示例1: bindSimpleValue

import org.dom4j.Element; //導入方法依賴的package包/類
public static void bindSimpleValue(Element node, SimpleValue model, boolean isNullable, String path, Mappings mappings) 
throws MappingException {
	model.setType( getTypeFromXML(node) );

	Attribute formulaNode = node.attribute("formula");
	if (formulaNode!=null) {
		Formula f = new Formula();
		f.setFormula( formulaNode.getText() );
		model.setFormula(f);
	}
	else {
		bindColumns(node, model, isNullable, true, path, mappings);
	}

	Attribute fkNode = node.attribute("foreign-key");
	if (fkNode!=null) model.setForeignKeyName( fkNode.getValue() );
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:18,代碼來源:Binder.java

示例2: addJunctionConnection

import org.dom4j.Element; //導入方法依賴的package包/類
@SuppressWarnings("unchecked")
public boolean addJunctionConnection(final String id, final String fromNode, 
									  final String from_x, final String from_y, 
									  final String toNode, 
									  final String to_x, final String to_y, 
									  final String dir)
{
	String s = "intconnction[@fromNode='"+fromNode+"' and @toNode='"+toNode+"']";
	List<Element> list = junction.selectNodes(s);
	if(list.isEmpty())
	{
		intconnction = junction.addElement("intconnction");
		intconnction.addAttribute("id", id);
		intconnction.addAttribute("numLanes", "1");
		intconnction.addAttribute("fromNode", fromNode);
		intconnction.addAttribute("from_x", from_x);
		intconnction.addAttribute("from_y", from_y);
		intconnction.addAttribute("toNode", toNode);
		intconnction.addAttribute("to_x", to_x);
		intconnction.addAttribute("to_y", to_y);
		intconnction.addAttribute("dir", dir);
		return true;
	}
	else
	{
		Iterator<Element> iter = list.iterator();
		//System.out.println(list.size());
		while (iter.hasNext())
		{
			Element ele = iter.next();
			Attribute attr = ele.attribute("numLanes");
			Integer numLanes = Integer.parseInt(attr.getValue())+1;
			attr.setValue(numLanes.toString());
		}
		//System.out.println("有重複的lane");
		return false;
	}
}
 
開發者ID:ansleliu,項目名稱:GraphicsViewJambi,代碼行數:39,代碼來源:ExportNetworkToXML.java

示例3: bindColumnsOrFormula

import org.dom4j.Element; //導入方法依賴的package包/類
private static void bindColumnsOrFormula(Element node, SimpleValue simpleValue, String path,
		boolean isNullable, Mappings mappings) {
	Attribute formulaNode = node.attribute( "formula" );
	if ( formulaNode != null ) {
		Formula f = new Formula();
		f.setFormula( formulaNode.getText() );
		simpleValue.addFormula( f );
	}
	else {
		bindColumns( node, simpleValue, isNullable, true, path, mappings );
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:HbmBinder.java

示例4: checkAttribute

import org.dom4j.Element; //導入方法依賴的package包/類
public Attribute checkAttribute(Node node, String attrName) throws DocumentException {
	if (!(node instanceof Element))
		throw new CheckMessagesException("Node is not an element", this, node);
	Element element = (Element) node;
	Attribute attr = element.attribute(attrName);
	if (attr == null)
		throw new CheckMessagesException("Missing " + attrName + " attribute", this, node);
	return attr;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:10,代碼來源:CheckMessages.java

示例5: initialise

import org.dom4j.Element; //導入方法依賴的package包/類
public void initialise(Element element, NamespacePrefixResolver nspr, PermissionModel permissionModel)
{
    Attribute authorityAttribute = element.attribute(AUTHORITY);
    if(authorityAttribute != null)
    {
        authority = authorityAttribute.getStringValue();
    }
    Attribute permissionAttribute = element.attribute(PERMISSION);
    if(permissionAttribute != null)
    {
        permissionReference = permissionModel.getPermissionReference(null, permissionAttribute.getStringValue());
    }

}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:15,代碼來源:GlobalPermissionEntry.java

示例6: getTypeFromXML

import org.dom4j.Element; //導入方法依賴的package包/類
private static Type getTypeFromXML(Element node) throws MappingException {
	Type type;
	Attribute typeNode = node.attribute("type");
	if (typeNode==null) typeNode = node.attribute("id-type"); //for an any
	if (typeNode==null) {
		return null; //we will have to use reflection
	}
	else {
		type = TypeFactory.heuristicType( typeNode.getValue() );
		if (type==null) throw new MappingException( "Could not interpret type: " + typeNode.getValue() );
	}
	return type;
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:14,代碼來源:Binder.java

示例7: getInheritance

import org.dom4j.Element; //導入方法依賴的package包/類
private Inheritance getInheritance(Element tree, XMLContext.Default defaults) {
	Element element = tree != null ? tree.element( "inheritance" ) : null;
	if ( element != null ) {
		AnnotationDescriptor ad = new AnnotationDescriptor( Inheritance.class );
		Attribute attr = element.attribute( "strategy" );
		InheritanceType strategy = InheritanceType.SINGLE_TABLE;
		if ( attr != null ) {
			String value = attr.getValue();
			if ( "SINGLE_TABLE".equals( value ) ) {
				strategy = InheritanceType.SINGLE_TABLE;
			}
			else if ( "JOINED".equals( value ) ) {
				strategy = InheritanceType.JOINED;
			}
			else if ( "TABLE_PER_CLASS".equals( value ) ) {
				strategy = InheritanceType.TABLE_PER_CLASS;
			}
			else {
				throw new AnnotationException(
						"Unknown InheritanceType in XML: " + value + " (" + SCHEMA_VALIDATION + ")"
				);
			}
		}
		ad.setValue( "strategy", strategy );
		return AnnotationFactory.create( ad );
	}
	else if ( defaults.canUseJavaAnnotations() ) {
		return getPhysicalAnnotation( Inheritance.class );
	}
	else {
		return null;
	}
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:34,代碼來源:JPAOverriddenAnnotationReader.java

示例8: makeVersion

import org.dom4j.Element; //導入方法依賴的package包/類
private static final void makeVersion(Element node, SimpleValue model) {

		// VERSION UNSAVED-VALUE
		Attribute nullValueNode = node.attribute( "unsaved-value" );
		if ( nullValueNode != null ) {
			model.setNullValue( nullValueNode.getValue() );
		}
		else {
			model.setNullValue( "undefined" );
		}

	}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:13,代碼來源:HbmBinder.java

示例9: isCallable

import org.dom4j.Element; //導入方法依賴的package包/類
private static boolean isCallable(Element element, boolean supportsCallable)
		throws MappingException {
	Attribute attrib = element.attribute( "callable" );
	if ( attrib != null && "true".equals( attrib.getValue() ) ) {
		if ( !supportsCallable ) {
			throw new MappingException( "callable attribute not supported yet!" );
		}
		return true;
	}
	return false;
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:12,代碼來源:HbmBinder.java

示例10: replaceAll

import org.dom4j.Element; //導入方法依賴的package包/類
@Override
public Document replaceAll(Document document, Map<String, String> pro) {
  /**
   * <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");
    // System.out.println("屬性"+attribute.getName() +":" + attribute.getValue());
    String contentuid = attribute.getValue();
    // String text = e.getText();
    String newText = (String) pro.get(contentuid);
    if (newText != null && !"".equals(newText)) {
      e.setText(newText);
      // System.out.println(contentuid + "=" + text + "|" + newText);
      // System.out.println(contentuid + "=" + newText);
    }
  }
  return document;
}
 
開發者ID:SvenAugustus,項目名稱:Divinity_Original_Sin_2_zhCN,代碼行數:29,代碼來源:DOS2Replace.java

示例11: getMatcher

import org.dom4j.Element; //導入方法依賴的package包/類
private Matcher getMatcher(Element element) throws FilterException {
	// These will be either BugCode, Method, or Or elements.
	String name = element.getName();
	if (name.equals("BugCode")) {
		return new BugCodeMatcher(element.valueOf("@name"));
	} else if (name.equals("Method")) {
		Attribute nameAttr = element.attribute("name");
		Attribute paramsAttr = element.attribute("params");
		Attribute returnsAttr = element.attribute("returns");

		if (nameAttr == null)
			throw new FilterException("Missing name attribute in Method element");

		if ((paramsAttr != null || returnsAttr != null) && (paramsAttr == null || returnsAttr == null))
			throw new FilterException("Method element must have both params and returns attributes if either is used");

		if (paramsAttr == null)
			return new MethodMatcher(nameAttr.getValue());
		else
			return new MethodMatcher(nameAttr.getValue(), paramsAttr.getValue(), returnsAttr.getValue());
	} else if (name.equals("Or")) {
		OrMatcher orMatcher = new OrMatcher();
		Iterator i = element.elementIterator();
		while (i.hasNext()) {
			orMatcher.addChild(getMatcher((Element) i.next()));
		}
		return orMatcher;
	} else
		throw new FilterException("Unknown element: " + name);
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:31,代碼來源:Filter.java

示例12: bindSimpleValue

import org.dom4j.Element; //導入方法依賴的package包/類
public static void bindSimpleValue(Element node, SimpleValue simpleValue, boolean isNullable,
		String path, Mappings mappings) throws MappingException {
	bindSimpleValueType( node, simpleValue, mappings );

	bindColumnsOrFormula( node, simpleValue, path, isNullable, mappings );

	Attribute fkNode = node.attribute( "foreign-key" );
	if ( fkNode != null ) simpleValue.setForeignKeyName( fkNode.getValue() );
}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:10,代碼來源:HbmBinder.java

示例13: makeIdentifier

import org.dom4j.Element; //導入方法依賴的package包/類
private static void makeIdentifier(Element node, SimpleValue model, Mappings mappings)
        throws MappingException {
	//GENERATOR

	Element subnode = node.element("generator");
	if ( subnode!=null ) {
		model.setIdentifierGeneratorStrategy( subnode.attributeValue("class") );

		Properties params = new Properties();

		if ( mappings.getSchemaName()!=null ) {
			params.setProperty( PersistentIdentifierGenerator.SCHEMA, mappings.getSchemaName() );
		}

		params.setProperty( PersistentIdentifierGenerator.TABLE, model.getTable().getName() );

		params.setProperty(
			PersistentIdentifierGenerator.PK,
			( (Column) model.getColumnIterator().next() ).getName()
		);

		Iterator iter = subnode.elementIterator("param");
		while( iter.hasNext() ) {
			Element childNode = (Element) iter.next();
			params.setProperty(
				childNode.attributeValue("name"),
				childNode.getText()
			);
		}

		model.setIdentifierGeneratorProperties(params);
	}

	model.getTable().setIdentifierValue(model);

	// ID UNSAVED-VALUE
	Attribute nullValueNode = node.attribute("unsaved-value");
	if (nullValueNode!=null) {
		model.setNullValue( nullValueNode.getValue() );
	}
	else {
		model.setNullValue("null");
	}
}
 
開發者ID:parabuild-ci,項目名稱:parabuild-ci,代碼行數:45,代碼來源:Binder.java

示例14: makeIdentifier

import org.dom4j.Element; //導入方法依賴的package包/類
private static void makeIdentifier(Element node, SimpleValue model, Mappings mappings) {

		// GENERATOR
		Element subnode = node.element( "generator" );
		if ( subnode != null ) {
			final String generatorClass = subnode.attributeValue( "class" );
			model.setIdentifierGeneratorStrategy( generatorClass );

			Properties params = new Properties();
			// YUCK!  but cannot think of a clean way to do this given the string-config based scheme
			params.put( PersistentIdentifierGenerator.IDENTIFIER_NORMALIZER, mappings.getObjectNameNormalizer() );

			if ( mappings.getSchemaName() != null ) {
				params.setProperty(
						PersistentIdentifierGenerator.SCHEMA,
						mappings.getObjectNameNormalizer().normalizeIdentifierQuoting( mappings.getSchemaName() )
				);
			}
			if ( mappings.getCatalogName() != null ) {
				params.setProperty(
						PersistentIdentifierGenerator.CATALOG,
						mappings.getObjectNameNormalizer().normalizeIdentifierQuoting( mappings.getCatalogName() )
				);
			}

			Iterator iter = subnode.elementIterator( "param" );
			while ( iter.hasNext() ) {
				Element childNode = (Element) iter.next();
				params.setProperty( childNode.attributeValue( "name" ), childNode.getTextTrim() );
			}

			model.setIdentifierGeneratorProperties( params );
		}

		model.getTable().setIdentifierValue( model );

		// ID UNSAVED-VALUE
		Attribute nullValueNode = node.attribute( "unsaved-value" );
		if ( nullValueNode != null ) {
			model.setNullValue( nullValueNode.getValue() );
		}
		else {
			if ( "assigned".equals( model.getIdentifierGeneratorStrategy() ) ) {
				model.setNullValue( "undefined" );
			}
			else {
				model.setNullValue( null );
			}
		}
	}
 
開發者ID:lamsfoundation,項目名稱:lams,代碼行數:51,代碼來源:HbmBinder.java

示例15: initialise

import org.dom4j.Element; //導入方法依賴的package包/類
public void initialise(Element element, NamespacePrefixResolver nspr, PermissionModel permissionModel)
{
    super.initialise(element, nspr, permissionModel);
    
    Attribute att = element.attribute(EXPOSE);
    if (att != null)
    {
        isExposed = Boolean.parseBoolean(att.getStringValue());
    }
    else
    {
        isExposed = true;
    }
    
    att = element.attribute(REQUIRES_TYPE);
    if (att != null)
    {
        requiresType = Boolean.parseBoolean(att.getStringValue());
    }
    else
    {
        requiresType = true;
    }
    
    Attribute defaultPermissionAttribute = element.attribute(DEFAULT_PERMISSION);
    if(defaultPermissionAttribute != null)
    {
        if(defaultPermissionAttribute.getStringValue().equalsIgnoreCase(ALLOW))
        {
            defaultPermission = AccessStatus.ALLOWED;  
        }
        else if(defaultPermissionAttribute.getStringValue().equalsIgnoreCase(DENY))
        {
            defaultPermission = AccessStatus.DENIED;  
        }
        else
        {
            throw new PermissionModelException("The default permission must be deny or allow");
        }
    }
    else
    {
        defaultPermission = AccessStatus.DENIED;
    }
    
    for (Iterator gtgit = element.elementIterator(GRANTED_TO_GROUP); gtgit.hasNext(); /**/)
    {
        QName qName;
        Element grantedToGroupsElement = (Element) gtgit.next();
        Attribute typeAttribute = grantedToGroupsElement.attribute(GTG_TYPE);
        if (typeAttribute != null)
        {
            qName = QName.createQName(typeAttribute.getStringValue(), nspr);
        }
        else
        {
            qName = getTypeQName();
        }

        String grantedName = grantedToGroupsElement.attributeValue(GTG_NAME);
        
        grantedToGroups.add(PermissionReferenceImpl.getPermissionReference(qName, grantedName));
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:65,代碼來源:Permission.java


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