本文整理了Java中org.apache.abdera.model.Element.getLanguage()
方法的一些代码示例,展示了Element.getLanguage()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Element.getLanguage()
方法的具体详情如下:
包路径:org.apache.abdera.model.Element
类名称:Element
方法名:getLanguage
[英]Returns the value of this elements xml:lang
attribute or null if xml:lang
is undefined.
[中]返回此元素xml:lang
属性的值,如果xml:lang
未定义,则返回null。
代码示例来源:origin: org.apache.abdera/abdera-core
public String getLanguage() {
return internal.getLanguage();
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.abdera
public String getLanguage() {
return internal.getLanguage();
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
private static boolean needToWriteLang(Element element) {
String parentlang = null;
if (element.getParentElement() != null) {
Base parent = element.getParentElement();
parentlang =
parent instanceof Document ? ((Document)parent).getLanguage() : ((Element)parent).getLanguage();
}
String lang = element.getLanguage();
return (parentlang == null && lang != null) || (lang != null && parentlang != null && !parentlang
.equalsIgnoreCase(lang));
}
代码示例来源:origin: org.apache.abdera/abdera-parser
public String getLanguage() {
String lang = getAttributeValue(LANG);
Base parent = this.getParentElement();
return (lang != null) ? lang : (parent != null && parent instanceof Element) ? ((Element)parent).getLanguage()
: (parent != null && parent instanceof Document) ? ((Document)parent).getLanguage() : null;
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-json
private static void writeLanguageFields(Element element, JSONStream jstream) throws IOException {
if (needToWriteLang(element)) {
String lang = element.getLanguage();
jstream.writeField("lang", lang);
}
if (needToWriteDir(element)) {
Direction dir = BidiHelper.getDirection(element);
jstream.writeField("dir", dir.name().toLowerCase());
}
}
代码示例来源:origin: org.apache.abdera/abdera-extensions-main
/**
* Attempt to guess the base direction using the in-scope language. Implements the method used by Internet Explorer
* 7's feed view documented here:
* http://blogs.msdn.com/rssteam/archive/2007/05/17/reading-feeds-in-right-to-left-order.aspx. This algorithm
* differs slightly from the method documented in that the primary language tag is case insensitive. If the language
* tag is not specified, then the default Locale is used to determine the direction. According to the Atom Bidi
* spec, if the dir attribute is set explicitly, we should not do language guessing. This restriction can be
* bypassed by setting ignoredir to true.
*/
public static <T extends Element> Direction guessDirectionFromLanguage(T element, boolean ignoredir) {
if (!ignoredir && hasDirection(element))
return getDirection(element);
String language = element.getLanguage();
Lang lang = language != null ? new Lang(language) : new Lang(Locale.getDefault());
return Bidi.guessDirectionFromLanguage(lang);
}
内容来源于网络,如有侵权,请联系作者删除!