本文整理汇总了Java中android.util.Xml.parse方法的典型用法代码示例。如果您正苦于以下问题:Java Xml.parse方法的具体用法?Java Xml.parse怎么用?Java Xml.parse使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.util.Xml
的用法示例。
在下文中一共展示了Xml.parse方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseFromPicasaXml
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parses photos XML (a list of photo; the contents of an album).
*
* @param xmlStr
* the photo XML
* @return a list of {@link Photo}s
*/
public static List<Photo> parseFromPicasaXml(String xmlStr) {
PicasaPhotosSaxHandler handler = new PicasaPhotosSaxHandler();
try {
// The Parser somehow has some trouble with a plus sign in the
// content. This is a hack to fix this.
// TODO: Maybe we should replace all these special characters with
// XML entities?
xmlStr = xmlStr.replace("+", "+");
Xml.parse(xmlStr, handler);
return handler.getPhotos();
} catch (SAXException e) {
Log.e("Photo", e.getMessage(), e);
}
return new ArrayList<Photo>();
}
示例2: parseFromPicasaXml
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parses Picasa albums XML and returns a list of albums.
*/
public static List<Album> parseFromPicasaXml(String xmlStr) {
PicasaAlbumsSaxHandler handler = new PicasaAlbumsSaxHandler();
try {
Xml.parse(xmlStr, handler);
return handler.getAlbums();
} catch (SAXException e) {
Log.e(TAG, e.getMessage(), e);
}
return new ArrayList<Album>();
}
示例3: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (host_info)
*
* @param rpcResult String returned by RPC call of core client
* @return HostInfo
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
* or does not contain valid {@code <host_info>} tag
*/
public static HostInfo parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
HostInfoParser parser = new HostInfoParser();
Xml.parse(rpcResult, parser);
return parser.getHostInfo();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <host_info>", e);
}
}
示例4: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (version_info)
*
* @param rpcResult String returned by RPC call of core client
* @return VersionInfo (of core client)
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static VersionInfo parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
VersionInfoParser parser = new VersionInfoParser();
Xml.parse(rpcResult, parser);
return parser.getVersionInfo();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <server_version>", e);
}
}
示例5: getSeqno
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (seqno) and generate corresponding vector
*
* @param rpcResult String returned by RPC call of core client
* @return number of messages
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static int getSeqno(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
MessageCountParser parser = new MessageCountParser();
Xml.parse(rpcResult, parser);
return parser.seqno();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <seqno>", e);
}
}
示例6: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (results) and generate vector of results info
*
* @param rpcResult String returned by RPC call of core client
* @return vector of results info
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static Vector<Result> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
ResultsParser parser = new ResultsParser();
Xml.parse(rpcResult, parser);
return parser.getResults();
} catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <results>", e);
}
}
示例7: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (file_transfers) and generate vector of transfers info
*
* @param rpcResult String returned by RPC call of core client
* @return vector of projects info
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static Vector<Transfer> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
TransfersParser parser = new TransfersParser();
Xml.parse(rpcResult, parser);
return parser.getTransfers();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <file_transfers>", e);
}
}
示例8: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (projects) and generate vector of projects info
*
* @param rpcResult String returned by RPC call of core client
* @return vector of projects info
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static Vector<Project> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
ProjectsParser parser = new ProjectsParser();
Xml.parse(rpcResult, parser);
return parser.getProjects();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <project>", e);
}
}
示例9: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (app) and generate vector of app
*
* @param rpcResult String returned by RPC call of core client
* @return vector of app
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static Vector<App> parse(String rpcResult) throws InvalidDataReceivedException {
try {
AppsParser parser = new AppsParser();
Xml.parse(rpcResult, parser);
return parser.getApps();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <app>", e);
}
}
示例10: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (cc_status)
* @param rpcResult String returned by RPC call of core client
* @return CcStatus
* @throws RpcClientFailedException in case of error:
* <ul>
* <li>{@link AuthorizationFailedException} in case of unauthorized</li>
* <li>{@link InvalidDataReceivedException} in case XML cannot be parsed
* or does not contain valid {@code <cc_status>} tag</li>
* </ul>
*/
public static CcStatus parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
CcStatusParser parser = new CcStatusParser();
Xml.parse(rpcResult, parser);
return parser.getCcStatus();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <cc_status>");
}
}
示例11: isSuccess
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result of command
*
* @param rpcResult String returned by RPC call of core client
* @return true in case of {@code <success/>}, false in case of {@code <failure/>}
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static boolean isSuccess(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
SimpleReplyParser parser = new SimpleReplyParser();
Xml.parse(rpcResult, parser);
return parser.result();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing simple reply", e);
}
}
示例12: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (workunit) and generate corresponding vector
*
* @param rpcResult String returned by RPC call of core client
* @return vector of workunits
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static Vector<Workunit> parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
WorkunitsParser parser = new WorkunitsParser();
Xml.parse(rpcResult, parser);
return parser.getWorkunits();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <workunits>", e);
}
}
示例13: parse
import android.util.Xml; //导入方法依赖的package包/类
/**
* Parse the RPC result (state) and generate vector of projects info
*
* @param rpcResult String returned by RPC call of core client
* @return connected client state
* @throws AuthorizationFailedException in case of unauthorized
* @throws InvalidDataReceivedException in case XML cannot be parsed
*/
public static CcState parse(String rpcResult) throws AuthorizationFailedException, InvalidDataReceivedException {
try {
CcStateParser parser = new CcStateParser();
Xml.parse(rpcResult, parser);
return parser.getCcState();
}
catch (SAXException e) {
if (BuildConfig.DEBUG) Log.d(TAG, "Malformed XML:\n" + rpcResult);
throw new InvalidDataReceivedException("Malformed XML while parsing <cc_state>", e);
}
}
示例14: parse
import android.util.Xml; //导入方法依赖的package包/类
public static String parse(String rpcRequest) {
try {
RpcRequestParser parser = new RpcRequestParser();
Xml.parse(rpcRequest, parser);
return parser.mRequest;
}
catch (SAXException e) {
Log.d(TAG, "Malformed XML:\n" + rpcRequest);
return "";
}
}
示例15: a
import android.util.Xml; //导入方法依赖的package包/类
public HashMap<String, Object> a(String str) {
Object aVar = new a();
Xml.parse(str, aVar);
return aVar.a();
}