當前位置: 首頁>>代碼示例>>Java>>正文


Java Xml.parse方法代碼示例

本文整理匯總了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("+", "&#43;");
    Xml.parse(xmlStr, handler);
    return handler.getPhotos();
  } catch (SAXException e) {
    Log.e("Photo", e.getMessage(), e);
  }
  return new ArrayList<Photo>();
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:23,代碼來源:Photo.java

示例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>();
}
 
開發者ID:sdrausty,項目名稱:buildAPKsSamples,代碼行數:14,代碼來源:Album.java

示例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);
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:21,代碼來源:HostInfoParser.java

示例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);
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:20,代碼來源:VersionInfoParser.java

示例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);
    }

}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:21,代碼來源:MessageCountParser.java

示例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);
    }

}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:20,代碼來源:ResultsParser.java

示例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);
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:20,代碼來源:TransfersParser.java

示例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);
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:20,代碼來源:ProjectsParser.java

示例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);
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:19,代碼來源:AppsParser.java

示例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>");
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:23,代碼來源:CcStatusParser.java

示例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);
    }

}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:21,代碼來源:SimpleReplyParser.java

示例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);
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:20,代碼來源:WorkunitsParser.java

示例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);
    }

}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:21,代碼來源:CcStateParser.java

示例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 "";
    }
}
 
開發者ID:palo-m,項目名稱:androboinc,代碼行數:12,代碼來源:RpcRequestParser.java

示例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();
}
 
開發者ID:JackChan1999,項目名稱:boohee_v5.6,代碼行數:6,代碼來源:g.java


注:本文中的android.util.Xml.parse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。