本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
}
}
示例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;
}
示例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();
}
示例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;
}
示例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);
}
示例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);
}
}
示例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;
}
示例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 );
}
};
}
示例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);
}
}
示例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;
}