yweathernamespacecontext.java
来自「yahoo 所使用的 天气预报的解析代码」· Java 代码 · 共 39 行
JAVA
39 行
/*
* YWeatherNamespaceContext.java
*
* Created on May 25, 2007, 2:34 PM
*
*/
package yweatherbeta;
import java.util.Iterator;
import javax.xml.XMLConstants;
import javax.xml.namespace.NamespaceContext;
/**
*
* @author BEN
*/
public class YWeatherNamespaceContext implements NamespaceContext {
public String getNamespaceURI(String prefix) {
if (prefix == null) throw new NullPointerException("Null prefix");
else if ("yweather".equals(prefix)) return "http://xml.weather.yahoo.com/ns/rss/1.0";
else if ("geo".equals(prefix)) return "http://www.w3.org/2003/01/geo/wgs84_pos#";
else if ("xml".equals(prefix)) return XMLConstants.XML_NS_URI;
return XMLConstants.NULL_NS_URI;
}
// This method isn't necessary for XPath processing.
public String getPrefix(String uri) {
throw new UnsupportedOperationException();
}
// This method isn't necessary for XPath processing either.
public Iterator getPrefixes(String uri) {
throw new UnsupportedOperationException();
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?