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


Java Attribute类代码示例

本文整理汇总了Java中org.dom4j.Attribute的典型用法代码示例。如果您正苦于以下问题:Java Attribute类的具体用法?Java Attribute怎么用?Java Attribute使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: element2Map

import org.dom4j.Attribute; //导入依赖的package包/类
/**
 * Element to map
 * @param e
 * @param map
 */
public static void element2Map(Element e, Map<String, Object> map) {
    List<Object> list = e.elements();
    if (e.attributeCount() > 0) {
        for (Object attri : e.attributes()) {
            Attribute at = (Attribute)attri;
            map.put(at.getName(), at.getValue());
        }
    }
    if (list.size() < 1 && DataUtil.isEmpty(e.getText())) {
        return;
    } else if (list.size() < 1 && !DataUtil.isEmpty(e.getText())) {
        map.put("text", e.getText());
    }
    for (Object aList : list) {
        Element iter = (Element)aList;
        Map<String, Object> cMap = new HashMap<String, Object>();
        element2Map(iter, cMap);
        map.put(iter.getName(), cMap);
    }
}
 
开发者ID:iBase4J,项目名称:iBase4J-Common,代码行数:26,代码来源:XmlUtil.java

示例2: element2Map

import org.dom4j.Attribute; //导入依赖的package包/类
/**
 * Element to map
 * 
 * @param e
 * @return
 */
public static void element2Map(Element e, Map<String, Object> map) {
	List<Object> list = e.elements();
	if (e.attributeCount() > 0) {
		for (Object attri : e.attributes()) {
			Attribute at = (Attribute) attri;
			map.put(at.getName(), at.getValue());
		}
	}
	if (list.size() < 1 && DataUtil.isEmpty(e.getText())) {
		return;
	} else if (list.size() < 1 && !DataUtil.isEmpty(e.getText())) {
		map.put("text", e.getText());
	}
	for (Object aList : list) {
		Element iter = (Element) aList;
		Map<String, Object> cMap = new HashMap<String, Object>();
		element2Map(iter, cMap);
		map.put(iter.getName(), cMap);
	}
}
 
开发者ID:guokezheng,项目名称:automat,代码行数:27,代码来源:XmlUtil.java

示例3: getOptimisticLockMode

import org.dom4j.Attribute; //导入依赖的package包/类
private static int getOptimisticLockMode(Attribute olAtt) throws MappingException {
	
	if (olAtt==null) return Versioning.OPTIMISTIC_LOCK_VERSION;
	String olMode = olAtt.getValue();
	if ( olMode==null || "version".equals(olMode) ) {
		return Versioning.OPTIMISTIC_LOCK_VERSION;
	}
	else if ( "dirty".equals(olMode) ) {
		return Versioning.OPTIMISTIC_LOCK_DIRTY;
	}
	else if ( "all".equals(olMode) ) {
		return Versioning.OPTIMISTIC_LOCK_ALL;
	}
	else if ( "none".equals(olMode) ) {
		return Versioning.OPTIMISTIC_LOCK_NONE;
	}
	else {
		throw new MappingException("Unsupported optimistic-lock style: " + olMode);
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:21,代码来源:Binder.java

示例4: init

import org.dom4j.Attribute; //导入依赖的package包/类
public void init (Document  schemaDoc) {
	rootElement = schemaDoc.getRootElement();
	
	if (rootElement == null) {
		prtln ("SchemaProps ERROR: rootElement not found");
		return;
	}
	
	setProp ("namespace", rootElement.getNamespace());
	
	setDefaultProps ();
	
	for (Iterator i=rootElement.attributeIterator();i.hasNext();) {
		Attribute att = (Attribute)i.next();
		setProp (att.getName(), att.getValue());
	}
}
 
开发者ID:NCAR,项目名称:joai-project,代码行数:18,代码来源:SchemaProps.java

示例5: bindColumn

import org.dom4j.Attribute; //导入依赖的package包/类
public static void bindColumn(Element node, Column model, boolean isNullable) {
	Attribute lengthNode = node.attribute("length");
	if (lengthNode!=null) model.setLength( Integer.parseInt( lengthNode.getValue() ) );
	Attribute nullNode = node.attribute("not-null");
	model.setNullable( (nullNode!=null) ?
		!StringHelper.booleanValue( nullNode.getValue() ) :
		isNullable
	);
	Attribute unqNode = node.attribute("unique");
	model.setUnique( unqNode!=null && StringHelper.booleanValue( unqNode.getValue() ) );
	model.setCheckConstraint( node.attributeValue("check") );
	//Attribute qtNode = node.attribute("quote");
	//model.setQuoted( qtNode!=null && StringHelper.booleanValue( qtNode.getValue() ) );
	Attribute typeNode = node.attribute("sql-type");
	model.setSqlType( (typeNode==null) ? null : typeNode.getValue() );
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:17,代码来源:Binder.java

示例6: updateElement

import org.dom4j.Attribute; //导入依赖的package包/类
/**
 * Update the attributes of element
 *
 * @param element
 * @param properties
 */
private static void updateElement(Element element, Map<String, String> properties) {
    for (Map.Entry<String, String> entry : properties.entrySet()) {
        String key = entry.getKey();
        if (key.startsWith("tools:")) {
            continue;
        }
        String keyNoPrefix = key;
        String[] values = StringUtils.split(key, ":");
        if (values.length > 1) {
            keyNoPrefix = values[1];
        }
        if (null == entry.getValue()) {
            continue;
        } else {
            Attribute attribute = element.attribute(keyNoPrefix);
            if (null != attribute) {
                attribute.setValue(entry.getValue());
            } else {
                element.addAttribute(key, entry.getValue());
            }
        }
    }
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:30,代码来源:ManifestFileUtils.java

示例7: getVersionName

import org.dom4j.Attribute; //导入依赖的package包/类
/**
 * Update the plug-in's minSdkVersion and targetSdkVersion
 *
 * @param androidManifestFile
 * @throws IOException
 * @throws DocumentException
 */
public static String getVersionName(File androidManifestFile) throws IOException, DocumentException {
    SAXReader reader = new SAXReader();
    String versionName = "";
    if (androidManifestFile.exists()) {
        Document document = reader.read(androidManifestFile);// Read the XML file
        Element root = document.getRootElement();// Get the root node
        if ("manifest".equalsIgnoreCase(root.getName())) {
            List<Attribute> attributes = root.attributes();
            for (Attribute attr : attributes) {
                if (StringUtils.equalsIgnoreCase(attr.getName(), "versionName")) {
                    versionName = attr.getValue();
                }
            }
        }
    }
    return versionName;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:25,代码来源:ManifestFileUtils.java

示例8: getVersionCode

import org.dom4j.Attribute; //导入依赖的package包/类
public static String getVersionCode(File androidManifestFile) throws IOException, DocumentException {
    SAXReader reader = new SAXReader();
    String versionCode = "";
    if (androidManifestFile.exists()) {
        Document document = reader.read(androidManifestFile);// Read the XML file
        Element root = document.getRootElement();// Get the root node
        if ("manifest".equalsIgnoreCase(root.getName())) {
            List<Attribute> attributes = root.attributes();
            for (Attribute attr : attributes) {
                if (StringUtils.equalsIgnoreCase(attr.getName(), "versionCode")) {
                    versionCode = attr.getValue();
                }
            }
        }
    }
    return versionCode;
}
 
开发者ID:alibaba,项目名称:atlas,代码行数:18,代码来源:ManifestFileUtils.java

示例9: initOuterJoinFetchSetting

import org.dom4j.Attribute; //导入依赖的package包/类
private static void initOuterJoinFetchSetting(Element node, Fetchable model) {
	Attribute jfNode = node.attribute("outer-join");
	if ( jfNode==null ) {
		model.setOuterJoinFetchSetting(OuterJoinLoader.AUTO);
	}
	else {
		String eoj = jfNode.getValue();
		if ( "auto".equals(eoj) ) {
			model.setOuterJoinFetchSetting(OuterJoinLoader.AUTO);
		}
		else {
			model.setOuterJoinFetchSetting(
				"true".equals(eoj) ? OuterJoinLoader.EAGER : OuterJoinLoader.LAZY
			);
		}
	}
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:Binder.java

示例10: getClassTableName

import org.dom4j.Attribute; //导入依赖的package包/类
private static String getClassTableName(
		PersistentClass model,
		Element node,
		String schema,
		String catalog,
		Table denormalizedSuperTable,
		Mappings mappings) {
	Attribute tableNameNode = node.attribute( "table" );
	String logicalTableName;
	String physicalTableName;
	if ( tableNameNode == null ) {
		logicalTableName = StringHelper.unqualify( model.getEntityName() );
		physicalTableName = getNamingStrategyDelegate( mappings ).determineImplicitPrimaryTableName(
				model.getEntityName(),
				model.getJpaEntityName()
		);
	}
	else {
		logicalTableName = tableNameNode.getValue();
		physicalTableName = getNamingStrategyDelegate( mappings ).toPhysicalTableName( logicalTableName );
	}
	mappings.addTableBinding( schema, catalog, logicalTableName, physicalTableName, denormalizedSuperTable );
	return physicalTableName;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:25,代码来源:HbmBinder.java

示例11: getOptimisticLockStyle

import org.dom4j.Attribute; //导入依赖的package包/类
private static OptimisticLockStyle getOptimisticLockStyle(Attribute olAtt) throws MappingException {
	if ( olAtt == null ) {
		return OptimisticLockStyle.VERSION;
	}

	final String olMode = olAtt.getValue();
	if ( olMode == null || "version".equals( olMode ) ) {
		return OptimisticLockStyle.VERSION;
	}
	else if ( "dirty".equals( olMode ) ) {
		return OptimisticLockStyle.DIRTY;
	}
	else if ( "all".equals( olMode ) ) {
		return OptimisticLockStyle.ALL;
	}
	else if ( "none".equals( olMode ) ) {
		return OptimisticLockStyle.NONE;
	}
	else {
		throw new MappingException( "Unsupported optimistic-lock style: " + olMode );
	}
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:23,代码来源:HbmBinder.java

示例12: process

import org.dom4j.Attribute; //导入依赖的package包/类
@Override
public <T> T process(T xml, Iterable<Effect> effects) throws XmlBuilderException {
    if (!canHandle(xml)) {
        throw new IllegalArgumentException("XML model is not supported");
    }
    final Node xmlNode = (Node) xml;
    final Dom4jNode<?> node;
    switch (xmlNode.getNodeType()) {
        case Node.DOCUMENT_NODE:
            node = new Dom4jDocument((Document) xmlNode);
            break;
        case Node.ELEMENT_NODE:
            node = new Dom4jElement((Element) xmlNode);
            break;
        case Node.ATTRIBUTE_NODE:
            node = new Dom4jAttribute((Attribute) xmlNode);
            break;
        default:
            throw new IllegalArgumentException("XML node type is not supported");
    }
    final Navigator<Dom4jNode> navigator = new Dom4jNavigator(xmlNode);
    for (Effect effect : effects) {
        effect.perform(navigator, node);
    }
    return xml;
}
 
开发者ID:SimY4,项目名称:xpath-to-xml,代码行数:27,代码来源:Dom4jNavigatorSpi.java

示例13: toMap

import org.dom4j.Attribute; //导入依赖的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

示例14: writeAttributes

import org.dom4j.Attribute; //导入依赖的package包/类
protected void writeAttributes(Element element) throws IOException {
    for (int i = 0, size = element.attributeCount(); i < size; i++) {
        Attribute attribute = element.attribute(i);
           char quote = format.getAttributeQuoteCharacter();
           if (element.attributeCount() > 2) {
               writePrintln();
               indent();
               writer.write(format.getIndent());
           } else {
           	writer.write(" ");
           }
           writer.write(attribute.getQualifiedName());
           writer.write("=");
           writer.write(quote);
           writeEscapeAttributeEntities(attribute.getValue());
           writer.write(quote);
    }
}
 
开发者ID:Jenner4S,项目名称:unitimes,代码行数:19,代码来源:LowercaseTableNames.java

示例15: bindSimpleValue

import org.dom4j.Attribute; //导入依赖的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


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