本文整理匯總了Java中org.jdom.Element.getNamespace方法的典型用法代碼示例。如果您正苦於以下問題:Java Element.getNamespace方法的具體用法?Java Element.getNamespace怎麽用?Java Element.getNamespace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.jdom.Element
的用法示例。
在下文中一共展示了Element.getNamespace方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: isMyType
import org.jdom.Element; //導入方法依賴的package包/類
/**
* Indicates if a JDom document is an RSS instance that can be parsed with the parser.
* <p/>
* It checks for RDF ("http://www.w3.org/1999/02/22-rdf-syntax-ns#") and
* RSS ("http://purl.org/rss/1.0/") namespaces being defined in the root element.
*
* @param document document to check if it can be parsed with this parser implementation.
* @return <b>true</b> if the document is RSS1., <b>false</b> otherwise.
*/
public boolean isMyType(Document document) {
boolean ok = false;
Element rssRoot = document.getRootElement();
Namespace defaultNS = rssRoot.getNamespace();
List additionalNSs = rssRoot.getAdditionalNamespaces();
ok = defaultNS!=null && defaultNS.equals(getRDFNamespace());
if (ok) {
if (additionalNSs==null) {
ok = false;
}
else {
ok = false;
for (int i=0;!ok && i<additionalNSs.size();i++) {
ok = getRSSNamespace().equals(additionalNSs.get(i));
}
}
}
return ok;
}
示例2: isMyType
import org.jdom.Element; //導入方法依賴的package包/類
public boolean isMyType(Document document) {
boolean ok = false;
Element rssRoot = document.getRootElement();
Namespace defaultNS = rssRoot.getNamespace();
List additionalNSs = rssRoot.getAdditionalNamespaces();
ok = defaultNS!=null && defaultNS.equals(getRDFNamespace());
if (ok) {
if (additionalNSs==null) {
ok = false;
}
else {
ok = false;
for (int i=0;!ok && i<additionalNSs.size();i++) {
ok = getRSSNamespace().equals(additionalNSs.get(i));
}
}
}
return ok;
}
示例3: parseSearchResult
import org.jdom.Element; //導入方法依賴的package包/類
private LyricsInfo parseSearchResult(String xml) throws Exception {
SAXBuilder builder = new SAXBuilder();
Document document = builder.build(new StringReader(xml));
Element root = document.getRootElement();
Namespace ns = root.getNamespace();
String lyric = StringUtils.trimToNull(root.getChildText("Lyric", ns));
String song = root.getChildText("LyricSong", ns);
String artist = root.getChildText("LyricArtist", ns);
return new LyricsInfo(lyric, artist, song);
}
示例4: isMyType
import org.jdom.Element; //導入方法依賴的package包/類
public boolean isMyType(Document document) {
Element rssRoot = document.getRootElement();
Namespace defaultNS = rssRoot.getNamespace();
boolean ok = defaultNS!=null && defaultNS.equals(getRSSNamespace());
if (ok) {
ok = super.isMyType(document);
}
return ok;
}
示例5: isMyType
import org.jdom.Element; //導入方法依賴的package包/類
public boolean isMyType(Document document) {
Element rssRoot = document.getRootElement();
Namespace defaultNS = rssRoot.getNamespace();
return (defaultNS!=null) && defaultNS.equals(getAtomNamespace());
}