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


Java Element.getAttributeValue方法代码示例

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


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

示例1: parseContent

import org.jdom.Element; //导入方法依赖的package包/类
private Content parseContent(Element e) {
    String value = null;
    String type = e.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    type = (type!=null) ? type : "text/plain";
    String mode = e.getAttributeValue("mode");//getAtomNamespace())); DONT KNOW WHY DOESN'T WORK
    if (mode == null) {
        mode = Content.XML; // default to xml content
    }
    if (mode.equals(Content.ESCAPED)) {
        // do nothing XML Parser took care of this
        value = e.getText();
    }
    else
    if (mode.equals(Content.BASE64)) {
            value = Base64.decode(e.getText());
    }
    else
    if (mode.equals(Content.XML)) {
        XMLOutputter outputter = new XMLOutputter();
        List eContent = e.getContent();
        Iterator i = eContent.iterator();
        while (i.hasNext()) {
            org.jdom.Content c = (org.jdom.Content) i.next();
            if (c instanceof Element) {
                Element eC = (Element) c;
                if (eC.getNamespace().equals(getAtomNamespace())) {
                    ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
                }
            }
        }
        value = outputter.outputString(eContent);
    }

    Content content = new Content();
    content.setType(type);
    content.setMode(mode);
    content.setValue(value);
    return content;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:40,代码来源:Atom03Parser.java

示例2: parseContent

import org.jdom.Element; //导入方法依赖的package包/类
private Content parseContent(Element e) {
    String value = null;
    String src = e.getAttributeValue("src");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    String type = e.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    type = (type!=null) ? type : Content.TEXT;
    if (type.equals(Content.TEXT)) {
        // do nothing XML Parser took care of this
        value = e.getText();
    }
    else if (type.equals(Content.HTML)) {
        value = e.getText();
    }
    else if (type.equals(Content.XHTML)) {
        XMLOutputter outputter = new XMLOutputter();
        List eContent = e.getContent();
        Iterator i = eContent.iterator();
        while (i.hasNext()) {
            org.jdom.Content c = (org.jdom.Content) i.next();
            if (c instanceof Element) {
                Element eC = (Element) c;
                if (eC.getNamespace().equals(getAtomNamespace())) {
                    ((Element)c).setNamespace(Namespace.NO_NAMESPACE);
                }
            }
        }
        value = outputter.outputString(eContent);
    }
           
    Content content = new Content();
    content.setSrc(src);
    content.setType(type);
    content.setValue(value);
    return content;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:35,代码来源:Atom10Parser.java

示例3: createService

import org.jdom.Element; //导入方法依赖的package包/类
@Override
public GoogleAccountsService createService(final HttpServletRequest request) {
    final String relayState = request.getParameter(SamlProtocolConstants.PARAMETER_SAML_RELAY_STATE);

    final String xmlRequest = this.googleSaml20ObjectBuilder.decodeSamlAuthnRequest(
            request.getParameter(SamlProtocolConstants.PARAMETER_SAML_REQUEST));

    if (StringUtils.isBlank(xmlRequest)) {
        LOGGER.trace("SAML AuthN request not found in the request");
        return null;
    }

    final Document document = this.googleSaml20ObjectBuilder.constructDocumentFromXml(xmlRequest);
    if (document == null) {
        return null;
    }

    final Element root = document.getRootElement();
    final String assertionConsumerServiceUrl = root.getAttributeValue("AssertionConsumerServiceURL");
    final String requestId = root.getAttributeValue("ID");
    final GoogleAccountsService s = new GoogleAccountsService(assertionConsumerServiceUrl, relayState, requestId);
    s.setLoggedOutAlready(true);
    return s;
}
 
开发者ID:mrluo735,项目名称:cas-5.1.0,代码行数:25,代码来源:GoogleAccountsServiceFactory.java

示例4: parseCategory

import org.jdom.Element; //导入方法依赖的package包/类
private Category parseCategory(URL baseURI, Element eCategory) {
    Category category = new Category();
    String att = eCategory.getAttributeValue("term");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        category.setTerm(att);
    }
    att = eCategory.getAttributeValue("scheme");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        category.setScheme(resolveURI(baseURI, eCategory, att));
    }
    att = eCategory.getAttributeValue("label");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        category.setLabel(att);
    }
    return category;

}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:18,代码来源:Atom10Parser.java

示例5: determineCollectionElementType

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * Given a single-argument method whose parameter is a {@link Collection}, use
 * the method's generic type information to determine the collection element
 * type and store it as the ITEM_CLASS_NAME attribute of the given Element.
 * 
 * @param method
 *          the setter method
 * @param paramElt
 *          the PARAMETER element
 */
private void determineCollectionElementType(AnnotatedElement method,
    Type paramType, Element paramElt) {
  if(paramElt.getAttributeValue("ITEM_CLASS_NAME") == null) {
    Class<?> elementType;
    CreoleParameter paramAnnot = method.getAnnotation(CreoleParameter.class);
    if(paramAnnot != null
        && paramAnnot.collectionElementType() != CreoleParameter.NoElementType.class) {
      elementType = paramAnnot.collectionElementType();
    } else {
      elementType = findCollectionElementType(paramType);
    }
    if(elementType != null) {
      paramElt.setAttribute("ITEM_CLASS_NAME", elementType.getName());
    }
  }
}
 
开发者ID:GateNLP,项目名称:gate-core,代码行数:27,代码来源:CreoleAnnotationHandler.java

示例6: parseLinks

import org.jdom.Element; //导入方法依赖的package包/类
private List parseLinks(List eLinks,boolean alternate) {
    List links = new ArrayList();
    for (int i=0;i<eLinks.size();i++) {
        Element eLink = (Element) eLinks.get(i);
        //Namespace ns = getAtomNamespace();
        String rel = eLink.getAttributeValue("rel");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
        if (alternate) {
            if ("alternate".equals(rel)) {
                links.add(parseLink(eLink));
            }
        }
        else {
            if (!("alternate".equals(rel))) {
                links.add(parseLink(eLink));
            }
        }
    }
    return (links.size()>0) ? links : null;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:20,代码来源:Atom03Parser.java

示例7: loadState

import org.jdom.Element; //导入方法依赖的package包/类
@Override
public void loadState(final Element state) {
    synchronized (lock) {
        queue.clear();

        for (Element element : state.getChildren(TAG_ENTITY)) {
            final String actionName = element.getAttributeValue(ATTR_ACTION);
            final String dateStr = element.getAttributeValue(ATTR_DATE);
            final String parameters = element.getAttributeValue(ATTR_NAME);

            if (actionName != null && dateStr != null) {
                try {
                    final ACTIONS action = ACTIONS.valueOf(actionName);
                    queue.add(new Entity(action, parameters, dateStr));
                } catch (IllegalArgumentException ignored) {
                }
            }
        }
        lock.notifyAll();
    }
}
 
开发者ID:AlexanderBartash,项目名称:hybris-integration-intellij-idea-plugin,代码行数:22,代码来源:DefaultStatsCollector.java

示例8: getChildMap

import org.jdom.Element; //导入方法依赖的package包/类
public static <K, V> Map<K, V> getChildMap(Element element, String name, boolean optional) throws StudyUnrecognizedFormatException {
  Element mapParent = getChildWithName(element, name, optional);
  if (mapParent != null) {
    Element map = mapParent.getChild(MAP);
    if (map != null) {
      HashMap result = new HashMap();
      for (Element entry : map.getChildren()) {
        Object key = entry.getAttribute(KEY) == null ? entry.getChild(KEY).getChildren().get(0) : entry.getAttributeValue(KEY);
        Object value = entry.getAttribute(VALUE) == null ? entry.getChild(VALUE).getChildren().get(0) : entry.getAttributeValue(VALUE);
        result.put(key, value);
      }
      return result;
    }
  }
  return Collections.emptyMap();
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:17,代码来源:StudySerializationUtils.java

示例9: parseItem

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * Parses an item element of an RSS document looking for item information.
 * <p/>
 * It first invokes super.parseItem and then parses and injects the description property if present.
 * <p/>
 *
 * @param rssRoot the root element of the RSS document in case it's needed for context.
 * @param eItem the item element to parse.
 * @return the parsed RSSItem bean.
 */
protected Item parseItem(Element rssRoot,Element eItem) {
    Item item = super.parseItem(rssRoot,eItem);
    Element e = eItem.getChild("description",getRSSNamespace());
    if (e!=null) {
        item.setDescription(parseItemDescription(rssRoot,e));
    }

    String uri = eItem.getAttributeValue("about", getRDFNamespace());
    if (uri != null) {
        item.setUri(uri);
    }

    return item;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:25,代码来源:RSS10Parser.java

示例10: hashSimpleElementForObject

import org.jdom.Element; //导入方法依赖的package包/类
private static void hashSimpleElementForObject(@NotNull Element suiteObjectElement, @NotNull String applicationName,
                                               Map<String, HashSet<String>> objectNameToApplicationNameListMap) {
  final String objectName = suiteObjectElement.getAttributeValue("name");
  final String code = suiteObjectElement.getAttributeValue("code");
  if (objectName == null || code == null) return;

  updateObjectNameSetForApplication(objectName, applicationName, objectNameToApplicationNameListMap);
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:9,代码来源:AppleScriptSystemDictionaryRegistryService.java

示例11: parseClassElement

import org.jdom.Element; //导入方法依赖的package包/类
private void parseClassElement(@NotNull String applicationName, @NotNull Element classElement, boolean isExtends) {
//    if isExtends -> name is always == "application"
    String className = isExtends ? classElement.getAttributeValue("extends") : classElement.getAttributeValue("name");
    String code = classElement.getAttributeValue("code");
    String pluralClassName = classElement.getAttributeValue("plural");
    if (className == null || code == null) return;
    pluralClassName = !StringUtil.isEmpty(pluralClassName) ? pluralClassName : className + "s";

    updateObjectNameSetForApplication(className, applicationName, applicationNameToClassNameSetMap);
    updateObjectNameSetForApplication(pluralClassName, applicationName, applicationNameToClassNamePluralSetMap);
    if (ApplicationDictionary.SCRIPTING_ADDITIONS_LIBRARY.equals(applicationName)) {
      updateApplicationNameSetFor(className, applicationName, stdClassNameToApplicationNameSetMap);
      updateApplicationNameSetFor(pluralClassName, applicationName, stdClassNamePluralToApplicationNameSetMap);
    }
  }
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:16,代码来源:AppleScriptSystemDictionaryRegistryService.java

示例12: parseChannel

import org.jdom.Element; //导入方法依赖的package包/类
protected WireFeed parseChannel(Element rssRoot) {
    Channel channel = (Channel) super.parseChannel(rssRoot);

    Element eChannel = rssRoot.getChild("channel", getRSSNamespace());
    String uri = eChannel.getAttributeValue("about", getRDFNamespace());
    if (uri != null) {
        channel.setUri(uri);
    }

    return channel;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:12,代码来源:RSS10Parser.java

示例13: getListCellRendererComponent

import org.jdom.Element; //导入方法依赖的package包/类
/**
 * @param list
 * @param value
 * @param index
 * @param isSelected
 * @param cellHasFocus
 * @return
 */
public Component getListCellRendererComponent( final JList list,
                                               final Object value,
                                               final int index,
                                               final boolean isSelected,
                                               boolean cellHasFocus ) {
    return new JPanel() {
        public void paintComponent( Graphics g ) {
            super.paintComponent( g );
            Element e = ( Element ) value;
            String title = e.getAttributeValue( "title" );
            String text = e.getText().trim();

            g.setColor( isSelected ? COLOR_SELECTED : index % 2 == 0 ? COLOR_EVEN : COLOR_ODD );
            g.fillRect( 0, 0, getWidth(), getHeight() );

            g.setColor( isSelected ? Color.WHITE : list.getForeground() );
            g.setFont( new Font( Font.SANS_SERIF, Font.BOLD, 12 ) );
            g.drawString( ( index + 1 ) + ". " + title, 5, 16 );
            g.setFont( new Font( Font.SANS_SERIF, Font.PLAIN, 12 ) );

            if ( text.indexOf( "\n" ) != -1 ) {
                text = text.substring( 0, text.indexOf( "\n" ) );
            }
            g.drawString( text, 20, 32 );
        }

        public Dimension getPreferredSize() {
            return new Dimension( 200, 40 );
        }
    };
}
 
开发者ID:jrana,项目名称:quicknotes,代码行数:40,代码来源:NoteListRenderer.java

示例14: setProperty

import org.jdom.Element; //导入方法依赖的package包/类
/**
     * setProperty inject
     *
     * @param element
     * @param o
     * @throws Exception
     */
    private void setProperty(Element element, Object o) throws Exception {
        for (Element property : (List<Element>) element.getChildren("property")) {
            String name = property.getAttributeValue("name");
            String bean = property.getAttributeValue("bean");
            //从beans.xml中根据id取到类的对象
            Object beanObj = this.getBean(bean);
//            System.out.println(beanObj);//[email protected]
            String methodName = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
            // 反射机制对方法进行调用,将对象在加载bean时就注入到环境上下文中
            Method m = o.getClass().getMethod(methodName, beanObj.getClass().getInterfaces()[0]);
            m.invoke(o, beanObj);
        }
    }
 
开发者ID:xujiajun,项目名称:tastjava,代码行数:21,代码来源:ClassPathXmlApplicationContext.java

示例15: parseLink

import org.jdom.Element; //导入方法依赖的package包/类
private Link parseLink(Feed feed , Entry entry, URL baseURI, Element eLink) {
    Link link = new Link();
    String att = eLink.getAttributeValue("rel");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setRel(att);
    }
    att = eLink.getAttributeValue("type");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setType(att);
    }
    att = eLink.getAttributeValue("href");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        if (isRelativeURI(att)) { //
            link.setHref(resolveURI(baseURI, eLink, ""));
        } else {
            link.setHref(att);
        }
    }
    att = eLink.getAttributeValue("hreflang");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setHreflang(att);
    }
    att = eLink.getAttributeValue("length");//getAtomNamespace()); DONT KNOW WHY DOESN'T WORK
    if (att!=null) {
        link.setLength(Long.parseLong(att));
    }
    return link;
}
 
开发者ID:parabuild-ci,项目名称:parabuild-ci,代码行数:29,代码来源:Atom10Parser.java


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