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


Java Attribute.setValue方法代碼示例

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


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

示例1: 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

示例2: fillFullClazzName

import org.dom4j.Attribute; //導入方法依賴的package包/類
private static void fillFullClazzName(Element root, String packageName, String type) {
    List<? extends Node> applicatNodes = root.selectNodes("//" + type);
    for (Node node : applicatNodes) {
        Element element = (Element)node;
        Attribute attribute = element.attribute("name");
        if (attribute != null) {
            if (attribute.getValue().startsWith(".")) {
                attribute.setValue(packageName + attribute.getValue());
            }
        }
    }
}
 
開發者ID:alibaba,項目名稱:atlas,代碼行數:13,代碼來源:ManifestFileUtils.java

示例3: addJunctionConnection

import org.dom4j.Attribute; //導入方法依賴的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

示例4: writeResponse

import org.dom4j.Attribute; //導入方法依賴的package包/類
@Override
protected void writeResponse(InputStream input, OutputStream output)
    throws IOException
{
    if (response.getContentType().startsWith(MimetypeMap.MIMETYPE_ATOM) ||
        response.getContentType().startsWith(MimetypeMap.MIMETYPE_RSS))
    {
        // Only post-process ATOM and RSS feeds
        // Replace all navigation links with "proxied" versions
        SAXReader reader = new SAXReader();
        try
        {
            Document document = reader.read(input);
            Element rootElement = document.getRootElement();

            XPath xpath = rootElement.createXPath(ATOM_LINK_XPATH);
            Map<String,String> uris = new HashMap<String,String>();
            uris.put(ATOM_NS_PREFIX, ATOM_NS_URI);
            xpath.setNamespaceURIs(uris);

            List nodes = xpath.selectNodes(rootElement);
            Iterator iter = nodes.iterator();
            while (iter.hasNext())
            {
                Element element = (Element)iter.next();
                Attribute hrefAttr = element.attribute("href");
                String mimetype = element.attributeValue("type");
                if (mimetype == null || mimetype.length() == 0)
                {
                    mimetype = MimetypeMap.MIMETYPE_HTML;
                }
                String url = createUrl(engine, hrefAttr.getValue(), mimetype);
                if (url.startsWith("/"))
                {
                    url = rootPath + url;
                }
                hrefAttr.setValue(url);
            }
            
            OutputFormat outputFormat = OutputFormat.createPrettyPrint();
            XMLWriter writer = new XMLWriter(output, outputFormat);
            writer.write(rootElement);
            writer.flush();                
        }
        catch(DocumentException e)
        {
            throw new IOException(e.toString());
        }
    }
    else
    {
        super.writeResponse(input, output);
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:55,代碼來源:SearchProxy.java


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